Vim syntastic:如何让符号选项与此插件一起使用?
我知道我有 Syntastic 工作,因为在测试 .c 文件中,我将编写一行缺少分号的行并将其移动,并且 :Errors
窗口报告正确的语法错误位置。
但是我无法使 syntastic-error-signs
选项正常工作。
这是我的完整 .vimrc (文件底部的 Syntastic 特定选项)
set nocompatible
set enc=utf-8
set fenc=utf-8
set number
set backspace=indent,eol,start "allow bs over everything
fixdel "for Cygwin
set nobackup
"set noswapfile
set dir=/tmp "swap file location
set autoindent
set smartindent
set tabstop=4
set shiftwidth=4
set shiftround "use multiples of shiftwidth when using < or >
"set expandtab "use spaces instead of \t
set nowrap
set history=1000 " remember more commands and search history
set undolevels=1000 " use many muchos levels of undo
set wildignore=*.swp,*.bak,*.pyc,*.class
set title " change the terminal's title
set visualbell " don't beep
set noerrorbells " don't beep
set splitright
set splitbelow
" Minimal number of screen lines to keep above and below the cursor.
set scrolloff=4
" Shows the current line in different color
set cursorline
filetype plugin on
syntax on
highlight ExtraWhitespace ctermbg=darkgreen guibg=lightgreen
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/
"remove trailing whitespace
"http://vim.wikia.com/wiki/Remove_unwanted_spaces#Automatically_removing_all_trailing_whitespace
"autocmd BufWritePre * :%s/\s\+$//e
autocmd BufWritePre *.c :%s/\s\+$//e
autocmd BufWritePre *.cpp :%s/\s\+$//e
autocmd BufWritePre *.c++ :%s/\s\+$//e
autocmd BufWritePre *.h :%s/\s\+$//e
autocmd BufWritePre *.java :%s/\s\+$//e
autocmd BufWritePre *.php :%s/\s\+$//e
autocmd BufWritePre *.pl :%s/\s\+$//e
autocmd BufWritePre *.py :%s/\s\+$//e
"autocmd FileType c,cpp,c++,java,php,pl,py autocmd BufWritePre <buffer> :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))
"search options
set smartcase "ignore case if all lowercase
set ignorecase
set incsearch
set hlsearch
set showmatch
nmap <space> <C-f>
nmap n nzz
nmap N Nzz
"adding / removing lines
map <S-Enter> O<Esc>j
map <CR> o<Esc>k
"reduce keystrokes for command mode
inoremap ;w <esc>:w<cr>a
nnoremap ; :
"set arrow keys to move between buffer / tabs
inoremap <Up> <esc>:bprev<cr>
inoremap <Down> <esc>:bnext<cr>
inoremap <Left> <esc>:tabprev<cr>
inoremap <Right> <esc>:tabnext<cr>
noremap <Up> :bprev<cr>
noremap <Down> :bnext<cr>
noremap <Left> :tabprev<cr>
noremap <Right> :tabnext<cr>
" Easy window navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
"Maps for jj to act as esc
inoremap jj <esc>
cnoremap jj <C-c>
inoremap jk <esc>
inoremap kj <esc>
"Use Q for formatting the current paragraph (or selection)
vmap Q gq
nmap Q gqap
"navigate wrapped lines
nnoremap k gk
nnoremap j gj
nnoremap gk k
nnoremap gj j
"forget sudo
cmap w!! w !sudo tee % >/dev/null
"toggle set paste option
set pastetoggle=<F2>
"gvim specific options
set vb t_vb=
set guioptions-=T
"set foldmethod=indent
set showtabline=2
"plugin command t
noremap <S-T> :CommandT<cr>
"always show status line
set laststatus=2
set statusline=%<%y\ b%n\ %h%m%r%=%-14.(%l,%c%V%)\ %P
"for Syntastic
let g:syntastic_enable_signs=1
let g:syntastic_quiet_warnings=1
au BufWritePost ~/.vimrc source ~/.vimrc
I know I have Syntastic working because in a test .c file I'll write a line with a missing semicolon and move it around, and the :Errors
window reports the correct syntax error location.
However I cannot get the syntastic-error-signs
option working.
This is my full .vimrc (Syntastic specific options at bottom of file)
set nocompatible
set enc=utf-8
set fenc=utf-8
set number
set backspace=indent,eol,start "allow bs over everything
fixdel "for Cygwin
set nobackup
"set noswapfile
set dir=/tmp "swap file location
set autoindent
set smartindent
set tabstop=4
set shiftwidth=4
set shiftround "use multiples of shiftwidth when using < or >
"set expandtab "use spaces instead of \t
set nowrap
set history=1000 " remember more commands and search history
set undolevels=1000 " use many muchos levels of undo
set wildignore=*.swp,*.bak,*.pyc,*.class
set title " change the terminal's title
set visualbell " don't beep
set noerrorbells " don't beep
set splitright
set splitbelow
" Minimal number of screen lines to keep above and below the cursor.
set scrolloff=4
" Shows the current line in different color
set cursorline
filetype plugin on
syntax on
highlight ExtraWhitespace ctermbg=darkgreen guibg=lightgreen
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/
"remove trailing whitespace
"http://vim.wikia.com/wiki/Remove_unwanted_spaces#Automatically_removing_all_trailing_whitespace
"autocmd BufWritePre * :%s/\s\+$//e
autocmd BufWritePre *.c :%s/\s\+$//e
autocmd BufWritePre *.cpp :%s/\s\+$//e
autocmd BufWritePre *.c++ :%s/\s\+$//e
autocmd BufWritePre *.h :%s/\s\+$//e
autocmd BufWritePre *.java :%s/\s\+$//e
autocmd BufWritePre *.php :%s/\s\+$//e
autocmd BufWritePre *.pl :%s/\s\+$//e
autocmd BufWritePre *.py :%s/\s\+$//e
"autocmd FileType c,cpp,c++,java,php,pl,py autocmd BufWritePre <buffer> :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))
"search options
set smartcase "ignore case if all lowercase
set ignorecase
set incsearch
set hlsearch
set showmatch
nmap <space> <C-f>
nmap n nzz
nmap N Nzz
"adding / removing lines
map <S-Enter> O<Esc>j
map <CR> o<Esc>k
"reduce keystrokes for command mode
inoremap ;w <esc>:w<cr>a
nnoremap ; :
"set arrow keys to move between buffer / tabs
inoremap <Up> <esc>:bprev<cr>
inoremap <Down> <esc>:bnext<cr>
inoremap <Left> <esc>:tabprev<cr>
inoremap <Right> <esc>:tabnext<cr>
noremap <Up> :bprev<cr>
noremap <Down> :bnext<cr>
noremap <Left> :tabprev<cr>
noremap <Right> :tabnext<cr>
" Easy window navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
"Maps for jj to act as esc
inoremap jj <esc>
cnoremap jj <C-c>
inoremap jk <esc>
inoremap kj <esc>
"Use Q for formatting the current paragraph (or selection)
vmap Q gq
nmap Q gqap
"navigate wrapped lines
nnoremap k gk
nnoremap j gj
nnoremap gk k
nnoremap gj j
"forget sudo
cmap w!! w !sudo tee % >/dev/null
"toggle set paste option
set pastetoggle=<F2>
"gvim specific options
set vb t_vb=
set guioptions-=T
"set foldmethod=indent
set showtabline=2
"plugin command t
noremap <S-T> :CommandT<cr>
"always show status line
set laststatus=2
set statusline=%<%y\ b%n\ %h%m%r%=%-14.(%l,%c%V%)\ %P
"for Syntastic
let g:syntastic_enable_signs=1
let g:syntastic_quiet_warnings=1
au BufWritePost ~/.vimrc source ~/.vimrc
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的 Vim 副本必须在符号支持的情况下进行编译才能使其正常工作 - 您可以通过在命令模式下输入以下内容进行检查:
并查找它是否返回 1。
Your copy of Vim must be compiled with signs support in order for this to work -- you can check by entering the following in command mode:
and look for it to return a 1.