Stack OverflowMaking Vim ubiquitous?
[+123] [28] Hamish Downer
[2009-05-05 18:13:00]
[ vim productivity vi ]

The Pragmatic Programmer [1] recommends that you should use one text editor for everything. My chosen weapon editor is Vim.

So I want to collect all the ways in which Vim (and the Vim keybindings) can be used and setting up your computer to make Vim work well. This includes how to embed Vim in your IDE, web browser, email client, command shell ...

But I don't want Vim tips - there [2] are [3] other [4] questions [5] for them. I want tips to get into Vim, or Vim mode. Though tips about Vim mode not in an editor would be allowed (e.g. tips for vi mode when using Bash).

Update: Going quite well so far, with ways to edit in Vim/gVim, or to get vi mode in Firefox, Safari, Thunderbird, many IDEs and command line applications, MS Outlook and Word. But I'm wondering if there are more. Particular applications I wonder about include

(2) See also:… - Ryan Edwards , adds VIM flavour to textareas (working but not mature, though) - Jakub M.
There is a nice plugin for firefox and chrome that allows you to use VIM bindings to edit any text area... it is called "wasavi" - AhHatem
[+55] [2009-05-05 18:22:52] chaos

Put this in your ~/.inputrc:

set editing-mode vi

That gets you vi mode in everything that uses readline (e.g. mysql client).

(6) Is this similar to set -o vi ? - OscarRyz
(4) Yeah, it does what set -o vi does in bash to whatever uses readline. - chaos
(1) I'm sorry, as die hard fan of vim as I am, there is no beating emacs shortcuts in this one. e.g. I do a $vi<Ctrl-P> and I can go back in history to all my earlier vim uses. or $kpdf<Ctrl-P> and all earlier uses, as opposed to typing esc for every shortcut and then using k and then pressing i to make changes. - user247077
(1) Damn, do I wish this was available in Windows. - Don Reba
(3) @user247077, your particular example, C-p etc are trivial to bind in addition to vi keys. And all in insert mode what's the default for a new prompt in bash/zsh :) - progo
@DonReba You can install cygwin or something and then bash and you're good to go. - user247077
(2) Note that zsh does not use readline, but instead zle, which does not read ~/.inputrc. - orftz
[+22] [2009-05-08 00:54:46] andrewdotn

Trying to use vim for everything is overkill. While the book does say,

Tip 22

Use a Single Editor Well

at a high level, it also says “use the right tool for the job.” It’s better to know how to use one text editor really well than to be barely competent with a half-dozen; but it would be significantly worse to master only a single program.

[+21] [2009-05-05 18:15:01] Hamish Downer

For Firefox, It's all text [1] and ViewSourceWith [2] allow you to use an external editor for text boxes. You generally want to use

gvim -f

The -f option means that will not fork a process, so this allows the calling program to wait until gVim closes. Without the -f option the above plugins won't work very well ...

If you want to go further then investigate the vimperator [3]. Scroll pages with hjkl, go back and forward with H and L, and many more keybindings [4] familiar to Vim users.

It is not at version 1.0 yet, but jV [5] makes text areas work like vi.

And finally there is an experimental way to directly embed the actual Vim in Firefox using embedded editor [6] - though it requires mozplugger and will only work on Linux.

For more details see this question about using vim with firefox [7].


The main thing I don't like about It's All Text is that I can't find any way to launch the external text editor using the keyboard. What good is it if I have to use my mouse to launch the editor? - Chad Birch
(1) @Chad Birch: If you look at the preferences for It's All Text, you'll see there is a "Hot Key" preference that allows you to set a keyboard shortcut. I use Ctrl-E - Hamish Downer
(2) try vimperator & hit ctrl-i while in a text-area ;) - sjh
I couldn't get ViewSourceWith or jV to work with current versions of Mac OS X (Snow Leopard) or Firefox (15.0.1). - David Ketcheson
It's All Text doesn't work with latest versions either. The only thing I got working is QuickCursor, which works like It's All Text. - David Ketcheson
[+21] [2009-05-05 18:44:27] Steve Rowe

I can highly recommend ViEmu [1] which is a plugin for Visual Studio giving you nearly 100% Vim capability while retaining things like Intellisense. It's great for C# coding. There is also a version of ViEmu for Word, Outlook and for SQL Server if you do a lot of those and want the power of Vim there as well.


(3) For me, it seems kind of useless, since it does not support Vim scripts. That would be a dubious proposition, even if it was free. - Don Reba
[+18] [2009-05-05 18:19:41] Hamish Downer

When using Bash, you can do

$ set -o vi

to enable vi editing mode. You start in insert mode, but you can press Escape and go forward and backwards with h and l, delete the previous word with db (or dB for back to the previous gap defined by spaces) ... If you like it, stick

set -o vi

in your .bashrc file.

Also see this question about vi mode and readline [1].


(1) This is covered by adding 'set editing-mode vi' to .inputrc - graywh
(1) @graywh: it is, but sometimes you just want a temporary change.. Maybe you are ssh'ed into a server as root, and just want to change to vi-mode for that session, but not to change it for everyone else. Or you are on someone else's computer for a brief period. - Hamish Downer
[+14] [2009-05-18 16:29:28] sjh

For Firefox use Vimperator [1]. It transforms Firefox into a vim-like program.

Hit Ctrl-I while your keyboard focus is inside a text area to launch vim on that text area.


(2) Being a Vim adept, I tried to use this multiple times over the years. However, the mapping of VI onto browser doesn't really make sense to me. I like the (e)links(2)/lynx/w3m type bindings a lot better. Opera is the king of keyboard browsing for me - sehe
[+13] [2009-05-05 18:13:53] Hamish Downer

For Thunderbird, the external editor [1] extension allows you to use gVim to write your emails, or you could use Vimperator [2]'s sister extension - muttator [3].


[+11] [2009-05-06 06:32:07] sykora

Set your $EDITOR to Vim.

At least in Linux, most environment aware applications will draw on this variable to choose the editor whenever they need you to edit something.

[+10] [2011-07-18 19:07:43] user8958

dactyl [1]

is like vimperator but maybe even better (I just started using it a bit).

I'm no programmer but like using this way of browsing. I still wonder if it's worth my while getting more into vim, since I'll probably never write a program; a bit of basic command line use in the terminal is about it.


[+9] [2009-05-05 19:22:41] Brian Carper

Vim can be used as PAGER [1] and for viewing man pages [2].

Many tools, e.g. Git, also let you specify a DIFF program (often via a configuration option or environment variable); Vim's diff mode works very well for that.


[+9] [2010-04-25 21:46:14] Hamish Downer

For Google Chrome, there are now a few extensions. Text Aid [1] and Edit with Emacs [2] both allow editing with an external editor. (Edit with Emacs does not require you to use emacs).

And in the spirit of the Vimperator Firefox extension, there are now

allowing you to navigate pages with vi key-bindings. However currently (May 2010) they are very basic compared to the Vimperator. Vrome is the most feature rich one [6].


[+8] [2009-05-05 18:16:54] Hamish Downer

You can set your keyboard to swap Caps Lock and Escape.

With the standard Ubuntu/GNOME desktop, go through the menus: System -> Preferences -> Keyboard -> Layouts tab. Then hit the "Layout Options" button, click on the triangle next to "Caps Lock key behaviour" and select "Swap ESC and CapsLock".

Not strictly part of Vim, but it makes Vim so much nicer to use.

Also see this question about making the ESC key easier to get to [1].


I guess that this would be cool. But I tried it and now I know that I wouldn't survive the first three days. - innaM
Swapping is a bad idea because you end up hitting caps lock by accident instead of ESC. Better to get rid of the caps lock functionality entirely and have both of those keys produce an ESC. Unless of course you actually find caps lock useful. - intuited
@intuited: I do find caps lock useful once in a while. I never reach up to the ESC key normally. But I guess having both be ESC might be useful for people in transition. - Hamish Downer
[+6] [2009-05-05 18:16:56] Adrian Mouat

There are some Vim plug-ins for Eclipse, see

There is also a commercial one at

Also, Eclim is a layer that connects headless Eclipse to Vim, giving it code completion abilities, and an understanding of Eclipse projects: Eclim home page [1]


I'm a user of viplugin. It works but it's not great. However it's better than nothing. - Peter Severin
(1) It is frustrating that such a useful thread is closed. - Traveler
I found this very useful:… Amazingly, I can pop back and forth from Vim to Eclipse and everything seems to work. - Traveler
[+5] [2009-12-19 03:43:48] Pistos

To change zsh to vi mode:

bindkey -v

To change it permanently, add that line to your ~/.zshrc. Alternatively, if you set your EDITOR (environment variable) to vi or vim, zsh will assume you want vi mode in the shell command line as well.

[+5] [2010-05-17 17:57:29] Hamish Downer

There is a PDF viewer called apvlv [1] that uses vi-like bindings.

For example, < Ctrl-f > to forward page, < Ctrl-b > to previous page, 'k','j','h','l' to scrolling a page up, down, left or right, and so on.

And, Apvlv can understand that how many times you want to run the command.

The only thing you need to do is typing the number before the command. For example, typing '50' and < Ctrl-f > will go forward 50 pages, typing '30' and < Ctrl-b > will go previous 30 pages.


(3) Just found out that evince (a PDF reader on Linux) lets you move around using hjkl aswell. - Hamish Downer
(4) And Okular as well. - progo
Zathura too - its primary interface is Vim-style commands. - Nathan Moos
[+4] [2009-05-05 19:52:42] Andy

I've seen quite a few examples around the web of Autohotkey being combined with gvim [1] in order to increase ubiquity. There are probably more.


[+4] [2009-05-06 13:24:21] Hamish Downer

For Mac users I just came across the Vi Input Manager plugin [1] which "patches the Cocoa Text System to add a Vi-like command mode". This affects applications including "Safari, TeXShop, XCode".

Looks cool. (Though I am not a Mac user).


[+4] [2009-06-04 13:13:15] smcameron

For your Vim gaming needs: Word War vi [1] - a retro styled side scrolling shoot'em up arcade game for Linux.


[+4] [2010-05-17 17:44:13] dotancohen

Abiword has an optional VI mode:

How I wish that was available for

Please comment on that OOo bug!

[+4] [2011-01-16 12:33:38] Bitterjug

Here's an idea for a bit if hjkl ubiquity (based on this thread [1] at but sadly it doesn't work.

xev tells me that my Windoze key sends keycode 133; I created .hjkl.modmap:

keycode 66 = Mode_switch
keysym j = j J Left 
keysym l = l L Right
keysym i = i I Up
keysym k = k K Down

And installed it with xmodmap

$ xmodmap .hjkl.modmap

Now Win-[hjkl] behave like the arrow keys. One less reason to take my hands off the home keys. But it clobbers the Win key. Maybe someone knows how to just remap Win-h, etc?


[+3] [2009-05-05 18:31:14] Hamish Downer

One last link to another question - this one about vi mode plugins for IDEs [1].


[+3] [2009-05-08 04:09:02] Greg Dunn

This [1] site has an AutoHotkey script for Windows that will let you set up some basic Vim keystrokes in any application (I use hjkl for motion everywhere now).


[+2] [2009-05-05 18:56:06] Joe Philllips

In the game NetHack [1] you can use vi keyboard mode. Just set the setting to 0 (zero):

Use the number keys to move instead of [yuhjklbn] (default 0 or off).

[+2] [2009-05-16 07:15:51] Caglar Toklu

MonoDevelop has a vi mode [1] too.

Also check Eclim [2]. It started to integrate the functionality of Vim and Eclipse, but now it seems it is beyond that. I have not used it though, but its release notes shows that it supports Python, PHP and C++ and markup languages.


[+2] [2009-12-21 20:43:29] 0x89

There is a very good vim plugin for intellij idea (recently partly open sourced). It can easily be installed from the plugins menu.

And there is jvi [1] for netbeans.


jvi is the cream of the crop as far as IDE vi[m] plugins. All others seem a bit clunky. - Lyle
[+1] [2009-05-06 21:11:59] Hamish Downer

Just for completeness, I will mention that you can use command line email clients such as mutt [1] and pine [2]. And with them you can use any command line editor for writing your emails.


[+1] [2011-03-31 23:06:34] Sameer

Check out the IDE pida [1]. This embeds vim right inside the IDE. Standard features like interface with common version control software and source code browsing with ctags / gtags are included. Plugins are available for a variety of languages. You can also use this with emacs instead of vim.


[0] [2009-07-08 10:50:51] Greg

I have half-followed the instructions at the Vim tips wiki [1] but used my own little script for AutoHotKey:

; edit in Vim...
WinGetActiveTitle, VimTargetWindow
SendInput ^a^c
RunWait c:\Program Files (x86)\Vim\vim72\gvim.exe --servername ClipBrd +ClipBrd +only
If not ErrorLevel
    WinActivate %VimTargetWindow%
    Sleep 10
    SendInput ^a^v

However, it does clobber the clipboard, and is a bit hit and miss whether it gets back to the right application if you've been doing things in the meantime...