.vimrc в подкаталогах
Иногда случается полезным устанавливать некоторые настройки vim специфично для отдельных каталогов/подкаталогов.
Вот небольшой скриптец, который подгружает .vimrc из каталога, в котором открывается или создаётся файл.
function! Load_local_rc(dir)
if a:dir == expand("~")
return
endif
let rcfile = a:dir."/".".vimrc"
if ! filereadable(rcfile)
return
endif
execute "source ".rcfile
endfunction
autocmd BufReadPre * call Load_local_rc(expand("<afile>:p:h"))
autocmd BufNewFile * call Load_local_rc(expand("<afile>:p:h"))- 1719 просмотров
Страница для печати

Оказывается есть встроенное в vim. Вот что выдает :help noexrc
*'exrc'* *'ex'* *'noexrc'* *'noex'* 'exrc' 'ex' boolean (default off) global {not in Vi} Enables the reading of .vimrc, .exrc and .gvimrc in the current directory. If you switch this option on you should also consider setting the 'secure' option (see |initialization|). Using a local .exrc, .vimrc or .gvimrc is a potential security leak, use with care! also see |.vimrc| and |gui-init|. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons.--
Signature invent in progress 24% ##........
Отправить комментарий