-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"^A" is inserted at old cursor position in vi mode #5
Comments
Does it work correctly for you without vi mode ? I want to make sure this not due to the bash version. |
Yup, works perfectly without vi mode. It looks like it's the |
Things seem to work well if I just get rid of the ^A whenever we're in vi mode, e.g: # Key bindings. Before executing the main function, place the cursor at the begeninng of the command line (\key1).
if [[ ${SHELLOPTS} =~ (^|:)"vi"(:|$) ]]; then
bind '"\key1":""'
else
bind '"\key1":"\C-a"'
fi The only thing that sucks here is that we bind when we source the plugin, which means that if we turn on vi mode later then we're out of luck. |
Hmm, I need to think about it. I'm not sure 100% that removing the "\C-a" will actually resolve the issue. I did it (placed the cursor at the beginning) to fix a displaying bug for some cases, but maybe it's no longer needed in vi mode. I'll try to do more tests. |
Indeed, removing it will not work properly. You can try your snippet with a command that takes 2 lines or more for example. You will see that things gonna be messed up. So placing the cursor at the beginning before executing the main function is mandatory, but not sure how to do it in vi mode. I'll try to figure out a way to fix that, but if you have any suggestion, don't hesitate :) |
If bash is in vi mode (set -o vi), then whenever the I jump to a new character a "^A" is inserted after the old cursor position.
Using bash version 3.2.20(1)-release (x86_64-pc-linux-gnu)
The text was updated successfully, but these errors were encountered: