不能,高亮显示功能是高亮显示关键字、各种括号,自己定义的变量不是关键字,所以不能高亮显示,不光是在Vim,其他的文本编辑器也是一样的。
十载的武威网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。网络营销推广的优势是能够根据用户设备显示端的尺寸不同,自动调整武威建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。成都创新互联从事“武威网站设计”,“武威网站推广”以来,每个客户项目都认真落实执行。
用vim很多年了。没明白你所说的高亮红和高亮绿是个什么情况。
常年用vim的人一般都会有为自己定制的vim。所以你说这种高亮、红、绿,估计很多人不会明白是什么意思。我的c语言里面就完全没有类似的。对应的Python配置里面倒是有块状红色,表示那一行代码逻辑或者语法上有明显错误。
在~/.vimrc中加入syntax on就行了。下面是我的配置文件,可以直接用,我也是在网上拼凑的
" 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.
"新建.c,.h,.sh,.java文件,自动插入文件头
autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()"
""定义函数SetTitle,自动插入文件头
func SetTitle()
"如果文件类型为.sh文件
if filetype == 'sh'
call setline(1,"\#########################################################################")
call append(line("."), "\# File Name: ".expand("%"))
call append(line(".")+1, "\# Author: Leo ")
call append(line(".")+2, "\# mail: kuling729@gmail点抗 ")
call append(line(".")+3, "\# Created Time: ".strftime("%c"))
call append(line(".")+4, "\#########################################################################")
call append(line(".")+5, "\#!/bin/bash")
call append(line(".")+6, "")
else
call setline(1, "/*************************************************************************")
call append(line("."), " File Name: ".expand("%"))
call append(line(".")+1, " Author: Leo")
call append(line(".")+2, " Mail: kuling729@gmail点抗 ")
call append(line(".")+3, " Created Time: ".strftime("%c"))
call append(line(".")+4, " ************************************************************************/")
call append(line(".")+5, "")
endif
if filetype == 'cpp'
call append(line(".")+6, "#includeiostream")
call append(line(".")+7, "using namespace std;")
call append(line(".")+8, "")
endif
if filetype == 'c'
call append(line(".")+6, "#includestdio.h")
call append(line(".")+7, "")
endif
"新建文件后,自动定位到文件末尾
autocmd BufNewFile * normal G
endfunc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has("syntax")
syntax on
endif
set number
set tabstop=4
set softtabstop=4
set shiftwidth=4
set autoindent
set cindent
colorscheme evening
let g:indent_guides_guide_size=1
set tags=tags;
set autochdir
" 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)
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif