1
0
Fork 0
mirror of synced 2024-11-22 08:45:34 -05:00

Updated plugins

This commit is contained in:
amix 2016-08-02 14:48:32 +02:00
parent 64a81818ee
commit 61a22e9f3e
39 changed files with 1372 additions and 782 deletions

View file

@ -97,6 +97,7 @@ let [s:pref, s:bpref, s:opts, s:new_opts, s:lc_opts] =
\ 'compare_lim': ['s:compare_lim', 3000],
\ 'bufname_mod': ['s:bufname_mod', ':t'],
\ 'bufpath_mod': ['s:bufpath_mod', ':~:.:h'],
\ 'formatline_func': ['s:flfunc', 's:formatline(v:val)'],
\ }, {
\ 'open_multiple_files': 's:opmul',
\ 'regexp': 's:regexp',
@ -203,11 +204,11 @@ let s:hlgrps = {
\ }
" lname, sname of the basic(non-extension) modes
let s:coretypes = [
let s:coretypes = filter([
\ ['files', 'fil'],
\ ['buffers', 'buf'],
\ ['mru files', 'mru'],
\ ]
\ ], 'index(g:ctrlp_types, v:val[1])!=-1')
" Get the options {{{2
fu! s:opts(...)
@ -439,9 +440,9 @@ fu! s:UserCmd(lscmd)
en
if has('patch-7.4-597') && !(has('win32') || has('win64'))
let g:ctrlp_allfiles = systemlist(printf(lscmd, path))
else
el
let g:ctrlp_allfiles = split(system(printf(lscmd, path)), "\n")
end
en
if exists('+ssl') && exists('ssl')
let &ssl = ssl
cal map(g:ctrlp_allfiles, 'tr(v:val, "\\", "/")')
@ -624,7 +625,7 @@ fu! s:Render(lines, pat)
en
if s:mw_order == 'btt' | cal reverse(lines) | en
let s:lines = copy(lines)
cal map(lines, 's:formatline(v:val)')
cal map(lines, s:flfunc)
cal setline(1, s:offset(lines, height))
cal s:unmarksigns()
cal s:remarksigns()
@ -719,7 +720,7 @@ fu! s:PrtBS()
if empty(s:prompt[0]) && s:brfprt != 0
cal s:PrtExit()
retu
endif
en
unl! s:hstgot
let [s:prompt[0], s:matches] = [substitute(s:prompt[0], '.$', '', ''), 1]
cal s:BuildPrompt(1)
@ -877,12 +878,13 @@ fu! s:PrtFocusMap(char)
endf
fu! s:PrtClearCache()
if s:itemtype == 0
let ct = s:curtype()
if ct == 'fil'
cal ctrlp#clr()
elsei s:itemtype > 2
elsei s:itemtype >= len(s:coretypes)
cal ctrlp#clr(s:statypes[s:itemtype][1])
en
if s:itemtype == 2
if ct == 'mru'
let g:ctrlp_lines = ctrlp#mrufiles#refresh()
el
cal ctrlp#setlines()
@ -893,9 +895,10 @@ fu! s:PrtClearCache()
endf
fu! s:PrtDeleteEnt()
if s:itemtype == 2
let ct = s:curtype()
if ct == 'mru'
cal s:PrtDeleteMRU()
elsei s:itemtype == 1
elsei ct == 'buf'
cal s:delbuf()
elsei type(s:getextvar('wipe')) == 1
cal s:delent(s:getextvar('wipe'))
@ -903,7 +906,7 @@ fu! s:PrtDeleteEnt()
endf
fu! s:PrtDeleteMRU()
if s:itemtype == 2
if s:curtype() == 'mru'
cal s:delent('ctrlp#mrufiles#remove')
en
endf
@ -1011,7 +1014,7 @@ fu! s:ToggleByFname()
endf
fu! s:ToggleType(dir)
let max = len(g:ctrlp_ext_vars) + 2
let max = len(g:ctrlp_ext_vars) + len(s:coretypes) - 1
let next = s:walker(max, s:itemtype, a:dir)
cal ctrlp#setlines(next)
cal ctrlp#syntax()
@ -1151,7 +1154,7 @@ fu! s:AcceptSelection(action)
if subm | if s:SpecInputs(str) | retu | en | en
" Get the selected line
let line = ctrlp#getcline()
if !subm && !s:itemtype && line == '' && line('.') > s:offset
if !subm && s:curtype() != 'fil' && line == '' && line('.') > s:offset
\ && str !~ '\v^(\.\.([\/]\.\.)*[\/]?[.\/]*|/|\\|\?|\@.+)$'
cal s:CreateNewFile(md) | retu
en
@ -1161,7 +1164,7 @@ fu! s:AcceptSelection(action)
let actfunc = s:openfunc[s:ctype]
let type = has_key(s:openfunc, 'arg_type') ? s:openfunc['arg_type'] : 'list'
el
if s:itemtype < 3
if s:itemtype < len(s:coretypes)
let [actfunc, type] = ['ctrlp#acceptfile', 'dict']
el
let [actfunc, exttype] = [s:getextvar('accept'), s:getextvar('act_farg')]
@ -1206,15 +1209,16 @@ fu! s:CreateNewFile(...)
endf
" * OpenMulti() {{{1
fu! s:MarkToOpen()
let ct = s:curtype()
if s:bufnr <= 0 || s:opmul == '0'
\ || ( s:itemtype > 2 && s:getextvar('opmul') != 1 )
\ || ( s:itemtype >= len(s:coretypes) && s:getextvar('opmul') != 1 )
retu
en
let line = ctrlp#getcline()
" Do not allow to mark modified or current buffer
let bufnr = s:bufnrfilpath(line)[0]
if (s:itemtype == 1 && s:delbufcond(bufnr))
if (ct == 'buf' && s:delbufcond(bufnr))
retu
en
@ -1247,7 +1251,7 @@ endf
fu! s:OpenMulti(...)
let has_marked = exists('s:marked')
if ( !has_marked && a:0 ) || s:opmul == '0' || !s:ispath
\ || ( s:itemtype > 2 && s:getextvar('opmul') != 1 )
\ || ( s:itemtype >= len(s:coretypes) && s:getextvar('opmul') != 1 )
retu -1
en
" Get the options
@ -1442,7 +1446,8 @@ fu! s:shortest(lens)
endf
fu! s:mixedsort(...)
if s:itemtype == 1
let ct = s:curtype()
if ct == 'buf'
let pat = '[\/]\?\[\d\+\*No Name\]$'
if a:1 =~# pat && a:2 =~# pat | retu 0
elsei a:1 =~# pat | retu 1
@ -1453,10 +1458,10 @@ fu! s:mixedsort(...)
let ms = []
if s:res_count < 21
let ms += [s:compfnlen(a:1, a:2)]
if s:itemtype !~ '^[12]$' | let ms += [s:comptime(a:1, a:2)] | en
if ct !~ '^\(buf\|mru\)$' | let ms += [s:comptime(a:1, a:2)] | en
if !s:itemtype | let ms += [s:comparent(a:1, a:2)] | en
en
if s:itemtype =~ '^[12]$'
if ct =~ '^\(buf\|mru\)$'
let ms += [s:compmref(a:1, a:2)]
let cln = cml ? cln : 0
en
@ -1540,7 +1545,8 @@ endf
" Line formatting {{{3
fu! s:formatline(str)
let str = a:str
if s:itemtype == 1
let ct = s:curtype()
if ct == 'buf'
let bufnr = s:bufnrfilpath(str)[0]
let parts = s:bufparts(bufnr)
let str = printf('%'.s:bufnr_width.'s', bufnr)
@ -1560,7 +1566,7 @@ fu! s:formatline(str)
en
en
en
let cond = s:itemtype != 1 &&s:ispath && ( s:winw - 4 ) < s:strwidth(str)
let cond = ct != 'buf' &&s:ispath && ( s:winw - 4 ) < s:strwidth(str)
retu s:lineprefix.( cond ? s:pathshorten(str) : str )
endf
@ -1615,7 +1621,7 @@ fu! s:lash(...)
endf
fu! s:ispathitem()
retu s:itemtype < 3 || ( s:itemtype > 2 && s:getextvar('type') == 'path' )
retu s:itemtype < len(s:coretypes) || s:getextvar('type') == 'path'
endf
fu! ctrlp#igncwd(cwd)
@ -1649,11 +1655,11 @@ fu! ctrlp#dirnfile(entries)
endf
fu! s:usrign(item, type)
if s:igntype == 1 | retu a:item =~ s:usrign | end
if s:igntype == 1 | retu a:item =~ s:usrign | en
if s:igntype == 2
if call(s:usrign, [a:item, a:type])
retu 1
end
en
elsei s:igntype == 4
if has_key(s:usrign, a:type) && s:usrign[a:type] != ''
\ && a:item =~ s:usrign[a:type]
@ -1661,8 +1667,8 @@ fu! s:usrign(item, type)
elsei has_key(s:usrign, 'func') && s:usrign['func'] != ''
\ && call(s:usrign['func'], [a:item, a:type])
retu 1
end
end
en
en
retu 0
endf
@ -1772,7 +1778,7 @@ fu! ctrlp#syntax()
exe "sy match CtrlPLinePre '^".escape(get(g:, 'ctrlp_line_prefix', '>'),'^$.*~\')."'"
en
if s:itemtype == 1 && s:has_conceal
if s:curtype() == 'buf' && s:has_conceal
sy region CtrlPBufferNr matchgroup=CtrlPLinePre start='^>\s\+' end='\s'
sy region CtrlPBufferInd concealends matchgroup=Ignore start='<bi>' end='</bi>'
sy region CtrlPBufferRegion concealends matchgroup=Ignore start='<bn>' end='</bn>'
@ -1810,7 +1816,7 @@ fu! s:highlight(pat, grp)
if s:byfname()
" Make sure there are no slashes in our match
let beginning = beginning.'\([^\/]*$\)\@='
end
en
for i in range(len(chars))
" Surround our current target letter with \zs and \ze so it only
@ -1822,14 +1828,14 @@ fu! s:highlight(pat, grp)
if i == 0
let charcopy[i] = '\zs'.charcopy[i].'\ze'
let middle = join(charcopy, '.\{-}')
else
el
let before = join(charcopy[0:i-1], '.\{-}')
let after = join(charcopy[i+1:-1], '.\{-}')
let c = charcopy[i]
" for abc, match either ab.\{-}c or a.*b.\{-}c in that order
let cpat = '\(\zs'.c.'\|'.'.*\zs'.c.'\)\ze.*'
let middle = before.cpat.after
endif
en
" Now we matchadd for each letter, the basic form being:
" ^.*\zsx\ze.*$, but with our pattern we built above for the letter,
@ -1956,7 +1962,7 @@ fu! s:isabs(path)
endf
fu! s:bufnrfilpath(line)
if s:isabs(a:line) || a:line =~ '^\~[/\\]' || a:line =~ '^\w\+:\/\/'
if s:isabs(a:line) || a:line =~ '^\~[/\\]'
let filpath = a:line
el
let filpath = s:dyncwd.s:lash().a:line
@ -2140,12 +2146,13 @@ fu! s:modevar()
endf
fu! s:nosort()
retu s:matcher != {} || s:nolim == 1 || ( s:itemtype == 2 && s:mrudef )
\ || ( s:itemtype =~ '\v^(1|2)$' && s:prompt == ['', '', ''] ) || !s:dosort
let ct = s:curtype()
retu s:matcher != {} || s:nolim == 1 || ( ct == 'mru' && s:mrudef )
\ || ( ct =~ '^\(buf\|mru\)$' && s:prompt == ['', '', ''] ) || !s:dosort
endf
fu! s:byfname()
retu s:itemtype != 1 && s:ispath && s:byfname
retu s:curtype() != 'buf' && s:ispath && s:byfname
endf
fu! s:narrowable()
@ -2374,13 +2381,17 @@ fu! s:buildpat(lst)
retu pat
endf
fu! s:curtype()
return s:CurTypeName()[1]
endf
fu! s:mfunc()
let mfunc = 'match'
if s:byfname()
let mfunc = 's:matchfname'
elsei s:itemtype == 1
elsei s:curtype() == 'buf'
let mfunc = 's:matchbuf'
elsei s:itemtype > 2
elsei s:itemtype >= len(s:coretypes)
let matchtypes = { 'tabs': 's:matchtabs', 'tabe': 's:matchtabe' }
if has_key(matchtypes, s:matchtype)
let mfunc = matchtypes[s:matchtype]
@ -2439,7 +2450,7 @@ fu! s:insertcache(str)
endf
" Extensions {{{2
fu! s:mtype()
retu s:itemtype > 2 ? s:getextvar('type') : 'path'
retu s:itemtype >= len(s:coretypes) ? s:getextvar('type') : 'path'
endf
fu! s:execextvar(key)
@ -2450,8 +2461,8 @@ fu! s:execextvar(key)
endf
fu! s:getextvar(key)
if s:itemtype > 2
let vars = g:ctrlp_ext_vars[s:itemtype - 3]
if s:itemtype >= len(s:coretypes) && len(g:ctrlp_ext_vars) > 0
let vars = g:ctrlp_ext_vars[s:itemtype - len(s:coretypes)]
retu has_key(vars, a:key) ? vars[a:key] : -1
en
retu get(g:, 'ctrlp_' . s:matchtype . '_' . a:key, -1)
@ -2505,7 +2516,8 @@ endf
fu! ctrlp#setlines(...)
if a:0 | let s:itemtype = a:1 | en
cal s:modevar()
let types = ['ctrlp#files()', 'ctrlp#buffers()', 'ctrlp#mrufiles#list()']
let inits = {'fil': 'ctrlp#files()', 'buf': 'ctrlp#buffers()', 'mru': 'ctrlp#mrufiles#list()'}
let types = map(copy(g:ctrlp_types), 'inits[v:val]')
if !empty(g:ctrlp_ext_vars)
cal map(copy(g:ctrlp_ext_vars), 'add(types, v:val["init"])')
en
@ -2514,11 +2526,11 @@ endf
" Returns [lname, sname]
fu! s:CurTypeName()
if s:itemtype < 3
return s:coretypes[s:itemtype]
else
if s:itemtype < len(s:coretypes)
return filter(copy(s:coretypes), 'v:val[1]==g:ctrlp_types[s:itemtype]')[0]
el
return [s:getextvar("lname"), s:getextvar('sname')]
endif
en
endfu
fu! s:ExitIfSingleCandidate()
@ -2526,7 +2538,7 @@ fu! s:ExitIfSingleCandidate()
call s:AcceptSelection('e')
call ctrlp#exit()
return 1
endif
en
return 0
endfu
@ -2539,14 +2551,23 @@ fu! ctrlp#init(type, ...)
cal s:SetWD(a:0 ? a:1 : {})
cal s:MapNorms()
cal s:MapSpecs()
cal ctrlp#setlines(s:settype(a:type))
if type(a:type) == 0
let type = a:type
el
let type = index(g:ctrlp_types, a:type)
if type == -1
call ctrlp#exit()
retu
en
en
cal ctrlp#setlines(s:settype(type))
cal ctrlp#syntax()
cal s:SetDefTxt()
let curName = s:CurTypeName()
let shouldExitSingle = index(s:opensingle, curName[0])>=0 || index(s:opensingle, curName[1])>=0
if shouldExitSingle && s:ExitIfSingleCandidate()
return 0
endif
en
cal s:BuildPrompt(1)
if s:keyloop | cal s:KeyLoop() | en
return 1

View file

@ -68,6 +68,7 @@ Overview:~
|ctrlp_open_single_match|.....Automatically accept when only one candidate.
|ctrlp_brief_prompt|..........Exit CtrlP on empty prompt by <bs>.
|ctrlp_match_current_file|....Include current file in match entries.
|ctrlp_types|.................Names of builtin types.
MRU mode:
|ctrlp_mruf_max|..............Max MRU entries to remember.
@ -454,13 +455,19 @@ This option works well together with |g:ctrlp_open_single_match|
*'g:ctrlp_match_current_file'*
Includes the current file in the match entries:
Includes the current file in the match entries: >
let g:ctrlp_match_current_file = 1
By default, the current file is excluded from the list.
Note: does not apply when |g:ctrlp_match_func| is used.
*'g:ctrlp_types'*
Set this to list of names to customize core types: >
let g:ctrlp_types = ['mru', 'fil']
By default, the types are: >
let g:ctrlp_types = ['fil', 'buf', 'mru'].
*'g:ctrlp_abbrev'*
Define input abbreviations that can be expanded (either internally or visibly)

View file

@ -10,17 +10,23 @@ if ( exists('g:loaded_ctrlp') && g:loaded_ctrlp ) || v:version < 700 || &cp
en
let g:loaded_ctrlp = 1
let s:types = ['fil', 'buf', 'mru']
if !exists('g:ctrlp_types')
let g:ctrlp_types = s:types
el
call filter(g:ctrlp_types, "index(['fil', 'buf', 'mru'], v:val)!=-1")
en
let [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags, g:ctrlp_alldirs,
\ g:ctrlp_allmixes, g:ctrlp_buftags, g:ctrlp_ext_vars, g:ctrlp_builtins]
\ = [[], [], [], [], {}, {}, [], 2]
\ = [[], [], [], [], {}, {}, [], len(g:ctrlp_types)-1]
if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
com! -n=? -com=dir CtrlP cal ctrlp#init(0, { 'dir': <q-args> })
com! -n=? -com=dir CtrlPMRUFiles cal ctrlp#init(2, { 'dir': <q-args> })
com! -n=? -com=dir CtrlP cal ctrlp#init('fil', { 'dir': <q-args> })
com! -n=? -com=dir CtrlPMRUFiles cal ctrlp#init('mru', { 'dir': <q-args> })
com! -bar CtrlPBuffer cal ctrlp#init(1)
com! -bar CtrlPBuffer cal ctrlp#init('buf')
com! -n=? CtrlPLastMode cal ctrlp#init(-1, { 'args': <q-args> })
com! -bar CtrlPClearCache cal ctrlp#clr()
@ -29,9 +35,9 @@ com! -bar CtrlPClearAllCaches cal ctrlp#clra()
com! -bar ClearCtrlPCache cal ctrlp#clr()
com! -bar ClearAllCtrlPCaches cal ctrlp#clra()
com! -bar CtrlPCurWD cal ctrlp#init(0, { 'mode': '' })
com! -bar CtrlPCurFile cal ctrlp#init(0, { 'mode': 'c' })
com! -bar CtrlPRoot cal ctrlp#init(0, { 'mode': 'r' })
com! -bar CtrlPCurWD cal ctrlp#init('fil', { 'mode': '' })
com! -bar CtrlPCurFile cal ctrlp#init('fil', { 'mode': 'c' })
com! -bar CtrlPRoot cal ctrlp#init('fil', { 'mode': 'r' })
exe 'nn <silent> <plug>(ctrlp) :<c-u>'.g:ctrlp_cmd.'<cr>'
@ -55,10 +61,10 @@ com! -bar CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
com! -bar CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
com! -n=? -com=buffer CtrlPLine
\ cal ctrlp#init(ctrlp#line#cmd(1, <q-args>))
\ cal ctrlp#init(ctrlp#line#cmd('buf', <q-args>))
com! -n=? -com=buffer CtrlPChange
\ cal ctrlp#init(ctrlp#changes#cmd(0, <q-args>))
\ cal ctrlp#init(ctrlp#changes#cmd('fil', <q-args>))
com! -bar CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1))
com! -bar CtrlPMixed cal ctrlp#init(ctrlp#mixed#id())

View file

@ -30,16 +30,17 @@
4.4. [Are there any local checkers for HTML5 that I can use with syntastic?](#faqhtml5)
4.5. [The `perl` checker has stopped working...](#faqperl)
4.6. [What happened to the `rustc` checker?](#faqrust)
4.7. [What happened to the `xcrun` checker?](#faqxcrun)
4.8. [I run a checker and the location list is not updated...](#faqloclist)
4.8. [I run`:lopen` or `:lwindow` and the error window is empty...](#faqloclist)
4.9. [How can I pass additional arguments to a checker?](#faqargs)
4.10. [Syntastic supports several checkers for my filetype - how do I tell which one(s) to use?](#faqcheckers)
4.11. [What is the difference between syntax checkers and style checkers?](#faqstyle)
4.12. [I have enabled multiple checkers for the current filetype. How can I display all errors from all checkers together?](#faqaggregate)
4.13. [How can I jump between the different errors without using the location list at the bottom of the window?](#faqlnext)
4.14. [My favourite checker needs to load a configuration file from the project's root rather than the current directory...](#faqconfig)
4.15. [The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?](#faqbdelete)
4.7. [What happened to the `tsc` checker?](#faqtsc)
4.8. [What happened to the `xcrun` checker?](#faqxcrun)
4.9. [I run a checker and the location list is not updated...](#faqloclist)
4.9. [I run`:lopen` or `:lwindow` and the error window is empty...](#faqloclist)
4.10. [How can I pass additional arguments to a checker?](#faqargs)
4.11. [Syntastic supports several checkers for my filetype - how do I tell which one(s) to use?](#faqcheckers)
4.12. [What is the difference between syntax checkers and style checkers?](#faqstyle)
4.13. [I have enabled multiple checkers for the current filetype. How can I display all errors from all checkers together?](#faqaggregate)
4.14. [How can I jump between the different errors without using the location list at the bottom of the window?](#faqlnext)
4.15. [My favourite checker needs to load a configuration file from the project's root rather than the current directory...](#faqconfig)
4.16. [The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?](#faqbdelete)
5. [Resources](#otherresources)
- - -
@ -54,26 +55,26 @@ can be done on demand, or automatically as files are saved. If syntax errors
are detected, the user is notified and is happy because they didn't have to
compile their code or execute their script to find them.
At the time of this writing, syntastic has checking plugins for ActionScript,
Ada, Ansible configurations, API Blueprint, AppleScript, AsciiDoc, Assembly
languages, BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal, Chef, CoffeeScript,
Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dockerfile, 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, Markdown, MATLAB, Mercury, NASM, Nix,
Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable
Object, OS X and iOS property lists, Pug (formerly Jade), Puppet, Python,
QML, R, Racket, RDF TriG, RDF Turtle, Relax NG, reStructuredText, RPM spec,
Ruby, SASS/SCSS, Scala, Slim, SML, Sphinx, SQL, Stylus, Tcl, TeX, Texinfo,
Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT, XQuery,
YACC, YAML, YANG data models, z80, Zope page templates, and Zsh. See the
[manual][checkers] for details about the corresponding supported checkers
(`:help syntastic-checkers` in Vim).
At the time of this writing, syntastic has checking plugins for ACPI
Source Language, ActionScript, Ada, Ansible configurations, API Blueprint,
AppleScript, AsciiDoc, Assembly languages, BEMHTML, Bro, Bourne shell, C,
C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart,
DocBook, Dockerfile, 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, Markdown,
MATLAB, Mercury, NASM, Nix, Objective-C, Objective-C++, OCaml, Perl, Perl
POD, PHP, gettext Portable Object, OS X and iOS property lists, Pug (formerly
Jade), Puppet, Python, QML, R, Racket, RDF TriG, RDF Turtle, Relax NG,
reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Sphinx, SQL,
Stylus, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml,
XML, XSLT, XQuery, YACC, YAML, YANG data models, z80, Zope page templates, and
Zsh. See the [manual][checkers] for details about the corresponding supported
checkers (`:help syntastic-checkers` in Vim).
A number of third-party Vim plugins also provide checkers for syntastic,
for example: [merlin][merlin], [omnisharp-vim][omnisharp], [rust.vim][rust],
[syntastic-extras][myint], [syntastic-more][roktas], [vim-crystal][crystal],
[vim-eastwood][eastwood], and [vim-swift][swift].
A number of third-party Vim plugins also provide checkers for syntastic, for
example: [merlin][merlin], [omnisharp-vim][omnisharp], [rust.vim][rust],
[syntastic-extras][myint], [syntastic-more][roktas], [tsuquyomi][tsuquyomi],
[vim-crystal][crystal], [vim-eastwood][eastwood], and [vim-swift][swift].
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
@ -303,9 +304,17 @@ __4.6. Q. What happened to the `rustc` checker?__
A. It is now part of the [rust.vim][rust] plugin. If you install this plugin the
checker should be picked up automatically by syntastic.
<a name="faqtsc"></a>
__4.7. Q. What happened to the `tsc` checker?__
A. It didn't meet people's expectations and it has been removed. Please
consider using the external checker [tsuquyomi][tsuquyomi] instead. If you
install this plugin the checker should be picked up automatically by syntastic.
<a name="faqxcrun"></a>
__4.7. Q. What happened to the `xcrun` checker?__
__4.8. Q. What happened to the `xcrun` checker?__
A. The `xcrun` checker used to have a security problem and it has been removed.
A better checker for __Swift__ is part of the [vim-swift][swift] plugin. If you
@ -313,8 +322,8 @@ install this plugin the checker should be picked up automatically by syntastic.
<a name="faqloclist"></a>
__4.8. Q. I run a checker and the location list is not updated...__
__4.8. Q. I run`:lopen` or `:lwindow` and the error window is empty...__
__4.9. Q. I run a checker and the location list is not updated...__
__4.9. 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
@ -326,7 +335,7 @@ let g:syntastic_always_populate_loc_list = 1
<a name="faqargs"></a>
__4.9. Q. How can I pass additional arguments to a checker?__
__4.10. Q. How can I pass additional arguments to a checker?__
A. Almost all syntax checkers use the `makeprgBuild()` function. Those checkers
that do can be configured using global variables. The general form of the
@ -342,7 +351,7 @@ See `:help syntastic-checker-options` for more information.
<a name="faqcheckers"></a>
__4.10. Q. Syntastic supports several checkers for my filetype - how do I tell it
__4.11. Q. Syntastic supports several checkers for my filetype - how do I tell it
which one(s) to use?__
A. Stick a line like this in your `vimrc`:
@ -383,7 +392,7 @@ filetype of the current file is `php`).
<a name="faqstyle"></a>
__4.11. Q. What is the difference between syntax checkers and style checkers?__
__4.12. 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
@ -413,7 +422,7 @@ See `:help syntastic_quiet_messages` for details.
<a name="faqaggregate"></a>
__4.12. Q. I have enabled multiple checkers for the current filetype. How can I
__4.13. Q. I have enabled multiple checkers for the current filetype. How can I
display all errors from all checkers together?__
A. Set `g:syntastic_aggregate_errors` to 1 in your `vimrc`:
@ -425,7 +434,7 @@ See `:help syntastic-aggregating-errors` for more details.
<a name="faqlnext"></a>
__4.13. Q. How can I jump between the different errors without using the location
__4.14. 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
@ -437,7 +446,7 @@ mappings (among other things).
<a name="faqconfig"></a>
__4.14. My favourite checker needs to load a configuration file from the
__4.15. My favourite checker needs to load a configuration file from the
project's root rather than the current directory...__
A. You can set up an `autocmd` to search for the configuration file in the
@ -456,7 +465,7 @@ autocmd FileType javascript let b:syntastic_javascript_jscs_args =
```
<a name="faqbdelete"></a>
__4.15. Q. The error window is closed automatically when I :quit the current buffer
__4.16. Q. The error window is closed automatically when I :quit the current buffer
but not when I :bdelete it?__
A. There is no safe way to handle that situation automatically, but you can
@ -510,6 +519,7 @@ a look at [ghcmod-vim][ghcmod], [jedi-vim][jedi], [python-mode][python_mode], [v
[swift]: https://github.com/kballard/vim-swift
[tidy]: http://www.htacg.org/tidy-html5/
[tidy_old]: http://tidy.sourceforge.net/
[tsuquyomi]: https://github.com/Quramy/tsuquyomi/
[unimpaired]: https://github.com/tpope/vim-unimpaired
[vam]: https://github.com/MarcWeber/vim-addon-manager
[vim]: http://www.vim.org/

View file

@ -6,6 +6,7 @@ SYNTAX CHECKERS BY LANGUAGE *syntastic-checkers-lang*
|syntastic| comes with checkers for the following languages:
ACPI Source Language.....................|syntastic-checkers-asl|
ActionScript.............................|syntastic-checkers-actionscript|
Ada......................................|syntastic-checkers-ada|
Ansible..................................|syntastic-checkers-ansible|
@ -132,6 +133,37 @@ SYNTAX CHECKERS BY LANGUAGE *syntastic-checkers-lang*
Third-party checkers are available for additional languages.
==============================================================================
SYNTAX CHECKERS FOR ACPI SOURCE LANGUAGE *syntastic-checkers-asl*
The following checkers are available for the ACPI Source Language (filetype
"asl"):
1. iasl.....................|syntastic-asl-iasl|
------------------------------------------------------------------------------
1. iasl *syntastic-asl-iasl*
Name: iasl
Maintainer: Peter Wu <peter@lekensteyn.nl>
"iasl" is a compiler/decompiler for ACPI Source Language (ASL) and ACPI
Machine Language (AML). See the project's page for details:
https://acpica.org/
Checker options~
This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|.
Note~
You probably also need a plugin to set |filetype| for ASL files, such as
"vim-acpi-asl":
https://github.com/martinlroth/vim-acpi-asl
==============================================================================
SYNTAX CHECKERS FOR ACTIONSCRIPT *syntastic-checkers-actionscript*
@ -344,7 +376,7 @@ accepts the standard options described at |syntastic-config-makeprg|.
==============================================================================
SYNTAX CHECKERS FOR ASSEMBLY LANGUAGES *syntastic-checkers-asm*
The following checkers are available for asembly languages (filetype "asm"):
The following checkers are available for assembly languages (filetype "asm"):
1. GCC......................|syntastic-asm-gcc|
@ -432,7 +464,7 @@ The following checkers are available for BEMHTML (filetype "bemhtml"):
Name: bemhtmllint
Maintainer: Sergej Tatarincev
BEMHTML is a template engine intended for using with BEM methodology
BEMHTML is a template engine intended for using with the BEM methodology
(http://bem.info/method/). See the project's page at GitHub for details:
https://github.com/SevInf/bemhtml-lint
@ -492,9 +524,9 @@ Checker options~
This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|.
Aditionally:
Additionally:
*g:syntastic_avrgcc_config_file*
*'g:syntastic_avrgcc_config_file'*
Type: string
Default: ".syntastic_avrgcc_config"
File containing compilation flags (such as defines or include directories),
@ -895,17 +927,39 @@ SYNTAX CHECKERS FOR C++ *syntastic-checkers-cpp*
The following checkers are available for C++ (filetype "cpp"):
1. ClangCheck...............|syntastic-cpp-clang_check|
2. Clang-Tidy...............|syntastic-cpp-clang_tidy|
3. Cppcheck.................|syntastic-cpp-cppcheck|
4. Cpplint..................|syntastic-cpp-cpplint|
5. GCC......................|syntastic-cpp-gcc|
6. OClint...................|syntastic-cpp-oclint|
7. PC-Lint..................|syntastic-cpp-pc_lint|
8. Vera++...................|syntastic-cpp-verapp|
1. AVR-GCC..................|syntastic-cpp-avrgcc|
2. ClangCheck...............|syntastic-cpp-clang_check|
3. Clang-Tidy...............|syntastic-cpp-clang_tidy|
4. Cppcheck.................|syntastic-cpp-cppcheck|
5. Cpplint..................|syntastic-cpp-cpplint|
6. GCC......................|syntastic-cpp-gcc|
7. OClint...................|syntastic-cpp-oclint|
8. PC-Lint..................|syntastic-cpp-pc_lint|
9. Vera++...................|syntastic-cpp-verapp|
------------------------------------------------------------------------------
1. ClangCheck *syntastic-cpp-clang_check*
1. AVR-GCC *syntastic-cpp-avrgcc*
Name: avrgcc
Maintainer: Sławek Piotrowski <sentinel@atteo.com>
Checker options~
This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|.
Additionally:
'g:syntastic_avrgcc_config_file'
Type: string
Default: ".syntastic_avrgcc_config"
File containing compilation flags (such as defines or include directories),
one option per line (cf. |syntastic-config-files|).
See also: |syntastic-c-avrgcc|.
------------------------------------------------------------------------------
2. ClangCheck *syntastic-cpp-clang_check*
Name: clang_check
Maintainer: Benjamin Bannier <bbannier@gmail.com>
@ -948,7 +1002,7 @@ then ignored.
See also: |syntastic-c-clang_check|.
------------------------------------------------------------------------------
2. Clang-Tidy *syntastic-cpp-clang_tidy*
3. Clang-Tidy *syntastic-cpp-clang_tidy*
Name: clang_tidy
Maintainer: Benjamin Bannier <bbannier@gmail.com>
@ -999,7 +1053,7 @@ then ignored.
See also: |syntastic-c-clang_tidy|.
------------------------------------------------------------------------------
3. Cppcheck *syntastic-cpp-cppcheck*
4. Cppcheck *syntastic-cpp-cppcheck*
Name: cppcheck
Maintainer: LCD 47 <lcd047@gmail.com>
@ -1025,7 +1079,7 @@ one option per line (cf. |syntastic-config-files|).
See also: |syntastic-c-cppcheck|.
------------------------------------------------------------------------------
4. Cpplint *syntastic-cpp-cpplint*
5. Cpplint *syntastic-cpp-cpplint*
Name: cpplint
Maintainer: LCD 47 <lcd047@gmail.com>
@ -1061,7 +1115,7 @@ However, if your "cpplint" was installed with "pip", the script's name is
let g:syntastic_cpp_cpplint_exec = "cpplint"
<
------------------------------------------------------------------------------
5. GCC *syntastic-cpp-gcc*
6. GCC *syntastic-cpp-gcc*
Name: gcc
Maintainer: Gregor Uhlenheuer <kongo2002@gmail.com>
@ -1158,7 +1212,7 @@ executable.
See also: |syntastic-c-gcc|.
------------------------------------------------------------------------------
6. OClint *syntastic-cpp-oclint*
7. OClint *syntastic-cpp-oclint*
Name: oclint
Maintainer: "UnCO" Lin <undercooled@lavabit.com>
@ -1198,7 +1252,7 @@ Config files pointed to by 'g:syntastic_oclint_config_file' are then ignored.
See also: |syntastic-c-oclint|.
------------------------------------------------------------------------------
7. PC-Lint *syntastic-cpp-pc_lint*
8. PC-Lint *syntastic-cpp-pc_lint*
Name: pc_lint
Maintainer: Steve Bragg <steve@empresseffects.com>
@ -1225,7 +1279,7 @@ current directory and in parent directories; first such file found is used.
See also: |syntastic-c-pc_lint|.
------------------------------------------------------------------------------
8. Vera++ *syntastic-cpp-verapp*
9. Vera++ *syntastic-cpp-verapp*
Name: verapp
Maintainer: Lucas Verney <phyks@phyks.me>
@ -1450,7 +1504,7 @@ The following checkers are available for Coq (filetype "coq"):
Name: coqtop
Maintainer: Matvey Aksenov <matvey.aksenov@gmail.com>
"Coqtop" is the top level intrface for Coq. See the project's page for
"Coqtop" is the top level interface for Coq. See the project's page for
details:
http://coq.inria.fr/
@ -1989,8 +2043,8 @@ Name: syntaxerl
Maintainer: locojay
"SyntaxErl" is a syntax checker for Erlang. It uses "rebar"
(https://github.com/basho/rebar) to determine correct deps and libs paths.
See the project's page for more information:
(https://github.com/basho/rebar) to determine correct dependencies and library
paths. See the project's page for more information:
https://github.com/ten0s/syntaxerl
@ -2191,7 +2245,7 @@ If the magic comment does not exist, then the dictionary
'g:syntastic_glsl_extensions' is used to infer the appropriate profile from
the current file's extension. If this dictionary does not exist either, a
default dictionary is used instead. Finally, if the current file's extension
cannott be found in these dictionaries, the checker assumes a vertex shader
cannot be found in these dictionaries, the checker assumes a vertex shader
profile.
*'g:syntastic_glsl_options'*
@ -2879,7 +2933,7 @@ point |'g:syntastic_java_checkstyle_classpath'| to it:
http://iweb.dl.sourceforge.net/project/checkstyle/checkstyle/
http://checkstyle.sourceforge.net/cmdline.html#Usage_by_Classpath_update
Current builds at Maven Central do not package "checkstyles" with its
Current builds at Maven Central do not package "checkstyle" with its
dependencies:
http://search.maven.org/#search|gav|1|g%3A%22com.puppycrawl.tools%22%20AND%20a%3A%22checkstyle%22
@ -4637,7 +4691,7 @@ Please note that transforming a file like this affects line numbers and
column numbers, and syntastic has no way to make the necessary adjustments.
Consequently, errors might appear on surprising lines if you enable this
feature and the transformed file has code on different lines than the raw
file. For this reason the use of these transformations should be limitted
file. For this reason the use of these transformations should be limited
to codecs that preserve line numbers, such as the "spec" codec provided by
"NoseOfYeti":
@ -4741,7 +4795,7 @@ setting of "lint.style".
Name: lintr
Maintainer: Jim Hester <james.f.hester@gmail.com>
"lintr" is a static code analysys tool for R files. See the project's page at
"lintr" is a static code analysis tool for R files. See the project's page at
GitHub for details:
https://github.com/jimhester/lintr
@ -4794,7 +4848,7 @@ This is a checker for R files, using the R package "svTools":
http://cran.r-project.org/web/packages/svTools/
In turn, this package delegates most of the work to the "checkUsage()"
function in the codetools package:
function in the "codetools" package:
http://cran.r-project.org/web/packages/codetools/
@ -4851,7 +4905,7 @@ The following checkers are available for R Markdown (filetype "rmd"):
Name: lintr
Maintainer: Jim Hester <james.f.hester@gmail.com>
"lintr" is a static code analysys tool for R files. See the project's page at
"lintr" is a static code analysis tool for R files. See the project's page at
GitHub for details:
https://github.com/jimhester/lintr
@ -5060,7 +5114,7 @@ directory, or if you want to override the autodetected paths, options
|'g:syntastic_rst_sphinx_source_dir'| and |'g:syntastic_rst_sphinx_config_dir'|
take precedence over the detected values.
Please not also that the checker creates output files in a temporary directory
Please note also that the checker creates output files in a temporary directory
that is created upon the first run in the current session, and is removed when
Vim exits. If you need to change the location of this directory you can do
so by exporting the environment variables "TMPDIR" or "TMP" (on UNIX and Mac
@ -5081,7 +5135,7 @@ The following checkers are available for Linux RPM packages (filetype "spec"):
Name: rpmlint
Maintainer: LCD 47 <lcd047@gmail.com>
"rpmlint" is a trool for checking Linux RPM packages. See the project's page
"rpmlint" is a tool for checking Linux RPM packages. See the project's page
for details:
http://sourceforge.net/projects/rpmlint/
@ -5165,7 +5219,7 @@ Name: macruby
Maintainer: Martin Grenfell <martin.grenfell@gmail.com>
"MacRuby" is an implementation of Ruby for Mac OS X. See the project's
pagefor details:
page for details:
http://www.macruby.org/
@ -5864,7 +5918,7 @@ The following checkers are available for Texinfo (filetype "texinfo"):
Name: makeinfo
Maintainer: LCD 47 <lcd047@gmail.com>
"Makeinfo" is a convertor for Texinfo files. It is distributed together with
"Makeinfo" is a converter for Texinfo files. It is distributed together with
the GNU package "texinfo":
http://www.gnu.org/software/texinfo/
@ -6087,8 +6141,7 @@ SYNTAX CHECKERS FOR TYPESCRIPT *syntastic-checkers-typescript*
The following checkers are available for TypeScript (filetype "typescript"):
1. ESLint...................|syntastic-typescript-eslint|
2. tsc......................|syntastic-typescript-tsc|
3. TSLint...................|syntastic-typescript-tslint|
2. TSLint...................|syntastic-typescript-tslint|
------------------------------------------------------------------------------
1. ESLint *syntastic-typescript-eslint*
@ -6118,29 +6171,7 @@ as "typescript-vim":
See also: |syntastic-html-eslint|, |syntastic-javascript-eslint|.
------------------------------------------------------------------------------
2. tsc *syntastic-typescript-tsc*
Name: tsc
Maintainer: Bill Casarin <bill@casarin.ca>
"tsc" is a compiler for TypeScript. See the project's page for details:
http://www.typescriptlang.org/
Checker options~
This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|.
Note~
You probably also need a plugin to set |filetype| for TypeScript files, such
as "typescript-vim":
https://github.com/leafgarland/typescript-vim
------------------------------------------------------------------------------
3. TSLint *syntastic-typescript-tslint*
2. TSLint *syntastic-typescript-tslint*
Name: tslint
Maintainer: Seon-Wook Park <seon.wook@swook.net>
@ -6861,6 +6892,7 @@ syntastic-specific configuration files:
OpenCOBOL (|syntastic-cobol-cobc|)
C++~
AVR-GCC (|syntastic-cpp-avrgcc|)
ClangCheck (|syntastic-cpp-clang_check|)
Clang-Tidy (|syntastic-cpp-clang_tidy|)
Cppcheck (|syntastic-cpp-cppcheck|)

View file

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START
endif
let g:_SYNTASTIC_VERSION = '3.7.0-162'
let g:_SYNTASTIC_VERSION = '3.7.0-177'
lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1

View file

@ -12,6 +12,7 @@ let s:_DEFAULT_CHECKERS = {
\ 'apiblueprint': ['drafter'],
\ 'applescript': ['osacompile'],
\ 'asciidoc': ['asciidoc'],
\ 'asl': ['iasl'],
\ 'asm': ['gcc'],
\ 'bro': ['bro'],
\ 'bemhtml': ['bemhtmllint'],
@ -93,7 +94,7 @@ let s:_DEFAULT_CHECKERS = {
\ 'trig': ['rapper'],
\ 'turtle': ['rapper'],
\ 'twig': ['twiglint'],
\ 'typescript': ['tsc'],
\ 'typescript': [],
\ 'vala': ['valac'],
\ 'verilog': ['verilator'],
\ 'vhdl': ['ghdl'],

View file

@ -0,0 +1,59 @@
"============================================================================
"File: iasl.vim
"Description: Syntax checking plugin for syntastic using iasl
"Maintainer: Peter Wu <peter@lekensteyn.nl>
"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_asl_iasl_checker')
finish
endif
let g:loaded_syntastic_asl_iasl_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_asl_iasl_GetLocList() dict
let tmpdir = syntastic#util#tmpdir() . syntastic#util#Slash()
let makeprg = self.makeprgBuild({
\ 'args': '-vi',
\ 'args_after': ['-p', tmpdir] })
let errorformat =
\ '%f(%l) : %trror %n - %m,' .
\ '%f(%l) : %tarning %n - %m,' .
\ '%f(%l) : %temark %n - %m,' .
\ '%f(%l) : %tptimize %n - %m,' .
\ '%f(%l) : %m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'returns': [0, 255] })
for e in loclist
if e['type'] =~? 'r'
let e['type'] = 'W'
elseif e['type'] =~? 'o'
let e['type'] = 'W'
let e['subtype'] = 'Style'
endif
endfor
call syntastic#util#rmrf(tmpdir)
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'asl',
\ 'name': 'iasl'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View file

@ -1,6 +1,6 @@
"============================================================================
"File: avrgcc.vim
"Description: Syntax checking plugin for syntastic.vim
"Description: Syntax checking plugin for syntastic
"Maintainer: Karel <karelishere 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
@ -22,10 +22,12 @@ endif
let s:save_cpo = &cpo
set cpo&vim
let s:opt_x = { 'c': 'c', 'cpp': 'c++' }
function! SyntaxCheckers_c_avrgcc_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_before': syntastic#c#ReadConfig(g:syntastic_avrgcc_config_file),
\ 'args_after': '-x c -fsyntax-only' })
\ 'args_after': '-x ' . get(s:opt_x, self.getFiletype(), '') . ' -fsyntax-only' })
let errorformat =
\ '%-G%f:%s:,' .

View file

@ -0,0 +1,24 @@
"============================================================================
"File: avrgcc.vim
"Description: Syntax checking plugin for syntastic
"Maintainer: Sławek Piotrowski <sentinel at atteo 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_avrgcc_checker')
finish
endif
let g:loaded_syntastic_cpp_avrgcc_checker = 1
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'avrgcc',
\ 'exec': 'avr-g++',
\ 'redirect': 'c/avrgcc'})
" vim: set sw=4 sts=4 et fdm=marker:

View file

@ -1,66 +0,0 @@
"============================================================================
"File: tsc.vim
"Description: TypeScript syntax checker
"Maintainer: Bill Casarin <bill@casarin.ca>
"
"============================================================================
if exists('g:loaded_syntastic_typescript_tsc_checker')
finish
endif
let g:loaded_syntastic_typescript_tsc_checker = 1
if !exists('g:syntastic_typescript_tsc_sort')
let g:syntastic_typescript_tsc_sort = 1
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_typescript_tsc_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
let version_output = split(syntastic#util#system(self.getExecEscaped() . ' --version'), '\n', 1)
let ver = filter(copy(version_output), 'v:val =~# ''\m\<Version ''')
let parsed_ver = len(ver) ? syntastic#util#parseVersion(ver[0], '\v<Version \zs\d+(\.\d+)\ze') : []
if len(parsed_ver)
call self.setVersion(parsed_ver)
let s:tsc_new = syntastic#util#versionIsAtLeast(parsed_ver, [1, 5])
else
call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', version_output)
call syntastic#log#error("checker typescript/tsc: can't parse version string (abnormal termination?)")
let s:tsc_new = -1
endif
return s:tsc_new >= 0
endfunction
function! SyntaxCheckers_typescript_tsc_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args': '--module commonjs',
\ 'args_after': (s:tsc_new ? '--noEmit' : '--out ' . syntastic#util#DevNull()) })
let errorformat =
\ '%E%f %#(%l\,%c): error %m,' .
\ '%E%f %#(%l\,%c): %m,' .
\ '%Eerror %m,' .
\ '%C%\s%\+%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['guards'],
\ 'defaults': {'bufnr': bufnr('')} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'typescript',
\ 'name': 'tsc'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View file

@ -41,7 +41,7 @@ the `<F7>` key if so. For example, to remap it to `<F3>` instead, use:
For flake8 configuration options please consult the following page:
https://flake8.readthedocs.org/en/latest/config.html
http://flake8.pycqa.org/en/latest/user/configuration.html
To customize the location of your flake8 binary, set `g:flake8_cmd`:

View file

@ -1,17 +1,45 @@
## 1.8 (unplanned)
## Unplanned
IMPROVEMENTS:
* **guru** uses now the `-modified` flag, which allows us use guru on modified
buffers as well. This affects all commands where `guru` is used. Such as
`:GoDef`, `:GoReferrers`, etc.. [gh-944]
* Cleanup and improve documentation [gh-987]
BUG FIXES:
* Fix system calls on Windows [gh-988]
## 1.8 (July 31, 2016)
FEATURES:
* If you open a new buffer with a Go filename it get automatically populated based on the directory. If there are no Go files a simple main package is created, otherwise the file will include the package declaration line based on the package in the current directory. Checkout the demo to see it in action: https://twitter.com/fatih/status/748333086643994624. This is enabled by default. Can be disabled with `let g:go_template_autocreate = 0`. You can use your own template with `let g:go_template_file = "foo.go"` and putting the file under the `templates/` folder. [gh-918]
* The snippet expansion `json` is now much more smarter. It pre populates the placeholder according to the first word and it also applies `snake_case` or `camelCase` conversion. Checkout the demo to see it in action: https://github.com/fatih/vim-go/pull/927 [gh-927]
* **`:GoSameIds`** support. When called highlights all same identifiers in the current file. Can be also enabled to highlight identifiers automatically. Checkout the demo to see it in action: https://twitter.com/fatih/status/753673709278339072. [gh-936]
* New **`:GoAddTags`** command that adds field tags for the fields of a struct automatically based on the field names. Checkout the demo to see it in action: https://twitter.com/fatih/status/759822857773907968 [gh-971]
* The snippet expansion `json` is now much more smarter. It pre populates the placeholder according to the first word and it also applies `snake_case` or `camelCase` conversion. Together with `:GoAddTags` it gives `vim-go` users flexible ways of populating a field tag. Checkout the demo to see it in action: https://twitter.com/fatih/status/754477622042689536 [gh-927]
* New **`:GoSameIds`** command. When called highlights all same identifiers in the current file. Can be also enabled to highlight identifiers automatically (with `:GoSameIdsAutoToggle` or `g:go_auto_sameids`). Checkout the demo to see it in action: https://twitter.com/fatih/status/753673709278339072. [gh-936]
* New **`:GoWhicherrs`** command. It shows all possible values of the selected error variable. [gh-948]
* Add new `errp` snippet to expand an `if err != nil { panic() }` clause [gh-926]
* If you open a new buffer with a Go filename it get automatically populated based on the directory. If there are no Go files a simple main package is created, otherwise the file will include the package declaration line based on the package in the current directory. Checkout the demo to see it in action: https://twitter.com/fatih/status/748333086643994624. This is enabled by default. Can be disabled with `let g:go_template_autocreate = 0`. You can use your own template with `let g:go_template_file = "foo.go"` and putting the file under the `templates/` folder. [gh-918]
* Added new toggle commands to enable/disable feature that run for your
automatic. For example if you have `let g:go_auto_type_info = 1` enabled, you
can now easily enable/disable it on the fly. Support added with the following
commands: `:GoAutoTypeInfoToggle`, `:GoFmtAutoSaveToggle`,
`:GoAsmFmtAutoSaveToggle`, `:GoMetalinterAutoSaveToggle`,
`:GoTemplateAutoCreateToggle` [gh-945]
IMPROVEMENTS:
* `:GoDoc` accepts arguments now which are passed directly to `godoc`. So usages like `:GoDoc flag` works again (it was changed in previous versions [gh-894]
* `:GoDef` works now for modified files as well [gh-910]
* Internal: pass filename to the `--srcdir` flag to enable upcoming `goimports` features [gh-957]
* Internal: fix indentations on all files to **2-spaces/no tabs**. This is now the default vim-go style across all VimL files [gh-915]
* Internal: autocmd settings can be now dynamically enabled/disabled [gh-939]
* Internal: automatically detect `GOPATH` for :GoInstall [gh-980]
* Internal: shell executions uses now by default `sh` and then resets it back to the user preference. [gh-967]
* Syntax: improved syntax highglighting performance for methods, fields, structs and interface type declarations [gh-917]
* Syntax: moved `:GoCoverage` highlight definition into go's syntax file for more customizability [gh-962]
BUG FIXES:
@ -21,6 +49,7 @@ BUG FIXES:
* Fix `:GoFmt` not picking up `-srcdir` if the command was set to use `goimports` [gh-904]
* Fix `:GoTestCompile` to not leave behind artifacts if the cwd and the test files's directory do not match [gh-909]
* Fix `:GoDocBrowser` to not fail if godoc doesn't exist [gh-920]
* Fix `:GoFmt` to not change the permissions of saved file. Now original file permissions are restored [gh-922]
BACKWARDS INCOMPATIBILITIES:

View file

@ -50,10 +50,16 @@ disabled/enabled easily.
in their own new terminal. (beta)
* Alternate between implementation and test code with `:GoAlternate`
Checkout the official [tutorial](https://github.com/fatih/vim-go-tutorial)
that goes literally over all features and shows many tips and tricks. It shows
how to install vim-go and explains many unknown use cases. Recommended for
beginners as well as advanced users: https://github.com/fatih/vim-go-tutorial
## Install
Master branch is supposed to be a development branch. So stuff here can break and change.
Please try use always the [latest release](https://github.com/fatih/vim-go/releases/latest)
Master branch is supposed to be a development branch. So stuff here can break
and change. Please try use always the [latest
release](https://github.com/fatih/vim-go/releases/latest)
Vim-go follows the standard runtime path structure, so I highly recommend to
use a common and well known plugin manager to install vim-go. Do not use vim-go
@ -69,6 +75,8 @@ command.
* `NeoBundle 'fatih/vim-go'`
* [Vundle](https://github.com/gmarik/vundle)
* `Plugin 'fatih/vim-go'`
* [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages) (since Vim 7.4.1528)
* `git clone https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go`
Please be sure all necessary binaries are installed (such as `gocode`, `godef`,
`goimports`, etc.). You can easily install them with the included
@ -84,7 +92,8 @@ installed binaries.
completion (completion by type) install:
[neocomplete](https://github.com/Shougo/neocomplete.vim) for Vim or
[deoplete](https://github.com/Shougo/deoplete.nvim) and
[deoplete-go](https://github.com/zchee/deoplete-go) for NeoVim
[deoplete-go](https://github.com/zchee/deoplete-go) for NeoVim or
[SimpleAutoCmplPop](https://github.com/roxma/SimpleAutoComplPop)
* To display source code tag information on a sidebar install
[tagbar](https://github.com/majutsushi/tagbar).
* For snippet features install:
@ -270,7 +279,6 @@ To resolve this:
let g:go_list_type = "quickfix"
```
## More info
Check out the [Wiki](https://github.com/fatih/vim-go/wiki) page for more
@ -282,8 +290,12 @@ other [various pieces](https://github.com/fatih/vim-go/wiki) of information.
## Donation
People have asked for this for a long time, now you can be a fully supporter by
[being a patron](https://www.patreon.com/fatih)! This is fully optional and is
just a way to support vim-go's ongoing development directly. Thanks!
[being a patron](https://www.patreon.com/fatih)!
By being a patron, you are enabling vim-go to grow and mature, helping me to
invest in bug fixes, new documentation, and improving both current and future
features. It's completely optional and is just a direct way to support Vim-go's
ongoing development. Thanks!
[https://www.patreon.com/fatih](https://www.patreon.com/fatih)

View file

@ -41,7 +41,11 @@ function! go#asmfmt#Format()
" Replace the current file with the temp file; then reload the buffer.
let old_fileformat = &fileformat
" save old file permissions
let original_fperm = getfperm(expand('%'))
call rename(l:tmpname, expand('%'))
" restore old file permissions
call setfperm(expand('%'), original_fperm)
silent edit!
let &fileformat = old_fileformat
let &syntax = &syntax
@ -51,4 +55,15 @@ function! go#asmfmt#Format()
call winrestview(l:curw)
endfunction
function! go#asmfmt#ToggleAsmFmtAutoSave()
if get(g:, "go_asmfmt_autosave", 1)
let g:go_asmfmt_autosave = 0
call go#util#EchoProgress("auto asmfmt disabled")
return
end
let g:go_asmfmt_autosave = 1
call go#util#EchoProgress("auto asmfmt enabled")
endfunction
" vim: sw=2 ts=2 et

View file

@ -143,6 +143,8 @@ endfunction
" is given(which are passed directly to 'go install') it tries to install those
" packages. Errors are populated in the location window.
function! go#cmd#Install(bang, ...)
let old_gopath = $GOPATH
let $GOPATH = go#path#Detect()
let default_makeprg = &makeprg
" :make expands '%' and '#' wildcards, so they must also be escaped
@ -179,6 +181,7 @@ function! go#cmd#Install(bang, ...)
redraws! | echon "vim-go: " | echohl Function | echon "installed to ". $GOPATH | echohl None
endif
let $GOPATH = old_gopath
let &makeprg = default_makeprg
endfunction

View file

@ -153,4 +153,16 @@ function! go#complete#Complete(findstart, base)
endif
endf
function! go#complete#ToggleAutoTypeInfo()
if get(g:, "go_auto_type_info", 0)
let g:go_auto_type_info = 0
call go#util#EchoProgress("auto type info disabled")
return
end
let g:go_auto_type_info = 1
call go#util#EchoProgress("auto type info enabled")
endfunction
" vim: sw=2 ts=2 et

View file

@ -134,9 +134,9 @@ endfunction
" Generates matches to be added to matchaddpos for the given coverage profile
" block
function! go#coverage#genmatch(cov)
let color = 'covered'
let color = 'goCoverageCovered'
if a:cov.cnt == 0
let color = 'uncover'
let color = 'goCoverageUncover'
endif
let matches = []
@ -195,12 +195,12 @@ function! go#coverage#overlay(file)
" contains matches for matchaddpos()
let matches = []
" first mark all lines as normaltext. We use a custom group to not
" first mark all lines as goCoverageNormalText. We use a custom group to not
" interfere with other buffers highlightings. Because the priority is
" lower than the cover and uncover matches, it'll be overriden.
let cnt = 1
while cnt <= line('$')
call add(matches, {'group': 'normaltext', 'pos': [cnt], 'priority': 1})
call add(matches, {'group': 'goCoverageNormalText', 'pos': [cnt], 'priority': 1})
let cnt += 1
endwhile
@ -234,9 +234,6 @@ function! go#coverage#overlay(file)
endfor
syntax manual
highlight normaltext term=bold ctermfg=darkgrey guifg=#75715E
highlight covered term=bold ctermfg=green guifg=#A6E22E
highlight uncover term=bold ctermfg=red guifg=#F92672
" clear the matches if we leave the buffer
autocmd BufWinLeave <buffer> call go#coverage#Clear()

View file

@ -6,12 +6,6 @@ function! go#def#Jump(mode)
let $GOPATH = go#path#Detect()
let fname = fnamemodify(expand("%"), ':p:gs?\\?/?')
if &modified
" Write current unsaved buffer to a temp file and use the modified content
let l:tmpname = tempname()
call writefile(getline(1, '$'), l:tmpname)
let fname = l:tmpname
endif
" so guru right now is slow for some people. previously we were using
" godef which also has it's own quirks. But this issue come up so many
@ -19,6 +13,13 @@ function! go#def#Jump(mode)
" covers all edge cases, but now anyone can switch to godef if they wish
let bin_name = get(g:, 'go_def_mode', 'guru')
if bin_name == 'godef'
if &modified
" Write current unsaved buffer to a temp file and use the modified content
let l:tmpname = tempname()
call writefile(getline(1, '$'), l:tmpname)
let fname = l:tmpname
endif
let bin_path = go#path#CheckBinPath("godef")
if empty(bin_path)
let $GOPATH = old_gopath
@ -31,31 +32,45 @@ function! go#def#Jump(mode)
" jump_to_declaration() function can parse it. This makes it
" compatible with guru definition as well too
let out = join(split(out, '\n'), ':')
if exists("l:tmpname")
call delete(l:tmpname)
endif
elseif bin_name == 'guru'
let flags = ""
let in = ""
if &modified
let sep = go#util#LineEnding()
let content = join(getline(1, '$'), sep)
let in = fname . "\n" . strlen(content) . "\n" . content
let flags .= " -modified"
endif
let bin_path = go#path#CheckBinPath("guru")
if empty(bin_path)
let $GOPATH = old_gopath
return
endif
let flags = ""
if exists('g:go_guru_tags')
let tags = get(g:, 'go_guru_tags')
let flags = printf(" -tags %s", tags)
let flags .= printf(" -tags %s", tags)
endif
let fname = shellescape(fname.':#'.go#util#OffsetCursor())
let command = printf("%s %s definition %s", bin_path, flags, fname)
if &modified
let out = go#util#System(command, in)
else
let out = go#util#System(command)
endif
else
call go#util#EchoError('go_def_mode value: '. bin_name .' is not valid. Valid values are: [godef, guru]')
return
endif
if exists("l:tmpname")
call delete(l:tmpname)
endif
if go#util#ShellError() != 0
call go#util#EchoError(out)
return
@ -98,6 +113,8 @@ function! s:jump_to_declaration(out, mode)
" modes of switchbuf which we need based on the split mode
let old_switchbuf = &switchbuf
let l:fname = fnamemodify(expand("%"), ':p:gs?\\?/?')
if filename != l:fname
" jump to existing buffer if, 1. we have enabled it, 2. the buffer is loaded
" and 3. there is buffer window number we switch to
if get(g:, 'go_def_reuse_buffer', 0) && bufloaded(filename) != 0 && bufwinnr(filename) != -1
@ -112,10 +129,13 @@ function! s:jump_to_declaration(out, mode)
split
elseif a:mode == "vsplit"
vsplit
elseif &modified
split
endif
" open the file and jump to line and column
exec 'edit '.filename
endif
call cursor(line, col)
" also align the line to middle of the view

View file

@ -124,7 +124,7 @@ function! go#fmt#Format(withGoimport)
if exists('b:goimports_vendor_compatible') && b:goimports_vendor_compatible
let ssl_save = &shellslash
set noshellslash
let command = command . '-srcdir ' . shellescape(expand("%:p:h"))
let command = command . '-srcdir ' . shellescape(expand("%:p"))
let &shellslash = ssl_save
endif
endif
@ -149,7 +149,15 @@ function! go#fmt#Format(withGoimport)
" Replace current file with temp file, then reload buffer
let old_fileformat = &fileformat
if exists("*getfperm")
" save old file permissions
let original_fperm = getfperm(expand('%'))
endif
call rename(l:tmpname, expand('%'))
" restore old file permissions
if exists("*setfperm") && original_fperm != ''
call setfperm(expand('%'), original_fperm)
endif
silent edit!
let &fileformat = old_fileformat
let &syntax = &syntax
@ -207,4 +215,14 @@ function! go#fmt#Format(withGoimport)
endif
endfunction
function! go#fmt#ToggleFmtAutoSave()
if get(g:, "go_fmt_autosave", 1)
let g:go_fmt_autosave = 0
call go#util#EchoProgress("auto fmt disabled")
return
end
let g:go_fmt_autosave = 1
call go#util#EchoProgress("auto fmt enabled")
endfunction
" vim: sw=2 ts=2 et

View file

@ -1,5 +1,6 @@
" guru.vim -- Vim integration for the Go guru.
func! s:RunGuru(mode, format, selected, needs_scope) range abort
"return with a warning if the binary doesn't exist
let bin_path = go#path#CheckBinPath("guru")
@ -7,18 +8,6 @@ func! s:RunGuru(mode, format, selected, needs_scope) range abort
return {'err': "bin path not found"}
endif
let filename = fnamemodify(expand("%"), ':p:gs?\\?/?')
if !filereadable(filename)
" this might happen for new buffers which are not written yet
return {'err': "file does not exist"}
endif
if &modified
" Write current unsaved buffer to a temp file and use the modified content
let l:tmpname = tempname()
call writefile(getline(1, '$'), l:tmpname)
let filename = l:tmpname
endif
let dirname = expand('%:p:h')
let pkg = go#package#ImportPath(dirname)
@ -30,6 +19,15 @@ func! s:RunGuru(mode, format, selected, needs_scope) range abort
" start constructing the 'command' variable
let command = bin_path
let filename = fnamemodify(expand("%"), ':p:gs?\\?/?')
let in = ""
if &modified
let sep = go#util#LineEnding()
let content = join(getline(1, '$'), sep )
let in = filename . "\n" . strlen(content) . "\n" . content
let command .= " -modified"
endif
" enable outputting in json format
if a:format == "json"
let command .= " -json"
@ -72,8 +70,8 @@ func! s:RunGuru(mode, format, selected, needs_scope) range abort
let scopes = go#util#Shelllist(scopes)
" guru expect a comma-separated list of patterns, construct it
let scope = join(scopes, ",")
let command .= printf(" -scope %s", scope)
let l:scope = join(scopes, ",")
let command .= printf(" -scope %s", l:scope)
endif
let pos = printf("#%s", go#util#OffsetCursor())
@ -91,16 +89,18 @@ func! s:RunGuru(mode, format, selected, needs_scope) range abort
let old_gopath = $GOPATH
let $GOPATH = go#path#Detect()
if a:mode !=# 'what'
if a:needs_scope
call go#util#EchoProgress("analysing with scope ". l:scope . " ...")
elseif a:mode !=# 'what'
" the query might take time, let us give some feedback
call go#util#EchoProgress("analysing ...")
endif
" run, forrest run!!!
if &modified
let out = go#util#System(command, in)
else
let out = go#util#System(command)
if exists("l:tmpname")
call delete(l:tmpname)
endif
let $GOPATH = old_gopath
@ -176,6 +176,23 @@ function! go#guru#Tags(...)
endif
endfunction
" Report the possible constants, global variables, and concrete types that may
" appear in a value of type error
function! go#guru#Whicherrs(selected)
let out = s:RunGuru('whicherrs', 'plain', a:selected, 1)
if has_key(out, 'err')
call go#util#EchoError(out.err)
return
endif
if empty(out.out)
call go#util#EchoSuccess("no error variables found. Try to change the scope with :GoGuruScope")
return
endif
call s:loclistSecond(out.out)
endfunction
" Show 'implements' relation for selected package
function! go#guru#Implements(selected)
let out = s:RunGuru('implements', 'plain', a:selected, 1)
@ -271,16 +288,11 @@ function! go#guru#Referrers(selected)
endfunction
function! go#guru#What(selected)
" nvim doesn't have JSON support, though they work on it:
" https://github.com/neovim/neovim/pull/4131
if has('nvim')
return {'err': "GoWhat is not supported in Neovim"}
endif
" json_encode() and friends are introduced with this patch
" https://groups.google.com/d/msg/vim_dev/vLupTNhQhZ8/cDGIk0JEDgAJ
if !has('patch-7.4.1304')
return {'err': "GoWhat is supported with Vim version 7.4-1304 or later"}
" json_encode() and friends are introduced with this patch (7.4.1304)
" vim: https://groups.google.com/d/msg/vim_dev/vLupTNhQhZ8/cDGIk0JEDgAJ
" nvim: https://github.com/neovim/neovim/pull/4131
if !exists("*json_decode")
return {'err': "GoWhat is not supported due old version of Vim/Neovim"}
endif
let out = s:RunGuru('what', 'json', a:selected, 0)
@ -297,10 +309,29 @@ function! go#guru#What(selected)
return result
endfunction
function! go#guru#SameIds(selected)
function! go#guru#AutoToogleSameIds()
if get(g:, "go_auto_sameids", 0)
call go#util#EchoProgress("sameids auto highlighting disabled")
call go#guru#ClearSameIds()
let g:go_auto_sameids = 0
return
endif
call go#util#EchoSuccess("sameids auto highlighting enabled")
let g:go_auto_sameids = 1
endfunction
function! go#guru#SameIds(selected)
" we use matchaddpos() which was introduce with 7.4.330, be sure we have
" it: http://ftp.vim.org/vim/patches/7.4/7.4.330
if !exists("*matchaddpos")
call go#util#EchoError("GoSameIds is supported with Vim version 7.4-330 or later")
return
endif
let result = go#guru#What(a:selected)
call go#guru#ClearSameIds() " run after calling guru to reduce flicker.
if has_key(result, 'err') && !get(g:, 'go_auto_sameids', 0)
" only echo if it's called via `:GoSameIds, but not if it's in automode
call go#util#EchoError(result.err)
@ -327,8 +358,6 @@ function! go#guru#SameIds(selected)
return
endif
hi goSameId term=bold cterm=bold ctermbg=white ctermfg=black
let same_ids = result['sameids']
" highlight the lines
for item in same_ids
@ -346,4 +375,12 @@ function! go#guru#ClearSameIds()
endfor
endfunction
function! go#guru#ToggleSameIds(selected)
if len(getmatches()) != 0
call go#guru#ClearSameIds()
else
call go#guru#SameIds(a:selected)
endif
endfunction
" vim: sw=2 ts=2 et

View file

@ -71,12 +71,12 @@ endif
function! s:root_dirs()
let dirs = []
let root = go#util#GOROOT()
let root = go#util#goroot()
if root !=# '' && isdirectory(root)
call add(dirs, root)
endif
let paths = map(split(go#util#GOPATH(), go#util#PathListSep()), "substitute(v:val, '\\\\', '/', 'g')")
let paths = map(split(go#util#gopath(), go#util#PathListSep()), "substitute(v:val, '\\\\', '/', 'g')")
if go#util#ShellError()
return []
endif
@ -91,7 +91,7 @@ endfunction
function! s:go_packages(dirs)
let pkgs = []
for d in a:dirs
let pkg_root = expand(d . '/pkg/' . go#util#OSARCH())
let pkg_root = expand(d . '/pkg/' . go#util#osarch())
call extend(pkgs, split(globpath(pkg_root, '**/*.a', 1), "\n"))
endfor
return map(pkgs, "fnamemodify(v:val, ':t:r')")

View file

@ -196,4 +196,15 @@ function! go#lint#Errcheck(...) abort
endfunction
function! go#lint#ToggleMetaLinterAutoSave()
if get(g:, "go_metalinter_autosave", 0)
let g:go_metalinter_autosave = 0
call go#util#EchoProgress("auto metalinter disabled")
return
end
let g:go_metalinter_autosave = 1
call go#util#EchoProgress("auto metalinter enabled")
endfunction
" vim: sw=2 ts=2 et

View file

@ -33,7 +33,7 @@ function! go#package#Paths()
if !exists("s:goroot")
if executable('go')
let s:goroot = substitute(go#util#System('go env GOROOT'), '\n', '', 'g')
let s:goroot = go#util#goroot()
if go#util#ShellError() != 0
echomsg '''go env GOROOT'' failed'
endif

View file

@ -14,7 +14,7 @@ function! go#template#create()
if l:package_name == -1
let l:template_file = get(g:, 'go_template_file', "hello_world.go")
let l:template_path = go#util#Join(l:root_dir, "templates", l:template_file)
exe '0r ' . l:template_path
exe '0r ' . fnameescape(l:template_path)
$delete _
else
let l:content = printf("package %s", l:package_name)
@ -28,4 +28,15 @@ function! go#template#create()
execute cd . fnameescape(dir)
endfunction
function! go#template#ToggleAutoCreate()
if get(g:, "go_template_autocreate", 1)
let g:go_template_autocreate = 0
call go#util#EchoProgress("auto template create disabled")
return
end
let g:go_template_autocreate = 1
call go#util#EchoProgress("auto template create enabled")
endfunction
" vim: sw=2 ts=2 et

View file

@ -44,7 +44,7 @@ function! go#tool#Imports()
endfunction
function! go#tool#PackageName()
let command = "go list -f '{{.Name}}'"
let command = "go list -f \"{{.Name}}\""
let out = go#tool#ExecuteInDir(command)
if go#util#ShellError() != 0
return -1

View file

@ -43,27 +43,26 @@ function! go#util#IsWin()
return 0
endfunction
function! go#util#GOARCH()
function! go#util#goarch()
return substitute(go#util#System('go env GOARCH'), '\n', '', 'g')
endfunction
function! go#util#GOOS()
function! go#util#goos()
return substitute(go#util#System('go env GOOS'), '\n', '', 'g')
endfunction
function! go#util#GOROOT()
function! go#util#goroot()
return substitute(go#util#System('go env GOROOT'), '\n', '', 'g')
endfunction
function! go#util#GOPATH()
function! go#util#gopath()
return substitute(go#util#System('go env GOPATH'), '\n', '', 'g')
endfunction
function! go#util#OSARCH()
return go#util#GOOS() . '_' . go#util#GOARCH()
function! go#util#osarch()
return go#util#goos() . '_' . go#util#goarch()
endfunction
"Check if has vimproc
function! s:has_vimproc()
if !exists('g:go#use_vimproc')
@ -92,8 +91,20 @@ else
let s:vim_shell_error = ''
endif
" System runs a shell command. It will reset the shell to /bin/sh for Unix-like
" systems if it is executable.
function! go#util#System(str, ...)
return call(s:vim_system, [a:str] + a:000)
let l:shell = &shell
if !go#util#IsWin() && executable('/bin/sh')
let &shell = '/bin/sh'
endif
try
let l:output = call(s:vim_system, [a:str] + a:000)
return l:output
finally
let &shell = l:shell
endtry
endfunction
function! go#util#ShellError()
@ -228,24 +239,68 @@ function! go#util#camelcase(word)
endif
endfunction
function! go#util#AddTags(line1, line2, ...)
" default is json
let l:keys = ["json"]
if a:0
let l:keys = a:000
endif
let l:line1 = a:line1
let l:line2 = a:line2
" If we're inside a struct and just call this function let us add the tags
" to all fields
" TODO(arslan): I don't like using patterns. Check if we can move it to
" `motion` and do it via AST based position
let ln1 = searchpair('struct {', '', '}', 'bcnW')
if ln1 == 0
echon "vim-go: " | echohl ErrorMsg | echon "cursor is outside the struct" | echohl None
return
endif
" searchpair only returns a single position
let ln2 = search('}', "cnW")
" if no range is given we apply for the whole struct
if l:line1 == l:line2
let l:line1 = ln1 + 1
let l:line2 = ln2 - 1
endif
for line in range(l:line1, l:line2)
" get the field name (word) that are not part of a commented line
let l:matched = matchstr(getline(line), '\(\/\/.*\)\@<!\w\+')
if empty(l:matched)
continue
endif
let word = go#util#snippetcase(l:matched)
let tags = map(copy(l:keys), 'printf("%s:%s", v:val,"\"'. word .'\"")')
let updated_line = printf("%s `%s`", getline(line), join(tags, " "))
" finally, update the line inplace
call setline(line, updated_line)
endfor
endfunction
" TODO(arslan): I couldn't parameterize the highlight types. Check if we can
" simplify the following functions
function! go#util#EchoSuccess(msg)
redraws! | echon "vim-go: " | echohl Function | echon a:msg | echohl None
redraw | echon "vim-go: " | echohl Function | echon a:msg | echohl None
endfunction
function! go#util#EchoError(msg)
redraws! | echon "vim-go: " | echohl ErrorMsg | echon a:msg | echohl None
redraw | echon "vim-go: " | echohl ErrorMsg | echon a:msg | echohl None
endfunction
function! go#util#EchoWarning(msg)
redraws! | echon "vim-go: " | echohl WarningMsg | echon a:msg | echohl None
redraw | echon "vim-go: " | echohl WarningMsg | echon a:msg | echohl None
endfunction
function! go#util#EchoProgress(msg)
redraws! | echon "vim-go: " | echohl Identifier | echon a:msg | echohl None
redraw | echon "vim-go: " | echohl Identifier | echon a:msg | echohl None
endfunction
" vim: sw=2 ts=2 et

File diff suppressed because it is too large Load diff

View file

@ -4,6 +4,7 @@ command! -nargs=? GoRename call go#rename#Rename(<bang>0,<f-args>)
" -- guru
command! -nargs=* -complete=customlist,go#package#Complete GoGuruScope call go#guru#Scope(<f-args>)
command! -range=% GoImplements call go#guru#Implements(<count>)
command! -range=% GoWhicherrs call go#guru#Whicherrs(<count>)
command! -range=% GoCallees call go#guru#Callees(<count>)
command! -range=% GoDescribe call go#guru#Describe(<count>)
command! -range=% GoCallers call go#guru#Callers(<count>)
@ -12,13 +13,20 @@ command! -range=% GoFreevars call go#guru#Freevars(<count>)
command! -range=% GoChannelPeers call go#guru#ChannelPeers(<count>)
command! -range=% GoReferrers call go#guru#Referrers(<count>)
command! -nargs=? GoGuruTags call go#guru#Tags(<f-args>)
command! -nargs=* -range GoAddTags call go#util#AddTags(<line1>, <line2>, <f-args>)
command! -range=% GoSameIds call go#guru#SameIds(<count>)
command! -range=0 GoSameIdsClear call go#guru#ClearSameIds()
command! -range=% GoSameIdsToggle call go#guru#ToggleSameIds(<count>)
command! -range=0 GoSameIdsAutoToggle call go#guru#AutoToogleSameIds()
" -- tool
command! -nargs=0 GoFiles echo go#tool#Files()
command! -nargs=0 GoDeps echo go#tool#Deps()
command! -nargs=* GoInfo call go#complete#Info(0)
command! -nargs=0 GoAutoTypeInfoToggle call go#complete#ToggleAutoTypeInfo()
" -- cmd
command! -nargs=* -bang GoBuild call go#cmd#Build(<bang>0,<f-args>)
@ -50,8 +58,12 @@ command! -nargs=* -range -complete=customlist,go#package#Complete GoDocBrowser c
" -- fmt
command! -nargs=0 GoFmt call go#fmt#Format(-1)
command! -nargs=0 GoFmtAutoSaveToggle call go#fmt#ToggleFmtAutoSave()
command! -nargs=0 GoImports call go#fmt#Format(1)
" -- asmfmt
command! -nargs=0 GoAsmFmtAutoSaveToggle call go#asmfmt#ToggleAsmFmtAutoSave()
" -- import
command! -nargs=? -complete=customlist,go#package#Complete GoDrop call go#import#SwitchImport(0, '', <f-args>, '')
command! -nargs=1 -bang -complete=customlist,go#package#Complete GoImport call go#import#SwitchImport(1, '', <f-args>, '<bang>')
@ -59,6 +71,7 @@ command! -nargs=* -bang -complete=customlist,go#package#Complete GoImportAs call
" -- linters
command! -nargs=* GoMetaLinter call go#lint#Gometa(0, <f-args>)
command! -nargs=0 GoMetalinterAutoSaveToggle call go#lint#ToggleMetaLinterAutoSave()
command! -nargs=* GoLint call go#lint#Golint(<f-args>)
command! -nargs=* -bang GoVet call go#lint#Vet(<bang>0, <f-args>)
command! -nargs=* -complete=customlist,go#package#Complete GoErrCheck call go#lint#Errcheck(<f-args>)
@ -75,4 +88,7 @@ endif
" -- impl
command! -nargs=* -buffer -complete=customlist,go#impl#Complete GoImpl call go#impl#Impl(<f-args>)
" -- template
command! -nargs=0 GoTemplateAutoCreateToggle call go#template#ToggleAutoCreate()
" vim: sw=2 ts=2 et

View file

@ -44,6 +44,8 @@ xnoremap <silent> <Plug>(go-freevars) :<C-u>call go#guru#Freevars(0)<CR>
nnoremap <silent> <Plug>(go-channelpeers) :<C-u>call go#guru#ChannelPeers(-1)<CR>
nnoremap <silent> <Plug>(go-referrers) :<C-u>call go#guru#Referrers(-1)<CR>
nnoremap <silent> <Plug>(go-sameids) :<C-u>call go#guru#SameIds(-1)<CR>
nnoremap <silent> <Plug>(go-whicherrs) :<C-u>call go#guru#Whicherrs(-1)<CR>
nnoremap <silent> <Plug>(go-sameids-toggle) :<C-u>call go#guru#ToggleSameIds(-1)<CR>
nnoremap <silent> <Plug>(go-rename) :<C-u>call go#rename#Rename(!g:go_jump_to_error)<CR>

View file

@ -189,6 +189,11 @@ snippet json "\`json:key\`"
\`json:"${1:`!v go#util#snippetcase(matchstr(getline("."), '\w\+'))`}"\`
endsnippet
# yaml field tag
snippet yaml "\`yaml:key\`"
\`yaml:"${1:`!v go#util#snippetcase(matchstr(getline("."), '\w\+'))`}"\`
endsnippet
# fallthrough
snippet ft "fallthrough"
fallthrough

View file

@ -162,6 +162,11 @@ snippet json
abbr \`json:key\`
\`json:"${1:keyName}"\`
# yaml snippet
snippet yaml
abbr \`yaml:key\`
\`yaml:"${1:keyName}"\`
# fallthrough
snippet ft
abbr fallthrough

View file

@ -27,7 +27,6 @@ command! GoInstallBinaries call s:GoInstallBinaries(-1)
command! GoUpdateBinaries call s:GoInstallBinaries(1)
command! -nargs=? -complete=dir GoPath call go#path#GoPath(<f-args>)
" GoInstallBinaries downloads and install all necessary binaries stated in the
" packages variable. It uses by default $GOBIN or $GOPATH/bin as the binary
" target install directory. GoInstallBinaries doesn't install binaries if they
@ -143,44 +142,64 @@ function! s:echo_go_info()
redraws! | echo "vim-go: " | echohl Function | echon item.info | echohl None
endfunction
function! s:auto_type_info()
" GoInfo automatic update
if get(g:, "go_auto_type_info", 0)
call go#complete#Info(1)
endif
endfunction
function! s:auto_sameids()
" GoSameId automatic update
if get(g:, "go_auto_sameids", 0)
call go#guru#SameIds(-1)
endif
endfunction
function! s:fmt_autosave()
" Go code formatting on save
if get(g:, "go_fmt_autosave", 1)
call go#fmt#Format(-1)
endif
endfunction
function! s:asmfmt_autosave()
" Go asm formatting on save
if get(g:, "go_asmfmt_autosave", 1)
call go#asmfmt#Format()
endif
endfunction
function! s:metalinter_autosave()
" run gometalinter on save
if get(g:, "go_metalinter_autosave", 0)
call go#lint#Gometa(1)
endif
endfunction
function! s:template_autocreate()
" create new template from scratch
if get(g:, "go_template_autocreate", 1)
call go#template#create()
endif
endfunction
augroup vim-go
autocmd!
" GoInfo automatic update
if get(g:, "go_auto_type_info", 0)
autocmd CursorHold *.go nested call go#complete#Info(1)
endif
" GoSameId automatic update
if get(g:, "go_auto_sameids", 0)
autocmd CursorMoved *.go nested call go#guru#SameIds(-1)
endif
autocmd CursorHold *.go call s:auto_type_info()
autocmd CursorHold *.go call s:auto_sameids()
" Echo the identifier information when completion is done. Useful to see
" the signature of a function, etc...
if exists('##CompleteDone')
autocmd CompleteDone *.go nested call s:echo_go_info()
autocmd CompleteDone *.go call s:echo_go_info()
endif
" Go code formatting on save
if get(g:, "go_fmt_autosave", 1)
autocmd BufWritePre *.go call go#fmt#Format(-1)
endif
" Go asm formatting on save
if get(g:, "go_asmfmt_autosave", 1)
autocmd BufWritePre *.s call go#asmfmt#Format()
endif
" run gometalinter on save
if get(g:, "go_metalinter_autosave", 0)
autocmd BufWritePost *.go call go#lint#Gometa(1)
endif
" create new template from scratch
if get(g:, "go_template_autocreate", 1)
autocmd BufNewFile *.go call go#template#create()
endif
autocmd BufWritePre *.go call s:fmt_autosave()
autocmd BufWritePre *.s call s:asmfmt_autosave()
autocmd BufWritePost *.go call s:metalinter_autosave()
autocmd BufNewFile *.go call s:template_autocreate()
augroup END
" vim: sw=2 ts=2 et

View file

@ -271,6 +271,7 @@ hi def link goSpaceError Error
syn keyword goTodo contained NOTE
hi def link goTodo Todo
syn match goVarArgs /\.\.\./
" Operators;
if g:go_highlight_operators != 0
@ -285,9 +286,9 @@ if g:go_highlight_operators != 0
" match remaining two-char operators: := && || <- ++ --
syn match goOperator /:=\|||\|<-\|++\|--/
" match ...
syn match goOperator /\.\.\./
hi def link goPointerOperator Operator
hi def link goPointerOperator goOperator
hi def link goVarArgs goOperator
endif
hi def link goOperator Operator
@ -306,14 +307,13 @@ hi def link goFunction Function
" Methods;
if g:go_highlight_methods != 0
syn match goMethod /\.\w\+(/hs=s+1,he=e-1
syn match goMethod /\.\w\+\ze(/hs=s+1
endif
hi def link goMethod Type
" Fields;
if g:go_highlight_fields != 0
syn match goVarArgs /\.\.\.\w\+\>/
syn match goField /\.\a\+\([\ \n\r\:\)\[]\)\@=/hs=s+1
syn match goField /\.\w\+\([\ \n\r\:\)\[,]\)\@=/hs=s+1
endif
hi def link goField Identifier
@ -366,7 +366,13 @@ if g:go_highlight_build_constraints != 0
hi def link goPackageComment Comment
endif
hi def link goSameId IncSearch
" :GoSameIds
hi def goSameId term=bold cterm=bold ctermbg=white ctermfg=black
" :GoCoverage commands
hi def link goCoverageNormalText Comment
hi def goCoverageCovered ctermfg=green guifg=#A6E22E
hi def goCoverageUncover ctermfg=red guifg=#F92672
" Search backwards for a global declaration to start processing the syntax.
"syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/

View file

@ -127,7 +127,6 @@ endsnippet
#############
snippet input "Input with Label" w
<label for="${2:${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g}}">$1</label><input type="${3:text/submit/hidden/button}" name="${4:$2}" value="$5"${6: id="${7:$2}"}`!p x(snip)`>
endsnippet
snippet input "XHTML <input>" w
@ -141,9 +140,7 @@ endsnippet
snippet select "Select Box" w
<select name="${1:some_name}" id="${2:$1}"${3:${4: multiple}${5: onchange="${6:}"}${7: size="${8:1}"}}>
<option${9: value="${10:option1}"}>${11:$10}</option>
<option${12: value="${13:option2}"}>${14:$13}</option>${15:}
$0
${0:${VISUAL}}
</select>
endsnippet
@ -162,25 +159,25 @@ endsnippet
snippet body "<body>"
<body>
$0
${0:${VISUAL}}
</body>
endsnippet
snippet div "<div>" w
<div>
$0
${0:${VISUAL}}
</div>
endsnippet
snippet div. "<div> with class" w
<div`!p snip.rv=' class="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""`>
$0
${0:${VISUAL}}
</div>
endsnippet
snippet div# "<div> with ID & class" w
<div`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""``!p snip.rv=' class="' if t[2] else ""`${2:name}`!p snip.rv = '"' if t[2] else ""`>
$0
${0:${VISUAL}}
</div>
endsnippet
@ -188,33 +185,39 @@ snippet form "XHTML <form>" w
<form action="${1:`!p
snip.rv = (snip.basename or 'unnamed') + '_submit'
`}" method="${2:get}" accept-charset="utf-8">
$0
<p><input type="submit" value="Continue →"`!p x(snip)`></p>
${0:${VISUAL}}
</form>
endsnippet
snippet h1 "XHTML <h1>" w
<h1>$0</h1>
<h1>${0:${VISUAL}}</h1>
endsnippet
snippet h2 "XHTML <h2>" w
<h2>$0</h2>
<h2>${0:${VISUAL}}</h2>
endsnippet
snippet h3 "XHTML <h3>" w
<h3>$0</h3>
<h3>${0:${VISUAL}}</h3>
endsnippet
snippet h4 "XHTML <h4>" w
<h4>$0</h4>
<h4>${0:${VISUAL}}</h4>
endsnippet
snippet h5 "XHTML <h5>" w
<h5>${0:${VISUAL}}</h5>
endsnippet
snippet h6 "XHTML <h6>" w
<h6>${0:${VISUAL}}</h6>
endsnippet
snippet head "XHTML <head>"
<head>
<meta charset="utf-8">
<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
$0
${0:${VISUAL}}
</head>
endsnippet
@ -232,20 +235,19 @@ endsnippet
snippet script "XHTML <script>" w
<script type="text/javascript" charset="utf-8">
$0
${0:${VISUAL}}
</script>
endsnippet
snippet style "XHTML <style>" w
<style type="text/css" media="screen">
$0
${0:${VISUAL}}
</style>
endsnippet
snippet table "XHTML <table>" w
<table border="${1:0}"${2: cellspacing="${3:5}" cellpadding="${4:5}"}>
<tr><th>${5:Header}</th></tr>
<tr><td>${0:Data}</td></tr>
${0:${VISUAL}}
</table>
endsnippet
@ -254,29 +256,29 @@ snippet a "Link" w
endsnippet
snippet p "paragraph" w
<p>$0</p>
<p>${0:${VISUAL}}</p>
endsnippet
snippet li "list item" w
<li>$0</li>
<li>${0:${VISUAL}}</li>
endsnippet
snippet ul "unordered list" w
<ul>
$0
${0:${VISUAL}}
</ul>
endsnippet
snippet td "table cell" w
<td>$0</td>
<td>${0:${VISUAL}}</td>
endsnippet
snippet th "table header" w
<th>$0</th>
<th>${0:${VISUAL}}</th>
endsnippet
snippet tr "table row" w
<tr>$0</tr>
<tr>${0:${VISUAL}}</tr>
endsnippet
snippet title "XHTML <title>" w
@ -286,7 +288,7 @@ endsnippet
snippet fieldset "Fieldset" w
<fieldset id="${1/[\w\d]+|( )/(?1:_:\L$0\E)/g}" ${2:class="${3:}"}>
<legend>$1</legend>
$0
${0:${VISUAL}}
</fieldset>
endsnippet

View file

@ -105,13 +105,17 @@ snippet imp
snippet ali
alias ${0:module_name}
snippet test
test "${1:test_name}" do
test "${1:test name}" do
${0}
end
snippet testa
test "${1:test_name}", %{${2:arg: arg}} do
${0}
end
snippet des
describe "${1:test group subject}" do
${0}
end
snippet exunit
defmodule ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} do
use ExUnit.Case, async: true

View file

@ -171,6 +171,9 @@ snippet pn
# print
snippet pr
fmt.Printf("%${1:s}\n", ${2:var})
# println
snippet pl
fmt.Println("${1:s}")
# range
snippet rn
range ${0}

View file

@ -30,6 +30,11 @@ snippet (f
(function(${1}) {
${0}
}(${2}));
# Minify safe iife
snippet ;fe
;(function(${1}) {
${0}
}(${2}))
# self-defining function
snippet sdf
var ${1:function_name} = function (${2:argument}) {

View file

@ -0,0 +1,127 @@
#
## Libraries
snippet lib
library ${1}
use ${1}.${2}
# Standard Libraries
snippet libs
library IEEE;
use IEEE.std_logic_1164.ALL;
use IEEE.numeric_std.ALL;
# Xilinx Library
snippet libx
library UNISIM;
use UNISIM.VCOMPONENTS.ALL;
## Entity Declaration
snippet ent
entity ${1:`vim_snippets#Filename()`} is
generic (
${2}
);
port (
${3}
);
end entity $1;
## Architecture
snippet arc
architecture ${1:behav} of ${2:`vim_snippets#Filename()`} is
${3}
begin
end $1;
## Declarations
# std_logic
snippet st
signal ${1} : std_logic;
# std_logic_vector
snippet sv
signal ${1} : std_logic_vector (${2} downto 0);
# std_logic in
snippet ist
${1} : in std_logic;
# std_logic_vector in
snippet isv
${1} : in std_logic_vector (${2} downto 0);
# std_logic out
snippet ost
${1} : out std_logic;
# std_logic_vector out
snippet osv
${1} : out std_logic_vector (${2} downto 0);
# unsigned
snippet un
signal ${1} : unsigned (${2} downto 0);
## Process Statements
# process
snippet pr
process (${1})
begin
${2}
end process;
# process with clock
snippet prc
process (${1:clk})
begin
if rising_edge ($1) then
${2}
end if;
end process;
# process all
snippet pra
process (${1:all})
begin
${2}
end process;
## Control Statements
# if
snippet if
if ${1} then
${2}
end if;
# if
snippet ife
if ${1} then
${2}
else
${3}
end if;
# else
snippet el
else
${1}
# if
snippet eif
elsif ${1} then
${2}
# case
snippet ca
case ${1} is
${2}
end case;
# when
snippet wh
when ${1} =>
${2}
# for
snippet for
for ${1:i} in ${2} ${3:to} ${4} loop
${5}
end loop;
# while
snippet wh
while ${1} loop
${2}
end loop;
## Misc
# others
snippet oth
(others => '${1:0}');