* 外部ファイルのインクルード [#x05e3147]
*** runtime [#n5f04072]
** runtime [#n5f04072]
runtime! mylib/*.vim
# パスが通ってない場合はruntimepathに設定する
set runtimepath+=$HOME/.vim/mylib
runtime! *.vim
- http://vim-jp.org/vimdoc-ja/repeat.html#using-scripts
*** source [#h84d2a0d]
*** runtimepathの確認 [#ud6f0b39]
echo &rtp
** source [#h84d2a0d]
if filereadable(expand('$HOME/mylib/foo.vim'))
source $HOME/mylib/foo.vim
endif
for f in split(glob('~/.vim/mylib/*.vim'), '\n')
exe 'source' f
endfor
- http://vim-jp.org/vimdoc-ja/repeat.html#using-scripts
** runtimeとsourceの違い [#m8daf105]
- sourceは引数にファイルのパス(相対パスか絶対パス)を指定してインクルードするのに対して、
- runtimeはruntimepathで指定された検索パスの中から見つかったファイルをインクルードする
https://stackoverflow.com/questions/7321073/whats-the-difference-between-source-file-and-runtime-file-in-vim
** 参考 [#de8537be]
https://unix.stackexchange.com/questions/171132/can-vimrc-be-divided-into-multiple-files