Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm getting used to vim bindings (like pressing w to go to word, dw to delete a word, and such) and it's modes (insert, normal, visual), and, out of curiosity would like to know: is there some kind of implementation of this behaviour of modes and bindindgs from vim to my terminal? Have insert mode, normal mode and such...

Thanks!

share|improve this question

1 Answer 1

up vote 19 down vote accepted

It has insert and normal mode (the insert mode is default, and escape for normal mode) but no visual mode.

In bash: set -o vi You can run it at the command line for just this session or add it to your .bashrc file.

Many programs use readline for input, and you can make any of them use vi-style keybindings by setting up your .inputrc with

set editing-mode vi
set keymap vi

In zsh, if you change your EDITOR environment variable, the shell will match it.

share|improve this answer
    
Pretty neat. Do you know if it's possible to have some kind of .vimrc as well, but for this uses? For example, adding different mappings to <ESC>... –  Somebody still uses you MS-DOS Dec 15 '10 at 18:10
2  
@Somebody: Not .vimrc since you're still using the shell's built-in editor, but you can configure key bindings in .inputrc for all readline applications (such as bash), in .bashrc for bash specifically, in .zshrc for zsh. –  Gilles Dec 15 '10 at 18:34
1  
Checkout the bind builtin –  Shawn J. Goff Dec 15 '10 at 18:35
    
Note that on OS X, you'll need to put the put -o vi in ~/.bash_profile instead of ~/.bashrc . –  Steve Jorgensen Mar 23 '11 at 7:24
    
I notice that the cursor appearance doesn't change in the different modes bash w/ vi key bindings. Is there any way to make it do that? It would be nice to have a visual indication of what mode I'm in. –  Steve Jorgensen Mar 23 '11 at 7:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.