From 8795e1a65ecfa76f5355e986377cf37e43aefdbd Mon Sep 17 00:00:00 2001 From: Amila Welihinda Date: Thu, 14 Jul 2016 21:39:02 -0700 Subject: [PATCH 1/8] Added Linux instructions --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index ad17e8cf..489ec5f9 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,10 @@ This is useful to install on remote servers where you don't need many plugins an Use [msysgit](http://msysgit.github.com/) to checkout the repository and run the installation instructions above. No special instructions needed ;-) +## How to install on Linux + +If you have vim aliased as `vi` instead of `vim`, make sure to either alias it: `alias vi=vim`. Otherwise, `apt-get install vim` + ## How to update to latest version? Simply just do a git rebase! From 61a22e9f3e106568508d37636e1b03d243e7b6a4 Mon Sep 17 00:00:00 2001 From: amix Date: Tue, 2 Aug 2016 14:48:32 +0200 Subject: [PATCH 2/8] Updated plugins --- .../ctrlp.vim/autoload/ctrlp.vim | 119 ++- sources_non_forked/ctrlp.vim/doc/ctrlp.txt | 9 +- sources_non_forked/ctrlp.vim/plugin/ctrlp.vim | 24 +- sources_non_forked/syntastic/README.markdown | 88 +- .../syntastic/doc/syntastic-checkers.txt | 148 +-- .../syntastic/plugin/syntastic.vim | 2 +- .../syntastic/plugin/syntastic/registry.vim | 3 +- .../syntastic/syntax_checkers/asl/iasl.vim | 59 ++ .../syntastic/syntax_checkers/c/avrgcc.vim | 6 +- .../syntastic/syntax_checkers/cpp/avrgcc.vim | 24 + .../syntax_checkers/typescript/tsc.vim | 66 -- sources_non_forked/vim-flake8/README.mdown | 2 +- sources_non_forked/vim-go/CHANGELOG.md | 39 +- sources_non_forked/vim-go/README.md | 24 +- .../vim-go/autoload/go/asmfmt.vim | 15 + sources_non_forked/vim-go/autoload/go/cmd.vim | 3 + .../vim-go/autoload/go/complete.vim | 12 + .../vim-go/autoload/go/coverage.vim | 11 +- sources_non_forked/vim-go/autoload/go/def.vim | 78 +- sources_non_forked/vim-go/autoload/go/fmt.vim | 22 +- .../vim-go/autoload/go/guru.vim | 101 +- .../vim-go/autoload/go/impl.vim | 6 +- .../vim-go/autoload/go/lint.vim | 11 + .../vim-go/autoload/go/package.vim | 2 +- .../vim-go/autoload/go/template.vim | 17 +- .../vim-go/autoload/go/tool.vim | 2 +- .../vim-go/autoload/go/util.vim | 79 +- sources_non_forked/vim-go/doc/vim-go.txt | 860 ++++++++++-------- .../vim-go/ftplugin/go/commands.vim | 16 + .../vim-go/ftplugin/go/mappings.vim | 2 + .../vim-go/gosnippets/UltiSnips/go.snippets | 5 + .../vim-go/gosnippets/snippets/go.snip | 5 + sources_non_forked/vim-go/plugin/go.vim | 79 +- sources_non_forked/vim-go/syntax/go.vim | 18 +- .../vim-snippets/UltiSnips/html.snippets | 56 +- .../vim-snippets/snippets/elixir.snippets | 6 +- .../vim-snippets/snippets/go.snippets | 3 + .../snippets/javascript/javascript.snippets | 5 + .../vim-snippets/snippets/vhdl.snippets | 127 +++ 39 files changed, 1372 insertions(+), 782 deletions(-) create mode 100644 sources_non_forked/syntastic/syntax_checkers/asl/iasl.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/cpp/avrgcc.vim delete mode 100644 sources_non_forked/syntastic/syntax_checkers/typescript/tsc.vim create mode 100644 sources_non_forked/vim-snippets/snippets/vhdl.snippets diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim index fef2544f..b0146a36 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim @@ -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='' end='' sy region CtrlPBufferRegion concealends matchgroup=Ignore start='' end='' @@ -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 diff --git a/sources_non_forked/ctrlp.vim/doc/ctrlp.txt b/sources_non_forked/ctrlp.vim/doc/ctrlp.txt index bd4fc095..4cc6017d 100644 --- a/sources_non_forked/ctrlp.vim/doc/ctrlp.txt +++ b/sources_non_forked/ctrlp.vim/doc/ctrlp.txt @@ -68,6 +68,7 @@ Overview:~ |ctrlp_open_single_match|.....Automatically accept when only one candidate. |ctrlp_brief_prompt|..........Exit CtrlP on empty prompt by . |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) diff --git a/sources_non_forked/ctrlp.vim/plugin/ctrlp.vim b/sources_non_forked/ctrlp.vim/plugin/ctrlp.vim index 5f5303f1..9f2bb147 100644 --- a/sources_non_forked/ctrlp.vim/plugin/ctrlp.vim +++ b/sources_non_forked/ctrlp.vim/plugin/ctrlp.vim @@ -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 = '' | en if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en -com! -n=? -com=dir CtrlP cal ctrlp#init(0, { 'dir': }) -com! -n=? -com=dir CtrlPMRUFiles cal ctrlp#init(2, { 'dir': }) +com! -n=? -com=dir CtrlP cal ctrlp#init('fil', { 'dir': }) +com! -n=? -com=dir CtrlPMRUFiles cal ctrlp#init('mru', { 'dir': }) -com! -bar CtrlPBuffer cal ctrlp#init(1) +com! -bar CtrlPBuffer cal ctrlp#init('buf') com! -n=? CtrlPLastMode cal ctrlp#init(-1, { '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 (ctrlp) :'.g:ctrlp_cmd.'' @@ -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, )) + \ cal ctrlp#init(ctrlp#line#cmd('buf', )) com! -n=? -com=buffer CtrlPChange - \ cal ctrlp#init(ctrlp#changes#cmd(0, )) + \ cal ctrlp#init(ctrlp#changes#cmd('fil', )) com! -bar CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1)) com! -bar CtrlPMixed cal ctrlp#init(ctrlp#mixed#id()) diff --git a/sources_non_forked/syntastic/README.markdown b/sources_non_forked/syntastic/README.markdown index 7e493df2..19e986ef 100644 --- a/sources_non_forked/syntastic/README.markdown +++ b/sources_non_forked/syntastic/README.markdown @@ -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. + + +__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. + -__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. -__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 -__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. -__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`). -__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. -__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. -__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). -__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 = ``` -__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/ diff --git a/sources_non_forked/syntastic/doc/syntastic-checkers.txt b/sources_non_forked/syntastic/doc/syntastic-checkers.txt index 47948490..19974054 100644 --- a/sources_non_forked/syntastic/doc/syntastic-checkers.txt +++ b/sources_non_forked/syntastic/doc/syntastic-checkers.txt @@ -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 + +"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 + +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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -1450,7 +1504,7 @@ The following checkers are available for Coq (filetype "coq"): Name: coqtop Maintainer: Matvey Aksenov -"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 -"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 -"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 -"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 "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 -"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 - -"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 @@ -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|) diff --git a/sources_non_forked/syntastic/plugin/syntastic.vim b/sources_non_forked/syntastic/plugin/syntastic.vim index 8076eebe..441490d5 100644 --- a/sources_non_forked/syntastic/plugin/syntastic.vim +++ b/sources_non_forked/syntastic/plugin/syntastic.vim @@ -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 diff --git a/sources_non_forked/syntastic/plugin/syntastic/registry.vim b/sources_non_forked/syntastic/plugin/syntastic/registry.vim index 0c2d261f..8e78f112 100644 --- a/sources_non_forked/syntastic/plugin/syntastic/registry.vim +++ b/sources_non_forked/syntastic/plugin/syntastic/registry.vim @@ -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'], diff --git a/sources_non_forked/syntastic/syntax_checkers/asl/iasl.vim b/sources_non_forked/syntastic/syntax_checkers/asl/iasl.vim new file mode 100644 index 00000000..0aae5d29 --- /dev/null +++ b/sources_non_forked/syntastic/syntax_checkers/asl/iasl.vim @@ -0,0 +1,59 @@ +"============================================================================ +"File: iasl.vim +"Description: Syntax checking plugin for syntastic using iasl +"Maintainer: Peter Wu +"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: diff --git a/sources_non_forked/syntastic/syntax_checkers/c/avrgcc.vim b/sources_non_forked/syntastic/syntax_checkers/c/avrgcc.vim index 0fbb9840..a4124975 100644 --- a/sources_non_forked/syntastic/syntax_checkers/c/avrgcc.vim +++ b/sources_non_forked/syntastic/syntax_checkers/c/avrgcc.vim @@ -1,6 +1,6 @@ "============================================================================ "File: avrgcc.vim -"Description: Syntax checking plugin for syntastic.vim +"Description: Syntax checking plugin for syntastic "Maintainer: Karel "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:,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/cpp/avrgcc.vim b/sources_non_forked/syntastic/syntax_checkers/cpp/avrgcc.vim new file mode 100644 index 00000000..cc48b74f --- /dev/null +++ b/sources_non_forked/syntastic/syntax_checkers/cpp/avrgcc.vim @@ -0,0 +1,24 @@ +"============================================================================ +"File: avrgcc.vim +"Description: Syntax checking plugin for syntastic +"Maintainer: Sławek Piotrowski +"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: diff --git a/sources_non_forked/syntastic/syntax_checkers/typescript/tsc.vim b/sources_non_forked/syntastic/syntax_checkers/typescript/tsc.vim deleted file mode 100644 index de9242e5..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/typescript/tsc.vim +++ /dev/null @@ -1,66 +0,0 @@ -"============================================================================ -"File: tsc.vim -"Description: TypeScript syntax checker -"Maintainer: Bill Casarin -" -"============================================================================ - -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\= 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: diff --git a/sources_non_forked/vim-flake8/README.mdown b/sources_non_forked/vim-flake8/README.mdown index 692baadf..940eadf7 100644 --- a/sources_non_forked/vim-flake8/README.mdown +++ b/sources_non_forked/vim-flake8/README.mdown @@ -41,7 +41,7 @@ the `` key if so. For example, to remap it to `` 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`: diff --git a/sources_non_forked/vim-go/CHANGELOG.md b/sources_non_forked/vim-go/CHANGELOG.md index c332edfc..536b77dc 100644 --- a/sources_non_forked/vim-go/CHANGELOG.md +++ b/sources_non_forked/vim-go/CHANGELOG.md @@ -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: diff --git a/sources_non_forked/vim-go/README.md b/sources_non_forked/vim-go/README.md index b65ca08e..47d8c416 100644 --- a/sources_non_forked/vim-go/README.md +++ b/sources_non_forked/vim-go/README.md @@ -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) diff --git a/sources_non_forked/vim-go/autoload/go/asmfmt.vim b/sources_non_forked/vim-go/autoload/go/asmfmt.vim index 711e3274..b47651da 100644 --- a/sources_non_forked/vim-go/autoload/go/asmfmt.vim +++ b/sources_non_forked/vim-go/autoload/go/asmfmt.vim @@ -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 diff --git a/sources_non_forked/vim-go/autoload/go/cmd.vim b/sources_non_forked/vim-go/autoload/go/cmd.vim index a01e30d3..33fccd3a 100644 --- a/sources_non_forked/vim-go/autoload/go/cmd.vim +++ b/sources_non_forked/vim-go/autoload/go/cmd.vim @@ -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 diff --git a/sources_non_forked/vim-go/autoload/go/complete.vim b/sources_non_forked/vim-go/autoload/go/complete.vim index 96fc36c8..3cc52d2d 100644 --- a/sources_non_forked/vim-go/autoload/go/complete.vim +++ b/sources_non_forked/vim-go/autoload/go/complete.vim @@ -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 diff --git a/sources_non_forked/vim-go/autoload/go/coverage.vim b/sources_non_forked/vim-go/autoload/go/coverage.vim index 83082174..f3d36c43 100644 --- a/sources_non_forked/vim-go/autoload/go/coverage.vim +++ b/sources_non_forked/vim-go/autoload/go/coverage.vim @@ -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 call go#coverage#Clear() diff --git a/sources_non_forked/vim-go/autoload/go/def.vim b/sources_non_forked/vim-go/autoload/go/def.vim index bea95117..2c783939 100644 --- a/sources_non_forked/vim-go/autoload/go/def.vim +++ b/sources_non_forked/vim-go/autoload/go/def.vim @@ -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) - let out = go#util#System(command) + + 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,24 +113,29 @@ function! s:jump_to_declaration(out, mode) " modes of switchbuf which we need based on the split mode let old_switchbuf = &switchbuf - " 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 - " jumpt to existing buffer if it exists - execute bufwinnr(filename) . 'wincmd w' - elseif a:mode == "tab" - let &switchbuf = "usetab" - if bufloaded(filename) == 0 - tab split + 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 + " jumpt to existing buffer if it exists + execute bufwinnr(filename) . 'wincmd w' + elseif a:mode == "tab" + let &switchbuf = "usetab" + if bufloaded(filename) == 0 + tab split + endif + elseif a:mode == "split" + split + elseif a:mode == "vsplit" + vsplit + elseif &modified + split endif - elseif a:mode == "split" - split - elseif a:mode == "vsplit" - vsplit - endif - " open the file and jump to line and column - exec 'edit '.filename + " 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 diff --git a/sources_non_forked/vim-go/autoload/go/fmt.vim b/sources_non_forked/vim-go/autoload/go/fmt.vim index eb49553d..e47b52d2 100644 --- a/sources_non_forked/vim-go/autoload/go/fmt.vim +++ b/sources_non_forked/vim-go/autoload/go/fmt.vim @@ -43,7 +43,7 @@ if !exists("g:go_fmt_experimental") let g:go_fmt_experimental = 0 endif -" we have those problems : +" we have those problems : " http://stackoverflow.com/questions/12741977/prevent-vim-from-updating-its-undo-tree " http://stackoverflow.com/questions/18532692/golang-formatter-and-vim-how-to-destroy-history-record?rq=1 " @@ -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 diff --git a/sources_non_forked/vim-go/autoload/go/guru.vim b/sources_non_forked/vim-go/autoload/go/guru.vim index 5ddc99d0..3fb5a7d5 100644 --- a/sources_non_forked/vim-go/autoload/go/guru.vim +++ b/sources_non_forked/vim-go/autoload/go/guru.vim @@ -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!!! - let out = go#util#System(command) - - if exists("l:tmpname") - call delete(l:tmpname) + if &modified + let out = go#util#System(command, in) + else + let out = go#util#System(command) 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#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) - call go#guru#ClearSameIds() + " 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 diff --git a/sources_non_forked/vim-go/autoload/go/impl.vim b/sources_non_forked/vim-go/autoload/go/impl.vim index e0ffac45..fce4a29b 100644 --- a/sources_non_forked/vim-go/autoload/go/impl.vim +++ b/sources_non_forked/vim-go/autoload/go/impl.vim @@ -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')") diff --git a/sources_non_forked/vim-go/autoload/go/lint.vim b/sources_non_forked/vim-go/autoload/go/lint.vim index 1a2ef9aa..9b2a543a 100644 --- a/sources_non_forked/vim-go/autoload/go/lint.vim +++ b/sources_non_forked/vim-go/autoload/go/lint.vim @@ -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 diff --git a/sources_non_forked/vim-go/autoload/go/package.vim b/sources_non_forked/vim-go/autoload/go/package.vim index 2aefd5d6..c69cba4b 100644 --- a/sources_non_forked/vim-go/autoload/go/package.vim +++ b/sources_non_forked/vim-go/autoload/go/package.vim @@ -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 diff --git a/sources_non_forked/vim-go/autoload/go/template.vim b/sources_non_forked/vim-go/autoload/go/template.vim index 73b37e86..4b9e2713 100644 --- a/sources_non_forked/vim-go/autoload/go/template.vim +++ b/sources_non_forked/vim-go/autoload/go/template.vim @@ -10,13 +10,13 @@ function! go#template#create() let l:package_name = go#tool#PackageName() " if we can't figure out any package name(no Go files or non Go package - " files) from the directory create the template + " files) from the directory create the template 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 + else let l:content = printf("package %s", l:package_name) call append(0, l:content) $delete _ @@ -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 diff --git a/sources_non_forked/vim-go/autoload/go/tool.vim b/sources_non_forked/vim-go/autoload/go/tool.vim index 487b933d..c41bbd27 100644 --- a/sources_non_forked/vim-go/autoload/go/tool.vim +++ b/sources_non_forked/vim-go/autoload/go/tool.vim @@ -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 diff --git a/sources_non_forked/vim-go/autoload/go/util.vim b/sources_non_forked/vim-go/autoload/go/util.vim index 591606ff..0251b14a 100644 --- a/sources_non_forked/vim-go/autoload/go/util.vim +++ b/sources_non_forked/vim-go/autoload/go/util.vim @@ -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), '\(\/\/.*\)\@ git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go < - * https://github.com/junegunn/vim-plug > Plug 'fatih/vim-go' -< * https://github.com/Shougo/neobundle.vim > NeoBundle 'fatih/vim-go' < - * https://github.com/gmarik/vundle > Plugin 'fatih/vim-go' +* Vim |packages| (since Vim 7.4.1528) +> + git clone https://github.com/fatih/vim-go.git \ + ~/.vim/pack/plugins/start/vim-go < * Manual > Copy all of the files into your `~/.vim` directory < -Please be sure all necessary binaries are installed (such as `gocode`, `godef`, -`goimports`, etc..). You can easily install them with the included -|GoInstallBinaries| command. If you invoke it, all necessary binaries will be -automatically downloaded and installed to your `$GOBIN` environment (if not set -it will use `$GOPATH/bin`). It requires `git` for fetching the individual Go -packages. +Please be sure all necessary binaries are installed (such as `gocode`, +`godef`, `goimports`, etc.). You can easily install them with the included +|:GoInstallBinaries| command. If you invoke it, all necessary binaries will be +automatically downloaded and installed to your `$GOBIN` environment (if not +set it will use `$GOPATH/bin`). It requires `git` for fetching the individual +Go packages. * Autocompletion is enabled by default via ``, to get real-time completion (completion by type) install: @@ -121,20 +127,21 @@ https://github.com/majutsushi/tagbar. * For snippet feature install: https://github.com/Shougo/neosnippet.vim or https://github.com/SirVer/ultisnips. -* For a better documentation viewer checkout: https://github.com/garyburd/go-explorer +* For a better documentation viewer check out: + https://github.com/garyburd/go-explorer -=============================================================================== -COMMANDS *go-commands* +============================================================================== +COMMANDS *go-commands* - *:GoPath* + *:GoPath* :GoPath [path] GoPath sets and overrides GOPATH with the given {path}. If no {path} is given it shows the current GOPATH. If `""` is given as path, it clears - current `GOPATH` which was set with |GoPath| and restores `GOPATH` back to - the initial value which was sourced when Vim was started. + current `GOPATH` which was set with |:GoPath| and restores `GOPATH` back + to the initial value which was sourced when Vim was started. - *:GoImport* + *:GoImport* :GoImport[!] [path] Import ensures that the provided package {path} is imported in the current @@ -143,36 +150,36 @@ COMMANDS *go-commands* If [!] is given it will download the package with `go get` - *:GoImportAs* + *:GoImportAs* :GoImportAs [localname] [path] Same as Import, but uses a custom local name for the package. - *:GoDrop* + *:GoDrop* :GoDrop [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. - *:GoLint* + *:GoLint* :GoLint [packages] Run golint for the current Go file, or for given packages. - *:GoDoc* + *:GoDoc* :GoDoc [word] Open the relevant GoDoc in split window for either the word[s] passed to the command or by default, the word under the cursor. - *:GoDocBrowser* + *:GoDocBrowser* :GoDocBrowser [word] Open the relevant GoDoc in browser for either the word[s] passed to the command or by default, the word under the cursor. - *:GoFmt* + *:GoFmt* :GoFmt Filter the current Go buffer through gofmt. It tries to preserve cursor @@ -183,7 +190,7 @@ COMMANDS *go-commands* Filter the current Go buffer through goimports (needs to be installed). `goimports` automatically discards/add import path based on the code. Like - |GoFmt|, It tries to preserve cursor position and avoids replacing the + |:GoFmt|, It tries to preserve cursor position and avoids replacing the buffer with stderr output. *:GoPlay* @@ -194,14 +201,14 @@ COMMANDS *go-commands* is copied to system clipboard if Vim is compiled with 'clipboard' or 'xterm-clipboard' otherwise it's get yanked into the `""` register. - *:GoVet* + *:GoVet* :GoVet[!] [options] Run `go vet` for the directory under your current file. Vet examines Go source code and reports suspicious constructs, such as Printf calls whose - arguments do not align with the format string. Vet uses heuristics that do not - guarantee all reports are genuine problems, but it can find errors not caught - by the compilers. + arguments do not align with the format string. Vet uses heuristics that do + not guarantee all reports are genuine problems, but it can find errors not + caught by the compilers. You may optionally pass any valid go tool vet flags/options. In this case, `go tool vet` is run in place of `go vet`. For a full list please see @@ -209,7 +216,7 @@ COMMANDS *go-commands* If [!] is not given the first error is jumped to. - *:GoDef* + *:GoDef* :GoDef [identifier] gd CTRL-] @@ -217,67 +224,68 @@ CTRL-] Goto declaration/definition for the given [identifier]. If no argument is given, it will jump to the declaration under the cursor. By default the CTRL-] key and the mapping `gd` are enabled to invoke :GoDef for the - identifier under the cursor. See |g:go_def_mapping_enabled| to disable them. + identifier under the cursor. See |'g:go_def_mapping_enabled'| to disable + them. - vim-go also keeps a per-window location stack, roughly analagous to how - vim's internal |tags| functionality works. This is pushed to every time a - jump is made using the GoDef functionality. In essence, this is a LIFO list - of file locations you have visited with :GoDef that is retained to help you - navigate software. For more information on displaying the stack, see - |:GoDefJump| + vim-go also keeps a per-window location stack, roughly analogous to how + Vim's internal |tags| functionality works. This is pushed to every time a + jump is made using the GoDef functionality. In essence, this is a LIFO + list of file locations you have visited with :GoDef that is retained to + help you navigate software. - *:GoDefStack* + *:GoDefStack* :GoDefStack [number] - This command Jumps to a given location in the jumpstack, retaining all other - entries. Jumps to non-existent entries will print an informative message, - but are otherwise a noop. + This command Jumps to a given location in the jumpstack, retaining all + other entries. Jumps to non-existent entries will print an informative + message, but are otherwise a noop. - If no argument is given, it will print out an interactive list of all items - in the stack. Its output looks like this: + If no argument is given, it will print out an interactive list of all + items in the stack. Its output looks like this: - 1 /path/to/first/file.go|1187 col 16|AddThing func(t *Thing) - > 2 /path/to/thing/thing.go|624 col 19|String() string - 3 /path/to/thing/thing.go|744 col 6|func Sprintln(a ...interface{}) string + 1 /path/first/file.go|1187 col 16|AddThing func(t *Thing) + > 2 /path/thing/thing.go|624 col 19|String() string + 3 /path/thing/thing.go|744 col 6|func Sprintln(a ...interface{}) string This list shows the identifiers that you jumped to and the file and cursor - position before that jump. The older jumps are at the top, the newer at the - bottom. + position before that jump. The older jumps are at the top, the newer at + the bottom. - The '>' points to the active entry. This entry and any newer entries below - it will be replaced if |:GoDef| is done from this location. The CTRL-t and - |:GoDefPop| command will jump to the position above the active entry. + The '>' points to the active entry. This entry and any newer entries + below it will be replaced if |:GoDef| is done from this location. The + CTRL-t and |:GoDefPop| command will jump to the position above the active + entry. Jumps to non-existent entries will print an informative message, but are otherwise a noop. *:GoDefStackClear* -:GoDefStackClear +:GoDefStackClear Clears the current stack list and resets it. - *:GoDefPop* + *:GoDefPop* :GoDefPop [count] CTRL-t - Navigate to the [count] earlier entry in the jump stack, retaining the newer - entries. If no argument is given, it will jump to the next most recent entry - (`:GoDefPop 1`). If [count] is greater than the number of prior entries, - an error will be printed and no jump will be performed. + Navigate to the [count] earlier entry in the jump stack, retaining the + newer entries. If no argument is given, it will jump to the next most + recent entry (`:GoDefPop 1`). If [count] is greater than the number of + prior entries, an error will be printed and no jump will be performed. If you have used :GoDefPop to jump to an earlier location, and you issue another :GoDef command, the current entry will be replaced, and all newer entries will be removed, effectively resuming the stack at that location. - By default [count]CTRL-t is enabled to invoke :GoDefPop. Similarly, hitting - CTRL-t without a prior count is equivalent to `:GoDefPop 1`. See - |g:go_def_mapping_enabled| to disable this. + By default [count]CTRL-t is enabled to invoke :GoDefPop. Similarly, + hitting CTRL-t without a prior count is equivalent to `:GoDefPop 1`. See + |'g:go_def_mapping_enabled'| to disable this. - *:GoRun* + *:GoRun* :GoRun[!] [expand] Build and run your current main package. By default all main files for the - current file is used. If an argument is passed, 'expand' is used as file + current file is used. If an argument is passed, [expand] is used as file selector. For example use `:GoRun %` to select the current file only. You may optionally pass any valid go run flags/options. For a full list @@ -286,73 +294,73 @@ CTRL-t If [!] is not given the first error is jumped to. If using neovim then `:GoRun` will run in a new terminal according to - |g:go_term_mode|. + |'g:go_term_mode'|. - *:GoBuild* + *:GoBuild* :GoBuild[!] [expand] Build your package with `go build`. Errors are populated in the quickfix window. It automatically builds only the files that depends on the current file. `:GoBuild` doesn't produce a result file. - Use 'make' to create a result file. + Use |:make| to create a result file. You may optionally pass any valid go build flags/options. For a full list - please see `go help build`. Options are expanded with 'expand'. + please see `go help build`. Options are expanded with [expand]. If [!] is not given the first error is jumped to. If using neovim then this command is fully async, it does not block the UI. - *:GoGenerate* + *:GoGenerate* :GoGenerate[!] [expand] Creates or updates your auto-generated source files by running `go generate`. - You may optionally pass any valid go generate flags/options. For a full list - please see `go help generate`. Options are expanded with 'expand'. + You may optionally pass any valid go generate flags/options. For a full + list please see `go help generate`. Options are expanded with [expand]. If [!] is not given the first error is jumped to. - *:GoInfo* + *:GoInfo* :GoInfo Show type information about the identifier under the cursor. For example putting it above a function call is going to show the full function signature. It uses gocode to get the type informations. - *:GoInstall* + *:GoInstall* :GoInstall[!] [options] Install your package with `go install`. - You may optionally pass any valid go install flags/options. For a full list - please see `go help install`. + You may optionally pass any valid go install flags/options. For a full + list please see `go help install`. If [!] is not given the first error is jumped to. - *:GoTest* + *:GoTest* :GoTest[!] [expand] Run the tests on your _test.go files via in your current directory. Errors - are populated in the quickfix window. If an argument is passed, 'expand' + are populated in the quickfix window. If an argument is passed, [expand] is used as file selector (useful for cases like `:GoTest ./...`). You may optionally pass any valid go test flags/options. For a full list please see `go help test`. GoTest timesout automatically after 10 seconds. To customize the timeout - use |g:go_test_timeout|. This feature is disabled if any arguments are + use |'g:go_test_timeout'|. This feature is disabled if any arguments are passed to the `:GoTest` command. If [!] is not given the first error is jumped to. If using neovim `:GoTest` will run in a new terminal or run asynchronously - in the background according to |g:go_term_enabled|. You can set the mode of - the new terminal with |g:go_term_mode|. + in the background according to |'g:go_term_enabled'|. You can set the mode + of the new terminal with |'g:go_term_mode'|. - *:GoTestFunc* + *:GoTestFunc* :GoTestFunc[!] [expand] Runs :GoTest, but only on the single test function immediate to your @@ -364,15 +372,15 @@ CTRL-t If [!] is not given the first error is jumped to. - If using neovim `:GoTestFunc` will run in a new terminal or run asynchronously - in the background according to |g:go_term_enabled|. You can set the mode of - the new terminal with |g:go_term_mode|. + If using neovim `:GoTestFunc` will run in a new terminal or run + asynchronously in the background according to |'g:go_term_enabled'|. You + can set the mode of the new terminal with |'g:go_term_mode'|. *:GoTestCompile* :GoTestCompile[!] [expand] Compile your _test.go files via in your current directory. Errors are - populated in the quickfix window. If an argument is passed, 'expand' is + populated in the quickfix window. If an argument is passed, [expand] is used as file selector (useful for cases like `:GoTest ./...`). Useful to not run the tests and capture/fix errors before running the tests or to create test binary. @@ -380,10 +388,10 @@ CTRL-t If [!] is not given the first error is jumped to. If using neovim `:GoTestCompile` will run in a new terminal or run - asynchronously in the background according to |g:go_term_enabled|. You can - set the mode of the new terminal with |g:go_term_mode|. + asynchronously in the background according to |'g:go_term_enabled'|. You + can set the mode of the new terminal with |'g:go_term_mode'|. - *:GoCoverage* + *:GoCoverage* :GoCoverage[!] [options] Create a coverage profile and annotates the current file's source code. If @@ -391,7 +399,7 @@ CTRL-t If [!] is not given the first error is jumped to. - *:GoCoverageToggle* + *:GoCoverageToggle* :GoCoverageToggle[!] [options] Create a coverage profile and annotates the current file's source code. If @@ -399,7 +407,7 @@ CTRL-t If [!] is not given the first error is jumped to. - *:GoCoverageClear* + *:GoCoverageClear* :GoCoverageClear [options] Clears the coverage annotation. @@ -416,7 +424,7 @@ CTRL-t If [!] is not given the first error is jumped to. - *:GoErrCheck* + *:GoErrCheck* :GoErrCheck [options] Check for unchecked errors in you current package. Errors are populated in @@ -425,12 +433,12 @@ CTRL-t You may optionally pass any valid errcheck flags/options. For a full list please see `errcheck -h`. - *:GoFiles* + *:GoFiles* :GoFiles Show source files that depends for the current package - *:GoDeps* + *:GoDeps* :GoDeps Show dependencies for the current package @@ -439,23 +447,23 @@ CTRL-t :GoInstallBinaries Download and Install all necessary Go tool binaries such as `godef`, - `goimports`, `gocode`, etc.. under `g:go_bin_path`. Set |g:go_get_update| - to disable updating dependencies. + `goimports`, `gocode`, etc. under `g:go_bin_path`. Set + |'g:go_get_update'| to disable updating dependencies. - *:GoUpdateBinaries* + *:GoUpdateBinaries* :GoUpdateBinaries Download and Update previously installed Go tool binaries such as `godef`, `goimports`, `gocode`, etc.. under `g:go_bin_path`. This can be used to update the necessary Go binaries. - *:GoImplements* + *:GoImplements* :GoImplements - Show 'implements' relation for a selected package. A list of interfaces + Show "implements" relation for a selected package. A list of interfaces for the type that implements an interface under the cursor (or selected package) is shown in a location list. - *:GoRename* + *:GoRename* :GoRename[!] [to] Rename the identifier under the cursor to the desired new name. If no @@ -464,13 +472,13 @@ CTRL-t If [!] is not given the first error is jumped to. - *:GoGuruScope* + *:GoGuruScope* :GoGuruScope [pattern] [pattern2] ... [patternN] - Changes the custom |g:go_guru_scope| setting and overrides it with the + Changes the custom |'g:go_guru_scope'| setting and overrides it with the given package patterns. The custom scope is cleared (unset) if `""` is given as the only path. If no arguments is given it prints the current - custom scope. Example patterns are: + custom scope. Example patterns are: > golang.org/x/tools/cmd/guru # a single package golang.org/x/tools/... # all packages beneath dir @@ -488,21 +496,21 @@ CTRL-t Under the hood, the patterns are all joined to a comma-separated list and passed to `guru`'s `-scope` flag. - *:GoCallees* + *:GoCallees* :GoCallees - Show 'callees' relation for a selected package. A list of possible call + Show "callees" relation for a selected package. A list of possible call targets for the type under the cursor (or selected package) is shown in a location list. - *:GoCallers* + *:GoCallers* :GoCallers - Show 'callers' relation for a selected function. A list of possible + Show "callers" relation for a selected function. A list of possible callers for the selected function under the cursor is shown in a location list. - *:GoDescribe* + *:GoDescribe* :GoDescribe Shows various properties of the selected syntax: its syntactic kind, its @@ -511,15 +519,15 @@ CTRL-t identifier), etc. Almost any piece of syntax may be described, and the guru will try to print all the useful information it can. - *:GoCallstack* + *:GoCallstack* :GoCallstack - Shows 'callstack' relation for the selected function. An arbitrary path + Shows "callstack" relation for the selected function. An arbitrary path from the root of the callgraph to the selected function is shown in a location list. This may be useful to understand how the function is reached in a given program. - *:GoFreevars* + *:GoFreevars* :GoFreevars Enumerates the free variables of the selection. “Free variables” is a @@ -532,106 +540,121 @@ CTRL-t understand what the inputs are to a complex block of code even if you don’t plan to change it. - *:GoChannelPeers* + *:GoChannelPeers* :GoChannelPeers Shows the set of possible sends/receives on the channel operand of the - selected send or receive operation; the selection must be a <- token. + selected send or receive operation; the selection must be a `<-` token. For example, visually select a channel operand in the form of: - - "done <- true" - - and call |GoChannelPeers| on it. It will show where it was allocated, and +> + done <- true +< + And call |:GoChannelPeers| on it. It will show where it was allocated, and the sending and receiving endings. - *:GoReferrers* + *:GoReferrers* :GoReferrers The referrers query shows the set of identifiers that refer to the same object as does the selected identifier, within any package in the analysis scope. - *:GoSameIds* + *:GoSameIds* :GoSameIds Highlights all identifiers that are equivalent to the identifier under the cursor. - *:GoSameIdsClear* + *:GoSameIdsClear* :GoSameIdsClear Clears all SameIds highlights from a |:GoSameIds| call. - *:GoMetaLinter* + *:GoSameIdsToggle* +:GoSameIdsToggle + + Toggle between |:GoSameIds| and |:GoSameIdsClear|. + + *:GoSameIdsAutoToggle* +:GoSameIdsAutoToggle + + Enables or disables automatic highlighting of |:GoSameIds| while moving + the cursor. This basically toggles the option |'g:go_auto_sameids'| + on/off. + If enabled it starts highlighting whenever your cursor is. If disabled it + clears and stops automatic highlighting. + + *:GoMetaLinter* :GoMetaLinter [path] Calls the underlying `gometalinter` tool and displays all warnings and - errors in the quickfix window. By default the following linters are - enabled: "'vet', 'golint', 'errcheck'". This can be changed with the - |g:go_metalinter_enabled| variable. To override the command completely use - the variable |g:go_metalinter_command|. To override the maximum linters - execution time use |g:go_metalinter_deadline| variable. + errors in the |quickfix| window. By default the following linters are + enabled: `vet`, `golint`, and `errcheck`. This can be changed with the + |'g:go_metalinter_enabled'| variable. To override the command completely + use the variable |'g:go_metalinter_command'|. To override the maximum + linters execution time use |'g:go_metalinter_deadline'| variable. - *:GoGuruTags* + *:GoGuruTags* :GoGuruTags [tags] - Changes the custom |g:go_guru_tags| setting and overrides it with the + Changes the custom |'g:go_guru_tags'| setting and overrides it with the given build tags. This command cooperate with GoReferrers command when - there exist mulitiple build tags in your project, then you can set one - of the build tags for GoReferrers to find more accurate. + there exist mulitiple build tags in your project, then you can set one of + the build tags for GoReferrers to find more accurate. The custom build tags is cleared (unset) if `""` is given. If no arguments is given it prints the current custom build tags. *:AsmFmt* :AsmFmt - Filter the current Go asm buffer through asmfmt. It tries to preserve cursor - position and avoids replacing the buffer with stderr output. + Filter the current Go asm buffer through asmfmt. It tries to preserve + cursor position and avoids replacing the buffer with stderr output. - - *:GoAlternate* + *:GoAlternate* :GoAlternate[!] - Alternates between the implementation and test code. For example if in main.go, - switch to main_test.go. Uses the |g:go_alternate_mode| setting as the command - to open the file. + Alternates between the implementation and test code. For example if in + main.go, switch to main_test.go. Uses the |'g:go_alternate_mode'| setting + as the command to open the file. - If [!] is given then it switches to the new file even if it does not exist. + If [!] is given then it switches to the new file even if it does not + exist. - If you would like to override the traditional commands for alternating, add - the following to your .vimrc: + If you would like to override the traditional commands for alternating, + add the following to your .vimrc: > augroup go autocmd! - autocmd Filetype go command! -bang A call go#alternate#Switch(0, 'edit') - autocmd Filetype go command! -bang AV call go#alternate#Switch(0, 'vsplit') - autocmd Filetype go command! -bang AS call go#alternate#Switch(0, 'split') + autocmd Filetype go + \ command! -bang A call go#alternate#Switch(0, 'edit') + \| command! -bang AV call go#alternate#Switch(0, 'vsplit') + \| command! -bang AS call go#alternate#Switch(0, 'split') augroup END < - *:GoDecls* + *:GoWhicherrs* +:GoWhicherrs + + Show the list of possible constants, global variables, and concrete types + for the error type under the cursor in a location list. + + *:GoDecls* :GoDecls [file] - + Only enabled if `ctrlp.vim` is installed. If run shows all function and type declarations for the current file. If [file] is non empty it parses - the given file. - By default `type` and `func` declarations are being showed. This can be - changed via |g:go_decls_includes|, which accepts a comma delimited list of - definitions. By default set to: `"func,type"`. Possible options are: - `{func,type}` + the given file. + By default `type` and `func` declarations are shown. This can be changed + via |'g:go_decls_includes'|. - *:GoDeclsDir* + *:GoDeclsDir* :GoDeclsDir [dir] - + Only enabled if `ctrlp.vim` is installed. If run shows all function and type declarations for the current directory. If [dir] is given it parses the given directory. - By default `type` and `func` declarations are being showed. This can be - changed via |g:go_decls_includes|, which accepts a comma delimited list of - definitions. By default set to: `"func,type"`. Possible options are: - `{func,type}` - *:GoImpl* + *:GoImpl* :GoImpl [receiver] [interface] Generates method stubs for implementing an interface. If no arguments is @@ -642,9 +665,48 @@ CTRL-t :GoImpl f *Foo io.Writer :GoImpl T io.ReadWriteCloser < - + *:GoAddTags* +:[range]GoAddTags [key] [key1] ... -=============================================================================== + Adds field tags for the fields of a struct. If called inside a struct it + automatically add field tags with the `json` key and the value + automatically generated based on the field name. An error message is given + if it's called outside a struct definition. + + If [range] is given, only the selected fields will be changed. + + The default `json` can be changed by providing one or more [key] + arguments. An example of adding `xml` and `db` would be: +> + :GoAddTags xml db +< + *:GoAutoTypeInfoToggle* +:GoAutoTypeInfoToggle + + Toggles |'g:go_auto_type_info'|. + + *:GoFmtAutoSaveToggle* +:GoFmtAutoSaveToggle + + Toggles |'g:go_fmt_autosave'|. + + *:GoAsmFmtAutoSaveToggle* +:GoAsmFmtAutoSaveToggle + + Toggles |'g:go_asmfmt_autosave'|. + + *:GoMetalinterAutoSaveToggle* +:GoMetalinterAutoSaveToggle + + Toggles |'g:go_metalinter_autosave'|. + + *:GoTemplateAutoCreateToggle* +:GoTemplateAutoCreateToggle + + Toggles |'g:go_template_autocreate'|. + + +============================================================================== MAPPINGS *go-mappings* vim-go has several keys which can be used to create custom mappings @@ -657,11 +719,11 @@ As always one is free to create more advanced mappings or functions based with |go-commands|. For more information please check out the mappings command documentation in the |go-commands| section. Available keys are: - *(go-run)* + *(go-run)* Calls `go run` for the current main package - *(go-run-tab)* + *(go-run-tab)* Calls `go run` for the current file in a new terminal tab This option is neovim only. @@ -671,46 +733,45 @@ This option is neovim only. Calls `go run` for the current file in a new terminal horizontal split This option is neovim only. - *(go-run-vertical)* + *(go-run-vertical)* Calls `go run` for the current file in a new terminal vertical split This option is neovim only. - - *(go-build)* + *(go-build)* Calls `go build` for the current package - *(go-generate)* + *(go-generate)* Calls `go generate` for the current package - *(go-info)* + *(go-info)* Shows type information for the word under the cursor - *(go-install)* + *(go-install)* Calls `go install` for the current package - *(go-test)* + *(go-test)* Calls `go test` for the current package - *(go-test-func)* + *(go-test-func)* Calls `go test -run '...'` for the test function immediate to cursor - *(go-test-compile)* + *(go-test-compile)* Calls `go test -c` for the current package - *(go-coverage)* + *(go-coverage)* Calls `go test -coverprofile-temp.out` for the current package and shows the coverage annotation. - *(go-coverage-clear)* + *(go-coverage-clear)* Clears the coverage annotation @@ -724,64 +785,62 @@ annotation. Calls `goimports` for the current package - *(go-vet)* + *(go-vet)* Calls `go vet` for the current package - *(go-files)* + *(go-files)* Show source files that depends for the current package - *(go-deps)* + *(go-deps)* Show dependencies for the current package - *(go-doc)* + *(go-doc)* Show the relevant GoDoc for the word under the cursor in a split window leftabove (default mode). - *(go-doc-split)* + *(go-doc-split)* Show the relevant GoDoc for the word under the cursor in a split window. - *(go-doc-vertical)* + *(go-doc-vertical)* Show the relevant GoDoc for the word under the cursor in a vertical split window. - - *(go-doc-tab)* + *(go-doc-tab)* Show the relevant GoDoc for the word under the cursor in a tab window. - *(go-doc-browser)* + *(go-doc-browser)* Show the relevant GoDoc for the word under in browser - *(go-def)* + *(go-def)* Goto declaration/definition. Results are shown in the current buffer. + *(go-def-split)* - *(go-def-split)* +Goto declaration/definition. Results are shown in a split window. +Jumps to an existing buffer if |'g:go_def_reuse_buffer'| is enabled. -Goto declaration/definition. Results are shown in a split window. -Jumps to an existing buffer if |g:go_def_reuse_buffer| is enabled. - - *(go-def-vertical)* + *(go-def-vertical)* Goto declaration/definition. Results are shown in a vertical split window. -Jumps to an existing buffer if |g:go_def_reuse_buffer| is enabled. +Jumps to an existing buffer if |'g:go_def_reuse_buffer'| is enabled. - *(go-def-tab)* + *(go-def-tab)* Goto declaration/definition. Results are shown in a tab window. -Jumps to an existing buffer if |g:go_def_reuse_buffer| is enabled. +Jumps to an existing buffer if |'g:go_def_reuse_buffer'| is enabled. *(go-def-stack)* @@ -791,77 +850,76 @@ Shows the godef tag stack Resets and clears the tag stack - *(go-def-pop)* + *(go-def-pop)* Jump to previous entry in the tag stack - *(go-implements)* + *(go-implements)* Show the interfaces that the type under the cursor implements. - *(go-rename)* + *(go-rename)* Rename the identifier under the cursor to the desired new name - *(go-callees)* + *(go-callees)* Show the call targets for the type under the cursor - *(go-callers)* + *(go-callers)* Show possible callers of selected function - *(go-describe)* + *(go-describe)* Describe selected syntax: definition, methods, etc - - *(go-callstack)* + *(go-callstack)* Show path from callgraph root to selected function - *(go-freevars)* + *(go-freevars)* Show free variables of selection - *(go-channelpeers)* + *(go-channelpeers)* Show send/receive corresponding to selected channel op - *(go-referrers)* + *(go-referrers)* Show all refs to entity denoted by selected identifier - *(go-metalinter)* + *(go-metalinter)* Calls `go-metalinter` for the current directory - *(go-alternate-edit)* + *(go-alternate-edit)* Alternates between the implementation and test code in the current window - *(go-alternate-split)* + *(go-alternate-split)* Alternates between the implementation and test code in a new horizontal split - *(go-alternate-vertical)* + *(go-alternate-vertical)* Alternates between the implementation and test code in a new vertical split - *(go-import)* + *(go-import)* Calls `:GoImport` for the current package -=============================================================================== +============================================================================== TEXT OBJECTS *go-text-objects* vim-go comes with several custom |text-objects| that can be used to operate upon regions of text. vim-go currently defines the following text objects: *go-v_af* *go-af* -af "a function", select contents from a function definition to the - closing bracket. If |g:go_textobj_include_function_doc| is +af "a function", select contents from a function definition to the + closing bracket. If |'g:go_textobj_include_function_doc'| is enabled it also includes the comment doc for a function declaration. This text-object also supports literal functions. @@ -874,9 +932,9 @@ if "inside a function", select contents of a function, vim-go also defines the following text motion objects: *go-v_]]* *go-]]* -]] [count] forward to next function declaration. If - |g:go_textobj_include_function_doc| is enabled and if your - on a comment, it skips the function which the comment +]] [count] forward to next function declaration. If + |'g:go_textobj_include_function_doc'| is enabled and if your + on a comment, it skips the function which the comment belongs and forwards to the next function declaration. *go-v_[[* *go-[[* @@ -884,34 +942,33 @@ vim-go also defines the following text motion objects: -=============================================================================== +============================================================================== FUNCTIONS *go-functions* *go#jobcontrol#Statusline()* Shows the status of a job running asynchronously. Can be used to plug into the statusline. It works to show the status per package instead of per -file. Assume you have three files open, all belonging to the same package, -if the package build (`:GoBuild`) is successful, all statusline's will be empty +file. Assume you have three files open, all belonging to the same package, if +the package build (`:GoBuild`) is successful, all statusline's will be empty (means SUCCESS), if you it fails all file's statusline will show FAILED. - *go#complete#GetInfo()* + *go#complete#GetInfo()* Returns the description of the identifer under the cursor. Can be used to plug -into the statusline. This function is also used for |g:go_auto_type_info|. +into the statusline. This function is also used for |'g:go_auto_type_info'|. -=============================================================================== +============================================================================== SETTINGS *go-settings* - *'g:go_test_timeout'* + *'g:go_test_timeout'* Use this option to change the test timeout of |:GoTest|. By default it is set to 10 seconds . > let g:go_test_timeout= '10s' < - - *'g:go_play_browser_command'* + *'g:go_play_browser_command'* Use this option to change the browser that is used to open the snippet url posted to play.golang.org with |:GoPlay| or for the relevant documentation @@ -920,29 +977,29 @@ the current OS. > let g:go_play_browser_command = '' < - *'g:go_play_open_browser'* + *'g:go_play_open_browser'* Use this option to open browser after posting the snippet to play.golang.org with |:GoPlay|. By default it's enabled. > let g:go_play_open_browser = 1 < - *'g:go_auto_type_info'* + *'g:go_auto_type_info'* -Use this option to show the type info (|:GoInfo|) for the word under the cursor -automatically. Whenever the cursor changes the type info will be updated. -By default it's disabled. +Use this option to show the type info (|:GoInfo|) for the word under the +cursor automatically. Whenever the cursor changes the type info will be +updated. By default it's disabled. > let g:go_auto_type_info = 0 < - *'g:go_auto_sameids'* + *'g:go_auto_sameids'* Use this option to highlight all uses of the identifier under the cursor (:GoSameIds) automatically. By default it's disabled. > let g:go_auto_sameids = 0 < - *'g:go_jump_to_error'* + *'g:go_jump_to_error'* Use this option to enable/disable passing the bang attribute to the mappings |(go-build)|, |(go-run)|, etc.. When enabled it will jump to the first error @@ -953,36 +1010,34 @@ changing the behaviour of our custom static mappings. By default it's enabled. > let g:go_jump_to_error = 1 < - *'g:go_fmt_autosave'* + *'g:go_fmt_autosave'* Use this option to auto |:GoFmt| on save. By default it's enabled > let g:go_fmt_autosave = 1 < - *'g:go_fmt_command'* + *'g:go_fmt_command'* Use this option to define which tool is used to gofmt. By default `gofmt` is used > let g:go_fmt_command = "gofmt" < - *'g:go_fmt_options'* + *'g:go_fmt_options'* -Use this option to add additional options to the |g:go_fmt_command|. Default +Use this option to add additional options to the |'g:go_fmt_command'|. Default is empty. > let g:go_fmt_options = '' < + *'g:go_fmt_fail_silently'* - *'g:go_fmt_fail_silently'* - -Use this option to disable showing a location list when |g:go_fmt_command| +Use this option to disable showing a location list when |'g:go_fmt_command'| fails. By default the location list is shown. > let g:go_fmt_fail_silently = 0 < - - *'g:go_fmt_experimental'* + *'g:go_fmt_experimental'* Use this option to enable fmt's experimental mode. This experimental mode is superior to the current mode as it fully saves the undo history, so undo/redo @@ -991,15 +1046,15 @@ it's causing problems on some Vim versions. By default it's disabled. > let g:go_fmt_experimental = 0 < - *'g:go_doc_keywordprg_enabled'* + *'g:go_doc_keywordprg_enabled'* -Use this option to run `godoc` on words under the cursor with the default -K , keywordprg shortcut. Usually this shortcut is set to use the program `man`. -In Go, using `godoc` is more idiomatic. Default is enabled. > +Use this option to run `godoc` on words under the cursor with the default K , +keywordprg shortcut. Usually this shortcut is set to use the program `man`. In +Go, using `godoc` is more idiomatic. Default is enabled. > let g:go_doc_keywordprg_enabled = 1 < - *'g:go_def_mode'* + *'g:go_def_mode'* Use this option to define the command to be used for |:GoDef|. By default `guru` is being used as it covers all edge cases. But one might also use @@ -1007,11 +1062,11 @@ Use this option to define the command to be used for |:GoDef|. By default let g:go_def_mode = 'guru' < - *'g:go_def_mapping_enabled'* + *'g:go_def_mapping_enabled'* Use this option to enable/disable the default mapping of CTRL-] and (`gd`) for -GoDef and CTRL-t for :GoDefPop. Disabling it allows you to map something else to -these keys or mappings. Default is enabled. > +GoDef and CTRL-t for :GoDefPop. Disabling it allows you to map something else +to these keys or mappings. Default is enabled. > let g:go_def_mapping_enabled = 1 < @@ -1022,25 +1077,24 @@ mappings of |:GoDef|. By default it's disabled. > let g:go_def_reuse_buffer = 0 < + *'g:go_dispatch_enabled'* - *'g:go_dispatch_enabled'* - -Use this option to enable/disable the use of Dispatch to execute the -`:GoRun`, `:GoBuild` and `:GoGenerate` commands. More information about Dispatch -is available at https://github.com/tpope/vim-dispatch. Default is disabled. > +Use this option to enable/disable the use of Dispatch to execute the `:GoRun`, +`:GoBuild` and `:GoGenerate` commands. More information about Dispatch is +available at https://github.com/tpope/vim-dispatch. Default is disabled. > let g:go_dispatch_enabled = 0 < - *'g:go_doc_command'* + *'g:go_doc_command'* Use this option to define which tool is used to godoc. By default `godoc` is used > let g:go_doc_command = "godoc" < - *'g:go_doc_options'* + *'g:go_doc_options'* -Use this option to add additional options to the |g:go_doc_command|. Default +Use this option to add additional options to the |'g:go_doc_command'|. Default is empty. > let g:go_doc_options = '' @@ -1048,20 +1102,19 @@ is empty. > < *'g:go_bin_path'* Use this option to change default path for vim-go tools when using -|GoInstallBinaries| and |GoUpdateBinaries|. If not set `$GOBIN` or +|:GoInstallBinaries| and |:GoUpdateBinaries|. If not set `$GOBIN` or `$GOPATH/bin` is used. > let g:go_bin_path = "" < - *'g:go_snippet_engine'* + *'g:go_snippet_engine'* Use this option to define the default snippet engine. By default "ultisnips" is used. Use "neosnippet" for neosnippet.vim: > let g:go_snippet_engine = "ultisnips" < - - *'g:go_snippet_case_type'* + *'g:go_snippet_case_type'* Use this option to define the default conversion type of snippet expansion for field tags. For the following case, if `snakecase` is used the `json` snippet @@ -1078,38 +1131,44 @@ If "camelcase" is used: FooBarQuz string `json:"fooBarQuz" } < -By default "snakecase" is used. Current values are: ["snakecase", "camelcase"]. +By default "snakecase" is used. Current values are: ["snakecase", +"camelcase"]. > let g:go_snippet_case_type = "snakecase" < + *'g:go_get_update'* - *'g:go_get_update'* - -Use this option to disable updating dependencies with |GoInstallBinaries|. By +Use this option to disable updating dependencies with |:GoInstallBinaries|. By default this is enabled. > let g:go_get_update = 1 < - - *'g:go_guru_scope'* + *'g:go_guru_scope'* Use this option to define the scope of the analysis to be passed for guru -related commands, such as |GoImplements|, |GoCallers|, etc.You can change it -on-the-fly with |GoGuruScope|. The input should be a a list of package +related commands, such as |:GoImplements|, |:GoCallers|, etc. You can change +it on-the-fly with |:GoGuruScope|. The input should be a a list of package pattern. An example input might be: -`["github.com/fatih/color","github.com/fatih/structs"]` By default it's not set, -so the relevant commands defaults are being used. +`["github.com/fatih/color","github.com/fatih/structs"]` By default it's not +set, so the relevant commands defaults are being used. > let g:go_guru_scope = [] < + *'g:go_guru_tags'* - *'g:go_highlight_array_whitespace_error'* +These options that will be automatically passed to the `-tags` option of +`go guru` when it's invoked with |:GoDef|. You can use |:GoGuruTags| to set +this. By default it's not set. +> + let g:go_guru_tags = '' +< + + *'g:go_highlight_array_whitespace_error'* Highlights white space after "[]". > let g:go_highlight_array_whitespace_error = 1 < - *'g:go_highlight_chan_whitespace_error'* Highlights white space around the communications operator (`<-`) that doesn't @@ -1117,14 +1176,12 @@ follow the standard style. > let g:go_highlight_chan_whitespace_error = 1 < - *'g:go_highlight_extra_types'* Highlights commonly used library types (io.Reader, etc.). > let g:go_highlight_extra_types = 1 < - *'g:go_highlight_space_tab_error'* Highlights instances of tabs following spaces. > @@ -1136,100 +1193,106 @@ Highlights instances of tabs following spaces. > Highlights trailing white space. > let g:go_highlight_trailing_whitespace_error = 1 - < *'g:go_highlight_operators'* Highlights operators such as `:=` , `==`, `-=`, etc. By default it's disabled. > - let g:go_highlight_operators = 0 + let g:go_highlight_operators = 0 < - *'g:go_highlight_functions'* + *'g:go_highlight_functions'* Highlights function names. By default it's disabled. > - let g:go_highlight_functions = 0 + let g:go_highlight_functions = 0 < - *'g:go_highlight_methods'* + *'g:go_highlight_methods'* Highlights method names. By default it's disabled. > - let g:go_highlight_methods = 0 + let g:go_highlight_methods = 0 < - *'g:go_highlight_types'* + *'g:go_highlight_types'* Highlights struct and interface names. By default it's disabled. > let g:go_highlight_types = 0 < - *'g:go_highlight_fields'* + *'g:go_highlight_fields'* Highlights field names. By default it's disabled. > let g:go_highlight_fields = 0 < - *'g:go_highlight_build_constraints'* + *'g:go_highlight_build_constraints'* Highlights build constraints. By default it's disabled. > - let g:go_highlight_build_constraints = 0 + let g:go_highlight_build_constraints = 0 < - *'g:go_highlight_string_spellcheck* + *'g:go_highlight_string_spellcheck'* Use this option to highlight spelling errors in strings when |spell| is also enabled. By default it's enabled. > - let g:go_highlight_string_spellcheck = 1 + let g:go_highlight_string_spellcheck = 1 < - *'g:go_highlight_format_strings* + *'g:go_highlight_format_strings'* Use this option to highlight printf-style operators inside string literals. By default it's enabled. > - let g:go_highlight_format_strings = 1 + let g:go_highlight_format_strings = 1 < - *'g:go_autodetect_gopath'* + *'g:go_autodetect_gopath'* Automatically modifies GOPATH for certain directory structures, such as for the tool `godep` which has his own dependencies via the `Godeps` folder. What this means is that all tools are now working with the newly modified GOPATH. -So |GoDef| for example jumps to the source inside the `Godeps` (vendored) +So |:GoDef| for example jumps to the source inside the `Godeps` (vendored) source. Currently `godep` and `gb` is supported, in the near future more tool supports will be added. By default it's enabled. > - let g:go_autodetect_gopath = 1 + let g:go_autodetect_gopath = 1 < - *'g:go_textobj_enabled'* + *'g:go_textobj_enabled'* Adds custom text objects. By default it's enabled. > - let g:go_textobj_enabled = 1 + let g:go_textobj_enabled = 1 < - *'g:go_metalinter_autosave'* + *'g:go_textobj_include_function_doc'* + +Consider the comment above a function to be part of the function when using +the `af` text object and `[[` motion. By default it's enabled. > + + let g:go_textobj_include_function_doc = 1 +< + *'g:go_metalinter_autosave'* Use this option to auto |:GoMetaLinter| on save. Only linter messages for the active buffer will be shown. By default it's disabled > let g:go_metalinter_autosave = 0 < - *'g:go_metalinter_autosave_enabled'* + *'g:go_metalinter_autosave_enabled'* -Specifies the enabled linters for auto |GoMetaLinter| on save. By +Specifies the enabled linters for auto |:GoMetaLinter| on save. By default it's using `vet` and `golint`. > let g:go_metalinter_autosave_enabled = ['vet', 'golint'] < - *'g:go_metalinter_enabled'* + *'g:go_metalinter_enabled'* -Specifies the currently enabled linters for the |GoMetaLinter| command. By +Specifies the currently enabled linters for the |:GoMetaLinter| command. By default it's using `vet`, `golint` and `errcheck`. > let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck'] < - *'g:go_metalinter_command'* + *'g:go_metalinter_command'* -Overrides the command to be executed when |GoMetaLinter| is called. This is +Overrides the command to be executed when |:GoMetaLinter| is called. This is an advanced settings and is for users who want to have a complete control over how `gometalinter` should be executed. By default it's empty. > @@ -1242,7 +1305,7 @@ seconds. > let g:go_metalinter_deadline = "5s" < - *'g:go_list_height'* + *'g:go_list_height'* Specifies the window height for the quickfix and location list windows. The default value (empty) automatically sets the height to the number of items @@ -1251,7 +1314,7 @@ explicitly overrides this behavior. For standard Vim behavior, set it to 10. > let g:go_list_height = 0 < - *'g:go_list_type'* + *'g:go_list_type'* Specifies the type of list to use. The default value (empty) will use the appropriate kind of list for the command that was called. Supported values are @@ -1259,13 +1322,13 @@ appropriate kind of list for the command that was called. Supported values are let g:go_list_type = "" < - *'g:go_asmfmt_autosave'* + *'g:go_asmfmt_autosave'* Use this option to auto |:AsmFmt| on save. By default it's enabled. > let g:go_asmfmt_autosave = 1 < - *g:go_term_mode* + *'g:go_term_mode'* This option is Neovim only. Use it to change the default command used to open a new terminal for go commands such as |:GoRun|. @@ -1273,8 +1336,8 @@ The default is vsplit. > let g:go_term_mode = "vsplit" < - *g:go_term_height* - *g:go_term_width* + *'g:go_term_height'* + *'g:go_term_width'* These options are Neovim only. Use them to control the height and width of a terminal split. By default these are not set, meaning that the height and @@ -1286,51 +1349,51 @@ For example here is how to set each to 30. let g:go_term_height = 30 let g:go_term_width = 30 < - *g:go_term_enabled* + *'g:go_term_enabled'* This option is Neovim only. Use it to change the behavior of the test commands. If set to 1 it opens the test commands inside a new terminal -according to |g:go_term_mode|, otherwise it will run them in the background -just like `:GoBuild` and then display the status with |go#jobcontrol#Statusline()|. -By default it is disabled. +according to |'g:go_term_mode'|, otherwise it will run them in the background +just like `:GoBuild` and then display the status with +|go#jobcontrol#Statusline()|. By default it is disabled. > let g:go_term_enabled = 0 < - *g:go_alternate_mode* + *'g:go_alternate_mode'* Specifies the command that |:GoAlternate| uses to open the alternate file. By default it is set to edit. > let g:go_alternate_mode = "edit" < - *g:go_gorename_prefill* + *'g:go_gorename_prefill'* Specifies whether |:GoRename| prefills the new identifier name with the word under the cursor. By default it is enabled. > let g:go_gorename_prefill = 1 < - *g:go_gocode_autobuild* + *'g:go_gocode_autobuild'* Specifies whether `gocode` should automatically build out-of-date packages -when their source fiels are modified, in order to obtahin the freshes +when their source fields are modified, in order to obtain the freshest autocomplete results for them. By default it is enabled. > let g:go_gocode_autobuild = 1 < - *g:go_gocode_propose_builtins* + *'g:go_gocode_propose_builtins'* Specifies whether `gocode` should add built-in types, functions and constants to an autocompletion proposals. By default it is enabled. > let g:go_gocode_propose_builtins = 1 < - *g:go_template_autocreate* + *'g:go_template_autocreate'* When a new Go file is created, vim-go automatically fills the buffer content with a Go code template. By default the template under `templates/hello_world.go` is used. This can be changed with the -|g:go_template_file| setting. +|'g:go_template_file'| setting. If the new file is created in an already prepopulated package (with other Go files), in this case a Go code template with only the Go package declaration @@ -1340,64 +1403,81 @@ By default it is enabled. > let g:go_template_autocreate = 1 < - *g:go_template_file* + *'g:go_template_file'* Specifies the file under the `templates` folder that is used if a new Go file -is created. Checkout |g:go_template_autocreate| for more info. By default the -`hello_world.go` file is used. +is created. Checkout |'g:go_template_autocreate'| for more info. By default +the `hello_world.go` file is used. > let g:go_template_file = "hello_world.go" < -=============================================================================== + *'g:go_decls_includes'* + + Only useful if `ctrlp.vim` is installed. This sets which declarations to + show for |:GoDecls|. + It is a Comma delimited list Possible options are: {func,type}. + The default is: > + + let g:go_decls_includes = 'func,type' +< +============================================================================== TROUBLESHOOTING *go-troubleshooting* -I'm using Fish shell but have some problems using vim-go~ +I get "not an editor command" error when I invoke :GoXXX~ -First environment variables in Fish are applied differently, it should be like: +This happens if vim-go is not installed properly. Be sure you have added this +line into your vimrc: > - set -x GOPATH /your/own/gopath + filetype plugin indent on < -Second, Vim needs a POSIX compatible shell (more info here: -https://github.com/dag/vim-fish#teach-a-vim-to-fish). If you use Fish to open -Vim, it will make certain shell based commands fail (means vim-go will fail -too). To overcome this problem change the default shell by adding the -following into your .vimrc (on the top of the file): -> - if $SHELL =~ 'fish' - set shell='/bin/sh' - endif -< -or -> - set shell='/bin/sh' -> -I'm seeing weird errors during installation of binaries with -GoInstallBinaries: +I get a "command not found" error when I invoke :GoXXX~ + +If you try to call |:GoDef|, |:GoInfo| and get a command not found, check that +you have the binaries installed by using |:GoInstallBinaries|. + +Before opening vim, check your current $PATH: +> + echo $PATH +< +After opening vim, run `:echo $PATH`, the output must be your current `$PATH` +plus `$GOPATH/bin` (the location where |:GoInstallBinaries| installed the +binaries). + + +Vim becomes slow while editing Go files~ + +Don't enable these options: +> + let g:go_highlight_structs = 0 + let g:go_highlight_interfaces = 0 + let g:go_highlight_operators = 0 +< + +I get errors when using GoInstallBinaries~ If you see errors like this: > - Error installing code.google.com/p/go.tools/cmd/goimports: - Error installing code.google.com/p/rog-go/exp/cmd/godef: + Error installing golang.org/x/tools/cmd/goimports < that means your local Go setup is broken or the remote website is down. For -example sometimes code.google.com times out. To test, just execute a simple go -get: +example sometimes code.google.com times out. To test, just execute a simple +`go get`: -> - go get code.google.com/p/go.tools/cmd/goimports + go get golang.org/x/tools/cmd/goimports < You'll see a more detailed error. If this works, vim-go will work too. -=============================================================================== + +============================================================================== CREDITS *go-credits* -* Go Authors for official vim plugins +* Go Authors for official Vim plugins. * Gocode, Godef, Golint, Guru, Goimports, Errcheck projects and authors of those projects. * Other vim-plugins, thanks for inspiration (vim-golang, go.vim, vim-gocode, - vim-godef) -* vim-go contributors: https://github.com/fatih/vim-go/graphs/contributors + vim-godef). +* vim-go contributors: https://github.com/fatih/vim-go/graphs/contributors. vim:ft=help:et:ts=2:sw=2:sts=2:norl diff --git a/sources_non_forked/vim-go/ftplugin/go/commands.vim b/sources_non_forked/vim-go/ftplugin/go/commands.vim index 31e1f044..89c1a984 100644 --- a/sources_non_forked/vim-go/ftplugin/go/commands.vim +++ b/sources_non_forked/vim-go/ftplugin/go/commands.vim @@ -4,6 +4,7 @@ command! -nargs=? GoRename call go#rename#Rename(0,) " -- guru command! -nargs=* -complete=customlist,go#package#Complete GoGuruScope call go#guru#Scope() command! -range=% GoImplements call go#guru#Implements() +command! -range=% GoWhicherrs call go#guru#Whicherrs() command! -range=% GoCallees call go#guru#Callees() command! -range=% GoDescribe call go#guru#Describe() command! -range=% GoCallers call go#guru#Callers() @@ -12,13 +13,20 @@ command! -range=% GoFreevars call go#guru#Freevars() command! -range=% GoChannelPeers call go#guru#ChannelPeers() command! -range=% GoReferrers call go#guru#Referrers() command! -nargs=? GoGuruTags call go#guru#Tags() + + +command! -nargs=* -range GoAddTags call go#util#AddTags(, , ) + command! -range=% GoSameIds call go#guru#SameIds() command! -range=0 GoSameIdsClear call go#guru#ClearSameIds() +command! -range=% GoSameIdsToggle call go#guru#ToggleSameIds() +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(0,) @@ -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, '', , '') command! -nargs=1 -bang -complete=customlist,go#package#Complete GoImport call go#import#SwitchImport(1, '', , '') @@ -59,6 +71,7 @@ command! -nargs=* -bang -complete=customlist,go#package#Complete GoImportAs call " -- linters command! -nargs=* GoMetaLinter call go#lint#Gometa(0, ) +command! -nargs=0 GoMetalinterAutoSaveToggle call go#lint#ToggleMetaLinterAutoSave() command! -nargs=* GoLint call go#lint#Golint() command! -nargs=* -bang GoVet call go#lint#Vet(0, ) command! -nargs=* -complete=customlist,go#package#Complete GoErrCheck call go#lint#Errcheck() @@ -75,4 +88,7 @@ endif " -- impl command! -nargs=* -buffer -complete=customlist,go#impl#Complete GoImpl call go#impl#Impl() +" -- template +command! -nargs=0 GoTemplateAutoCreateToggle call go#template#ToggleAutoCreate() + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/ftplugin/go/mappings.vim b/sources_non_forked/vim-go/ftplugin/go/mappings.vim index 7bf8dcf3..b798209d 100644 --- a/sources_non_forked/vim-go/ftplugin/go/mappings.vim +++ b/sources_non_forked/vim-go/ftplugin/go/mappings.vim @@ -44,6 +44,8 @@ xnoremap (go-freevars) :call go#guru#Freevars(0) nnoremap (go-channelpeers) :call go#guru#ChannelPeers(-1) nnoremap (go-referrers) :call go#guru#Referrers(-1) nnoremap (go-sameids) :call go#guru#SameIds(-1) +nnoremap (go-whicherrs) :call go#guru#Whicherrs(-1) +nnoremap (go-sameids-toggle) :call go#guru#ToggleSameIds(-1) nnoremap (go-rename) :call go#rename#Rename(!g:go_jump_to_error) diff --git a/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets b/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets index 15d9b76f..fcb82985 100644 --- a/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets +++ b/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets @@ -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 diff --git a/sources_non_forked/vim-go/gosnippets/snippets/go.snip b/sources_non_forked/vim-go/gosnippets/snippets/go.snip index 413eb1e1..942a82e0 100644 --- a/sources_non_forked/vim-go/gosnippets/snippets/go.snip +++ b/sources_non_forked/vim-go/gosnippets/snippets/go.snip @@ -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 diff --git a/sources_non_forked/vim-go/plugin/go.vim b/sources_non_forked/vim-go/plugin/go.vim index 3ba16d7e..6c050083 100644 --- a/sources_non_forked/vim-go/plugin/go.vim +++ b/sources_non_forked/vim-go/plugin/go.vim @@ -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() - " 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 diff --git a/sources_non_forked/vim-go/syntax/go.vim b/sources_non_forked/vim-go/syntax/go.vim index 0ead7527..33315317 100644 --- a/sources_non_forked/vim-go/syntax/go.vim +++ b/sources_non_forked/vim-go/syntax/go.vim @@ -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\)\>/ diff --git a/sources_non_forked/vim-snippets/UltiSnips/html.snippets b/sources_non_forked/vim-snippets/UltiSnips/html.snippets index fd1aca51..4e92a960 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/html.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/html.snippets @@ -127,7 +127,6 @@ endsnippet ############# snippet input "Input with Label" w - endsnippet snippet input "XHTML " w @@ -141,9 +140,7 @@ endsnippet snippet select "Select Box" w endsnippet @@ -162,25 +159,25 @@ endsnippet snippet body "" - $0 + ${0:${VISUAL}} endsnippet snippet div "
" w
- $0 + ${0:${VISUAL}}
endsnippet snippet div. "
with class" w - $0 + ${0:${VISUAL}}
endsnippet snippet div# "
with ID & class" w - $0 + ${0:${VISUAL}}
endsnippet @@ -188,33 +185,39 @@ snippet form "XHTML
" w - $0 - -

+ ${0:${VISUAL}}
endsnippet snippet h1 "XHTML

" w -

$0

+

${0:${VISUAL}}

endsnippet snippet h2 "XHTML

" w -

$0

+

${0:${VISUAL}}

endsnippet snippet h3 "XHTML

" w -

$0

+

${0:${VISUAL}}

endsnippet snippet h4 "XHTML

" w -

$0

+

${0:${VISUAL}}

+endsnippet + +snippet h5 "XHTML
" w +
${0:${VISUAL}}
+endsnippet + +snippet h6 "XHTML
" w +
${0:${VISUAL}}
endsnippet snippet head "XHTML " ${1:`!p snip.rv = snip.basename or "Page Title"`} - $0 + ${0:${VISUAL}} endsnippet @@ -232,20 +235,19 @@ endsnippet snippet script "XHTML endsnippet snippet style "XHTML endsnippet snippet table "XHTML " w
- - + ${0:${VISUAL}}
${5:Header}
${0:Data}
endsnippet @@ -254,29 +256,29 @@ snippet a "Link" w endsnippet snippet p "paragraph" w -

$0

+

${0:${VISUAL}}

endsnippet snippet li "list item" w -
  • $0
  • +
  • ${0:${VISUAL}}
  • endsnippet snippet ul "unordered list" w
      -$0 + ${0:${VISUAL}}
    endsnippet snippet td "table cell" w -$0 +${0:${VISUAL}} endsnippet snippet th "table header" w -$0 +${0:${VISUAL}} endsnippet snippet tr "table row" w -$0 +${0:${VISUAL}} endsnippet snippet title "XHTML " 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 diff --git a/sources_non_forked/vim-snippets/snippets/elixir.snippets b/sources_non_forked/vim-snippets/snippets/elixir.snippets index 851dc8be..0a3efbdc 100644 --- a/sources_non_forked/vim-snippets/snippets/elixir.snippets +++ b/sources_non_forked/vim-snippets/snippets/elixir.snippets @@ -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 diff --git a/sources_non_forked/vim-snippets/snippets/go.snippets b/sources_non_forked/vim-snippets/snippets/go.snippets index b3acac1a..b2bdc9e0 100644 --- a/sources_non_forked/vim-snippets/snippets/go.snippets +++ b/sources_non_forked/vim-snippets/snippets/go.snippets @@ -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} diff --git a/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets b/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets index 0d054f4e..db04e545 100644 --- a/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets +++ b/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets @@ -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}) { diff --git a/sources_non_forked/vim-snippets/snippets/vhdl.snippets b/sources_non_forked/vim-snippets/snippets/vhdl.snippets new file mode 100644 index 00000000..f13f5bf9 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/vhdl.snippets @@ -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}'); From f8d1d3bb5008925a1af6a6cad09a915da6aeb7dc Mon Sep 17 00:00:00 2001 From: amix <amix@amix.dk> Date: Sat, 20 Aug 2016 13:23:52 +0200 Subject: [PATCH 3/8] Updated vim plugins --- .../lightline/colorscheme/solarized.vim | 77 +++++++++++++++++- .../lightline/colorscheme/solarized_dark.vim | 73 ----------------- .../lightline/colorscheme/solarized_light.vim | 80 ------------------- .../lightline.vim/doc/lightline.txt | 5 +- sources_non_forked/syntastic/README.markdown | 14 ++-- .../autoload/syntastic/preprocess.vim | 26 +++--- .../syntastic/doc/syntastic-checkers.txt | 32 ++++++++ .../syntastic/plugin/syntastic.vim | 2 +- .../syntastic/plugin/syntastic/registry.vim | 1 + .../dockerfile/dockerfile_lint.vim | 2 +- .../syntastic/syntax_checkers/perl/perl.vim | 16 ++-- .../syntastic/syntax_checkers/scala/fsc.vim | 3 +- .../syntax_checkers/solidity/solc.vim | 38 +++++++++ .../vim-coffee-script/after/syntax/haml.vim | 10 +++ .../vim-coffee-script/after/syntax/html.vim | 9 +++ .../vim-coffee-script/syntax/coffee.vim | 2 +- .../vim-fugitive/plugin/fugitive.vim | 2 +- sources_non_forked/vim-go/CHANGELOG.md | 5 ++ .../vim-go/autoload/go/complete.vim | 11 ++- .../vim-go/autoload/go/guru.vim | 12 ++- .../vim-go/autoload/go/package.vim | 11 ++- sources_non_forked/vim-go/doc/vim-go.txt | 7 ++ sources_non_forked/vim-go/ftplugin/go.vim | 2 +- .../vim-go/ftplugin/go/tagbar.vim | 2 +- sources_non_forked/vim-go/syntax/go.vim | 24 ++++-- .../vim-snippets/UltiSnips/ada.snippets | 4 +- .../vim-snippets/snippets/cpp.snippets | 2 +- 27 files changed, 264 insertions(+), 208 deletions(-) delete mode 100644 sources_non_forked/lightline.vim/autoload/lightline/colorscheme/solarized_dark.vim delete mode 100644 sources_non_forked/lightline.vim/autoload/lightline/colorscheme/solarized_light.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/solidity/solc.vim diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/solarized.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/solarized.vim index 2695c357..577177e2 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/solarized.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/solarized.vim @@ -2,10 +2,79 @@ " Filename: autoload/lightline/colorscheme/solarized.vim " Author: itchyny " License: MIT License -" Last Change: 2013/08/27 10:24:28. +" Last Change: 2016/08/08 10:31:00. " ============================================================================= -if &background ==# 'light' - let g:lightline#colorscheme#solarized#palette = g:lightline#colorscheme#solarized_light#palette + +let s:cuicolors = { + \ 'base03': [ '8', '234', 'DarkGray' ], + \ 'base02': [ '0', '235', 'Black' ], + \ 'base01': [ '10', '239', 'LightGreen' ], + \ 'base00': [ '11', '240', 'LightYellow' ], + \ 'base0': [ '12', '244', 'LightBlue' ], + \ 'base1': [ '14', '245', 'LightCyan' ], + \ 'base2': [ '7', '187', 'LightGray' ], + \ 'base3': [ '15', '230', 'White' ], + \ 'yellow': [ '3', '136', 'DarkYellow' ], + \ 'orange': [ '9', '166', 'LightRed' ], + \ 'red': [ '1', '124', 'DarkRed' ], + \ 'magenta': [ '5', '125', 'DarkMagenta' ], + \ 'violet': [ '13', '61', 'LightMagenta' ], + \ 'blue': [ '4', '33', 'DarkBlue' ], + \ 'cyan': [ '6', '37', 'DarkCyan' ], + \ 'green': [ '2', '64', 'DarkGreen' ], + \ } + +" The following condition only applies for the console and is the same +" condition vim-colors-solarized uses to determine which set of colors +" to use. +let s:solarized_termcolors = get(g:, 'solarized_termcolors', 256) +if s:solarized_termcolors != 256 && &t_Co >= 16 + let s:cuiindex = 0 +elseif s:solarized_termcolors == 256 + let s:cuiindex = 1 else - let g:lightline#colorscheme#solarized#palette = g:lightline#colorscheme#solarized_dark#palette + let s:cuiindex = 2 endif + +let s:base03 = [ '#002b36', s:cuicolors.base03[s:cuiindex] ] +let s:base02 = [ '#073642', s:cuicolors.base02[s:cuiindex] ] +let s:base01 = [ '#586e75', s:cuicolors.base01[s:cuiindex] ] +let s:base00 = [ '#657b83', s:cuicolors.base00[s:cuiindex] ] +let s:base0 = [ '#839496', s:cuicolors.base0[s:cuiindex] ] +let s:base1 = [ '#93a1a1', s:cuicolors.base1[s:cuiindex] ] +let s:base2 = [ '#eee8d5', s:cuicolors.base2[s:cuiindex] ] +let s:base3 = [ '#fdf6e3', s:cuicolors.base3[s:cuiindex] ] +let s:yellow = [ '#b58900', s:cuicolors.yellow[s:cuiindex] ] +let s:orange = [ '#cb4b16', s:cuicolors.orange[s:cuiindex] ] +let s:red = [ '#dc322f', s:cuicolors.red[s:cuiindex] ] +let s:magenta = [ '#d33682', s:cuicolors.magenta[s:cuiindex] ] +let s:violet = [ '#6c71c4', s:cuicolors.violet[s:cuiindex] ] +let s:blue = [ '#268bd2', s:cuicolors.blue[s:cuiindex] ] +let s:cyan = [ '#2aa198', s:cuicolors.cyan[s:cuiindex] ] +let s:green = [ '#859900', s:cuicolors.green[s:cuiindex] ] + +if &background ==# 'light' + let [ s:base03, s:base3 ] = [ s:base3, s:base03 ] + let [ s:base02, s:base2 ] = [ s:base2, s:base02 ] + let [ s:base01, s:base1 ] = [ s:base1, s:base01 ] + let [ s:base00, s:base0 ] = [ s:base0, s:base00 ] +endif + +let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} +let s:p.normal.left = [ [ s:base03, s:blue ], [ s:base03, s:base00 ] ] +let s:p.normal.right = [ [ s:base03, s:base1 ], [ s:base03, s:base00 ] ] +let s:p.inactive.right = [ [ s:base03, s:base00 ], [ s:base0, s:base02 ] ] +let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base0, s:base02 ] ] +let s:p.insert.left = [ [ s:base03, s:green ], [ s:base03, s:base00 ] ] +let s:p.replace.left = [ [ s:base03, s:red ], [ s:base03, s:base00 ] ] +let s:p.visual.left = [ [ s:base03, s:magenta ], [ s:base03, s:base00 ] ] +let s:p.normal.middle = [ [ s:base1, s:base02 ] ] +let s:p.inactive.middle = [ [ s:base01, s:base02 ] ] +let s:p.tabline.left = [ [ s:base03, s:base00 ] ] +let s:p.tabline.tabsel = [ [ s:base03, s:base1 ] ] +let s:p.tabline.middle = [ [ s:base0, s:base02 ] ] +let s:p.tabline.right = copy(s:p.normal.right) +let s:p.normal.error = [ [ s:base03, s:red ] ] +let s:p.normal.warning = [ [ s:base03, s:yellow ] ] + +let g:lightline#colorscheme#solarized#palette = lightline#colorscheme#flatten(s:p) diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/solarized_dark.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/solarized_dark.vim deleted file mode 100644 index 37a3dc7e..00000000 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/solarized_dark.vim +++ /dev/null @@ -1,73 +0,0 @@ -" ============================================================================= -" Filename: autoload/lightline/colorscheme/solarized_dark.vim -" Author: itchyny -" License: MIT License -" Last Change: 2014/05/31 01:04:15. -" ============================================================================= - -let s:cuicolors = { - \ 'base03': [ '8', '234', 'DarkGray' ], - \ 'base02': [ '0', '235', 'Black' ], - \ 'base01': [ '10', '239', 'LightGreen' ], - \ 'base00': [ '11', '240', 'LightYellow' ], - \ 'base0': [ '12', '244', 'LightBlue' ], - \ 'base1': [ '14', '245', 'LightCyan' ], - \ 'base2': [ '7', '187', 'LightGray' ], - \ 'base3': [ '15', '230', 'White' ], - \ 'yellow': [ '3', '136', 'DarkYellow' ], - \ 'orange': [ '9', '166', 'LightRed' ], - \ 'red': [ '1', '124', 'DarkRed' ], - \ 'magenta': [ '5', '125', 'DarkMagenta' ], - \ 'violet': [ '13', '61', 'LightMagenta' ], - \ 'blue': [ '4', '33', 'DarkBlue' ], - \ 'cyan': [ '6', '37', 'DarkCyan' ], - \ 'green': [ '2', '64', 'DarkGreen' ], - \ } - -" The following condition only applies for the console and is the same -" condition vim-colors-solarized uses to determine which set of colors -" to use. -let s:solarized_termcolors = get(g:, 'solarized_termcolors', 256) -if s:solarized_termcolors != 256 && &t_Co >= 16 - let s:cuiindex = 0 -elseif s:solarized_termcolors == 256 - let s:cuiindex = 1 -else - let s:cuiindex = 2 -endif - -let s:base03 = [ '#002b36', s:cuicolors.base03[s:cuiindex] ] -let s:base02 = [ '#073642', s:cuicolors.base02[s:cuiindex] ] -let s:base01 = [ '#586e75', s:cuicolors.base01[s:cuiindex] ] -let s:base00 = [ '#657b83', s:cuicolors.base00[s:cuiindex] ] -let s:base0 = [ '#839496', s:cuicolors.base0[s:cuiindex] ] -let s:base1 = [ '#93a1a1', s:cuicolors.base1[s:cuiindex] ] -let s:base2 = [ '#eee8d5', s:cuicolors.base2[s:cuiindex] ] -let s:base3 = [ '#fdf6e3', s:cuicolors.base3[s:cuiindex] ] -let s:yellow = [ '#b58900', s:cuicolors.yellow[s:cuiindex] ] -let s:orange = [ '#cb4b16', s:cuicolors.orange[s:cuiindex] ] -let s:red = [ '#dc322f', s:cuicolors.red[s:cuiindex] ] -let s:magenta = [ '#d33682', s:cuicolors.magenta[s:cuiindex] ] -let s:violet = [ '#6c71c4', s:cuicolors.violet[s:cuiindex] ] -let s:blue = [ '#268bd2', s:cuicolors.blue[s:cuiindex] ] -let s:cyan = [ '#2aa198', s:cuicolors.cyan[s:cuiindex] ] -let s:green = [ '#859900', s:cuicolors.green[s:cuiindex] ] - -let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} -let s:p.normal.left = [ [ s:base3, s:blue ], [ s:base3, s:base01 ] ] -let s:p.normal.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ] -let s:p.inactive.right = [ [ s:base02, s:base01 ], [ s:base00, s:base02 ] ] -let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base00, s:base02 ] ] -let s:p.insert.left = [ [ s:base3, s:green ], [ s:base3, s:base01 ] ] -let s:p.replace.left = [ [ s:base3, s:red ], [ s:base3, s:base01 ] ] -let s:p.visual.left = [ [ s:base3, s:magenta ], [ s:base3, s:base01 ] ] -let s:p.normal.middle = [ [ s:base1, s:base02 ] ] -let s:p.inactive.middle = [ [ s:base0, s:base02 ] ] -let s:p.tabline.left = [ [ s:base1, s:base00 ] ] -let s:p.tabline.tabsel = [ [ s:base3, s:base0 ] ] -let s:p.tabline.middle = [ [ s:base01, s:base02 ] ] -let s:p.tabline.right = copy(s:p.normal.right) -let s:p.normal.error = [ [ s:base2, s:red ] ] -let s:p.normal.warning = [ [ s:base02, s:yellow ] ] - -let g:lightline#colorscheme#solarized_dark#palette = lightline#colorscheme#flatten(s:p) diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/solarized_light.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/solarized_light.vim deleted file mode 100644 index 99046afb..00000000 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/solarized_light.vim +++ /dev/null @@ -1,80 +0,0 @@ -" ============================================================================= -" Filename: autoload/lightline/colorscheme/solarized_light.vim -" Author: itchyny -" License: MIT License -" Last Change: 2014/05/31 01:04:21. -" ============================================================================= - -let s:cuicolors = { - \ 'base03': [ '8', '234', 'DarkGray' ], - \ 'base02': [ '0', '235', 'Black' ], - \ 'base01': [ '10', '239', 'LightGreen' ], - \ 'base00': [ '11', '240', 'LightYellow' ], - \ 'base0': [ '12', '244', 'LightBlue' ], - \ 'base1': [ '14', '245', 'LightCyan' ], - \ 'base2': [ '7', '187', 'LightGray' ], - \ 'base3': [ '15', '230', 'White' ], - \ 'yellow': [ '3', '136', 'DarkYellow' ], - \ 'orange': [ '9', '166', 'LightRed' ], - \ 'red': [ '1', '124', 'DarkRed' ], - \ 'magenta': [ '5', '125', 'DarkMagenta' ], - \ 'violet': [ '13', '61', 'LightMagenta' ], - \ 'blue': [ '4', '33', 'DarkBlue' ], - \ 'cyan': [ '6', '37', 'DarkCyan' ], - \ 'green': [ '2', '64', 'DarkGreen' ], - \ } - -" The following condition only applies for the console and is the same -" condition vim-colors-solarized uses to determine which set of colors -" to use. -let s:solarized_termcolors = get(g:, 'solarized_termcolors', 256) -if s:solarized_termcolors != 256 && &t_Co >= 16 - let s:cuiindex = 0 -elseif s:solarized_termcolors == 256 - let s:cuiindex = 1 -else - let s:cuiindex = 2 -endif - -let s:base03 = [ '#002b36', s:cuicolors.base03[s:cuiindex] ] -let s:base02 = [ '#073642', s:cuicolors.base02[s:cuiindex] ] -let s:base01 = [ '#586e75', s:cuicolors.base01[s:cuiindex] ] -let s:base00 = [ '#657b83', s:cuicolors.base00[s:cuiindex] ] -let s:base0 = [ '#839496', s:cuicolors.base0[s:cuiindex] ] -let s:base1 = [ '#93a1a1', s:cuicolors.base1[s:cuiindex] ] -let s:base2 = [ '#eee8d5', s:cuicolors.base2[s:cuiindex] ] -let s:base3 = [ '#fdf6e3', s:cuicolors.base3[s:cuiindex] ] -let s:yellow = [ '#b58900', s:cuicolors.yellow[s:cuiindex] ] -let s:orange = [ '#cb4b16', s:cuicolors.orange[s:cuiindex] ] -let s:red = [ '#dc322f', s:cuicolors.red[s:cuiindex] ] -let s:magenta = [ '#d33682', s:cuicolors.magenta[s:cuiindex] ] -let s:violet = [ '#6c71c4', s:cuicolors.violet[s:cuiindex] ] -let s:blue = [ '#268bd2', s:cuicolors.blue[s:cuiindex] ] -let s:cyan = [ '#2aa198', s:cuicolors.cyan[s:cuiindex] ] -let s:green = [ '#859900', s:cuicolors.green[s:cuiindex] ] - -let [s:base03, s:base3] = [s:base3, s:base03] -let [s:base02, s:base2] = [s:base2, s:base02] -let [s:base01, s:base1] = [s:base1, s:base01] -let [s:base00, s:base0] = [s:base0, s:base00] - -let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} -let s:p.normal.left = [ [ s:base3, s:blue ], [ s:base3, s:base01 ] ] -let s:p.normal.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ] -let s:p.inactive.right = [ [ s:base02, s:base01 ], [ s:base00, s:base02 ] ] -let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base00, s:base02 ] ] -let s:p.insert.left = [ [ s:base3, s:green ], [ s:base3, s:base01 ] ] -let s:p.replace.left = [ [ s:base3, s:red ], [ s:base3, s:base01 ] ] -let s:p.visual.left = [ [ s:base3, s:magenta ], [ s:base3, s:base01 ] ] -let s:p.normal.middle = [ [ s:base1, s:base02 ] ] -let s:p.inactive.middle = [ [ s:base0, s:base02 ] ] -let s:p.tabline.left = [ [ s:base2, s:base01 ] ] -let s:p.tabline.tabsel = [ [ s:base2, s:base03 ] ] -let s:p.tabline.middle = [ [ s:base1, s:base02 ] ] -let s:p.tabline.right = copy(s:p.normal.right) -let s:p.normal.error = [ [ s:red, s:base01 ] ] -let s:p.normal.warning = [ [ s:yellow, s:base01 ] ] -let s:p.normal.error = [ [ s:base02, s:red ] ] -let s:p.normal.warning = [ [ s:base2, s:yellow ] ] - -let g:lightline#colorscheme#solarized_light#palette = lightline#colorscheme#flatten(s:p) diff --git a/sources_non_forked/lightline.vim/doc/lightline.txt b/sources_non_forked/lightline.vim/doc/lightline.txt index 99367251..c151bddb 100644 --- a/sources_non_forked/lightline.vim/doc/lightline.txt +++ b/sources_non_forked/lightline.vim/doc/lightline.txt @@ -4,7 +4,7 @@ Version: 0.0 Author: itchyny (https://github.com/itchyny) License: MIT License Repository: https://github.com/itchyny/lightline.vim -Last Change: 2016/05/26 21:57:34. +Last Change: 2016/08/09 06:22:39. CONTENTS *lightline-contents* @@ -1202,8 +1202,7 @@ Problem 13: *lightline-problem-13* try if g:colors_name =~# 'wombat\|solarized\|landscape\|jellybeans\|seoul256\|Tomorrow' let g:lightline.colorscheme = - \ substitute(substitute(g:colors_name, '-', '_', 'g'), '256.*', '', '') . - \ (g:colors_name ==# 'solarized' ? '_' . &background : '') + \ substitute(substitute(g:colors_name, '-', '_', 'g'), '256.*', '', '') call lightline#init() call lightline#colorscheme() call lightline#update() diff --git a/sources_non_forked/syntastic/README.markdown b/sources_non_forked/syntastic/README.markdown index 19e986ef..5523d088 100644 --- a/sources_non_forked/syntastic/README.markdown +++ b/sources_non_forked/syntastic/README.markdown @@ -65,11 +65,11 @@ 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). +reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Solidity, +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], @@ -456,12 +456,12 @@ For example for `jscs`: ```vim function! FindConfig(prefix, what, where) let cfg = findfile(a:what, escape(a:where, ' ') . ';') - return cfg !=# '' ? ' ' . a:prefix . ' ' . cfg : '' + return cfg !=# '' ? ' ' . a:prefix . ' ' . shellescape(cfg) : '' endfunction autocmd FileType javascript let b:syntastic_javascript_jscs_args = \ get(g:, 'syntastic_javascript_jscs_args', '') . - \ FindConfig('-c', '.jscsrc', expand('<amatch>:p:h', 1)) + \ FindConfig('-c', '.jscsrc', expand('<afile>:p:h', 1)) ``` <a name="faqbdelete"></a> diff --git a/sources_non_forked/syntastic/autoload/syntastic/preprocess.vim b/sources_non_forked/syntastic/autoload/syntastic/preprocess.vim index cbab6fdd..9d25b849 100644 --- a/sources_non_forked/syntastic/autoload/syntastic/preprocess.vim +++ b/sources_non_forked/syntastic/autoload/syntastic/preprocess.vim @@ -89,11 +89,11 @@ function! syntastic#preprocess#dockerfile_lint(errors) abort " {{{2 call add(out, msg) endfor catch /\m^Vim\%((\a\+)\)\=:E716/ - call syntastic#log#warn('checker dockerfile/dockerfile_lint: unrecognized error format') + call syntastic#log#warn('checker dockerfile/dockerfile_lint: unrecognized error format (crashed checker?)') let out = [] endtry else - call syntastic#log#warn('checker dockerfile/dockerfile_lint: unrecognized error format') + call syntastic#log#warn('checker dockerfile/dockerfile_lint: unrecognized error format (crashed checker?)') endif return out endfunction " }}}2 @@ -132,18 +132,18 @@ function! syntastic#preprocess#flow(errors) abort " {{{2 call add(out, msg) catch /\m^Vim\%((\a\+)\)\=:E716/ - call syntastic#log#warn('checker javascript/flow: unrecognized error format') + call syntastic#log#warn('checker javascript/flow: unrecognized error format (crashed checker?)') let out = [] break endtry else - call syntastic#log#warn('checker javascript/flow: unrecognized error format') + call syntastic#log#warn('checker javascript/flow: unrecognized error format (crashed checker?)') let out = [] break endif endfor else - call syntastic#log#warn('checker javascript/flow: unrecognized error format') + call syntastic#log#warn('checker javascript/flow: unrecognized error format (crashed checker?)') endif return out @@ -178,11 +178,11 @@ function! syntastic#preprocess#jscs(errors) abort " {{{2 endtry endfor else - call syntastic#log#warn('checker javascript/jscs: unrecognized error format') + call syntastic#log#warn('checker javascript/jscs: unrecognized error format (crashed checker?)') endif endfor else - call syntastic#log#warn('checker javascript/jscs: unrecognized error format') + call syntastic#log#warn('checker javascript/jscs: unrecognized error format (crashed checker?)') endif return out endfunction " }}}2 @@ -238,7 +238,7 @@ function! syntastic#preprocess#prospector(errors) abort " {{{2 endif endfor else - call syntastic#log#warn('checker python/prospector: unrecognized error format') + call syntastic#log#warn('checker python/prospector: unrecognized error format (crashed checker?)') endif endif @@ -311,11 +311,11 @@ function! syntastic#preprocess#scss_lint(errors) abort " {{{2 endtry endfor else - call syntastic#log#warn('checker scss/scss_lint: unrecognized error format') + call syntastic#log#warn('checker scss/scss_lint: unrecognized error format (crashed checker?)') endif endfor else - call syntastic#log#warn('checker scss/scss_lint: unrecognized error format') + call syntastic#log#warn('checker scss/scss_lint: unrecognized error format (crashed checker?)') endif return out endfunction " }}}2 @@ -351,7 +351,7 @@ function! syntastic#preprocess#stylelint(errors) abort " {{{2 endtry endfor else - call syntastic#log#warn('checker css/stylelint: unrecognized error format') + call syntastic#log#warn('checker css/stylelint: unrecognized error format (crashed checker?)') endif endif return out @@ -398,7 +398,7 @@ echomsg string(json) endtry endfor else - call syntastic#log#warn('checker javascript/tern_lint: unrecognized error format') + call syntastic#log#warn('checker javascript/tern_lint: unrecognized error format (crashed checker?)') endif echomsg string(out) @@ -453,7 +453,7 @@ function! syntastic#preprocess#vint(errors) abort " {{{2 endif endfor else - call syntastic#log#warn('checker vim/vint: unrecognized error format') + call syntastic#log#warn('checker vim/vint: unrecognized error format (crashed checker?)') endif return out diff --git a/sources_non_forked/syntastic/doc/syntastic-checkers.txt b/sources_non_forked/syntastic/doc/syntastic-checkers.txt index 19974054..dbb6d7ab 100644 --- a/sources_non_forked/syntastic/doc/syntastic-checkers.txt +++ b/sources_non_forked/syntastic/doc/syntastic-checkers.txt @@ -101,6 +101,7 @@ SYNTAX CHECKERS BY LANGUAGE *syntastic-checkers-lang* Sh.......................................|syntastic-checkers-sh| Slim.....................................|syntastic-checkers-slim| SML......................................|syntastic-checkers-sml| + Solidity.................................|syntastic-checkers-solidity| SQL......................................|syntastic-checkers-sql| Stylus...................................|syntastic-checkers-stylus| @@ -5779,6 +5780,37 @@ Checker options~ This checker is initialised using the "makeprgBuild()" function and thus it accepts the standard options described at |syntastic-config-makeprg|. +============================================================================== +SYNTAX CHECKERS FOR SOLIDITY *syntastic-checkers-solidity* + +The following checkers are available for Solidity (filetype "solidity"): + + 1. solc.....................|syntastic-solidity-solc| + +------------------------------------------------------------------------------ +1. solc *syntastic-solidity-solc* + +Name: solc +Maintainer: Jacob Cholewa <jacob@cholewa.dk> + +"solc" is a compiler for Ethereum's smart-contract language "Solidity" +(https://solidity.readthedocs.io/). See the project's page for details: + + https://github.com/ethereum/solidity + +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 Solidity files, such as +"vim-solidity": + + https://github.com/tomlion/vim-solidity + + ============================================================================== SYNTAX CHECKERS FOR SQL *syntastic-checkers-sql* diff --git a/sources_non_forked/syntastic/plugin/syntastic.vim b/sources_non_forked/syntastic/plugin/syntastic.vim index 441490d5..3678990c 100644 --- a/sources_non_forked/syntastic/plugin/syntastic.vim +++ b/sources_non_forked/syntastic/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:_SYNTASTIC_START endif -let g:_SYNTASTIC_VERSION = '3.7.0-177' +let g:_SYNTASTIC_VERSION = '3.7.0-193' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1 diff --git a/sources_non_forked/syntastic/plugin/syntastic/registry.vim b/sources_non_forked/syntastic/plugin/syntastic/registry.vim index 8e78f112..bcfd5c63 100644 --- a/sources_non_forked/syntastic/plugin/syntastic/registry.vim +++ b/sources_non_forked/syntastic/plugin/syntastic/registry.vim @@ -85,6 +85,7 @@ let s:_DEFAULT_CHECKERS = { \ 'slim': ['slimrb'], \ 'sml': ['smlnj'], \ 'spec': ['rpmlint'], + \ 'solidity': ['solc'], \ 'sql': ['sqlint'], \ 'stylus': ['stylint'], \ 'tcl': ['nagelfar'], diff --git a/sources_non_forked/syntastic/syntax_checkers/dockerfile/dockerfile_lint.vim b/sources_non_forked/syntastic/syntax_checkers/dockerfile/dockerfile_lint.vim index 3a5b7694..4858a6b5 100644 --- a/sources_non_forked/syntastic/syntax_checkers/dockerfile/dockerfile_lint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/dockerfile/dockerfile_lint.vim @@ -1,7 +1,7 @@ "============================================================================ "File: dockerfile_lint.vim "Description: Syntax checking plugin for syntastic.vim using dockerfile-lint -" (https://github.com/projectatomic/dockerfile-lint). +" (https://github.com/projectatomic/dockerfile_lint). "Maintainer: Tim Carry <tim at pixelastic dot com> "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute diff --git a/sources_non_forked/syntastic/syntax_checkers/perl/perl.vim b/sources_non_forked/syntastic/syntax_checkers/perl/perl.vim index e039518a..ca3d0d76 100644 --- a/sources_non_forked/syntastic/syntax_checkers/perl/perl.vim +++ b/sources_non_forked/syntastic/syntax_checkers/perl/perl.vim @@ -1,6 +1,6 @@ "============================================================================ "File: perl.vim -"Description: Syntax checking plugin for syntastic.vim +"Description: Syntax checking plugin for syntastic "Maintainer: Anthony Carapetis <anthony.carapetis at gmail dot com>, " Eric Harmon <http://eharmon.net> "License: This program is free software. It comes without any warranty, @@ -23,7 +23,7 @@ " " let g:syntastic_enable_perl_checker = 1 " -" References: +" Reference: " " - http://perldoc.perl.org/perlrun.html#*-c* @@ -55,15 +55,15 @@ function! SyntaxCheckers_perl_perl_GetLocList() dict " {{{1 call syntastic#log#oneTimeWarn('variable g:syntastic_perl_lib_path should be a list') let includes = split(g:syntastic_perl_lib_path, ',') else - let includes = copy(syntastic#util#var('perl_lib_path')) + let includes = copy(syntastic#util#var('perl_lib_path', [])) endif let shebang = syntastic#util#parseShebang() - let extra = join(map(includes, '"-I" . v:val')) . - \ (index(shebang['args'], '-T') >= 0 ? ' -T' : '') . - \ (index(shebang['args'], '-t') >= 0 ? ' -t' : '') + let extra = map(includes, '"-I" . v:val') + + \ (index(shebang['args'], '-T') >= 0 ? ['-T'] : []) + + \ (index(shebang['args'], '-t') >= 0 ? ['-t'] : []) let errorformat = '%f:%l:%m' - let makeprg = self.makeprgBuild({ 'args_before': '-c -X ' . extra }) + let makeprg = self.makeprgBuild({ 'args_before': ['-c', '-X '] + extra }) let errors = SyntasticMake({ \ 'makeprg': makeprg, @@ -74,7 +74,7 @@ function! SyntaxCheckers_perl_perl_GetLocList() dict " {{{1 return errors endif - let makeprg = self.makeprgBuild({ 'args_before': '-c -Mwarnings ' . extra }) + let makeprg = self.makeprgBuild({ 'args_before': ['-c', '-Mwarnings'] + extra }) return SyntasticMake({ \ 'makeprg': makeprg, diff --git a/sources_non_forked/syntastic/syntax_checkers/scala/fsc.vim b/sources_non_forked/syntastic/syntax_checkers/scala/fsc.vim index 25d6a4d7..0398e7ac 100644 --- a/sources_non_forked/syntastic/syntax_checkers/scala/fsc.vim +++ b/sources_non_forked/syntastic/syntax_checkers/scala/fsc.vim @@ -25,11 +25,12 @@ function! SyntaxCheckers_scala_fsc_GetLocList() dict " working directory changing after being started " that's why we better pass an absolute path let makeprg = self.makeprgBuild({ - \ 'args_after': '-Ystop-after:parser', + \ 'args': '-Ystop-after:parser', \ 'fname': syntastic#util#shexpand('%:p') }) let errorformat = \ '%E%f:%l: %trror: %m,' . + \ '%W%f:%l: %tarning:%m,' . \ '%Z%p^,' . \ '%-G%.%#' diff --git a/sources_non_forked/syntastic/syntax_checkers/solidity/solc.vim b/sources_non_forked/syntastic/syntax_checkers/solidity/solc.vim new file mode 100644 index 00000000..e401c3e0 --- /dev/null +++ b/sources_non_forked/syntastic/syntax_checkers/solidity/solc.vim @@ -0,0 +1,38 @@ +"============================================================================ +"File: solc.vim +"Description: Solidity syntax checker - using solc +"Maintainer: Jacob Cholewa <jacob@cholewa.dk> +"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_solidity_solc_checker') + finish +endif +let g:loaded_syntastic_solidity_solc_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_solidity_solc_GetLocList() dict + let makeprg = self.makeprgBuild({}) + + let errorformat = '%f:%l:%c: %trror: %m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'solidity', + \ 'name': 'solc'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/vim-coffee-script/after/syntax/haml.vim b/sources_non_forked/vim-coffee-script/after/syntax/haml.vim index 4c517ebb..3e186cdc 100644 --- a/sources_non_forked/vim-coffee-script/after/syntax/haml.vim +++ b/sources_non_forked/vim-coffee-script/after/syntax/haml.vim @@ -3,6 +3,11 @@ " URL: http://github.com/kchmck/vim-coffee-script " License: WTFPL + +if exists('b:current_syntax') + let s:current_syntax_save = b:current_syntax +endif + " Inherit coffee from html so coffeeComment isn't redefined and given higher " priority than hamlInterpolation. syn cluster hamlCoffeescript contains=@htmlCoffeeScript @@ -11,3 +16,8 @@ syn region hamlCoffeescriptFilter matchgroup=hamlFilter \ end="^\%(\z1 \| *$\)\@!" \ contains=@hamlCoffeeScript,hamlInterpolation \ keepend + +if exists('s:current_syntax_save') + let b:current_syntax = s:current_syntax_save + unlet s:current_syntax_save +endif diff --git a/sources_non_forked/vim-coffee-script/after/syntax/html.vim b/sources_non_forked/vim-coffee-script/after/syntax/html.vim index 82b44f13..aa01e7e9 100644 --- a/sources_non_forked/vim-coffee-script/after/syntax/html.vim +++ b/sources_non_forked/vim-coffee-script/after/syntax/html.vim @@ -3,9 +3,18 @@ " URL: http://github.com/kchmck/vim-coffee-script " License: WTFPL +if exists('b:current_syntax') + let s:current_syntax_save = b:current_syntax +endif + " Syntax highlighting for text/coffeescript script tags syn include @htmlCoffeeScript syntax/coffee.vim syn region coffeeScript start=#<script [^>]*type="text/coffeescript"[^>]*># \ end=#</script>#me=s-1 keepend \ contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc \ containedin=htmlHead + +if exists('s:current_syntax_save') + let b:current_syntax = s:current_syntax_save + unlet s:current_syntax_save +endif diff --git a/sources_non_forked/vim-coffee-script/syntax/coffee.vim b/sources_non_forked/vim-coffee-script/syntax/coffee.vim index bfb252f5..662ab756 100644 --- a/sources_non_forked/vim-coffee-script/syntax/coffee.vim +++ b/sources_non_forked/vim-coffee-script/syntax/coffee.vim @@ -32,7 +32,7 @@ hi def link coffeeConditional Conditional syn match coffeeException /\<\%(try\|catch\|finally\)\>/ display hi def link coffeeException Exception -syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\)\>/ +syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\|debugger\)\>/ \ display " The `own` keyword is only a keyword after `for`. syn match coffeeKeyword /\<for\s\+own\>/ contained containedin=coffeeRepeat diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index 805518ae..345ea349 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -859,7 +859,7 @@ function! s:StageUndo() abort let hash = repo.git_chomp('hash-object', '-w', filename) if !empty(hash) if section ==# 'untracked' - call repo.git_chomp_in_tree('clean', '--', filename) + call repo.git_chomp_in_tree('clean', '-f', '--', filename) elseif section ==# 'unmerged' call repo.git_chomp_in_tree('rm', '--', filename) elseif section ==# 'unstaged' diff --git a/sources_non_forked/vim-go/CHANGELOG.md b/sources_non_forked/vim-go/CHANGELOG.md index 536b77dc..02d0e4d2 100644 --- a/sources_non_forked/vim-go/CHANGELOG.md +++ b/sources_non_forked/vim-go/CHANGELOG.md @@ -6,10 +6,15 @@ IMPROVEMENTS: buffers as well. This affects all commands where `guru` is used. Such as `:GoDef`, `:GoReferrers`, etc.. [gh-944] * Cleanup and improve documentation [gh-987] +* Add new `g:go_gocode_socket_type` setting to change the underlying socket type passed to `gocode`. Usefull to fallback to `tcp` on cases such as Bash on Windows [gh-1000] +* `:GoSameIds` is now automatically re-evaluated in cases of buffer reloads (such as `:GoRename`) [gh-998] BUG FIXES: * Fix system calls on Windows [gh-988] +* Fix :GoSameIds and :GoCoverage for light background and after changing color schemes [gh-983] +* Fix TagBar and `GoCallers` for Windows user [gh-999] +* Set updatetime for for `auto_sameids` feature as well [gh-1016] ## 1.8 (July 31, 2016) diff --git a/sources_non_forked/vim-go/autoload/go/complete.vim b/sources_non_forked/vim-go/autoload/go/complete.vim index 3cc52d2d..5ebad4da 100644 --- a/sources_non_forked/vim-go/autoload/go/complete.vim +++ b/sources_non_forked/vim-go/autoload/go/complete.vim @@ -32,10 +32,17 @@ function! s:gocodeCommand(cmd, preargs, args) let old_gopath = $GOPATH let $GOPATH = go#path#Detect() - let result = go#util#System(printf('%s %s %s %s', go#util#Shellescape(bin_path), join(a:preargs), go#util#Shellescape(a:cmd), join(a:args))) + let socket_type = get(g:, 'go_gocode_socket_type', 'unix') + let cmd = printf('%s -sock %s %s %s %s', + \ go#util#Shellescape(bin_path), + \ socket_type, + \ join(a:preargs), + \ go#util#Shellescape(a:cmd), + \ join(a:args) + \ ) + let result = go#util#System(cmd) let $GOPATH = old_gopath - if go#util#ShellError() != 0 return "[\"0\", []]" else diff --git a/sources_non_forked/vim-go/autoload/go/guru.vim b/sources_non_forked/vim-go/autoload/go/guru.vim index 3fb5a7d5..c1f7f193 100644 --- a/sources_non_forked/vim-go/autoload/go/guru.vim +++ b/sources_non_forked/vim-go/autoload/go/guru.vim @@ -1,6 +1,5 @@ " 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") @@ -364,6 +363,12 @@ function! go#guru#SameIds(selected) let pos = split(item, ':') call matchaddpos('goSameId', [[str2nr(pos[-2]), str2nr(pos[-1]), str2nr(poslen)]]) endfor + + if get(g:, "go_auto_sameids", 0) + " re-apply SameIds at the current cursor position at the time the buffer + " is redisplayed: e.g. :edit, :GoRename, etc. + autocmd BufWinEnter <buffer> nested call go#guru#SameIds(-1) + endif endfunction function! go#guru#ClearSameIds() @@ -373,6 +378,11 @@ function! go#guru#ClearSameIds() call matchdelete(item['id']) endif endfor + + " remove the autocmds we defined + if exists("#BufWinEnter<buffer>") + autocmd! BufWinEnter <buffer> + endif endfunction function! go#guru#ToggleSameIds(selected) diff --git a/sources_non_forked/vim-go/autoload/go/package.vim b/sources_non_forked/vim-go/autoload/go/package.vim index c69cba4b..e6f194ae 100644 --- a/sources_non_forked/vim-go/autoload/go/package.vim +++ b/sources_non_forked/vim-go/autoload/go/package.vim @@ -59,7 +59,7 @@ function! go#package#ImportPath(arg) let dirs = go#package#Paths() for dir in dirs - if len(dir) && match(path, dir) == 0 + if len(dir) && matchstr(escape(path, '\/'), escape(dir, '\/')) == 0 let workspace = dir endif endfor @@ -68,8 +68,13 @@ function! go#package#ImportPath(arg) return -1 endif - let srcdir = substitute(workspace . '/src/', '//', '/', '') - return substitute(path, srcdir, '', '') + if go#util#IsWin() + let srcdir = substitute(workspace . '\src\', '//', '/', '') + return path[len(srcdir):] + else + let srcdir = substitute(workspace . '/src/', '//', '/', '') + return substitute(path, srcdir, '', '') + endif endfunction function! go#package#FromPath(arg) diff --git a/sources_non_forked/vim-go/doc/vim-go.txt b/sources_non_forked/vim-go/doc/vim-go.txt index cd278e19..39d0b670 100644 --- a/sources_non_forked/vim-go/doc/vim-go.txt +++ b/sources_non_forked/vim-go/doc/vim-go.txt @@ -1387,6 +1387,13 @@ Specifies whether `gocode` should add built-in types, functions and constants to an autocompletion proposals. By default it is enabled. > let g:go_gocode_propose_builtins = 1 +< + *'g:go_gocode_socket_type'* + +Specifies whether `gocode` should use a different socket type. By default +`unix` is enabled. Possible values: `unix`, `tcp` +> + let g:go_gocode_socket_type = 'unix' < *'g:go_template_autocreate'* diff --git a/sources_non_forked/vim-go/ftplugin/go.vim b/sources_non_forked/vim-go/ftplugin/go.vim index e4e993aa..dfe068f4 100644 --- a/sources_non_forked/vim-go/ftplugin/go.vim +++ b/sources_non_forked/vim-go/ftplugin/go.vim @@ -56,7 +56,7 @@ if get(g:, "go_textobj_enabled", 1) xnoremap <buffer> <silent> [[ :<c-u>call go#textobj#FunctionJump('v', 'prev')<cr> endif -if get(g:, "go_auto_type_info", 0) +if get(g:, "go_auto_type_info", 0) || get(g:, "go_auto_sameids", 0) setlocal updatetime=800 endif diff --git a/sources_non_forked/vim-go/ftplugin/go/tagbar.vim b/sources_non_forked/vim-go/ftplugin/go/tagbar.vim index e8982aaa..efdc397b 100644 --- a/sources_non_forked/vim-go/ftplugin/go/tagbar.vim +++ b/sources_non_forked/vim-go/ftplugin/go/tagbar.vim @@ -45,7 +45,7 @@ function! s:SetTagbar() \ 'ctype' : 't', \ 'ntype' : 'n' \ }, - \ 'ctagsbin' : expand(bin_path), + \ 'ctagsbin' : bin_path, \ 'ctagsargs' : '-sort -silent' \ } endif diff --git a/sources_non_forked/vim-go/syntax/go.vim b/sources_non_forked/vim-go/syntax/go.vim index 33315317..987485a0 100644 --- a/sources_non_forked/vim-go/syntax/go.vim +++ b/sources_non_forked/vim-go/syntax/go.vim @@ -366,13 +366,27 @@ if g:go_highlight_build_constraints != 0 hi def link goPackageComment Comment endif -" :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 + +function! s:hi() + " :GoSameIds + if &background == 'dark' + hi def goSameId term=bold cterm=bold ctermbg=white ctermfg=black guibg=white guifg=black + else + hi def goSameId term=bold cterm=bold ctermbg=14 guibg=Cyan + endif + + " :GoCoverage commands + hi def goCoverageCovered ctermfg=green guifg=#A6E22E + hi def goCoverageUncover ctermfg=red guifg=#F92672 +endfunction + +augroup vim-go-hi + autocmd! + autocmd ColorScheme * call s:hi() +augroup end +call s:hi() " Search backwards for a global declaration to start processing the syntax. "syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/ diff --git a/sources_non_forked/vim-snippets/UltiSnips/ada.snippets b/sources_non_forked/vim-snippets/UltiSnips/ada.snippets index cc35c2c2..bea2a6cd 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/ada.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/ada.snippets @@ -5,7 +5,9 @@ global !p def ada_case(word): out = word[0].upper() for i in range(1, len(word)): - if word[i - 1] == '_': + if word[i] == '-': + out = out + '.' + elif word[i - 1] == '_' or word[i - 1] == '-': out = out + word[i].upper() else: out = out + word[i] diff --git a/sources_non_forked/vim-snippets/snippets/cpp.snippets b/sources_non_forked/vim-snippets/snippets/cpp.snippets index d06b3c90..42c37341 100644 --- a/sources_non_forked/vim-snippets/snippets/cpp.snippets +++ b/sources_non_forked/vim-snippets/snippets/cpp.snippets @@ -3,7 +3,7 @@ extends c ## ## Preprocessor # #include <...> -snippet inc +snippet incc #include <${1:iostream}> snippet binc #include <boost/${1:shared_ptr}.hpp> From 48e1c892ede1e91a6552f50a9c5a0a81381b173c Mon Sep 17 00:00:00 2001 From: amix <amix@amix.dk> Date: Sat, 20 Aug 2016 13:28:37 +0200 Subject: [PATCH 4/8] Fixes https://github.com/amix/vimrc/issues/221 --- vimrcs/basic.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vimrcs/basic.vim b/vimrcs/basic.vim index 837469f7..f80164bf 100644 --- a/vimrcs/basic.vim +++ b/vimrcs/basic.vim @@ -189,8 +189,9 @@ set tabstop=4 set lbr set tw=500 -set ai "Auto indent -set si "Smart indent +set cindent +set cinkeys-=0# +set indentkeys-=0# set wrap "Wrap lines From 44481c92786910bd6f608853fdaefb4c2fdbd903 Mon Sep 17 00:00:00 2001 From: amix <amix@amix.dk> Date: Sat, 20 Aug 2016 13:31:52 +0200 Subject: [PATCH 5/8] Fixes https://github.com/amix/vimrc/issues/215 --- vimrcs/filetypes.vim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vimrcs/filetypes.vim b/vimrcs/filetypes.vim index 164454eb..9ac5c552 100644 --- a/vimrcs/filetypes.vim +++ b/vimrcs/filetypes.vim @@ -54,3 +54,11 @@ endfunction au FileType coffee call CoffeeScriptFold() au FileType gitcommit call setpos('.', [0, 1, 1, 0]) + + +"""""""""""""""""""""""""""""" +" => Shell section +"""""""""""""""""""""""""""""" +if exists('$TMUX') + set term=screen-256color +endif From 1f9936148427a5d5ad7e3f3b6bb442e4895943ea Mon Sep 17 00:00:00 2001 From: amix <amix@amix.dk> Date: Sat, 20 Aug 2016 14:44:55 +0200 Subject: [PATCH 6/8] Added the auto-pairs plugin --- sources_non_forked/auto-pairs/README.md | 310 ++++++++++ .../auto-pairs/plugin/auto-pairs.vim | 564 ++++++++++++++++++ update_plugins.py | 1 + 3 files changed, 875 insertions(+) create mode 100644 sources_non_forked/auto-pairs/README.md create mode 100644 sources_non_forked/auto-pairs/plugin/auto-pairs.vim diff --git a/sources_non_forked/auto-pairs/README.md b/sources_non_forked/auto-pairs/README.md new file mode 100644 index 00000000..72bde892 --- /dev/null +++ b/sources_non_forked/auto-pairs/README.md @@ -0,0 +1,310 @@ +Auto Pairs +========== +Insert or delete brackets, parens, quotes in pair. + +Installation +------------ +copy plugin/auto-pairs.vim to ~/.vim/plugin + +or if you are using `pathogen`: + +```git clone git://github.com/jiangmiao/auto-pairs.git ~/.vim/bundle/auto-pairs``` + +Features +-------- +* Insert in pair + + input: [ + output: [|] + +* Delete in pair + + input: foo[<BS>] + output: foo + +* Insert new indented line after Return + + input: {|} (press <CR> at |) + output: { + | + } + +* Insert spaces before closing characters, only for [], (), {} + + input: {|} (press <SPACE> at |) + output: { | } + + input: {|} (press <SPACE>foo} at |) + output: { foo }| + + input: '|' (press <SPACE> at |) + output: ' |' + +* Skip ' when inside a word + + input: foo| (press ' at |) + output: foo' + +* Skip closed bracket. + + input: [] + output: [] + +* Ignore auto pair when previous character is \ + + input: "\' + output: "\'" + +* Fast Wrap + + input: |'hello' (press (<M-e> at |) + output: ('hello') + + wrap string, only support c style string + input: |'h\\el\'lo' (press (<M-e> at |) + output ('h\\ello\'') + + input: |[foo, bar()] (press (<M-e> at |) + output: ([foo, bar()]) + +* Quick jump to closed pair. + + input: + { + something;| + } + + (press } at |) + + output: + { + + }| + +* Support ``` ''' and """ + + input: + ''' + + output: + '''|''' + +* Delete Repeated Pairs in one time + + input: """|""" (press <BS> at |) + output: | + + input: {{|}} (press <BS> at |) + output: | + + input: [[[[[[|]]]]]] (press <BS> at |) + output: | + +* Fly Mode + + input: if(a[3) + output: if(a[3])| (In Fly Mode) + output: if(a[3)]) (Without Fly Mode) + + input: + { + hello();| + world(); + } + + (press } at |) + + output: + { + hello(); + world(); + }| + + (then press <M-b> at | to do backinsert) + output: + { + hello();}| + world(); + } + + See Fly Mode section for details + +Fly Mode +-------- +Fly Mode will always force closed-pair jumping instead of inserting. only for ")", "}", "]" + +If jumps in mistake, could use AutoPairsBackInsert(Default Key: `<M-b>`) to jump back and insert closed pair. + +the most situation maybe want to insert single closed pair in the string, eg ")" + +Fly Mode is DISABLED by default. + +add **let g:AutoPairsFlyMode = 1** .vimrc to turn it on + +Default Options: + + let g:AutoPairsFlyMode = 0 + let g:AutoPairsShortcutBackInsert = '<M-b>' + +Shortcuts +--------- + + System Shortcuts: + <CR> : Insert new indented line after return if cursor in blank brackets or quotes. + <BS> : Delete brackets in pair + <M-p> : Toggle Autopairs (g:AutoPairsShortcutToggle) + <M-e> : Fast Wrap (g:AutoPairsShortcutFastWrap) + <M-n> : Jump to next closed pair (g:AutoPairsShortcutJump) + <M-b> : BackInsert (g:AutoPairsShortcutBackInsert) + + If <M-p> <M-e> or <M-n> conflict with another keys or want to bind to another keys, add + + let g:AutoPairsShortcutToggle = '<another key>' + + to .vimrc, if the key is empty string '', then the shortcut will be disabled. + +Options +------- +* g:AutoPairs + + Default: {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`'} + +* b:AutoPairs + + Default: g:AutoPairs + + Buffer level pairs set. + +* g:AutoPairsShortcutToggle + + Default: '<M-p>' + + The shortcut to toggle autopairs. + +* g:AutoPairsShortcutFastWrap + + Default: '<M-e>' + + Fast wrap the word. all pairs will be consider as a block (include <>). + (|)'hello' after fast wrap at |, the word will be ('hello') + (|)<hello> after fast wrap at |, the word will be (<hello>) + +* g:AutoPairsShortcutJump + + Default: '<M-n>' + + Jump to the next closed pair + +* g:AutoPairsMapBS + + Default : 1 + + Map <BS> to delete brackets, quotes in pair + execute 'inoremap <buffer> <silent> <BS> <C-R>=AutoPairsDelete()<CR>' + +* g:AutoPairsMapCh + + Default : 1 + + Map <C-h> to delete brackets, quotes in pair + +* g:AutoPairsMapCR + + Default : 1 + + Map <CR> to insert a new indented line if cursor in (|), {|} [|], '|', "|" + execute 'inoremap <buffer> <silent> <CR> <C-R>=AutoPairsReturn()<CR>' + +* g:AutoPairsCenterLine + + Default : 1 + + When g:AutoPairsMapCR is on, center current line after return if the line is at the bottom 1/3 of the window. + +* g:AutoPairsMapSpace + + Default : 1 + + Map <space> to insert a space after the opening character and before the closing one. + execute 'inoremap <buffer> <silent> <CR> <C-R>=AutoPairsSpace()<CR>' + +* g:AutoPairsFlyMode + + Default : 0 + + set it to 1 to enable FlyMode. + see FlyMode section for details. + +* g:AutoPairsMultilineClose + + Default : 1 + + When you press the key for the closing pair (e.g. `)`) it jumps past it. + If set to 1, then it'll jump to the next line, if there is only whitespace. + If set to 0, then it'll only jump to a closing pair on the same line. + +* g:AutoPairsShortcutBackInsert + + Default : <M-b> + + Work with FlyMode, insert the key at the Fly Mode jumped postion + +Buffer Level Pairs Setting +-------------------------- + +Set b:AutoPairs before BufEnter + +eg: + + " When the filetype is FILETYPE then make AutoPairs only match for parenthesis + au Filetype FILETYPE let b:AutoPairs = {"(": ")"} + +TroubleShooting +--------------- + The script will remap keys ([{'"}]) <BS>, + If auto pairs cannot work, use :imap ( to check if the map is corrected. + The correct map should be <C-R>=AutoPairsInsert("\(")<CR> + Or the plugin conflict with some other plugins. + use command :call AutoPairsInit() to remap the keys. + + +* How to insert parens purely + + There are 3 ways + + 1. use Ctrl-V ) to insert paren without trigger the plugin. + + 2. use Alt-P to turn off the plugin. + + 3. use DEL or <C-O>x to delete the character insert by plugin. + +* Swedish Character Conflict + + Because AutoPairs uses Meta(Alt) key as shortcut, it is conflict with some Swedish character such as å. + To fix the issue, you need remap or disable the related shortcut. + +Known Issues +----------------------- +Breaks '.' - [issue #3](https://github.com/jiangmiao/auto-pairs/issues/3) + + Description: After entering insert mode and inputing `[hello` then leave insert + mode by `<ESC>`. press '.' will insert 'hello' instead of '[hello]'. + Reason: `[` actually equals `[]\<LEFT>` and \<LEFT> will break '.'. + After version 7.4.849, Vim implements new keyword <C-G>U to avoid the break + Solution: Update Vim to 7.4.849+ + +Contributors +------------ +* [camthompson](https://github.com/camthompson) + + +License +------- + +Copyright (C) 2011-2013 Miao Jiang + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/sources_non_forked/auto-pairs/plugin/auto-pairs.vim b/sources_non_forked/auto-pairs/plugin/auto-pairs.vim new file mode 100644 index 00000000..200b2ddd --- /dev/null +++ b/sources_non_forked/auto-pairs/plugin/auto-pairs.vim @@ -0,0 +1,564 @@ +" Insert or delete brackets, parens, quotes in pairs. +" Maintainer: JiangMiao <jiangfriend@gmail.com> +" Contributor: camthompson +" Last Change: 2013-07-13 +" Version: 1.3.2 +" Homepage: http://www.vim.org/scripts/script.php?script_id=3599 +" Repository: https://github.com/jiangmiao/auto-pairs +" License: MIT + +if exists('g:AutoPairsLoaded') || &cp + finish +end +let g:AutoPairsLoaded = 1 + +if !exists('g:AutoPairs') + let g:AutoPairs = {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`'} +end + +if !exists('g:AutoPairsParens') + let g:AutoPairsParens = {'(':')', '[':']', '{':'}'} +end + +if !exists('g:AutoPairsMapBS') + let g:AutoPairsMapBS = 1 +end + +" Map <C-h> as the same BS +if !exists('g:AutoPairsMapCh') + let g:AutoPairsMapCh = 1 +end + +if !exists('g:AutoPairsMapCR') + let g:AutoPairsMapCR = 1 +end + +if !exists('g:AutoPairsMapSpace') + let g:AutoPairsMapSpace = 1 +end + +if !exists('g:AutoPairsCenterLine') + let g:AutoPairsCenterLine = 1 +end + +if !exists('g:AutoPairsShortcutToggle') + let g:AutoPairsShortcutToggle = '<M-p>' +end + +if !exists('g:AutoPairsShortcutFastWrap') + let g:AutoPairsShortcutFastWrap = '<M-e>' +end + +if !exists('g:AutoPairsShortcutJump') + let g:AutoPairsShortcutJump = '<M-n>' +endif + +" Fly mode will for closed pair to jump to closed pair instead of insert. +" also support AutoPairsBackInsert to insert pairs where jumped. +if !exists('g:AutoPairsFlyMode') + let g:AutoPairsFlyMode = 0 +endif + +" When skipping the closed pair, look at the current and +" next line as well. +if !exists('g:AutoPairsMultilineClose') + let g:AutoPairsMultilineClose = 1 +endif + +" Work with Fly Mode, insert pair where jumped +if !exists('g:AutoPairsShortcutBackInsert') + let g:AutoPairsShortcutBackInsert = '<M-b>' +endif + +if !exists('g:AutoPairsSmartQuotes') + let g:AutoPairsSmartQuotes = 1 +endif + +" 7.4.849 support <C-G>U to avoid breaking '.' +" Issue talk: https://github.com/jiangmiao/auto-pairs/issues/3 +" Vim note: https://github.com/vim/vim/releases/tag/v7.4.849 +if v:version >= 704 && has("patch849") + let s:Go = "\<C-G>U" +else + let s:Go = "" +endif + +let s:Left = s:Go."\<LEFT>" +let s:Right = s:Go."\<RIGHT>" + + +" Will auto generated {']' => '[', ..., '}' => '{'}in initialize. +let g:AutoPairsClosedPairs = {} + + +function! AutoPairsInsert(key) + if !b:autopairs_enabled + return a:key + end + + let line = getline('.') + let pos = col('.') - 1 + let before = strpart(line, 0, pos) + let after = strpart(line, pos) + let next_chars = split(after, '\zs') + let current_char = get(next_chars, 0, '') + let next_char = get(next_chars, 1, '') + let prev_chars = split(before, '\zs') + let prev_char = get(prev_chars, -1, '') + + let eol = 0 + if col('$') - col('.') <= 1 + let eol = 1 + end + + " Ignore auto close if prev character is \ + if prev_char == '\' + return a:key + end + + " The key is difference open-pair, then it means only for ) ] } by default + if !has_key(b:AutoPairs, a:key) + let b:autopairs_saved_pair = [a:key, getpos('.')] + + " Skip the character if current character is the same as input + if current_char == a:key + return s:Right + end + + if !g:AutoPairsFlyMode + " Skip the character if next character is space + if current_char == ' ' && next_char == a:key + return s:Right.s:Right + end + + " Skip the character if closed pair is next character + if current_char == '' + if g:AutoPairsMultilineClose + let next_lineno = line('.')+1 + let next_line = getline(nextnonblank(next_lineno)) + let next_char = matchstr(next_line, '\s*\zs.') + else + let next_char = matchstr(line, '\s*\zs.') + end + if next_char == a:key + return "\<ESC>e^a" + endif + endif + endif + + " Fly Mode, and the key is closed-pairs, search closed-pair and jump + if g:AutoPairsFlyMode && has_key(b:AutoPairsClosedPairs, a:key) + let n = stridx(after, a:key) + if n != -1 + return repeat(s:Right, n+1) + end + if search(a:key, 'W') + " force break the '.' when jump to different line + return "\<Right>" + endif + endif + + " Insert directly if the key is not an open key + return a:key + end + + let open = a:key + let close = b:AutoPairs[open] + + if current_char == close && open == close + return s:Right + end + + " Ignore auto close ' if follows a word + " MUST after closed check. 'hello|' + if a:key == "'" && prev_char =~ '\v\w' + return a:key + end + + " support for ''' ``` and """ + if open == close + " The key must be ' " ` + let pprev_char = line[col('.')-3] + if pprev_char == open && prev_char == open + " Double pair found + return repeat(a:key, 4) . repeat(s:Left, 3) + end + end + + let quotes_num = 0 + " Ignore comment line for vim file + if &filetype == 'vim' && a:key == '"' + if before =~ '^\s*$' + return a:key + end + if before =~ '^\s*"' + let quotes_num = -1 + end + end + + " Keep quote number is odd. + " Because quotes should be matched in the same line in most of situation + if g:AutoPairsSmartQuotes && open == close + " Remove \\ \" \' + let cleaned_line = substitute(line, '\v(\\.)', '', 'g') + let n = quotes_num + let pos = 0 + while 1 + let pos = stridx(cleaned_line, open, pos) + if pos == -1 + break + end + let n = n + 1 + let pos = pos + 1 + endwhile + if n % 2 == 1 + return a:key + endif + endif + + return open.close.s:Left +endfunction + +function! AutoPairsDelete() + if !b:autopairs_enabled + return "\<BS>" + end + + let line = getline('.') + let pos = col('.') - 1 + let current_char = get(split(strpart(line, pos), '\zs'), 0, '') + let prev_chars = split(strpart(line, 0, pos), '\zs') + let prev_char = get(prev_chars, -1, '') + let pprev_char = get(prev_chars, -2, '') + + if pprev_char == '\' + return "\<BS>" + end + + " Delete last two spaces in parens, work with MapSpace + if has_key(b:AutoPairs, pprev_char) && prev_char == ' ' && current_char == ' ' + return "\<BS>\<DEL>" + endif + + " Delete Repeated Pair eg: '''|''' [[|]] {{|}} + if has_key(b:AutoPairs, prev_char) + let times = 0 + let p = -1 + while get(prev_chars, p, '') == prev_char + let p = p - 1 + let times = times + 1 + endwhile + + let close = b:AutoPairs[prev_char] + let left = repeat(prev_char, times) + let right = repeat(close, times) + + let before = strpart(line, pos-times, times) + let after = strpart(line, pos, times) + if left == before && right == after + return repeat("\<BS>\<DEL>", times) + end + end + + + if has_key(b:AutoPairs, prev_char) + let close = b:AutoPairs[prev_char] + if match(line,'^\s*'.close, col('.')-1) != -1 + " Delete (|___) + let space = matchstr(line, '^\s*', col('.')-1) + return "\<BS>". repeat("\<DEL>", len(space)+1) + elseif match(line, '^\s*$', col('.')-1) != -1 + " Delete (|__\n___) + let nline = getline(line('.')+1) + if nline =~ '^\s*'.close + if &filetype == 'vim' && prev_char == '"' + " Keep next line's comment + return "\<BS>" + end + + let space = matchstr(nline, '^\s*') + return "\<BS>\<DEL>". repeat("\<DEL>", len(space)+1) + end + end + end + + return "\<BS>" +endfunction + +function! AutoPairsJump() + call search('["\]'')}]','W') +endfunction +" string_chunk cannot use standalone +let s:string_chunk = '\v%(\\\_.|[^\1]|[\r\n]){-}' +let s:ss_pattern = '\v''' . s:string_chunk . '''' +let s:ds_pattern = '\v"' . s:string_chunk . '"' + +func! s:RegexpQuote(str) + return substitute(a:str, '\v[\[\{\(\<\>\)\}\]]', '\\&', 'g') +endf + +func! s:RegexpQuoteInSquare(str) + return substitute(a:str, '\v[\[\]]', '\\&', 'g') +endf + +" Search next open or close pair +func! s:FormatChunk(open, close) + let open = s:RegexpQuote(a:open) + let close = s:RegexpQuote(a:close) + let open2 = s:RegexpQuoteInSquare(a:open) + let close2 = s:RegexpQuoteInSquare(a:close) + if open == close + return '\v'.open.s:string_chunk.close + else + return '\v%(' . s:ss_pattern . '|' . s:ds_pattern . '|' . '[^'.open2.close2.']|[\r\n]' . '){-}(['.open2.close2.'])' + end +endf + +" Fast wrap the word in brackets +function! AutoPairsFastWrap() + let line = getline('.') + let current_char = line[col('.')-1] + let next_char = line[col('.')] + let open_pair_pattern = '\v[({\[''"]' + let at_end = col('.') >= col('$') - 1 + normal x + " Skip blank + if next_char =~ '\v\s' || at_end + call search('\v\S', 'W') + let line = getline('.') + let next_char = line[col('.')-1] + end + + if has_key(b:AutoPairs, next_char) + let followed_open_pair = next_char + let inputed_close_pair = current_char + let followed_close_pair = b:AutoPairs[next_char] + if followed_close_pair != followed_open_pair + " TODO replace system searchpair to skip string and nested pair. + " eg: (|){"hello}world"} will transform to ({"hello})world"} + call searchpair('\V'.followed_open_pair, '', '\V'.followed_close_pair, 'W') + else + call search(s:FormatChunk(followed_open_pair, followed_close_pair), 'We') + end + return s:Right.inputed_close_pair.s:Left + else + normal he + return s:Right.current_char.s:Left + end +endfunction + +function! AutoPairsMap(key) + " | is special key which separate map command from text + let key = a:key + if key == '|' + let key = '<BAR>' + end + let escaped_key = substitute(key, "'", "''", 'g') + " use expr will cause search() doesn't work + execute 'inoremap <buffer> <silent> '.key." <C-R>=AutoPairsInsert('".escaped_key."')<CR>" +endfunction + +function! AutoPairsToggle() + if b:autopairs_enabled + let b:autopairs_enabled = 0 + echo 'AutoPairs Disabled.' + else + let b:autopairs_enabled = 1 + echo 'AutoPairs Enabled.' + end + return '' +endfunction + +function! AutoPairsReturn() + if b:autopairs_enabled == 0 + return '' + end + let line = getline('.') + let pline = getline(line('.')-1) + let prev_char = pline[strlen(pline)-1] + let cmd = '' + let cur_char = line[col('.')-1] + if has_key(b:AutoPairs, prev_char) && b:AutoPairs[prev_char] == cur_char + if g:AutoPairsCenterLine && winline() * 3 >= winheight(0) * 2 + " Use \<BS> instead of \<ESC>cl will cause the placeholder deleted + " incorrect. because <C-O>zz won't leave Normal mode. + " Use \<DEL> is a bit wierd. the character before cursor need to be deleted. + " Adding a space, recentering, and deleting it interferes with default + " whitespace-removing behavior when exiting insert mode. + let cmd = "\<ESC>zzcc" + end + + " If equalprg has been set, then avoid call = + " https://github.com/jiangmiao/auto-pairs/issues/24 + if &equalprg != '' + return "\<ESC>O".cmd + endif + + " conflict with javascript and coffee + " javascript need indent new line + " coffeescript forbid indent new line + if &filetype == 'coffeescript' || &filetype == 'coffee' + return "\<ESC>k==o".cmd + else + return "\<ESC>=ko".cmd + endif + end + return '' +endfunction + +function! AutoPairsSpace() + let line = getline('.') + let prev_char = line[col('.')-2] + let cmd = '' + let cur_char =line[col('.')-1] + if has_key(g:AutoPairsParens, prev_char) && g:AutoPairsParens[prev_char] == cur_char + let cmd = "\<SPACE>".s:Left + endif + return "\<SPACE>".cmd +endfunction + +function! AutoPairsBackInsert() + if exists('b:autopairs_saved_pair') + let pair = b:autopairs_saved_pair[0] + let pos = b:autopairs_saved_pair[1] + call setpos('.', pos) + return pair + endif + return '' +endfunction + +function! AutoPairsInit() + let b:autopairs_loaded = 1 + let b:autopairs_enabled = 1 + let b:AutoPairsClosedPairs = {} + + if !exists('b:AutoPairs') + let b:AutoPairs = g:AutoPairs + end + + " buffer level map pairs keys + for [open, close] in items(b:AutoPairs) + call AutoPairsMap(open) + if open != close + call AutoPairsMap(close) + end + let b:AutoPairsClosedPairs[close] = open + endfor + + " Still use <buffer> level mapping for <BS> <SPACE> + if g:AutoPairsMapBS + " Use <C-R> instead of <expr> for issue #14 sometimes press BS output strange words + execute 'inoremap <buffer> <silent> <BS> <C-R>=AutoPairsDelete()<CR>' + end + + if g:AutoPairsMapCh + execute 'inoremap <buffer> <silent> <C-h> <C-R>=AutoPairsDelete()<CR>' + endif + + if g:AutoPairsMapSpace + " Try to respect abbreviations on a <SPACE> + let do_abbrev = "" + if v:version == 703 && has("patch489") || v:version > 703 + let do_abbrev = "<C-]>" + endif + execute 'inoremap <buffer> <silent> <SPACE> '.do_abbrev.'<C-R>=AutoPairsSpace()<CR>' + end + + if g:AutoPairsShortcutFastWrap != '' + execute 'inoremap <buffer> <silent> '.g:AutoPairsShortcutFastWrap.' <C-R>=AutoPairsFastWrap()<CR>' + end + + if g:AutoPairsShortcutBackInsert != '' + execute 'inoremap <buffer> <silent> '.g:AutoPairsShortcutBackInsert.' <C-R>=AutoPairsBackInsert()<CR>' + end + + if g:AutoPairsShortcutToggle != '' + " use <expr> to ensure showing the status when toggle + execute 'inoremap <buffer> <silent> <expr> '.g:AutoPairsShortcutToggle.' AutoPairsToggle()' + execute 'noremap <buffer> <silent> '.g:AutoPairsShortcutToggle.' :call AutoPairsToggle()<CR>' + end + + if g:AutoPairsShortcutJump != '' + execute 'inoremap <buffer> <silent> ' . g:AutoPairsShortcutJump. ' <ESC>:call AutoPairsJump()<CR>a' + execute 'noremap <buffer> <silent> ' . g:AutoPairsShortcutJump. ' :call AutoPairsJump()<CR>' + end + +endfunction + +function! s:ExpandMap(map) + let map = a:map + let map = substitute(map, '\(<Plug>\w\+\)', '\=maparg(submatch(1), "i")', 'g') + return map +endfunction + +function! AutoPairsTryInit() + if exists('b:autopairs_loaded') + return + end + + " for auto-pairs starts with 'a', so the priority is higher than supertab and vim-endwise + " + " vim-endwise doesn't support <Plug>AutoPairsReturn + " when use <Plug>AutoPairsReturn will cause <Plug> isn't expanded + " + " supertab doesn't support <SID>AutoPairsReturn + " when use <SID>AutoPairsReturn will cause Duplicated <CR> + " + " and when load after vim-endwise will cause unexpected endwise inserted. + " so always load AutoPairs at last + + " Buffer level keys mapping + " comptible with other plugin + if g:AutoPairsMapCR + if v:version == 703 && has('patch32') || v:version > 703 + " VIM 7.3 supports advancer maparg which could get <expr> info + " then auto-pairs could remap <CR> in any case. + let info = maparg('<CR>', 'i', 0, 1) + if empty(info) + let old_cr = '<CR>' + let is_expr = 0 + else + let old_cr = info['rhs'] + let old_cr = s:ExpandMap(old_cr) + let old_cr = substitute(old_cr, '<SID>', '<SNR>' . info['sid'] . '_', 'g') + let is_expr = info['expr'] + let wrapper_name = '<SID>AutoPairsOldCRWrapper73' + endif + else + " VIM version less than 7.3 + " the mapping's <expr> info is lost, so guess it is expr or not, it's + " not accurate. + let old_cr = maparg('<CR>', 'i') + if old_cr == '' + let old_cr = '<CR>' + let is_expr = 0 + else + let old_cr = s:ExpandMap(old_cr) + " old_cr contain (, I guess the old cr is in expr mode + let is_expr = old_cr =~ '\V(' && toupper(old_cr) !~ '\V<C-R>' + + " The old_cr start with " it must be in expr mode + let is_expr = is_expr || old_cr =~ '\v^"' + let wrapper_name = '<SID>AutoPairsOldCRWrapper' + end + end + + if old_cr !~ 'AutoPairsReturn' + if is_expr + " remap <expr> to `name` to avoid mix expr and non-expr mode + execute 'inoremap <buffer> <expr> <script> '. wrapper_name . ' ' . old_cr + let old_cr = wrapper_name + end + " Always silent mapping + execute 'inoremap <script> <buffer> <silent> <CR> '.old_cr.'<SID>AutoPairsReturn' + end + endif + call AutoPairsInit() +endfunction + +" Always silent the command +inoremap <silent> <SID>AutoPairsReturn <C-R>=AutoPairsReturn()<CR> +imap <script> <Plug>AutoPairsReturn <SID>AutoPairsReturn + + +au BufEnter * :call AutoPairsTryInit() diff --git a/update_plugins.py b/update_plugins.py index 07116c96..97292d72 100644 --- a/update_plugins.py +++ b/update_plugins.py @@ -52,6 +52,7 @@ vim-flake8 https://github.com/nvie/vim-flake8 vim-pug https://github.com/digitaltoad/vim-pug vim-yankstack https://github.com/maxbrunsfeld/vim-yankstack lightline.vim https://github.com/itchyny/lightline.vim +auto-pairs https://github.com/jiangmiao/auto-pairs """.strip() GITHUB_ZIP = '%s/archive/master.zip' From a56d7679894536b799fce21573ef95685703f8b5 Mon Sep 17 00:00:00 2001 From: amix <amix@amix.dk> Date: Wed, 24 Aug 2016 00:02:31 +0200 Subject: [PATCH 7/8] Remove auto entering full screen view --- vimrcs/extended.vim | 6 ------ 1 file changed, 6 deletions(-) diff --git a/vimrcs/extended.vim b/vimrcs/extended.vim index 649ed083..499959a2 100644 --- a/vimrcs/extended.vim +++ b/vimrcs/extended.vim @@ -21,12 +21,6 @@ elseif has("unix") set gfn=Monospace\ 11 endif -" Open MacVim in fullscreen mode -if has("gui_macvim") - set fuoptions=maxvert,maxhorz - au GUIEnter * set fullscreen -endif - " Disable scrollbars (real hackers don't use scrollbars for navigation!) set guioptions-=r set guioptions-=R From 23ba938b6dcd2c3af9bbd58c607d91d3d9ae3fdc Mon Sep 17 00:00:00 2001 From: amix <amix@amix.dk> Date: Wed, 24 Aug 2016 00:02:40 +0200 Subject: [PATCH 8/8] Revert "Added the auto-pairs plugin" This reverts commit 1f9936148427a5d5ad7e3f3b6bb442e4895943ea. --- sources_non_forked/auto-pairs/README.md | 310 ---------- .../auto-pairs/plugin/auto-pairs.vim | 564 ------------------ update_plugins.py | 1 - 3 files changed, 875 deletions(-) delete mode 100644 sources_non_forked/auto-pairs/README.md delete mode 100644 sources_non_forked/auto-pairs/plugin/auto-pairs.vim diff --git a/sources_non_forked/auto-pairs/README.md b/sources_non_forked/auto-pairs/README.md deleted file mode 100644 index 72bde892..00000000 --- a/sources_non_forked/auto-pairs/README.md +++ /dev/null @@ -1,310 +0,0 @@ -Auto Pairs -========== -Insert or delete brackets, parens, quotes in pair. - -Installation ------------- -copy plugin/auto-pairs.vim to ~/.vim/plugin - -or if you are using `pathogen`: - -```git clone git://github.com/jiangmiao/auto-pairs.git ~/.vim/bundle/auto-pairs``` - -Features --------- -* Insert in pair - - input: [ - output: [|] - -* Delete in pair - - input: foo[<BS>] - output: foo - -* Insert new indented line after Return - - input: {|} (press <CR> at |) - output: { - | - } - -* Insert spaces before closing characters, only for [], (), {} - - input: {|} (press <SPACE> at |) - output: { | } - - input: {|} (press <SPACE>foo} at |) - output: { foo }| - - input: '|' (press <SPACE> at |) - output: ' |' - -* Skip ' when inside a word - - input: foo| (press ' at |) - output: foo' - -* Skip closed bracket. - - input: [] - output: [] - -* Ignore auto pair when previous character is \ - - input: "\' - output: "\'" - -* Fast Wrap - - input: |'hello' (press (<M-e> at |) - output: ('hello') - - wrap string, only support c style string - input: |'h\\el\'lo' (press (<M-e> at |) - output ('h\\ello\'') - - input: |[foo, bar()] (press (<M-e> at |) - output: ([foo, bar()]) - -* Quick jump to closed pair. - - input: - { - something;| - } - - (press } at |) - - output: - { - - }| - -* Support ``` ''' and """ - - input: - ''' - - output: - '''|''' - -* Delete Repeated Pairs in one time - - input: """|""" (press <BS> at |) - output: | - - input: {{|}} (press <BS> at |) - output: | - - input: [[[[[[|]]]]]] (press <BS> at |) - output: | - -* Fly Mode - - input: if(a[3) - output: if(a[3])| (In Fly Mode) - output: if(a[3)]) (Without Fly Mode) - - input: - { - hello();| - world(); - } - - (press } at |) - - output: - { - hello(); - world(); - }| - - (then press <M-b> at | to do backinsert) - output: - { - hello();}| - world(); - } - - See Fly Mode section for details - -Fly Mode --------- -Fly Mode will always force closed-pair jumping instead of inserting. only for ")", "}", "]" - -If jumps in mistake, could use AutoPairsBackInsert(Default Key: `<M-b>`) to jump back and insert closed pair. - -the most situation maybe want to insert single closed pair in the string, eg ")" - -Fly Mode is DISABLED by default. - -add **let g:AutoPairsFlyMode = 1** .vimrc to turn it on - -Default Options: - - let g:AutoPairsFlyMode = 0 - let g:AutoPairsShortcutBackInsert = '<M-b>' - -Shortcuts ---------- - - System Shortcuts: - <CR> : Insert new indented line after return if cursor in blank brackets or quotes. - <BS> : Delete brackets in pair - <M-p> : Toggle Autopairs (g:AutoPairsShortcutToggle) - <M-e> : Fast Wrap (g:AutoPairsShortcutFastWrap) - <M-n> : Jump to next closed pair (g:AutoPairsShortcutJump) - <M-b> : BackInsert (g:AutoPairsShortcutBackInsert) - - If <M-p> <M-e> or <M-n> conflict with another keys or want to bind to another keys, add - - let g:AutoPairsShortcutToggle = '<another key>' - - to .vimrc, if the key is empty string '', then the shortcut will be disabled. - -Options -------- -* g:AutoPairs - - Default: {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`'} - -* b:AutoPairs - - Default: g:AutoPairs - - Buffer level pairs set. - -* g:AutoPairsShortcutToggle - - Default: '<M-p>' - - The shortcut to toggle autopairs. - -* g:AutoPairsShortcutFastWrap - - Default: '<M-e>' - - Fast wrap the word. all pairs will be consider as a block (include <>). - (|)'hello' after fast wrap at |, the word will be ('hello') - (|)<hello> after fast wrap at |, the word will be (<hello>) - -* g:AutoPairsShortcutJump - - Default: '<M-n>' - - Jump to the next closed pair - -* g:AutoPairsMapBS - - Default : 1 - - Map <BS> to delete brackets, quotes in pair - execute 'inoremap <buffer> <silent> <BS> <C-R>=AutoPairsDelete()<CR>' - -* g:AutoPairsMapCh - - Default : 1 - - Map <C-h> to delete brackets, quotes in pair - -* g:AutoPairsMapCR - - Default : 1 - - Map <CR> to insert a new indented line if cursor in (|), {|} [|], '|', "|" - execute 'inoremap <buffer> <silent> <CR> <C-R>=AutoPairsReturn()<CR>' - -* g:AutoPairsCenterLine - - Default : 1 - - When g:AutoPairsMapCR is on, center current line after return if the line is at the bottom 1/3 of the window. - -* g:AutoPairsMapSpace - - Default : 1 - - Map <space> to insert a space after the opening character and before the closing one. - execute 'inoremap <buffer> <silent> <CR> <C-R>=AutoPairsSpace()<CR>' - -* g:AutoPairsFlyMode - - Default : 0 - - set it to 1 to enable FlyMode. - see FlyMode section for details. - -* g:AutoPairsMultilineClose - - Default : 1 - - When you press the key for the closing pair (e.g. `)`) it jumps past it. - If set to 1, then it'll jump to the next line, if there is only whitespace. - If set to 0, then it'll only jump to a closing pair on the same line. - -* g:AutoPairsShortcutBackInsert - - Default : <M-b> - - Work with FlyMode, insert the key at the Fly Mode jumped postion - -Buffer Level Pairs Setting --------------------------- - -Set b:AutoPairs before BufEnter - -eg: - - " When the filetype is FILETYPE then make AutoPairs only match for parenthesis - au Filetype FILETYPE let b:AutoPairs = {"(": ")"} - -TroubleShooting ---------------- - The script will remap keys ([{'"}]) <BS>, - If auto pairs cannot work, use :imap ( to check if the map is corrected. - The correct map should be <C-R>=AutoPairsInsert("\(")<CR> - Or the plugin conflict with some other plugins. - use command :call AutoPairsInit() to remap the keys. - - -* How to insert parens purely - - There are 3 ways - - 1. use Ctrl-V ) to insert paren without trigger the plugin. - - 2. use Alt-P to turn off the plugin. - - 3. use DEL or <C-O>x to delete the character insert by plugin. - -* Swedish Character Conflict - - Because AutoPairs uses Meta(Alt) key as shortcut, it is conflict with some Swedish character such as å. - To fix the issue, you need remap or disable the related shortcut. - -Known Issues ------------------------ -Breaks '.' - [issue #3](https://github.com/jiangmiao/auto-pairs/issues/3) - - Description: After entering insert mode and inputing `[hello` then leave insert - mode by `<ESC>`. press '.' will insert 'hello' instead of '[hello]'. - Reason: `[` actually equals `[]\<LEFT>` and \<LEFT> will break '.'. - After version 7.4.849, Vim implements new keyword <C-G>U to avoid the break - Solution: Update Vim to 7.4.849+ - -Contributors ------------- -* [camthompson](https://github.com/camthompson) - - -License -------- - -Copyright (C) 2011-2013 Miao Jiang - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/sources_non_forked/auto-pairs/plugin/auto-pairs.vim b/sources_non_forked/auto-pairs/plugin/auto-pairs.vim deleted file mode 100644 index 200b2ddd..00000000 --- a/sources_non_forked/auto-pairs/plugin/auto-pairs.vim +++ /dev/null @@ -1,564 +0,0 @@ -" Insert or delete brackets, parens, quotes in pairs. -" Maintainer: JiangMiao <jiangfriend@gmail.com> -" Contributor: camthompson -" Last Change: 2013-07-13 -" Version: 1.3.2 -" Homepage: http://www.vim.org/scripts/script.php?script_id=3599 -" Repository: https://github.com/jiangmiao/auto-pairs -" License: MIT - -if exists('g:AutoPairsLoaded') || &cp - finish -end -let g:AutoPairsLoaded = 1 - -if !exists('g:AutoPairs') - let g:AutoPairs = {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`'} -end - -if !exists('g:AutoPairsParens') - let g:AutoPairsParens = {'(':')', '[':']', '{':'}'} -end - -if !exists('g:AutoPairsMapBS') - let g:AutoPairsMapBS = 1 -end - -" Map <C-h> as the same BS -if !exists('g:AutoPairsMapCh') - let g:AutoPairsMapCh = 1 -end - -if !exists('g:AutoPairsMapCR') - let g:AutoPairsMapCR = 1 -end - -if !exists('g:AutoPairsMapSpace') - let g:AutoPairsMapSpace = 1 -end - -if !exists('g:AutoPairsCenterLine') - let g:AutoPairsCenterLine = 1 -end - -if !exists('g:AutoPairsShortcutToggle') - let g:AutoPairsShortcutToggle = '<M-p>' -end - -if !exists('g:AutoPairsShortcutFastWrap') - let g:AutoPairsShortcutFastWrap = '<M-e>' -end - -if !exists('g:AutoPairsShortcutJump') - let g:AutoPairsShortcutJump = '<M-n>' -endif - -" Fly mode will for closed pair to jump to closed pair instead of insert. -" also support AutoPairsBackInsert to insert pairs where jumped. -if !exists('g:AutoPairsFlyMode') - let g:AutoPairsFlyMode = 0 -endif - -" When skipping the closed pair, look at the current and -" next line as well. -if !exists('g:AutoPairsMultilineClose') - let g:AutoPairsMultilineClose = 1 -endif - -" Work with Fly Mode, insert pair where jumped -if !exists('g:AutoPairsShortcutBackInsert') - let g:AutoPairsShortcutBackInsert = '<M-b>' -endif - -if !exists('g:AutoPairsSmartQuotes') - let g:AutoPairsSmartQuotes = 1 -endif - -" 7.4.849 support <C-G>U to avoid breaking '.' -" Issue talk: https://github.com/jiangmiao/auto-pairs/issues/3 -" Vim note: https://github.com/vim/vim/releases/tag/v7.4.849 -if v:version >= 704 && has("patch849") - let s:Go = "\<C-G>U" -else - let s:Go = "" -endif - -let s:Left = s:Go."\<LEFT>" -let s:Right = s:Go."\<RIGHT>" - - -" Will auto generated {']' => '[', ..., '}' => '{'}in initialize. -let g:AutoPairsClosedPairs = {} - - -function! AutoPairsInsert(key) - if !b:autopairs_enabled - return a:key - end - - let line = getline('.') - let pos = col('.') - 1 - let before = strpart(line, 0, pos) - let after = strpart(line, pos) - let next_chars = split(after, '\zs') - let current_char = get(next_chars, 0, '') - let next_char = get(next_chars, 1, '') - let prev_chars = split(before, '\zs') - let prev_char = get(prev_chars, -1, '') - - let eol = 0 - if col('$') - col('.') <= 1 - let eol = 1 - end - - " Ignore auto close if prev character is \ - if prev_char == '\' - return a:key - end - - " The key is difference open-pair, then it means only for ) ] } by default - if !has_key(b:AutoPairs, a:key) - let b:autopairs_saved_pair = [a:key, getpos('.')] - - " Skip the character if current character is the same as input - if current_char == a:key - return s:Right - end - - if !g:AutoPairsFlyMode - " Skip the character if next character is space - if current_char == ' ' && next_char == a:key - return s:Right.s:Right - end - - " Skip the character if closed pair is next character - if current_char == '' - if g:AutoPairsMultilineClose - let next_lineno = line('.')+1 - let next_line = getline(nextnonblank(next_lineno)) - let next_char = matchstr(next_line, '\s*\zs.') - else - let next_char = matchstr(line, '\s*\zs.') - end - if next_char == a:key - return "\<ESC>e^a" - endif - endif - endif - - " Fly Mode, and the key is closed-pairs, search closed-pair and jump - if g:AutoPairsFlyMode && has_key(b:AutoPairsClosedPairs, a:key) - let n = stridx(after, a:key) - if n != -1 - return repeat(s:Right, n+1) - end - if search(a:key, 'W') - " force break the '.' when jump to different line - return "\<Right>" - endif - endif - - " Insert directly if the key is not an open key - return a:key - end - - let open = a:key - let close = b:AutoPairs[open] - - if current_char == close && open == close - return s:Right - end - - " Ignore auto close ' if follows a word - " MUST after closed check. 'hello|' - if a:key == "'" && prev_char =~ '\v\w' - return a:key - end - - " support for ''' ``` and """ - if open == close - " The key must be ' " ` - let pprev_char = line[col('.')-3] - if pprev_char == open && prev_char == open - " Double pair found - return repeat(a:key, 4) . repeat(s:Left, 3) - end - end - - let quotes_num = 0 - " Ignore comment line for vim file - if &filetype == 'vim' && a:key == '"' - if before =~ '^\s*$' - return a:key - end - if before =~ '^\s*"' - let quotes_num = -1 - end - end - - " Keep quote number is odd. - " Because quotes should be matched in the same line in most of situation - if g:AutoPairsSmartQuotes && open == close - " Remove \\ \" \' - let cleaned_line = substitute(line, '\v(\\.)', '', 'g') - let n = quotes_num - let pos = 0 - while 1 - let pos = stridx(cleaned_line, open, pos) - if pos == -1 - break - end - let n = n + 1 - let pos = pos + 1 - endwhile - if n % 2 == 1 - return a:key - endif - endif - - return open.close.s:Left -endfunction - -function! AutoPairsDelete() - if !b:autopairs_enabled - return "\<BS>" - end - - let line = getline('.') - let pos = col('.') - 1 - let current_char = get(split(strpart(line, pos), '\zs'), 0, '') - let prev_chars = split(strpart(line, 0, pos), '\zs') - let prev_char = get(prev_chars, -1, '') - let pprev_char = get(prev_chars, -2, '') - - if pprev_char == '\' - return "\<BS>" - end - - " Delete last two spaces in parens, work with MapSpace - if has_key(b:AutoPairs, pprev_char) && prev_char == ' ' && current_char == ' ' - return "\<BS>\<DEL>" - endif - - " Delete Repeated Pair eg: '''|''' [[|]] {{|}} - if has_key(b:AutoPairs, prev_char) - let times = 0 - let p = -1 - while get(prev_chars, p, '') == prev_char - let p = p - 1 - let times = times + 1 - endwhile - - let close = b:AutoPairs[prev_char] - let left = repeat(prev_char, times) - let right = repeat(close, times) - - let before = strpart(line, pos-times, times) - let after = strpart(line, pos, times) - if left == before && right == after - return repeat("\<BS>\<DEL>", times) - end - end - - - if has_key(b:AutoPairs, prev_char) - let close = b:AutoPairs[prev_char] - if match(line,'^\s*'.close, col('.')-1) != -1 - " Delete (|___) - let space = matchstr(line, '^\s*', col('.')-1) - return "\<BS>". repeat("\<DEL>", len(space)+1) - elseif match(line, '^\s*$', col('.')-1) != -1 - " Delete (|__\n___) - let nline = getline(line('.')+1) - if nline =~ '^\s*'.close - if &filetype == 'vim' && prev_char == '"' - " Keep next line's comment - return "\<BS>" - end - - let space = matchstr(nline, '^\s*') - return "\<BS>\<DEL>". repeat("\<DEL>", len(space)+1) - end - end - end - - return "\<BS>" -endfunction - -function! AutoPairsJump() - call search('["\]'')}]','W') -endfunction -" string_chunk cannot use standalone -let s:string_chunk = '\v%(\\\_.|[^\1]|[\r\n]){-}' -let s:ss_pattern = '\v''' . s:string_chunk . '''' -let s:ds_pattern = '\v"' . s:string_chunk . '"' - -func! s:RegexpQuote(str) - return substitute(a:str, '\v[\[\{\(\<\>\)\}\]]', '\\&', 'g') -endf - -func! s:RegexpQuoteInSquare(str) - return substitute(a:str, '\v[\[\]]', '\\&', 'g') -endf - -" Search next open or close pair -func! s:FormatChunk(open, close) - let open = s:RegexpQuote(a:open) - let close = s:RegexpQuote(a:close) - let open2 = s:RegexpQuoteInSquare(a:open) - let close2 = s:RegexpQuoteInSquare(a:close) - if open == close - return '\v'.open.s:string_chunk.close - else - return '\v%(' . s:ss_pattern . '|' . s:ds_pattern . '|' . '[^'.open2.close2.']|[\r\n]' . '){-}(['.open2.close2.'])' - end -endf - -" Fast wrap the word in brackets -function! AutoPairsFastWrap() - let line = getline('.') - let current_char = line[col('.')-1] - let next_char = line[col('.')] - let open_pair_pattern = '\v[({\[''"]' - let at_end = col('.') >= col('$') - 1 - normal x - " Skip blank - if next_char =~ '\v\s' || at_end - call search('\v\S', 'W') - let line = getline('.') - let next_char = line[col('.')-1] - end - - if has_key(b:AutoPairs, next_char) - let followed_open_pair = next_char - let inputed_close_pair = current_char - let followed_close_pair = b:AutoPairs[next_char] - if followed_close_pair != followed_open_pair - " TODO replace system searchpair to skip string and nested pair. - " eg: (|){"hello}world"} will transform to ({"hello})world"} - call searchpair('\V'.followed_open_pair, '', '\V'.followed_close_pair, 'W') - else - call search(s:FormatChunk(followed_open_pair, followed_close_pair), 'We') - end - return s:Right.inputed_close_pair.s:Left - else - normal he - return s:Right.current_char.s:Left - end -endfunction - -function! AutoPairsMap(key) - " | is special key which separate map command from text - let key = a:key - if key == '|' - let key = '<BAR>' - end - let escaped_key = substitute(key, "'", "''", 'g') - " use expr will cause search() doesn't work - execute 'inoremap <buffer> <silent> '.key." <C-R>=AutoPairsInsert('".escaped_key."')<CR>" -endfunction - -function! AutoPairsToggle() - if b:autopairs_enabled - let b:autopairs_enabled = 0 - echo 'AutoPairs Disabled.' - else - let b:autopairs_enabled = 1 - echo 'AutoPairs Enabled.' - end - return '' -endfunction - -function! AutoPairsReturn() - if b:autopairs_enabled == 0 - return '' - end - let line = getline('.') - let pline = getline(line('.')-1) - let prev_char = pline[strlen(pline)-1] - let cmd = '' - let cur_char = line[col('.')-1] - if has_key(b:AutoPairs, prev_char) && b:AutoPairs[prev_char] == cur_char - if g:AutoPairsCenterLine && winline() * 3 >= winheight(0) * 2 - " Use \<BS> instead of \<ESC>cl will cause the placeholder deleted - " incorrect. because <C-O>zz won't leave Normal mode. - " Use \<DEL> is a bit wierd. the character before cursor need to be deleted. - " Adding a space, recentering, and deleting it interferes with default - " whitespace-removing behavior when exiting insert mode. - let cmd = "\<ESC>zzcc" - end - - " If equalprg has been set, then avoid call = - " https://github.com/jiangmiao/auto-pairs/issues/24 - if &equalprg != '' - return "\<ESC>O".cmd - endif - - " conflict with javascript and coffee - " javascript need indent new line - " coffeescript forbid indent new line - if &filetype == 'coffeescript' || &filetype == 'coffee' - return "\<ESC>k==o".cmd - else - return "\<ESC>=ko".cmd - endif - end - return '' -endfunction - -function! AutoPairsSpace() - let line = getline('.') - let prev_char = line[col('.')-2] - let cmd = '' - let cur_char =line[col('.')-1] - if has_key(g:AutoPairsParens, prev_char) && g:AutoPairsParens[prev_char] == cur_char - let cmd = "\<SPACE>".s:Left - endif - return "\<SPACE>".cmd -endfunction - -function! AutoPairsBackInsert() - if exists('b:autopairs_saved_pair') - let pair = b:autopairs_saved_pair[0] - let pos = b:autopairs_saved_pair[1] - call setpos('.', pos) - return pair - endif - return '' -endfunction - -function! AutoPairsInit() - let b:autopairs_loaded = 1 - let b:autopairs_enabled = 1 - let b:AutoPairsClosedPairs = {} - - if !exists('b:AutoPairs') - let b:AutoPairs = g:AutoPairs - end - - " buffer level map pairs keys - for [open, close] in items(b:AutoPairs) - call AutoPairsMap(open) - if open != close - call AutoPairsMap(close) - end - let b:AutoPairsClosedPairs[close] = open - endfor - - " Still use <buffer> level mapping for <BS> <SPACE> - if g:AutoPairsMapBS - " Use <C-R> instead of <expr> for issue #14 sometimes press BS output strange words - execute 'inoremap <buffer> <silent> <BS> <C-R>=AutoPairsDelete()<CR>' - end - - if g:AutoPairsMapCh - execute 'inoremap <buffer> <silent> <C-h> <C-R>=AutoPairsDelete()<CR>' - endif - - if g:AutoPairsMapSpace - " Try to respect abbreviations on a <SPACE> - let do_abbrev = "" - if v:version == 703 && has("patch489") || v:version > 703 - let do_abbrev = "<C-]>" - endif - execute 'inoremap <buffer> <silent> <SPACE> '.do_abbrev.'<C-R>=AutoPairsSpace()<CR>' - end - - if g:AutoPairsShortcutFastWrap != '' - execute 'inoremap <buffer> <silent> '.g:AutoPairsShortcutFastWrap.' <C-R>=AutoPairsFastWrap()<CR>' - end - - if g:AutoPairsShortcutBackInsert != '' - execute 'inoremap <buffer> <silent> '.g:AutoPairsShortcutBackInsert.' <C-R>=AutoPairsBackInsert()<CR>' - end - - if g:AutoPairsShortcutToggle != '' - " use <expr> to ensure showing the status when toggle - execute 'inoremap <buffer> <silent> <expr> '.g:AutoPairsShortcutToggle.' AutoPairsToggle()' - execute 'noremap <buffer> <silent> '.g:AutoPairsShortcutToggle.' :call AutoPairsToggle()<CR>' - end - - if g:AutoPairsShortcutJump != '' - execute 'inoremap <buffer> <silent> ' . g:AutoPairsShortcutJump. ' <ESC>:call AutoPairsJump()<CR>a' - execute 'noremap <buffer> <silent> ' . g:AutoPairsShortcutJump. ' :call AutoPairsJump()<CR>' - end - -endfunction - -function! s:ExpandMap(map) - let map = a:map - let map = substitute(map, '\(<Plug>\w\+\)', '\=maparg(submatch(1), "i")', 'g') - return map -endfunction - -function! AutoPairsTryInit() - if exists('b:autopairs_loaded') - return - end - - " for auto-pairs starts with 'a', so the priority is higher than supertab and vim-endwise - " - " vim-endwise doesn't support <Plug>AutoPairsReturn - " when use <Plug>AutoPairsReturn will cause <Plug> isn't expanded - " - " supertab doesn't support <SID>AutoPairsReturn - " when use <SID>AutoPairsReturn will cause Duplicated <CR> - " - " and when load after vim-endwise will cause unexpected endwise inserted. - " so always load AutoPairs at last - - " Buffer level keys mapping - " comptible with other plugin - if g:AutoPairsMapCR - if v:version == 703 && has('patch32') || v:version > 703 - " VIM 7.3 supports advancer maparg which could get <expr> info - " then auto-pairs could remap <CR> in any case. - let info = maparg('<CR>', 'i', 0, 1) - if empty(info) - let old_cr = '<CR>' - let is_expr = 0 - else - let old_cr = info['rhs'] - let old_cr = s:ExpandMap(old_cr) - let old_cr = substitute(old_cr, '<SID>', '<SNR>' . info['sid'] . '_', 'g') - let is_expr = info['expr'] - let wrapper_name = '<SID>AutoPairsOldCRWrapper73' - endif - else - " VIM version less than 7.3 - " the mapping's <expr> info is lost, so guess it is expr or not, it's - " not accurate. - let old_cr = maparg('<CR>', 'i') - if old_cr == '' - let old_cr = '<CR>' - let is_expr = 0 - else - let old_cr = s:ExpandMap(old_cr) - " old_cr contain (, I guess the old cr is in expr mode - let is_expr = old_cr =~ '\V(' && toupper(old_cr) !~ '\V<C-R>' - - " The old_cr start with " it must be in expr mode - let is_expr = is_expr || old_cr =~ '\v^"' - let wrapper_name = '<SID>AutoPairsOldCRWrapper' - end - end - - if old_cr !~ 'AutoPairsReturn' - if is_expr - " remap <expr> to `name` to avoid mix expr and non-expr mode - execute 'inoremap <buffer> <expr> <script> '. wrapper_name . ' ' . old_cr - let old_cr = wrapper_name - end - " Always silent mapping - execute 'inoremap <script> <buffer> <silent> <CR> '.old_cr.'<SID>AutoPairsReturn' - end - endif - call AutoPairsInit() -endfunction - -" Always silent the command -inoremap <silent> <SID>AutoPairsReturn <C-R>=AutoPairsReturn()<CR> -imap <script> <Plug>AutoPairsReturn <SID>AutoPairsReturn - - -au BufEnter * :call AutoPairsTryInit() diff --git a/update_plugins.py b/update_plugins.py index 97292d72..07116c96 100644 --- a/update_plugins.py +++ b/update_plugins.py @@ -52,7 +52,6 @@ vim-flake8 https://github.com/nvie/vim-flake8 vim-pug https://github.com/digitaltoad/vim-pug vim-yankstack https://github.com/maxbrunsfeld/vim-yankstack lightline.vim https://github.com/itchyny/lightline.vim -auto-pairs https://github.com/jiangmiao/auto-pairs """.strip() GITHUB_ZIP = '%s/archive/master.zip'