Как я “получаю” что-то в своем .vimrc файле?

Я найду способ ответить на вопрос

    def git = ['sh', '-c', 'git commit -m "[skip ci]"'].execute()
94
задан Paul Wicks 29 April 2009 в 17:39
поделиться

4 ответа

Источник файла "выполняет" его. По сути, каждая строка файла считается командой. Sourcing это то же самое, что набирать каждую команду по порядку. Вы получаете источник с помощью команды : source (обычно сокращается до : так ).

Так что, если вы используете myStuff.vim

:so myStuff.vim

и if myStuff. vim содержал эти строки

set xx iI just intersted this<C-]>
set yy bbbb4dw

Это так же, как если бы вы вводили эти команды в Vim

:set xx iI just intersted this<C-]>
:set yy bbbb4dw

. Единственный файл, полученный по умолчанию, это .vimrc ( _vimrc в windows ) так что это место, где вы можете хранить все команды, которые вы используете для настройки Vim каждый раз.

Интересным становится тот факт, что поскольку исходный файл - это просто серия команд, а получение - это команда, вы можете исходные файлы из ваших исходных файлов. Поэтому плагины, которые вы используете каждый раз, могут быть получены при запуске Vim путем добавления строки в ваш .vimrc , например,

 so myPlugin.vim
113
ответ дан 24 November 2019 в 06:07
поделиться

Files in your .vim/plugin directory are sourced (loaded) automatically.

43
ответ дан 24 November 2019 в 06:07
поделиться

There are normally two vimrc files, one is _vimrc and the other _gvimrc (in the first one are the things for vim, and in the second for gvim - graphical things) - although most people I know just put everything in _vimrc.

A good practice is to keep all your extra files (plugins, colorschemes, snippets ...) in a separate (your own) vimfiles directory (which you can take with you).

If you do

:help vimfiles

vim will tell your vimfiles directory should be located. It depends somewhat on the platform (win, unix). On windows the usual is in your user folder (documents and settings, then user ...). In vimfiles directory there are a couple of subdirectories. Amongst them is the "plugin" subdirectory. Plugins put in that dir will be loaded automatically (also plugins put in subdirectories of "plugin"). If you do not wish to load it automatically, just put it in your "vimfiles", or some other directory, and

:so plugin_name.vim (with the appropriate path)
(you can use the $vim, $vimfiles, and $home as shortcuts when defining path to plugin)
6
ответ дан 24 November 2019 в 06:07
поделиться

There is always the :source file command. I usually write .vimrc that contains custom commands and what not for the console application and then a .gvimrc that contains additional goodies that are appropriate for a windowed version. My .gvimrc starts with source $HOME/.vimrc to pick up everything from the console version before adding in new stuff.

12
ответ дан 24 November 2019 в 06:07
поделиться
Другие вопросы по тегам:

Похожие вопросы: