History
Article Edit this page Discussion

Set Vim as your default editor for Unix

From Vim Tips Wiki

(Redirected from VimTip175)
Jump to: navigation, search

Tip 175 Previous Next Created: December 6, 2001 Complexity: basic Author: bhaskar Version: 5.7


Normally, typing edit on a Unix system brings up the vi editor and not Vim. If you've installed Vim in your home directory somewhere, you don't have a root account, and you want to make Vim the default editor for anything you do (e.g. edit a SQL statement in SQLplus), define these three variables in your .profile:

VIM=<base directory where Vim executable is placed>
VIMRUNTIME=<base directory where Vim runtimes are kept>
EDITOR=$VIM/vim

If you've installed vim with another name (say, vim.exe) then change EDITOR=$VIM/vim to EDITOR=$VIM/vim.exe

Source .profile, and the next time you start an editor from any program you'll bring up Vim.


On Ubuntu (or other Debian-based systems), update-alternatives can be used to change the default editor:

sudo update-alternatives --config editor
# Type the number which corresponds to Vim here (after installing it) then press Enter.

[edit] Comments

Notable programs which use the $EDITOR variable include CVS and Mutt. Anyone care to add to the list?

ClearCase as well, for the few commands that launch an editor.

$EDITOR is the place to have your editor defined. There's also $VISUAL to define a non-line oriented editor (which is actually vi's place). All programs on unixlikes spawning editors should support these. Some have reasons not to and some are just stupidly made and others stupidly configured.


Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto Wiki
Doctor Who
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Mystery Science Theater 3000
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions
Send this article to a friend
"Set Vim as your default editor for Unix"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation