1
0
Fork 0
mirror of synced 2024-11-23 17:25:35 -05:00

Updated plugins

This commit is contained in:
amix 2014-09-27 16:32:18 +01:00
parent 2a9908e4f0
commit 89c36a0d2c
97 changed files with 3635 additions and 1655 deletions

View file

@ -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
" 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')
" 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
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
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'\:'=':

View file

@ -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, ...)

View file

@ -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.

View file

@ -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...__
@ -154,6 +165,7 @@ automatically by syntastic.
<a name="faqloclist"></a>
__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:
-->

View file

@ -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

View file

@ -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})))

View file

@ -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

View file

@ -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

View file

@ -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'|
@ -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.: >
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:

View file

@ -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
@ -481,7 +483,15 @@ function! SyntasticMake(options) " {{{2
execute 'lcd ' . fnameescape(old_cwd)
endif
silent! lolder
try
silent lolder
catch /\m^Vim\%((\a\+)\)\=:E380/
" E380: At bottom of quickfix stack
call setloclist(0, [], 'r')
catch /\m^Vim\%((\a\+)\)\=:E776/
" E776: No location list
" do nothing
endtry
" restore options {{{3
let &errorformat = old_errorformat
@ -496,7 +506,7 @@ function! SyntasticMake(options) " {{{2
call syntastic#log#debug(g:SyntasticDebugLoclist, 'raw loclist:', errors)
if has_key(a:options, 'returns') && index(a:options['returns'], v:shell_error) == -1
if syntastic#util#var('exit_checks') && has_key(a:options, 'returns') && index(a:options['returns'], v:shell_error) == -1
throw 'Syntastic: checker error'
endif
@ -555,9 +565,9 @@ endfunction " }}}2
" Skip running in special buffers
function! s:skipFile() " {{{2
let fname = expand('%')
let skip = (exists('b:syntastic_skip_checks') ? b:syntastic_skip_checks : 0) ||
\ (&buftype != '') || !filereadable(fname) || getwinvar(0, '&diff') ||
\ s:ignoreFile(fname) || fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
let skip = get(b:, 'syntastic_skip_checks', 0) || (&buftype != '') ||
\ !filereadable(fname) || getwinvar(0, '&diff') || s:ignoreFile(fname) ||
\ fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
if skip
call syntastic#log#debug(g:SyntasticDebugTrace, 'skipFile: skipping')
endif

View file

@ -46,11 +46,9 @@ function! g:SyntasticChecker.getName() " {{{2
endfunction " }}}2
function! g:SyntasticChecker.getExec() " {{{2
if exists('g:syntastic_' . self._filetype . '_' . self._name . '_exec')
return expand(g:syntastic_{self._filetype}_{self._name}_exec)
endif
return self._exec
return
\ expand( exists('b:syntastic_' . self._name . '_exec') ? b:syntastic_{self._name}_exec :
\ syntastic#util#var(self._filetype . '_' . self._name . '_exec', self._exec) )
endfunction " }}}2
function! g:SyntasticChecker.getExecEscaped() " {{{2
@ -147,10 +145,9 @@ function! g:SyntasticChecker._populateHighlightRegexes(errors) " {{{2
endfunction " }}}2
function! g:SyntasticChecker._getOpt(opts, basename, name, default) " {{{2
let user_val = syntastic#util#var(a:basename . a:name)
let ret = []
call extend( ret, self._shescape(get(a:opts, a:name . '_before', '')) )
call extend( ret, self._shescape(user_val != '' ? user_val : get(a:opts, a:name, a:default)) )
call extend( ret, self._shescape(syntastic#util#var( a:basename . a:name, get(a:opts, a:name, a:default) )) )
call extend( ret, self._shescape(get(a:opts, a:name . '_after', '')) )
return ret

View file

@ -20,7 +20,8 @@ function! g:SyntasticCursorNotifier.refresh(loclist) " {{{2
if self.enabled() && !a:loclist.isEmpty()
call syntastic#log#debug(g:SyntasticDebugNotifications, 'cursor: refresh')
let b:syntastic_messages = copy(a:loclist.messages(bufnr('')))
let b:oldLine = -1
let b:syntastic_line = -1
let b:syntastic_cursor_columns = a:loclist.getCursorColumns()
autocmd! syntastic CursorMoved
autocmd syntastic CursorMoved * call SyntasticRefreshCursor()
endif
@ -31,7 +32,7 @@ function! g:SyntasticCursorNotifier.reset(loclist) " {{{2
call syntastic#log#debug(g:SyntasticDebugNotifications, 'cursor: reset')
autocmd! syntastic CursorMoved
unlet! b:syntastic_messages
let b:oldLine = -1
let b:syntastic_line = -1
endfunction " }}}2
" @vimlint(EVL103, 0, a:loclist)
@ -39,27 +40,97 @@ endfunction " }}}2
" Private methods {{{1
" The following defensive nonsense is needed because of the nature of autocmd
function! SyntasticRefreshCursor() " {{{2
if !exists('b:syntastic_messages') || empty(b:syntastic_messages)
" file not checked
return
endif
if !exists('b:oldLine')
let b:oldLine = -1
if !exists('b:syntastic_line')
let b:syntastic_line = -1
endif
let l = line('.')
if l == b:oldLine
let current_messages = get(b:syntastic_messages, l, {})
if !exists('b:syntastic_cursor_columns')
let b:syntastic_cursor_columns = g:syntastic_cursor_columns
endif
if b:syntastic_cursor_columns
let c = virtcol('.')
if !exists('b:syntastic_idx')
let b:syntastic_idx = -1
endif
if s:_isSameIndex(l, b:syntastic_line, c, b:syntastic_idx, current_messages)
return
else
let b:syntastic_line = l
endif
if !empty(current_messages)
let b:syntastic_idx = s:_findIndex(c, current_messages)
call syntastic#util#wideMsg(current_messages[b:syntastic_idx].text)
else
let b:syntastic_idx = -1
echo
endif
else
if l == b:syntastic_line
return
endif
let b:oldLine = l
let b:syntastic_line = l
if has_key(b:syntastic_messages, l)
call syntastic#util#wideMsg(b:syntastic_messages[l])
if !empty(current_messages)
call syntastic#util#wideMsg(current_messages[0].text)
else
echo
endif
endif
endfunction " }}}2
" }}}1
" Private functions {{{1
function! s:_isSameIndex(line, old_line, column, idx, messages) " {{{2
if a:old_line >= 0 && a:line == a:old_line && a:idx >= 0
if len(a:messages) <= 1
return 1
endif
if a:messages[a:idx].scol <= a:column || a:idx == 0
if a:idx == len(a:messages) - 1 || a:column < a:messages[a:idx + 1].scol
return 1
else
return 0
endif
else
return 0
endif
else
return 0
endif
endfunction " }}}2
function! s:_findIndex(column, messages) " {{{2
let max = len(a:messages) - 1
if max == 0
return 0
endif
let min = 0
" modified binary search: assign index 0 to columns to the left of the first error
while min < max - 1
let mid = (min + max) / 2
if a:column < a:messages[mid].scol
let max = mid
else
let min = mid
endif
endwhile
return a:column < a:messages[max].scol ? min : max
endfunction " }}}2
" }}}1

View file

@ -21,6 +21,8 @@ function! g:SyntasticLoclist.New(rawLoclist) " {{{2
let newObj._rawLoclist = llist
let newObj._name = ''
let newObj._owner = bufnr('')
let newObj._sorted = 0
let newObj._columns = g:syntastic_cursor_columns
return newObj
endfunction " }}}2
@ -39,7 +41,15 @@ function! g:SyntasticLoclist.extend(other) " {{{2
endfunction " }}}2
function! g:SyntasticLoclist.sort() " {{{2
call syntastic#util#sortLoclist(self._rawLoclist)
if !self._sorted
for e in self._rawLoclist
call s:_setScreenColumn(e)
endfor
call sort(self._rawLoclist, self._columns ? 's:_compareErrorItemsByColumns' : 's:_compareErrorItemsByLines')
let self._sorted = 1
endif
endfunction " }}}2
function! g:SyntasticLoclist.isEmpty() " {{{2
@ -66,6 +76,10 @@ function! g:SyntasticLoclist.getBuffers() " {{{2
return syntastic#util#unique(map(copy(self._rawLoclist), 'str2nr(v:val["bufnr"])') + [self._owner])
endfunction " }}}2
function! g:SyntasticLoclist.getCursorColumns() " {{{2
return self._columns
endfunction " }}}2
function! g:SyntasticLoclist.getStatuslineFlag() " {{{2
if !exists("self._stl_format")
let self._stl_format = ''
@ -183,8 +197,8 @@ endfunction " }}}2
function! g:SyntasticLoclist.messages(buf) " {{{2
if !exists("self._cachedMessages")
let self._cachedMessages = {}
let errors = self.errors() + self.warnings()
let errors = self.errors() + self.warnings()
for e in errors
let b = e['bufnr']
let l = e['lnum']
@ -194,9 +208,32 @@ function! g:SyntasticLoclist.messages(buf) " {{{2
endif
if !has_key(self._cachedMessages[b], l)
let self._cachedMessages[b][l] = e['text']
let self._cachedMessages[b][l] = [e]
elseif self._columns
call add(self._cachedMessages[b][l], e)
endif
endfor
if self._columns
if !self._sorted
for b in keys(self._cachedMessages)
for l in keys(self._cachedMessages[b])
if len(self._cachedMessages[b][l]) > 1
for e in self._cachedMessages[b][l]
call s:_setScreenColumn(e)
endfor
call sort(self._cachedMessages[b][l], 's:_compareErrorItemsByColumns')
endif
endfor
endfor
endif
for b in keys(self._cachedMessages)
for l in keys(self._cachedMessages[b])
call s:_removeShadowedItems(self._cachedMessages[b][l])
endfor
endfor
endif
endif
return get(self._cachedMessages, a:buf, {})
@ -210,7 +247,7 @@ endfunction " }}}2
"
"Note that all comparisons are done with ==?
function! g:SyntasticLoclist.filter(filters) " {{{2
let conditions = values(map(copy(a:filters), 's:translate(v:key, v:val)'))
let conditions = values(map(copy(a:filters), 's:_translate(v:key, v:val)'))
let filter = len(conditions) == 1 ?
\ conditions[0] : join(map(conditions, '"(" . v:val . ")"'), ' && ')
return filter(copy(self._rawLoclist), filter)
@ -271,10 +308,93 @@ endfunction " }}}2
" Private functions {{{1
function! s:translate(key, val) " {{{2
function! s:_translate(key, val) " {{{2
return 'get(v:val, ' . string(a:key) . ', "") ==? ' . string(a:val)
endfunction " }}}2
function! s:_setScreenColumn(item) " {{{2
if !has_key(a:item, 'scol')
let col = get(a:item, 'col', 0)
if col != 0 && get(a:item, 'vcol', 0) == 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'] = syntastic#util#screenWidth(strpart(line, 0, col), getbufvar(buf, '&tabstop'))
else
let a:item['scol'] = col
endif
endif
endfunction " }}}2
function! s:_removeShadowedItems(errors) " {{{2
" keep only the first message at a given column
let i = 0
while i < len(a:errors) - 1
let j = i + 1
let dupes = 0
while j < len(a:errors) && a:errors[j].scol == a:errors[i].scol
let dupes = 1
let j += 1
endwhile
if dupes
call remove(a:errors, i + 1, j - 1)
endif
let i += 1
endwhile
" merge messages with the same text
let i = 0
while i < len(a:errors) - 1
let j = i + 1
let dupes = 0
while j < len(a:errors) && a:errors[j].text == a:errors[i].text
let dupes = 1
let j += 1
endwhile
if dupes
call remove(a:errors, i + 1, j - 1)
endif
let i += 1
endwhile
endfunction " }}}2
function! s:_compareErrorItemsByColumns(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['scol'] != a:b['scol']
" sort by screen column
return a:a['scol'] - a:b['scol']
elseif a:a['type'] !=? a:b['type']
" errors take precedence over warnings
return a:a['type'] ==? 'E' ? -1 : 1
else
return 0
endif
endfunction " }}}2
function! s:_compareErrorItemsByLines(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
" vim: set sw=4 sts=4 et fdm=marker:

View file

@ -72,10 +72,11 @@ let s:defaultCheckers = {
\ 'scss': ['sass', 'scss_lint'],
\ 'sh': ['sh', 'shellcheck'],
\ 'slim': ['slimrb'],
\ 'spec': ['rpmlint'],
\ 'tcl': ['nagelfar'],
\ 'tex': ['lacheck', 'chktex'],
\ 'texinfo': ['makeinfo'],
\ 'text': ['atdtool'],
\ 'text': [],
\ 'twig': ['twiglint'],
\ 'typescript': ['tsc'],
\ 'vala': ['valac'],
@ -96,7 +97,8 @@ lockvar! s:defaultCheckers
let s:defaultFiletypeMap = {
\ 'gentoo-metadata': 'xml',
\ 'lhaskell': 'haskell',
\ 'litcoffee': 'coffee'
\ 'litcoffee': 'coffee',
\ 'mail': 'text'
\ }
lockvar! s:defaultFiletypeMap
@ -130,7 +132,7 @@ endfunction " }}}2
" not checked for availability (that is, the corresponding IsAvailable() are
" not run).
function! g:SyntasticRegistry.getCheckers(ftalias, hints_list) " {{{2
let ft = s:normaliseFiletype(a:ftalias)
let ft = s:_normaliseFiletype(a:ftalias)
call self._loadCheckersFor(ft)
let checkers_map = self._checkerMap[ft]
@ -173,13 +175,13 @@ function! g:SyntasticRegistry.getKnownFiletypes() " {{{2
endfunction " }}}2
function! g:SyntasticRegistry.getNamesOfAvailableCheckers(ftalias) " {{{2
let ft = s:normaliseFiletype(a:ftalias)
let ft = s:_normaliseFiletype(a:ftalias)
call self._loadCheckersFor(ft)
return keys(filter( copy(self._checkerMap[ft]), 'v:val.isAvailable()' ))
endfunction " }}}2
function! g:SyntasticRegistry.echoInfoFor(ftalias_list) " {{{2
let ft_list = syntastic#util#unique(map( copy(a:ftalias_list), 's:normaliseFiletype(v:val)' ))
let ft_list = syntastic#util#unique(map( copy(a:ftalias_list), 's:_normaliseFiletype(v:val)' ))
if len(ft_list) != 1
let available = []
let active = []
@ -253,7 +255,7 @@ endfunction " }}}2
"resolve filetype aliases, and replace - with _ otherwise we cant name
"syntax checker functions legally for filetypes like "gentoo-metadata"
function! s:normaliseFiletype(ftalias) " {{{2
function! s:_normaliseFiletype(ftalias) " {{{2
let ft = get(s:defaultFiletypeMap, a:ftalias, a:ftalias)
let ft = get(g:syntastic_filetype_map, ft, ft)
let ft = substitute(ft, '\m-', '_', 'g')

View file

@ -18,7 +18,7 @@ let g:loaded_syntastic_arduino_avrgcc_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'c',
\ 'filetype': 'arduino',
\ 'name': 'avrgcc',
\ 'exec': 'avr-gcc',
\ 'redirect': 'c/avrgcc'})

View file

@ -0,0 +1,65 @@
"============================================================================
"File: clang_check.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Benjamin Bannier <bbannier at gmail dot 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_c_clang_check_checker")
finish
endif
let g:loaded_syntastic_c_clang_check_checker = 1
if !exists('g:syntastic_clang_check_config_file')
let g:syntastic_clang_check_config_file = '.syntastic_clang_check_config'
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_c_clang_check_IsAvailable() dict
return executable(self.getExec())
endfunction
function! SyntaxCheckers_c_clang_check_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'post_args':
\ '-- ' .
\ syntastic#c#ReadConfig(g:syntastic_clang_check_config_file) . ' ' .
\ '-fshow-column ' .
\ '-fshow-source-location ' .
\ '-fno-caret-diagnostics ' .
\ '-fno-color-diagnostics ' .
\ '-fdiagnostics-format=clang' })
let errorformat =
\ '%E%f:%l:%c: fatal error: %m,' .
\ '%E%f:%l:%c: error: %m,' .
\ '%W%f:%l:%c: warning: %m,' .
\ '%-G%\m%\%%(LLVM ERROR:%\|No compilation database found%\)%\@!%.%#,' .
\ '%E%m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 1] })
call self.setWantSort(1)
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'c',
\ 'name': 'clang_check',
\ 'exec': 'clang-check'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -0,0 +1,65 @@
"============================================================================
"File: clang_tidy.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Benjamin Bannier <bbannier at gmail dot 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_c_clang_tidy_checker")
finish
endif
let g:loaded_syntastic_c_clang_tidy_checker = 1
if !exists('g:syntastic_clang_tidy_config_file')
let g:syntastic_clang_tidy_config_file = '.syntastic_clang_tidy_config'
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_c_clang_tidy_IsAvailable() dict
return executable(self.getExec())
endfunction
function! SyntaxCheckers_c_clang_tidy_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'post_args':
\ '-- ' .
\ syntastic#c#ReadConfig(g:syntastic_clang_tidy_config_file) . ' ' .
\ '-fshow-column ' .
\ '-fshow-source-location ' .
\ '-fno-caret-diagnostics ' .
\ '-fno-color-diagnostics ' .
\ '-fdiagnostics-format=clang' })
let errorformat =
\ '%E%f:%l:%c: fatal error: %m,' .
\ '%E%f:%l:%c: error: %m,' .
\ '%W%f:%l:%c: warning: %m,' .
\ '%-G%\m%\%%(LLVM ERROR:%\|No compilation database found%\)%\@!%.%#,' .
\ '%E%m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 1] })
call self.setWantSort(1)
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'c',
\ 'name': 'clang_tidy',
\ 'exec': 'clang-tidy'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -30,15 +30,13 @@ set cpo&vim
function! SyntaxCheckers_c_oclint_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'post_args_before': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file) })
\ 'post_args': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file) })
let errorformat =
\ '%E%f:%l:%c: %m P1 ,' .
\ '%E%f:%l:%c: %m P2 ,' .
\ '%W%f:%l:%c: %m P3 ,' .
\ '%E%f:%l:%c: fatal error: %m,' .
\ '%E%f:%l:%c: error: %m,' .
\ '%W%f:%l:%c: warning: %m,' .
\ '%E%f:%l:%c: %m,' .
\ '%-G%.%#'
let loclist = SyntasticMake({
@ -48,6 +46,15 @@ function! SyntaxCheckers_c_oclint_GetLocList() dict
\ 'postprocess': ['compressWhitespace'],
\ 'returns': [0, 3, 5] })
for e in loclist
if e['text'] =~# '\v P3( |$)'
let e['type'] = 'W'
endif
let e['text'] = substitute(e['text'], '\m\C P[1-3]$', '', '')
let e['text'] = substitute(e['text'], '\m\C P[1-3] ', ': ', '')
endfor
call self.setWantSort(1)
return loclist

View file

@ -0,0 +1,65 @@
"============================================================================
"File: pc_lint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Steve Bragg <steve at empresseffects dot 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_c_pc_lint_checker")
finish
endif
let g:loaded_syntastic_c_pc_lint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
if !exists('g:syntastic_pc_lint_config_file')
let g:syntastic_pc_lint_config_file = 'options.lnt'
endif
function! SyntaxCheckers_c_pc_lint_GetLocList() dict
let config = findfile(g:syntastic_pc_lint_config_file, '.;')
" -hFs1 - show filename, add space after messages, try to make message 1 line
" -width(0,0) - make sure there are no line breaks
" -t - set tab size
" -v - turn off verbosity
let makeprg = self.makeprgBuild({
\ 'args': (filereadable(config) ? syntastic#util#shescape(fnamemodify(config, ':p')) : ''),
\ 'args_after': ['-hFs1', '-width(0,0)', '-t' . &tabstop, '-format=%f:%l:%C:%t:%n:%m'] })
let errorformat =
\ '%E%f:%l:%v:Error:%n:%m,' .
\ '%W%f:%l:%v:Warning:%n:%m,' .
\ '%I%f:%l:%v:Info:%n:%m,' .
\ '%-G%.%#'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['cygwinRemoveCR'] })
for e in loclist
if e['type'] ==? 'I'
let e['type'] = 'W'
let e['subtype'] = 'Style'
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'c',
\ 'name': 'pc_lint',
\ 'exec': 'lint-nt'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -0,0 +1,25 @@
"============================================================================
"File: clang_check.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Benjamin Bannier <bbannier at gmail dot 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_cpp_clang_check_checker")
finish
endif
let g:loaded_syntastic_cpp_clang_check_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'clang_check',
\ 'exec': 'clang-check',
\ 'redirect': 'c/clang_check'})
" vim: set et sts=4 sw=4:

View file

@ -0,0 +1,25 @@
"============================================================================
"File: clang_tidy.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Benjamin Bannier <bbannier at gmail dot 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_cpp_clang_tidy_checker")
finish
endif
let g:loaded_syntastic_cpp_clang_tidy_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'clang_tidy',
\ 'exec': 'clang-tidy',
\ 'redirect': 'c/clang_tidy'})
" vim: set et sts=4 sw=4:

View file

@ -0,0 +1,26 @@
"============================================================================
"File: pc_lint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Steve Bragg <steve at empresseffects dot 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_cpp_pc_lint_checker")
finish
endif
let g:loaded_syntastic_cpp_pc_lint_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'pc_lint',
\ 'exec': 'lint-nt',
\ 'redirect': 'c/pc_lint'})
" vim: set et sts=4 sw=4:

View file

@ -32,7 +32,7 @@ main([FileName, "-rebar", Path, LibDirs]) ->
%io:format("~p~n", [LibDirs1]),
compile(FileName, LibDirs1);
main([FileName, LibDirs]) ->
main([FileName | LibDirs]) ->
compile(FileName, LibDirs).
compile(FileName, LibDirs) ->
@ -45,7 +45,12 @@ compile(FileName, LibDirs) ->
warn_export_vars,
strong_validation,
report] ++
[{i, filename:join(Root, I)} || I <- LibDirs]).
[{i, filename:join(Root, I)} || I <- LibDirs] ++
case lists:member("deps/pmod_transform/include", LibDirs) of
true -> [{parse_transform, pmod_pt}];
_ -> []
end
).
get_root(Dir) ->
Path = filename:split(filename:absname(Dir)),

View file

@ -42,9 +42,16 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict
\ syntastic#util#shescape('puts ERB.new(File.read(' .
\ fname . encoding_spec .
\ ').gsub(''<%='',''<%''), nil, ''-'').src') .
\ ' | ' . self.getExecEscaped() . ' -c'
\ ' | ' . self.getExecEscaped() . ' -w -c'
let errorformat =
let errorformat = '%-G%\m%.%#warning: %\%%(possibly %\)%\?useless use of a literal in void context,'
" filter out lines starting with ...
" long lines are truncated and wrapped in ... %p then returns the wrong
" column offset
let errorformat .= '%-G%\%.%\%.%\%.%.%#,'
let errorformat .=
\ '%-GSyntax OK,'.
\ '%E-:%l: syntax error\, %m,%Z%p^,'.
\ '%W-:%l: warning: %m,'.

View file

@ -29,6 +29,7 @@ function! SyntaxCheckers_handlebars_handlebars_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['guards'],
\ 'defaults': {'bufnr': bufnr("")} })
endfunction

View file

@ -27,19 +27,27 @@ endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_java_checkstyle_IsAvailable() dict
return
\ executable(self.getExec()) &&
\ filereadable(expand(g:syntastic_java_checkstyle_classpath)) &&
\ filereadable(expand(g:syntastic_java_checkstyle_conf_file))
endfunction
function! SyntaxCheckers_java_checkstyle_GetLocList() dict
let fname = syntastic#util#shescape( expand('%:p:h') . '/' . expand('%:t') )
let fname = syntastic#util#shescape( expand('%:p:h') . syntastic#util#Slash() . expand('%:t') )
if has('win32unix')
let fname = substitute(system('cygpath -m ' . fname), '\m\%x00', '', 'g')
endif
let makeprg = self.makeprgBuild({
\ 'args_after': '-cp ' . g:syntastic_java_checkstyle_classpath .
\ ' com.puppycrawl.tools.checkstyle.Main -c ' .
\ syntastic#util#shexpand(g:syntastic_java_checkstyle_conf_file) .
\ ' -f xml',
\ 'args_after': [
\ '-cp', expand(g:syntastic_java_checkstyle_classpath),
\ 'com.puppycrawl.tools.checkstyle.Main',
\ '-c', expand(g:syntastic_java_checkstyle_conf_file),
\ '-f', 'xml'],
\ 'fname': fname })
let errorformat = '%f:%t:%l:%c:%m'

View file

@ -35,7 +35,8 @@ function! SyntaxCheckers_javascript_eslint_GetLocList() dict
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
\ 'errorformat': errorformat,
\ 'postprocess': ['guards'] })
for e in loclist
let e['col'] += 1

View file

@ -58,6 +58,7 @@ function! SyntaxCheckers_less_lessc_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['guards'],
\ 'defaults': {'bufnr': bufnr(""), 'text': "Syntax error"} })
endfunction

View file

@ -71,7 +71,7 @@ if !exists('g:syntastic_ocaml_use_ocamlc') || !executable('ocamlc')
endif
if !exists('g:syntastic_ocaml_use_janestreet_core')
let g:syntastic_ocaml_use_ocamlc = 0
let g:syntastic_ocaml_use_janestreet_core = 0
endif
if !exists('g:syntastic_ocaml_use_ocamlbuild') || !executable("ocamlbuild")

View file

@ -38,7 +38,8 @@ function! SyntaxCheckers_php_php_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
\ 'errorformat': errorformat,
\ 'postprocess': ['guards'] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

View file

@ -0,0 +1,91 @@
"============================================================================
"File: phplint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot 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_php_phplint_checker")
finish
endif
let g:loaded_syntastic_php_phplint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_php_phplint_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\munresolved function \zs\S\+\ze')
if term != ''
return '\V' . escape(term, '\')
endif
let term = matchstr(a:item['text'], '\m\(class\|function\|method\) \zs\S\+\ze was declared as')
if term != ''
return '\V' . escape(term, '\')
endif
let term = matchstr(a:item['text'], '\maccess forbidden to \(private\|protected\) \(class\|constant\|method\|variable\|\(private\|protected\) property\) \zs\S\+\ze')
if term != ''
return '\V' . escape(term, '\')
endif
let term = matchstr(a:item['text'], '\musing deprecated \(class\|constant\|method\|property\|variable\) \zs\S\+\ze')
if term != ''
return '\V' . escape(term, '\')
endif
let term = matchstr(a:item['text'], '\munresolved function \zs\S\+\ze')
if term != ''
return '\V' . escape(term, '\')
endif
let term = matchstr(a:item['text'], '\munresolved function \zs\S\+\ze')
if term != ''
return '\V' . escape(term, '\')
endif
let term = matchstr(a:item['text'], '\munresolved function \zs\S\+\ze')
return term != '' ? '\V' . escape(term, '\') : ''
endfunction
function! SyntaxCheckers_php_phplint_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_after':
\ '--print-file-name ' .
\ '--print-line-numbers ' .
\ '--print-column-number ' .
\ '--print-errors ' .
\ '--print-warnings ' .
\ '--no-print-notices ' .
\ '--no-print-context ' .
\ '--no-print-source ' .
\ '--tab-size ' . &tabstop })
let errorformat =
\ '%E%f:%l:%v: %tRROR: %m,' .
\ '%W%f:%l:%v: %tarning: %m,' .
\ '%+C%\t%.%#,' .
\ '%-G%.%#'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['compressWhitespace'],
\ 'subtype': 'Style',
\ 'returns': [0, 1] })
for e in loclist
let e['text'] = substitute(e['text'], '\m \(Hint\|Examples\):.*', '', '')
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'php',
\ 'name': 'phplint',
\ 'exec': 'phpl' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -32,8 +32,8 @@ function! SyntaxCheckers_puppet_puppet_GetLocList() dict
let errorformat =
\ '%-Gerr: Try ''puppet help parser validate'' for usage,' .
\ '%-GError: Try ''puppet help parser validate'' for usage,' .
\ '%Eerr: Could not parse for environment %*[a-z]: %m at %f:%l,' .
\ '%EError: Could not parse for environment %*[a-z]: %m at %f:%l'
\ '%A%t%*[a-zA-Z]: %m at %f:%l:%c,' .
\ '%A%t%*[a-zA-Z]: %m at %f:%l'
return SyntasticMake({
\ 'makeprg': makeprg,

View file

@ -42,7 +42,7 @@ function! SyntaxCheckers_python_frosted_GetLocList() dict
if len(parts) >= 4
let e["type"] = parts[1][0]
let e["text"] = parts[3] . ' [' . parts[1] . ']'
let e["hl"] = '\V' . escape(parts[2], '\')
let e["hl"] = '\V\<' . escape(parts[2], '\') . '\>'
elseif e["text"] =~? '\v^I\d+:'
let e["valid"] = 0
else

View file

@ -69,8 +69,10 @@ function! s:PylintNew(exe)
" On Gentoo Linux it's "pylint-python2.7 0.28.0".
" On NixOS, that would be ".pylint-wrapped 0.26.0".
" On Arch Linux it's "pylint2 1.1.0".
" On new-ish Fedora it's "python3-pylint 1.2.0".
" Have you guys considered switching to creative writing yet? ;)
let pylint_version = filter(split(system(exe . ' --version'), '\m, \=\|\n'), 'v:val =~# ''\m^\.\=pylint[-0-9]*\>''')[0]
let pylint_version = filter( split(system(exe . ' --version'), '\m, \=\|\n'),
\ 'v:val =~# ''\m^\(python[-0-9]*-\|\.\)\=pylint[-0-9]*\>''' )[0]
let pylint_version = substitute(pylint_version, '\v^\S+\s+', '', '')
let ret = syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1])
catch /\m^Vim\%((\a\+)\)\=:E684/

View file

@ -44,7 +44,7 @@ function! SyntaxCheckers_ruby_mri_GetLocList() dict
"
"Which always generate the warning below. Note that ruby >= 1.9.3 includes
"the word "possibly" in the warning
let errorformat = '%-G%.%#warning: %\(possibly %\)%\?useless use of == in void context,'
let errorformat = '%-G%\m%.%#warning: %\%%(possibly %\)%\?useless use of == in void context,'
" filter out lines starting with ...
" long lines are truncated and wrapped in ... %p then returns the wrong

View file

@ -43,7 +43,7 @@ function! SyntaxCheckers_sass_sass_GetLocList() dict
\ 'args_before': '--cache-location ' . s:sass_cache_location . ' ' . s:imports . ' --check' })
let errorformat =
\ '%ESyntax %trror: %m,' .
\ '%E%\m%\%%(Syntax %\)%\?%trror: %m,' .
\ '%+C %.%#,' .
\ '%C on line %l of %f\, %.%#,' .
\ '%C on line %l of %f,' .

View file

@ -0,0 +1,71 @@
"============================================================================
"File: scalastyle.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot 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_scala_scalastyle_checker')
finish
endif
let g:loaded_syntastic_scala_scalastyle_checker = 1
if !exists('g:syntastic_scala_scalastyle_jar')
let g:syntastic_scala_scalastyle_jar = 'scalastyle-batch_2.10.jar'
endif
if !exists('g:syntastic_scala_scalastyle_config_file')
let g:syntastic_scala_scalastyle_config_file = 'scalastyle_config.xml'
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_scala_scalastyle_IsAvailable() dict
return
\ executable(self.getExec()) &&
\ filereadable(expand(g:syntastic_scala_scalastyle_jar)) &&
\ filereadable(expand(g:syntastic_scala_scalastyle_config_file))
endfunction
function! SyntaxCheckers_scala_scalastyle_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'exe_after': ['-jar', expand(g:syntastic_scala_scalastyle_jar)],
\ 'args_before': ['-q', 'true', '-c', expand(g:syntastic_scala_scalastyle_config_file)] })
let errorformat =
\ '%trror file=%f message=%m line=%l column=%c,' .
\ '%trror file=%f message=%m line=%l,' .
\ '%tarning file=%f message=%m line=%l column=%c,' .
\ '%tarning file=%f message=%m line=%l'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'returns': [0, 1] })
for e in loclist
if has_key(e, 'col')
let e['col'] += 1
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'scala',
\ 'name': 'scalastyle',
\ 'exec': 'java'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -31,7 +31,7 @@ function! SyntaxCheckers_scss_scss_lint_GetLocList() dict
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'returns': [0, 1, 65] })
\ 'returns': [0, 1, 2, 65, 66] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

View file

@ -57,7 +57,7 @@ function! s:GetShell()
endif
" try to use env variable in case no shebang could be found
if b:shell == ''
let b:shell = fnamemodify(expand('$SHELL'), ':t')
let b:shell = fnamemodify($SHELL, ':t')
endif
endif
return b:shell

View file

@ -0,0 +1,43 @@
"============================================================================
"File: rpmlint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot 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_spec_rpmlint_checker')
finish
endif
let g:loaded_syntastic_spec_rpmlint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_spec_rpmlint_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat =
\ '%E%f:%l: E: %m,' .
\ '%E%f: E: %m,' .
\ '%W%f:%l: W: %m,' .
\ '%W%f: W: %m,' .
\ '%-G%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'spec',
\ 'name': 'rpmlint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -44,6 +44,8 @@ function! SyntaxCheckers_text_atdtool_GetLocList() dict
let e['text'] = substitute(e['text'], '\m\n\s\+', ' | ', 'g')
endfor
call self.setWantSort(1)
return loclist
endfunction

View file

@ -156,7 +156,7 @@ function! airline#check_mode(winnr)
call add(l:mode, 'paste')
endif
if &readonly
if &readonly || ! &modifiable
call add(l:mode, 'readonly')
endif

View file

@ -215,6 +215,10 @@ function! airline#extensions#load()
call airline#extensions#capslock#init(s:ext)
endif
if (get(g:, 'airline#extensions#windowswap#enabled', 1) && get(g:, 'loaded_windowswap', 0))
call airline#extensions#windowswap#init(s:ext)
endif
if !get(g:, 'airline#extensions#disable_rtp_load', 0)
" load all other extensions, which are not part of the default distribution.
" (autoload/airline/extensions/*.vim outside of our s:script_path).

View file

@ -21,7 +21,12 @@ function! s:get_git_branch(path)
else
try
let line = join(readfile(dir . '/HEAD'))
if strpart(line, 0, 16) == 'ref: refs/heads/'
let name = strpart(line, 16)
else
" raw commit hash
let name = strpart(line, 0, 7)
endif
catch
let name = ''
endtry
@ -37,9 +42,11 @@ function! airline#extensions#branch#head()
endif
let b:airline_head = ''
let found_fugitive_head = 0
if s:has_fugitive && !exists('b:mercurial_dir')
let b:airline_head = fugitive#head()
let b:airline_head = fugitive#head(7)
let found_fugitive_head = 1
if empty(b:airline_head) && !exists('b:git_dir')
let b:airline_head = s:get_git_branch(expand("%:p:h"))
@ -61,7 +68,7 @@ function! airline#extensions#branch#head()
endif
endif
if empty(b:airline_head) || !s:check_in_path()
if empty(b:airline_head) || !found_fugitive_head && !s:check_in_path()
let b:airline_head = ''
endif

View file

@ -63,7 +63,11 @@ function! airline#extensions#default#apply(builder, context)
if airline#util#getwinvar(winnr, 'airline_render_left', active || (!active && !g:airline_inactive_collapse))
call <sid>build_sections(a:builder, a:context, s:layout[0])
else
call a:builder.add_section('airline_c'.(a:context.bufnr), ' %f%m ')
let text = <sid>get_section(winnr, 'c')
if empty(text)
let text = ' %f%m '
endif
call a:builder.add_section('airline_c'.(a:context.bufnr), text)
endif
call a:builder.split(s:get_section(winnr, 'gutter', '', ''))

View file

@ -7,7 +7,9 @@ let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
let s:show_tab_nr = get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1)
let s:show_close_button = get(g:, 'airline#extensions#tabline#show_close_button', 1)
let s:close_symbol = get(g:, 'airline#extensions#tabline#close_symbol', 'X')
let s:buffer_idx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0)
let s:builder_context = {
\ 'active' : 1,
@ -26,6 +28,21 @@ let s:buf_min_count = get(g:, 'airline#extensions#tabline#buffer_min_count', 0)
let s:tab_min_count = get(g:, 'airline#extensions#tabline#tab_min_count', 0)
let s:spc = g:airline_symbols.space
let s:number_map = &encoding == 'utf-8'
\ ? {
\ '0': '⁰',
\ '1': '¹',
\ '2': '²',
\ '3': '³',
\ '4': '⁴',
\ '5': '⁵',
\ '6': '⁶',
\ '7': '⁷',
\ '8': '⁸',
\ '9': '⁹'
\ }
\ : {}
function! airline#extensions#tabline#init(ext)
if has('gui_running')
set guioptions-=e
@ -37,6 +54,9 @@ function! airline#extensions#tabline#init(ext)
call s:toggle_on()
call a:ext.add_theme_func('airline#extensions#tabline#load_theme')
if s:buffer_idx_mode
call s:define_buffer_idx_mode_mappings()
endif
endfunction
function! s:toggle_off()
@ -71,12 +91,20 @@ function! airline#extensions#tabline#load_theme(palette)
let l:tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a)
let l:tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c)
let l:tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a)
if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c')
let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal_modified.airline_c)
else
"Fall back to normal airline_c if modified airline_c isn't present
let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal.airline_c)
endif
let l:tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c)
call airline#highlighter#exec('airline_tab', l:tab)
call airline#highlighter#exec('airline_tabsel', l:tabsel)
call airline#highlighter#exec('airline_tabtype', l:tabtype)
call airline#highlighter#exec('airline_tabfill', l:tabfill)
call airline#highlighter#exec('airline_tabmod', l:tabmod)
call airline#highlighter#exec('airline_tabmod_unsel', l:tabmodu)
call airline#highlighter#exec('airline_tabhid', l:tabhid)
endfunction
@ -93,7 +121,12 @@ function! s:on_cursormove(min_count, total_count)
endfunction
function! airline#extensions#tabline#get()
if s:show_buffers && tabpagenr('$') == 1
let curtabcnt = tabpagenr('$')
if curtabcnt != s:current_tabcnt
let s:current_tabcnt = curtabcnt
let s:current_bufnr = -1 " force a refresh...
endif
if s:show_buffers && curtabcnt == 1
return s:get_buffers()
else
return s:get_tabs()
@ -180,11 +213,13 @@ function! s:get_visible_buffers()
endif
endif
let g:current_visible_buffers = buffers
return buffers
endfunction
let s:current_bufnr = -1
let s:current_tabnr = -1
let s:current_tabcnt = -1
let s:current_tabline = ''
let s:current_modified = 0
function! s:get_buffers()
@ -195,6 +230,7 @@ function! s:get_buffers()
endif
endif
let l:index = 1
let b = airline#builder#new(s:builder_context)
let tab_bufs = tabpagebuflist(tabpagenr())
for nr in s:get_visible_buffers()
@ -202,6 +238,7 @@ function! s:get_buffers()
call b.add_raw('%#airline_tabhid#...')
continue
endif
if cur == nr
if g:airline_detect_modified && getbufvar(nr, '&modified')
let group = 'airline_tabmod'
@ -210,13 +247,25 @@ function! s:get_buffers()
endif
let s:current_modified = (group == 'airline_tabmod') ? 1 : 0
else
if index(tab_bufs, nr) > -1
if g:airline_detect_modified && getbufvar(nr, '&modified')
let group = 'airline_tabmod_unsel'
elseif index(tab_bufs, nr) > -1
let group = 'airline_tab'
else
let group = 'airline_tabhid'
endif
endif
if s:buffer_idx_mode
if len(s:number_map) > 0
call b.add_section(group, s:spc . get(s:number_map, l:index, '') . '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)' . s:spc)
else
call b.add_section(group, '['.l:index.s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.']')
endif
let l:index = l:index + 1
else
call b.add_section(group, s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.s:spc)
endif
endfor
call b.add_section('airline_tabfill', '')
@ -228,6 +277,35 @@ function! s:get_buffers()
return s:current_tabline
endfunction
function! s:select_tab(buf_index)
" no-op when called in the NERDTree buffer
if exists('t:NERDTreeBufName') && bufname('%') == t:NERDTreeBufName
return
endif
let idx = a:buf_index
if g:current_visible_buffers[0] == -1
let idx = idx + 1
endif
let buf = get(g:current_visible_buffers, idx, 0)
if buf != 0
exec 'b!' . buf
endif
endfunction
function! s:define_buffer_idx_mode_mappings()
noremap <unique> <Plug>AirlineSelectTab1 :call <SID>select_tab(0)<CR>
noremap <unique> <Plug>AirlineSelectTab2 :call <SID>select_tab(1)<CR>
noremap <unique> <Plug>AirlineSelectTab3 :call <SID>select_tab(2)<CR>
noremap <unique> <Plug>AirlineSelectTab4 :call <SID>select_tab(3)<CR>
noremap <unique> <Plug>AirlineSelectTab5 :call <SID>select_tab(4)<CR>
noremap <unique> <Plug>AirlineSelectTab6 :call <SID>select_tab(5)<CR>
noremap <unique> <Plug>AirlineSelectTab7 :call <SID>select_tab(6)<CR>
noremap <unique> <Plug>AirlineSelectTab8 :call <SID>select_tab(7)<CR>
noremap <unique> <Plug>AirlineSelectTab9 :call <SID>select_tab(8)<CR>
endfunction
function! s:get_tabs()
let curbuf = bufnr('%')
let curtab = tabpagenr()
@ -266,7 +344,9 @@ function! s:get_tabs()
call b.add_raw('%T')
call b.add_section('airline_tabfill', '')
call b.split()
if s:show_close_button
call b.add_section('airline_tab', ' %999X'.s:close_symbol.' ')
endif
if s:show_tab_type
call b.add_section('airline_tabtype', ' tabs ')
endif

View file

@ -0,0 +1,23 @@
" vim: et ts=2 sts=2 sw=2
if !exists('g:loaded_windowswap')
finish
endif
let s:spc = g:airline_symbols.space
if !exists('g:airline#extensions#windowswap#indicator_text')
let g:airline#extensions#windowswap#indicator_text = 'WS'
endif
function! airline#extensions#windowswap#init(ext)
call airline#parts#define_function('windowswap', 'airline#extensions#windowswap#get_status')
endfunction
function! airline#extensions#windowswap#get_status()
if WindowSwap#HasMarkedWindow() && WindowSwap#GetMarkedWindowNum() == winnr()
return g:airline#extensions#windowswap#indicator_text.s:spc
endif
return ''
endfunction

View file

@ -78,7 +78,7 @@ function! airline#init#bootstrap()
call airline#parts#define_raw('file', '%f%m')
call airline#parts#define_raw('linenr', '%{g:airline_symbols.linenr}%#__accent_bold#%4l%#__restore__#')
call airline#parts#define_function('ffenc', 'airline#parts#ffenc')
call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic', 'eclim', 'whitespace'])
call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic', 'eclim', 'whitespace','windowswap'])
call airline#parts#define_text('capslock', '')
unlet g:airline#init#bootstrapping
@ -105,7 +105,7 @@ function! airline#init#sections()
let g:airline_section_y = airline#section#create_right(['ffenc'])
endif
if !exists('g:airline_section_z')
let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3c '])
let g:airline_section_z = airline#section#create(['windowswap', '%3p%%'.spc, 'linenr', ':%3c '])
endif
if !exists('g:airline_section_warning')
let g:airline_section_warning = airline#section#create(['syntastic', 'eclim', 'whitespace'])

View file

@ -49,7 +49,7 @@ function! s:create(parts, append)
endif
if exists('part.condition')
let partval = substitute(partval, '{', '{'.(part.condition).' ? ', '')
let partval = substitute(partval, '{', '\="{".(part.condition)." ? "', '')
let partval = substitute(partval, '}', ' : ""}', '')
endif

View file

@ -1,43 +1,52 @@
"
" Colorscheme: Kalisi for airline. Inspired by powerline.
" 06.02.2014 Arthur Jaron
" Arthur Jaron
" hifreeo@gmail.com
"
" 30.07.2014
" Insert mode
let s:I1 = [ '#ffffff' , '#e80000' , 23 , 231 ]
let s:I2 = [ '#c5c5c5' , '#901010' , 74 , 31 ]
let s:I3 = [ '#c5c5c5' , '#500000' , 117 , 24 ]
let s:I1 = [ '#ffffff' , '#e80000','','']
let s:I2 = [ '#c5c5c5' , '#901010','','']
let s:I3 = [ '#c5c5c5' , '#500000','','']
" Visual mode
let s:V1 = [ '#005f5f' , '#ffffff' , 23 , 231 ]
let s:V2 = [ '#5fafd7' , '#0087af' , 74 , 31 ]
let s:V3 = [ '#87d7ff' , '#005f87' , 117 , 24 ]
let s:V1 = [ '#2a5d8e' , '#ffffff','','']
let s:V2 = [ '#87e7ff' , '#4077df','','']
let s:V3 = [ '#87e7ff' , '#2a5d8e','','']
" Replace mode
let s:R1 = [ '#8e00da' , '#ffffff' , 23 , 231 ]
let s:R2 = [ '#8e00da' , '#ce99ff' , 74 , 31 ]
let s:R3 = [ '#ce99ff' , '#8e00da' , 117 , 24 ]
let s:R1 = [ '#6e00ba' , '#ffffff','','']
let s:R2 = [ '#6e00ba' , '#d358ff','','']
let s:R3 = [ '#ce99ff' , '#6e00ba','','']
let g:airline#themes#kalisi#palette = {}
let g:airline#themes#kalisi#palette.accents = {'red': ['#FF0000', '', 88, '']}
function! airline#themes#kalisi#refresh()
let s:StatusLine = airline#themes#get_highlight('StatusLine')
let s:StatusLineNC = airline#themes#get_highlight('StatusLineNC')
" Normal mode
let s:N1 = [ '#005f00' , '#afd700' , 22 , 148 ]
let s:N2 = [ '#afd700' , '#005f00' , 247 , 236 ]
let s:N3 = airline#themes#get_highlight('StatusLine')
let s:N1 = [ '#005f00' , '#afd700','','']
let s:N2 = [ '#afd700' , '#005f00','','']
let s:N3 = s:StatusLine
" Tabline Plugin
let g:airline#themes#kalisi#palette.tabline = {
\ 'airline_tab': ['#A6DB29', '#005f00', 231, 29, ''],
\ 'airline_tabsel': ['#404042', '#A6DB29', 231, 36, ''],
\ 'airline_tabtype': ['#afd700', '#005f00', 231, 36, ''],
\ 'airline_tabfill': ['#ffffff', '#000000', 231, 23, ''],
\ 'airline_tabhid': ['#c5c5c5', '#404042', 231, 88, ''],
\ 'airline_tabmod': ['#ffffff', '#F1266F', 231, 88, ''],
\ 'airline_tab': ['#A6DB29', '#005f00','',''],
\ 'airline_tabsel': ['#404042', '#A6DB29','',''],
\ 'airline_tabtype': ['#afd700', '#204d20','',''],
\ 'airline_tabfill': s:StatusLine,
\ 'airline_tabhid': ['#c5c5c5', '#404042','',''],
\ 'airline_tabmod': ['#ffffff', '#F1266F','','']
\ }
" \ 'airline_tabfill': ['#ffffff', '#2b2b2b','',''],
let g:airline#themes#kalisi#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
let g:airline#themes#kalisi#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
let g:airline#themes#kalisi#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
@ -55,3 +64,11 @@ endfunction
call airline#themes#kalisi#refresh()
if !get(g:, 'loaded_ctrlp', 0)
finish
endif
let g:airline#themes#kalisi#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(
\ s:StatusLineNC,
\ s:StatusLine,
\ [ '#005f00' , '#afd700' , '','', ''] )

View file

@ -404,6 +404,25 @@ eclim <https://eclim.org>
* enable/disable displaying tab type (far right)
let g:airline#extensions#tabline#show_tab_type = 1
* enable/disable displaying index of the buffer.
When enabled, numbers will be displayed in the tabline and mappings will be
exposed to allow you to select a buffer directly. Up to 9 mappings will be
exposed.
let g:airline#extensions#tabline#buffer_idx_mode = 1
nmap <leader>1 <Plug>AirlineSelectTab1
nmap <leader>2 <Plug>AirlineSelectTab2
nmap <leader>3 <Plug>AirlineSelectTab3
nmap <leader>4 <Plug>AirlineSelectTab4
nmap <leader>5 <Plug>AirlineSelectTab5
nmap <leader>6 <Plug>AirlineSelectTab6
nmap <leader>7 <Plug>AirlineSelectTab7
nmap <leader>8 <Plug>AirlineSelectTab8
nmap <leader>9 <Plug>AirlineSelectTab9
Note: Mappings will be ignored within a NERDTree buffer.
* defines the name of a formatter for how buffer names are displayed. >
let g:airline#extensions#tabline#formatter = 'default'
@ -453,6 +472,9 @@ eclim <https://eclim.org>
let g:airline#extensions#tabline#right_sep = ''
let g:airline#extensions#tabline#right_alt_sep = ''
* configure whether close button should be shown
let g:airline#extensions#tabline#show_close_button = 1
* configure symbol used to represent close button
let g:airline#extensions#tabline#close_symbol = 'X'
@ -507,6 +529,15 @@ vim-capslock <https://github.com/tpope/vim-capslock>
* enable/disable vim-capslock integration >
let g:airline#extensions#capslock#enabled = 1
------------------------------------- *airline-windowswap*
vim-windowswap <https://github.com/wesQ3/vim-windowswap>
* enable/disable vim-windowswap integration >
let g:airline#extensions#windowswap#enabled = 1
* set marked window indicator string >
let g:airline#extensions#windowswap#indicator_text = 'WS'
<
==============================================================================
ADVANCED CUSTOMIZATION *airline-advanced-customization*

View file

@ -1195,7 +1195,7 @@ endif
call s:command("-bang -nargs=? -complete=customlist,s:EditComplete Ggrep :execute s:Grep('grep',<bang>0,<q-args>)")
call s:command("-bang -nargs=? -complete=customlist,s:EditComplete Glgrep :execute s:Grep('lgrep',<bang>0,<q-args>)")
call s:command("-bar -bang -nargs=* -range=0 -complete=customlist,s:EditComplete Glog :call s:Log('grep<bang>',<line1>,<count>,<f-args>)")
call s:command("-bar -bang -nargs=* -complete=customlist,s:EditComplete Gllog :call s:Log('lgrep<bang>',<line1>,<count>,<f-args>)")
call s:command("-bar -bang -nargs=* -range=0 -complete=customlist,s:EditComplete Gllog :call s:Log('lgrep<bang>',<line1>,<count>,<f-args>)")
function! s:Grep(cmd,bang,arg) abort
let grepprg = &grepprg

View file

@ -0,0 +1,8 @@
## Vim plugins have moved
The vim plugins have been removed from the Go repository along with all other
editor plugins. Please visit [The Go Wiki][1] for a current list of plugins. I
have personally moved over to the [vim-go][2] suite of plugins.
[1]: https://code.google.com/p/go-wiki/wiki/IDEsAndTextEditorPlugins
[2]: https://github.com/fatih/vim-go

View file

@ -1,103 +0,0 @@
" Copyright 2011 The Go Authors. All rights reserved.
" Use of this source code is governed by a BSD-style
" license that can be found in the LICENSE file.
"
" This file provides a utility function that performs auto-completion of
" package names, for use by other commands.
let s:goos = $GOOS
let s:goarch = $GOARCH
if len(s:goos) == 0
if exists('g:golang_goos')
let s:goos = g:golang_goos
elseif has('win32') || has('win64')
let s:goos = 'windows'
elseif has('macunix')
let s:goos = 'darwin'
else
let s:goos = '*'
endif
endif
if len(s:goarch) == 0
if exists('g:golang_goarch')
let s:goarch = g:golang_goarch
else
let s:goarch = '*'
endif
endif
function! go#complete#PackageMembers(package, member)
silent! let content = system('godoc ' . a:package)
if v:shell_error || !len(content)
return []
endif
let lines = filter(split(content, "\n"),"v:val !~ '^\\s\\+$'")
try
let mx1 = '^\s\+\(\S+\)\s\+=\s\+.*'
let mx2 = '^\%(const\|var\|type\|func\) \([A-Z][^ (]\+\).*'
let candidates =
\ map(filter(copy(lines), 'v:val =~ mx1'), 'substitute(v:val, mx1, "\\1", "")')
\ + map(filter(copy(lines), 'v:val =~ mx2'), 'substitute(v:val, mx2, "\\1", "")')
return filter(candidates, '!stridx(v:val, a:member)')
catch
return []
endtry
endfunction
function! go#complete#Package(ArgLead, CmdLine, CursorPos)
let dirs = []
let words = split(a:CmdLine, '\s\+', 1)
if len(words) > 2
" Complete package members
return go#complete#PackageMembers(words[1], words[2])
endif
if executable('go')
let goroot = substitute(system('go env GOROOT'), '\n', '', 'g')
if v:shell_error
echomsg '''go env GOROOT'' failed'
endif
else
let goroot = $GOROOT
endif
if len(goroot) != 0 && isdirectory(goroot)
let dirs += [goroot]
endif
let pathsep = ':'
if s:goos == 'windows'
let pathsep = ';'
endif
let workspaces = split($GOPATH, pathsep)
if workspaces != []
let dirs += workspaces
endif
if len(dirs) == 0
" should not happen
return []
endif
let ret = {}
for dir in dirs
" this may expand to multiple lines
let root = split(expand(dir . '/pkg/' . s:goos . '_' . s:goarch), "\n")
call add(root, expand(dir . '/src'))
for r in root
for i in split(globpath(r, a:ArgLead.'*'), "\n")
if isdirectory(i)
let i .= '/'
elseif i !~ '\.a$'
continue
endif
let i = substitute(substitute(i[len(r)+1:], '[\\]', '/', 'g'), '\.a$', '', 'g')
let ret[i] = i
endfor
endfor
endfor
return sort(keys(ret))
endfunction

View file

@ -1,30 +0,0 @@
" Copyright 2013 The Go Authors. All rights reserved.
" Use of this source code is governed by a BSD-style
" license that can be found in the LICENSE file.
"
" compiler/go.vim: Vim compiler file for Go.
if exists("current_compiler")
finish
endif
let current_compiler = "go"
if exists(":CompilerSet") != 2
command -nargs=* CompilerSet setlocal <args>
endif
let s:save_cpo = &cpo
set cpo-=C
CompilerSet makeprg=go\ build
CompilerSet errorformat=
\%-G#\ %.%#,
\%A%f:%l:%c:\ %m,
\%A%f:%l:\ %m,
\%C%*\\s%m,
\%-G%.%#
let &cpo = s:save_cpo
unlet s:save_cpo
" vim:ts=4:sw=4:et

View file

@ -1,23 +0,0 @@
" We take care to preserve the user's fileencodings and fileformats,
" because those settings are global (not buffer local), yet we want
" to override them for loading Go files, which are defined to be UTF-8.
let s:current_fileformats = ''
let s:current_fileencodings = ''
" define fileencodings to open as utf-8 encoding even if it's ascii.
function! s:gofiletype_pre()
let s:current_fileformats = &g:fileformats
let s:current_fileencodings = &g:fileencodings
set fileencodings=utf-8 fileformats=unix
setlocal filetype=go
endfunction
" restore fileencodings as others
function! s:gofiletype_post()
let &g:fileformats = s:current_fileformats
let &g:fileencodings = s:current_fileencodings
endfunction
au BufNewFile *.go setlocal filetype=go fileencoding=utf-8 fileformat=unix
au BufRead *.go call s:gofiletype_pre()
au BufReadPost *.go call s:gofiletype_post()

View file

@ -1,19 +0,0 @@
" Copyright 2013 The Go Authors. All rights reserved.
" Use of this source code is governed by a BSD-style
" license that can be found in the LICENSE file.
"
" go.vim: Vim filetype plugin for Go.
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
setlocal formatoptions-=t
setlocal comments=s1:/*,mb:*,ex:*/,://
setlocal commentstring=//\ %s
let b:undo_ftplugin = "setl fo< com< cms<"
" vim:ts=4:sw=4:et

View file

@ -1,69 +0,0 @@
" Copyright 2011 The Go Authors. All rights reserved.
" Use of this source code is governed by a BSD-style
" license that can be found in the LICENSE file.
"
" fmt.vim: Vim command to format Go files with gofmt.
"
" This filetype plugin add a new commands for go buffers:
"
" :Fmt
"
" Filter the current Go buffer through gofmt.
" It tries to preserve cursor position and avoids
" replacing the buffer with stderr output.
"
" Options:
"
" g:go_fmt_commands [default=1]
"
" Flag to indicate whether to enable the commands listed above.
"
" g:gofmt_command [default="gofmt"]
"
" Flag naming the gofmt executable to use.
"
if exists("b:did_ftplugin_go_fmt")
finish
endif
if !exists("g:go_fmt_commands")
let g:go_fmt_commands = 1
endif
if !exists("g:gofmt_command")
let g:gofmt_command = "gofmt"
endif
if g:go_fmt_commands
command! -buffer Fmt call s:GoFormat()
endif
function! s:GoFormat()
let view = winsaveview()
silent execute "%!" . g:gofmt_command
if v:shell_error
let errors = []
for line in getline(1, line('$'))
let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)')
if !empty(tokens)
call add(errors, {"filename": @%,
\"lnum": tokens[2],
\"col": tokens[3],
\"text": tokens[4]})
endif
endfor
if empty(errors)
% | " Couldn't detect gofmt error format, output errors
endif
undo
if !empty(errors)
call setqflist(errors, 'r')
endif
echohl Error | echomsg "Gofmt returned error" | echohl None
endif
call winrestview(view)
endfunction
let b:did_ftplugin_go_fmt = 1
" vim:ts=4:sw=4:et

View file

@ -1,250 +0,0 @@
" Copyright 2011 The Go Authors. All rights reserved.
" Use of this source code is governed by a BSD-style
" license that can be found in the LICENSE file.
"
" import.vim: Vim commands to import/drop Go packages.
"
" This filetype plugin adds three new commands for go buffers:
"
" :Import {path}
"
" Import ensures that the provided package {path} is imported
" in the current Go buffer, using proper style and ordering.
" If {path} is already being imported, an error will be
" displayed and the buffer will be untouched.
"
" :ImportAs {localname} {path}
"
" Same as Import, but uses a custom local name for the package.
"
" :Drop {path}
"
" Remove the import line for the provided package {path}, if
" present in the current Go buffer. If {path} is not being
" imported, an error will be displayed and the buffer will be
" untouched.
"
" If you would like to add shortcuts, you can do so by doing the following:
"
" Import fmt
" au Filetype go nnoremap <buffer> <LocalLeader>f :Import fmt<CR>
"
" Drop fmt
" au Filetype go nnoremap <buffer> <LocalLeader>F :Drop fmt<CR>
"
" Import the word under your cursor
" au Filetype go nnoremap <buffer> <LocalLeader>k
" \ :exe 'Import ' . expand('<cword>')<CR>
"
" The backslash '\' is the default maplocalleader, so it is possible that
" your vim is set to use a different character (:help maplocalleader).
"
" Options:
"
" g:go_import_commands [default=1]
"
" Flag to indicate whether to enable the commands listed above.
"
if exists("b:did_ftplugin_go_import")
finish
endif
if !exists("g:go_import_commands")
let g:go_import_commands = 1
endif
if g:go_import_commands
command! -buffer -nargs=? -complete=customlist,go#complete#Package Drop call s:SwitchImport(0, '', <f-args>)
command! -buffer -nargs=1 -complete=customlist,go#complete#Package Import call s:SwitchImport(1, '', <f-args>)
command! -buffer -nargs=* -complete=customlist,go#complete#Package ImportAs call s:SwitchImport(1, <f-args>)
endif
function! s:SwitchImport(enabled, localname, path)
let view = winsaveview()
let path = a:path
" Quotes are not necessary, so remove them if provided.
if path[0] == '"'
let path = strpart(path, 1)
endif
if path[len(path)-1] == '"'
let path = strpart(path, 0, len(path) - 1)
endif
if path == ''
call s:Error('Import path not provided')
return
endif
" Extract any site prefix (e.g. github.com/).
" If other imports with the same prefix are grouped separately,
" we will add this new import with them.
" Only up to and including the first slash is used.
let siteprefix = matchstr(path, "^[^/]*/")
let qpath = '"' . path . '"'
if a:localname != ''
let qlocalpath = a:localname . ' ' . qpath
else
let qlocalpath = qpath
endif
let indentstr = 0
let packageline = -1 " Position of package name statement
let appendline = -1 " Position to introduce new import
let deleteline = -1 " Position of line with existing import
let linesdelta = 0 " Lines added/removed
" Find proper place to add/remove import.
let line = 0
while line <= line('$')
let linestr = getline(line)
if linestr =~# '^package\s'
let packageline = line
let appendline = line
elseif linestr =~# '^import\s\+('
let appendstr = qlocalpath
let indentstr = 1
let appendline = line
let firstblank = -1
let lastprefix = ""
while line <= line("$")
let line = line + 1
let linestr = getline(line)
let m = matchlist(getline(line), '^\()\|\(\s\+\)\(\S*\s*\)"\(.\+\)"\)')
if empty(m)
if siteprefix == "" && a:enabled
" must be in the first group
break
endif
" record this position, but keep looking
if firstblank < 0
let firstblank = line
endif
continue
endif
if m[1] == ')'
" if there's no match, add it to the first group
if appendline < 0 && firstblank >= 0
let appendline = firstblank
endif
break
endif
let lastprefix = matchstr(m[4], "^[^/]*/")
if a:localname != '' && m[3] != ''
let qlocalpath = printf('%-' . (len(m[3])-1) . 's %s', a:localname, qpath)
endif
let appendstr = m[2] . qlocalpath
let indentstr = 0
if m[4] == path
let appendline = -1
let deleteline = line
break
elseif m[4] < path
" don't set candidate position if we have a site prefix,
" we've passed a blank line, and this doesn't share the same
" site prefix.
if siteprefix == "" || firstblank < 0 || match(m[4], "^" . siteprefix) >= 0
let appendline = line
endif
elseif siteprefix != "" && match(m[4], "^" . siteprefix) >= 0
" first entry of site group
let appendline = line - 1
break
endif
endwhile
break
elseif linestr =~# '^import '
if appendline == packageline
let appendstr = 'import ' . qlocalpath
let appendline = line - 1
endif
let m = matchlist(linestr, '^import\(\s\+\)\(\S*\s*\)"\(.\+\)"')
if !empty(m)
if m[3] == path
let appendline = -1
let deleteline = line
break
endif
if m[3] < path
let appendline = line
endif
if a:localname != '' && m[2] != ''
let qlocalpath = printf("%s %" . len(m[2])-1 . "s", a:localname, qpath)
endif
let appendstr = 'import' . m[1] . qlocalpath
endif
elseif linestr =~# '^\(var\|const\|type\|func\)\>'
break
endif
let line = line + 1
endwhile
" Append or remove the package import, as requested.
if a:enabled
if deleteline != -1
call s:Error(qpath . ' already being imported')
elseif appendline == -1
call s:Error('No package line found')
else
if appendline == packageline
call append(appendline + 0, '')
call append(appendline + 1, 'import (')
call append(appendline + 2, ')')
let appendline += 2
let linesdelta += 3
let appendstr = qlocalpath
let indentstr = 1
endif
call append(appendline, appendstr)
execute appendline + 1
if indentstr
execute 'normal >>'
endif
let linesdelta += 1
endif
else
if deleteline == -1
call s:Error(qpath . ' not being imported')
else
execute deleteline . 'd'
let linesdelta -= 1
if getline(deleteline-1) =~# '^import\s\+(' && getline(deleteline) =~# '^)'
" Delete empty import block
let deleteline -= 1
execute deleteline . "d"
execute deleteline . "d"
let linesdelta -= 2
endif
if getline(deleteline) == '' && getline(deleteline - 1) == ''
" Delete spacing for removed line too.
execute deleteline . "d"
let linesdelta -= 1
endif
endif
endif
" Adjust view for any changes.
let view.lnum += linesdelta
let view.topline += linesdelta
if view.topline < 0
let view.topline = 0
endif
" Put buffer back where it was.
call winrestview(view)
endfunction
function! s:Error(s)
echohl Error | echo a:s | echohl None
endfunction
let b:did_ftplugin_go_import = 1
" vim:ts=4:sw=4:et

View file

@ -1,78 +0,0 @@
#!/bin/bash -e
#
# Copyright 2012 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
#
# Tests for import.vim.
cd $(dirname $0)
cat > base.go <<EOF
package test
import (
"bytes"
"io"
"net"
"mycorp/foo"
)
EOF
fail=0
# usage: test_one command pattern
# Pattern is a PCRE expression that will match across lines.
test_one() {
echo 2>&1 -n "$1: "
vim -e -s -u /dev/null -U /dev/null --noplugin -c "source import.vim" \
-c "$1" -c 'wq! test.go' base.go
# ensure blank lines are treated correctly
if ! gofmt test.go | cmp test.go -; then
echo 2>&1 "gofmt conflict"
gofmt test.go | diff -u test.go - | sed "s/^/ /" 2>&1
fail=1
return
fi
if ! [[ $(cat test.go) =~ $2 ]]; then
echo 2>&1 "$2 did not match"
cat test.go | sed "s/^/ /" 2>&1
fail=1
return
fi
echo 2>&1 "ok"
}
# Tests for Import
test_one "Import baz" '"baz".*"bytes"'
test_one "Import io/ioutil" '"io".*"io/ioutil".*"net"'
test_one "Import myc" '"io".*"myc".*"net"' # prefix of a site prefix
test_one "Import nat" '"io".*"nat".*"net"'
test_one "Import net/http" '"net".*"net/http".*"mycorp/foo"'
test_one "Import zoo" '"net".*"zoo".*"mycorp/foo"'
test_one "Import mycorp/bar" '"net".*"mycorp/bar".*"mycorp/foo"'
test_one "Import mycorp/goo" '"net".*"mycorp/foo".*"mycorp/goo"'
# Tests for Drop
cat > base.go <<EOF
package test
import (
"foo"
"something"
"zoo"
)
EOF
test_one "Drop something" '\([^"]*"foo"[^"]*"zoo"[^"]*\)'
rm -f base.go test.go
if [ $fail -gt 0 ]; then
echo 2>&1 "FAIL"
exit 1
fi
echo 2>&1 "PASS"

View file

@ -1,77 +0,0 @@
" Copyright 2011 The Go Authors. All rights reserved.
" Use of this source code is governed by a BSD-style
" license that can be found in the LICENSE file.
"
" indent/go.vim: Vim indent file for Go.
"
" TODO:
" - function invocations split across lines
" - general line splits (line ends in an operator)
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
" C indentation is too far off useful, mainly due to Go's := operator.
" Let's just define our own.
setlocal nolisp
setlocal autoindent
setlocal indentexpr=GoIndent(v:lnum)
setlocal indentkeys+=<:>,0=},0=)
if exists("*GoIndent")
finish
endif
" The shiftwidth() function is relatively new.
" Don't require it to exist.
if exists('*shiftwidth')
func s:sw()
return shiftwidth()
endfunc
else
func s:sw()
return &shiftwidth
endfunc
endif
function! GoIndent(lnum)
let prevlnum = prevnonblank(a:lnum-1)
if prevlnum == 0
" top of file
return 0
endif
" grab the previous and current line, stripping comments.
let prevl = substitute(getline(prevlnum), '//.*$', '', '')
let thisl = substitute(getline(a:lnum), '//.*$', '', '')
let previ = indent(prevlnum)
let ind = previ
if prevl =~ '[({]\s*$'
" previous line opened a block
let ind += s:sw()
endif
if prevl =~# '^\s*\(case .*\|default\):$'
" previous line is part of a switch statement
let ind += s:sw()
endif
" TODO: handle if the previous line is a label.
if thisl =~ '^\s*[)}]'
" this line closed a block
let ind -= s:sw()
endif
" Colons are tricky.
" We want to outdent if it's part of a switch ("case foo:" or "default:").
" We ignore trying to deal with jump labels because (a) they're rare, and
" (b) they're hard to disambiguate from a composite literal key.
if thisl =~# '^\s*\(case .*\|default\):$'
let ind -= s:sw()
endif
return ind
endfunction

View file

@ -1,6 +0,0 @@
This is a mirror of the misc/vim portion of the official Go repository. It is
automatically updated.
Any contributions or issues should be made to the official repository.
http://golang.org/doc/contribute.html

View file

@ -1,130 +0,0 @@
" Copyright 2011 The Go Authors. All rights reserved.
" Use of this source code is governed by a BSD-style
" license that can be found in the LICENSE file.
"
" godoc.vim: Vim command to see godoc.
"
"
" Commands:
"
" :Godoc
"
" Open the relevant Godoc for either the word[s] passed to the command or
" the, by default, the word under the cursor.
"
" Options:
"
" g:go_godoc_commands [default=1]
"
" Flag to indicate whether to enable the commands listed above.
if exists("g:loaded_godoc")
finish
endif
let g:loaded_godoc = 1
let s:buf_nr = -1
let s:last_word = ''
if !exists('g:go_godoc_commands')
let g:go_godoc_commands = 1
endif
if g:go_godoc_commands
command! -nargs=* -range -complete=customlist,go#complete#Package Godoc :call s:Godoc(<f-args>)
endif
nnoremap <silent> <Plug>(godoc-keyword) :<C-u>call <SID>Godoc('')<CR>
function! s:GodocView()
if !bufexists(s:buf_nr)
leftabove new
file `="[Godoc]"`
let s:buf_nr = bufnr('%')
elseif bufwinnr(s:buf_nr) == -1
leftabove split
execute s:buf_nr . 'buffer'
delete _
elseif bufwinnr(s:buf_nr) != bufwinnr('%')
execute bufwinnr(s:buf_nr) . 'wincmd w'
endif
setlocal filetype=godoc
setlocal bufhidden=delete
setlocal buftype=nofile
setlocal noswapfile
setlocal nobuflisted
setlocal modifiable
setlocal nocursorline
setlocal nocursorcolumn
setlocal iskeyword+=:
setlocal iskeyword-=-
nnoremap <buffer> <silent> K :Godoc<cr>
au BufHidden <buffer> call let <SID>buf_nr = -1
endfunction
function! s:GodocWord(word)
if !executable('godoc')
echohl WarningMsg
echo "godoc command not found."
echo " install with: go get code.google.com/p/go.tools/cmd/godoc"
echohl None
return 0
endif
let word = a:word
silent! let content = system('godoc ' . word)
if v:shell_error || !len(content)
if len(s:last_word)
silent! let content = system('godoc ' . s:last_word.'/'.word)
if v:shell_error || !len(content)
echo 'No documentation found for "' . word . '".'
return 0
endif
let word = s:last_word.'/'.word
else
echo 'No documentation found for "' . word . '".'
return 0
endif
endif
let s:last_word = word
silent! call s:GodocView()
setlocal modifiable
silent! %d _
silent! put! =content
silent! normal gg
setlocal nomodifiable
setfiletype godoc
return 1
endfunction
function! s:Godoc(...)
if !len(a:000)
let oldiskeyword = &iskeyword
setlocal iskeyword+=.
let word = expand('<cword>')
let &iskeyword = oldiskeyword
let word = substitute(word, '[^a-zA-Z0-9\\/._~-]', '', 'g')
let words = split(word, '\.\ze[^./]\+$')
else
let words = a:000
endif
if !len(words)
return
endif
if s:GodocWord(words[0])
if len(words) > 1
if search('^\%(const\|var\|type\|\s\+\) ' . words[1] . '\s\+=\s')
return
endif
if search('^func ' . words[1] . '(')
silent! normal zt
return
endif
echo 'No documentation found for "' . words[1] . '".'
endif
endif
endfunction
" vim:ts=4:sw=4:et

View file

@ -1,103 +0,0 @@
Vim plugins for Go (http://golang.org)
======================================
To use all the Vim plugins, add these lines to your $HOME/.vimrc.
" Some Linux distributions set filetype in /etc/vimrc.
" Clear filetype flags before changing runtimepath to force Vim to reload them.
if exists("g:did_load_filetypes")
filetype off
filetype plugin indent off
endif
set runtimepath+=$GOROOT/misc/vim " replace $GOROOT with the output of: go env GOROOT
filetype plugin indent on
syntax on
If you want to select fewer plugins, use the instructions in the rest of
this file.
A popular configuration is to gofmt Go source files when they are saved.
To do that, add this line to the end of your $HOME/.vimrc.
autocmd FileType go autocmd BufWritePre <buffer> Fmt
Vim syntax highlighting
-----------------------
To install automatic syntax highlighting for GO programs:
1. Copy or link the filetype detection script to the ftdetect directory
underneath your vim runtime directory (normally $HOME/.vim/ftdetect)
2. Copy or link syntax/go.vim to the syntax directory underneath your vim
runtime directory (normally $HOME/.vim/syntax). Linking this file rather
than just copying it will ensure any changes are automatically reflected
in your syntax highlighting.
3. Add the following line to your .vimrc file (normally $HOME/.vimrc):
syntax on
In a typical unix environment you might accomplish this using the following
commands:
mkdir -p $HOME/.vim/ftdetect
mkdir -p $HOME/.vim/syntax
mkdir -p $HOME/.vim/autoload/go
ln -s $GOROOT/misc/vim/ftdetect/gofiletype.vim $HOME/.vim/ftdetect/
ln -s $GOROOT/misc/vim/syntax/go.vim $HOME/.vim/syntax
ln -s $GOROOT/misc/vim/autoload/go/complete.vim $HOME/.vim/autoload/go
echo "syntax on" >> $HOME/.vimrc
Vim filetype plugins
--------------------
To install one of the available filetype plugins:
1. Same as 1 above.
2. Copy or link ftplugin/go.vim to the ftplugin directory underneath your vim
runtime directory (normally $HOME/.vim/ftplugin). Copy or link one or more
additional plugins from ftplugin/go/*.vim to the Go-specific subdirectory
in the same place ($HOME/.vim/ftplugin/go/*.vim).
3. Add the following line to your .vimrc file (normally $HOME/.vimrc):
filetype plugin on
Vim indentation plugin
----------------------
To install automatic indentation:
1. Same as 1 above.
2. Copy or link indent/go.vim to the indent directory underneath your vim
runtime directory (normally $HOME/.vim/indent).
3. Add the following line to your .vimrc file (normally $HOME/.vimrc):
filetype indent on
Vim compiler plugin
-------------------
To install the compiler plugin:
1. Same as 1 above.
2. Copy or link compiler/go.vim to the compiler directory underneath your vim
runtime directory (normally $HOME/.vim/compiler).
3. Activate the compiler plugin with ":compiler go". To always enable the
compiler plugin in Go source files add an autocommand to your .vimrc file
(normally $HOME/.vimrc):
autocmd FileType go compiler go
Godoc plugin
------------
To install godoc plugin:
1. Same as 1 above.
2. Copy or link plugin/godoc.vim to $HOME/.vim/plugin/godoc,
syntax/godoc.vim to $HOME/.vim/syntax/godoc.vim,
and autoload/go/complete.vim to $HOME/.vim/autoload/go/complete.vim.

View file

@ -1,207 +0,0 @@
" Copyright 2009 The Go Authors. All rights reserved.
" Use of this source code is governed by a BSD-style
" license that can be found in the LICENSE file.
"
" go.vim: Vim syntax file for Go.
"
" Options:
" There are some options for customizing the highlighting; the recommended
" settings are the default values, but you can write:
" let OPTION_NAME = 0
" in your ~/.vimrc file to disable particular options. You can also write:
" let OPTION_NAME = 1
" to enable particular options. At present, all options default to on.
"
" - go_highlight_array_whitespace_error
" Highlights white space after "[]".
" - go_highlight_chan_whitespace_error
" Highlights white space around the communications operator that don't follow
" the standard style.
" - go_highlight_extra_types
" Highlights commonly used library types (io.Reader, etc.).
" - go_highlight_space_tab_error
" Highlights instances of tabs following spaces.
" - go_highlight_trailing_whitespace_error
" Highlights trailing white space.
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
finish
endif
if !exists("go_highlight_array_whitespace_error")
let go_highlight_array_whitespace_error = 1
endif
if !exists("go_highlight_chan_whitespace_error")
let go_highlight_chan_whitespace_error = 1
endif
if !exists("go_highlight_extra_types")
let go_highlight_extra_types = 1
endif
if !exists("go_highlight_space_tab_error")
let go_highlight_space_tab_error = 1
endif
if !exists("go_highlight_trailing_whitespace_error")
let go_highlight_trailing_whitespace_error = 1
endif
syn case match
syn keyword goDirective package import
syn keyword goDeclaration var const type
syn keyword goDeclType struct interface
hi def link goDirective Statement
hi def link goDeclaration Keyword
hi def link goDeclType Keyword
" Keywords within functions
syn keyword goStatement defer go goto return break continue fallthrough
syn keyword goConditional if else switch select
syn keyword goLabel case default
syn keyword goRepeat for range
hi def link goStatement Statement
hi def link goConditional Conditional
hi def link goLabel Label
hi def link goRepeat Repeat
" Predefined types
syn keyword goType chan map bool string error
syn keyword goSignedInts int int8 int16 int32 int64 rune
syn keyword goUnsignedInts byte uint uint8 uint16 uint32 uint64 uintptr
syn keyword goFloats float32 float64
syn keyword goComplexes complex64 complex128
hi def link goType Type
hi def link goSignedInts Type
hi def link goUnsignedInts Type
hi def link goFloats Type
hi def link goComplexes Type
" Treat func specially: it's a declaration at the start of a line, but a type
" elsewhere. Order matters here.
syn match goType /\<func\>/
syn match goDeclaration /^func\>/
" Predefined functions and values
syn keyword goBuiltins append cap close complex copy delete imag len
syn keyword goBuiltins make new panic print println real recover
syn keyword goConstants iota true false nil
hi def link goBuiltins Keyword
hi def link goConstants Keyword
" Comments; their contents
syn keyword goTodo contained TODO FIXME XXX BUG
syn cluster goCommentGroup contains=goTodo
syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell
syn region goComment start="//" end="$" contains=@goCommentGroup,@Spell
hi def link goComment Comment
hi def link goTodo Todo
" Go escapes
syn match goEscapeOctal display contained "\\[0-7]\{3}"
syn match goEscapeC display contained +\\[abfnrtv\\'"]+
syn match goEscapeX display contained "\\x\x\{2}"
syn match goEscapeU display contained "\\u\x\{4}"
syn match goEscapeBigU display contained "\\U\x\{8}"
syn match goEscapeError display contained +\\[^0-7xuUabfnrtv\\'"]+
hi def link goEscapeOctal goSpecialString
hi def link goEscapeC goSpecialString
hi def link goEscapeX goSpecialString
hi def link goEscapeU goSpecialString
hi def link goEscapeBigU goSpecialString
hi def link goSpecialString Special
hi def link goEscapeError Error
" Strings and their contents
syn cluster goStringGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU,goEscapeError
syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup
syn region goRawString start=+`+ end=+`+
hi def link goString String
hi def link goRawString String
" Characters; their contents
syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU
syn region goCharacter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@goCharacterGroup
hi def link goCharacter Character
" Regions
syn region goBlock start="{" end="}" transparent fold
syn region goParen start='(' end=')' transparent
" Integers
syn match goDecimalInt "\<\d\+\([Ee]\d\+\)\?\>"
syn match goHexadecimalInt "\<0x\x\+\>"
syn match goOctalInt "\<0\o\+\>"
syn match goOctalError "\<0\o*[89]\d*\>"
hi def link goDecimalInt Integer
hi def link goHexadecimalInt Integer
hi def link goOctalInt Integer
hi def link Integer Number
" Floating point
syn match goFloat "\<\d\+\.\d*\([Ee][-+]\d\+\)\?\>"
syn match goFloat "\<\.\d\+\([Ee][-+]\d\+\)\?\>"
syn match goFloat "\<\d\+[Ee][-+]\d\+\>"
hi def link goFloat Float
" Imaginary literals
syn match goImaginary "\<\d\+i\>"
syn match goImaginary "\<\d\+\.\d*\([Ee][-+]\d\+\)\?i\>"
syn match goImaginary "\<\.\d\+\([Ee][-+]\d\+\)\?i\>"
syn match goImaginary "\<\d\+[Ee][-+]\d\+i\>"
hi def link goImaginary Number
" Spaces after "[]"
if go_highlight_array_whitespace_error != 0
syn match goSpaceError display "\(\[\]\)\@<=\s\+"
endif
" Spacing errors around the 'chan' keyword
if go_highlight_chan_whitespace_error != 0
" receive-only annotation on chan type
syn match goSpaceError display "\(<-\)\@<=\s\+\(chan\>\)\@="
" send-only annotation on chan type
syn match goSpaceError display "\(\<chan\)\@<=\s\+\(<-\)\@="
" value-ignoring receives in a few contexts
syn match goSpaceError display "\(\(^\|[={(,;]\)\s*<-\)\@<=\s\+"
endif
" Extra types commonly seen
if go_highlight_extra_types != 0
syn match goExtraType /\<bytes\.\(Buffer\)\>/
syn match goExtraType /\<io\.\(Reader\|Writer\|ReadWriter\|ReadWriteCloser\)\>/
syn match goExtraType /\<reflect\.\(Kind\|Type\|Value\)\>/
syn match goExtraType /\<unsafe\.Pointer\>/
endif
" Space-tab error
if go_highlight_space_tab_error != 0
syn match goSpaceError display " \+\t"me=e-1
endif
" Trailing white space error
if go_highlight_trailing_whitespace_error != 0
syn match goSpaceError display excludenl "\s\+$"
endif
hi def link goExtraType Type
hi def link goSpaceError Error
" Search backwards for a global declaration to start processing the syntax.
"syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/
" There's a bug in the implementation of grouphere. For now, use the
" following as a more expensive/less precise workaround.
syn sync minlines=500
let b:current_syntax = "go"

View file

@ -1,20 +0,0 @@
" Copyright 2011 The Go Authors. All rights reserved.
" Use of this source code is governed by a BSD-style
" license that can be found in the LICENSE file.
if exists("b:current_syntax")
finish
endif
syn case match
syn match godocTitle "^\([A-Z][A-Z ]*\)$"
command -nargs=+ HiLink hi def link <args>
HiLink godocTitle Title
delcommand HiLink
let b:current_syntax = "godoc"
" vim:ts=4 sts=2 sw=2:

View file

@ -0,0 +1,22 @@
if !exists("g:less_html_style_tags")
let g:less_html_style_tags = 1
endif
if !g:less_html_style_tags
finish
endif
" Unset (but preserve) so that less will run.
let s:pre_less_cur_syn = b:current_syntax
unlet b:current_syntax
" Inspired by code from github.com/kchmck/vim-coffee-script
" and the html syntax file included with vim 7.4.
syn include @htmlLess syntax/less.vim
" We have to explicitly add to htmlHead (containedin) as that region specifies 'contains'.
syn region lessStyle start=+<style [^>]*type *=[^>]*text/less[^>]*>+ keepend end=+</style>+ contains=@htmlLess,htmlTag,htmlEndTag,htmlCssStyleComment,@htmlPreproc containedin=htmlHead
" Reset since 'less' isn't really the current_syntax.
let b:current_syntax = s:pre_less_cur_syn

View file

@ -1,4 +1,4 @@
Snipmate & UltiSnip Snippets
snipMate & UltiSnip Snippets
============================
This repository contains snippets files for various programming languages.
@ -9,7 +9,7 @@ other improvements already.
Contents
--------
- `snippets/*`: snippets using snipmate format
- `snippets/*`: snippets using snipMate format
- `UltiSnips/*`: snippets using UltiSnips format
Snippet engines supporting vim-snippets
@ -28,7 +28,7 @@ snippets by typing the name of a snippet hitting the expansion mapping.
- [github.com/drmingdrmer/xptemplate](https://github.com/drmingdrmer/xptemplate):
Totally different syntax, does not read snippets contained in this file, but
it is also very powerful. It does not support vim-snippets (just listing it
here for completness)
here for completeness)
There tries to be a more comprehensive list (which still is incomplete) here:
http://vim-wiki.mawercer.de/wiki/topic/text-snippets-skeletons-templates.html
@ -45,16 +45,15 @@ If you have VimL only (vim without python support) your best option is using
[garbas/vim-snipmate](https://github.com/garbas/vim-snipmate) and cope with the
minor bugs found in the engine.
Q: Should "snipMate be deprecated in favour of UltiSnips"?
Q: Should "snipmate be deprecated in favour of UltiSnips"?
A: No, because snimpate is VimL, and UltiSnips requires Python.
A: No, because snipMate is VimL, and UltiSnips requires Python.
Some people want to use snippets without having to install Vim with Python
support. Yes - this sucks.
One solution would be: Use snippets if they are good enough, but allow overriding them
in UltiSnips. This would avoid most duplication while still serving most users.
AFAIK there is a nested-placeholder branch for snipmate too. snipmate is still
AFAIK there is a nested-placeholder branch for snipMate too. snipMate is still
improved by Adnan Zafar. So maybe time is not ready to make a final decision yet.
[github issue/discussion](https://github.com/honza/vim-snippets/issues/363)
@ -68,11 +67,11 @@ which is why Marc Weber thinks that it doesn't make sense to repeat the same
repetitive information everywhere.
*Recommended way:*
[vim-addon-manager](vim-addon-manager) (because Marc Weber wrote it for exactly
this reason, it supports simple dependency management). Eg you're done by this
line in your .vimrc:
[vim-addon-manager](https://github.com/MarcWeber/vim-addon-manager) (because Marc Weber wrote it for exactly
this reason, it supports simple dependency management). E.g. you're done by this
line in your `.vimrc`:
```
```vim
" assuming you want to use snipmate snippet engine
ActivateAddons vim-snippets snipmate
```
@ -80,16 +79,17 @@ ActivateAddons vim-snippets snipmate
[vim-pi](https://bitbucket.org/vimcommunity/vim-pi/issue/90/we-really-need-a-web-interface)
Is the place to discuss plugin managers and repository resources.
About how to install snipate see [snipmate@garbas](https://github.com/garbas/vim-snipmate)
About how to install snipMate see [snipmate@garbas](https://github.com/garbas/vim-snipmate)
(Bundle, Pathogen, git clone - keywords to make people find this link by ctrl-f search)
I know that I should be reading the docs of the snippet engine, just let me copy paste into my .vimrc:
I know that I should be reading the docs of the snippet engine, just let me copy paste into my `.vimrc`:
[See this pull request](https://github.com/honza/vim-snippets/pull/307/files).
TROUBLE
=======
If you still have trouble getting this to work create a github ticket, ask on
irc or the mailinglist.
If you still have trouble getting this to work create a GitHub ticket, ask on
IRC or the mailing list.
Policies / for contributors
---------------------------
@ -105,7 +105,8 @@ el : else ..
wh : while (cond) ...
```
Don't add useless placeholder default texts like
Don't add useless placeholder default texts like:
```
if (${1:condition}){
${2:some code here}
@ -119,7 +120,7 @@ if (${1}){
}
```
Exception: Functions which are used less often, such as Vim's matchall(), matchstr()
Exception: Functions which are used less often, such as Vim's `matchall()`, `matchstr()`
functions which case hints may be helpful to remember order. In the VimL case
get vim-dev plugin which has function completion
@ -140,6 +141,7 @@ on merging should be done (dropping duplicates etc). Also see engines section ab
Related repositories
--------------------
We also encourage people to maintain sets of snippets for particular use cases
so that all users can benefit from them. People can list their snippet repositories here:
@ -148,7 +150,7 @@ so that all users can benefit from them. People can list their snippet reposito
* https://github.com/zedr/zope-snipmate-bundle.git (snippets for Python, TAL and ZCML)
* https://github.com/bonsaiben/bootstrap-snippets (snippets for Twitter Bootstrap markup, in HTML and Haml)
Installation using VAM: "github:rbonvall/snipmate-snippets-bib"
Installation using VAM: https://github.com/MarcWeber/vim-addon-manager
Future - ideas - examples
-------------------------
@ -156,7 +158,6 @@ Future - ideas - examples
[overview snippet engines](http://vim-wiki.mawercer.de/wiki/topic/text-snippets-skeletons-templates.html)
If you have ideas you can add them to that list of "snippet engine features by example".
Historical notes
----------------
@ -166,15 +167,15 @@ unfortunately abandoned the project. [Rok Garbas][3] is now maintaining a
Versions / dialects / ..
========================
There are some issues, such as newer language versions may require other
snippets than older. If this exists we currently recommend doing this:
add snippets/ruby.snippets (common snippets)
add snippets/ruby-1.8.snippets (1.8 only)
add snippets/ruby-1.9.snippets (1.9 only)
then configure github.com/garbas/vim-snipmate this way:
* add snippets/ruby.snippets (common snippets)
* add snippets/ruby-1.8.snippets (1.8 only)
* add snippets/ruby-1.9.snippets (1.9 only)
then configure https://github.com/garbas/vim-snipmate this way:
```vim
let g:snipMate = {}
@ -183,17 +184,18 @@ let g:snipMate.scope_aliases['ruby'] = 'ruby,ruby-rails,ruby-1.9'
```
If it happens that you work on a project requiring ruby-1.8 snippets instead,
consider using vim-addon-local-vimrc and override the filetypes.
consider using `vim-addon-local-vimrc` and override the filetypes.
Well - of course it may not make sense to create a new file for each
ruby-library-version triplet. Sometimes postfixing a name such as
```
migrate_lib_20_down
migrate_lib_20_up
```
will do it then if syntax has changed.
Language maintainers
--------------------
@ -219,7 +221,6 @@ License
Just as the original snipMate plugin, all the snippets are licensed under the
terms of the MIT license.
[1]: http://github.com/garbas/vim-snipmate
[2]: http://github.com/msanders
[3]: http://github.com/garbas

View file

@ -0,0 +1,324 @@
priority -50
global !p
def ada_case(word):
out = word[0].upper()
for i in range(1, len(word)):
if word[i - 1] == '_':
out = out + word[i].upper()
else:
out = out + word[i]
return out
def get_year():
import time
return time.strftime("%Y")
endglobal
snippet wi "with"
with $1;$0
endsnippet
snippet pac "package"
package ${1:`!p snip.rv = ada_case(snip.basename)`} is
$0
end $1;
endsnippet
snippet pacb "package body"
package body ${1:`!p snip.rv = ada_case(snip.basename)`} is
$0
end $1;
endsnippet
snippet ent "entry ... when"
entry $1($2) when $3 is
begin
$0
end $1;
endsnippet
snippet task "task"
task $1 is
entry $0
end $1;
endsnippet
snippet taskb "task body"
task body $1 is
$2
begin
$0
end $1;
endsnippet
snippet acc "accept"
accept $1($2) do
$0
end $1;
endsnippet
snippet prot "protected type"
protected type $1($2) is
$0
end $1;
endsnippet
snippet prob "protected body"
protected body $1 is
$2
begin
$0
end $1;
endsnippet
snippet gen "generic type"
generic
type $1 is $2;$0
endsnippet
snippet ty "type"
type $1 is $2;$0
endsnippet
snippet tyd "type with default value"
type $1 is $2
with Default_Value => $3;$0
endsnippet
snippet subty "subtype"
subtype $1 is $2;$0
endsnippet
snippet dec "declare block"
declare
$1
begin
$0
end;
endsnippet
snippet decn "declare named block"
$1:
declare
$2
begin
$0
end $1;
endsnippet
snippet ifex "if expression"
if $1 then $2 else $0
endsnippet
snippet casex "case expression"
case $1 is
when $2 => $3,$0
endsnippet
snippet fora "for all"
for all $1 ${2:in} $3 => $0
endsnippet
snippet fors "for some"
for some $1 ${2:in} $3 => $0
endsnippet
snippet if "if"
if $1 then
$0
end if;
endsnippet
snippet ife "if ... else"
if $1 then
$2
else
$0
end if;
endsnippet
snippet el "else"
else
$0
endsnippet
snippet eif "elsif"
elsif $1 then
$0
endsnippet
snippet wh "while"
while $1 loop
$0
end loop;
endsnippet
snippet nwh "named while"
$1:
while $2 loop
$0
end loop $1;
endsnippet
snippet for "for"
for ${1:I} in $2 loop
$0
end loop;
endsnippet
snippet fore "for each"
for $1 of $2 loop
$0
end loop;
endsnippet
snippet nfor "named for"
$1:
for ${2:I} in $3 loop
$0
end loop $1;
endsnippet
snippet nfore "named for each"
$1:
for $2 of $3 loop
$0
end loop $1;
endsnippet
snippet proc "procedure"
procedure $1($2) is
$3
begin
$0
end $1;
endsnippet
snippet procd "procedure declaration"
procedure $1;$0
endsnippet
snippet fun "function"
function $1($2) return $3 is
$4
begin
$0
end $1;
endsnippet
snippet fune "expression function"
function $1 return $2 is
($3);$0
endsnippet
snippet fund "function declaration"
function $1 return $2;$0
endsnippet
snippet ret "extended return"
return $1 do
$0
end return;
endsnippet
snippet rec "record"
record
$0
end record;
endsnippet
snippet case "case"
case $1 is
when $2 => $3;$0
end case;
endsnippet
snippet whe "when"
when $1 => $2;$0
endsnippet
snippet wheo "when others"
when others => $1;$0
endsnippet
snippet lo "loop"
loop
$0
end loop;
endsnippet
snippet nlo "named loop"
$1:
loop
$0
end loop $1;
endsnippet
snippet ex "exit when"
exit when $1;$0
endsnippet
snippet put "Ada.Text_IO.Put"
Ada.Text_IO.Put($1);$0
endsnippet
snippet putl "Ada.Text_IO.Put_Line"
Ada.Text_IO.Put_Line($1);$0
endsnippet
snippet get "Ada.Text_IO.Get"
Ada.Text_IO.Get($1);$0
endsnippet
snippet getl "Ada.Text_IO.Get_Line"
Ada.Text_IO.Get_Line($1);$0
endsnippet
snippet newline "Ada.Text_IO.New_Line"
Ada.Text_IO.New_Line(${1:1});$0
endsnippet
snippet gpl "GPL license header"
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU ${1}General Public License as published by
-- the Free Software Foundation; either version ${2:3} of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU $1General Public License for more details.
--
-- You should have received a copy of the GNU $1General Public License
-- along with this program; if not, see <http://www.gnu.org/licenses/>.
--
-- Copyright (C) ${3:Author}, ${4:`!p snip.rv = get_year()`}
$0
endsnippet
snippet gplf "GPL file license header"
-- This file is part of ${1:Program-Name}.
--
-- $1 is free software: you can redistribute it and/or modify
-- it under the terms of the GNU ${2}General Public License as published by
-- the Free Software Foundation, either version ${3:3} of the License, or
-- (at your option) any later version.
--
-- $1 is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU $2General Public License for more details.
--
-- You should have received a copy of the GNU $2General Public License
-- along with $1. If not, see <http://www.gnu.org/licenses/>.
--
-- Copyright (C) ${4:Author}, ${5:`!p snip.rv = get_year()`}
$0
endsnippet
# vim:ft=snippets:

View file

@ -120,4 +120,14 @@ vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.
endsnippet
##########################
# VIM MODELINE GENERATOR #
##########################
# See advice on `:help 'tabstop'` for why these values are set. Uses second
# modeline form ('set') to work in languages with comment terminators
# (/* like C */).
snippet modeline "Vim modeline"
vim`!v ':set '. (&expandtab ? printf('et sw=%i ts=%i', &sw, &ts) : printf('noet sts=%i sw=%i ts=%i', &sts, &sw, &ts)) . (&tw ? ' tw='. &tw : '') . ':'`
endsnippet
# vim:ft=snippets:

View file

@ -77,7 +77,6 @@ else:
${VISUAL}${0}
#endif /* end of include guard: $1 */
endsnippet
snippet td "Typedef"

View file

@ -29,4 +29,9 @@ ${1:SubSubsection}:`!p snip.rv = sec_title(snip, t)`
$0
endsnippet
# For vim help, follow the same settings as the official docs.
snippet modeline "Vim help modeline"
`!v 'vim'`:tw=78:ts=8:ft=help:norl:
endsnippet
# vim:ft=snippets:

View file

@ -253,6 +253,10 @@ snippet td "table cell" w
<td>$0</td>
endsnippet
snippet th "table header" w
<th>$0</th>
endsnippet
snippet tr "table row" w
<tr>$0</tr>
endsnippet

View file

@ -180,13 +180,13 @@ endsnippet
snippet elif "else if"
else if ($1)`!p nl(snip)`{
$0
$0${VISUAL}
}
endsnippet
snippet el "else" w
else`!p nl(snip)`{
$0
$0${VISUAL}
}
endsnippet
@ -214,7 +214,7 @@ endsnippet
snippet if "if" b
if ($1)`!p nl(snip)`{
$0
$0${VISUAL}
}
endsnippet
@ -303,7 +303,7 @@ endsnippet
snippet try "try/catch" b
try {
$1
$1${VISUAL}
} catch(${2:Exception} ${3:e}){
${4:e.printStackTrace();}
}

View file

@ -50,6 +50,10 @@ snippet ee "expect to equal (js)" b
expect(${1:target}).toEqual(${2:value});
endsnippet
snippet eb "expect to be (js)" b
expect(${1:target}).toBe(${2:value});
endsnippet
snippet em "expect to match (js)" b
expect(${1:target}).toMatch(${2:pattern});
endsnippet

View file

@ -1,3 +1,12 @@
extends markdown
# overwrite if necessary
priority -49
extends markdown
snippet title "Title Header" b
% ${1:`!v Filename('', 'title')`}
% ${2:`!v g:snips_author`}
% ${3:`!v strftime("%d %B %Y")`}
$0
endsnippet

View file

@ -129,4 +129,11 @@ while ($1) {
endsnippet
snippet until "until"
until ($1) {
${2:# body...}
}
endsnippet
# vim:ft=snippets:

View file

@ -14,7 +14,7 @@ endsnippet
snippet do "do"
do {
${2:// code... }
} while (${1:/* condition */});"
} while (${1:/* condition */});
endsnippet
snippet doc_f "doc_f"
@ -67,6 +67,12 @@ if (${1:/* condition */}) {
}
endsnippet
snippet elif "elseif"
elseif (${1:/* condition */}) {
${2:// code...}
}
endsnippet
snippet inc "inc"
include '${1:file}';${2}
endsnippet
@ -240,7 +246,7 @@ public function __construct(${1:$dependencies})
$0
endsnippet
snippet pr "Dumb debug helper in HTML"
snippet ve "Dumb debug helper in HTML"
echo '<pre>' . var_export($1, 1) . '</pre>';$0
endsnippet

View file

@ -84,22 +84,22 @@ def get_style(snip):
def format_arg(arg, style):
if style == DOXYGEN:
return "@param %s @todo" % arg
return "@param %s TODO" % arg
elif style == SPHINX:
return ":param %s: @todo" % arg
return ":param %s: TODO" % arg
elif style == NORMAL:
return ":%s: @todo" % arg
return ":%s: TODO" % arg
elif style == GOOGLE:
return "%s (@todo): @todo" % arg
return "%s (TODO): TODO" % arg
def format_return(style):
if style == DOXYGEN:
return "@return: @todo"
return "@return: TODO"
elif style in (NORMAL, SPHINX):
return ":returns: @todo"
return ":returns: TODO"
elif style == GOOGLE:
return "Returns: @todo"
return "Returns: TODO"
def write_docstring_args(args, snip):
@ -169,7 +169,7 @@ class ${1:MyClass}(${2:object}):
`!p snip.rv = triple_quotes(snip)`${3:Docstring for $1. }`!p snip.rv = triple_quotes(snip)`
def __init__(self$4):
`!p snip.rv = triple_quotes(snip)`${5:@todo: to be defined1.}`!p
`!p snip.rv = triple_quotes(snip)`${5:TODO: to be defined1.}`!p
snip.rv = ""
snip >> 2
@ -197,7 +197,7 @@ write_slots_args(args, snip)
`
def __init__(self$4):
`!p snip.rv = triple_quotes(snip)`${5:@todo: to be defined.}`!p
`!p snip.rv = triple_quotes(snip)`${5:TODO: to be defined.}`!p
snip.rv = ""
snip >> 2
@ -399,7 +399,7 @@ snippet def "function with docstrings" b
def ${1:function}(`!p
if snip.indent:
snip.rv = 'self' + (", " if len(t[2]) else "")`${2:arg1}):
`!p snip.rv = triple_quotes(snip)`${4:@todo: Docstring for $1.}`!p
`!p snip.rv = triple_quotes(snip)`${4:TODO: Docstring for $1.}`!p
snip.rv = ""
snip >> 1
@ -437,7 +437,7 @@ endsnippet
snippet rwprop "Read write property" b
def ${1:name}():
`!p snip.rv = triple_quotes(snip) if t[2] else ''
`${2:@todo: Docstring for $1.}`!p
`${2:TODO: Docstring for $1.}`!p
if t[2]:
snip >> 1

View file

@ -73,7 +73,7 @@ endsnippet
snippet ecl "...extern crate log;" b
#![feature(phase)]
#[phase(syntax, link)] extern crate log;
#[phase(plugin, link)] extern crate log;
endsnippet
snippet mod "A module" b
@ -83,16 +83,16 @@ mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} {
endsnippet
snippet crate "Create header information" b
// Crate ID
#![crate_id = "${1:crate_name}#${2:0.0.1}"]
// Crate name
#![crate_name = "${1:crate_name}"]
// Additional metadata attributes
#![desc = "${3:Descrption.}"]
#![license = "${4:BSD}"]
#![comment = "${5:Comment.}"]
#![desc = "${2:Descrption.}"]
#![license = "${3:BSD}"]
#![comment = "${4:Comment.}"]
// Specify the output type
#![crate_type = "${6:lib}"]
#![crate_type = "${5:lib}"]
endsnippet
snippet allow "#[allow(..)]" b

View file

@ -1,54 +1,56 @@
extends css
priority -50
snippet /@?imp/ "@import '...';" br
snippet imp "@import '...';" b
@import '${1:file}';
endsnippet
snippet /@?inc/ "@include mixin(...);" br
snippet inc "@include mixin(...);" b
@include ${1:mixin}(${2:arguments});
endsnippet
snippet /@?ext?/ "@extend %placeholder;" br
snippet ext "@extend %placeholder;" b
@extend %${1:placeholder};
endsnippet
snippet /@?mixin/ "@mixin (...) { ... }" br
snippet mixin "@mixin (...) { ... }" b
@mixin ${1:name}(${2:arguments}) {
${VISUAL}$0
}
endsnippet
snippet /@?fun/ "@function (...) { ... }" br
snippet fun "@function (...) { ... }" b
@function ${1:name}(${2:arguments}) {
${VISUAL}$0
}
endsnippet
snippet /@?if/ "@if (...) { ... }" br
snippet if "@if (...) { ... }" b
@if ${1:condition} {
${VISUAL}$0
}
endsnippet
snippet /(} )?@?else/ "@else { ... }" br
snippet else "@else { ... }" b
@else ${1:condition} {
${VISUAL}$0
}
endsnippet
snippet /@?for/ "@for loop" br
snippet for "@for loop" b
@for ${1:$i} from ${2:1} through ${3:3} {
${VISUAL}$0
}
endsnippet
snippet /@?each/ "@each loop" br
snippet each "@each loop" b
@each ${1:$item} in ${2:item, item, item} {
${VISUAL}$0
}
endsnippet
snippet /@?while/ "@while loop" br
snippet while "@while loop" b
@while ${1:$i} ${2:>} ${3:0} {
${VISUAL}$0
}

View file

@ -0,0 +1,255 @@
snippet wi with
with ${1};${0}
snippet pac package
package ${1} is
${0}
end $1;
snippet pacb package body
package body ${1} is
${0}
end $1;
snippet ent entry ... when
entry ${1}(${2}) when ${3} is
begin
${0}
end $1;
snippet task task
task ${1} is
entry ${0}
end $1;
snippet taskb task body
task body ${1} is
${2}
begin
${0}
end $1;
snippet acc accept
accept ${1}(${2}) do
${0}
end $1;
snippet prot protected type
protected type ${1}(${2}) is
${0}
end $1;
snippet prob protected body
protected body ${1} is
${2}
begin
${0}
end $1;
snippet gen generic type
generic
type ${1} is ${2};${0}
snippet ty type
type ${1} is ${2};${0}
snippet tyd type with default value
type ${1} is ${2}
with Default_Value => ${3};${0}
snippet subty subtype
subtype ${1} is ${2};${0}
snippet dec declare block
declare
${1}
begin
${0}
end;
snippet decn declare named block
${1}:
declare
${2}
begin
${0}
end $1;
snippet ifex if expression
if ${1} then ${2} else ${0}
snippet casex case expression
case ${1} is
when ${2} => ${3},${0}
snippet fora for all
for all ${1} ${2:in} ${3} => ${0}
snippet fors for some
for some ${1} ${2:in} ${3} => ${0}
snippet if if
if ${1} then
${0}
end if;
snippet ife if ... else
if ${1} then
${2}
else
${0}
end if;
snippet el else
else
${0}
snippet eif elsif
elsif ${1} then
${0}
snippet wh while
while ${1} loop
${0}
end loop;
snippet nwh named while
${1}:
while ${2} loop
${0}
end loop $1;
snippet for for
for ${1:I} in ${2} loop
${0}
end loop;
snippet fore for each
for ${1} of ${2} loop
${0}
end loop;
snippet nfor named for
${1}:
for ${2:I} in ${3} loop
${0}
end loop $1;
snippet nfore named for each
${1}:
for ${2} of ${3} loop
${0}
end loop $1;
snippet proc procedure
procedure ${1}(${2}) is
${3}
begin
${0}
end $1;
snippet procd procedure declaration
procedure ${1};${0}
snippet fun function
function ${1}(${2}) return ${3} is
${4}
begin
${0}
end $1;
snippet fune expression function
function ${1} return ${2} is
(${3});${0}
snippet fund function declaration
function ${1} return ${2};${0}
snippet ret extended return
return ${1} do
${0}
end return;
snippet rec record
record
${0}
end record;
snippet case case
case ${1} is
when ${2} => ${3};${0}
end case;
snippet whe when
when ${1} => ${2};${0}
snippet wheo when others
when others => ${1};${0}
snippet lo loop
loop
${0}
end loop;
snippet nlo named loop
${1}:
loop
${0}
end loop $1;
snippet ex exit when
exit when ${1};${0}
snippet put Ada.Text_IO.Put
Ada.Text_IO.Put(${1});${0}
snippet putl Ada.Text_IO.Put_Line
Ada.Text_IO.Put_Line(${1});${0}
snippet get Ada.Text_IO.Get
Ada.Text_IO.Get(${1});${0}
snippet getl Ada.Text_IO.Get_Line
Ada.Text_IO.Get_Line(${1});${0}
snippet newline Ada.Text_IO.New_Line
Ada.Text_IO.New_Line(${1:1});${0}
snippet gpl GPL license header
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU ${1}General Public License as published by
-- the Free Software Foundation; either version ${2:3} of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU $1General Public License for more details.
--
-- You should have received a copy of the GNU $1General Public License
-- along with this program; if not, see <http://www.gnu.org/licenses/>.
--
-- Copyright (C) ${3:Author}, ${4:`strftime("%Y")`}
${0}
snippet gplf GPL file license header
-- This file is part of ${1:Program-Name}.
--
-- $1 is free software: you can redistribute it and/or modify
-- it under the terms of the GNU ${2}General Public License as published by
-- the Free Software Foundation, either version ${3:3} of the License, or
-- (at your option) any later version.
--
-- $1 is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU $2General Public License for more details.
--
-- You should have received a copy of the GNU $2General Public License
-- along with $1. If not, see <http://www.gnu.org/licenses/>.
--
-- Copyright (C) ${4:Author}, ${5:`strftime("%Y")`}
${0}

View file

@ -0,0 +1,11 @@
snippet def
define ["${1:#dependencies1}"], (${2:#dependencies2}) ->
${0:TARGET}
snippet defn
define "${1:#name}", ["${2:#dependencies1}"], (${3:#dependencies2}) ->
${0:TARGET}
snippet reqjs
require ["${1:#dependencies1}"], (${2:#dependencies2}) ->
${0:TARGET}

View file

@ -0,0 +1,338 @@
### Import
snippet imp
import
snippet pimp
public import
### My favorite modules
snippet io
std.stdio
snippet traits
std.traits
snippet conv
std.conv
snippet arr
std.array
snippet algo
std.algorithm
snippet theusual
import std.stdio, std.string, std.array;
import std.traits, std.conv, std.algorithm;
import std.math, std.regex;
### Control Structures
snippet for
for(int ${1:i} = 0; $1 < ${2:count}; $1++) {
${0}
}
snippet fe
foreach(${1:elem}; ${2:range}) {
${0}
}
snippet fei
foreach(${1:i}, ${2:elem}; ${3:range}) {
${0}
}
snippet fer
foreach_reverse(${1:elem}; ${2:range}) {
${0}
}
snippet feri
foreach_reverse(${1:i}, ${2:elem}; ${3:range}) {
${0}
}
snippet sce
scope(exit) ${1:f.close();}
snippet scs
scope(success) ${1}
snippet scf
scope(failure) ${1}
snippet el
else {
${1}
}
snippet eif
else if(${1}) {
${0}
}
snippet if
if(${1}) {
${0}
}
snippet ife
if(${1}) {
${2}
} else {
${3}
}
snippet ifee
if(${1}) {
${2}
} else if(${3}) {
${4}
} else {
${5}
}
snippet sw
switch(${1}) {
${0}
}
snippet cs
case ${1:0}:
${2}
break;
snippet def
default:
${0}
snippet fsw
final switch(${1}) {
${0}
}
snippet try
try {
${1}
} catch(${2:Exception} ${3:e}) {
${4}
}
snippet tcf
try {
${0}
} catch(${1:Exception} ${2:e}) {
${3}
} finally {
${4}
}
snippet wh
while(${1:cond}) {
${0}
}
snippet dowh
do {
${1}
} while(${2});
snippet sif
static if(${1:cond}) {
${2}
}
snippet sife
static if(${1}) {
${2}
} else {
${3}
}
snippet sifee
static if(${1}) {
${2}
} else static if(${3}) {
${4}
} else {
${5}
}
snippet seif
else static if(${1}) {
${2}
}
snippet ?
(${1: a > b}) ? ${2:a} : ${3:b};
snippet with
with(${1:exp}) {
${2}
} ${0}
### Functions
snippet fun
${1:auto} ${2:func}(${3:params}) {
${0}
}
snippet contr
in {
${1}
} out {
${2}
} body {
${0}
}
snippet l
(${1:x}) => ${2:x}${0:;}
snippet funl
function (${1:int x}) => ${2}${3:;}
snippet del
delegate (${1:int x}) => ${2}${3:;}
### Templates
snippet temp
template ${1:`vim_snippets#Filename("$2", "untitled")`}(${2:T}) {
${0}
}
snippet tempif
template ${1:`vim_snippets#Filename("$2", "untitled")`}(${2:T}) if(${3:isSomeString!}$2) {
${0}
}
snippet opApply
int opApply(Dg)(Dg dg) if(ParameterTypeTuble!Dg.length == 2) {
${0}
}
snippet psn
pure @safe nothrow
snippet safe
@safe
snippet trusted
@trusted
snippet system
@system
### OOPs
snippet cl
class${1:(T)} ${2:`vim_snippets#Filename("$3", "untitled")`} {
${0}
}
snippet str
struct${1:(T)} ${2:`vim_snippets#Filename("$3", "untitled")`} {
${0}
}
snippet uni
union${1:(T)} ${2:`vim_snippets#Filename("$3", "untitled")`} {
${0}
}
snippet inter
interface I${1:`vim_snippets#Filename("$2", "untitled")`} {
${0}
}
snippet enum
enum ${1} {
${0}
}
snippet pu
public
snippet pr
private
snippet po
protected
snippet ctor
this(${1}) {
${0}
}
snippet dtor
~this(${1}) {
${0}
}
### Type Witchery
snippet al
alias ${1:b} = ${2:a};
${0}
snippet alth
alias ${1:value} this;
${0}
### The Commonplace
snippet main
void main() {
${0}
}
snippet maina
void main(string[] args) {
${0}
}
snippet mod
module ${1:main};${0}
snippet var
${1:auto} ${2:var} = ${0:1};
snippet new
${1:auto} ${2:var} = new ${3:Object}(${4});
${0}
snippet file
auto ${1:f} = File(${2:"useful_info.xml"}, ${3:"rw"});
${0}
snippet map
map!(${1:f})(${2:xs});
${0}
snippet filter
filter!(${1:p})(${2:xs});
${0}
snippet reduce
reduce!(${1:f})(${2:xs});
${0}
snippet find
find!(${1:p})($2:xs);
${0}
snippet aa
${1:int}[${2:string}] ${3:dict} = ${0};
### Misc
snippet #!
#!/usr/bin/env rdmd
snippet bang
#!/usr/bin/env rdmd
snippet rdmd
#!/usr/bin/env rdmd
snippet isstr
isSomeString!${1:S}
snippet isnum
isNumeric!${1:N}
snippet tos
to!string(${1:x});
${0}
snippet toi
to!int(${1:str});
${0}
snippet tod
to!double(${1:str});
${0}
snippet un
unittest {
${0}
}
snippet ver
version(${1:Posix}) {
${0}
}
snippet de
debug {
${0}
}
snippet sst
shared static this(${1}) {
${0}
}
snippet td
// Typedef is deprecated. Use alias instead.
typedef
snippet ino
inout
snippet imm
immutable
snippet fin
final
snippet con
const
snippet psi
private static immutable ${1:int} ${2:Constant} = ${3:1};
${0}
snippet prag
pragma(${1})
snippet pms
pragma(msg, ${1:Warning});
snippet asm
asm {
${1}
}
snippet mixin
mixin(${1:`writeln("Hello, World!");`});
snippet over
override
snippet ret
return ${1};
snippet FILE
__FILE__
snippet MOD
__MODULE__
snippet LINE
__LINE__
snippet FUN
__FUNCTION__
snippet PF
__PRETTY_FUNCTION__
snippet cast
cast(${1:T})(${2:val});
snippet /*
/*
* ${1}
*/
### Fun stuff
snippet idk
// I don't know how this works. Don't touch it.
snippet idfk
// Don't FUCKING touch this.

View file

@ -330,7 +330,7 @@ snippet dt+
snippet em
<em>${0}</em>
snippet embed
<embed src=${1} type="${0} />
<embed src="${1}" type="${0}" />
snippet fieldset
<fieldset>
${0}
@ -353,6 +353,14 @@ snippet figcaption
<figcaption>${0}</figcaption>
snippet figure
<figure>${0}</figure>
snippet figure#
<figure id="${1}">
${0}
</figure>
snippet figure.
<figure class="${1}">
${0}
</figure>
snippet footer
<footer>
${0}
@ -454,10 +462,23 @@ snippet html5
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
${2:meta}
${2:link}
</head>
<body>
${0:body}
</body>
</html>
snippet html5l
<!DOCTYPE html>
<html lang="${1:es}">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>${2:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
${3:link}
</head>
<body>
${0:body}
@ -561,6 +582,8 @@ snippet link
<link rel="${1}" href="${2}" title="${3}" type="${4}" />
snippet link:atom
<link rel="alternate" href="${1:atom.xml}" title="Atom" type="application/atom+xml" />
snippet link:s
<link rel="stylesheet" href="${1:style.css}" />
snippet link:css
<link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}" />
snippet link:favicon
@ -601,6 +624,10 @@ snippet menu:t
</menu>
snippet meta
<meta http-equiv="${1}" content="${2}" />
snippet meta:s
<meta ${0} />
snippet meta:d
<meta name="description" content="${0}" />
snippet meta:compat
<meta http-equiv="X-UA-Compatible" content="IE=${1:7,8,edge}" />
snippet meta:refresh
@ -703,6 +730,12 @@ snippet script
<script type="text/javascript" charset="utf-8">
${0}
</script>
snippet scripts
<script src="${0}.js"></script>
snippet scriptt
<script type="${1}" id="${2}">
${0}
</script>
snippet scriptsrc
<script src="${0}.js" type="text/javascript" charset="utf-8"></script>
snippet section
@ -780,7 +813,7 @@ snippet td+
<td>${1}</td>
td+${0}
snippet textarea
<textarea name="${1}" id=${2:$1} rows="${3:8}" cols="${4:40}">${5}</textarea>
<textarea name="${1}" id="${2:$1}" rows="${3:8}" cols="${4:40}">${5}</textarea>
snippet tfoot
<tfoot>
${0}

View file

@ -40,6 +40,8 @@ snippet j.u
## Class
snippet cl
class ${1:`vim_snippets#Filename("$1", "untitled")`} ${0}
snippet pcl
public class ${1:`vim_snippets#Filename("$1", "untitled")`} ${0}
snippet in
interface ${1:`vim_snippets#Filename("$1", "untitled")`} ${2:extends Parent}
snippet tc

View file

@ -0,0 +1,14 @@
snippet def
define(["${1:#dependencies1}"], function (${2:#dependencies2}) {
return ${0:TARGET};
});
snippet defn
define("${1:#name}", ["${2:#dependencies1}"], function (${3:#dependencies2}) {
return ${0:TARGET};
});
snippet reqjs
require(["${1:#dependencies1}"], function (${2:#dependencies2}) {
return ${0:TARGET};
});

View file

@ -0,0 +1,50 @@
# module exports
snippet ex
module.exports = ${1};
# require
snippet re
var ${1} = require("${2:module_name}");
# EventEmitter
snippet on
on('${1:event_name}', function(${2:stream}) {
${3}
});
snippet emit
emit('${1:event_name}', ${2:args});
snippet once
once('${1:event_name}', function(${2:stream}) {
${3}
});
# http. User js function snippet as handler
snippet http
http.createServer(${1:handler}).listen(${2:port_number});
# net
snippet net
net.createServer(function(${1:socket}){
${1}.on('data', function('data'){
${2}
]});
${1}.on('end', function(){
${3}
});
}).listen(${4:8124});
# Stream snippets
snippet pipe
pipe(${1:stream})${2}
# Express snippets
snippet eget
${1:app}.get('${2:route}', ${3:handler});
snippet epost
${1:app}.post('${2:route}', ${3:handler});
snippet eput
${1:app}.put('${2:route}', ${3:handler});
snippet edel
${1:app}.delete('${2:route}', ${3:handler});
# process snippets
snippet stdin
process.stdin
snippet stdout
process.stdout
snippet stderr
process.stderr

View file

@ -1,19 +1,23 @@
# Prototype
# prototype
snippet proto
${1:class_name}.prototype.${2:method_name} =
function(${3:first_argument}) {
${0:// body...}
${1:class_name}.prototype.${2:method_name} = function(${3}) {
${0}
};
# Function
snippet fun
function ${1:function_name}(${2:argument}) {
${0:// body...}
function ${1:function_name}(${2}) {
${0}
}
# Anonymous Function
snippet f
function(${1}) {
${0}
}
# Function assigned to variable
snippet vf
var ${1:function_name} = function $1(${2}) {
${0}
};
# Immediate function
snippet (f
(function(${1}) {

View file

@ -349,3 +349,11 @@ snippet debug_trace
require Carp; Carp::confess
};
snippet dump
use Data::Dump qw(dump);
warn dump ${1:variable}
snippet subtest
subtest '${1: test_name}' => sub {
${2}
};

View file

@ -347,6 +347,10 @@ snippet vd
var_dump(${0});
snippet vdd
var_dump(${1}); die(${0:});
snippet pr
print_r(${0});
snippet prs
print_r(${0}, 1);
snippet vdf
error_log(print_r($${1:foo}, true), 3, '${2:/tmp/debug.log}');
snippet http_redirect

View file

@ -109,6 +109,8 @@ snippet dele delegate .. to
delegate :${1:methods}, to: :${0:object}
snippet dele delegate .. to .. prefix .. allow_nil
delegate :${1:methods}, to: :${2:object}, prefix: :${3:prefix}, allow_nil: ${0:allow_nil}
snippet amc
alias_method_chain :${1:method_name}, :${0:feature}
snippet flash
flash[:${1:notice}] = '${0}'
snippet habtm

View file

@ -590,7 +590,11 @@ snippet begin
#debugging
snippet debug
require 'ruby-debug'; debugger; true;
require 'byebug'; byebug
snippet debug19
require 'debugger'; debugger
snippet debug18
require 'ruby-debug'; debugger
snippet pry
require 'pry'; binding.pry
snippet strf

View file

@ -34,20 +34,20 @@ snippet ec
extern crate ${1:sync};
snippet ecl
#![feature(phase)]
#[phase(syntax, link)] extern crate log;
#[phase(plugin, link)] extern crate log;
snippet mod
mod ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
${0}
} /* $1 */
snippet crate
// Crate ID
#![crate_id = "${1:crate_name}#${2:0.0.1}"]
// Crate name
#![crate_name = "${1:crate_name}"]
// Additional metadata attributes
#![desc = "${3:Descrption.}"]
#![license = "${4:BSD}"]
#![comment = "${5:Comment.}"]
#![desc = "${2:Descrption.}"]
#![license = "${3:BSD}"]
#![comment = "${4:Comment.}"]
// Specify the output type
#![crate_type = "${6:lib}"]
#![crate_type = "${5:lib}"]
snippet allow
#[allow(${1:unused_variable})]
snippet feat

View file

@ -0,0 +1,993 @@
snippet !
!important
snippet bdi:m+
-moz-border-image url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch}
snippet bdi:m
-moz-border-image ${0}
snippet bdrz:m
-moz-border-radius ${0}
snippet bxsh:m+
-moz-box-shadow ${1:0} ${2:0} ${3:0} ${0}
snippet bxsh:m
-moz-box-shadow ${0}
snippet bdi:w+
-webkit-border-image url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch}
snippet bdi:w
-webkit-border-image ${0}
snippet bdrz:w
-webkit-border-radius ${0}
snippet bxsh:w+
-webkit-box-shadow ${1:0} ${2:0} ${3:0} ${0}
snippet bxsh:w
-webkit-box-shadow ${0}
snippet @f
@font-face ${0}
snippet @i
@import '${0}'
snippet @r
@require '${0}'
snippet @m
@media ${1:screen}
snippet @msmw
@media screen and (min-width: ${0}px)
snippet @ext
@extend .${1}
${0}
snippet bg+
background ${1} url(${2}) ${3:0} ${4:0} ${0:no-repeat}
snippet bga
background-attachment ${0}
snippet bga:f
background-attachment fixed
snippet bga:s
background-attachment scroll
snippet bgbk
background-break ${0}
snippet bgbk:bb
background-break bounding-box
snippet bgbk:c
background-break continuous
snippet bgbk:eb
background-break each-box
snippet bgcp
background-clip ${0}
snippet bgcp:bb
background-clip border-box
snippet bgcp:cb
background-clip content-box
snippet bgcp:nc
background-clip no-clip
snippet bgcp:pb
background-clip padding-box
snippet bgc
background-color ${0}
snippet bgc:t
background-color transparent
snippet bgi
background-image url(${0})
snippet bgi:n
background-image none
snippet bgo
background-origin ${0}
snippet bgo:bb
background-origin border-box
snippet bgo:cb
background-origin content-box
snippet bgo:pb
background-origin padding-box
snippet bgpx
background-position-x ${0}
snippet bgpy
background-position-y ${0}
snippet bgp
background-position ${1:0} ${0:0}
snippet bgr
background-repeat ${0}
snippet bgr:n
background-repeat no-repeat
snippet bgr:x
background-repeat repeat-x
snippet bgr:y
background-repeat repeat-y
snippet bgr:r
background-repeat repeat
snippet bgz
background-size ${0}
snippet bgz:a
background-size auto
snippet bgz:ct
background-size contain
snippet bgz:cv
background-size cover
snippet bg
background ${0}
snippet bg:ie
filter progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${1}',sizingMethod='${0:crop}')
snippet bg:n
background none
snippet bd+
border ${1:1px} ${2:solid} ${0}
snippet bdb+
border-bottom ${1:1px} ${2:solid} ${0}
snippet bdbc
border-bottom-color ${0}
snippet bdbi
border-bottom-image url(${0})
snippet bdbi:n
border-bottom-image none
snippet bdbli
border-bottom-left-image url(${0})
snippet bdbli:c
border-bottom-left-image continue
snippet bdbli:n
border-bottom-left-image none
snippet bdblrz
border-bottom-left-radius ${0}
snippet bdbri
border-bottom-right-image url(${0})
snippet bdbri:c
border-bottom-right-image continue
snippet bdbri:n
border-bottom-right-image none
snippet bdbrrz
border-bottom-right-radius ${0}
snippet bdbs
border-bottom-style ${0}
snippet bdbs:n
border-bottom-style none
snippet bdbw
border-bottom-width ${0}
snippet bdb
border-bottom ${0}
snippet bdb:n
border-bottom none
snippet bdbk
border-break ${0}
snippet bdbk:c
border-break close
snippet bdcl
border-collapse ${0}
snippet bdcl:c
border-collapse collapse
snippet bdcl:s
border-collapse separate
snippet bdc
border-color ${0}
snippet bdci
border-corner-image url(${0})
snippet bdci:c
border-corner-image continue
snippet bdci:n
border-corner-image none
snippet bdf
border-fit ${0}
snippet bdf:c
border-fit clip
snippet bdf:of
border-fit overwrite
snippet bdf:ow
border-fit overwrite
snippet bdf:r
border-fit repeat
snippet bdf:sc
border-fit scale
snippet bdf:sp
border-fit space
snippet bdf:st
border-fit stretch
snippet bdi
border-image url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch}
snippet bdi:n
border-image none
snippet bdl+
border-left ${1:1px} ${2:solid} ${0}
snippet bdlc
border-left-color ${0}
snippet bdli
border-left-image url(${0})
snippet bdli:n
border-left-image none
snippet bdls
border-left-style ${0}
snippet bdls:n
border-left-style none
snippet bdlw
border-left-width ${0}
snippet bdl
border-left ${0}
snippet bdl:n
border-left none
snippet bdlt
border-length ${0}
snippet bdlt:a
border-length auto
snippet bdrz
border-radius ${0}
snippet bdr+
border-right ${1:1px} ${2:solid} ${0}
snippet bdrc
border-right-color ${0}
snippet bdri
border-right-image url(${0})
snippet bdri:n
border-right-image none
snippet bdrs
border-right-style ${0}
snippet bdrs:n
border-right-style none
snippet bdrw
border-right-width ${0}
snippet bdr
border-right ${0}
snippet bdr:n
border-right none
snippet bdsp
border-spacing ${0}
snippet bds
border-style ${0}
snippet bds:ds
border-style dashed
snippet bds:dtds
border-style dot-dash
snippet bds:dtdtds
border-style dot-dot-dash
snippet bds:dt
border-style dotted
snippet bds:db
border-style double
snippet bds:g
border-style groove
snippet bds:h
border-style hidden
snippet bds:i
border-style inset
snippet bds:n
border-style none
snippet bds:o
border-style outset
snippet bds:r
border-style ridge
snippet bds:s
border-style solid
snippet bds:w
border-style wave
snippet bdt+
border-top ${1:1px} ${2:solid} ${0}
snippet bdtc
border-top-color ${0}
snippet bdti
border-top-image url(${0})
snippet bdti:n
border-top-image none
snippet bdtli
border-top-left-image url(${0})
snippet bdtli:c
border-corner-image continue
snippet bdtli:n
border-corner-image none
snippet bdtlrz
border-top-left-radius ${0}
snippet bdtri
border-top-right-image url(${0})
snippet bdtri:c
border-top-right-image continue
snippet bdtri:n
border-top-right-image none
snippet bdtrrz
border-top-right-radius ${0}
snippet bdts
border-top-style ${0}
snippet bdts:n
border-top-style none
snippet bdtw
border-top-width ${0}
snippet bdt
border-top ${0}
snippet bdt:n
border-top none
snippet bdw
border-width ${0}
snippet bd
border ${0}
snippet bd:n
border none
snippet b
bottom ${0}
snippet b:a
bottom auto
snippet bxsh+
box-shadow ${1:0} ${2:0} ${3:0} ${0}
snippet bxsh
box-shadow ${0}
snippet bxsh:n
box-shadow none
snippet bxz
box-sizing ${0}
snippet bxz:bb
box-sizing border-box
snippet bxz:cb
box-sizing content-box
snippet cps
caption-side ${0}
snippet cps:b
caption-side bottom
snippet cps:t
caption-side top
snippet cl
clear ${0}
snippet cl:b
clear both
snippet cl:l
clear left
snippet cl:n
clear none
snippet cl:r
clear right
snippet cp
clip ${0}
snippet cp:a
clip auto
snippet cp:r
clip rect(${1:0} ${2:0} ${3:0} ${0:0})
snippet c
color ${0}
snippet ct
content ${0}
snippet ct:a
content attr(${0})
snippet ct:cq
content close-quote
snippet ct:c
content counter(${0})
snippet ct:cs
content counters(${0})
snippet ct:ncq
content no-close-quote
snippet ct:noq
content no-open-quote
snippet ct:n
content normal
snippet ct:oq
content open-quote
snippet coi
counter-increment ${0}
snippet cor
counter-reset ${0}
snippet cur
cursor ${0}
snippet cur:a
cursor auto
snippet cur:c
cursor crosshair
snippet cur:d
cursor default
snippet cur:ha
cursor hand
snippet cur:he
cursor help
snippet cur:m
cursor move
snippet cur:p
cursor pointer
snippet cur:t
cursor text
snippet d
display ${0}
snippet d:mib
display -moz-inline-box
snippet d:mis
display -moz-inline-stack
snippet d:b
display block
snippet d:cp
display compact
snippet d:ib
display inline-block
snippet d:itb
display inline-table
snippet d:i
display inline
snippet d:li
display list-item
snippet d:n
display none
snippet d:ri
display run-in
snippet d:tbcp
display table-caption
snippet d:tbc
display table-cell
snippet d:tbclg
display table-column-group
snippet d:tbcl
display table-column
snippet d:tbfg
display table-footer-group
snippet d:tbhg
display table-header-group
snippet d:tbrg
display table-row-group
snippet d:tbr
display table-row
snippet d:tb
display table
snippet ec
empty-cells ${0}
snippet ec:h
empty-cells hide
snippet ec:s
empty-cells show
snippet exp
expression()
snippet fl
float ${0}
snippet fl:l
float left
snippet fl:n
float none
snippet fl:r
float right
snippet f+
font ${1:1em} ${2:Arial},${0:sans-serif}
snippet fef
font-effect ${0}
snippet fef:eb
font-effect emboss
snippet fef:eg
font-effect engrave
snippet fef:n
font-effect none
snippet fef:o
font-effect outline
snippet femp
font-emphasize-position ${0}
snippet femp:a
font-emphasize-position after
snippet femp:b
font-emphasize-position before
snippet fems
font-emphasize-style ${0}
snippet fems:ac
font-emphasize-style accent
snippet fems:c
font-emphasize-style circle
snippet fems:ds
font-emphasize-style disc
snippet fems:dt
font-emphasize-style dot
snippet fems:n
font-emphasize-style none
snippet fem
font-emphasize ${0}
snippet ff
font-family ${0}
snippet ff:c
font-family ${0:'Monotype Corsiva','Comic Sans MS'},cursive
snippet ff:f
font-family ${0:Capitals,Impact},fantasy
snippet ff:m
font-family ${0:Monaco,'Courier New'},monospace
snippet ff:ss
font-family ${0:Helvetica,Arial},sans-serif
snippet ff:s
font-family ${0:Georgia,'Times New Roman'},serif
snippet fza
font-size-adjust ${0}
snippet fza:n
font-size-adjust none
snippet fz
font-size ${0}
snippet fsm
font-smooth ${0}
snippet fsm:aw
font-smooth always
snippet fsm:a
font-smooth auto
snippet fsm:n
font-smooth never
snippet fst
font-stretch ${0}
snippet fst:c
font-stretch condensed
snippet fst:e
font-stretch expanded
snippet fst:ec
font-stretch extra-condensed
snippet fst:ee
font-stretch extra-expanded
snippet fst:n
font-stretch normal
snippet fst:sc
font-stretch semi-condensed
snippet fst:se
font-stretch semi-expanded
snippet fst:uc
font-stretch ultra-condensed
snippet fst:ue
font-stretch ultra-expanded
snippet fs
font-style ${0}
snippet fs:i
font-style italic
snippet fs:n
font-style normal
snippet fs:o
font-style oblique
snippet fv
font-variant ${0}
snippet fv:n
font-variant normal
snippet fv:sc
font-variant small-caps
snippet fw
font-weight ${0}
snippet fw:b
font-weight bold
snippet fw:br
font-weight bolder
snippet fw:lr
font-weight lighter
snippet fw:n
font-weight normal
snippet f
font ${0}
snippet h
height ${0}
snippet h:a
height auto
snippet l
left ${0}
snippet l:a
left auto
snippet lts
letter-spacing ${0}
snippet lh
line-height ${0}
snippet lisi
list-style-image url(${0})
snippet lisi:n
list-style-image none
snippet lisp
list-style-position ${0}
snippet lisp:i
list-style-position inside
snippet lisp:o
list-style-position outside
snippet list
list-style-type ${0}
snippet list:c
list-style-type circle
snippet list:dclz
list-style-type decimal-leading-zero
snippet list:dc
list-style-type decimal
snippet list:d
list-style-type disc
snippet list:lr
list-style-type lower-roman
snippet list:n
list-style-type none
snippet list:s
list-style-type square
snippet list:ur
list-style-type upper-roman
snippet lis
list-style ${0}
snippet lis:n
list-style none
snippet mb
margin-bottom ${0}
snippet mb:a
margin-bottom auto
snippet ml
margin-left ${0}
snippet ml:a
margin-left auto
snippet mr
margin-right ${0}
snippet mr:a
margin-right auto
snippet mt
margin-top ${0}
snippet mt:a
margin-top auto
snippet m
margin ${0}
snippet m:4
margin ${1:0} ${2:0} ${3:0} ${0:0}
snippet m:3
margin ${1:0} ${2:0} ${0:0}
snippet m:2
margin ${1:0} ${0:0}
snippet m:0
margin 0
snippet m:a
margin auto
snippet mah
max-height ${0}
snippet mah:n
max-height none
snippet maw
max-width ${0}
snippet maw:n
max-width none
snippet mih
min-height ${0}
snippet miw
min-width ${0}
snippet op
opacity ${0}
snippet op:ie
filter progid:DXImageTransform.Microsoft.Alpha(Opacity=${0:100})
snippet op:ms
-ms-filter 'progid:DXImageTransform.Microsoft.Alpha(Opacity=${0:100})'
snippet orp
orphans ${0}
snippet o+
outline ${1:1px} ${2:solid} ${0}
snippet oc
outline-color ${0}
snippet oc:i
outline-color invert
snippet oo
outline-offset ${0}
snippet os
outline-style ${0}
snippet ow
outline-width ${0}
snippet o
outline ${0}
snippet o:n
outline none
snippet ovs
overflow-style ${0}
snippet ovs:a
overflow-style auto
snippet ovs:mq
overflow-style marquee
snippet ovs:mv
overflow-style move
snippet ovs:p
overflow-style panner
snippet ovs:s
overflow-style scrollbar
snippet ovx
overflow-x ${0}
snippet ovx:a
overflow-x auto
snippet ovx:h
overflow-x hidden
snippet ovx:s
overflow-x scroll
snippet ovx:v
overflow-x visible
snippet ovy
overflow-y ${0}
snippet ovy:a
overflow-y auto
snippet ovy:h
overflow-y hidden
snippet ovy:s
overflow-y scroll
snippet ovy:v
overflow-y visible
snippet ov
overflow ${0}
snippet ov:a
overflow auto
snippet ov:h
overflow hidden
snippet ov:s
overflow scroll
snippet ov:v
overflow visible
snippet pb
padding-bottom ${0}
snippet pl
padding-left ${0}
snippet pr
padding-right ${0}
snippet pt
padding-top ${0}
snippet p
padding ${0}
snippet p:4
padding ${1:0} ${2:0} ${3:0} ${0:0}
snippet p:3
padding ${1:0} ${2:0} ${0:0}
snippet p:2
padding ${1:0} ${0:0}
snippet p:0
padding 0
snippet pgba
page-break-after ${0}
snippet pgba:aw
page-break-after always
snippet pgba:a
page-break-after auto
snippet pgba:l
page-break-after left
snippet pgba:r
page-break-after right
snippet pgbb
page-break-before ${0}
snippet pgbb:aw
page-break-before always
snippet pgbb:a
page-break-before auto
snippet pgbb:l
page-break-before left
snippet pgbb:r
page-break-before right
snippet pgbi
page-break-inside ${0}
snippet pgbi:a
page-break-inside auto
snippet pgbi:av
page-break-inside avoid
snippet pos
position ${0}
snippet pos:a
position absolute
snippet pos:f
position fixed
snippet pos:r
position relative
snippet pos:s
position static
snippet q
quotes ${0}
snippet q:en
quotes '\201C' '\201D' '\2018' '\2019'
snippet q:n
quotes none
snippet q:ru
quotes '\00AB' '\00BB' '\201E' '\201C'
snippet rz
resize ${0}
snippet rz:b
resize both
snippet rz:h
resize horizontal
snippet rz:n
resize none
snippet rz:v
resize vertical
snippet r
right ${0}
snippet r:a
right auto
snippet tbl
table-layout ${0}
snippet tbl:a
table-layout auto
snippet tbl:f
table-layout fixed
snippet tal
text-align-last ${0}
snippet tal:a
text-align-last auto
snippet tal:c
text-align-last center
snippet tal:l
text-align-last left
snippet tal:r
text-align-last right
snippet ta
text-align ${0}
snippet ta:c
text-align center
snippet ta:l
text-align left
snippet ta:r
text-align right
snippet td
text-decoration ${0}
snippet td:l
text-decoration line-through
snippet td:n
text-decoration none
snippet td:o
text-decoration overline
snippet td:u
text-decoration underline
snippet te
text-emphasis ${0}
snippet te:ac
text-emphasis accent
snippet te:a
text-emphasis after
snippet te:b
text-emphasis before
snippet te:c
text-emphasis circle
snippet te:ds
text-emphasis disc
snippet te:dt
text-emphasis dot
snippet te:n
text-emphasis none
snippet th
text-height ${0}
snippet th:a
text-height auto
snippet th:f
text-height font-size
snippet th:m
text-height max-size
snippet th:t
text-height text-size
snippet ti
text-indent ${0}
snippet ti:-
text-indent -9999px
snippet tj
text-justify ${0}
snippet tj:a
text-justify auto
snippet tj:d
text-justify distribute
snippet tj:ic
text-justify inter-cluster
snippet tj:ii
text-justify inter-ideograph
snippet tj:iw
text-justify inter-word
snippet tj:k
text-justify kashida
snippet tj:t
text-justify tibetan
snippet to+
text-outline ${1:0} ${2:0} ${0}
snippet to
text-outline ${0}
snippet to:n
text-outline none
snippet tr
text-replace ${0}
snippet tr:n
text-replace none
snippet tsh+
text-shadow ${1:0} ${2:0} ${3:0} ${0}
snippet tsh
text-shadow ${0}
snippet tsh:n
text-shadow none
snippet tt
text-transform ${0}
snippet tt:c
text-transform capitalize
snippet tt:l
text-transform lowercase
snippet tt:n
text-transform none
snippet tt:u
text-transform uppercase
snippet tw
text-wrap ${0}
snippet tw:no
text-wrap none
snippet tw:n
text-wrap normal
snippet tw:s
text-wrap suppress
snippet tw:u
text-wrap unrestricted
snippet t
top ${0}
snippet t:a
top auto
snippet va
vertical-align ${0}
snippet va:bl
vertical-align baseline
snippet va:b
vertical-align bottom
snippet va:m
vertical-align middle
snippet va:sub
vertical-align sub
snippet va:sup
vertical-align super
snippet va:tb
vertical-align text-bottom
snippet va:tt
vertical-align text-top
snippet va:t
vertical-align top
snippet v
visibility ${0}
snippet v:c
visibility collapse
snippet v:h
visibility hidden
snippet v:v
visibility visible
snippet whsc
white-space-collapse ${0}
snippet whsc:ba
white-space-collapse break-all
snippet whsc:bs
white-space-collapse break-strict
snippet whsc:k
white-space-collapse keep-all
snippet whsc:l
white-space-collapse loose
snippet whsc:n
white-space-collapse normal
snippet whs
white-space ${0}
snippet whs:n
white-space normal
snippet whs:nw
white-space nowrap
snippet whs:pl
white-space pre-line
snippet whs:pw
white-space pre-wrap
snippet whs:p
white-space pre
snippet wid
widows ${0}
snippet w
width ${0}
snippet w:a
width auto
snippet wob
word-break ${0}
snippet wob:ba
word-break break-all
snippet wob:bs
word-break break-strict
snippet wob:k
word-break keep-all
snippet wob:l
word-break loose
snippet wob:n
word-break normal
snippet wos
word-spacing ${0}
snippet wow
word-wrap ${0}
snippet wow:no
word-wrap none
snippet wow:n
word-wrap normal
snippet wow:s
word-wrap suppress
snippet wow:u
word-wrap unrestricted
snippet z
z-index ${0}
snippet z:a
z-index auto
snippet zoo
zoom 1
snippet :h
:hover
snippet :fc
:first-child
snippet :lc
:last-child
snippet :nc
:nth-child(${0})
snippet :nlc
:nth-last-child(${0})
snippet :oc
:only-child
snippet :a
:after
snippet :b
:before
snippet ::a
::after
snippet ::b
::before
snippet if
if ${0}
snippet mix
${1}(${0})
snippet for
for ${1:i} in ${0}
snippet keyf
@keyframes ${0}

View file

@ -263,3 +263,20 @@ snippet col2 two-column environment
${0}
\end{column}
\end{columns}
# Code listings
snippet lst
\begin{listing}[language=${1:language}]
${0}
\end{listing}
snippet lsi
\lstinline|${1}| ${0}
# Hyperlinks
snippet url
\url{${1}} ${0}
snippet href
\href{${1}}{${2}} ${0}
# URL from Clipboard.
snippet urlc
\url{`@+`} ${0}
snippet hrefc
\href{`@+`}{${1}} ${0}

View file

@ -57,6 +57,10 @@ snippet [
snippet always
{ ${1:try} } always { ${0:always} }
snippet fun
function ${1:name} (${2:args}) {
${0:# body}
${1:function_name}() {
${0:# function_body}
}
snippet ffun
function ${1:function_name}() {
${0:# function_body}
}