oh-my-bash icon indicating copy to clipboard operation
oh-my-bash copied to clipboard

autosuggestion suppprt

Open meilihao opened this issue 6 years ago • 13 comments

like zsh-users/zsh-autosuggestions

meilihao avatar Sep 29 '19 01:09 meilihao

@meilihao That's impossible for Bash actually.

nntoan avatar Sep 30 '19 04:09 nntoan

What do you call it when you double-TAB and the first option is highlighted, and TAB again to highlight the second option?

E.g.

$ ls
foo/ bar/
$ cd <TAB TAB>
[foo/] bar/
<ANOTHER TAB>
foo/ [bar/]

I use square brackets, but it might be a highlight colour.

So, what is that called, and does oh-my-bash support it? (I thought it might have something to do with "suggest" hence posting here.)

opyate avatar Nov 06 '19 15:11 opyate

I'm developing a bash configuration ble.sh and found this question today. Actually ble.sh provides both auto-complete (like zsh-autosuggestions) (in Bash 4.0+) and menu-complete with highlighting of the selected completion. ble.sh is completely orthogonal to oh-my-bash (i.e., ble.sh provides basic line-editor functionalities but does not provide settings of prompts, aliases and functions), so that you can load both ble.sh and oh-my-bash in ~/.bashrc if you like.

@meilihao Maybe you can try ble.sh for autosuggestions in Bash (which is called auto-complete in ble.sh). auto-complete generates a possible completion from command histories and also from normal completions.

@opyate

  • I think what you want is menu-complete. Actually the feature autosuggestions is quite different from menu-complete. I'm not sure whether a specific name is given for "highlighting in menu-complete".
  • Highlighting is not available, but you can configure the plain Bash with the following settings for menu-complete. You don't even need oh-my-bash (See also Bash autocomplete: first list files then cycle through them - Unix & Linux Stack Exchange).
# In bashrc
bind 'TAB: menu-complete'
bind 'set show-all-if-ambiguous on'
# Or, in inputrc
TAB: menu-complete
set show-all-if-ambiguous on
  • If you want to highlight the selected completion in menu-complete, I think oh-my-bash does not support it because it's really complicated to realize it with Bash configurations. But as I have already written first, ble.sh does support it. Maybe you can also try ble.sh.

akinomyoga avatar Jan 02 '20 16:01 akinomyoga

@akinomyoga thanks so much for taking the time to reply. I'll try your suggestions some time.

opyate avatar Jan 02 '20 23:01 opyate

@akinomyoga I checked out ble.sh today. It's really awesome! Kudos. I'd be great if oh-my-bash had a plugin sort of thing for ble.sh so that it can be optionally enabled, eliminating the need to install both oh-my-bash and ble.sh separately.

rashil2000 avatar Sep 18 '20 16:09 rashil2000

I tried ble.sh, but i still like zsh-users/zsh-autosuggestions. Because there is a little delay in ble.sh's response, and better experience in zsh-autosuggestions.

meilihao avatar Sep 23 '20 13:09 meilihao