加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

语法突出显示在终端vim但不是gVIM

发布时间:2020-12-15 22:06:03 所属栏目:安全 来源:网络整理
导读:我目前正在终端中使用VIM,并且具有完美的语法突出显示.但是当我尝试使用g vim时,不管是什么类型的文件或者输入了多少次:“:语法开启”我没有得到任何语法高亮.任何人的想法? 谢谢. 对于那些感兴趣的人,这是我的.vimrc: " Turn on pathogen for all plug-
我目前正在终端中使用VIM,并且具有完美的语法突出显示.但是当我尝试使用g vim时,不管是什么类型的文件或者输入了多少次:“:语法开启”我没有得到任何语法高亮.任何人的想法?

谢谢.

对于那些感兴趣的人,这是我的.vimrc:

" Turn on pathogen for all plug-ins installed after 9/13/2010
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()

" My color theme for vim
colors sorcerer

" Disable line wrapping for now
set nowrap

" Enable the mouse even when vi is used in the terminal
set mouse=a

" Since I use linux,I want this
let g:clipbrdDefaultReg = '+'

" This shows what you are typing as a command.  I love this!
set showcmd

" Automatically cd into the directory that the file is in
autocmd BufEnter * execute "chdir ".escape(expand("%:p:h"),' ')

"Fix Vim's regex...
nnoremap / /v
vnoremap / /v

" Gimme some breathing room at the bottom please...
set scrolloff=5

" makes vim usable with screen
set restorescreen

" Disable the arrow keys... helps the learning
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
imap <up> <nop>
imap <down> <nop>
imap <left> <nop>
imap <right> <nop>


"Kill error bells
set noerrorbells
set visualbell
set t_vb=

" Turn on spell check
" set spell

" Thesaurus!! 
set thesaurus+=/usr/share/myspell/dicts/mthesaur.txt

" Some NERDTree love
let NERDTreeBookmarksFile=expand("$HOME/.vim/NERDTreeBookmarks")

let NERDTreeShowBookmarks=1
let NERDTreeQuitOnOpen=1
let NERDTreeHighlightCursorline=1
let NERDTreeShowFiles=1
let NERDTreeShowHidden=1

" Make swapping windows easier...
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l

" Allow for buffers to be hidden so that they need not be closed to go to
" another file
set hidden

" Turn on incremental search
set incsearch
set smartcase

" Long history is long
set history=1000
set undolevels=1000

" No need for a vi backup file
set nobackup

" Colors!!
set t_Co=256

" Compatibility
set nocompatible

set formatprg=par

" Syntastic!!
let g:syntastic_enable_signs=1
let g:syntastic_auto_loclist=1
let g:syntastic_quiet_warnings=0

" For soft wrapping text
command! -nargs=* Wrap set wrap linebreak nolist
set showbreak=…

" Sandro spacing preferences here
set number
set expandtab
set autoindent
set smartindent
set softtabstop=4
set shiftwidth=4
set shiftround

" Sandro key mapping here
map <F2> :NERDTreeToggle<CR>

"allow backspacing over everything in insert mode
set backspace=indent,eol,start

set showmode "show current mode down the bottom

"Setting the status line...

set statusline=%f       "tail of the filename

"display a warning if the file format isn't Unix
set statusline+=%#warningmsg#
set statusline+=%{&ff!='unix'?'['.&ff.']':''}
set statusline+=%*

"display a warning if file encoding isn't UTf-8
set statusline+=%#warningmsg#
set statusline+=%{(&fenc!='utf-8'&&&fenc!='')?'['.&fenc.']':''}
set statusline+=%*

set statusline+=%h      "help file flag
set statusline+=%y      "filetype
set statusline+=%r      "read only flag
set statusline+=%m      "modified flag

"Syntastic!!
" set statusline+=%#warningmsg#
" set statusline+=%{SyntasticStatuslineFlag()}
" set statusline+=%*


" Auto completion options
set wildmode=list:longest  "Change tab completion to be like Bash's
set wildignore=*.o,*.obj,*~,*.swp,*.pyc "Files to ignore on auto complete

"display tabs and trailing spaces
set list

" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:??,extends:?,precedes:?,trail:?


let g:pydiction_location='~/.vim/after/ftplugin/pydiction/complete-dict'
set sm
set ai
let java_highlight_all=1
let java_highlight_functions="style"
let java_allow_cpp_keywords=1
set tags=~/.tags
set complete=.,w,b,u,t,i

command W w !sudo tee % > /dev/null

" IMPORTANT: win32 users will need to have 'shell slash' set so that latex
" can be called correctly.
"set shell slash

" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
"set grepprg=grep -nH $*


" OPTIONAL: Starting with Vim 7,the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex',which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
" let g:tex_flavor='latex'

filetype on        " enables filetype detection
filetype plugin on " enables filetype specific plug-ins
syntax on
filetype indent on " OPTIONAL: This enables automatic indentation as you type.


" VIM 7.3 features here...
if v:version >= 703
    set relativenumber
    set undofile
endif

解决方法

>使用:让g:colors_name查看已加载的colourscheme的名称,该值应该是’sorcerer’,如果不是,那么某些内容已经严重错误

>类型:hi运算符,你’xxx’部分应该是彩色的,你应该看到guifg =< color>在输出中.>在.vimrc的顶部添加一个新行,其中只包含单词“finish”,这将停止vim处理你的.vimrc.使用:colors default和:syntax on应足以启用语法高亮显示.如果这样做,那么只需将终止线向下移动到.vimrc,直到找到破坏语法高亮的部分.>在Windows上,gVim使用一个名为_vimrc的文件,因此也要检查它.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读