Vim Tips Wiki
mNo edit summary
mNo edit summary
Line 12: Line 12:
 
|category2=
 
|category2=
 
}}
 
}}
Normally typing edit brings up the vi editor and not Vim.
+
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,
 
If you've installed Vim in your home directory somewhere,
 
you don't have a root account, and you want to
 
you don't have a root account, and you want to
 
make Vim the default editor for anything you do
 
make Vim the default editor for anything you do
(e.g. edit a SQL statement in SQLplus), define these three variables in your .profile
+
(e.g. edit a SQL statement in SQLplus), define these three variables in your .profile:
   
 
<pre>
 
<pre>
Line 24: Line 24:
 
</pre>
 
</pre>
   
Note: If you've installed vim with another name (say, vim.exe) then
+
If you've installed vim with another name (say, vim.exe) then
 
change EDITOR=$VIM/vim to EDITOR=$VIM/vim.exe
 
change EDITOR=$VIM/vim to EDITOR=$VIM/vim.exe
   
Source the .profile, then the next time you start an editor from any
+
Source .profile, and the next time you start an editor from any
 
program you'll bring up Vim.
 
program you'll bring up Vim.
   

Revision as of 18:35, 9 May 2008

Tip 175 Printable Monobook 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.

Comments

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


$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.