I work in several groups, each of which has its own tab/indentation/spacing standards in C.
Is there a way to have separate selectable VIM configurations for each so, when I edit a file, either:
set group=1
to select a configurationUsing file name completion, you could type :e $M then press Tab until you see the desired variable. If you only want to see the path, type :echo $M then press Tab to see the variable, and press Enter. In gvim, the Edit menu includes "Startup Settings" which will use $MYVIMRC to edit your vimrc file.
In the terminal, type vi . vimrc . This will create an empty vimrc system file which you want to use. In the file, type set number , and then hit Esc on the keyboard and type in :wq .
Settings file used by Vim, a text editing program often used by source code developers and system administrators; saves the default settings for the editor when it is opened; allows users to customize options for the editor. VIMRC files are saved in a plain text format.
I have this in $HOME/.vimrc
:
if filereadable(".vim.custom") so .vim.custom endif
This allows me to put a .vim.custom
file in every directory to load commands and options specific to that directory. If you're working on multiple projects that have deep directory structures you might need something more sophisticated (e.g. walk up the directory tree until a .vim.custom
is found), but the same basic idea will work.
UPDATE:
I now do something like this in order to read a .vim
file from the same directory as the file I'm editing, regardless of what the current directory is.
let b:thisdir=expand("%:p:h") let b:vim=b:thisdir."/.vim" if (filereadable(b:vim)) execute "source ".b:vim endif
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