Vim 配色方案仅在 .vimrc 中有效

Vim 配色方案仅在 .vimrc 中有效

如果我专门~/.vimrc在 vim 中编辑:colorscheme <some colorscheme>,它将完全按照预期执行。/usr/share/vim/vim74/colors但只有 中的方案会起作用,而不会在任何其他文件夹中起作用,例如~/.vim/colors/(它返回Cannot find colorscheme '<some colorscheme>)。

如果我正在编辑除此之外的任何其他文件~/.vimrc:colorscheme <some colorscheme>则不会返回任何错误,而只会更改背景颜色,即~位于每行开头的颜色,如果我幸运的话,会将文本从黄色单调更改为蓝色单调或类似的东西。

.vimrc文件现在为空。

答案1

这是因为语法高亮默认关闭。尝试:syntax on一下,如果 vim 无法识别文件类型,你可以手动操作set filetype=<filetype>,例如set filetype=php。虽然在 gvim 中获取语法高亮文件类型的完整列表很简单,但对于控制台版本,你有几个选项:a)列出识别它们的自动命令

        :au filetypedetect

These autocommands are set by $VIMRUNTIME/filetype.vim; one of them runs
$VIMRUNTIME/scripts.vim to try to identify files from their contents
when the name, path, etc. are not enough.

b) check which filetypes have scripts to handle them

(gvim) Syntax => Show filetypes in menu

which, however, lists only preinstalled filetypes, and not with the name
under which the 'filetype' or 'syntax' option knows them;

or else, for each of the directories listed in the 'runtimepath' option,
list (using ls on Unix or dir, possibly dir /w to save space, on Windows):

<directory>/ftplugin/*.vim
<directory>/indent/*.vim
<directory>/syntax/*.vim

Note that 'filetype' (as used by ftplugin and indent scripts) and
'syntax' (as used by syntax scripts) are separate options, which have
usually the same value but could be different.

In a "vanilla" install of Vim with no third-party scripts installed, the
only value of <directory> above pointing to an existing, nonempty
directory is your $VIMRUNTIME directory.

答案2

我从来没有让配色方案在 Guake 或常规终端中工作,但在尝试终端终止器后,它就运行良好了。

相关内容