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.71k stars 85 forks source link

inline-sabbrev-no-insert not working? #388

Closed dgudim closed 10 months ago

dgudim commented 10 months ago

ble version: Bash version:

GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu) [EndeavourOS]
ble.sh, version 0.4.0-devel4+6f4badf4 (noarch) [git 2.43.0, GNU Make 4.4.1, GNU Awk 5.3.0, API 4.0, PMA Avon 8-g1, (GNU MPFR 4.2.1, GNU MP 6.3.0)]
bash-completion, version 2.11 (hash:2d02f73e803daa87a06e94e33b2a7b3e672a2c0c, 76338 bytes) (noarch)
fzf key-bindings, (hash:c4dce3ba5bfafecbc6c47695f89ef02c305b984e, 5524 bytes) (noarch) (integration: on)
fzf completion, (hash:db84e06a1ee5fb43bc6ad1aaeec6657cad79c917, 14523 bytes) (noarch) (integration: on)
locale: LANG=en_US.UTF-8 LC_ADDRESS=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8 LC_MEASUREMENT=C LC_MONETARY=lt_LT.UTF-8 LC_NAME=en_US.UTF-8 LC_NUMERIC=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8 LC_TIME=ru_RU.UTF-8
terminal: TERM=xterm-256color wcwidth=15.0-west/15.1-2+ri, konsole:220380 (1;115;0)

If I understand correctly, inline-sabbrev-no-insert should disable insertion of space after completing sabberv, but it still inserts it for me

ble-sabbrev "~proj=$HOME/Documents/shared/_projects/"
bleopt edit_magic_opts=inline-sabbrev-no-insert

typing ~proj and pressing space still inserts a space after .../shared/_projects/

akinomyoga commented 10 months ago

Only inline sabbrevs, which are defined with -i, are affected by that option. Please define it in this way:

ble-sabbrev -i "~proj=$HOME/Documents/shared/_projects/"
dgudim commented 10 months ago

But it will also complete somestring~proj right?

dgudim commented 10 months ago

Yeah, it does. Ok, thanks for quick response anyway. I though this would work for all sabbrevs. Is it possible to add a similar option for not inline ones?

akinomyoga commented 10 months ago

But it will also complete somestring~proj right?

Right.

Is it possible to add a similar option for not inline ones?

It's possible if it is really needed by users, but what is your use case of not inserting a space after e.g. word sabbrevs? The word sabbrevs (which are the default sabbrevs when the type is unspecified) are intended to generate a single command-line word separated by a space. So a global option that disables suffixing space for all the sabbrevs doesn't seem useful. Specifically for the example of ~proj you provided, I suspect what you want would be actually defining it without the final slash,

ble-sabbrev -i "~proj=$HOME/Documents/shared/_projects"

and press / after typing ~proj to continue to write filenames or subdirectory names. Here, notice that magic-slash is bound to the key / by default.

dgudim commented 10 months ago

Oh, I somehow missed the / part, many thanks :)