Last active
February 22, 2021 07:22
-
-
Save paoloumali/421dd1b08582731bf64baf938c045975 to your computer and use it in GitHub Desktop.
vim key bindings in bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add in .bashrc below, then refresh session | |
``` | |
set -o vi | |
bind '"jk":"\e"', do only if in control of all systems, stick with ESC for consistency | |
``` | |
It defaults to insert mode, ESC/jk to go command mode. | |
## Benefits | |
- jk binding is easier than ESC key | |
- vim navigation is closer to natural position of fingers than the arrow keys | |
- dw to delete current word | |
- b go back one word, 2b for two words | |
- w forward a work, 2w for 2 | |
- d$ deletes from cursor to end | |
- d0 deletes from current to start of the line | |
- i for insert mode | |
## Extras | |
To for ssh connections to go vi edit mode, use shortcut below in your aliases | |
function s() { | |
ssh -t $@ 'bash -o vi' | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment