Let's say I have a tarball of all my vim config - everything normally inside ~/.vim (plugins, autoload, colours, all that stuff), and a vimrc file. I extract this to a directory somewhere. So in the directory where I am ($PWD), there is a "vim" folder and a "vimrc" file. (note: this directory will be read-only, so vim shouldn't try to write into it).
What command-line arguments or environment variables can I give to vim to ensure that all my plugins, syntax, etc is loaded as well as the vimrc, in the same order as they normally would if they were located in ~/.vim and ~/.vimrc
As a bonus, I'd like to ignore the host computer's ~/.vimrc and ~/.vim if possible (but this is not mandatory).
If you're wondering why I don't just chuck the files in ~/.vimrc and ~/,vim, I'm trying to package up my own vim configuration and take it with me. I don't want to clobber the vim config of the computer I'm using, I just want to start a vim session with my config.
Replace mode allows you replace existing text by directly typing over it. Before entering this mode, get into normal mode and put your cursor on top of the first character that you want to replace. Then press 'R' (capital R) to enter replace mode. Now whatever you type will replace the existing text.
vimrc , and Vim files of current user are located inside ~/. vim/ . The global configuration file is located at /etc/vimrc .
The system vimrc should normally be left unmodified and is located in the $VIM * directory.
I have a portable .vim
folder exactly as you described, this is how I have set it up:
Put your portable .vimrc
file inside your .vim
folder.
Add the following lines to the start of your portable .vim/.vimrc
:
" set default 'runtimepath' (without ~/.vim folders) let &runtimepath = printf('%s/vimfiles,%s,%s/vimfiles/after', $VIM, $VIMRUNTIME, $VIM) " what is the name of the directory containing this file? let s:portable = expand('<sfile>:p:h') " add the directory to 'runtimepath' let &runtimepath = printf('%s,%s,%s/after', s:portable, &runtimepath, s:portable)
vim -u /path/to/portable/vim/.vimrc
.On Unix & Linux systems (and maybe Windows) Vim uses the $HOME environment variable to locate the .vimrc file and .vim directory. So you can cd into the directory where you have your custom versions and start vim or gvim like this:
HOME=. vim files....
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