我的vimrc位于/ usr / share / vim / vimrc,我有.vim文件用于我想要使用的主题。我把.vim主题文件和我在vimrc文件中更改的目录放在哪个目录中? 这是我的vimrc文件:
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
" you can find below. If you wish to change any of those settings, you should
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed. It is recommended to
" make changes after sourcing debian.vim since it alters the value of the
" 'compatible' option.
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim
" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
if has("syntax")
syntax on
endif
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
"set background=dark
" Uncomment the following to have Vim jump to the last position when
" reopening a file
"if has("autocmd")
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"endif
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"if has("autocmd")
" filetype plugin indent on
"endif
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd " Show (partial) command in status line.
"set showmatch " Show matching brackets.
"set ignorecase " Do case insensitive matching
"set smartcase " Do smart case matching
"set incsearch " Incremental search
"set autowrite " Automatically save before commands like :next and :make
"set hidden " Hide buffers when they are abandoned
"set mouse=a " Enable mouse usage (all modes)
set autoindent
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
答案 0 :(得分:4)
该文件不您的vimrc:它是一个默认的vimrc,可在系统范围内使用,使Vim以稍微可预测的方式运行。不要碰它。
vimrc的正确位置是:
$HOME/.vimrc
配置(包括colorschemes)的正确位置为:
$HOME/.vim/
从不 在/usr/share/vim/
中执行任何:您的更改无法可靠或甚至无法预测,并且可以在更新。
答案 1 :(得分:2)
请参阅:help :colorscheme
。
您可以输入:colo
,然后输入ctrl-d
以列出所有可用的色彩方案。
将您的colorscheme放在$HOME/.vim/colors
(Unix)或%USERPROFILE%\vimfiles\colors
(Windows)中。
示例:
将您的colorscheme foo.vim
放入$HOME/.vim/colors
,然后colorscheme foo
放入您的vimrc。
答案 2 :(得分:0)
在Vim
:version
你会得到:
系统vimrc文件:$ VIM / vimrc
用户vimrc文件:$ HOME / .vimrc
并运行:
:scriptnames
您将获得vimrc文件的路径列表:
1: /usr/share/vim/vimrc
2: /usr/share/vim/vim74/debian.vim
3: /usr/share/vim/vim74/syntax/syntax.vim
4: /usr/share/vim/vim74/syntax/synload.vim
5: /usr/share/vim/vim74/syntax/syncolor.vim
6: /usr/share/vim/vim74/filetype.vim
7: ~/.vimrc
8: /usr/share/vim/vim74/vimrc_example.vim
9: /usr/share/vim/vim74/syntax/nosyntax.vim
10: /usr/share/vim/vim74/ftplugin.vim
11: /usr/share/vim/vim74/indent.vim
12: /usr/share/vim/vim74/mswin.vi
...
因此,您可能会发现您的vimrc文件应位于~/.vimrc
下。就像@romainl说的那样,永远不要把你自己的文件放在/usr/share/vim
下,所有更改都可能在更新过程中被覆盖。