SYSTEM:
- Ubuntu: 20.04
- Kernel: 5.4.0-162-generic
- bash: 5.0.17(1)
I found a strange problem that when I use bash's reverse search with CTRL+r, I will find a command I want to run. I select TAB to select it before running, and for some reason bash will insert a string into the command.
Like if the command I want to use is this
(reverse-i-search)`sele': docker exec -it my-postgres psql -P pager=off -P expanded=auto -U database -c "select * from stuff;"
After I hit tab what is presented to me is this
docker exec -it my-postgres psql -P pager=off -P expanded=auto -U database -c "my-select * from stuff;"
see how my- is inserted in front of select? I tried cleaning up my history with -d and writing with -w. But still this behavior continues. It only happens for speific history commands through. So if I did echo dog and reverse searched it, pressed tab, then my- is not inserted.
I also tried searching for other words in the command like pager, or auto, and the behavior still happens.
On a last note I did try searching for the first word docker, if I hit TAB then, this behavior does not insert my-. Seems to be fine for the first word.
Does anyone know why? I don't do anything crazy with .bashrc here is the only things I added at the end
# User specific aliases and functions
set -o vi
alias lc='stat -c "%A %a %h %U %G %n" * | column -t'
alias vi=vim
export PATH=/home/fsnt/bin:$PATH
export EDITOR='vim'
export VISUAL='vim'
Here is my .inputrc
#vi mode adding TextObject Motions
$if mode=vi
set keymap vi-command
"ciw": "lbcw"
"yiw": "lbyw"
"ciW": "lBcW"
"yiW": "lByW"
$endif
bind -p. You can also use a movement key to select the command during search, e.g. I often useC-e(go to end of line) to accept the search as I may want to add something at the end of line.