Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Nice introduction to Vim!

Using bash/zsh extensively, and Vim a few times a day, I have been wondering if people treat bash/zsh and Vim as two different worlds when it comes to keybindings, or is it common to use Vi/m keybindings in bash/zsh/other shells? Would love to hear some input on this! :-)



Personally, I have vi mode enabled for anything that uses readline. Some of my friends, though, have been reluctant to use it since the prompt doesn't indicate which mode it's currently in.

But... That changed with recent versions of readline, which introduced 'show-mode-in-prompt' [0]. It's somewhat limited - it only prints an indicator at the beginning of the last row of the prompt. You can, however, change what text is displayed. I use it to emit escape codes that change the shape of the cursor (similar to vim itself) [1].

[0] https://www.gnu.org/software/bash/manual/html_node/Readline-...

[1] https://wiki.archlinux.org/index.php/Readline#Editing_mode


They are two different worlds. GNU readline enforces the keys you might identify with Emacs and other GNU components that make their way into your GNU/Linux distro bundle.

https://www.gnu.org/software/bash/manual/html_node/Readline-...

I've toyed with taking what suckless have done with their libs and implement some alternatives (people still gripe about missing CP/M (DOS) shortcuts)


I use vi key bindings in bash and in tmux for that matter.


“set -o vi” will give you vim bindings in bash


Yes, and thanks! In this case I was actually trying to understand how people in general try to combine the two tools. Keeping them separate, or using one keybinding for both! :-)


If you don't have fkeys bound `$ vimtutor` works too.

*I have never used them on osx and use a 50% keyboard.


For fish run (or store in config.fish) `fish_vi_key_bindings`




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: