Updated plugins
This commit is contained in:
parent
2a9908e4f0
commit
89c36a0d2c
97 changed files with 3635 additions and 1655 deletions
|
@ -1,6 +1,6 @@
|
|||
" pathogen.vim - path option manipulation
|
||||
" Maintainer: Tim Pope <http://tpo.pe/>
|
||||
" Version: 2.2
|
||||
" Version: 2.3
|
||||
|
||||
" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
|
||||
"
|
||||
|
@ -8,52 +8,49 @@
|
|||
" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your
|
||||
" .vimrc is the only other setup necessary.
|
||||
"
|
||||
" The API is documented inline below. For maximum ease of reading,
|
||||
" :set foldmethod=marker
|
||||
" The API is documented inline below.
|
||||
|
||||
if exists("g:loaded_pathogen") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_pathogen = 1
|
||||
|
||||
function! s:warn(msg)
|
||||
echohl WarningMsg
|
||||
echomsg a:msg
|
||||
echohl NONE
|
||||
endfunction
|
||||
|
||||
" Point of entry for basic default usage. Give a relative path to invoke
|
||||
" pathogen#incubate() (defaults to "bundle/{}"), or an absolute path to invoke
|
||||
" pathogen#surround(). For backwards compatibility purposes, a full path that
|
||||
" does not end in {} or * is given to pathogen#runtime_prepend_subdirectories()
|
||||
" instead.
|
||||
function! pathogen#infect(...) abort " {{{1
|
||||
for path in a:0 ? reverse(copy(a:000)) : ['bundle/{}']
|
||||
if path =~# '^[^\\/]\+$'
|
||||
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
|
||||
call pathogen#incubate(path . '/{}')
|
||||
elseif path =~# '^[^\\/]\+[\\/]\%({}\|\*\)$'
|
||||
call pathogen#incubate(path)
|
||||
elseif path =~# '[\\/]\%({}\|\*\)$'
|
||||
" pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke
|
||||
" pathogen#surround(). Curly braces are expanded with pathogen#expand():
|
||||
" "bundle/{}" finds all subdirectories inside "bundle" inside all directories
|
||||
" in the runtime path.
|
||||
function! pathogen#infect(...) abort
|
||||
for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}']
|
||||
if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]'
|
||||
call pathogen#surround(path)
|
||||
else
|
||||
elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)'
|
||||
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
|
||||
call pathogen#surround(path . '/{}')
|
||||
elseif path =~# '[{}*]'
|
||||
call pathogen#interpose(path)
|
||||
else
|
||||
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
|
||||
call pathogen#interpose(path . '/{}')
|
||||
endif
|
||||
endfor
|
||||
call pathogen#cycle_filetype()
|
||||
if pathogen#is_disabled($MYVIMRC)
|
||||
return 'finish'
|
||||
endif
|
||||
return ''
|
||||
endfunction " }}}1
|
||||
endfunction
|
||||
|
||||
" Split a path into a list.
|
||||
function! pathogen#split(path) abort " {{{1
|
||||
function! pathogen#split(path) abort
|
||||
if type(a:path) == type([]) | return a:path | endif
|
||||
if empty(a:path) | return [] | endif
|
||||
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
|
||||
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
|
||||
endfunction " }}}1
|
||||
endfunction
|
||||
|
||||
" Convert a list to a path.
|
||||
function! pathogen#join(...) abort " {{{1
|
||||
function! pathogen#join(...) abort
|
||||
if type(a:1) == type(1) && a:1
|
||||
let i = 1
|
||||
let space = ' '
|
||||
|
@ -77,15 +74,143 @@ function! pathogen#join(...) abort " {{{1
|
|||
let i += 1
|
||||
endwhile
|
||||
return substitute(path,'^,','','')
|
||||
endfunction " }}}1
|
||||
endfunction
|
||||
|
||||
" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
|
||||
function! pathogen#legacyjoin(...) abort " {{{1
|
||||
function! pathogen#legacyjoin(...) abort
|
||||
return call('pathogen#join',[1] + a:000)
|
||||
endfunction " }}}1
|
||||
endfunction
|
||||
|
||||
" Turn filetype detection off and back on again if it was already enabled.
|
||||
function! pathogen#cycle_filetype() abort
|
||||
if exists('g:did_load_filetypes')
|
||||
filetype off
|
||||
filetype on
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Check if a bundle is disabled. A bundle is considered disabled if its
|
||||
" basename or full name is included in the list g:pathogen_disabled.
|
||||
function! pathogen#is_disabled(path) abort
|
||||
if a:path =~# '\~$'
|
||||
return 1
|
||||
endif
|
||||
let sep = pathogen#slash()
|
||||
let blacklist = map(
|
||||
\ get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) +
|
||||
\ pathogen#split($VIMBLACKLIST),
|
||||
\ 'substitute(v:val, "[\\/]$", "", "")')
|
||||
return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1
|
||||
endfunction "}}}1
|
||||
|
||||
" Prepend the given directory to the runtime path and append its corresponding
|
||||
" after directory. Curly braces are expanded with pathogen#expand().
|
||||
function! pathogen#surround(path) abort
|
||||
let sep = pathogen#slash()
|
||||
let rtp = pathogen#split(&rtp)
|
||||
let path = fnamemodify(a:path, ':p:?[\\/]\=$??')
|
||||
let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)')
|
||||
let after = filter(reverse(pathogen#expand(path.sep.'after')), '!pathogen#is_disabled(v:val[0:-7])')
|
||||
call filter(rtp, 'index(before + after, v:val) == -1')
|
||||
let &rtp = pathogen#join(before, rtp, after)
|
||||
return &rtp
|
||||
endfunction
|
||||
|
||||
" For each directory in the runtime path, add a second entry with the given
|
||||
" argument appended. Curly braces are expanded with pathogen#expand().
|
||||
function! pathogen#interpose(name) abort
|
||||
let sep = pathogen#slash()
|
||||
let name = a:name
|
||||
if has_key(s:done_bundles, name)
|
||||
return ""
|
||||
endif
|
||||
let s:done_bundles[name] = 1
|
||||
let list = []
|
||||
for dir in pathogen#split(&rtp)
|
||||
if dir =~# '\<after$'
|
||||
let list += reverse(filter(pathogen#expand(dir[0:-6].name.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])')) + [dir]
|
||||
else
|
||||
let list += [dir] + filter(pathogen#expand(dir.sep.name), '!pathogen#is_disabled(v:val)')
|
||||
endif
|
||||
endfor
|
||||
let &rtp = pathogen#join(pathogen#uniq(list))
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
let s:done_bundles = {}
|
||||
|
||||
" Invoke :helptags on all non-$VIM doc directories in runtimepath.
|
||||
function! pathogen#helptags() abort
|
||||
let sep = pathogen#slash()
|
||||
for glob in pathogen#split(&rtp)
|
||||
for dir in map(split(glob(glob), "\n"), 'v:val.sep."/doc/".sep')
|
||||
if (dir)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir) == 2 && !empty(split(glob(dir.'*.txt'))) && (!filereadable(dir.'tags') || filewritable(dir.'tags'))
|
||||
silent! execute 'helptags' pathogen#fnameescape(dir)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
command! -bar Helptags :call pathogen#helptags()
|
||||
|
||||
" Execute the given command. This is basically a backdoor for --remote-expr.
|
||||
function! pathogen#execute(...) abort
|
||||
for command in a:000
|
||||
execute command
|
||||
endfor
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
" Section: Unofficial
|
||||
|
||||
function! pathogen#is_absolute(path) abort
|
||||
return a:path =~# (has('win32') ? '^\%([\\/]\|\w:\)[\\/]\|^[~$]' : '^[/~$]')
|
||||
endfunction
|
||||
|
||||
" Given a string, returns all possible permutations of comma delimited braced
|
||||
" alternatives of that string. pathogen#expand('/{a,b}/{c,d}') yields
|
||||
" ['/a/c', '/a/d', '/b/c', '/b/d']. Empty braces are treated as a wildcard
|
||||
" and globbed. Actual globs are preserved.
|
||||
function! pathogen#expand(pattern) abort
|
||||
if a:pattern =~# '{[^{}]\+}'
|
||||
let [pre, pat, post] = split(substitute(a:pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1)
|
||||
let found = map(split(pat, ',', 1), 'pre.v:val.post')
|
||||
let results = []
|
||||
for pattern in found
|
||||
call extend(results, pathogen#expand(pattern))
|
||||
endfor
|
||||
return results
|
||||
elseif a:pattern =~# '{}'
|
||||
let pat = matchstr(a:pattern, '^.*{}[^*]*\%($\|[\\/]\)')
|
||||
let post = a:pattern[strlen(pat) : -1]
|
||||
return map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post')
|
||||
else
|
||||
return [a:pattern]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" \ on Windows unless shellslash is set, / everywhere else.
|
||||
function! pathogen#slash() abort
|
||||
return !exists("+shellslash") || &shellslash ? '/' : '\'
|
||||
endfunction
|
||||
|
||||
function! pathogen#separator() abort
|
||||
return pathogen#slash()
|
||||
endfunction
|
||||
|
||||
" Convenience wrapper around glob() which returns a list.
|
||||
function! pathogen#glob(pattern) abort
|
||||
let files = split(glob(a:pattern),"\n")
|
||||
return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")')
|
||||
endfunction "}}}1
|
||||
|
||||
" Like pathogen#glob(), only limit the results to directories.
|
||||
function! pathogen#glob_directories(pattern) abort
|
||||
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
|
||||
endfunction "}}}1
|
||||
|
||||
" Remove duplicates from a list.
|
||||
function! pathogen#uniq(list) abort " {{{1
|
||||
function! pathogen#uniq(list) abort
|
||||
let i = 0
|
||||
let seen = {}
|
||||
while i < len(a:list)
|
||||
|
@ -100,142 +225,18 @@ function! pathogen#uniq(list) abort " {{{1
|
|||
endif
|
||||
endwhile
|
||||
return a:list
|
||||
endfunction " }}}1
|
||||
|
||||
" \ on Windows unless shellslash is set, / everywhere else.
|
||||
function! pathogen#separator() abort " {{{1
|
||||
return !exists("+shellslash") || &shellslash ? '/' : '\'
|
||||
endfunction " }}}1
|
||||
|
||||
" Convenience wrapper around glob() which returns a list.
|
||||
function! pathogen#glob(pattern) abort " {{{1
|
||||
let files = split(glob(a:pattern),"\n")
|
||||
return map(files,'substitute(v:val,"[".pathogen#separator()."/]$","","")')
|
||||
endfunction "}}}1
|
||||
|
||||
" Like pathogen#glob(), only limit the results to directories.
|
||||
function! pathogen#glob_directories(pattern) abort " {{{1
|
||||
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
|
||||
endfunction "}}}1
|
||||
|
||||
" Turn filetype detection off and back on again if it was already enabled.
|
||||
function! pathogen#cycle_filetype() " {{{1
|
||||
if exists('g:did_load_filetypes')
|
||||
filetype off
|
||||
filetype on
|
||||
endif
|
||||
endfunction " }}}1
|
||||
|
||||
" Check if a bundle is disabled. A bundle is considered disabled if it ends
|
||||
" in a tilde or its basename or full name is included in the list
|
||||
" g:pathogen_disabled.
|
||||
function! pathogen#is_disabled(path) " {{{1
|
||||
if a:path =~# '\~$'
|
||||
return 1
|
||||
elseif !exists("g:pathogen_disabled")
|
||||
return 0
|
||||
endif
|
||||
let sep = pathogen#separator()
|
||||
let blacklist = g:pathogen_disabled
|
||||
return index(blacklist, strpart(a:path, strridx(a:path, sep)+1)) != -1 && index(blacklist, a:path) != 1
|
||||
endfunction "}}}1
|
||||
|
||||
" Prepend the given directory to the runtime path and append its corresponding
|
||||
" after directory. If the directory is already included, move it to the
|
||||
" outermost position. Wildcards are added as is. Ending a path in /{} causes
|
||||
" all subdirectories to be added (except those in g:pathogen_disabled).
|
||||
function! pathogen#surround(path) abort " {{{1
|
||||
let sep = pathogen#separator()
|
||||
let rtp = pathogen#split(&rtp)
|
||||
if a:path =~# '[\\/]{}$'
|
||||
let path = fnamemodify(a:path[0:-4], ':p:s?[\\/]\=$??')
|
||||
let before = filter(pathogen#glob_directories(path.sep.'*'), '!pathogen#is_disabled(v:val)')
|
||||
let after = filter(reverse(pathogen#glob_directories(path.sep."*".sep."after")), '!pathogen#is_disabled(v:val[0:-7])')
|
||||
call filter(rtp,'v:val[0:strlen(path)-1] !=# path')
|
||||
else
|
||||
let path = fnamemodify(a:path, ':p:s?[\\/]\=$??')
|
||||
let before = [path]
|
||||
let after = [path . sep . 'after']
|
||||
call filter(rtp, 'index(before + after, v:val) == -1')
|
||||
endif
|
||||
let &rtp = pathogen#join(before, rtp, after)
|
||||
return &rtp
|
||||
endfunction " }}}1
|
||||
|
||||
" Prepend all subdirectories of path to the rtp, and append all 'after'
|
||||
" directories in those subdirectories. Deprecated.
|
||||
function! pathogen#runtime_prepend_subdirectories(path) " {{{1
|
||||
call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#surround('.string(a:path.'/{}').')')
|
||||
return pathogen#surround(a:path . pathogen#separator() . '{}')
|
||||
endfunction " }}}1
|
||||
|
||||
" For each directory in the runtime path, add a second entry with the given
|
||||
" argument appended. If the argument ends in '/{}', add a separate entry for
|
||||
" each subdirectory. The default argument is 'bundle/{}', which means that
|
||||
" .vim/bundle/*, $VIM/vimfiles/bundle/*, $VIMRUNTIME/bundle/*,
|
||||
" $VIM/vim/files/bundle/*/after, and .vim/bundle/*/after will be added (on
|
||||
" UNIX).
|
||||
function! pathogen#incubate(...) abort " {{{1
|
||||
let sep = pathogen#separator()
|
||||
let name = a:0 ? a:1 : 'bundle/{}'
|
||||
if "\n".s:done_bundles =~# "\\M\n".name."\n"
|
||||
return ""
|
||||
endif
|
||||
let s:done_bundles .= name . "\n"
|
||||
let list = []
|
||||
for dir in pathogen#split(&rtp)
|
||||
if dir =~# '\<after$'
|
||||
if name =~# '{}$'
|
||||
let list += filter(pathogen#glob_directories(substitute(dir,'after$',name[0:-3],'').'*'.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])') + [dir]
|
||||
else
|
||||
let list += [dir, substitute(dir, 'after$', '', '') . name . sep . 'after']
|
||||
endif
|
||||
else
|
||||
if name =~# '{}$'
|
||||
let list += [dir] + filter(pathogen#glob_directories(dir.sep.name[0:-3].'*'), '!pathogen#is_disabled(v:val)')
|
||||
else
|
||||
let list += [dir . sep . name, dir]
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
let &rtp = pathogen#join(pathogen#uniq(list))
|
||||
return 1
|
||||
endfunction " }}}1
|
||||
|
||||
" Deprecated alias for pathogen#incubate().
|
||||
function! pathogen#runtime_append_all_bundles(...) abort " {{{1
|
||||
if a:0
|
||||
call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#incubate('.string(a:1.'/{}').')')
|
||||
else
|
||||
call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#incubate()')
|
||||
endif
|
||||
return call('pathogen#incubate', map(copy(a:000),'v:val . "/{}"'))
|
||||
endfunction
|
||||
|
||||
let s:done_bundles = ''
|
||||
" }}}1
|
||||
|
||||
" Invoke :helptags on all non-$VIM doc directories in runtimepath.
|
||||
function! pathogen#helptags() abort " {{{1
|
||||
let sep = pathogen#separator()
|
||||
for glob in pathogen#split(&rtp)
|
||||
for dir in split(glob(glob), "\n")
|
||||
if (dir.sep)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir.sep.'doc') == 2 && !empty(filter(split(glob(dir.sep.'doc'.sep.'*'),"\n>"),'!isdirectory(v:val)')) && (!filereadable(dir.sep.'doc'.sep.'tags') || filewritable(dir.sep.'doc'.sep.'tags'))
|
||||
silent! execute 'helptags' pathogen#fnameescape(dir.'/doc')
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endfunction " }}}1
|
||||
|
||||
command! -bar Helptags :call pathogen#helptags()
|
||||
|
||||
" Execute the given command. This is basically a backdoor for --remote-expr.
|
||||
function! pathogen#execute(...) abort " {{{1
|
||||
for command in a:000
|
||||
execute command
|
||||
endfor
|
||||
return ''
|
||||
endfunction " }}}1
|
||||
" Backport of fnameescape().
|
||||
function! pathogen#fnameescape(string) abort
|
||||
if exists('*fnameescape')
|
||||
return fnameescape(a:string)
|
||||
elseif a:string ==# '-'
|
||||
return '\-'
|
||||
else
|
||||
return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Like findfile(), but hardcoded to use the runtimepath.
|
||||
function! pathogen#runtime_findfile(file,count) abort "{{{1
|
||||
|
@ -246,18 +247,38 @@ function! pathogen#runtime_findfile(file,count) abort "{{{1
|
|||
else
|
||||
return fnamemodify(file,':p')
|
||||
endif
|
||||
endfunction " }}}1
|
||||
endfunction
|
||||
|
||||
" Backport of fnameescape().
|
||||
function! pathogen#fnameescape(string) abort " {{{1
|
||||
if exists('*fnameescape')
|
||||
return fnameescape(a:string)
|
||||
elseif a:string ==# '-'
|
||||
return '\-'
|
||||
" Section: Deprecated
|
||||
|
||||
function! s:warn(msg) abort
|
||||
echohl WarningMsg
|
||||
echomsg a:msg
|
||||
echohl NONE
|
||||
endfunction
|
||||
|
||||
" Prepend all subdirectories of path to the rtp, and append all 'after'
|
||||
" directories in those subdirectories. Deprecated.
|
||||
function! pathogen#runtime_prepend_subdirectories(path) abort
|
||||
call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')')
|
||||
return pathogen#surround(a:path . pathogen#slash() . '{}')
|
||||
endfunction
|
||||
|
||||
function! pathogen#incubate(...) abort
|
||||
let name = a:0 ? a:1 : 'bundle/{}'
|
||||
call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')')
|
||||
return pathogen#interpose(name)
|
||||
endfunction
|
||||
|
||||
" Deprecated alias for pathogen#interpose().
|
||||
function! pathogen#runtime_append_all_bundles(...) abort
|
||||
if a:0
|
||||
call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')')
|
||||
else
|
||||
return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
|
||||
call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()')
|
||||
endif
|
||||
endfunction " }}}1
|
||||
return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}')
|
||||
endfunction
|
||||
|
||||
if exists(':Vedit')
|
||||
finish
|
||||
|
@ -265,7 +286,7 @@ endif
|
|||
|
||||
let s:vopen_warning = 0
|
||||
|
||||
function! s:find(count,cmd,file,lcd) " {{{1
|
||||
function! s:find(count,cmd,file,lcd)
|
||||
let rtp = pathogen#join(1,pathogen#split(&runtimepath))
|
||||
let file = pathogen#runtime_findfile(a:file,a:count)
|
||||
if file ==# ''
|
||||
|
@ -284,10 +305,10 @@ function! s:find(count,cmd,file,lcd) " {{{1
|
|||
else
|
||||
return a:cmd.' '.pathogen#fnameescape(file) . warning
|
||||
endif
|
||||
endfunction " }}}1
|
||||
endfunction
|
||||
|
||||
function! s:Findcomplete(A,L,P) " {{{1
|
||||
let sep = pathogen#separator()
|
||||
function! s:Findcomplete(A,L,P)
|
||||
let sep = pathogen#slash()
|
||||
let cheats = {
|
||||
\'a': 'autoload',
|
||||
\'d': 'doc',
|
||||
|
@ -312,7 +333,7 @@ function! s:Findcomplete(A,L,P) " {{{1
|
|||
endfor
|
||||
endfor
|
||||
return sort(keys(found))
|
||||
endfunction " }}}1
|
||||
endfunction
|
||||
|
||||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(<count>,'edit<bang>',<q-args>,0)
|
||||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(<count>,'edit<bang>',<q-args>,0)
|
||||
|
@ -323,4 +344,4 @@ command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabed
|
|||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(<count>,'pedit',<q-args>,<bang>1)
|
||||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(<count>,'read',<q-args>,<bang>1)
|
||||
|
||||
" vim:set et sw=2:
|
||||
" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':
|
||||
|
|
|
@ -64,7 +64,8 @@ function! s:setup_pad(bufnr, vert, size)
|
|||
execute win . 'wincmd w'
|
||||
execute (a:vert ? 'vertical ' : '') . 'resize ' . max([0, a:size])
|
||||
augroup goyop
|
||||
autocmd WinEnter,CursorMoved <buffer> call s:blank()
|
||||
autocmd WinEnter,CursorMoved <buffer> nested call s:blank()
|
||||
autocmd WinLeave <buffer> call s:hide_statusline()
|
||||
augroup END
|
||||
|
||||
" To hide scrollbars of pad windows in GVim
|
||||
|
@ -114,6 +115,10 @@ function! s:tranquilize()
|
|||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:hide_statusline()
|
||||
let &l:statusline = repeat(' ', winwidth(0))
|
||||
endfunction
|
||||
|
||||
function! s:goyo_on(width)
|
||||
let s:orig_tab = tabpagenr()
|
||||
|
||||
|
@ -131,7 +136,6 @@ function! s:goyo_on(width)
|
|||
\ 'winwidth': &winwidth,
|
||||
\ 'winminheight': &winminheight,
|
||||
\ 'winheight': &winheight,
|
||||
\ 'statusline': &statusline,
|
||||
\ 'ruler': &ruler,
|
||||
\ 'sidescroll': &sidescroll,
|
||||
\ 'sidescrolloff': &sidescrolloff
|
||||
|
@ -211,19 +215,20 @@ function! s:goyo_on(width)
|
|||
call s:resize_pads()
|
||||
call s:tranquilize()
|
||||
|
||||
let &statusline = repeat(' ', winwidth(0))
|
||||
|
||||
augroup goyo
|
||||
autocmd!
|
||||
autocmd BufWinLeave <buffer> call s:goyo_off()
|
||||
autocmd TabLeave * call s:goyo_off()
|
||||
autocmd VimResized * call s:resize_pads()
|
||||
autocmd ColorScheme * call s:tranquilize()
|
||||
autocmd WinEnter,WinLeave <buffer> call s:hide_statusline()
|
||||
augroup END
|
||||
|
||||
call s:hide_statusline()
|
||||
if exists('g:goyo_callbacks[0]')
|
||||
call g:goyo_callbacks[0]()
|
||||
endif
|
||||
silent! doautocmd User GoyoEnter
|
||||
endfunction
|
||||
|
||||
function! s:goyo_off()
|
||||
|
@ -312,6 +317,7 @@ function! s:goyo_off()
|
|||
if exists('g:goyo_callbacks[1]')
|
||||
call g:goyo_callbacks[1]()
|
||||
endif
|
||||
silent! doautocmd User GoyoLeave
|
||||
endfunction
|
||||
|
||||
function! s:goyo(bang, ...)
|
||||
|
|
|
@ -462,8 +462,8 @@ Jump to the previous sibling of the selected node.
|
|||
------------------------------------------------------------------------------
|
||||
*NERDTree-C*
|
||||
Default key: C
|
||||
Map option: NERDTreeMapChdir
|
||||
Applies to: directories.
|
||||
Map option: NERDTreeMapChangeRoot
|
||||
Applies to: files and directories.
|
||||
|
||||
Make the selected directory node the new tree root. If a file is selected, its
|
||||
parent is used.
|
||||
|
|
|
@ -40,11 +40,12 @@ C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart,
|
|||
DocBook, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go,
|
||||
Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS,
|
||||
Lex, Limbo, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C,
|
||||
Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X
|
||||
and iOS property lists, Puppet, Python, Racket, R, reStructuredText, Ruby,
|
||||
SASS/SCSS, Scala, Slim, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog,
|
||||
VHDL, VimL, xHtml, XML, XSLT, YACC, YAML, z80, Zope page templates, and zsh.
|
||||
See the [wiki][3] for details about the corresponding supported checkers.
|
||||
Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X and
|
||||
iOS property lists, Puppet, Python, Racket, R, reStructuredText, RPM spec,
|
||||
Ruby, SASS/SCSS, Scala, Slim, Tcl, TeX, Texinfo, Twig, TypeScript, Vala,
|
||||
Verilog, VHDL, VimL, xHtml, XML, XSLT, YACC, YAML, z80, Zope page templates,
|
||||
and zsh. See the [wiki][3] for details about the corresponding supported
|
||||
checkers.
|
||||
|
||||
Below is a screenshot showing the methods that Syntastic uses to display syntax
|
||||
errors. Note that, in practise, you will only have a subset of these methods
|
||||
|
@ -127,6 +128,16 @@ error output for a syntax checker may have changed. In this case, make sure you
|
|||
have the latest version of the syntax checker installed. If it still fails then
|
||||
create an issue - or better yet, create a pull request.
|
||||
|
||||
<a name="faqpython3"></a>
|
||||
|
||||
__Q. The `python` checker complains about syntactically valid Python 3 constructs...__
|
||||
|
||||
A. Configure the `python` checker to call a Python 3 interpreter rather than
|
||||
Python 2, e.g:
|
||||
```vim
|
||||
let g:syntastic_python_python_exec = '/path/to/python3'
|
||||
```
|
||||
|
||||
<a name="faqperl"></a>
|
||||
|
||||
__Q. The `perl` checker has stopped working...__
|
||||
|
@ -153,7 +164,8 @@ automatically by syntastic.
|
|||
|
||||
<a name="faqloclist"></a>
|
||||
|
||||
__Q. I run a checker and the location list is not updated...__
|
||||
__Q. I run a checker and the location list is not updated...__
|
||||
__Q. I run`:lopen` or `:lwindow` and the error window is empty...__
|
||||
|
||||
A. By default the location list is changed only when you run the `:Errors`
|
||||
command, in order to minimise conflicts with other plugins. If you want the
|
||||
|
@ -200,8 +212,7 @@ To tell syntastic to use `pylint`, you would use this setting:
|
|||
let g:syntastic_python_checkers = ['pylint']
|
||||
```
|
||||
|
||||
Some filetypes, like PHP, have style checkers as well as syntax checkers. These
|
||||
can be chained together like this:
|
||||
Checkers can be chained together like this:
|
||||
```vim
|
||||
let g:syntastic_php_checkers = ['php', 'phpcs', 'phpmd']
|
||||
```
|
||||
|
@ -219,7 +230,37 @@ e.g. to run `phpcs` and `phpmd`:
|
|||
This works for any checkers available for the current filetype, even if they
|
||||
aren't listed in `g:syntastic_<filetype>_checkers`. You can't run checkers for
|
||||
"foreign" filetypes though (e.g. you can't run, say, a Python checker if the
|
||||
current filetype is `php`).
|
||||
filetype of the current file is `php`).
|
||||
|
||||
<a name="faqstyle"></a>
|
||||
|
||||
__Q. What is the difference between syntax checkers and style checkers?__
|
||||
|
||||
A. The errors and warnings they produce are highlighted differently and can
|
||||
be filtered by different rules, but otherwise the distinction is pretty much
|
||||
arbitrary. There is an ongoing effort to keep things consistent, so you can
|
||||
_generally_ expect messages produced by syntax checkers to be _mostly_ related
|
||||
to syntax, and messages produced by style checkers to be _mostly_ about style.
|
||||
But there can be no formal guarantee that, say, a style checker that runs into
|
||||
a syntax error wouldn't die with a fatal message, nor that a syntax checker
|
||||
wouldn't give you warnings against using some constructs as being bad practice.
|
||||
There is also no guarantee that messages marked as "style" are less severe than
|
||||
the ones marked as "syntax" (whatever that might mean). And there are even a
|
||||
few Frankenstein checkers (for example `flake8` and `pylama`) that, by their
|
||||
nature, produce both kinds of messages. Syntastic is not smart enough to be
|
||||
able to sort out these things by itself.
|
||||
|
||||
In fact it's more useful to look at this from the perspective of filtering
|
||||
unwanted messages, rather than as an indicator of severity levels. The
|
||||
distinction between syntax and style is orthogonal to the distinction between
|
||||
errors and warnings, and thus you can turn off messages based on level, on
|
||||
type, or both.
|
||||
|
||||
e.g. To disable all style messages:
|
||||
```vim
|
||||
let g:syntastic_quiet_messages = { "type": "style" }
|
||||
```
|
||||
See `:help syntastic_quiet_messages` for details.
|
||||
|
||||
<a name="faqaggregate"></a>
|
||||
|
||||
|
@ -238,29 +279,13 @@ See `:help syntastic-aggregating-errors` for more details.
|
|||
__Q. How can I jump between the different errors without using the location
|
||||
list at the bottom of the window?__
|
||||
|
||||
A. Vim provides several built in commands for this. See `:help :lnext` and
|
||||
A. Vim provides several built-in commands for this. See `:help :lnext` and
|
||||
`:help :lprev`.
|
||||
|
||||
If you use these commands a lot then you may want to add shortcut mappings to
|
||||
your vimrc, or install something like [unimpaired][2], which provides such
|
||||
mappings (among other things).
|
||||
|
||||
<a name="faqstyle"></a>
|
||||
|
||||
__Q. A syntax checker is giving me unwanted/strange style tips?__
|
||||
|
||||
A. Some filetypes (e.g. php) have style checkers as well as syntax
|
||||
checkers. You can usually configure the options that are passed to the style
|
||||
checkers, or just disable them. Take a look at the [wiki][3] to see what
|
||||
options are available.
|
||||
|
||||
Alternatively, you can use `g:syntastic_quiet_messages` to filter out the
|
||||
messages you don't want to see. e.g. To turn off all style messages:
|
||||
```vim
|
||||
let g:syntastic_quiet_messages = { "type": "style" }
|
||||
```
|
||||
See `:help syntastic_quiet_messages` for details.
|
||||
|
||||
<a name="faqbdelete"></a>
|
||||
|
||||
__Q. The error window is closed automatically when I :quit the current buffer
|
||||
|
@ -303,3 +328,7 @@ a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9].
|
|||
[10]: http://perldoc.perl.org/perlrun.html#*-c*
|
||||
[11]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide
|
||||
[12]: https://github.com/rust-lang/rust/
|
||||
|
||||
<!--
|
||||
vim:tw=79:sw=4:
|
||||
-->
|
||||
|
|
|
@ -62,7 +62,7 @@ endfunction " }}}2
|
|||
" GetLocList() for C-like compilers
|
||||
function! syntastic#c#GetLocList(filetype, subchecker, options) " {{{2
|
||||
try
|
||||
let flags = s:getCflags(a:filetype, a:subchecker, a:options)
|
||||
let flags = s:_getCflags(a:filetype, a:subchecker, a:options)
|
||||
catch /\m\C^Syntastic: skip checks$/
|
||||
return []
|
||||
endtry
|
||||
|
@ -70,9 +70,9 @@ function! syntastic#c#GetLocList(filetype, subchecker, options) " {{{2
|
|||
let makeprg = syntastic#util#shexpand(g:syntastic_{a:filetype}_compiler) .
|
||||
\ ' ' . flags . ' ' . syntastic#util#shexpand('%')
|
||||
|
||||
let errorformat = s:getCheckerVar('g', a:filetype, a:subchecker, 'errorformat', a:options['errorformat'])
|
||||
let errorformat = s:_getCheckerVar('g', a:filetype, a:subchecker, 'errorformat', a:options['errorformat'])
|
||||
|
||||
let postprocess = s:getCheckerVar('g', a:filetype, a:subchecker, 'remove_include_errors', 0) ?
|
||||
let postprocess = s:_getCheckerVar('g', a:filetype, a:subchecker, 'remove_include_errors', 0) ?
|
||||
\ ['filterForeignErrors'] : []
|
||||
|
||||
" process makeprg
|
||||
|
@ -87,29 +87,29 @@ endfunction " }}}2
|
|||
" Private functions {{{1
|
||||
|
||||
" initialize c/cpp syntax checker handlers
|
||||
function! s:init() " {{{2
|
||||
function! s:_init() " {{{2
|
||||
let s:handlers = []
|
||||
let s:cflags = {}
|
||||
|
||||
call s:regHandler('\m\<cairo', 'syntastic#c#checkPKG', ['cairo', 'cairo'])
|
||||
call s:regHandler('\m\<freetype', 'syntastic#c#checkPKG', ['freetype', 'freetype2', 'freetype'])
|
||||
call s:regHandler('\m\<glade', 'syntastic#c#checkPKG', ['glade', 'libglade-2.0', 'libglade'])
|
||||
call s:regHandler('\m\<glib', 'syntastic#c#checkPKG', ['glib', 'glib-2.0', 'glib'])
|
||||
call s:regHandler('\m\<gtk', 'syntastic#c#checkPKG', ['gtk', 'gtk+-2.0', 'gtk+', 'glib-2.0', 'glib'])
|
||||
call s:regHandler('\m\<libsoup', 'syntastic#c#checkPKG', ['libsoup', 'libsoup-2.4', 'libsoup-2.2'])
|
||||
call s:regHandler('\m\<libxml', 'syntastic#c#checkPKG', ['libxml', 'libxml-2.0', 'libxml'])
|
||||
call s:regHandler('\m\<pango', 'syntastic#c#checkPKG', ['pango', 'pango'])
|
||||
call s:regHandler('\m\<SDL', 'syntastic#c#checkPKG', ['sdl', 'sdl'])
|
||||
call s:regHandler('\m\<opengl', 'syntastic#c#checkPKG', ['opengl', 'gl'])
|
||||
call s:regHandler('\m\<webkit', 'syntastic#c#checkPKG', ['webkit', 'webkit-1.0'])
|
||||
call s:_regHandler('\m\<cairo', 'syntastic#c#checkPKG', ['cairo', 'cairo'])
|
||||
call s:_regHandler('\m\<freetype', 'syntastic#c#checkPKG', ['freetype', 'freetype2', 'freetype'])
|
||||
call s:_regHandler('\m\<glade', 'syntastic#c#checkPKG', ['glade', 'libglade-2.0', 'libglade'])
|
||||
call s:_regHandler('\m\<glib', 'syntastic#c#checkPKG', ['glib', 'glib-2.0', 'glib'])
|
||||
call s:_regHandler('\m\<gtk', 'syntastic#c#checkPKG', ['gtk', 'gtk+-2.0', 'gtk+', 'glib-2.0', 'glib'])
|
||||
call s:_regHandler('\m\<libsoup', 'syntastic#c#checkPKG', ['libsoup', 'libsoup-2.4', 'libsoup-2.2'])
|
||||
call s:_regHandler('\m\<libxml', 'syntastic#c#checkPKG', ['libxml', 'libxml-2.0', 'libxml'])
|
||||
call s:_regHandler('\m\<pango', 'syntastic#c#checkPKG', ['pango', 'pango'])
|
||||
call s:_regHandler('\m\<SDL', 'syntastic#c#checkPKG', ['sdl', 'sdl'])
|
||||
call s:_regHandler('\m\<opengl', 'syntastic#c#checkPKG', ['opengl', 'gl'])
|
||||
call s:_regHandler('\m\<webkit', 'syntastic#c#checkPKG', ['webkit', 'webkit-1.0'])
|
||||
|
||||
call s:regHandler('\m\<php\.h\>', 'syntastic#c#checkPHP', [])
|
||||
call s:regHandler('\m\<Python\.h\>', 'syntastic#c#checkPython', [])
|
||||
call s:regHandler('\m\<ruby', 'syntastic#c#checkRuby', [])
|
||||
call s:_regHandler('\m\<php\.h\>', 'syntastic#c#checkPHP', [])
|
||||
call s:_regHandler('\m\<Python\.h\>', 'syntastic#c#checkPython', [])
|
||||
call s:_regHandler('\m\<ruby', 'syntastic#c#checkRuby', [])
|
||||
endfunction " }}}2
|
||||
|
||||
" return a handler dictionary object
|
||||
function! s:regHandler(regex, function, args) " {{{2
|
||||
function! s:_regHandler(regex, function, args) " {{{2
|
||||
let handler = {}
|
||||
let handler["regex"] = a:regex
|
||||
let handler["func"] = function(a:function)
|
||||
|
@ -118,7 +118,7 @@ function! s:regHandler(regex, function, args) " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
" resolve checker-related user variables
|
||||
function! s:getCheckerVar(scope, filetype, subchecker, name, default) " {{{2
|
||||
function! s:_getCheckerVar(scope, filetype, subchecker, name, default) " {{{2
|
||||
let prefix = a:scope . ':' . 'syntastic_'
|
||||
if exists(prefix . a:filetype . '_' . a:subchecker . '_' . a:name)
|
||||
return {a:scope}:syntastic_{a:filetype}_{a:subchecker}_{a:name}
|
||||
|
@ -130,10 +130,10 @@ function! s:getCheckerVar(scope, filetype, subchecker, name, default) " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
" resolve user CFLAGS
|
||||
function! s:getCflags(ft, ck, opts) " {{{2
|
||||
function! s:_getCflags(ft, ck, opts) " {{{2
|
||||
" determine whether to parse header files as well
|
||||
if has_key(a:opts, 'header_names') && expand('%') =~? a:opts['header_names']
|
||||
if s:getCheckerVar('g', a:ft, a:ck, 'check_header', 0)
|
||||
if s:_getCheckerVar('g', a:ft, a:ck, 'check_header', 0)
|
||||
let flags = get(a:opts, 'header_flags', '') . ' -c ' . syntastic#c#NullOutput()
|
||||
else
|
||||
" checking headers when check_header is unset: bail out
|
||||
|
@ -143,21 +143,21 @@ function! s:getCflags(ft, ck, opts) " {{{2
|
|||
let flags = get(a:opts, 'main_flags', '')
|
||||
endif
|
||||
|
||||
let flags .= ' ' . s:getCheckerVar('g', a:ft, a:ck, 'compiler_options', '') . ' ' . s:getIncludeDirs(a:ft)
|
||||
let flags .= ' ' . s:_getCheckerVar('g', a:ft, a:ck, 'compiler_options', '') . ' ' . s:_getIncludeDirs(a:ft)
|
||||
|
||||
" check if the user manually set some cflags
|
||||
let b_cflags = s:getCheckerVar('b', a:ft, a:ck, 'cflags', '')
|
||||
let b_cflags = s:_getCheckerVar('b', a:ft, a:ck, 'cflags', '')
|
||||
if b_cflags == ''
|
||||
" check whether to search for include files at all
|
||||
if !s:getCheckerVar('g', a:ft, a:ck, 'no_include_search', 0)
|
||||
if !s:_getCheckerVar('g', a:ft, a:ck, 'no_include_search', 0)
|
||||
if a:ft ==# 'c' || a:ft ==# 'cpp'
|
||||
" refresh the include file search if desired
|
||||
if s:getCheckerVar('g', a:ft, a:ck, 'auto_refresh_includes', 0)
|
||||
let flags .= ' ' . s:searchHeaders()
|
||||
if s:_getCheckerVar('g', a:ft, a:ck, 'auto_refresh_includes', 0)
|
||||
let flags .= ' ' . s:_searchHeaders()
|
||||
else
|
||||
" search for header includes if not cached already
|
||||
if !exists('b:syntastic_' . a:ft . '_includes')
|
||||
let b:syntastic_{a:ft}_includes = s:searchHeaders()
|
||||
let b:syntastic_{a:ft}_includes = s:_searchHeaders()
|
||||
endif
|
||||
let flags .= ' ' . b:syntastic_{a:ft}_includes
|
||||
endif
|
||||
|
@ -169,7 +169,7 @@ function! s:getCflags(ft, ck, opts) " {{{2
|
|||
endif
|
||||
|
||||
" add optional config file parameters
|
||||
let config_file = s:getCheckerVar('g', a:ft, a:ck, 'config_file', '.syntastic_' . a:ft . '_config')
|
||||
let config_file = s:_getCheckerVar('g', a:ft, a:ck, 'config_file', '.syntastic_' . a:ft . '_config')
|
||||
let flags .= ' ' . syntastic#c#ReadConfig(config_file)
|
||||
|
||||
return flags
|
||||
|
@ -177,7 +177,7 @@ endfunction " }}}2
|
|||
|
||||
" get the gcc include directory argument depending on the default
|
||||
" includes and the optional user-defined 'g:syntastic_c_include_dirs'
|
||||
function! s:getIncludeDirs(filetype) " {{{2
|
||||
function! s:_getIncludeDirs(filetype) " {{{2
|
||||
let include_dirs = []
|
||||
|
||||
if a:filetype =~# '\v^%(c|cpp|objc|objcpp)$' &&
|
||||
|
@ -195,7 +195,7 @@ endfunction " }}}2
|
|||
|
||||
" search the first 100 lines for include statements that are
|
||||
" given in the handlers dictionary
|
||||
function! s:searchHeaders() " {{{2
|
||||
function! s:_searchHeaders() " {{{2
|
||||
let includes = ''
|
||||
let files = []
|
||||
let found = []
|
||||
|
@ -324,7 +324,7 @@ let s:default_includes = [
|
|||
\ '..' . syntastic#util#Slash() . 'include',
|
||||
\ '..' . syntastic#util#Slash() . 'includes' ]
|
||||
|
||||
call s:init()
|
||||
call s:_init()
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
|
|
@ -65,8 +65,8 @@ function! syntastic#log#debug(level, msg, ...) " {{{2
|
|||
return
|
||||
endif
|
||||
|
||||
let leader = s:logTimestamp()
|
||||
call s:logRedirect(1)
|
||||
let leader = s:_logTimestamp()
|
||||
call s:_logRedirect(1)
|
||||
|
||||
if a:0 > 0
|
||||
" filter out dictionary functions
|
||||
|
@ -77,7 +77,7 @@ function! syntastic#log#debug(level, msg, ...) " {{{2
|
|||
echomsg leader . a:msg
|
||||
endif
|
||||
|
||||
call s:logRedirect(0)
|
||||
call s:_logRedirect(0)
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#log#debugShowOptions(level, names) " {{{2
|
||||
|
@ -85,15 +85,15 @@ function! syntastic#log#debugShowOptions(level, names) " {{{2
|
|||
return
|
||||
endif
|
||||
|
||||
let leader = s:logTimestamp()
|
||||
call s:logRedirect(1)
|
||||
let leader = s:_logTimestamp()
|
||||
call s:_logRedirect(1)
|
||||
|
||||
let vlist = copy(type(a:names) == type("") ? [a:names] : a:names)
|
||||
if !empty(vlist)
|
||||
call map(vlist, "'&' . v:val . ' = ' . strtrans(string(eval('&' . v:val)))")
|
||||
echomsg leader . join(vlist, ', ')
|
||||
endif
|
||||
call s:logRedirect(0)
|
||||
call s:_logRedirect(0)
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#log#debugShowVariables(level, names) " {{{2
|
||||
|
@ -101,18 +101,18 @@ function! syntastic#log#debugShowVariables(level, names) " {{{2
|
|||
return
|
||||
endif
|
||||
|
||||
let leader = s:logTimestamp()
|
||||
call s:logRedirect(1)
|
||||
let leader = s:_logTimestamp()
|
||||
call s:_logRedirect(1)
|
||||
|
||||
let vlist = type(a:names) == type("") ? [a:names] : a:names
|
||||
for name in vlist
|
||||
let msg = s:formatVariable(name)
|
||||
let msg = s:_formatVariable(name)
|
||||
if msg != ''
|
||||
echomsg leader . msg
|
||||
endif
|
||||
endfor
|
||||
|
||||
call s:logRedirect(0)
|
||||
call s:_logRedirect(0)
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#log#debugDump(level) " {{{2
|
||||
|
@ -127,19 +127,19 @@ endfunction " }}}2
|
|||
|
||||
" Private functions {{{1
|
||||
|
||||
function! s:isDebugEnabled_smart(level) " {{{2
|
||||
function! s:_isDebugEnabled_smart(level) " {{{2
|
||||
return and(g:syntastic_debug, a:level)
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:isDebugEnabled_dumb(level) " {{{2
|
||||
function! s:_isDebugEnabled_dumb(level) " {{{2
|
||||
" poor man's bit test for bit N, assuming a:level == 2**N
|
||||
return (g:syntastic_debug / a:level) % 2
|
||||
endfunction " }}}2
|
||||
|
||||
let s:isDebugEnabled = function(exists('*and') ? 's:isDebugEnabled_smart' : 's:isDebugEnabled_dumb')
|
||||
let s:isDebugEnabled = function(exists('*and') ? 's:_isDebugEnabled_smart' : 's:_isDebugEnabled_dumb')
|
||||
lockvar s:isDebugEnabled
|
||||
|
||||
function! s:logRedirect(on) " {{{2
|
||||
function! s:_logRedirect(on) " {{{2
|
||||
if exists("g:syntastic_debug_file")
|
||||
if a:on
|
||||
try
|
||||
|
@ -154,11 +154,11 @@ function! s:logRedirect(on) " {{{2
|
|||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:logTimestamp() " {{{2
|
||||
function! s:_logTimestamp() " {{{2
|
||||
return 'syntastic: ' . split(reltimestr(reltime(g:syntastic_start)))[0] . ': '
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:formatVariable(name) " {{{2
|
||||
function! s:_formatVariable(name) " {{{2
|
||||
let vals = []
|
||||
if exists('g:syntastic_' . a:name)
|
||||
call add(vals, 'g:syntastic_' . a:name . ' = ' . strtrans(string(g:syntastic_{a:name})))
|
||||
|
|
|
@ -46,6 +46,25 @@ function! syntastic#postprocess#filterForeignErrors(errors) " {{{2
|
|||
return filter(copy(a:errors), 'get(v:val, "bufnr") == ' . bufnr(''))
|
||||
endfunction " }}}2
|
||||
|
||||
" make sure line numbers are not past end of buffers
|
||||
" XXX: this loads all referenced buffers in memory
|
||||
function! syntastic#postprocess#guards(errors) " {{{2
|
||||
let buffers = syntastic#util#unique(map(filter(copy(a:errors), 'v:val["valid"]'), 'str2nr(v:val["bufnr"])'))
|
||||
|
||||
let guards = {}
|
||||
for b in buffers
|
||||
let guards[b] = len(getbufline(b, 1, '$'))
|
||||
endfor
|
||||
|
||||
for e in a:errors
|
||||
if e['valid'] && e['lnum'] > guards[e['bufnr']]
|
||||
let e['lnum'] = guards[e['bufnr']]
|
||||
endif
|
||||
endfor
|
||||
|
||||
return a:errors
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
|
|
|
@ -96,6 +96,16 @@ endfunction " }}}2
|
|||
let s:width = function(exists('*strwidth') ? 'strwidth' : 'strlen')
|
||||
lockvar s:width
|
||||
|
||||
function! syntastic#util#screenWidth(str, tabstop) " {{{2
|
||||
let chunks = split(a:str, "\t", 1)
|
||||
let width = s:width(chunks[-1])
|
||||
for c in chunks[:-2]
|
||||
let cwidth = s:width(c)
|
||||
let width += cwidth + a:tabstop - cwidth % a:tabstop
|
||||
endfor
|
||||
return width
|
||||
endfunction " }}}2
|
||||
|
||||
"print as much of a:msg as possible without "Press Enter" prompt appearing
|
||||
function! syntastic#util#wideMsg(msg) " {{{2
|
||||
let old_ruler = &ruler
|
||||
|
@ -215,7 +225,7 @@ function! syntastic#util#redraw(full) " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
function! syntastic#util#dictFilter(errors, filter) " {{{2
|
||||
let rules = s:translateFilter(a:filter)
|
||||
let rules = s:_translateFilter(a:filter)
|
||||
" call syntastic#log#debug(g:SyntasticDebugFilters, "applying filter:", rules)
|
||||
try
|
||||
call filter(a:errors, rules)
|
||||
|
@ -225,13 +235,6 @@ function! syntastic#util#dictFilter(errors, filter) " {{{2
|
|||
endtry
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#util#sortLoclist(errors) " {{{2
|
||||
for e in a:errors
|
||||
call s:setScreenColumn(e)
|
||||
endfor
|
||||
call sort(a:errors, 's:compareErrorItems')
|
||||
endfunction " }}}2
|
||||
|
||||
" Return a [high, low] list of integers, representing the time
|
||||
" (hopefully high resolution) since program start
|
||||
" TODO: This assumes reltime() returns a list of integers.
|
||||
|
@ -243,13 +246,13 @@ endfunction " }}}2
|
|||
|
||||
" Private functions {{{1
|
||||
|
||||
function! s:translateFilter(filters) " {{{2
|
||||
function! s:_translateFilter(filters) " {{{2
|
||||
let conditions = []
|
||||
for k in keys(a:filters)
|
||||
if type(a:filters[k]) == type([])
|
||||
call extend(conditions, map(copy(a:filters[k]), 's:translateElement(k, v:val)'))
|
||||
call extend(conditions, map(copy(a:filters[k]), 's:_translateElement(k, v:val)'))
|
||||
else
|
||||
call add(conditions, s:translateElement(k, a:filters[k]))
|
||||
call add(conditions, s:_translateElement(k, a:filters[k]))
|
||||
endif
|
||||
endfor
|
||||
|
||||
|
@ -259,7 +262,7 @@ function! s:translateFilter(filters) " {{{2
|
|||
return len(conditions) == 1 ? conditions[0] : join(map(conditions, '"(" . v:val . ")"'), ' && ')
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:translateElement(key, term) " {{{2
|
||||
function! s:_translateElement(key, term) " {{{2
|
||||
if a:key ==? 'level'
|
||||
let ret = 'v:val["type"] !=? ' . string(a:term[0])
|
||||
elseif a:key ==? 'type'
|
||||
|
@ -275,49 +278,6 @@ function! s:translateElement(key, term) " {{{2
|
|||
return ret
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:screenWidth(str, tabstop) " {{{2
|
||||
let chunks = split(a:str, "\t", 1)
|
||||
let width = s:width(chunks[-1])
|
||||
for c in chunks[:-2]
|
||||
let cwidth = s:width(c)
|
||||
let width += cwidth + a:tabstop - cwidth % a:tabstop
|
||||
endfor
|
||||
return width
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:setScreenColumn(item) " {{{2
|
||||
if !has_key(a:item, 'scol')
|
||||
let col = get(a:item, 'col', 0)
|
||||
if col != 0 && a:item['vcol'] == 0
|
||||
let buf = str2nr(a:item['bufnr'])
|
||||
try
|
||||
let line = getbufline(buf, a:item['lnum'])[0]
|
||||
catch /\m^Vim\%((\a\+)\)\=:E684/
|
||||
let line = ''
|
||||
endtry
|
||||
let a:item['scol'] = s:screenWidth(strpart(line, 0, col), getbufvar(buf, '&tabstop'))
|
||||
else
|
||||
let a:item['scol'] = col
|
||||
endif
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:compareErrorItems(a, b) " {{{2
|
||||
if a:a['bufnr'] != a:b['bufnr']
|
||||
" group by file
|
||||
return a:a['bufnr'] - a:b['bufnr']
|
||||
elseif a:a['lnum'] != a:b['lnum']
|
||||
" sort by line
|
||||
return a:a['lnum'] - a:b['lnum']
|
||||
elseif a:a['type'] !=? a:b['type']
|
||||
" errors take precedence over warnings
|
||||
return a:a['type'] ==? 'E' ? -1 : 1
|
||||
else
|
||||
" sort by screen column
|
||||
return a:a['scol'] - a:b['scol']
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
|
|
|
@ -67,7 +67,7 @@ Take a look at the wiki for a list of supported filetypes and checkers:
|
|||
https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers
|
||||
|
||||
Note: This doc only deals with using syntastic. To learn how to write syntax
|
||||
checker integrations, see the guide on the github wiki:
|
||||
checker integrations, see the guide on the GitHub wiki:
|
||||
|
||||
https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide
|
||||
|
||||
|
@ -78,16 +78,17 @@ Syntastic comes preconfigured with a default list of enabled checkers per
|
|||
filetype. This list is kept reasonably short to prevent slowing down Vim or
|
||||
trying to use conflicting checkers.
|
||||
|
||||
You can see the list checkers available for the current filetype with the
|
||||
You can see the list of checkers available for the current filetype with the
|
||||
|:SyntasticInfo| command.
|
||||
|
||||
If you want to override the configured list of checkers for a filetype then
|
||||
see |syntastic-checker-options| for details. You can also change the arguments
|
||||
passed to a specific checker as well.
|
||||
You probably want to override the configured list of checkers for the
|
||||
filetypes you use, and also change the arguments passed to specific checkers
|
||||
to suit your needs. See |syntastic-checker-options| for details.
|
||||
|
||||
Use |:SyntasticCheck| to manually check right now. Use |:SyntasticToggleMode|
|
||||
to switch between active (checking on writing the buffer) and passive (manual)
|
||||
checking.
|
||||
Use |:SyntasticCheck| to manually check right now. Use |:Errors| to open the
|
||||
|location-list| window, and |:lclose| to close it. You can clear the error
|
||||
list with |:SyntasticReset|, and you can use |:SyntasticToggleMode| to switch
|
||||
between active (checking on writing the buffer) and passive (manual) checking.
|
||||
|
||||
==============================================================================
|
||||
2. Functionality provided *syntastic-functionality*
|
||||
|
@ -155,13 +156,21 @@ Example: >
|
|||
highlight SyntasticErrorLine guibg=#2f0000
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
2.3. The error window *:Errors* *syntastic-error-window*
|
||||
2.3. The error window *syntastic-error-window*
|
||||
|
||||
You can use the :Errors command to display the errors for the current buffer
|
||||
You can use the |:Errors| command to display the errors for the current buffer
|
||||
in the |location-list|.
|
||||
|
||||
Note that when you use :Errors, the current location list is overwritten with
|
||||
Syntastic's own location list.
|
||||
Note that when you use |:Errors|, the current location list is overwritten
|
||||
with Syntastic's own location list.
|
||||
|
||||
By default syntastic doesn't fill the |location-list| with the errors found by
|
||||
the checkers, in order to reduce clashes with other plugins. Consequently, if
|
||||
you run |:lopen| or |:lwindow| rather than |:Errors| to open the error window you
|
||||
wouldn't see syntastic's list of errors. If you insist on using |:lopen| or
|
||||
|:lwindow| you should either run |:SyntasticSetLoclist| after running the checks,
|
||||
or set |syntastic_always_populate_loc_list| which tells syntastic to update the
|
||||
|location-list| automatically.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2.4. Error highlighting *syntastic-highlighting*
|
||||
|
@ -212,11 +221,14 @@ See also: |'syntastic_<filetype>_<checker>_quiet_messages'|.
|
|||
==============================================================================
|
||||
3. Commands *syntastic-commands*
|
||||
|
||||
:Errors *:SyntasticErrors*
|
||||
:Errors *:Errors*
|
||||
|
||||
When errors have been detected, use this command to pop up the |location-list|
|
||||
and display the error messages.
|
||||
|
||||
Please note that the |:Errors| command overwrites the current location list with
|
||||
syntastic's own location list.
|
||||
|
||||
:SyntasticToggleMode *:SyntasticToggleMode*
|
||||
|
||||
Toggles syntastic between active and passive mode. See |'syntastic_mode_map'|
|
||||
|
@ -239,7 +251,7 @@ the order specified. The rules of |syntastic_aggregate_errors| still apply.
|
|||
Example: >
|
||||
:SyntasticCheck flake8 pylint
|
||||
<
|
||||
:SyntasticInfo *:SyntasticInfo*
|
||||
:SyntasticInfo *:SyntasticInfo*
|
||||
|
||||
The command takes an optional argument, and outputs information about the
|
||||
checkers available for the filetype named by said argument, or for the current
|
||||
|
@ -303,9 +315,22 @@ messages grouped by checker output, set this variable to 0. >
|
|||
<
|
||||
*'syntastic_echo_current_error'*
|
||||
Default: 1
|
||||
If enabled, syntastic will echo the error associated with the current line to
|
||||
the command window. If multiple errors are found, the first will be used. >
|
||||
If enabled, syntastic will echo current error to the command window. If
|
||||
multiple errors are found on the same line, |syntastic_cursor_columns| is used
|
||||
to decide which one is shown. >
|
||||
let g:syntastic_echo_current_error = 1
|
||||
<
|
||||
*'syntastic_cursor_columns'*
|
||||
Default: 1
|
||||
This option controls which errors are echoed to the command window if
|
||||
|syntastic_echo_current_error| is set and multiple errors are found on the same
|
||||
line. When the option is enabled, the first error corresponding to the current
|
||||
column is show. Otherwise, the first error on the current line is echoed,
|
||||
regardless of the cursor position on the current line.
|
||||
|
||||
When dealing with very large lists of errors, disabling this option can speed
|
||||
up navigation significantly: >
|
||||
let g:syntastic_cursor_column = 0
|
||||
<
|
||||
*'syntastic_enable_signs'*
|
||||
Default: 1
|
||||
|
@ -407,7 +432,6 @@ default behaviour of running both checkers against the input file: >
|
|||
Default: { "mode": "active",
|
||||
"active_filetypes": [],
|
||||
"passive_filetypes": [] }
|
||||
|
||||
Use this option to fine tune when automatic syntax checking is done (or not
|
||||
done).
|
||||
|
||||
|
@ -436,7 +460,6 @@ active and passive modes.
|
|||
|
||||
*'syntastic_quiet_messages'*
|
||||
Default: {}
|
||||
|
||||
Use this option to filter out some of the messages produced by checkers. The
|
||||
option should be set to something like: >
|
||||
let g:syntastic_quiet_messages = { "level": "warnings",
|
||||
|
@ -505,6 +528,12 @@ statusline: >
|
|||
<
|
||||
If the buffer had 2 warnings, starting on line 5 then this would appear: >
|
||||
[Warn: 5 #2]
|
||||
<
|
||||
*'b:syntastic_skip_checks'*
|
||||
Default: unset
|
||||
Only the local form |'b:syntastic_skip_checks'| is used. When set to a true
|
||||
value, no checks are run against the corresponding buffer. Example: >
|
||||
let b:syntastic_skip_checks = 1
|
||||
<
|
||||
*'syntastic_full_redraws'*
|
||||
Default: 0 in GUI Vim and MacVim, 1 otherwise
|
||||
|
@ -513,6 +542,13 @@ Changing it can in principle make screen redraws smoother, but it can also
|
|||
cause screen to flicker, or cause ghost characters. Leaving it to the default
|
||||
should be safe.
|
||||
|
||||
*'syntastic_exit_checks'*
|
||||
Default: 0 when running under "cmd.exe" on Windows, 1 otherwise
|
||||
Syntastic attempts to catch abnormal termination conditions from checkers by
|
||||
looking at their exit codes. The "cmd.exe" shell on Windows make these checks
|
||||
meaningless, by returning 1 to Vim when the checkers exit with non-zero codes.
|
||||
The above variable can be used to disable exit code checks in syntastic.
|
||||
|
||||
*'syntastic_debug'*
|
||||
Default: 0
|
||||
Set this to the sum of one or more of the following flags to enable
|
||||
|
@ -580,11 +616,19 @@ Use |:SyntasticInfo| to see which checkers are available for a given filetype.
|
|||
5.2 Choosing the executable *syntastic-config-exec*
|
||||
|
||||
*'syntastic_<filetype>_<checker>_exec'*
|
||||
The executable used by a checker is normally defined automatically, when the
|
||||
checkers is registered. You can however override it by setting the variable
|
||||
The executable run by a checker is normally defined automatically, when the
|
||||
checker is registered. You can however override it, by setting the variable
|
||||
'g:syntastic_<filetype>_<checker>_exec': >
|
||||
let g:syntastic_ruby_mri_exec = '~/bin/ruby2'
|
||||
<
|
||||
This variable has a local version, 'b:syntastic_<filetype>_<checker>_exec',
|
||||
which takes precedence over the global one in the corresponding buffer.
|
||||
|
||||
*'b:syntastic_<checker>_exec'*
|
||||
And there is also a local variable named 'b:syntastic_<checker>_exec', which
|
||||
takes precedence over both 'b:syntastic_<filetype>_<checker>_exec' and
|
||||
'g:syntastic_<filetype>_<checker>_exec' in the buffers where it is defined.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
5.3 Configuring specific checkers *syntastic-config-makeprg*
|
||||
|
||||
|
@ -609,21 +653,20 @@ have local versions 'b:syntastic_<filetype>_<checker-name>_<option-name>',
|
|||
which take precedence over the global ones in the corresponding buffers.
|
||||
|
||||
If one of these variables has a non-empty default and you want it to be empty,
|
||||
you can set it to a space, e.g.: >
|
||||
let g:syntastic_javascript_jslint_args = " "
|
||||
you can set it to an empty string, e.g.: >
|
||||
let g:syntastic_javascript_jslint_args = ""
|
||||
<
|
||||
(setting it to an empty string doesn't work, for implementation reasons).
|
||||
|
||||
*'syntastic_<filetype>_<checker>_exe'*
|
||||
The 'exe' is normally the same as the 'exec' attribute described above, in
|
||||
which case it may be omitted. However, you can use it to add environment
|
||||
variables or additional parameters, e.g. to tell the mri checker to use KANJI
|
||||
encoding you could do something like this: >
|
||||
let g:syntastic_ruby_mri_exe = 'RUBYOPT="-Ke" ruby'
|
||||
variables, or to change the way the checker is run. For example this setup
|
||||
allows you to run PC-Lint under Wine emulation on Linux: >
|
||||
let g:syntastic_c_pc_lint_exec = "wine"
|
||||
let g:syntastic_c_pc_lint_exe = "wine c:/path/to/lint-nt.exe"
|
||||
<
|
||||
To override the args and the tail: >
|
||||
let g:syntastic_ruby_mri_args = "--my --args --here"
|
||||
let g:syntastic_ruby_mri_tail = "> /tmp/my-output-file-biatch"
|
||||
let g:syntastic_c_pc_lint_args = "-w5 -Iz:/usr/include/linux"
|
||||
let g:syntastic_c_pc_lint_tail = "2>/dev/null"
|
||||
<
|
||||
The general form of the override options is: >
|
||||
syntastic_<filetype>_<checker>_<option-name>
|
||||
|
@ -740,9 +783,9 @@ https://github.com/jmcantrell/vim-virtualenv). This is a limitation of
|
|||
7. About *syntastic-about*
|
||||
|
||||
The core maintainers of syntastic are:
|
||||
Martin Grenfell (github: scrooloose)
|
||||
Gregor Uhlenheuer (github: kongo2002)
|
||||
LCD 047 (github: lcd047)
|
||||
Martin Grenfell (GitHub: scrooloose)
|
||||
Gregor Uhlenheuer (GitHub: kongo2002)
|
||||
LCD 047 (GitHub: lcd047)
|
||||
|
||||
Find the latest version of syntastic at:
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ if has('reltime')
|
|||
lockvar! g:syntastic_start
|
||||
endif
|
||||
|
||||
let g:syntastic_version = '3.4.0-117'
|
||||
let g:syntastic_version = '3.5.0-37'
|
||||
lockvar g:syntastic_version
|
||||
|
||||
" Sanity checks {{{1
|
||||
|
@ -56,12 +56,14 @@ let g:syntastic_defaults = {
|
|||
\ 'bash_hack': 1,
|
||||
\ 'check_on_open': 0,
|
||||
\ 'check_on_wq': 1,
|
||||
\ 'cursor_columns': 1,
|
||||
\ 'debug': 0,
|
||||
\ 'echo_current_error': 1,
|
||||
\ 'enable_balloons': 1,
|
||||
\ 'enable_highlighting': 1,
|
||||
\ 'enable_signs': 1,
|
||||
\ 'error_symbol': '>>',
|
||||
\ 'exit_checks': !(s:running_windows && &shell =~? '\m\<cmd\.exe$'),
|
||||
\ 'filetype_map': {},
|
||||
\ 'full_redraws': !(has('gui_running') || has('gui_macvim')),
|
||||
\ 'id_checkers': 1,
|
||||
|
@ -228,7 +230,7 @@ endfunction " }}}2
|
|||
function! s:QuitPreHook() " {{{2
|
||||
call syntastic#log#debug(g:SyntasticDebugAutocommands,
|
||||
\ 'autocmd: QuitPre, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))))
|
||||
let b:syntastic_skip_checks = !g:syntastic_check_on_wq
|
||||
let b:syntastic_skip_checks = get(b:, 'syntastic_skip_checks', 0) || !syntastic#util#var('check_on_wq')
|
||||
call SyntasticLoclistHide()
|
||||
endfunction " }}}2
|
||||
|
||||
|