1

我的 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
4

3 回答 3

5

该文件不是你的 vimrc:它是一个默认的 vimrc,它在系统范围内可用,以使 Vim 以稍微可预测的方式运行。不要碰它。

vimrc正确位置是:

$HOME/.vimrc

并且您的配置(包括颜色方案)的正确位置是:

$HOME/.vim/

永远不要任何事情:您的/usr/share/vim/更改将无法可靠地工作,甚至无法预测,并且它们可能会在更新期间被覆盖。

于 2013-08-17T11:58:06.097 回答
2

:help :colorscheme

您可以键入:colo,然后ctrl-d列出所有可用的配色方案。

将您的配色方案放在$HOME/.vim/colors(Unix) 或%USERPROFILE%\vimfiles\colors(Windows) 中。

例子:

将您的配色方案foo.vim放入$HOME/.vim/colors然后colorscheme foo放入您的 vimrc。

于 2013-08-17T11:27:58.127 回答
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,所有更改都可能在更新期间被覆盖。

于 2015-09-20T12:43:05.703 回答