akinomyoga / ble.sh

Bash Line Editor―a line editor written in pure Bash with syntax highlighting, auto suggestions, vim modes, etc. for Bash interactive sessions.
BSD 3-Clause "New" or "Revised" License
2.67k stars 85 forks source link

[Bash 3.2 in macOS] keymap 'emacs' is not defined. #33

Closed dylankb closed 4 years ago

dylankb commented 4 years ago

ble version:

3.0.0

Bash version:

I'm on MacOS and have installed bash via Homebrew

$ bash -c 'echo $BASH_VERSION' 
5.0.11(1)-release
$ echo $BASH_VERSION
3.2.57(1)-release

When I add follow the instructions for configuring bleh.sh with .bashrc (except that I'm using .bash_profile) I get an error.

usage: sleep seconds
$ ... ~ $ ble.sh: Failed to load the default keymap. keymap 'emacs' is not defined.

Use "logout" to leave the shell.

Oddly enough if I manually source /bleh.sh then bleh.sh does load the first time. If I start a new session and try to source again I'll get the same error.

Just wanted to add though that this is a cool project!

akinomyoga commented 4 years ago

Thank you very much for the report!

ble.sh: Failed to load the default keymap. keymap 'emacs' is not defined.

This error typically occurs when only ble.sh is copied during the installation and other related resources are not copied, in particular, when the file keymap/emacs.sh is not copied.

Question 1: Can you provide me the file tree of the directory where Homebrew installed the script file ble.sh? It should be something like the following tree.

blesh
|-- ble.sh
|-- cache.d
|-- keymap
|   |-- emacs.rlfunc.txt
|   |-- emacs.sh
|   |-- vi.sh
|   |-- vi_digraph.sh
|   |-- vi_digraph.txt
|   |-- vi_imap.rlfunc.txt
|   |-- vi_nmap.rlfunc.txt
|   `-- vi_test.sh
|-- lib
|   |-- core-complete.sh
|   |-- core-edit.ignoreeof-messages.txt
|   |-- core-syntax.sh
|   |-- init-bind.sh
|   |-- init-cmap.sh
|   |-- init-term.sh
|   |-- vim-arpeggio.sh
|   `-- vim-surround.sh
`-- tmp

I'm on MacOS and have installed bash via Homebrew

I don't have macOS so I don't have experience on Homebrew, but I suspect that the Homebrew formula that you used is broken.

Question 2: Where did you get Homebrew formula for ble.sh? Or did you define it by yourself? Could you provide me the details of the formula?

Oddly enough if I manually source /bleh.sh

Question 3: Where is that ble.sh located? Is it in the install directory by Homebrew? Or some downloaded version of ble.sh?

dylankb commented 4 years ago

Thanks for the quick reply!

This error typically occurs when only ble.sh is copied during the installation and other related resources are not copied, in particular, when the file keymap/emacs.sh is not copied.

Question 1: Can you provide me the file tree of the directory where Homebrew installed the script file ble.sh?

1) Sorry, if that wasn't clear but I installed bleh.sh manually via the curl/tar commands provided in the project readme - I only mentioned that I upgraded bash via Homebrew.

I do not seem to be missing the keymap/emacs.sh file. Here's the directory contents:

.
├── ble.sh
├── cache.d
│   └── 501
│       ├── ble-decode-bind.30257.UTF-8.bind
│       ├── ble-decode-bind.30257.UTF-8.unbind
│       ├── cmap+default.3.xterm-256color.dump
│       ├── keymap.emacs
│       └── xterm-256color.term
├── keymap
│   ├── emacs.rlfunc.txt
│   ├── emacs.sh
│   ├── vi.sh
│   ├── vi_digraph.sh
│   ├── vi_digraph.txt
│   ├── vi_imap.rlfunc.txt
│   ├── vi_nmap.rlfunc.txt
│   └── vi_test.sh
└── lib
    ├── core-complete.sh
    ├── core-edit.ignoreeof-messages.txt
    ├── core-syntax.sh
    ├── init-bind.sh
    ├── init-cmap.sh
    ├── init-term.sh
    └── vim-surround.sh

2) I have no knowledge of whether Homebrew has a bleh.sh recipe, and I didn't use one (see response to question 1 above).

3) I happened to install it at /Users/$MYUSER/Code/dev-tools/bleh-0.3.0/bleh.sh, but I'm guessing this is not especially interesting information unless I was having an issue pointing to the bleh.sh file in my bashrc or bash_profile file.

akinomyoga commented 4 years ago

I only mentioned that I upgraded bash via Homebrew.

Oh, I see. You have clearly written that you installed bash via Homebrew. I'm sorry it's just my mistake.

Here's the directory contents:

OK. It appears that the directory contents are correct.

Because I don't have macOS, I am trying to reproduce it in Linux with bash-3.2.57 and bash-5.0.7, but have not yet reproduced the problem. I would like to ask for your help. After the message "ble.sh: Failed to ... not defined.", can you type ble-edit/detach and hit Return/Enter?

...$ ble.sh: Failed to load the default keymap. keymap 'emacs' is not defined.
ble-edit/detach # <- Please input this text (though it will not show up).

The input command ble-edit/detach will not show up in the terminal but actually there it is. After the command, you can see the commands you input. Then I would like to know the results of the following commands. Could you provide me the results?

$ type ble-decode/DEFAULT_KEYMAP
$ declare -p _ble_decode_emacs_kmap_
$ ble/is-array _ble_decode_emacs_kmap_; echo $?

Edit: I'm also interested in the result of the following command. Can you check?

$ echo "$_ble_base_cache"
$ ls -ld "${XDG_CACHE_HOME:-$HOME/.cache}"
dylankb commented 4 years ago

I followed your instructions and entered ble-edit/detach and got an error that looked something like -bash:ble-decode is not .... Unfortunately I'm not sure if that's correct because when I entered the same command again it closed the session, losing the error text. Every time afterwards that I've entered ble-edit/detach after sourcing I get a different error message -bash: syntax error near unexpected token;.

From that state I ran the commands that you requested. Here's the output:

$ type ble-decode/DEFAULT_KEYMAP
ble-decode/DEFAULT_KEYMAP is a function
ble-decode/DEFAULT_KEYMAP ()
{
    local ret;
    bleopt/get:default_keymap;
    local defmap=$ret;
    if ble-edit/bind/load-keymap-definition "$defmap"; then
        if [[ $defmap == vi ]]; then
            builtin eval -- "$2=vi_imap";
        else
            builtin eval -- "$2=\$defmap";
        fi && ble-decode/keymap/is-keymap "${!2}" && return 0;
    fi;
    echo "ble.sh: The definition of the default keymap \"$bleopt_default_keymap\" is not found. ble.sh uses \"safe\" keymap instead.";
    ble-edit/bind/load-keymap-definition safe && builtin eval -- "$2=safe" && bleopt_default_keymap=safe
}
$ declare -p _ble_decode_emacs_kmap_
declare -- _ble_decode_emacs_kmap_="([0]=\"1:ble/widget/set-mark\" [8]=\"1:ble/widget/delete-region-or backward-char\" [9]=\"1:ble/widget/complete\" [13]=\"1:ble/widget/accept-single-line-or-newline\" [32]=\"1:ble/widget/magic-space\" [45]=\"1:ble/widget/emacs/append-arg\" [48]=\"1:ble/widget/emacs/append-arg\" [49]=\"1:ble/widget/emacs/append-arg\" [50]=\"1:ble/widget/emacs/append-arg\" [51]=\"1:ble/widget/emacs/append-arg\" [52]=\"1:ble/widget/emacs/append-arg\" [53]=\"1:ble/widget/emacs/append-arg\" [54]=\"1:ble/widget/emacs/append-arg\" [55]=\"1:ble/widget/emacs/append-arg\" [56]=\"1:ble/widget/emacs/append-arg\" [57]=\"1:ble/widget/emacs/append-arg\" [127]=\"1:ble/widget/delete-region-or backward-char\" [1114112]=\"1:ble/widget/batch-insert\" [1114113]=\"1:ble/widget/self-insert\" [1114115]=\"1:ble/widget/emacs/__before_widget__\" [1114116]=\"1:ble/widget/emacs/__after_widget__\" [1114117]=\"1:ble/widget/safe/__attach__\" [1114125]=\"1:ble/widget/overwrite-mode\" [1114126]=\"1:ble/widget/@nomarked beginning-of-line\" [1114128]=\"1:ble/widget/delete-region-or forward-char\" [1114129]=\"1:ble/widget/@nomarked end-of-line\" [1114131]=\"1:ble/widget/command-help\" [1114151]=\"1:ble/widget/emacs/bracketed-paste\" [1114153]=\"1:ble/widget/@nomarked backward-line history\" [1114154]=\"1:ble/widget/@nomarked forward-line history\" [1114155]=\"1:ble/widget/@nomarked forward-char\" [1114156]=\"1:ble/widget/@nomarked backward-char\" [1114158]=\"1:ble/widget/auto-complete-enter\" [34668558]=\"1:ble/widget/@marked beginning-of-line\" [34668561]=\"1:ble/widget/@marked end-of-line\" [34668585]=\"1:ble/widget/@marked backward-line\" [34668586]=\"1:ble/widget/@marked forward-line\" [34668587]=\"1:ble/widget/@marked forward-char\" [34668588]=\"1:ble/widget/@marked backward-char\" [67108872]=\"1:ble/widget/emacs/undo\" [67108873]=\"1:ble/widget/menu-complete\" [67108877]=\"1:ble/widget/accept-line\" [67108896]=\"1:ble/widget/set-mark\" [67108909]=\"1:ble/widget/emacs/append-arg\" [67108911]=\"1:ble/widget/emacs/undo\" [67108912]=\"1:ble/widget/emacs/append-arg\" [67108913]=\"1:ble/widget/emacs/append-arg\" [67108914]=\"1:ble/widget/emacs/append-arg\" [67108915]=\"1:ble/widget/emacs/append-arg\" [67108916]=\"1:ble/widget/emacs/append-arg\" [67108917]=\"1:ble/widget/emacs/append-arg\" [67108918]=\"1:ble/widget/emacs/append-arg\" [67108919]=\"1:ble/widget/emacs/append-arg\" [67108920]=\"1:ble/widget/emacs/append-arg\" [67108921]=\"1:ble/widget/emacs/append-arg\" [67108927]=\"1:ble/widget/delete-region-or backward-char\" [67108928]=\"1:ble/widget/set-mark\" [67108956]=\"1:ble/widget/bell\" [67108957]=\"1:ble/widget/bell\" [67108958]=\"1:ble/widget/bell\" [67108959]=\"1:ble/widget/emacs/undo\" [67108961]=\"1:ble/widget/@nomarked beginning-of-line\" [67108962]=\"1:ble/widget/@nomarked backward-char\" [67108963]=\"1:ble/widget/discard-line\" [67108964]=\"1:ble/widget/delete-region-or forward-char-or-exit\" [67108965]=\"1:ble/widget/@nomarked end-of-line\" [67108966]=\"1:ble/widget/@nomarked forward-char\" [67108967]=\"1:ble/widget/bell\" [67108968]=\"1:ble/widget/delete-region-or backward-char\" [67108969]=\"1:ble/widget/complete\" [67108970]=\"1:ble/widget/accept-line\" [67108971]=\"1:ble/widget/kill-forward-line\" [67108972]=\"1:ble/widget/clear-screen\" [67108973]=\"1:ble/widget/accept-single-line-or-newline\" [67108974]=\"1:ble/widget/@nomarked forward-line history\" [67108975]=\"1:ble/widget/accept-and-next\" [67108976]=\"1:ble/widget/@nomarked backward-line history\" [67108977]=\"1:ble/widget/emacs/quoted-insert\" [67108978]=\"1:ble/widget/history-isearch-backward\" [67108979]=\"1:ble/widget/history-isearch-forward\" [67108980]=\"1:ble/widget/transpose-chars\" [67108981]=\"1:ble/widget/kill-backward-line\" [67108982]=\"1:ble/widget/emacs/quoted-insert\" [67108983]=\"1:ble/widget/kill-region-or uword\" [67108984]=\"_\" [67108985]=\"1:ble/widget/yank\" [67108986]=\"1:ble/widget/.SHELL_COMMAND 'fg'\" [67108991]=\"1:ble/widget/emacs/undo\" [68222990]=\"1:ble/widget/@nomarked beginning-of-text\" [68222991]=\"1:ble/widget/history-beginning\" [68222992]=\"1:ble/widget/delete-forward-cword\" [68222993]=\"1:ble/widget/@nomarked end-of-text\" [68222994]=\"1:ble/widget/history-end\" [68223019]=\"1:ble/widget/@nomarked forward-cword\" [68223020]=\"1:ble/widget/@nomarked backward-cword\" [100663393]=\"1:ble/widget/@marked beginning-of-line\" [100663394]=\"1:ble/widget/@marked backward-char\" [100663397]=\"1:ble/widget/@marked end-of-line\" [100663398]=\"1:ble/widget/@marked forward-char\" [100663406]=\"1:ble/widget/@marked forward-line\" [100663408]=\"1:ble/widget/@marked backward-line\" [101777422]=\"1:ble/widget/@marked beginning-of-text\" [101777425]=\"1:ble/widget/@marked end-of-text\" [101777451]=\"1:ble/widget/@marked forward-cword\" [101777452]=\"1:ble/widget/@marked backward-cword\" [134217736]=\"1:ble/widget/copy-backward-sword\" [134217741]=\"1:ble/widget/newline\" [134217760]=\"1:ble/widget/set-mark\" [134217761]=\"1:ble/widget/complete context=command\" [134217764]=\"1:ble/widget/complete context=variable\" [134217767]=\"1:ble/widget/sabbrev-expand\" [134217770]=\"1:ble/widget/complete insert_all\" [134217773]=\"1:ble/widget/emacs/append-arg\" [134217775]=\"1:ble/widget/complete context=filename\" [134217776]=\"1:ble/widget/emacs/append-arg\" [134217777]=\"1:ble/widget/emacs/append-arg\" [134217778]=\"1:ble/widget/emacs/append-arg\" [134217779]=\"1:ble/widget/emacs/append-arg\" [134217780]=\"1:ble/widget/emacs/append-arg\" [134217781]=\"1:ble/widget/emacs/append-arg\" [134217782]=\"1:ble/widget/emacs/append-arg\" [134217783]=\"1:ble/widget/emacs/append-arg\" [134217784]=\"1:ble/widget/emacs/append-arg\" [134217785]=\"1:ble/widget/emacs/append-arg\" [134217788]=\"1:ble/widget/history-beginning\" [134217790]=\"1:ble/widget/history-end\" [134217791]=\"1:ble/widget/complete show_menu\" [134217792]=\"1:ble/widget/complete context=hostname\" [134217794]=\"1:ble/widget/@marked backward-cword\" [134217798]=\"1:ble/widget/@marked forward-cword\" [134217805]=\"1:ble/widget/@marked non-space-beginning-of-line\" [134217820]=\"1:ble/widget/delete-horizontal-space\" [134217822]=\"1:ble/widget/history-expand-line\" [134217826]=\"1:ble/widget/@nomarked backward-cword\" [134217828]=\"1:ble/widget/kill-forward-cword\" [134217830]=\"1:ble/widget/@nomarked forward-cword\" [134217831]=\"1:ble/widget/complete context=glob\" [134217832]=\"1:ble/widget/kill-backward-cword\" [134217836]=\"1:ble/widget/redraw-line\" [134217837]=\"1:ble/widget/@nomarked non-space-beginning-of-line\" [134217842]=\"1:ble/widget/emacs/revert\" [134217847]=\"1:ble/widget/copy-region-or uword\" [134217850]=\"1:ble/widget/.SHELL_COMMAND 'fg'\" [134217854]=\"1:ble/widget/complete context=username\" [134217855]=\"1:ble/widget/copy-backward-sword\" [135331856]=\"1:ble/widget/copy-forward-sword\" [135331883]=\"1:ble/widget/@nomarked forward-sword\" [135331884]=\"1:ble/widget/@nomarked backward-sword\" [167772258]=\"1:ble/widget/@marked backward-cword\" [167772262]=\"1:ble/widget/@marked forward-cword\" [167772269]=\"1:ble/widget/@marked non-space-beginning-of-line\" [168886315]=\"1:ble/widget/@marked forward-sword\" [168886316]=\"1:ble/widget/@marked backward-sword\" [201326655]=\"1:ble/widget/copy-backward-sword\" [201326695]=\"1:ble/widget/bell\" [201326696]=\"1:ble/widget/copy-backward-sword\" [201326701]=\"1:ble/widget/newline\")"
$ ble/is-array _ble_decode_emacs_kmap_; echo $?
1
$ echo "$_ble_base_cache"
/Users/dbarnard/Code/dev-tools/ble-0.3.0/./cache.d/501
$ ls -ld "${XDG_CACHE_HOME:-$HOME/.cache}"
ls: /Users/dbarnard/.cache: No such file or directory

Before I noted that after a fresh unzipping of the directory I'm able to source bleh.sh exactly once before subsequent sourcings return the emacs keymap error. Once thing I forgot to note is the first command post successful source always returns a ` prompt_command_array' error.

$ echo 'hello'
-bash: read: ` prompt_command_array': not a valid identifier
hello
$ echo 'again'
again
akinomyoga commented 4 years ago

Thank you very much for details! It seems there are several separate problems. I'm still trying to reproduce the problem, yet I haven't managed to reproduce the main problem.

About results

Every time ... I get a different error message

That's a puzzle... I don't have any idea what happens there. Maybe I need to take more time to investigate it.

$ type ble-decode/DEFAULT_KEYMAP

Thank you for the result! It seems that the definition of the function ble-decode/DEFAULT_KEYMAP is successfully loaded.

$ declare -p _ble_decode_emacs_kmap_
declare -- _ble_decode_emacs_kmap_=...

Yes! Here's a problem. Somehow the expected array attribute -a is missing for the shell variable _ble_decode_emacs_kmap_. But I'm not sure for now why it's missing. The other results are understandable.

prompt_command_array error

Once thing I forgot to note is the first command post successful source always returns a ` prompt_command_array' error.

Thank you for the report! I guess you are using bash-preexec.sh, and the error is caused by the interaction of bash-preexec.sh and ble.sh. It was a separate problem related to a bug of Bash 3.2. I added a workaround (see the next section for the update).

Next check

Before going to next step, I would like to ask you to update ble-0.3. Could you try the following command to update your ble.sh? And then please restart the Bash session.

$ ble-update

The update includes

Then, after the "Failed to load the default keymap" error, could you check the results of the following commands?

$ ... $ ble.sh: Failed to load the default keymap. keymap 'emacs' is not defined.
$ grep _emacs_ "$_ble_base_cache/keymap.emacs"
$ arr=(1 2 3)
$ declare -p arr | cat -A
$ ble/util/declare-print-definitions arr | cat -A
$ cat -A <<< $IFS
dylankb commented 4 years ago

Thank you for the report! I guess you are using bash-preexec.sh, and the error is caused by the interaction of bash-preexec.sh and ble.sh. It was a separate problem related to a bug of Bash 3.2.

Huh, that's interesting. My impression was that it would use my updated bash version. I'm unsure if I'm using bash-preexec.sh locally - I couldn't find anything with a fuzzy search. Not sure if it matters but I have an iTerm shell integration and some bash completion scripts.

Before going to next step, I would like to ask you to update ble-0.3.

I had to install gawk via Homebrew first, but once I did so I began to run into another error when running ble-update.

$ ble-update

mkdir -p out
DEPENDENCIES_PHONY=1 DEPENDENCIES_OUTPUT=out/ble.dep DEPENDENCIES_TARGET=out/ble.sh FULLVER=0.3.0 \
      /usr/local/bin/gawk -f ext/mwg_pp.awk ble.pp >/dev/null
mkdir -p out/keymap
cp -p keymap/emacs.sh out/keymap/emacs.sh
cp -p keymap/vi.sh out/keymap/vi.sh
cp -p keymap/vi_digraph.sh out/keymap/vi_digraph.sh
cp -p keymap/vi_digraph.txt out/keymap/vi_digraph.txt
cp -p keymap/vi_test.sh out/keymap/vi_test.sh
cp -p keymap/emacs.rlfunc.txt out/keymap/emacs.rlfunc.txt
cp -p keymap/vi_imap.rlfunc.txt out/keymap/vi_imap.rlfunc.txt
cp -p keymap/vi_nmap.rlfunc.txt out/keymap/vi_nmap.rlfunc.txt
mkdir -p out/lib
cp -p lib/init-term.sh out/lib/init-term.sh
cp -p lib/init-bind.sh out/lib/init-bind.sh
cp -p lib/core-complete.sh out/lib/core-complete.sh
/usr/local/bin/gawk -f ext/mwg_pp.awk lib/core-syntax.sh > out/lib/core-syntax.sh
cp -p lib/core-edit.ignoreeof-messages.txt out/lib/core-edit.ignoreeof-messages.txt
cp -p lib/init-cmap.sh out/lib/init-cmap.sh
cp -p lib/vim-surround.sh out/lib/vim-surround.sh
bash make_command.sh install "out/ble.sh" "/Users/dbarnard/Code/dev-tools/ble-0.3.0/ble.sh"
sed: 1: "1i# this script is a pa ...": command i expects \ followed by text
make: *** [/Users/dbarnard/Code/dev-tools/ble-0.3.0/ble.sh] Error 1
[ble: exit 2]
akinomyoga commented 4 years ago

I'm sorry for many troubles one after another. As I haven't tested ble.sh with macOS, there seem to be many troubles related to the differences between softwares, such as GNU awk vs new-awk, GNU sed vs BSD sed, etc. I fixed the problem of the update. Also I newly installed FreeBSD (which I think is closer to macOS environment than Linux) in my virtual machine, tested ble.sh, and fixed another problem.

I'm sorry, but I think ble-update is currently not available in your bash due to the installation failure. Could you try to update ble.sh by the following command?

$ cd /Users/dbarnard/Code/dev-tools/ble-0.3.0/ble.sh/src/ble.sh
$ git pull
$ make clean
$ make install INSDIR=../..

Then, if there is no problem, could you try the following commands (which were modified from the previous comment) in the new session?

$ ... $ ble.sh: Failed to load the default keymap. keymap 'emacs' is not defined.
$ grep _emacs_ "$_ble_base_cache/keymap.emacs"
$ arr=(1 2 3)
$ declare -p arr | cat -v
$ ble/util/declare-print-definitions arr | cat -v
$ cat -v <<< $IFS
akinomyoga commented 4 years ago

My impression was that it would use my updated bash version

Maybe you haven't yet noticed, but actually you are still using Bash 3.2.57 for login shells as your first post implies:

$ bash -c 'echo $BASH_VERSION' 
5.0.11(1)-release # <-- this is the version of Bash called from login shells
$ echo $BASH_VERSION
3.2.57(1)-release # <-- this is the version of Bash for login shells

So actually you can now switch to newly installed Bash to see if the problem persists, but to avoid the complication of the problem I would like to solve the problem in older Bash before going to the newer version.

I'm unsure if I'm using bash-preexec.sh locally .... I have an iTerm shell integration

I found that in fact iTerm2 shell-integration script contains embedded bash-preexec.sh.

dylankb commented 4 years ago

No worries at all - thanks for being so responsive on the issue.

Well I couldn't follow your instructions exactly, but the good news is that's because I no longer receive the "Failed to load the default keymap" type error. I ran the commands in case the output was still useful.

$ grep _emacs_ "$_ble_base_cache/keymap.emacs"
_ble_decode_emacs_kmap_=([0]="1:ble/widget/set-mark" [8]="1:ble/widget/delete-region-or backward-char" [9]="1:ble/widget/complete" [13]="1:ble/widget/accept-single-line-or-newline" [32]="1:ble/widget/magic-space" [45]="1:ble/widget/emacs/append-arg" [48]="1:ble/widget/emacs/append-arg" [49]="1:ble/widget/emacs/append-arg" [50]="1:ble/widget/emacs/append-arg" [51]="1:ble/widget/emacs/append-arg" [52]="1:ble/widget/emacs/append-arg" [53]="1:ble/widget/emacs/append-arg" [54]="1:ble/widget/emacs/append-arg" [55]="1:ble/widget/emacs/append-arg" [56]="1:ble/widget/emacs/append-arg" [57]="1:ble/widget/emacs/append-arg" [127]="1:ble/widget/delete-region-or backward-char" [1114112]="1:ble/widget/batch-insert" [1114113]="1:ble/widget/self-insert" [1114115]="1:ble/widget/emacs/__before_widget__" [1114116]="1:ble/widget/emacs/__after_widget__" [1114117]="1:ble/widget/safe/__attach__" [1114126]="1:ble/widget/overwrite-mode" [1114127]="1:ble/widget/@nomarked beginning-of-line" [1114129]="1:ble/widget/delete-region-or forward-char" [1114130]="1:ble/widget/@nomarked end-of-line" [1114132]="1:ble/widget/command-help" [1114152]="1:ble/widget/emacs/bracketed-paste" [1114154]="1:ble/widget/@nomarked backward-line history" [1114155]="1:ble/widget/@nomarked forward-line history" [1114156]="1:ble/widget/@nomarked forward-char" [1114157]="1:ble/widget/@nomarked backward-char" [1114159]="1:ble/widget/auto-complete-enter" [34668559]="1:ble/widget/@marked beginning-of-line" [34668562]="1:ble/widget/@marked end-of-line" [34668586]="1:ble/widget/@marked backward-line" [34668587]="1:ble/widget/@marked forward-line" [34668588]="1:ble/widget/@marked forward-char" [34668589]="1:ble/widget/@marked backward-char" [67108872]="1:ble/widget/emacs/undo" [67108873]="1:ble/widget/menu-complete" [67108877]="1:ble/widget/accept-line" [67108896]="1:ble/widget/set-mark" [67108909]="1:ble/widget/emacs/append-arg" [67108911]="1:ble/widget/emacs/undo" [67108912]="1:ble/widget/emacs/append-arg" [67108913]="1:ble/widget/emacs/append-arg" [67108914]="1:ble/widget/emacs/append-arg" [67108915]="1:ble/widget/emacs/append-arg" [67108916]="1:ble/widget/emacs/append-arg" [67108917]="1:ble/widget/emacs/append-arg" [67108918]="1:ble/widget/emacs/append-arg" [67108919]="1:ble/widget/emacs/append-arg" [67108920]="1:ble/widget/emacs/append-arg" [67108921]="1:ble/widget/emacs/append-arg" [67108927]="1:ble/widget/delete-region-or backward-char" [67108928]="1:ble/widget/set-mark" [67108956]="1:ble/widget/bell" [67108957]="1:ble/widget/bell" [67108958]="1:ble/widget/bell" [67108959]="1:ble/widget/emacs/undo" [67108961]="1:ble/widget/@nomarked beginning-of-line" [67108962]="1:ble/widget/@nomarked backward-char" [67108963]="1:ble/widget/discard-line" [67108964]="1:ble/widget/delete-region-or forward-char-or-exit" [67108965]="1:ble/widget/@nomarked end-of-line" [67108966]="1:ble/widget/@nomarked forward-char" [67108967]="1:ble/widget/bell" [67108968]="1:ble/widget/delete-region-or backward-char" [67108969]="1:ble/widget/complete" [67108970]="1:ble/widget/accept-line" [67108971]="1:ble/widget/kill-forward-line" [67108972]="1:ble/widget/clear-screen" [67108973]="1:ble/widget/accept-single-line-or-newline" [67108974]="1:ble/widget/@nomarked forward-line history" [67108975]="1:ble/widget/accept-and-next" [67108976]="1:ble/widget/@nomarked backward-line history" [67108977]="1:ble/widget/emacs/quoted-insert" [67108978]="1:ble/widget/history-isearch-backward" [67108979]="1:ble/widget/history-isearch-forward" [67108980]="1:ble/widget/transpose-chars" [67108981]="1:ble/widget/kill-backward-line" [67108982]="1:ble/widget/emacs/quoted-insert" [67108983]="1:ble/widget/kill-region-or uword" [67108984]="_" [67108985]="1:ble/widget/yank" [67108986]="1:ble/widget/.SHELL_COMMAND 'fg'" [67108991]="1:ble/widget/emacs/undo" [68222991]="1:ble/widget/@nomarked beginning-of-text" [68222992]="1:ble/widget/history-beginning" [68222993]="1:ble/widget/delete-forward-cword" [68222994]="1:ble/widget/@nomarked end-of-text" [68222995]="1:ble/widget/history-end" [68223020]="1:ble/widget/@nomarked forward-cword" [68223021]="1:ble/widget/@nomarked backward-cword" [100663393]="1:ble/widget/@marked beginning-of-line" [100663394]="1:ble/widget/@marked backward-char" [100663397]="1:ble/widget/@marked end-of-line" [100663398]="1:ble/widget/@marked forward-char" [100663406]="1:ble/widget/@marked forward-line" [100663408]="1:ble/widget/@marked backward-line" [101777423]="1:ble/widget/@marked beginning-of-text" [101777426]="1:ble/widget/@marked end-of-text" [101777452]="1:ble/widget/@marked forward-cword" [101777453]="1:ble/widget/@marked backward-cword" [134217736]="1:ble/widget/copy-backward-sword" [134217741]="1:ble/widget/newline" [134217760]="1:ble/widget/set-mark" [134217761]="1:ble/widget/complete context=command" [134217764]="1:ble/widget/complete context=variable" [134217767]="1:ble/widget/sabbrev-expand" [134217770]="1:ble/widget/complete insert_all" [134217773]="1:ble/widget/emacs/append-arg" [134217775]="1:ble/widget/complete context=filename" [134217776]="1:ble/widget/emacs/append-arg" [134217777]="1:ble/widget/emacs/append-arg" [134217778]="1:ble/widget/emacs/append-arg" [134217779]="1:ble/widget/emacs/append-arg" [134217780]="1:ble/widget/emacs/append-arg" [134217781]="1:ble/widget/emacs/append-arg" [134217782]="1:ble/widget/emacs/append-arg" [134217783]="1:ble/widget/emacs/append-arg" [134217784]="1:ble/widget/emacs/append-arg" [134217785]="1:ble/widget/emacs/append-arg" [134217788]="1:ble/widget/history-beginning" [134217790]="1:ble/widget/history-end" [134217791]="1:ble/widget/complete show_menu" [134217792]="1:ble/widget/complete context=hostname" [134217794]="1:ble/widget/@marked backward-cword" [134217798]="1:ble/widget/@marked forward-cword" [134217805]="1:ble/widget/@marked non-space-beginning-of-line" [134217820]="1:ble/widget/delete-horizontal-space" [134217822]="1:ble/widget/history-expand-line" [134217826]="1:ble/widget/@nomarked backward-cword" [134217828]="1:ble/widget/kill-forward-cword" [134217830]="1:ble/widget/@nomarked forward-cword" [134217831]="1:ble/widget/complete context=glob" [134217832]="1:ble/widget/kill-backward-cword" [134217836]="1:ble/widget/redraw-line" [134217837]="1:ble/widget/@nomarked non-space-beginning-of-line" [134217842]="1:ble/widget/emacs/revert" [134217847]="1:ble/widget/copy-region-or uword" [134217850]="1:ble/widget/.SHELL_COMMAND 'fg'" [134217854]="1:ble/widget/complete context=username" [134217855]="1:ble/widget/copy-backward-sword" [135331857]="1:ble/widget/copy-forward-sword" [135331884]="1:ble/widget/@nomarked forward-sword" [135331885]="1:ble/widget/@nomarked backward-sword" [167772258]="1:ble/widget/@marked backward-cword" [167772262]="1:ble/widget/@marked forward-cword" [167772269]="1:ble/widget/@marked non-space-beginning-of-line" [168886316]="1:ble/widget/@marked forward-sword" [168886317]="1:ble/widget/@marked backward-sword" [201326655]="1:ble/widget/copy-backward-sword" [201326695]="1:ble/widget/bell" [201326696]="1:ble/widget/copy-backward-sword" [201326701]="1:ble/widget/newline")
_ble_decode_emacs_kmap__67108984=([33]="1:ble/widget/complete show_menu:context=command" [36]="1:ble/widget/complete show_menu:context=variable" [39]="1:ble/widget/sabbrev-expand" [42]="1:ble/widget/complete insert_all:context=glob" [47]="1:ble/widget/complete show_menu:context=filename" [60]="1:ble/widget/history-nsearch-backward" [62]="1:ble/widget/history-nsearch-forward" [64]="1:ble/widget/complete show_menu:context=hostname" [85]="1:ble/widget/emacs/redo" [103]="1:ble/widget/complete show_menu:context=glob" [110]="1:ble/widget/history-substring-search-forward" [112]="1:ble/widget/history-substring-search-backward" [117]="1:ble/widget/emacs/undo" [126]="1:ble/widget/complete show_menu:context=username" [1114154]="1:ble/widget/history-search-backward" [1114155]="1:ble/widget/history-search-forward" [67108967]="1:ble/widget/bell" [67108974]="1:ble/widget/history-search-forward" [67108976]="1:ble/widget/history-search-backward" [67108978]="1:ble/widget/dabbrev-expand" [67108981]="1:ble/widget/emacs/undo" [67108982]="1:ble/widget/display-shell-version" [67108984]="1:ble/widget/exchange-point-and-mark" [100663413]="1:ble/widget/emacs/redo")
$ arr=(1 2 3)
$ declare -p arr | cat -v
declare -a arr='([0]="1" [1]="2" [2]="3")'
$ ble/util/declare-print-definitions arr | cat -v
arr=([0]="1" [1]="2" [2]="3")
$ cat -v <<< $IFS
# blank new line
dylankb commented 4 years ago

Maybe you haven't yet noticed, but actually you are still using Bash 3.2.57 for login shells as your first post implies:

Hm, yes I thought the default shell in OSX was the login shell so I'm actually not sure why there's two versions for different shells, but I don't know much about this type of stuff. https://unix.stackexchange.com/questions/119627/why-are-interactive-shells-on-osx-login-shells-by-default

So actually you can now switch to newly installed Bash to see if the problem persists, but to avoid the complication of the problem I would like to solve the problem in older Bash before going to the newer version.

The main feature that drew me to this project was the mention of fish / zsh-autosuggestions type functionality but in plain bash. Here's an example of what I mean.

776722e0

Is the reason I'm not seeing these types of autosuggestions for all terminal commands because bleh.sh is running on an older version of bash for the login shell? If so I'm guessing I should change my login shell bash version by adding bleh.sh to /etc/shells.

akinomyoga commented 4 years ago

For "Failed to load the default keymap" error

Thank you for the results!

the good news is that's because I no longer receive the "Failed to load the default keymap" type error.

OK. So now, would you have some syntax highlighting? (If not, that means there are still problems.)

$ grep _emacs_ "$_ble_base_cache/keymap.emacs"
_ble_decode_emacs_kmap_=([0]="1:ble/widget/set-mark"...
_ble_decode_emacs_kmap__67108984=([33]="1:ble/widget...
$ arr=(1 2 3)
$ declare -p arr | cat -v
declare -a arr='([0]="1" [1]="2" [2]="3")'
$ ble/util/declare-print-definitions arr | cat -v
arr=([0]="1" [1]="2" [2]="3")
$ cat -v <<< $IFS
# blank new line

Now it looks like everything is working correctly. I'm not sure what was the actual problem, but I am thinking of leaving it for another occasion.

Is the reason I'm not seeing these types of autosuggestions for all terminal commands because bleh.sh is running on an older version of bash?

Yes. ble.sh's autosuggestions are only available with Bash 4.0 and later because it internally uses a Bash 4.0's feature. Currently your login shell is Bash 3.2, so autosuggestions are inactive.

Change login shell

Let's go to the newer version of Bash! I don't know your exact situation, but I guess you have installed the new Bash by Homebrew but haven't added the path in /etc/shells and also haven't changed the default shell by chsh command. In order to use the new version of Bash as the default login shell, you want to follow this Q&A. To summarize the instructions, you need the following two steps:

  1. Add a line /usr/local/bin/bash (the path to the new version of Bash) to /etc/shells (you need a root privilege to edit the file). Edit: Before adding it to /etc/shells, please check that the path is actually /usr/local/bin/bash. If the path is incorrect, it will cause problems.
  2. Change your default login shell to the new version by the command chsh -s /usr/local/bin/bash.

FYI: Right prompt in ble.sh

If you want to show the right prompt (like RPROMPT in zsh) as in the image of your previous comment, ble.sh provides the setting. You can use the following setting if you are interested.

# In ~/.bashrc (after source ble.sh) or in ~/.blerc
bleopt rps1='\D{%c}'

Here is an example at my side (in Arch Linux in a virtual machine). I'm running Bash 5.0:

Example
image
akinomyoga commented 4 years ago

FYI: .bash_profile vs .bashrc

Related to the login shell, you have mentioned that you are using .bash_profile to configure ble.sh in the initial post:

I add follow the instructions for configuring bleh.sh with .bashrc (except that I'm using .bash_profile)

If you do not have specific reasons or special preferences, I actually recommend you to put the setting of ble.sh in .bashrc but not in .bash_profile. (I'm sorry if you already understand that and do it in that way intendedly!)

Login shell and non-login shell

Actually .bash_profile is loaded for the login shells, and .bashrc is loaded for the other shells (instead of .bash_profile). For example when you open a terminal in macOS, you'll initially get a login shell:

$ echo hello # <-- We are in a login shell (bash_login is loaded for this session).
hello
$
$ bash # <-- You can launch a child shell inside the login shell.
$ echo hello # <-- Now we are NOT in a login shell but a child shell (bashrc is loaded for this session)
hello
$ exit # <-- Exit the child shell.
$ # <-- We come back to the login shell

Normal configuration

Usually .bash_profile is configured to call .bashrc inside. In this way, .bash_profile is called only once in the login shell for the session, and .bashrc is called every time the new Bash starts. In such a setup, .bash_profile is used to configure the settings that affects all the child processes (such as environment variables), and .bashrc is used to configure the settings which have effects to only the current Bash (such as aliases, functoins, key bindings, Bash extensions, etc.). The typical configuration of .bash_profile and .bashrc have the following forms:

# bash_profile

# (Setting environment variables such as LANG, PATH, etc.)

# call bashrc inside
[[ -f ~/.bashrc ]] && source ~/.bashrc
# bashrc

# (Common settings)

[[ $- == *i* ]] || return 0 # If this is not interactive session, then exit here

# (Commonn settings for interactive session such as aliases, functions, key bindings, etc)

ble.sh in bashrc

Actually ble.sh belongs to the latter type of configuration, i.e., it only affects the current Bash instance. So we want to call ble.sh in .bashrc to load ble.sh for every Bash instances. If you configure ble.sh in .bash_profile, you have ble.sh only in login shells and will not get ble.sh activated in non-login shells. You can confirm that by launching another non-login bash inside the login bash.

For this reason, I recommend to configure ble.sh in .bashrc. (In such a case, please do not forget to call .bashrc from .bash_profile!)

dylankb commented 4 years ago

Now it looks like everything is working correctly. I'm not sure what was the actual problem, but I am thinking of leaving it for another occasion.

Should have mentioned that I did run the update command successfully first before the errors loading ble.sh stopped.

If you want to show the right prompt (like RPROMPT in zsh) as in the image of your previous comment, ble.sh provides the setting.

Ah, sorry I wasn't clear! I showed the screenshot from fish as an example of autocomplete since I wasn't sure if the ble.sh autcomplete feature was similar to the fish version or not.

Thanks for the detailed information on login shells! I followed the instructions and now have fish-like autocomplete working which I'm very happy about. There are two small issues I'm running into though.

The suggested contents can be inserted by typing S-RET (when the cursor is at the end of the command line, you can also use right, C-f or end to insert the suggestion).

1) S-RET: I was unfamiliar with emac keyboard notation (so I think it refers to "Shift + Return") but I'm not sure what the intended behavior is for S-RET? I was hoping it would behave like right or C-f, but on my system it only behaves like "Return". I think there may be a limitation in iTerm2 and maybe OSX where by default S-RET has the same keycode as RET https://emacs.stackexchange.com/questions/26699/keycode-for-shift-return-on-os-x-iterm2. I can configure a hex or escape code to return on S-RET but I'm not sure what it should be, or if that's the right approach.

If you want to insert only first word of the suggested contents, you can use M-right or M-f

2) M-right: Even though I have to the Option key set as a Meta key as suggested here in iTerm2, M-right is interpreted as right. I'm not sure if it's relevant and I can't find much documentation on it, but I have an iTerm2 setting called Natural Text Editing that allows Opt-right to move one word on the terminal. I can use Tab to select the first path section in a longer path, which is good, but it sounds different from what M-right does.

akinomyoga commented 4 years ago

I followed the instructions and now have fish-like autocomplete working which I'm very happy about.

Thank you for the report! I'm glad to hear that!

1. S-RET

S-RET: I was unfamiliar with emac keyboard notation (so I think it refers to "Shift + Return")

Right. It represents "Shift + Return".

I was hoping it would behave like right or C-f, but on my system it only behaves like "Return".

Yes. S-RET is intended to behave like right or C-f. To be precise, when the cursor is not at the end of the line, right and C-f retain the original meaning, "move one character right", so they cannot be used for auto-complete. S-RET is an alternative binding which can be used for auto-complete any time.

but on my system it only behaves like "Return". I think there may be a limitation in iTerm2 and maybe OSX

This should be the limitation of iTerm2. ble.sh uses a terminal feature for extended key sequences called "modifyOtherKeys", but it seems iTerm2 haven't yet supported it according to my search. There was a pull request for extended key settings in iTerm2 three years ago. The author of iTerm2 opened an Issue for modifyOtherKeys at that time. Recently the author again opened another Issue for modifyOtherKeys. Maybe it will be supported in near future.

I can configure a hex or escape code to return on S-RET but I'm not sure what it should be, or if that's the right approach.

I think that's the right approach for the current iTerm2. I don't have macOS, so I cannot try iTerm2, but it seems there is a setting "Action: Send Escape Sequence" looking at an image in this answer. You can enter [13;2u in the bottom text box (next to "ESC +") for S-RET.

If you also want to set up other key combinations for iTerm2, the following table shows examples for the key combinations used in ble.sh.

Key combination Escape sequence Key combination Escape sequence
S-RET ESC [ 1 3 ; 2 u C-0 ESC [ 4 8 ; 5 u
C-RET ESC [ 1 3 ; 5 u C-1 ESC [ 4 9 ; 5 u
C-S-RET ESC [ 1 3 ; 6 u C-2 ESC [ 5 0 ; 5 u
S-TAB ESC [ 9 ; 2 u C-3 ESC [ 5 1 ; 5 u
C-TAB ESC [ 9 ; 5 u C-4 ESC [ 5 2 ; 5 u
C-S-TAB ESC [ 9 ; 6 u C-5 ESC [ 5 3 ; 5 u
S-SP ESC [ 3 2 ; 2 u C-6 ESC [ 5 4 ; 5 u
C-S-SP ESC [ 3 2 ; 6 u C-7 ESC [ 5 5 ; 5 u
S-BS ESC [ 8 ; 2 u C-8 ESC [ 5 6 ; 5 u
C-S-BS ESC [ 8 ; 6 u C-9 ESC [ 5 7 ; 5 u

2. M-right

I think the right settings depend on what behavior you actually expect for different key combinations with Meta keys. There are historically two different roles for Meta key in terminals:

The following is a part of possible settings based on my guess on iTerm2 (as I don't have iTerm2/macOS). I'm not sure if they work, but I wish so.

dylankb commented 4 years ago
  1. S-RET

Thanks for looking into those details and providing the escape codes! I have now have S-RET others working correctly.

  1. M-right

Wow, thanks for the thorough explanation. Let me be more specific and you can tell me if the behavior I have is the expected one:

Given terminal input cd d and an autocomplete suggestion of cd do/a/thing I thought that entering M-right would select and move the cursor the first end of the first path segment (i.e changing the current terminal input to cd do/). This is the behavior I get if I use Tab. However instead entering M-right completes to the whole segment cd do/a/thing. I think this is not the expected behavior since normally a / is treated as a delimiter - at least currently in iTerm2 using Natural Text Editing respects the / delimiters with regular (non-autcomplete suggested) Terminal line editor content.

However it's interesting that M-right observe spaces as delimiters in autocomplete suggestions. For example, If I enter e and get a suggestion of echo hello world I can then use M-rightto move one word at a time - i.e I would need to enter M-right 3 times to reach the end of the autocomplete suggestions.

akinomyoga commented 4 years ago

Thank you very much for your feedback!

However it's interesting that M-right observe spaces as delimiters in autocomplete suggestions.

This is actually my preference and was an intended one. I added an option to configure the delimiters c294e31 (in master branch not in ble-0.3 because this is a new feature). You can configure the characters to be used for word breaks of M-right by the following settings.

# Example 1: spaces (default)
bleopt complete_auto_wordbreaks=$' \t\n'

# Example 2: spaces + /
bleopt complete_auto_wordbreaks=$' \t\n/'
dylankb commented 4 years ago

Thanks for all the help!

akinomyoga commented 4 years ago

OK. Thank you for your reports and replies on the problems!

dylankb commented 4 years ago

Just letting you know that including bleopt complete_auto_wordbreaks=$' \t\n/' in my .blerc file causes this error to display when loading bleh.sh. It also appears as if the change does not take affect. I ran ble-update to grab the latest as well.

bleopt: unknown bleopt option `complete_auto_wordbreaks'
akinomyoga commented 4 years ago

Thank you for the information! Which version of ble.sh do you use? As I have already written, this new feature is implemented in the master branch and not reflected in ble-0.3. In my environment, it works for the master branch. If you now use ble-0.3 and want to use the feature, you need to switch to the master branch (the devel branch for ble-0.4). To use the master branch version, you can follow the intruction in README (with git clone & make install).

Note: ble-update does not upgrade ble-0.3 series to ble-0.4 series. It just picks up patches for fixing problems in ble-0.3.

dylankb commented 4 years ago

Ah, you clearly explained this before and I overlooked that point. Thanks!

dylankb commented 4 years ago

The feature works great in ble-0.4 series, but in case you didn't know an error message does pop up when loading ble.sh.

ble/builtin/trap: invalid signal specification "-".
akinomyoga commented 4 years ago

Thank you for the report! This was a bug. Fixed (db8b0c2). Could you check after ble-update?

dylankb commented 4 years ago

Yep, that fixed it!

akinomyoga commented 4 years ago

Thank you!

jw-miaem commented 7 months ago

Started seeing same thing updated macos (14.4.1 (23E224)) today:

→ ble.sh: The keymap 'emacs' is empty. → RRRRRRR

→ ble --version ble.sh, version 0.4.0-devel4+b6344b3b (noarch)

blesh is installed via bash-it plugins

jw-miaem commented 7 months ago

MACHTYPE: aarch64-apple-darwin23.2.0 BLE_VERSION: 0.4.0-devel4+b6344b3b BASH_VERSION: 5.2.26(1)-release locale: LANG=en_US LC_ALL=en_US.UTF-8 LC_TERMINAL=iTerm2 LC_TERMINAL_VERSION=3.4.20 /Users/UN/.local/share/blesh/lib/test-bash.sh:238: (set -H; builtin history -c; builtin history -p "$line") --- 53016.stdout.expect 2024-04-07 12:25:56 +++ 53016.stdout.result 2024-04-07 12:25:56 @@ -1 +1 @@ -$'\'!!'\' +

98.3% [section] bash: 60/61 (1 fail, 0 crash, 4 skip) 100.0% [section] ble/main: 19/19 (0 fail, 0 crash, 0 skip) -bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8): Permission denied -bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8): Permission denied 100.0% [section] ble/util: 1231/1231 (0 fail, 0 crash, 3 skip) 100.0% [section] ble/canvas/trace (relative:confine:measure-bbox): 5/5 (0 fail, 0 crash, 12 skip) 100.0% [section] ble/canvas/trace (cfuncs): 17/17 (0 fail, 0 crash, 1 skip) 100.0% [section] ble/canvas/trace (justify): 2/2 (0 fail, 0 crash, 28 skip) 100.0% [section] ble/canvas/trace-text: 11/11 (0 fail, 0 crash, 0 skip) 100.0% [section] ble/canvas/textmap: 5/5 (0 fail, 0 crash, 0 skip) 100.0% [section] ble/canvas/GraphemeCluster/c2break: 77/77 (0 fail, 0 crash, 0 skip) 100.0% [section] ble/canvas/GraphemeCluster/c2break (GraphemeBreakTest.txt): 6244/6244 (0 fail, 0 crash, 0 skip) 100.0% [section] ble/decode: 33/33 (0 fail, 0 crash, 0 skip) 100.0% [section] ble/edit: 2/2 (0 fail, 0 crash, 0 skip) 100.0% [section] ble/syntax: 22/22 (0 fail, 0 crash, 0 skip) 100.0% [section] ble/complete: 7/7 (0 fail, 0 crash, 0 skip) 100.0% [section] ble/keymap.vi/space: 2/2 (0 fail, 0 crash, 0 skip) 100.0% [section] ble/keymap.vi/cw: 30/30 (0 fail, 0 crash, 0 skip) 100.0% [section] ble/keymap.vi/search: 10/10 (0 fail, 0 crash, 0 skip) 100.0% [section] ble/keymap.vi/increment: 19/19 (0 fail, 0 crash, 0 skip) 100.0% [section] ble/keymap.vi/macro: 1/1 (0 fail, 0 crash, 0 skip) 100.0% [section] ble/keymap.vi/surround: 7/7 (0 fail, 0 crash, 0 skip) 100.0% [section] ble/keymap.vi/txtobj_quote_xmap: 45/45 (0 fail, 0 crash, 0 skip) 100.0% [section] ble/keymap.vi/txtobj_block_omap: 41/41 (0 fail, 0 crash, 0 skip) 100.0% [section] ble/keymap.vi/txtobj_block_xmap: 145/145 (0 fail, 0 crash, 0 skip) 100.0% [section] ble/keymap.vi/txtobj_word_omap: 79/79 (0 fail, 0 crash, 0 skip) 100.0% [section] ble/keymap.vi/txtobj_word_xmap: 34/34 (0 fail, 0 crash, 0 skip) 100.0% [section] ble/keymap.vi/op.2018-02-22: 4/4 (0 fail, 0 crash, 0 skip)

jw-miaem commented 7 months ago

I added [[ $- == i ]] && source $HOME/.local/share/blesh/ble.sh --noattach to top of .bashrc and error disappeared

akinomyoga commented 7 months ago

@jw-miaem If possible could you provide the result of the following command in a ble.sh session?

$ ble/widget/display-shell-version

Could you try clearing ble.sh's cache and restart Bash to see if anything changes?

$ bash /path/to/ble.sh --clear-cache    # <-- please replace /path/to/ble.sh with the actual path to the script file ble.sh

Also, does your system have gawk?

$ type gawk
jw-miaem commented 7 months ago
→ ble/widget/display-shell-version
GNU bash, version 5.2.26(1)-release (aarch64-apple-darwin23.2.0)
ble.sh, version 0.4.0-devel4+b6344b3b (noarch) [git 2.43.0, GNU Make 3.81, GNU Awk 5.3.0, API 4.0, (GNU MPFR 4.2.1, GNU MP 6.3.0)]
bash-completion, version 2.13.0 (hash:480ffcc6a751e55621ec526eb5dea7a0d86d9e72, 17877 bytes) (noarch)
bash-preexec, (hash:5f1208c33e624859eea70e3843bd9b8c9a06819e, 13046 bytes) (noarch)
bash-it, version +ad2b5580 (noarch), alias(general), completion(aliases awscli bash-it brew composer docker-compose docker drush git kubectl lerna npm nvm ssh system terraform), plugin(aws base battery blesh docker-compose docker nginx node osx postgres proxy ssh)
locale: LANG=en_US LC_ALL=en_US.UTF-8 LC_TERMINAL=iTerm2 LC_TERMINAL_VERSION=3.4.20
terminal: TERM=xterm-256color wcwidth=auto-auto/15.1-2+ri
jw-miaem commented 7 months ago

and run → bash path --clear-cache → type gawk gawk is /opt/homebrew/bin/gawk

and basically it seems to fix it - there was some text output but its obscured something like...put cache for TERM=xterm-256color... done

jw-miaem commented 7 months ago

yep all seems good again so thanks for swift response

akinomyoga commented 7 months ago

Oh, OK. Thanks.