Vim插件之syntastic
来源:互联网 发布:逆波兰表达式 c语言 编辑:程序博客网 时间:2024/05/15 23:47
已经转投ale,具体看这里
syntastic是Vim上比较老牌的一款语法检查插件,虽然性能不及ale,但兼容性要更好一些,配置如下
"syntastic"设置error和warning的标志let g:syntastic_enable_signs = 1let g:syntastic_error_symbol='✗'let g:syntastic_warning_symbol='►'"总是打开Location List(相当于QuickFix)窗口,如果你发现syntastic因为与其他插件冲突而经常崩溃,将下面选项置0let g:syntastic_always_populate_loc_list = 1"自动打开Locaton List,默认值为2,表示发现错误时不自动打开,当修正以后没有再发现错误时自动关闭,置1表示自动打开自动关闭,0表示关闭自动打开和自动关闭,3表示自动打开,但不自动关闭let g:syntastic_auto_loc_list = 1"修改Locaton List窗口高度let g:syntastic_loc_list_height = 5"打开文件时自动进行检查let g:syntastic_check_on_open = 1"自动跳转到发现的第一个错误或警告处let g:syntastic_auto_jump = 1"进行实时检查,如果觉得卡顿,将下面的选项置为1let g:syntastic_check_on_wq = 0"高亮错误let g:syntastic_enable_highlighting=1"让syntastic支持C++11let g:syntastic_cpp_compiler = 'clang++'let g:syntastic_cpp_compiler_options = ' -std=c++11 -stdlib=libc++'"设置pyflakes为默认的python语法检查工具let g:syntastic_python_checkers = ['pyflakes']"修复syntastic使用:lnext和:lprev出现的跳转问题,同时修改键盘映射使用sn和sp进行跳转function! <SID>LocationPrevious() try lprev catch /^Vim\%((\a\+)\)\=:E553/ llast endtry endfunction function! <SID>LocationNext() try lnext catch /^Vim\%((\a\+)\)\=:E553/ lfirst endtry endfunction nnoremap <silent> <Plug>LocationPrevious :<C-u>exe 'call <SID>LocationPrevious()'<CR> nnoremap <silent> <Plug>LocationNext :<C-u>exe 'call <SID>LocationNext()'<CR>nmap <silent> sp <Plug>LocationPrevious nmap <silent> sn <Plug>LocationNext"关闭syntastic语法检查, 鼠标复制代码时用到, 防止把错误标志给复制了nnoremap <silent> <Leader>ec :SyntasticToggleMode<CR>function! ToggleErrors() let old_last_winnr = winnr('$') lclose if old_last_winnr == winnr('$') " Nothing was closed, open syntastic error location panel Errors endifendfunction
因为默认情况下syntastic并不支持对C++11
进行语法检查,因此上面使用了clang
来解决这个问题,clang相比gcc提供的错误信息更加友好,如果你习惯gcc
的话,将上面的
let g:syntastic_cpp_compiler = 'clang++'let g:syntastic_cpp_compiler_options = ' -std=c++11 -stdlib=libc++'
替换为
let g:syntastic_cpp_checkers = ['gcc']let g:syntastic_cpp_compiler = 'gcc'let g:syntastic_cpp_compiler_options = '-std=c++11'
另外,使用时,如果你想临时手动关闭syntastic的Location List输入:lclose
即可
0 0
- Vim插件之syntastic
- vim环境配置之Syntastic
- vim syntastic 安装
- Vim Syntastic Cpplint 配置
- scrooloose/syntastic插件
- Archlinux YouCompleteMe+syntastic vim自动补全插件,显示缩进和状态栏美化,爽心悦目的vim
- vim + syntastic + verilator or iverilog
- Vim自动补全神器:YouCompleteMe+Syntastic
- VIM插件之NERD_comments.vim
- Vim插件之vim-flake8
- Vim插件之vim-autoformat
- Vim插件之vim-signature
- Vim插件之vim-workspace
- Vim插件之vim-airline
- Vim插件之vim-surround
- Vim插件之vim-commentary
- Vim插件之vim-polyglot
- Vim插件之investigate.vim
- robots.txt的介绍和写作
- leetcode 8
- asp.net 中的app_offline.htm的使用
- Nancy总结(一)Nancy一个轻量的MVC框架
- 基于Deep Learning的跟踪算法总结(一)
- Vim插件之syntastic
- 使用.net Stopwatch class 来分析你的代码
- [leetCode刷题笔记]2017.04.03
- 转换到 COFF 期间失败: 文件无效或损坏
- 快排算法及常见两种常见优化方法
- 数据结构(C语言描述)
- 神经网络和贝叶斯网络关系
- c语言模拟库函数strlen、strcpy、strcmp.
- 【Bzoj4195】程序自动分析