How to source all vim files in directory

前端 未结 4 603
遥遥无期
遥遥无期 2021-01-31 16:14

I have split my .vimrc into several files and placed them into ~/vimfiles/vimrc.d/.

Currently I source each file in that directory using exact name:

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-31 16:59

    mb14 gave you the best answer. You want something automatically executed? Then use the standard organization: here the plugin/ subdirectory.

    Otherwise, :runtime would have been your friend:

    :runtime! vimrc.d/*.vim
    
    • :source barks when its parameter doesn't exist while :runtime silently source nothing.
    • :source can source only one file while :runtime! can source any number of files.
    • :source takes an absolute pathname, or a pathname relative to the current directory while :runtime takes a pathname relative to the 'runtimepath' option, which shouldn't be a problem as long as you respect vim conventions.

提交回复
热议问题