1
0
mirror of https://github.com/amix/vimrc synced 2025-06-24 07:44:59 +08:00

Added vim-commentary and updarted the plugins.

commentary:
Comment stuff out.  Use `gcc` to comment out a line (takes a count),
`gc` to comment out the target of a motion (for example, `gcap` to
comment out a paragraph), and `gc` in visual mode to comment out the
selection.  That's it.
This commit is contained in:
amix
2014-03-02 14:35:00 +00:00
parent 8c9210dca4
commit 0d8e7370bd
56 changed files with 1330 additions and 873 deletions

View File

@ -28,10 +28,6 @@ endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_c_cppcheck_Preprocess(errors)
return map(copy(a:errors), 'substitute(v:val, ''\v^\[[^]]+\]\zs( -\> \[[^]]+\])+\ze:'', "", "")')
endfunction
function! SyntaxCheckers_c_cppcheck_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args': syntastic#c#ReadConfig(g:syntastic_cppcheck_config_file),
@ -50,7 +46,7 @@ function! SyntaxCheckers_c_cppcheck_GetLocList() dict
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'SyntaxCheckers_c_cppcheck_Preprocess',
\ 'preprocess': 'cppcheck',
\ 'returns': [0] })
for e in loclist

View File

@ -54,7 +54,7 @@ function! s:GhcModNew(exe)
try
let ghc_mod_version = filter(split(system(exe), '\n'), 'v:val =~# ''\m^ghc-mod version''')[0]
let ret = syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(ghc_mod_version), [2, 1, 2])
catch /^Vim\%((\a\+)\)\=:E684/
catch /\m^Vim\%((\a\+)\)\=:E684/
call syntastic#log#error("checker haskell/ghc_mod: can't parse version string (abnormal termination?)")
let ret = -1
endtry

View File

@ -42,7 +42,8 @@ function! SyntaxCheckers_html_jshint_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr('')} })
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 2] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -48,21 +48,6 @@ endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_html_validator_Preprocess(errors)
let out = []
for e in a:errors
let parts = matchlist(e, '\v^"([^"]+)"(.+)')
if len(parts) >= 3
" URL decode, except leave alone any "+"
let parts[1] = substitute(parts[1], '\m%\(\x\x\)', '\=nr2char("0x".submatch(1))', 'g')
let parts[1] = substitute(parts[1], '\m\\"', '"', 'g')
let parts[1] = substitute(parts[1], '\m\\\\', '\\', 'g')
call add(out, '"' . parts[1] . '"' . parts[2])
endif
endfor
return out
endfunction
function! SyntaxCheckers_html_validator_GetLocList() dict
let fname = syntastic#util#shexpand('%')
let makeprg = self.getExecEscaped() . ' -s --compressed -F out=gnu -F asciiquotes=yes' .
@ -87,7 +72,7 @@ function! SyntaxCheckers_html_validator_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'SyntaxCheckers_html_validator_Preprocess',
\ 'preprocess': 'validator',
\ 'returns': [0] })
endfunction

View File

@ -27,33 +27,6 @@ endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_java_checkstyle_Preprocess(errors)
let out = []
let fname = expand('%')
for err in a:errors
if match(err, '\m<error\>') > -1
let line = str2nr(matchstr(err, '\m\<line="\zs\d\+\ze"'))
if line == 0
continue
endif
let col = str2nr(matchstr(err, '\m\<column="\zs\d\+\ze"'))
let type = matchstr(err, '\m\<severity="\zs.\ze')
if type !~? '^[EW]'
let type = 'E'
endif
let message = syntastic#util#decodeXMLEntities(matchstr(err, '\m\<message="\zs[^"]\+\ze"'))
call add(out, join([fname, type, line, col, message], ':'))
elseif match(err, '\m<file name="') > -1
let fname = syntastic#util#decodeXMLEntities(matchstr(err, '\v\<file name\="\zs[^"]+\ze"'))
endif
endfor
return out
endfunction
function! SyntaxCheckers_java_checkstyle_GetLocList() dict
let fname = syntastic#util#shescape( expand('%:p:h') . '/' . expand('%:t') )
@ -73,8 +46,8 @@ function! SyntaxCheckers_java_checkstyle_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'preprocess': 'SyntaxCheckers_java_checkstyle_Preprocess' })
\ 'preprocess': 'checkstyle',
\ 'subtype': 'Style' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -17,9 +17,6 @@ let g:loaded_syntastic_javascript_jscs_checker = 1
let s:save_cpo = &cpo
set cpo&vim
" we borrow SyntaxCheckers_java_checkstyle_Preprocess() from java/checkstyle
runtime! syntax_checkers/java/*.vim
function! SyntaxCheckers_javascript_jscs_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '--no-colors --reporter checkstyle' })
let errorformat = '%f:%t:%l:%c:%m'
@ -27,9 +24,9 @@ function! SyntaxCheckers_javascript_jscs_GetLocList() dict
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'preprocess': 'SyntaxCheckers_java_checkstyle_Preprocess',
\ 'preprocess': 'checkstyle',
\ 'postprocess': ['sort'],
\ 'returns': [0] })
\ 'returns': [0, 2] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -47,7 +47,8 @@ function! SyntaxCheckers_javascript_jshint_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr('')} })
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 2] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -0,0 +1,51 @@
"============================================================================
"File: jsxhint.vim
"Description: Javascript syntax checker - using jsxhint
"Maintainer: Thomas Boyt <me@thomasboyt.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists('g:loaded_syntastic_javascript_jsxhint_checker')
finish
endif
let g:loaded_syntastic_javascript_jsxhint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict
if !executable('jshint') || !syntastic#util#versionIsAtLeast(syntastic#util#getVersion('jshint --version'), [1, 1])
return 0
endif
let jsxhint_version = system(self.getExecEscaped() . ' --version')
return
\ v:shell_error == 0 &&
\ jsxhint_version =~# '\m^JSXHint\>' &&
\ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(jsxhint_version), [0, 4, 1])
endfunction
function! SyntaxCheckers_javascript_jsxhint_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_after': '--verbose' })
let errorformat = '%A%f: line %l\, col %v\, %m \(%t%*\d\)'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr('')} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'javascript',
\ 'name': 'jsxhint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View File

@ -44,19 +44,6 @@ function! SyntaxCheckers_perl_perl_IsAvailable() dict
return v:shell_error == 0
endfunction
function! SyntaxCheckers_perl_perl_Preprocess(errors)
let out = []
for e in a:errors
let parts = matchlist(e, '\v^(.*)\sat\s(.*)\sline\s(\d+)(.*)$')
if !empty(parts)
call add(out, parts[2] . ':' . parts[3] . ':' . parts[1] . parts[4])
endif
endfor
return syntastic#util#unique(out)
endfunction
function! SyntaxCheckers_perl_perl_GetLocList() dict
let exe = expand(g:syntastic_perl_interpreter)
if type(g:syntastic_perl_lib_path) == type('')
@ -78,7 +65,7 @@ function! SyntaxCheckers_perl_perl_GetLocList() dict
let errors = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'SyntaxCheckers_perl_perl_Preprocess',
\ 'preprocess': 'perl',
\ 'defaults': {'type': 'E'} })
if !empty(errors)
return errors
@ -91,7 +78,7 @@ function! SyntaxCheckers_perl_perl_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'SyntaxCheckers_perl_perl_Preprocess',
\ 'preprocess': 'perl',
\ 'defaults': {'type': 'W'} })
endfunction

View File

@ -23,7 +23,8 @@ set cpo&vim
function! SyntaxCheckers_php_phpcs_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_after': '--report=csv --tab-width=' . &tabstop })
\ 'args': '--tab-width=' . &tabstop,
\ 'args_after': '--report=csv' })
let errorformat =
\ '%-GFile\,Line\,Column\,Type\,Message\,Source\,Severity,'.
@ -37,7 +38,7 @@ endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'php',
\ 'name': 'phpcs'})
\ 'name': 'phpcs' })
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@ -13,11 +13,6 @@ let g:loaded_syntastic_python_pep257_checker = 1
let s:save_cpo = &cpo
set cpo&vim
" sanity: kill empty lines here rather than munging errorformat
function! SyntaxCheckers_python_pep257_Preprocess(errors)
return filter(copy(a:errors), 'v:val != ""')
endfunction
function! SyntaxCheckers_python_pep257_GetLocList() dict
let makeprg = self.makeprgBuild({})
@ -30,7 +25,7 @@ function! SyntaxCheckers_python_pep257_GetLocList() dict
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'preprocess': 'SyntaxCheckers_python_pep257_Preprocess',
\ 'preprocess': 'killEmpty',
\ 'postprocess': ['compressWhitespace'] })
" pep257 outputs byte offsets rather than column numbers

View File

@ -45,6 +45,7 @@ function! SyntaxCheckers_python_pyflakes_GetLocList() dict
let errorformat =
\ '%E%f:%l: could not compile,'.
\ '%-Z%p^,'.
\ '%E%f:%l:%c: %m,'.
\ '%E%f:%l: %m,'.
\ '%-G%.%#'

View File

@ -62,11 +62,13 @@ function! s:PylintNew(exe)
let exe = syntastic#util#shescape(a:exe)
try
" On Windows the version is shown as "pylint-script.py 1.0.0".
" On Gentoo Linux it's "pylint-python2.7 0.28.0". Oh, joy. :)
let pylint_version = filter(split(system(exe . ' --version'), '\m, \=\|\n'), 'v:val =~# ''\m^pylint\>''')[0]
" On Gentoo Linux it's "pylint-python2.7 0.28.0".
" On NixOS, that would be ".pylint-wrapped 0.26.0", that would be.
" Have you guys considered switching to creative writing yet? ;)
let pylint_version = filter(split(system(exe . ' --version'), '\m, \=\|\n'), 'v:val =~# ''\m^\.\=pylint\>''')[0]
let pylint_version = substitute(pylint_version, '\v^\S+\s+', '', '')
let ret = syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1])
catch /^Vim\%((\a\+)\)\=:E684/
catch /\m^Vim\%((\a\+)\)\=:E684/
call syntastic#log#error("checker python/pylint: can't parse version string (abnormal termination?)")
let ret = -1
endtry

View File

@ -41,12 +41,11 @@ endfunction
function! s:ForwardToZshChecker()
let registry = g:SyntasticRegistry.Instance()
if registry.checkable('zsh')
if registry.isCheckable('zsh')
return registry.getCheckers('zsh', ['zsh'])[0].getLocListRaw()
else
return []
endif
endfunction
function! s:IsShellValid()

View File

@ -40,7 +40,7 @@ function! SyntaxCheckers_vim_vimlint_IsAvailable() dict
try
call vimlint#vimlint(syntastic#util#DevNull(), { 'output': [], 'quiet': 1 })
let ret = 1
catch /^Vim\%((\a\+)\)\=:E117/
catch /\m^Vim\%((\a\+)\)\=:E117/
" do nothing
endtry
return ret

View File

@ -69,7 +69,8 @@ endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'yaml',
\ 'name': 'yamlxs' })
\ 'name': 'yamlxs',
\ 'exec': 'perl' })
let &cpo = s:save_cpo
unlet s:save_cpo