When using vi I almost always need to do
:set hlsearch
:set number
How can I make my system always load these as presets or something when I use vi.
In one machine I am root, in another not. So please include an answer for both. Thank you!
just create a .vimrc
file with the following entries:
set hlsearch
set number
Put this file in the $HOME
directory of the user you are using on the particular machine:
/root/
on the machine where you are root
./home/USERNAME
on the machine where your user is USERNAME
if .vimrc does not exist, create it.
You can create a file named .exrc in your home directory and write all the commands (without the preceding : ) there.
When you start the vi editor, the editor searches for the environment variable $EXINIT and uses the contents of the file it points to as configuration commands, if it exists. If EXINIT is not defined, vi looks for the .exrc file in your HOME directory, and uses its configuration commands. Finally, vi looks in your current directory for a file named .exrc and executes the commands in that file, if it exists. In this manner, you can have a different vi configuration for each directory or project that you're working on. (http://alvinalexander.com/unix/edu/un010003/)
The corresponding file for vim is called .vimrc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With