Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
VIM语法高亮显示不起作用_Vim_Syntax_Raspberry Pi - Fatal编程技术网

VIM语法高亮显示不起作用

VIM语法高亮显示不起作用,vim,syntax,raspberry-pi,Vim,Syntax,Raspberry Pi,我对vim还相当陌生,并尝试将语法突出显示设置到位。我制作并编辑了我的vimrc文件,当我查看该文件时,它是彩色的。但是当我转到python文件时,它们没有突出显示。任何帮助都会很好 L: http://vim.wikia.com/wiki/Example_vimrc " Authors: http://vim.wikia.com/wiki/Vim_on_Freenode " Description: A minimal, but feature rich, example .vimrc. If

我对vim还相当陌生,并尝试将语法突出显示设置到位。我制作并编辑了我的vimrc文件,当我查看该文件时,它是彩色的。但是当我转到python文件时,它们没有突出显示。任何帮助都会很好

L: http://vim.wikia.com/wiki/Example_vimrc
" Authors: http://vim.wikia.com/wiki/Vim_on_Freenode
" Description: A minimal, but feature rich, example .vimrc. If you are a
"              newbie, basing your first .vimrc on this file is a good choice.
"              If you're a more advanced user, building your own .vimrc based
"              on this file is still a good idea.

"------------------------------------------------------------
" Features {{{1
"
" These options and commands enable some very useful features in Vim, that
" no user should have to live without.

" Set 'nocompatible' to ward off unexpected things that your distro might
" have made, as well as sanely reset options when re-sourcing .vimrc
set nocompatible

" Attempt to determine the type of a file based on its name and possibly its
" contents. Use this to allow intelligent auto-indenting for each filetype,
" and for plugins that are filetype specific.
filetype indent plugin on

" Enable syntax highlighting
syntax on


"------------------------------------------------------------
" Must have options {{{1
"
" These are highly recommended options.

" Vim with default settings does not allow easy switching between multiple files
" in the same editor window. Users can use multiple split windows or multiple
" tab pages to edit multiple files, but it is still best to enable an option to
" allow easier switching between files.
"
" One such option is the 'hidden' option, which allows you to re-use the same
" window and switch from an unsaved buffer without saving it first. Also allows
" you to keep an undo history for multiple files when re-using the same window
" in this way. Note that using persistent undo also lets you undo in multiple
" files even in the same window, but is less efficient and is actually designed
" for keeping undo history after closing Vim entirely. Vim will complain if you
" try to quit without saving, and swap files will keep you safe if your computer
" crashes.
set hidden

" Note that not everyone likes working this way (with the hidden option).
" Alternatives include using tabs or split windows instead of re-using the same
" window as mentioned above, and/or either of the following options:
" set confirm
" set autowriteall

" Better command-line completion
set wildmenu

" Show partial commands in the last line of the screen
set showcmd

" Highlight searches (use <C-L> to temporarily turn off highlighting; see the
" mapping of <C-L> below)
set hlsearch

" Modelines have historically been a source of security vulnerabilities. As
" such, it may be a good idea to disable them and use the securemodelines
" script, <http://www.vim.org/scripts/script.php?script_id=1876>.
" set nomodeline


"------------------------------------------------------------
" Usability options {{{1
"
" These are options that users frequently set in their .vimrc. Some of them
" change Vim's behaviour in ways which deviate from the true Vi way, but
" which are considered to add usability. Which, if any, of these options to
" use is very much a personal preference, but they are harmless.

" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase

" Allow backspacing over autoindent, line breaks and start of insert action
set backspace=indent,eol,start

" When opening a new line and no filetype-specific indenting is enabled, keep
" the same indent as the line you're currently on. Useful for READMEs, etc.
set autoindent

" Stop certain movements from always going to the first character of a line.
" While this behaviour deviates from that of Vi, it does what most users
" coming from other editors would expect.
set nostartofline

" Display the cursor position on the last line of the screen or in the status
" line of a window
set ruler

" Always display the status line, even if only one window is displayed
set laststatus=2

" Instead of failing a command because of unsaved changes, instead raise a
" dialogue asking if you wish to save changed files.
set confirm

" Use visual bell instead of beeping when doing something wrong
set visualbell

" And reset the terminal code for the visual bell. If visualbell is set, and
" this line is also included, vim will neither flash nor beep. If visualbell
" is unset, this does nothing.
set t_vb=

" Enable use of the mouse for all modes
set mouse=a

" Set the command window height to 2 lines, to avoid many cases of having to
" "press <Enter> to continue"
set cmdheight=2

" Display line numbers on the left
set number

" Quickly time out on keycodes, but never time out on mappings
set notimeout ttimeout ttimeoutlen=200

" Use <F11> to toggle between 'paste' and 'nopaste'
set pastetoggle=<F11>


"------------------------------------------------------------
" Indentation options {{{1
"
" Indentation settings according to personal preference.

" Indentation settings for using 2 spaces instead of tabs.
" Do not change 'tabstop' from its default value of 8 with this setup.
set shiftwidth=2
set softtabstop=2
set expandtab

" Indentation settings for using hard tabs for indent. Display tabs as
" two characters wide.
"set shiftwidth=2
"set tabstop=2


"------------------------------------------------------------
" Mappings {{{1
"
" Useful mappings

" Map Y to act like D and C, i.e. to yank until EOL, rather than act as yy,
" which is the default
map Y y$

" Map <C-L> (redraw screen) to also turn off search highlighting until the
" next search
nnoremap <C-L> :nohl<CR><C-L>


"------------------------------------------------------------
L:http://vim.wikia.com/wiki/Example_vimrc
“作者:http://vim.wikia.com/wiki/Vim_on_Freenode
描述:一个最小但功能丰富的示例.vimrc。如果你是一个
“新手,将您的第一个.vimrc基于此文件是一个不错的选择。
“如果您是更高级的用户,请构建自己的基于.vimrc的
“在这个文件上仍然是一个好主意。
"------------------------------------------------------------
“特征{{{1
"
“这些选项和命令支持Vim中的一些非常有用的功能
“任何用户都不应该生活在没有。
设置“nocompatible”以避免发行版可能遇到的意外情况
“在重新寻源时,已做出以及明智地重置选项。vimrc
兼容模式
“尝试根据文件名和可能的名称确定文件类型
“内容。使用此选项可以对每个文件类型进行智能自动缩进,
对于文件类型特定的插件。
上的文件类型缩进插件
“启用语法突出显示
语法高亮
"------------------------------------------------------------
“必须有选项{{{1
"
“这些都是强烈建议的选项。
“具有默认设置的Vim不允许在多个文件之间轻松切换
“在同一编辑器窗口中。用户可以使用多个拆分窗口或多个
“选项卡页以编辑多个文件,但最好还是启用一个选项来编辑多个文件。”
“允许更轻松地在文件之间切换。
"
“其中一个选项是‘隐藏’选项,它允许您重复使用相同的选项
“窗口并从未保存的缓冲区切换,而不首先保存它。还允许
“您需要在重新使用同一窗口时保留多个文件的撤消历史记录
“以这种方式。请注意,使用“持久撤消”还可以多次撤消
“文件甚至在同一窗口中,但效率较低,而且实际上是经过设计的
“用于在完全关闭Vim后保留撤消历史记录。如果
“尝试退出而不保存,如果您的计算机
“崩溃。
隐藏
“请注意,并非所有人都喜欢这种方式(使用隐藏选项)。
“替代方法包括使用选项卡或拆分窗口,而不是重复使用相同的选项卡或拆分窗口
“如上所述的窗口,和/或以下任一选项:
“设定确认
“设置自动写入”
“更好地完成命令行
设置菜单
“在屏幕的最后一行显示部分命令
设置showcmd
突出显示搜索(用于暂时关闭突出显示;请参阅
“地图绘制(见下文)
高亮显示
“Modelines历来是安全漏洞的来源
“因此,禁用它们并使用securemodelines可能是一个好主意
“脚本。
“设置nomodeline
"------------------------------------------------------------
“可用性选项{{{1
"
“这些是用户经常在其.vimrc中设置的选项
“以偏离真实Vi方式的方式改变Vim的行为,但
“哪些被认为是增加可用性的。如果有的话,这些选项中有哪些是
“使用在很大程度上是个人偏好,但它们是无害的。
使用不区分大小写的搜索,除非使用大写字母
置之不理
设置smartcase
允许在自动缩进、换行和插入操作开始时使用退格
设置退格=缩进、下线、开始
打开新行时,如果未启用文件类型特定的缩进,请保留
“与当前所在行相同的缩进。对自述等有用。”。
自动缩进
“阻止某些动作始终指向行的第一个字符。
“虽然这种行为与Vi不同,但它却做了大多数用户所做的事情
“其他编辑也会这么想。
设置诺萨托夫线
“将光标位置显示在屏幕的最后一行或状态中
“窗户的线条
定尺
'始终显示状态行,即使只显示一个窗口
设置laststatus=2
与其因为未保存的更改而使命令失败,不如引发
“询问是否要保存更改的文件的对话框。
设定确认
“当做错事时,用可视铃声代替嘟嘟声
设置可视球
重置可视钟的终端代码。如果设置了可视钟,则
“该行也包括在内,vim既不会闪烁也不会发出蜂鸣音。如果visualbell
“未设置,这不起任何作用。
设置t_vb=
“允许在所有模式下使用鼠标
设置鼠标=a
“将命令窗口高度设置为2行,以避免许多情况下必须
“按以继续”
设置cmdheight=2
“在左侧显示行号
设定数
“在键码上快速超时,但在映射上从不超时
设置notimeout ttimeout ttimeoutlen=200
“用于在“粘贴”和“不粘贴”之间切换”
设置粘贴切换=
"------------------------------------------------------------
“缩进选项{{{1
"
“根据个人喜好设置缩进。
“使用2个空格而不是制表符的缩进设置。
“使用此设置时,不要将“tabstop”的默认值从8更改为8。
设置shiftwidth=2
设置softtabstop=2
设置扩展选项卡
“使用硬制表符进行缩进的缩进设置。将制表符显示为”
“两个字符宽。
“设置shiftwidth=2
“设置tabstop=2
"------------------------------------------------------------
“映射{{{1
"
“有用的映射
“将Y映射为像D和C一样的动作,即将Y拉扯到EOL,而不是像yy那样动作,
“这是默认值
地图Y$
“映射(重绘屏幕)以同时关闭搜索高亮显示,直到
“下一次搜索
nnoremap:nohl
"------------------------------------------------------------
文件位于以下位置:
/home/pi

已解决,使用sudo启动vim并引用了from vimrc

您可以发布vimrc的内容吗?因此基本上您将vimrc放在了错误的目录中(root的主目录而不是您自己的主目录)