


The sixth, $VIMRUNTIME/defaults.vim is the default vimrc that comes with your Vim build. The fifth, $HOME/.exrc works similar to $HOME/.vimrc. The fourth, $EXINIT works similar to $VIMINIT. Note that there is no dot in vimrc file name ( $HOME/.vim/.vimrc won't work, but $HOME/.vim/vimrc will). You might have the ~/.vim directory already for your plugins, custom scripts, or View files. The third, $HOME/.vim/vimrc, is located inside the ~/.vim directory. If you have a ~/.vimrc file, Vim will use this as your vimrc file. $HOME in many cases is your root directory ( ~). The second location, $HOME/.vimrc, is the conventional path for many Vim users. After you run export VIMINIT='let $MYVIMRC="$HOME/dotfiles/testvimrc" | source $MYVIMRC', Vim will now use ~/dotfiles/testvimrc as your vimrc file. If you want to use ~/dotfiles/testvimrc as your $VIMINIT value, you can create an environment variable containing the path of that vimrc. The first location, $VIMINIT, is an environment variable. If Vim finds it, it will stop looking and use $HOME/.vim/vimrc. If there is nothing there, Vim will check for $HOME/.vim/vimrc. If there is nothing there, Vim will check for $HOME/.vimrc. The first found vimrc file will be used and the rest is ignored.įirst Vim will look for a $VIMINIT. When you start Vim, it will check the above six locations in that order for a vimrc file. vimrc dotfile in the root directory ~/.vimrc (it might be different depending on your OS).īehind the scene, Vim looks at multiple places for a vimrc file. The conventional wisdom for vimrc is to add a.
#VIMR RESOURCE VIMRC HOW TO#
In this chapter, you will learn how to orgnize and configure vimrc. In the previous chapters, you learned how to use Vim.
