From 18692c0bc75de46e2a88b6e6fee759405c890bc3 Mon Sep 17 00:00:00 2001 From: Emanuele Mazzotta Date: Sat, 21 May 2016 20:59:42 +0200 Subject: [PATCH 1/8] Update .gitignore The file "sources_non_forked/ctrlp.vim/doc/tags-cn" keeps getting created for me and should be ignored. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 66d01465..7022e36e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ sources_non_forked/ack.vim/.netrwhist temp_dirs/yankring_history_v2.txt sources_forked/yankring/doc/tags sources_non_forked/tlib/doc/tags +sources_non_forked/ctrlp.vim/doc/tags* my_configs.vim tags .DS_Store From 0228ad0e9e193d643810db5dfcf813977dd9070a Mon Sep 17 00:00:00 2001 From: amix Date: Sat, 11 Jun 2016 15:56:50 +0200 Subject: [PATCH 2/8] Updated plugins --- sources_non_forked/ctrlp.vim/.gitignore | 7 + .../ctrlp.vim/autoload/ctrlp.vim | 15 +- sources_non_forked/lightline.vim/README.md | 12 +- .../lightline.vim/autoload/lightline.vim | 4 +- .../lightline.vim/doc/lightline.txt | 26 +- .../lightline.vim/test/highlight.vim | 36 +- .../nerdtree/autoload/nerdtree/ui_glue.vim | 2 +- .../syntastic/autoload/syntastic/util.vim | 6 + .../syntastic/plugin/syntastic.vim | 4 +- .../syntastic/plugin/syntastic/checker.vim | 3 + .../syntax_checkers/ansible/ansible_lint.vim | 4 +- .../syntastic/syntax_checkers/cuda/nvcc.vim | 54 +-- .../syntastic/syntax_checkers/html/eslint.vim | 23 ++ .../syntax_checkers/racket/racket.vim | 3 +- sources_non_forked/vim-go/CHANGELOG.md | 34 +- sources_non_forked/vim-go/README.md | 8 +- sources_non_forked/vim-go/autoload/go/cmd.vim | 28 +- .../vim-go/autoload/go/complete.vim | 48 ++- .../vim-go/autoload/go/coverage.vim | 19 +- sources_non_forked/vim-go/autoload/go/def.vim | 320 ++++++++++-------- sources_non_forked/vim-go/autoload/go/doc.vim | 30 +- sources_non_forked/vim-go/autoload/go/fmt.vim | 11 +- .../vim-go/autoload/go/guru.vim | 3 +- .../vim-go/autoload/go/lint.vim | 2 +- .../vim-go/autoload/go/package.vim | 2 +- .../vim-go/autoload/go/path.vim | 3 + .../vim-go/autoload/go/rename.vim | 9 + .../vim-go/autoload/go/textobj.vim | 4 +- .../vim-go/autoload/go/tool.vim | 21 +- sources_non_forked/vim-go/autoload/go/ui.vim | 2 +- sources_non_forked/vim-go/doc/vim-go.txt | 56 ++- .../vim-go/ftplugin/go/mappings.vim | 1 + .../vim-go/gosnippets/snippets/go.snip | 18 +- sources_non_forked/vim-go/plugin/go.vim | 10 +- sources_non_forked/vim-go/syntax/go.vim | 10 + .../vim-multiple-cursors/README.md | 13 +- .../vim-snipmate/Contributors.md | 2 + sources_non_forked/vim-snipmate/README.md | 12 +- .../vim-snipmate/autoload/snipMate.vim | 101 ++---- .../autoload/snipmate/jumping.vim | 47 ++- .../vim-snipmate/autoload/snipmate/legacy.vim | 13 +- .../vim-snipmate/autoload/snipmate/parse.vim | 182 +++++++--- .../vim-snipmate/doc/snipMate.txt | 10 +- sources_non_forked/vim-snipmate/t/parser.vim | 100 +++--- .../UltiSnips/php-phpspec.snippets | 196 ++++++++++- .../UltiSnips/php-phpunit.snippets | 40 --- .../vim-snippets/UltiSnips/php.snippets | 159 ++------- .../vim-snippets/UltiSnips/twig.snippets | 53 --- .../vim-snippets/snippets/_.snippets | 2 + .../vim-snippets/snippets/cpp.snippets | 4 +- .../vim-snippets/snippets/elixir.snippets | 5 +- .../vim-snippets/snippets/elm.snippets | 50 +++ .../vim-snippets/snippets/erlang.snippets | 31 ++ .../snippets/javascript-mocha.snippets | 14 + .../vim-snippets/snippets/make.snippets | 5 + .../vim-snippets/snippets/mustache.snippets | 18 + .../vim-snippets/snippets/php.snippets | 199 ++++++----- .../vim-snippets/snippets/ruby.snippets | 2 + .../vim-snippets/snippets/twig.snippets | 27 +- .../vim-surround/plugin/surround.vim | 2 +- 60 files changed, 1341 insertions(+), 784 deletions(-) create mode 100644 sources_non_forked/ctrlp.vim/.gitignore create mode 100644 sources_non_forked/syntastic/syntax_checkers/html/eslint.vim delete mode 100644 sources_non_forked/vim-snippets/UltiSnips/php-phpunit.snippets delete mode 100644 sources_non_forked/vim-snippets/UltiSnips/twig.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/elm.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/javascript-mocha.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/mustache.snippets diff --git a/sources_non_forked/ctrlp.vim/.gitignore b/sources_non_forked/ctrlp.vim/.gitignore new file mode 100644 index 00000000..3dc7cfe1 --- /dev/null +++ b/sources_non_forked/ctrlp.vim/.gitignore @@ -0,0 +1,7 @@ +*.markdown +*.zip +note.txt +tags +tags-cn +.hg* +tmp/* diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim index fe2cdf87..d8601794 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim @@ -315,11 +315,11 @@ fu! s:Open() cal s:setupblank() endf -fu! s:Close() +fu! s:Close(exit) cal s:buffunc(0) if winnr('$') == 1 bw! - el + elsei a:exit try | bun! cat | clo! | endt cal s:unmarksigns() @@ -908,7 +908,7 @@ endf fu! s:PrtExit() if bufnr('%') == s:bufnr && bufname('%') == 'ControlP' - noa cal s:Close() + noa cal s:Close(1) noa winc p en endf @@ -1754,7 +1754,7 @@ fu! ctrlp#syntax() en sy match CtrlPNoEntries '^ == NO ENTRIES ==$' if hlexists('CtrlPLinePre') - sy match CtrlPLinePre '^>' + exe "sy match CtrlPLinePre '^".escape(get(g:, 'ctrlp_line_prefix', '>'),'^$.*~\')."'" en if s:itemtype == 1 && s:has_conceal @@ -1941,7 +1941,7 @@ fu! s:isabs(path) endf fu! s:bufnrfilpath(line) - if s:isabs(a:line) || a:line =~ '^\~[/\\]' + if s:isabs(a:line) || a:line =~ '^\~[/\\]' || a:line =~ '^\w\+:\/\/' let filpath = a:line el let filpath = s:dyncwd.s:lash().a:line @@ -1956,9 +1956,10 @@ fu! s:bufnrfilpath(line) endf fu! ctrlp#normcmd(cmd, ...) + let buftypes = [ 'quickfix', 'help' ] if a:0 < 2 && s:nosplit() | retu a:cmd | en let norwins = filter(range(1, winnr('$')), - \ 'empty(getbufvar(winbufnr(v:val), "&bt")) || s:isneovimterminal(winbufnr(v:val))') + \ 'index(buftypes, getbufvar(winbufnr(v:val), "&bt")) == -1 || s:isneovimterminal(winbufnr(v:val))') for each in norwins let bufnr = winbufnr(each) if empty(bufname(bufnr)) && empty(getbufvar(bufnr, '&ft')) @@ -2533,7 +2534,7 @@ if has('autocmd') aug CtrlPAug au! au BufEnter ControlP cal s:checkbuf() - au BufLeave ControlP noa cal s:Close() + au BufLeave ControlP noa cal s:Close(0) au VimLeavePre * cal s:leavepre() aug END en diff --git a/sources_non_forked/lightline.vim/README.md b/sources_non_forked/lightline.vim/README.md index 4b0a2b42..03f5da1b 100644 --- a/sources_non_forked/lightline.vim/README.md +++ b/sources_non_forked/lightline.vim/README.md @@ -520,8 +520,8 @@ Oops! We forgot the cool mark for the branch component! (work with the patched f ```vim function! LightLineFugitive() if exists("*fugitive#head") - let _ = fugitive#head() - return _ !=# '' ? '⭠ '._ : '' + let branch = fugitive#head() + return branch !=# '' ? '⭠ '.branch : '' endif return '' endfunction @@ -596,8 +596,8 @@ endfunction function! LightLineFugitive() if &ft !~? 'vimfiler\|gundo' && exists("*fugitive#head") - let _ = fugitive#head() - return _ !=# '' ? '⭠ '._ : '' + let branch = fugitive#head() + return branch !=# '' ? '⭠ '.branch : '' endif return '' endfunction @@ -691,8 +691,8 @@ function! LightLineFugitive() try if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head') let mark = '' " edit here for cool mark - let _ = fugitive#head() - return _ !=# '' ? mark._ : '' + let branch = fugitive#head() + return branch !=# '' ? mark.branch : '' endif catch endtry diff --git a/sources_non_forked/lightline.vim/autoload/lightline.vim b/sources_non_forked/lightline.vim/autoload/lightline.vim index 5fbc5b5f..769fa7d9 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline.vim @@ -2,7 +2,7 @@ " Filename: autoload/lightline.vim " Author: itchyny " License: MIT License -" Last Change: 2016/05/14 13:20:45. +" Last Change: 2016/06/11 14:05:27. " ============================================================================= let s:save_cpo = &cpo @@ -276,7 +276,7 @@ function! lightline#highlight(...) abort let rs = has_key(get(c, d, {}), 'right') ? c[d].right : has_key(f, d) && has_key(get(c, f[d], {}), 'right') ? c[f[d]].right : c.normal.right for [p, l, zs] in [['Left', len(left), ls], ['Right', len(right), rs]] for [i, t] in map(range(0, l), '[v:val, 0]') + types - if i != l + if i < l || i < 1 let r = t ? (has_key(get(c, d, []), i) ? c[d][i][0] : has_key(get(c, 'tabline', {}), i) ? c.tabline[i][0] : get(c.normal, i, zs)[0]) : get(zs, i, ms) exec printf('hi LightLine%s_%s_%s guifg=%s guibg=%s ctermfg=%s ctermbg=%s %s', p, mode, i, r[0], r[1], r[2], r[3], s:term(r)) endif diff --git a/sources_non_forked/lightline.vim/doc/lightline.txt b/sources_non_forked/lightline.vim/doc/lightline.txt index 541e23c3..99367251 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/08 13:56:19. +Last Change: 2016/05/26 21:57:34. CONTENTS *lightline-contents* @@ -175,14 +175,18 @@ OPTIONS *lightline-option* |g:lightline.component_expand|. The types are used to specify the color. Specifically, the type raw is used to specify a component which should not be wrapped by item group: %(...%). -> + The default value is: > + let g:lightline.component_type = { \ 'tabs': 'tabsel', \ 'close': 'raw' } < g:lightline.tab_component *g:lightline.tab_component* A dictionary for components in one tab. + The default value is: > + let g:lightline.tab_component = {} +< g:lightline.tab_component_function *g:lightline.tab_component_function* Another dictionary for components in one tab. A function specified as a tab component takes one argument: @@ -286,8 +290,8 @@ nice. endfunction function! LightLineFugitive() if exists('*fugitive#head') - let _ = fugitive#head() - return _ !=# '' ? ''._ : '' + let branch = fugitive#head() + return branch !=# '' ? ''.branch : '' endif return '' endfunction @@ -311,8 +315,8 @@ look nice. endfunction function! LightLineFugitive() if exists('*fugitive#head') - let _ = fugitive#head() - return _ !=# '' ? '⭠ '._ : '' + let branch = fugitive#head() + return branch !=# '' ? '⭠ '.branch : '' endif return '' endfunction @@ -337,7 +341,7 @@ Exposed functions for lightline.vim. Returns the mode of the Vim using |g:lightline.mode_map|. lightline#init() *lightline#init()* - Initializes the variable |g:lightline|. + Initializes the internal state from |g:lightline|. lightline#colorscheme() *lightline#colorscheme()* Initializes the colorscheme and the highlight groups. @@ -741,8 +745,8 @@ A nice example for |vim-powerline| font users: endfunction function! LightLineFugitive() if &ft !~? 'vimfiler' && exists('*fugitive#head') - let _ = fugitive#head() - return _ !=# '' ? '⭠ '._ : '' + let branch = fugitive#head() + return branch !=# '' ? '⭠ '.branch : '' endif return '' endfunction @@ -802,8 +806,8 @@ For users who uses lots of plugins: try if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head') let mark = '' " edit here for cool mark - let _ = fugitive#head() - return _ !=# '' ? mark._ : '' + let branch = fugitive#head() + return branch !=# '' ? mark.branch : '' endif catch endtry diff --git a/sources_non_forked/lightline.vim/test/highlight.vim b/sources_non_forked/lightline.vim/test/highlight.vim index a72ed1eb..fe5182a3 100644 --- a/sources_non_forked/lightline.vim/test/highlight.vim +++ b/sources_non_forked/lightline.vim/test/highlight.vim @@ -3,9 +3,6 @@ let s:assert = themis#helper('assert') function! s:suite.before_each() hi clear - let g:lightline = {} - call lightline#init() - call lightline#colorscheme() endfunction function! s:hi(name) @@ -22,6 +19,9 @@ function! s:pattern(xs, ...) abort endfunction function! s:suite.highlight() + let g:lightline = {} + call lightline#init() + call lightline#colorscheme() let palette = lightline#palette() call s:assert.match(s:hi('LightLineLeft_normal_0'), s:pattern(palette.normal.left[0])) call s:assert.match(s:hi('LightLineLeft_normal_1'), s:pattern(palette.normal.left[1])) @@ -34,6 +34,9 @@ function! s:suite.highlight() endfunction function! s:suite.insert() + let g:lightline = {} + call lightline#init() + call lightline#colorscheme() call lightline#highlight('insert') let palette = lightline#palette() call s:assert.match(s:hi('LightLineLeft_insert_0'), s:pattern(palette.insert.left[0])) @@ -48,6 +51,9 @@ endfunction function! s:suite.visual() + let g:lightline = {} + call lightline#init() + call lightline#colorscheme() call lightline#highlight('visual') let palette = lightline#palette() call s:assert.match(s:hi('LightLineLeft_visual_0'), s:pattern(palette.visual.left[0])) @@ -61,6 +67,9 @@ function! s:suite.visual() endfunction function! s:suite.replace() + let g:lightline = {} + call lightline#init() + call lightline#colorscheme() call lightline#highlight('replace') let palette = lightline#palette() call s:assert.match(s:hi('LightLineLeft_replace_0'), s:pattern(palette.replace.left[0])) @@ -97,6 +106,27 @@ function! s:suite.left_right() call s:assert.match(s:hi('LightLineMiddle_normal'), s:pattern(palette.normal.middle[0])) endfunction +function! s:suite.no_components() + let g:lightline = { + \ 'active': { + \ 'left': [], + \ 'right': [] + \ }, + \ 'inactive': { + \ 'left': [], + \ 'right': [] + \ }, + \ } + call lightline#init() + call lightline#colorscheme() + let palette = lightline#palette() + call s:assert.match(s:hi('LightLineLeft_normal_0'), s:pattern(palette.normal.left[0])) + call s:assert.match(s:hi('LightLineLeft_normal_1'), 'E411: highlight group not found\|cleared') + call s:assert.match(s:hi('LightLineRight_normal_0'), s:pattern(palette.normal.right[0])) + call s:assert.match(s:hi('LightLineRight_normal_1'), 'E411: highlight group not found\|cleared') + call s:assert.match(s:hi('LightLineMiddle_normal'), s:pattern(palette.normal.middle[0])) +endfunction + function! s:suite.subseparator() let g:lightline = { \ 'active': { diff --git a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim index 05f03c96..0912faff 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim @@ -280,7 +280,7 @@ function! s:findAndRevealPath() else call g:NERDTree.CursorToTreeWin() endif - call b:NERDTree.setShowHidden(g:NERDTreeShowHidden) + call b:NERDTree.ui.setShowHidden(g:NERDTreeShowHidden) call s:chRoot(g:NERDTreeDirNode.New(p.getParent(), b:NERDTree)) else if !g:NERDTree.IsOpen() diff --git a/sources_non_forked/syntastic/autoload/syntastic/util.vim b/sources_non_forked/syntastic/autoload/syntastic/util.vim index 87b0b5f9..68eb06ea 100644 --- a/sources_non_forked/syntastic/autoload/syntastic/util.vim +++ b/sources_non_forked/syntastic/autoload/syntastic/util.vim @@ -37,13 +37,19 @@ function! syntastic#util#system(command) abort " {{{2 let $LC_MESSAGES = 'C' let $LC_ALL = '' + let cmd_start = reltime() let out = system(a:command) + let cmd_time = split(reltimestr(reltime(cmd_start)))[0] let $LC_ALL = old_lc_all let $LC_MESSAGES = old_lc_messages let &shell = old_shell + if exists('g:_SYNTASTIC_DEBUG_TRACE') + call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'system: command run in ' . cmd_time . 's') + endif + return out endfunction " }}}2 diff --git a/sources_non_forked/syntastic/plugin/syntastic.vim b/sources_non_forked/syntastic/plugin/syntastic.vim index 9a7dffe6..2379f75a 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-137' +let g:_SYNTASTIC_VERSION = '3.7.0-144' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1 @@ -522,7 +522,7 @@ function! SyntasticMake(options) abort " {{{2 let env_save = {} if has_key(a:options, 'env') && len(a:options['env']) for key in keys(a:options['env']) - if key =~? '\m^[a-z_]\+$' + if key =~? '\m^[a-z_][a-z0-9_]*$' execute 'let env_save[' . string(key) . '] = $' . key execute 'let $' . key . ' = ' . string(a:options['env'][key]) endif diff --git a/sources_non_forked/syntastic/plugin/syntastic/checker.vim b/sources_non_forked/syntastic/plugin/syntastic/checker.vim index 6569da62..22ad8205 100644 --- a/sources_non_forked/syntastic/plugin/syntastic/checker.vim +++ b/sources_non_forked/syntastic/plugin/syntastic/checker.vim @@ -91,6 +91,7 @@ function! g:SyntasticChecker.getExecEscaped() abort " {{{2 endfunction " }}}2 function! g:SyntasticChecker.getLocListRaw() abort " {{{2 + let checker_start = reltime() let name = self._filetype . '/' . self._name if has_key(self, '_enable') @@ -128,6 +129,8 @@ function! g:SyntasticChecker.getLocListRaw() abort " {{{2 call self._populateHighlightRegexes(list) call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, name . ' raw:', list) call self._quietMessages(list) + call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, + \ 'getLocList: checker ' . name . ' run in ' . split(reltimestr(reltime(checker_start)))[0] . 's') return list endfunction " }}}2 diff --git a/sources_non_forked/syntastic/syntax_checkers/ansible/ansible_lint.vim b/sources_non_forked/syntastic/syntax_checkers/ansible/ansible_lint.vim index b09e7eb3..fe62581c 100644 --- a/sources_non_forked/syntastic/syntax_checkers/ansible/ansible_lint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/ansible/ansible_lint.vim @@ -28,7 +28,9 @@ endfunction function! SyntaxCheckers_ansible_ansible_lint_GetLocList() dict let makeprg = self.makeprgBuild({ 'args_after': '-p' }) - let errorformat = '%f:%l: [ANSIBLE%n] %m' + let errorformat = + \ '%f:%l: [EANSIBLE%n] %m,' . + \ '%f:%l: [ANSIBLE%n] %m' let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' } diff --git a/sources_non_forked/syntastic/syntax_checkers/cuda/nvcc.vim b/sources_non_forked/syntastic/syntax_checkers/cuda/nvcc.vim index 7cd0da31..34760390 100644 --- a/sources_non_forked/syntastic/syntax_checkers/cuda/nvcc.vim +++ b/sources_non_forked/syntastic/syntax_checkers/cuda/nvcc.vim @@ -10,19 +10,41 @@ if exists('g:loaded_syntastic_cuda_nvcc_checker') endif let g:loaded_syntastic_cuda_nvcc_checker = 1 +if !exists('g:syntastic_cuda_config_file') + let g:syntastic_cuda_config_file = '.syntastic_cuda_config' +endif + let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_cuda_nvcc_GetLocList() dict - if syntastic#util#var('cuda_arch') !=# '' - let arch_flag = '-arch=' . g:syntastic_cuda_arch - else - let arch_flag = '' + let arch_flag = syntastic#util#var('cuda_arch') + if arch_flag !=# '' + let arch_flag = '-arch=' . arch_flag + call syntastic#log#oneTimeWarn('variable g:syntastic_cuda_arch is deprecated, ' . + \ 'please add ' . string(arch_flag) . ' to g:syntastic_cuda_nvcc_args instead') endif - let makeprg = - \ self.getExecEscaped() . ' ' . arch_flag . - \ ' --cuda -O0 -I . -Xcompiler -fsyntax-only ' . - \ syntastic#util#shexpand('%') . ' ' . syntastic#c#NullOutput() + + let build_opts = {} + let dummy = '' + if index(['h', 'hpp', 'cuh'], expand('%:e', 1), 0, 1) >= 0 + if syntastic#util#var('cuda_check_header', 0) + let dummy = expand('%:p:h', 1) . syntastic#util#Slash() . '.syntastic_dummy.cu' + let build_opts = { + \ 'exe_before': 'echo > ' . syntastic#util#shescape(dummy) . ' ;', + \ 'fname_before': '.syntastic_dummy.cu -include' } + else + return [] + endif + endif + + call extend(build_opts, { + \ 'args_before': arch_flag . ' --cuda -O0 -I .', + \ 'args': syntastic#c#ReadConfig(g:syntastic_cuda_config_file), + \ 'args_after': '-Xcompiler -fsyntax-only', + \ 'tail_after': syntastic#c#NullOutput() }) + + let makeprg = self.makeprgBuild(build_opts) let errorformat = \ '%*[^"]"%f"%*\D%l: %m,'. @@ -40,19 +62,13 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() dict \ '%DMaking %*\a in %f,'. \ '%f|%l| %m' - if index(['h', 'hpp', 'cuh'], expand('%:e', 1), 0, 1) >= 0 - if syntastic#util#var('cuda_check_header', 0) - let makeprg = - \ 'echo > .syntastic_dummy.cu ; ' . - \ self.getExecEscaped() . ' ' . arch_flag . - \ ' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include ' . - \ syntastic#util#shexpand('%') . ' ' . syntastic#c#NullOutput() - else - return [] - endif + let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + if dummy !=# '' + call delete(dummy) endif - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/sources_non_forked/syntastic/syntax_checkers/html/eslint.vim b/sources_non_forked/syntastic/syntax_checkers/html/eslint.vim new file mode 100644 index 00000000..3e91931c --- /dev/null +++ b/sources_non_forked/syntastic/syntax_checkers/html/eslint.vim @@ -0,0 +1,23 @@ +"============================================================================ +"File: eslint.vim +"Description: Syntax checking plugin for syntastic +"Maintainer: LCD 47 +"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_html_eslint_checker') + finish +endif +let g:loaded_syntastic_html_eslint_checker = 1 + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'html', + \ 'name': 'eslint', + \ 'redirect': 'javascript/eslint'}) + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/syntastic/syntax_checkers/racket/racket.vim b/sources_non_forked/syntastic/syntax_checkers/racket/racket.vim index 59327c99..b563a5b0 100644 --- a/sources_non_forked/syntastic/syntax_checkers/racket/racket.vim +++ b/sources_non_forked/syntastic/syntax_checkers/racket/racket.vim @@ -42,7 +42,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'racket', - \ 'name': 'racket'}) + \ 'name': 'racket', + \ 'enable': 'enable_racket_racket_checker' }) let &cpo = s:save_cpo unlet s:save_cpo diff --git a/sources_non_forked/vim-go/CHANGELOG.md b/sources_non_forked/vim-go/CHANGELOG.md index 0db8d09f..61b46cd9 100644 --- a/sources_non_forked/vim-go/CHANGELOG.md +++ b/sources_non_forked/vim-go/CHANGELOG.md @@ -1,25 +1,57 @@ -## 1.7 (unreleased) +## 1.8 (unplanned) + +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] + + +BUG FIXES: + +* Escape `#` characters when opening URL's, as it's handled as alternative file in vim [gh-895] +* Fix typos in `doc/vim-go.txt` about usages of syntax highglightings [gh-897] + +## 1.7.1 (June 7, 2016) + +BUG FIXES: +* Fixed typo in `syntax/go.vim` file from `go:go_highlight_fields` to `g:go_highlight_fields` + +## 1.7 (June 7, 2016) FEATURES: * New **`:GoImpl`** command that generates method stubs for implementing an interface. Checkout the [demo](https://twitter.com/fatih/status/729991365581545472) to see how it works. [gh-846] +* `godef` support is added back as an optional setting. By default `:GoDef` still uses `guru`, but can be changed to `godef` by adding the option: `let g:go_def_mode = 'godef'` [gh-888] * New `` and `]>` shortcuts to split current window and jumpt to the identifier under cursor. [gh-838] +* New syntax setting" `g:go_highlight_fields` that highlights struct field references [gh-854] IMPROVEMENTS: +* Invoking `:GoRename` now reloads all files to reflect new changes automatically [gh-855] +* Calling `:GoTestCompile` does not create any temporary binary file anymore [gh-879] * Enable passing the `-tags` flag to `:GoDef`. Now you can pass build tags to `:GoDef` via `:GoGuruTags` or `g:go_guru_tags` * Internal refactoring to use custom `system()` function that wraps both the standard `system()` call and `vimproc`. Now all system calls will take advantage and will use `vimproc` if installed. [gh-801] +* Completion enables now `gocode`'s `autobuild` and `propose-builtins` flags automatically. With these settings packages will be automatically build to get the freshest completion candidates and builtin keywords will be showed as well. By defaults these settings are enabled. Settings can be disabled/enabled via `g:go_gocode_autobuild` and `g:go_gocode_propose_builtins`. [gh-815] * Added new `http.HandlerFunc` snippets with `hf` and `hhf` shortcuts [gh-816] * Added new `Example` and `Benchmark` snippets with `example` and `benchmark` shortcuts [gh-836] * Search tool binaries first in `GOBIN` and then in `PATH` as most of vim-go users installs it to `GOBIN` mostly [gh-823] +* Improve `guru` based commands by providing automatically detected GOPATHS, such as `gb`, `godep` to be used if possible [gh-861] +* Add `(go-imports)` mapping to make it assignable to other keys [gh-878] +* Increase compatibility with tcsh [gh-869] +* Improve `:GoInstallBinaries` for GOPATH's which don't have packages that work well with `go get -u`. We have a new `g:go_get_update` setting to disable it. By default it's enabled. [gh-883] + + BUG FIXES: * Fix `(go-freevars)` plug mapping to work as in visual mode instead of noncompatible normal mode [gh-832] * Commands based on guru now shows a more meaningful error message instead of just showing the exit status (-1) * Fix `:GoCoverage` accidently enabling syntax highlighting for users who don't use syntax (i.e syntax off) [gh-827] +* Fix `:GoCoverage` colors to work for xterm as well [gh-863] * Fix commenting out block of texts for Go templates (filetype gothtmltmpl) [gh-813] * Fix `:GoImplements` failing because of an empty scope definition. Now we default to current package to make it usable. * Fix `:GoPlay` posting to non HTTPS url. [gh-847] +* Fix escaping the filenames for lint and motion commands [gh-862] +* Fix escaping the filename to `:GoDef` completely for tcsh [gh-868] +* Fix showing SUCCESS for `go test` related commands if no test files are available [gh-859] diff --git a/sources_non_forked/vim-go/README.md b/sources_non_forked/vim-go/README.md index aaf9e4ab..e8dc40a5 100644 --- a/sources_non_forked/vim-go/README.md +++ b/sources_non_forked/vim-go/README.md @@ -52,7 +52,7 @@ disabled/enabled easily. ## Install -Master branch is supposed to be a development branch. So stuff here can break and change. +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 @@ -180,6 +180,7 @@ To change it: ```vim let g:go_highlight_functions = 1 let g:go_highlight_methods = 1 +let g:go_highlight_fields = 1 let g:go_highlight_structs = 1 let g:go_highlight_interfaces = 1 let g:go_highlight_operators = 1 @@ -218,6 +219,11 @@ let g:go_bin_path = expand("~/.gotools") let g:go_bin_path = "/home/fatih/.mypath" "or give absolute path ``` +Disable updating dependencies when installing/updating binaries: +```vim +let g:go_get_update = 0 +``` + ### Using with Neovim (beta) Note: Neovim currently is not a first class citizen for vim-go. You are free diff --git a/sources_non_forked/vim-go/autoload/go/cmd.vim b/sources_non_forked/vim-go/autoload/go/cmd.vim index 5efb5967..b31466a2 100644 --- a/sources_non_forked/vim-go/autoload/go/cmd.vim +++ b/sources_non_forked/vim-go/autoload/go/cmd.vim @@ -191,12 +191,14 @@ function! go#cmd#Test(bang, compile, ...) " don't run the test, only compile it. Useful to capture and fix errors or " to create a test binary. if a:compile - call add(args, "-c") + let compile_file = "vim-go-test-compile" + call extend(args, ["-c", "-o", compile_file]) endif if a:0 " expand all wildcards(i.e: '%' to the current file name) let goargs = map(copy(a:000), "expand(v:val)") + let goargs = go#util#Shelllist(goargs, 1) call extend(args, goargs, 1) else @@ -217,6 +219,11 @@ function! go#cmd#Test(bang, compile, ...) else let id = go#jobcontrol#Spawn(a:bang, "test", args) endif + + if a:compile + call go#jobcontrol#AddHandler(function('s:test_compile_handler')) + let s:test_compile_handlers[id] = compile_file + endif return id endif @@ -229,6 +236,10 @@ function! go#cmd#Test(bang, compile, ...) let l:listtype = "quickfix" + if a:compile + call delete(compile_file) + endif + if go#util#ShellError() != 0 let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' let dir = getcwd() @@ -332,4 +343,19 @@ function! go#cmd#Generate(bang, ...) let $GOPATH = old_gopath endfunction + +" ----------------------- +" | Neovim job handlers | +" ----------------------- +let s:test_compile_handlers = {} + +function! s:test_compile_handler(job, exit_status, data) + if !has_key(s:test_compile_handlers, a:job.id) + return + endif + let l:compile_file = s:test_compile_handlers[a:job.id] + call delete(l:compile_file) + unlet s:test_compile_handlers[a:job.id] +endfunction + " vim:ts=4:sw=4:et diff --git a/sources_non_forked/vim-go/autoload/go/complete.vim b/sources_non_forked/vim-go/autoload/go/complete.vim index 5582f311..d7a66be5 100644 --- a/sources_non_forked/vim-go/autoload/go/complete.vim +++ b/sources_non_forked/vim-go/autoload/go/complete.vim @@ -1,9 +1,4 @@ -if !exists("g:go_gocode_bin") - let g:go_gocode_bin = "gocode" -endif - - -fu! s:gocodeCurrentBuffer() +function! s:gocodeCurrentBuffer() let buf = getline(1, '$') if &encoding != 'utf-8' let buf = map(buf, 'iconv(v:val, &encoding, "utf-8")') @@ -17,9 +12,9 @@ fu! s:gocodeCurrentBuffer() call writefile(buf, file) return file -endf +endfunction -fu! s:gocodeCommand(cmd, preargs, args) +function! s:gocodeCommand(cmd, preargs, args) for i in range(0, len(a:args) - 1) let a:args[i] = go#util#Shellescape(a:args[i]) endfor @@ -27,7 +22,7 @@ fu! s:gocodeCommand(cmd, preargs, args) let a:preargs[i] = go#util#Shellescape(a:preargs[i]) endfor - let bin_path = go#path#CheckBinPath(g:go_gocode_bin) + let bin_path = go#path#CheckBinPath("gocode") if empty(bin_path) return endif @@ -49,20 +44,43 @@ fu! s:gocodeCommand(cmd, preargs, args) endif return result endif -endf +endfunction -fu! s:gocodeCurrentBufferOpt(filename) +function! s:gocodeCurrentBufferOpt(filename) return '-in=' . a:filename -endf +endfunction + +let s:optionsEnabled = 0 +function! s:gocodeEnableOptions() + if s:optionsEnabled + return + endif + + let bin_path = go#path#CheckBinPath("gocode") + if empty(bin_path) + return + endif + + let s:optionsEnabled = 1 + + call go#util#System(printf('%s set propose-builtins %s', go#util#Shellescape(bin_path), s:toBool(get(g:, 'go_gocode_propose_builtins', 1)))) + call go#util#System(printf('%s set autobuild %s', go#util#Shellescape(bin_path), s:toBool(get(g:, 'go_gocode_autobuild', 1)))) +endfunction + +function! s:toBool(val) + if a:val | return 'true ' | else | return 'false' | endif +endfunction + +function! s:gocodeAutocomplete() + call s:gocodeEnableOptions() -fu! s:gocodeAutocomplete() let filename = s:gocodeCurrentBuffer() let result = s:gocodeCommand('autocomplete', \ [s:gocodeCurrentBufferOpt(filename), '-f=vim'], \ [expand('%:p'), go#util#OffsetCursor()]) call delete(filename) return result -endf +endfunction function! go#complete#GetInfo() let offset = go#util#OffsetCursor()+1 @@ -120,7 +138,7 @@ function! s:trim_bracket(val) return a:val endfunction -fu! go#complete#Complete(findstart, base) +function! go#complete#Complete(findstart, base) "findstart = 1 when we need to get the text length if a:findstart == 1 execute "silent let g:gocomplete_completions = " . s:gocodeAutocomplete() diff --git a/sources_non_forked/vim-go/autoload/go/coverage.vim b/sources_non_forked/vim-go/autoload/go/coverage.vim index 46467618..2a45e523 100644 --- a/sources_non_forked/vim-go/autoload/go/coverage.vim +++ b/sources_non_forked/vim-go/autoload/go/coverage.vim @@ -28,6 +28,19 @@ function! go#coverage#Buffer(bang, ...) return -1 endif + " check if there is any test file, if not we just return + let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' + let dir = getcwd() + try + execute cd . fnameescape(expand("%:p:h")) + if empty(glob("*_test.go")) + call go#util#EchoError("no tests files available") + return + endif + finally + execute cd . fnameescape(dir) + endtry + let s:toggle = 1 let l:tmpname = tempname() let args = [a:bang, 0, "-coverprofile", l:tmpname] @@ -221,9 +234,9 @@ function! go#coverage#overlay(file) endfor syntax manual - highlight normaltext term=bold ctermfg=59 guifg=#75715E - highlight covered term=bold ctermfg=118 guifg=#A6E22E - highlight uncover term=bold ctermfg=197 guifg=#F92672 + 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 f3f3ad8c..323fa69d 100644 --- a/sources_non_forked/vim-go/autoload/go/def.vim +++ b/sources_non_forked/vim-go/autoload/go/def.vim @@ -2,201 +2,227 @@ let s:go_stack = [] let s:go_stack_level = 0 function! go#def#Jump(mode) - let bin_path = go#path#CheckBinPath("guru") - if empty(bin_path) - return - endif + let old_gopath = $GOPATH + let $GOPATH = go#path#Detect() - let old_gopath = $GOPATH - let $GOPATH = go#path#Detect() + let fname = fnamemodify(expand("%"), ':p:gs?\\?/?') - let flags = "" - if exists('g:go_guru_tags') - let tags = get(g:, 'go_guru_tags') - let flags = printf(" -tags %s", tags) - 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 + " times I've decided to support both. By default we still use guru as it + " 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' + let bin_path = go#path#CheckBinPath("godef") + if empty(bin_path) + let $GOPATH = old_gopath + return + endif + let command = printf("%s -f=%s -o=%s -t", bin_path, fname, go#util#OffsetCursor()) + let out = go#util#System(command) - let fname = fnamemodify(expand("%"), ':p:gs?\\?/?') - let command = printf("%s %s definition %s:#%s", bin_path, flags, shellescape(fname), go#util#OffsetCursor()) + " append the type information to the same line so our + " jump_to_declaration() function can parse it. This makes it + " compatible with guru definition as well too + let out = join(split(out, '\n'), ':') + elseif bin_name == 'guru' + let bin_path = go#path#CheckBinPath("guru") + if empty(bin_path) + let $GOPATH = old_gopath + return + endif - let out = go#util#System(command) - if go#util#ShellError() != 0 - call go#util#EchoError(out) - return - endif + let flags = "" + if exists('g:go_guru_tags') + let tags = get(g:, 'go_guru_tags') + let flags = printf(" -tags %s", tags) + endif - call s:jump_to_declaration(out, a:mode) - let $GOPATH = old_gopath + let fname = shellescape(fname.':#'.go#util#OffsetCursor()) + let command = printf("%s %s definition %s", bin_path, flags, fname) + let out = go#util#System(command) + else + call go#util#EchoError('go_def_mode value: '. bin_name .' is not valid. Valid values are: [godef, guru]') + return + endif + + if go#util#ShellError() != 0 + call go#util#EchoError(out) + return + endif + + call s:jump_to_declaration(out, a:mode) + let $GOPATH = old_gopath endfunction function! s:jump_to_declaration(out, mode) - " strip line ending - let out = split(a:out, go#util#LineEnding())[0] - if go#util#IsWin() - let parts = split(out, '\(^[a-zA-Z]\)\@,:navigate :jump ,q:exit'] + let stackOut = ['" ,:navigate :jump ,q:exit'] - let i = 0 - while i < len(s:go_stack) - let entry = s:go_stack[i] - let prefix = "" + let i = 0 + while i < len(s:go_stack) + let entry = s:go_stack[i] + let prefix = "" - if i == s:go_stack_level - let prefix = ">" - else - let prefix = " " - endif + if i == s:go_stack_level + let prefix = ">" + else + let prefix = " " + endif - call add(stackOut, printf("%s %d %s|%d col %d|%s", - \ prefix, i+1, entry["file"], entry["line"], entry["col"], entry["ident"])) - let i += 1 - endwhile + call add(stackOut, printf("%s %d %s|%d col %d|%s", + \ prefix, i+1, entry["file"], entry["line"], entry["col"], entry["ident"])) + let i += 1 + endwhile - if s:go_stack_level == i - call add(stackOut, "> ") - endif + if s:go_stack_level == i + call add(stackOut, "> ") + endif - call go#ui#OpenWindow("GoDef Stack", stackOut, "godefstack") + call go#ui#OpenWindow("GoDef Stack", stackOut, "godefstack") - noremap :call go#def#SelectStackEntry() - noremap :call go#ui#CloseWindow() - noremap q :call go#ui#CloseWindow() + noremap :call go#def#SelectStackEntry() + noremap :call go#ui#CloseWindow() + noremap q :call go#ui#CloseWindow() endfunction function! go#def#StackClear(...) - let s:go_stack = [] - let s:go_stack_level = 0 + let s:go_stack = [] + let s:go_stack_level = 0 endfunction function! go#def#StackPop(...) - if len(s:go_stack) == 0 - call go#util#EchoError("godef stack empty") - return - endif + if len(s:go_stack) == 0 + call go#util#EchoError("godef stack empty") + return + endif - if s:go_stack_level == 0 - call go#util#EchoError("at bottom of the godef stack") - return - endif + if s:go_stack_level == 0 + call go#util#EchoError("at bottom of the godef stack") + return + endif - if !len(a:000) - let numPop = 1 - else - let numPop = a:1 - endif + if !len(a:000) + let numPop = 1 + else + let numPop = a:1 + endif - let newLevel = str2nr(s:go_stack_level) - str2nr(numPop) - call go#def#Stack(newLevel + 1) + let newLevel = str2nr(s:go_stack_level) - str2nr(numPop) + call go#def#Stack(newLevel + 1) endfunction function! go#def#Stack(...) - if len(s:go_stack) == 0 - call go#util#EchoError("godef stack empty") - return - endif + if len(s:go_stack) == 0 + call go#util#EchoError("godef stack empty") + return + endif - if !len(a:000) - " Display interactive stack - call go#def#StackUI() - return - else - let jumpTarget = a:1 - endif + if !len(a:000) + " Display interactive stack + call go#def#StackUI() + return + else + let jumpTarget = a:1 + endif - if jumpTarget !~ '^\d\+$' - if jumpTarget !~ '^\s*$' - call go#util#EchoError("location must be a number") - endif - return - endif + if jumpTarget !~ '^\d\+$' + if jumpTarget !~ '^\s*$' + call go#util#EchoError("location must be a number") + endif + return + endif - let jumpTarget = str2nr(jumpTarget) - 1 + let jumpTarget = str2nr(jumpTarget) - 1 - if jumpTarget >= 0 && jumpTarget < len(s:go_stack) - let s:go_stack_level = jumpTarget - let target = s:go_stack[s:go_stack_level] + if jumpTarget >= 0 && jumpTarget < len(s:go_stack) + let s:go_stack_level = jumpTarget + let target = s:go_stack[s:go_stack_level] - " jump - exec 'edit '.target["file"] - call cursor(target["line"], target["col"]) - normal! zz - else - call go#util#EchoError("invalid location. Try :GoDefStack to see the list of valid entries") - endif + " jump + exec 'edit '.target["file"] + call cursor(target["line"], target["col"]) + normal! zz + else + call go#util#EchoError("invalid location. Try :GoDefStack to see the list of valid entries") + endif endfunction diff --git a/sources_non_forked/vim-go/autoload/go/doc.vim b/sources_non_forked/vim-go/autoload/go/doc.vim index f64445b8..a380f0aa 100644 --- a/sources_non_forked/vim-go/autoload/go/doc.vim +++ b/sources_non_forked/vim-go/autoload/go/doc.vim @@ -77,17 +77,28 @@ function! go#doc#OpenBrowser(...) endfunction function! go#doc#Open(newmode, mode, ...) - " check if we have 'gogetdoc' and use it automatically - let bin_path = go#path#CheckBinPath('gogetdoc') - if empty(bin_path) - return + if len(a:000) + " check if we have 'godoc' and use it automatically + let bin_path = go#path#CheckBinPath('godoc') + if empty(bin_path) + return + endif + + let command = printf("%s %s", bin_path, join(a:000, ' ')) + else + " check if we have 'gogetdoc' and use it automatically + let bin_path = go#path#CheckBinPath('gogetdoc') + if empty(bin_path) + return + endif + + let offset = go#util#OffsetCursor() + let fname = expand("%:p:gs!\\!/!") + let pos = shellescape(fname.':#'.offset) + + let command = printf("%s -pos %s", bin_path, pos) endif - let offset = go#util#OffsetCursor() - let fname = expand("%:p") - - let command = printf("%s -pos %s:#%s", bin_path, fname, offset) - let out = go#util#System(command) if go#util#ShellError() != 0 call go#util#EchoError(out) @@ -134,6 +145,7 @@ function! s:GodocView(newposition, position, content) call append(0, split(a:content, "\n")) sil $delete _ setlocal nomodifiable + sil normal! gg " close easily with or enter noremap :close diff --git a/sources_non_forked/vim-go/autoload/go/fmt.vim b/sources_non_forked/vim-go/autoload/go/fmt.vim index ad932683..65303c91 100644 --- a/sources_non_forked/vim-go/autoload/go/fmt.vim +++ b/sources_non_forked/vim-go/autoload/go/fmt.vim @@ -87,7 +87,7 @@ function! go#fmt#Format(withGoimport) " get the command first so we can test it let fmt_command = g:go_fmt_command - if a:withGoimport == 1 + if a:withGoimport == 1 let fmt_command = g:go_goimports_bin endif @@ -109,18 +109,15 @@ function! go#fmt#Format(withGoimport) " populate the final command with user based fmt options let command = fmt_command . ' -w ' - if a:withGoimport != 1 + if a:withGoimport != 1 let command = command . g:go_fmt_options endif if fmt_command == "goimports" if !exists('b:goimports_vendor_compatible') - let out = go#util#System("goimports --help") + let out = go#util#System(bin_path . " --help") if out !~ "-srcdir" - echohl WarningMsg - echomsg "vim-go: goimports does not support srcdir." - echomsg " update with: :GoUpdateBinaries" - echohl None + call go#util#EchoWarning("vim-go: goimports does not support srcdir. update with: :GoUpdateBinaries") else let b:goimports_vendor_compatible = 1 endif diff --git a/sources_non_forked/vim-go/autoload/go/guru.vim b/sources_non_forked/vim-go/autoload/go/guru.vim index 09d50a02..72e36b65 100644 --- a/sources_non_forked/vim-go/autoload/go/guru.vim +++ b/sources_non_forked/vim-go/autoload/go/guru.vim @@ -74,7 +74,8 @@ func! s:RunGuru(mode, format, selected, needs_scope) range abort endif " this is our final command - let command .= printf(' %s %s:%s', a:mode, shellescape(filename), pos) + let filename .= ':'.pos + let command .= printf(' %s %s', a:mode, shellescape(filename)) let old_gopath = $GOPATH let $GOPATH = go#path#Detect() diff --git a/sources_non_forked/vim-go/autoload/go/lint.vim b/sources_non_forked/vim-go/autoload/go/lint.vim index 236abb73..34ff7f6f 100644 --- a/sources_non_forked/vim-go/autoload/go/lint.vim +++ b/sources_non_forked/vim-go/autoload/go/lint.vim @@ -24,7 +24,7 @@ endif function! go#lint#Gometa(autosave, ...) abort if a:0 == 0 - let goargs = expand('%:p:h') + let goargs = shellescape(expand('%:p:h')) else let goargs = go#util#Shelljoin(a:000) endif diff --git a/sources_non_forked/vim-go/autoload/go/package.vim b/sources_non_forked/vim-go/autoload/go/package.vim index 9b5c6482..4f756135 100644 --- a/sources_non_forked/vim-go/autoload/go/package.vim +++ b/sources_non_forked/vim-go/autoload/go/package.vim @@ -46,7 +46,7 @@ function! go#package#Paths() let dirs += [s:goroot] endif - let workspaces = split($GOPATH, go#util#PathListSep()) + let workspaces = split(go#path#Detect(), go#util#PathListSep()) if workspaces != [] let dirs += workspaces endif diff --git a/sources_non_forked/vim-go/autoload/go/path.vim b/sources_non_forked/vim-go/autoload/go/path.vim index 48f3269d..8afe8f16 100644 --- a/sources_non_forked/vim-go/autoload/go/path.vim +++ b/sources_non_forked/vim-go/autoload/go/path.vim @@ -151,6 +151,9 @@ function! go#path#CheckBinPath(binpath) " if it's in PATH just return it if executable(binpath) + if v:version == 704 && has('patch235') + let binpath = exepath(binpath) + endif let $PATH = old_path return binpath endif diff --git a/sources_non_forked/vim-go/autoload/go/rename.vim b/sources_non_forked/vim-go/autoload/go/rename.vim index d01795ca..cb92dc9f 100644 --- a/sources_non_forked/vim-go/autoload/go/rename.vim +++ b/sources_non_forked/vim-go/autoload/go/rename.vim @@ -36,6 +36,15 @@ function! go#rename#Rename(bang, ...) let out = go#tool#ExecuteInDir(cmd) + " reload all files to reflect the new changes. We explicitly call + " checktime to trigger a reload of all files. See + " http://www.mail-archive.com/vim@vim.org/msg05900.html for more info + " about the autoread bug + let current_autoread = &autoread + set autoread + silent! checktime + let &autoread = current_autoread + " strip out newline on the end that gorename puts. If we don't remove, it " will trigger the 'Hit ENTER to continue' prompt let clean = split(out, '\n') diff --git a/sources_non_forked/vim-go/autoload/go/textobj.vim b/sources_non_forked/vim-go/autoload/go/textobj.vim index 1901d061..ba1d03ee 100644 --- a/sources_non_forked/vim-go/autoload/go/textobj.vim +++ b/sources_non_forked/vim-go/autoload/go/textobj.vim @@ -16,7 +16,7 @@ endif function! go#textobj#Function(mode) let offset = go#util#OffsetCursor() - let fname = expand("%:p") + let fname = shellescape(expand("%:p")) if &modified " Write current unsaved buffer to a temp file and use the modified content let l:tmpname = tempname() @@ -103,7 +103,7 @@ function! go#textobj#FunctionJump(mode, direction) let offset = go#util#OffsetCursor() - let fname = expand("%:p") + let fname = shellescape(expand("%:p")) if &modified " Write current unsaved buffer to a temp file and use the modified content let l:tmpname = tempname() diff --git a/sources_non_forked/vim-go/autoload/go/tool.vim b/sources_non_forked/vim-go/autoload/go/tool.vim index 85eb9b61..a3c80172 100644 --- a/sources_non_forked/vim-go/autoload/go/tool.vim +++ b/sources_non_forked/vim-go/autoload/go/tool.vim @@ -1,19 +1,21 @@ function! go#tool#Files() if go#util#IsWin() - let command = 'go list -f "{{range $f := .GoFiles}}{{$.Dir}}\{{$f}}{{printf \"\n\"}}{{end}}{{range $f := .CgoFiles}}{{$.Dir}}\{{$f}}{{printf \"\n\"}}{{end}}"' + let format = '{{range $f := .GoFiles}}{{$.Dir}}\{{$f}}{{printf \"\n\"}}{{end}}{{range $f := .CgoFiles}}{{$.Dir}}\{{$f}}{{printf \"\n\"}}{{end}}' else - let command = "go list -f '{{range $f := .GoFiles}}{{$.Dir}}/{{$f}}{{printf \"\\n\"}}{{end}}{{range $f := .CgoFiles}}{{$.Dir}}/{{$f}}{{printf \"\\n\"}}{{end}}'" + let format = "{{range $f := .GoFiles}}{{$.Dir}}/{{$f}}{{printf \"\\n\"}}{{end}}{{range $f := .CgoFiles}}{{$.Dir}}/{{$f}}{{printf \"\\n\"}}{{end}}" endif + let command = 'go list -f '.shellescape(format) let out = go#tool#ExecuteInDir(command) return split(out, '\n') endfunction function! go#tool#Deps() if go#util#IsWin() - let command = 'go list -f "{{range $f := .Deps}}{{$f}}{{printf \"\n\"}}{{end}}"' + let format = '{{range $f := .Deps}}{{$f}}{{printf \"\n\"}}{{end}}' else - let command = "go list -f $'{{range $f := .Deps}}{{$f}}\n{{end}}'" + let format = "{{range $f := .Deps}}{{$f}}\n{{end}}" endif + let command = 'go list -f '.shellescape(format) let out = go#tool#ExecuteInDir(command) return split(out, '\n') endfunction @@ -21,10 +23,11 @@ endfunction function! go#tool#Imports() let imports = {} if go#util#IsWin() - let command = 'go list -f "{{range $f := .Imports}}{{$f}}{{printf \"\n\"}}{{end}}"' + let format = '{{range $f := .Imports}}{{$f}}{{printf \"\n\"}}{{end}}' else - let command = "go list -f $'{{range $f := .Imports}}{{$f}}\n{{end}}'" + let format = "{{range $f := .Imports}}{{$f}}{{printf \"\\n\"}}{{end}}" endif + let command = 'go list -f '.shellescape(format) let out = go#tool#ExecuteInDir(command) if go#util#ShellError() != 0 echo out @@ -32,7 +35,7 @@ function! go#tool#Imports() endif for package_path in split(out, '\n') - let cmd = "go list -f {{.Name}} " . package_path + let cmd = "go list -f '{{.Name}}' " . shellescape(package_path) let package_name = substitute(go#tool#ExecuteInDir(cmd), '\n$', '', '') let imports[package_name] = package_path endfor @@ -168,10 +171,10 @@ function! go#tool#OpenBrowser(url) return endif if cmd =~ '^!' - let cmd = substitute(cmd, '%URL%', '\=shellescape(a:url)', 'g') + let cmd = substitute(cmd, '%URL%', '\=escape(shellescape(a:url),"#")', 'g') silent! exec cmd elseif cmd =~ '^:[A-Z]' - let cmd = substitute(cmd, '%URL%', '\=a:url', 'g') + let cmd = substitute(cmd, '%URL%', '\=escape(a:url,"#")', 'g') exec cmd else let cmd = substitute(cmd, '%URL%', '\=shellescape(a:url)', 'g') diff --git a/sources_non_forked/vim-go/autoload/go/ui.vim b/sources_non_forked/vim-go/autoload/go/ui.vim index a8f4c482..c4f7abe6 100644 --- a/sources_non_forked/vim-go/autoload/go/ui.vim +++ b/sources_non_forked/vim-go/autoload/go/ui.vim @@ -87,7 +87,7 @@ function! go#ui#OpenDefinition(filter) " don't touch our first line or any blank line if curline =~ a:filter || curline =~ "^$" - " supress information about calling this function + " suppress information about calling this function echo "" return endif diff --git a/sources_non_forked/vim-go/doc/vim-go.txt b/sources_non_forked/vim-go/doc/vim-go.txt index e39fdbb0..15279445 100644 --- a/sources_non_forked/vim-go/doc/vim-go.txt +++ b/sources_non_forked/vim-go/doc/vim-go.txt @@ -439,7 +439,8 @@ CTRL-t :GoInstallBinaries Download and Install all necessary Go tool binaries such as `godef`, - `goimports`, `gocode`, etc.. under `g:go_bin_path` + `goimports`, `gocode`, etc.. under `g:go_bin_path`. Set |g:go_get_update| + to disable updating dependencies. *:GoUpdateBinaries* :GoUpdateBinaries @@ -630,6 +631,7 @@ CTRL-t :GoImpl f *Foo io.Writer :GoImpl T io.ReadWriteCloser < + =============================================================================== MAPPINGS *go-mappings* @@ -672,17 +674,14 @@ Calls `go build` for the current package Calls `go generate` for the current package - *(go-info)* Shows type information for the word under the cursor - *(go-install)* Calls `go install` for the current package - *(go-test)* Calls `go test` for the current package @@ -710,6 +709,10 @@ Calls `go test -coverprofile-temp.out` for the current package and shows the coverage annotation. If run agains it acts as a toggle and clears the annotation. + *(go-imports)* + +Calls `goimports` for the current package + *(go-vet)* Calls `go vet` for the current package @@ -834,6 +837,11 @@ Alternates between the implementation and test code in a new horizontal split Alternates between the implementation and test code in a new vertical split + *(go-import)* + +Calls `:GoImport` for the current package + + =============================================================================== TEXT OBJECTS *go-text-objects* @@ -973,6 +981,14 @@ 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'* + +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 +`godef` as it's more faster. Current valid options are: `[guru, godef]` > + + let g:go_def_mode = 'guru' < *'g:go_def_mapping_enabled'* @@ -1028,6 +1044,14 @@ is used. Use "neosnippet" for neosnippet.vim: > let g:go_snippet_engine = "ultisnips" < + *'g:go_get_update'* + +Use this option to disable updating dependencies with |GoInstallBinaries|. By +default this is enabled. +> + let g:go_get_update = 1 +< + *'g:go_guru_scope'* Use this option to define the scope of the analysis to be passed for guru @@ -1098,7 +1122,13 @@ Highlights method names. By default it's disabled. > Highlights struct names. By default it's disabled. > - let g:go_highlight_structs = 0 + let g:go_highlight_structs = 0 +< + *'g:go_highlight_fields'* + +Highlights field names. By default it's disabled. > + + let g:go_highlight_fields = 0 < *'g:go_highlight_interfaces'* @@ -1243,10 +1273,24 @@ By default it is set to edit. *g:go_gorename_prefill* Specifies whether |:GoRename| prefills the new identifier name with the -word under the cursor. By default is is enabled. +word under the cursor. By default it is enabled. > let g:go_gorename_prefill = 1 < + *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 +autocomplete results for them. By default it is enabled. +> + let g:go_gocode_autobuild = 1 +< + *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 =============================================================================== diff --git a/sources_non_forked/vim-go/ftplugin/go/mappings.vim b/sources_non_forked/vim-go/ftplugin/go/mappings.vim index da011fc2..70d56eaa 100644 --- a/sources_non_forked/vim-go/ftplugin/go/mappings.vim +++ b/sources_non_forked/vim-go/ftplugin/go/mappings.vim @@ -33,6 +33,7 @@ nnoremap (go-files) :call go#tool#Files() nnoremap (go-deps) :call go#tool#Deps() nnoremap (go-info) :call go#complete#Info(0) nnoremap (go-import) :call go#import#SwitchImport(1, '', expand(''), '') +nnoremap (go-imports) :call go#fmt#Format(1) nnoremap (go-implements) :call go#guru#Implements(-1) nnoremap (go-callees) :call go#guru#Callees(-1) diff --git a/sources_non_forked/vim-go/gosnippets/snippets/go.snip b/sources_non_forked/vim-go/gosnippets/snippets/go.snip index bb25a352..c24d2750 100644 --- a/sources_non_forked/vim-go/gosnippets/snippets/go.snip +++ b/sources_non_forked/vim-go/gosnippets/snippets/go.snip @@ -307,19 +307,17 @@ abbr if err != nil { t.Fatalf(...) } } # test example snippet example -func Example${1:Method}() { - ${0} - // Output: -} -endsnippet + func Example${1:Method}() { + ${0} + // Output: + } # test benchmark snippet benchmark -func Benchmark${1:Method}(b *testing.B) { - for i := 0; i < b.N; i++ { - ${0} + func Benchmark${1:Method}(b *testing.B) { + for i := 0; i < b.N; i++ { + ${0} + } } -} -endsnippet # variable declaration snippet var abbr var x Type [= ...] diff --git a/sources_non_forked/vim-go/plugin/go.vim b/sources_non_forked/vim-go/plugin/go.vim index f3c23161..779f4e1b 100644 --- a/sources_non_forked/vim-go/plugin/go.vim +++ b/sources_non_forked/vim-go/plugin/go.vim @@ -8,11 +8,12 @@ let g:go_loaded_install = 1 " needed by the user with GoInstallBinaries let s:packages = [ \ "github.com/nsf/gocode", - \ "github.com/alecthomas/gometalinter", + \ "github.com/alecthomas/gometalinter", \ "golang.org/x/tools/cmd/goimports", \ "golang.org/x/tools/cmd/guru", \ "golang.org/x/tools/cmd/gorename", \ "github.com/golang/lint/golint", + \ "github.com/rogpeppe/godef", \ "github.com/kisielk/errcheck", \ "github.com/jstemmer/gotags", \ "github.com/klauspost/asmfmt/cmd/asmfmt", @@ -65,13 +66,16 @@ function! s:GoInstallBinaries(updateBinaries) set noshellslash endif - let cmd = "go get -u -v " + let cmd = "go get -v " + if get(g:, "go_get_update", 1) != 0 + let cmd .= "-u " + endif let s:go_version = matchstr(go#util#System("go version"), '\d.\d.\d') " https://github.com/golang/go/issues/10791 if s:go_version > "1.4.0" && s:go_version < "1.5.0" - let cmd .= "-f " + let cmd .= "-f " endif for pkg in s:packages diff --git a/sources_non_forked/vim-go/syntax/go.vim b/sources_non_forked/vim-go/syntax/go.vim index c381851b..f9cd2cba 100644 --- a/sources_non_forked/vim-go/syntax/go.vim +++ b/sources_non_forked/vim-go/syntax/go.vim @@ -67,6 +67,10 @@ if !exists("g:go_highlight_methods") let g:go_highlight_methods = 0 endif +if !exists("g:go_highlight_fields") + let g:go_highlight_fields = 0 +endif + if !exists("g:go_highlight_structs") let g:go_highlight_structs = 0 endif @@ -308,6 +312,12 @@ if g:go_highlight_methods != 0 endif hi def link goMethod Type +" Fields; +if g:go_highlight_fields != 0 + syn match goField /\(\.\)\@<=\a\+\([\ \n\r\:\)]\)\@=/ +endif +hi def link goField Type + " Structs; if g:go_highlight_structs != 0 syn match goStruct /\(.\)\@<=\w\+\({\)\@=/ diff --git a/sources_non_forked/vim-multiple-cursors/README.md b/sources_non_forked/vim-multiple-cursors/README.md index 95722924..26cb6d02 100644 --- a/sources_non_forked/vim-multiple-cursors/README.md +++ b/sources_non_forked/vim-multiple-cursors/README.md @@ -199,10 +199,21 @@ highlight link multiple_cursors_visual Visual ## FAQ -**Q** CTRL+n doesn't seem to work in gVIM? +#### **Q** CTRL+n doesn't seem to work in gVIM? **A** Try setting `set selection=inclusive` in your `~/.gvimrc` +#### **Q** How can I select `n` keywords with several keystrokes? I have tried `200` which does not work. + +**A** You can use :MultipleCursorsFind keyword. I have this binding in my vimrc: + +```VimL +nnoremap :MultipleCursorsFind / +vnoremap :MultipleCursorsFind / +``` + +This allows one to a) search for the keyword using `*` b) turn search results into cursors with `Alt-j`. + ## Known Issues - Select mode is not implemented diff --git a/sources_non_forked/vim-snipmate/Contributors.md b/sources_non_forked/vim-snipmate/Contributors.md index 0c643486..42064722 100644 --- a/sources_non_forked/vim-snipmate/Contributors.md +++ b/sources_non_forked/vim-snipmate/Contributors.md @@ -14,6 +14,7 @@ additional contributions from: * [asymmetric](https://github.com/asymmetric) * [bpugh](https://github.com/bpugh) * [bruno-](https://github.com/bruno-) +* [CharlesGueunet](https://github.com/CharlesGueunet) * [darkwise](https://github.com/darkwise) * [dreviejo](https://github.com/dreviejo) * [fish-face](https://github.com/fish-face) @@ -40,6 +41,7 @@ additional contributions from: * [redpill](https://github.com/redpill) * [rglassett](http://github.com/rglassett) * [robhudson](https://github.com/robhudson) +* [shinymayhem](https://github.com/shinymayhem) * [Shraymonks](https://github.com/shraymonks) * [sickill](https://github.com/sickill) * [statik](https://github.com/statik) diff --git a/sources_non_forked/vim-snipmate/README.md b/sources_non_forked/vim-snipmate/README.md index e11f4246..b47b56df 100644 --- a/sources_non_forked/vim-snipmate/README.md +++ b/sources_non_forked/vim-snipmate/README.md @@ -87,7 +87,7 @@ languages. For this we provide two options: scope aliases and the `:SnipMateLoadScope` command. Scope aliases simply say "whenever this scope is loaded, also load this other scope: - let g:snipMate = {} + let g:snipMate = get(g:, 'snipMate', {}) " Allow for vimrc re-sourcing let g:snipMate.scope_aliases = {} let g:snipMate.scope_aliases['ruby'] = 'ruby,rails' @@ -98,6 +98,16 @@ does `:SnipMateLoadScope rails` when editing a Rails project for example. ## Release Notes ## +### 0.89 - 2016-05-29 ### + +* Various regex updates to legacy parser +* Addition of double bang syntax to completely remove a snippet from lookup +* Group various SnipMate autocommands +* Support setting 'shiftwidth' to 0 +* Parser now operates linewise, adding some flexibility +* Mirror substitutions are more literal +* Mirror length is calculated correctly when substitutions occur + ### 0.88 - 2015-04-04 ### * Implement simple caching diff --git a/sources_non_forked/vim-snipmate/autoload/snipMate.vim b/sources_non_forked/vim-snipmate/autoload/snipMate.vim index cc98df50..2157eeb1 100644 --- a/sources_non_forked/vim-snipmate/autoload/snipMate.vim +++ b/sources_non_forked/vim-snipmate/autoload/snipMate.vim @@ -28,7 +28,8 @@ function! snipMate#expandSnip(snip, version, col) abort let [snippet, b:snip_state.stops] = snipmate#parse#snippet(a:snip) " Build stop/mirror info let b:snip_state.stop_count = s:build_stops(snippet, b:snip_state.stops, lnum, col, indent) - let snipLines = snipMate#sniplist_str(snippet, b:snip_state.stops) + let snipLines = map(copy(snippet), + \ 'snipMate#sniplist_str(v:val, b:snip_state.stops)') else let snippet = snipmate#legacy#process_snippet(a:snip) let [b:snip_state.stops, b:snip_state.stop_count] = snipmate#legacy#build_stops(snippet, lnum, col - indent, indent) @@ -77,11 +78,11 @@ function! snipMate#expandSnip(snip, version, col) abort endfunction function! snipMate#placeholder_str(num, stops) abort - return snipMate#sniplist_str(a:stops[a:num].placeholder, a:stops)[0] + return snipMate#sniplist_str(a:stops[a:num].placeholder, a:stops) endfunction function! snipMate#sniplist_str(snippet, stops) abort - let lines = [''] + let str = '' let pos = 0 let add_to = 1 let seen_stops = [] @@ -90,110 +91,82 @@ function! snipMate#sniplist_str(snippet, stops) abort let item = a:snippet[pos] if type(item) == type('') - if add_to - let lines[-1] .= item - else - call add(lines, item) - endif - let add_to = 0 + let str .= item elseif type(item) == type([]) - let lines[-1] .= snipMate#placeholder_str(item[0], a:stops) - let add_to = 1 + let str .= snipMate#placeholder_str(item[0], a:stops) endif let pos += 1 unlet item " avoid E706 endwhile - return lines + return str endfunction function! s:build_stops(snippet, stops, lnum, col, indent) abort let stops = a:stops - let line = a:lnum + let lnum = a:lnum let col = a:col - for [id, dict] in items(stops) - for i in dict.instances - if len(i) > 1 && type(i[1]) != type({}) - if !has_key(dict, 'placeholder') - let dict.placeholder = i[1:] - else - unlet i[1:] - endif - endif - endfor - if !has_key(dict, 'placeholder') - let dict.placeholder = [] - let j = 0 - while len(dict.instances[j]) > 1 - let j += 1 - endwhile - call add(dict.instances[j], '') + for line in a:snippet + let col = s:build_loc_info(line, stops, lnum, col, []) + if line isnot line[-1] + let lnum += 1 + let col = a:indent endif - unlet dict.instances endfor - let [line, col] = s:build_loc_info(a:snippet, stops, line, col, a:indent) - " add zero tabstop if it doesn't exist and then link it to the highest stop " number let stops[0] = get(stops, 0, - \ { 'placeholder' : [], 'line' : line, 'col' : col }) + \ { 'placeholder' : [], 'line' : lnum, 'col' : col }) let stop_count = max(keys(stops)) + 2 let stops[stop_count - 1] = stops[0] return stop_count endfunction -function! s:build_loc_info(snippet, stops, line, col, indent) abort +function! s:build_loc_info(snippet, stops, lnum, col, seen_items) abort let stops = a:stops - let line = a:line + let lnum = a:lnum let col = a:col let pos = 0 let in_text = 0 + let seen_items = a:seen_items - while pos < len(a:snippet) - let item = a:snippet[pos] - + for item in a:snippet if type(item) == type('') - if in_text - let line += 1 - let col = a:indent - endif let col += len(item) - let in_text = 1 elseif type(item) == type([]) let id = item[0] - if len(item) > 1 && type(item[1]) != type({}) - let stops[id].line = line - let stops[id].col = col - let [line, col] = s:build_loc_info(item[1:], stops, line, col, a:indent) + let stub = item[-1] + let stub.line = lnum + let stub.col = col + call s:add_update_objects(stub, seen_items) + + if len(item) > 2 && type(item[1]) != type({}) + let col = s:build_loc_info(item[1:-2], stops, lnum, col, seen_items) else - call s:add_mirror(stops, id, line, col, item) let col += len(snipMate#placeholder_str(id, stops)) endif + let in_text = 0 endif - - let pos += 1 unlet item " avoid E706 - endwhile + endfor - return [line, col] + return col endfunction -function! s:add_mirror(stops, id, line, col, item) abort - let stops = a:stops - let item = a:item - let stops[a:id].mirrors = get(stops[a:id], 'mirrors', []) - let mirror = get(a:item, 1, {}) - let mirror.line = a:line - let mirror.col = a:col - call add(stops[a:id].mirrors, mirror) - if len(item) == 1 - call add(item, mirror) - endif +function! s:add_update_objects(object, targets) abort + let targets = a:targets + + for item in targets + let item.update_objects = get(item, 'update_objects', []) + call add(item.update_objects, a:object) + endfor + + call add(targets, a:object) endfunction " reads a .snippets file diff --git a/sources_non_forked/vim-snipmate/autoload/snipmate/jumping.vim b/sources_non_forked/vim-snipmate/autoload/snipmate/jumping.vim index 25db9614..aaf65ab5 100644 --- a/sources_non_forked/vim-snipmate/autoload/snipmate/jumping.vim +++ b/sources_non_forked/vim-snipmate/autoload/snipmate/jumping.vim @@ -113,7 +113,7 @@ function! s:state_update_changes() dict abort return self.remove() endif - call self.update(self.cur_stop, change_len) + call self.update(self.cur_stop, change_len, change_len) if !empty(self.mirrors) call self.update_mirrors(change_len) endif @@ -141,14 +141,37 @@ function! s:state_update_mirrors(change) dict abort endif endfor - call self.update(mirror, changeLen) + if has_key(mirror, 'oldSize') + " recover the old size deduce the endline + let oldSize = mirror.oldSize + else + " first time, we use the intitial size + let oldSize = strlen(newWord) + endif + " Split the line into three parts: the mirror, what's before it, and " what's after it. Then combine them using the new mirror string. " Subtract one to go from column index to byte index + let theline = getline(mirror.line) - let update = strpart(theline, 0, mirror.col - 1) - let update .= substitute(newWord, get(mirror, 'pat', ''), get(mirror, 'sub', ''), get(mirror, 'flags', '')) - let update .= strpart(theline, mirror.col + self.end_col - self.start_col - a:change - 1) + + " part before the current mirror + let beginline = strpart(theline, 0, mirror.col - 1) + + " current mirror transformation, and save size + let wordMirror= substitute(newWord, get(mirror, 'pat', ''), get(mirror, 'sub', ''), get(mirror, 'flags', '')) + let mirror.oldSize = strlen(wordMirror) + + " end of the line, use the oldSize because with the transformation, + " the size of the mirror can be different from those of the snippet + let endline = strpart(theline, mirror.col + oldSize -1) + + " Update other object on the line + call self.update(mirror, changeLen, mirror.oldSize - oldSize) + + " reconstruct the line + let update = beginline.wordMirror.endline + call setline(mirror.line, update) endfor @@ -179,17 +202,17 @@ function! s:state_find_update_objects(item) dict abort return item.update_objects endfunction -function! s:state_update(item, change_len) dict abort +function! s:state_update(item, change_len, mirror_change) dict abort let item = a:item - if exists('item.update_objects') - let to_update = item.update_objects - else - let to_update = self.find_update_objects(a:item) - let item.update_objects = to_update + if !exists('item.update_objects') + let item.update_objects = self.find_update_objects(a:item) endif + let to_update = item.update_objects for obj in to_update - let obj.col += a:change_len + " object does not necessarly have the same decalage + " than mirrors if mirrors use regexp + let obj.col += a:mirror_change if obj is self.cur_stop let self.start_col += a:change_len let self.end_col += a:change_len diff --git a/sources_non_forked/vim-snipmate/autoload/snipmate/legacy.vim b/sources_non_forked/vim-snipmate/autoload/snipmate/legacy.vim index 035c5eec..7ff39cbe 100644 --- a/sources_non_forked/vim-snipmate/autoload/snipmate/legacy.vim +++ b/sources_non_forked/vim-snipmate/autoload/snipmate/legacy.vim @@ -12,8 +12,7 @@ function! snipmate#legacy#process_snippet(snip) abort else let visual = '' endif - let snippet = substitute(snippet, '\n\(\t\+\).\{-\}\zs{VISUAL}', - \ substitute(escape(visual, '%\'), "\n", "\n\\\\1", 'g'), 'g') + let snippet = s:substitute_visual(snippet, visual) " Evaluate eval (`...`) expressions. " Backquotes prefixed with a backslash "\" are ignored. @@ -118,6 +117,16 @@ function! snipmate#legacy#build_stops(snip, lnum, col, indent) abort return [stops, i + 1] endfunction +function! s:substitute_visual(snippet, visual) abort + let lines = [] + for line in split(a:snippet, "\n") + let indent = matchstr(line, '^\t\+') + call add(lines, substitute(line, '{VISUAL}', + \ substitute(escape(a:visual, '%\'), "\n", "\n" . indent, 'g'), 'g')) + endfor + return join(lines, "\n") +endfunction + " Counts occurences of haystack in needle function! s:count(haystack, needle) abort let counter = 0 diff --git a/sources_non_forked/vim-snipmate/autoload/snipmate/parse.vim b/sources_non_forked/vim-snipmate/autoload/snipmate/parse.vim index d784ab9b..dd495e95 100644 --- a/sources_non_forked/vim-snipmate/autoload/snipmate/parse.vim +++ b/sources_non_forked/vim-snipmate/autoload/snipmate/parse.vim @@ -5,6 +5,7 @@ function! s:sfile() abort endfunction let s:parser_proto = {} +let s:special_chars = "$`\n" function! s:new_parser(text) abort let ret = copy(s:parser_proto) @@ -14,6 +15,7 @@ function! s:new_parser(text) abort let ret.indent = 0 let ret.value = [] let ret.vars = {} + let ret.stored_lines = [] call ret.advance() return ret endfunction @@ -82,35 +84,56 @@ function! s:parser_varend() dict abort endfunction function! s:parser_placeholder() dict abort - return self.parse('}') + let ret = self.text('}') + return empty(ret) ? [''] : ret endfunction function! s:parser_subst() dict abort let ret = {} - let ret.pat = join(self.text('/', 1)) + let ret.pat = self.pat() if self.same('/') - let ret.sub = join(self.text('/}')) + let ret.sub = self.pat(1) endif if self.same('/') - let ret.flags = join(self.text('}', 1)) + let ret.flags = self.pat(1) endif return ret endfunction +function! s:parser_pat(...) dict abort + let val = '' + + while self.pos < self.len + if self.same('\') + if self.next == '/' + let val .= '/' + call self.advance() + elseif a:0 && self.next == '}' + let val .= '}' + call self.advance() + else + let val .= '\' + endif + elseif self.next == '/' || a:0 && self.next == '}' + break + else + let val .= self.next + call self.advance() + endif + endwhile + + return val +endfunction + function! s:parser_expr() dict abort - let str = join(self.text('`', 1)) + let str = self.string('`') call self.same('`') return snipmate#util#eval(str) endfunction -function! s:parser_text(...) dict abort - let res = [] +function! s:parser_string(till, ...) dict abort let val = '' - if a:0 == 2 && a:2 - let till = '\V' . escape(a:1, '\') - else - let till = '[`$' . (a:0 ? a:1 : '') . ']' - endif + let till = '\V\[' . escape(a:till, '\') . ']' while self.pos < self.len if self.same('\') @@ -120,11 +143,6 @@ function! s:parser_text(...) dict abort call self.advance() elseif self.next =~# till break - elseif self.next == "\n" - call add(res, val) - let val = '' - let self.indent = 0 - call self.advance() elseif self.next == "\t" let self.indent += 1 let val .= s:indent(1) @@ -135,55 +153,77 @@ function! s:parser_text(...) dict abort endif endwhile - call add(res, val) - return res + return val endfunction -function! s:parser_parse(...) dict abort - let ret = a:0 ? [] : self.value +function! s:join_consecutive_strings(list) abort + let list = a:list + let pos = 0 + while pos + 1 < len(list) + if type(list[pos]) == type('') && type(list[pos+1]) == type('') + let list[pos] .= list[pos+1] + call remove(list, pos + 1) + else + let pos += 1 + endif + endwhile +endfunction + +function! s:parser_text(till) dict abort + let ret = [] + while self.pos < self.len + let lines = [] + if self.same('$') let var = self.var() if !empty(var) if var[0] is# 'VISUAL' - let add_to = s:visual_placeholder(var, self.indent) - if !empty(ret) && type(ret[-1]) == type('') - let ret[-1] .= add_to[0] - else - call add(ret, add_to[0]) - endif - call extend(ret, add_to[1:-1]) + let lines = s:visual_placeholder(var, self.indent) elseif var[0] >= 0 call add(ret, var) call self.add_var(var) endif endif elseif self.same('`') - let add_to = self.expr() - if !empty(ret) && type(ret[-1]) == type('') - let ret[-1] .= add_to - else - call add(ret, add_to) - endif + let lines = split(self.expr(), "\n", 1) else - let text = a:0 ? self.text(a:1) : self.text() - if exists('add_to') - let ret[-1] .= text[0] - call remove(text, 0) - unlet add_to - endif - call extend(ret, text) + let lines = [self.string(a:till . s:special_chars)] endif - if a:0 && self.next == a:1 + + if !empty(lines) + call add(ret, lines[0]) + call extend(self.stored_lines, lines[1:]) + endif + + " Empty lines are ignored if this is tested at the start of an iteration + if self.next ==# a:till break endif endwhile + + call s:join_consecutive_strings(ret) return ret endfunction -call extend(s:parser_proto, snipmate#util#add_methods(s:sfile(), 'parser', - \ [ 'advance', 'same', 'id', 'add_var', 'var', 'varend', - \ 'placeholder', 'subst', 'expr', 'text', 'parse' ]), 'error') +function! s:parser_line() dict abort + let ret = [] + if !empty(self.stored_lines) + call add(ret, remove(self.stored_lines, 0)) + else + call extend(ret, self.text("\n")) + call self.same("\n") + endif + let self.indent = 0 + return ret +endfunction + +function! s:parser_parse() dict abort + while self.pos < self.len || !empty(self.stored_lines) + let line = self.line() + call add(self.value, line) + endwhile +endfunction function! s:indent(count) abort if &expandtab @@ -211,9 +251,59 @@ function! s:visual_placeholder(var, indent) abort return content endfunction -function! snipmate#parse#snippet(text) abort +function! s:parser_create_stubs() dict abort + + for [id, dict] in items(self.vars) + for i in dict.instances + if len(i) > 1 && type(i[1]) != type({}) + if !has_key(dict, 'placeholder') + let dict.placeholder = i[1:] + call add(i, dict) + else + unlet i[1:] + call s:create_mirror_stub(i, dict) + endif + else + call s:create_mirror_stub(i, dict) + endif + endfor + if !has_key(dict, 'placeholder') + let dict.placeholder = [] + let j = 0 + while len(dict.instances[j]) > 2 + let j += 1 + endwhile + let oldstub = remove(dict.instances[j], 1, -1)[-1] + call add(dict.instances[j], '') + call add(dict.instances[j], dict) + call filter(dict.mirrors, 'v:val isnot oldstub') + endif + unlet dict.instances + endfor + +endfunction + +function! s:create_mirror_stub(mirror, dict) + let mirror = a:mirror + let dict = a:dict + let stub = get(mirror, 1, {}) + call add(mirror, stub) + let dict.mirrors = get(dict, 'mirrors', []) + call add(dict.mirrors, stub) +endfunction + +function! snipmate#parse#snippet(text, ...) abort let parser = s:new_parser(a:text) call parser.parse() + if !(a:0 && a:1) + call parser.create_stubs() + endif unlet! b:snipmate_visual return [parser.value, parser.vars] endfunction + +call extend(s:parser_proto, snipmate#util#add_methods(s:sfile(), 'parser', + \ [ 'advance', 'same', 'id', 'add_var', 'var', 'varend', + \ 'line', 'string', 'create_stubs', 'pat', + \ 'placeholder', 'subst', 'expr', 'text', 'parse', + \ ]), 'error') diff --git a/sources_non_forked/vim-snipmate/doc/snipMate.txt b/sources_non_forked/vim-snipmate/doc/snipMate.txt index f490f315..230fe686 100644 --- a/sources_non_forked/vim-snipmate/doc/snipMate.txt +++ b/sources_non_forked/vim-snipmate/doc/snipMate.txt @@ -1,7 +1,6 @@ *SnipMate.txt* Plugin for using TextMate-style snippets in Vim. SnipMate *snippet* *snippets* *SnipMate* -Last Change: December 27, 2009 1. Description |SnipMate-description| 2. Usage |SnipMate-usage| @@ -504,6 +503,15 @@ Perhaps some of these features will be added in a later release. ============================================================================== CHANGELOG *SnipMate-changelog* +0.89 - 2016-05-29 +----------------- + +* Various regex updates to legacy parser Addition of double bang syntax to +* completely remove a snippet from lookup Group various SnipMate autocommands +* Support setting 'shiftwidth' to 0 Parser now operates linewise, adding some +* flexibility Mirror substitutions are more literal Mirror length is +* calculated correctly when substitutions occur + 0.88 - 2015-04-04 ----------------- diff --git a/sources_non_forked/vim-snipmate/t/parser.vim b/sources_non_forked/vim-snipmate/t/parser.vim index 94214922..c5cf8739 100644 --- a/sources_non_forked/vim-snipmate/t/parser.vim +++ b/sources_non_forked/vim-snipmate/t/parser.vim @@ -2,27 +2,27 @@ describe 'snippet parser' before function! Parse(snippet, ...) - let [snip, stops] = snipmate#parse#snippet(a:snippet) - return a:0 ? [snip, stops] : snip + let [snip, stops] = snipmate#parse#snippet(a:snippet, (a:0 ? a:1 : 1)) + return (a:0 > 1 && a:2) ? [snip, stops] : snip endfunction let b:snipmate_visual = 'testvisual' end it 'parses numeric $id and ${id} vars as [id] lists' - let expect = [[1234567890]] + let expect = [[[1234567890]]] Expect Parse('$1234567890') == expect Expect Parse('${1234567890}') == expect end it 'disregards $ or ${ followed by a non-id' - Expect Parse('$x1') == ['x1'] - Expect Parse('${x}1') == ['x}1'] - Expect Parse('$VISUA1') == ['VISUA1'] - Expect Parse('${VISUA}1') == ['VISUA}1'] + Expect Parse('$x1') == [['x1']] + Expect Parse('${x}1') == [['x}1']] + Expect Parse('$VISUA1') == [['VISUA1']] + Expect Parse('${VISUA}1') == [['VISUA}1']] end it 'gathers references to each instance of each stop id' - let [snip, b:stops] = Parse('x$1x${2:x$1x}x$1x${1/a/b}x$VISUALx', 1) + let [snip, b:stops] = Parse('x$1x${2:x$1x}x$1x${1/a/b}x$VISUALx', 1, 1) function! InstanceFound(list) return !empty(filter(copy(b:stops[a:list[0]].instances), \ 'v:val is a:list')) @@ -36,87 +36,107 @@ describe 'snippet parser' unlet item " E732 endfor endfunction - call CheckList(snip) + call CheckList(snip[0]) end it 'parses mirror substitutions ${n/pat/sub} as [n, {...}]' - let expect = [[1, { 'pat' : 'abc', 'sub' : 'def' }]] + let expect = [[[1, { 'pat' : 'abc', 'sub' : 'def' }]]] Expect Parse('${1/abc/def}') == expect - let expect[0][1].flags = '' + let expect[0][0][1].flags = '' Expect Parse('${1/abc/def/}') == expect - let expect[0][1].flags = 'g' + let expect[0][0][1].flags = 'g' Expect Parse('${1/abc/def/g}') == expect end + it 'reads patterns literally except for "\/"' + Expect Parse('${1/\a\/b/\c\/d\}}') == [[[1, { 'pat' : '\a/b', 'sub' : '\c/d}' }]]] + end + it 'parses vars with placeholders as [id, placeholder] lists' - Expect Parse('${1:abc}') == [[1, 'abc']] + Expect Parse('${1:abc}') == [[[1, 'abc']]] end it 'evaluates backtick expressions' - Expect Parse('`fnamemodify("x.y", ":r")`') == ['x'] + Expect Parse('`fnamemodify("x.y", ":r")`') == [['x']] end it 'parses placeholders for vars and other specials' let text = 'a `fnamemodify("x.y", ":r")` ${2:(${3/a/b})}' let expect = ['a x ', [2, '(', [3, { 'pat' : 'a', 'sub' : 'b' }], ')']] - Expect Parse(text) == expect - Expect Parse(printf('${1:%s}', text)) == [[1] + expect] + Expect Parse(text) == [expect] + Expect Parse(printf('${1:%s}', text)) == [[[1] + expect]] end it 'converts tabs according to &et, &sts, &sw, &ts' " &noet -> leave tabs alone setl noet - Expect Parse("abc\tdef\n\t\tghi") == ["abc\tdef", "\t\tghi"] + Expect Parse("abc\tdef\n\t\tghi") == [["abc\tdef"], ["\t\tghi"]] " &et -> &sts or &sw setl et sts=2 sw=3 - Expect Parse("abc\tdef\n\t\tghi") == ["abc def", " ghi"] + Expect Parse("abc\tdef\n\t\tghi") == [["abc def"], [" ghi"]] setl et sts=0 sw=3 - Expect Parse("abc\tdef\n\t\tghi") == ["abc def", " ghi"] + Expect Parse("abc\tdef\n\t\tghi") == [["abc def"], [" ghi"]] setl et sts=-1 sw=3 - Expect Parse("abc\tdef\n\t\tghi") == ["abc def", " ghi"] + Expect Parse("abc\tdef\n\t\tghi") == [["abc def"], [" ghi"]] " See #227 if exists('*shiftwidth') setl et sts=0 sw=0 ts=3 - Expect Parse("abc\tdef\n\t\tghi") == ["abc def", " ghi"] + Expect Parse("abc\tdef\n\t\tghi") == [["abc def"], [" ghi"]] endif end it 'parses backslashes as escaping the next character or joining lines' - Expect Parse('x\x') == ['xx'] - Expect Parse('x\\x') == ['x\x'] - Expect Parse("x\\\nx") == ['xx'] - Expect Parse('x\$1') == ['x$1'] - Expect Parse('${1:\}}') == [[1, '}']] - Expect Parse('${1/\//\}}') == [[1, { 'pat' : '/', 'sub' : '}' }]] - Expect Parse('`fnamemodify("\`.x", ":r")`') == ['`'] - Expect Parse('\`x\`') == ['`x`'] + Expect Parse('x\x') == [['xx']] + Expect Parse('x\\x') == [['x\x']] + Expect Parse("x\\\nx") == [['xx']] + Expect Parse('x\$1') == [['x$1']] + Expect Parse('${1:\}}') == [[[1, '}']]] + Expect Parse('`fnamemodify("\`.x", ":r")`') == [['`']] + Expect Parse('\`x\`') == [['`x`']] end it 'splits text at newlines' - Expect Parse("x\nx") == ['x', 'x'] + Expect Parse("x\nx") == [['x'], ['x']] end it 'joins evaluated expressions to surrounding text on the same line' let g:foo = 'bar' - Expect Parse("x`g:foo`x") == ['xbarx'] - Expect Parse("x`g:foo`\nx") == ['xbar', 'x'] - Expect Parse("x\n`g:foo`x") == ['x', 'barx'] - end - - it 'adds empty strings before/after vars if at the start/end of a line' - Expect Parse("x$1\nx") == ['x', [1], '', 'x'] - Expect Parse("x\n$1x") == ['x', '', [1], 'x'] + Expect Parse("x`g:foo`x") == [['xbarx']] + Expect Parse("x`g:foo`\nx") == [['xbar'], ['x']] + Expect Parse("x\n`g:foo`x") == [['x'], ['barx']] end it 'expands $VISUAL placeholders with any indents' - Expect Parse("x$VISUALx") == ['xtestvisualx'] + Expect Parse("x$VISUALx") == [['xtestvisualx']] let b:snipmate_visual = " foo\nbar\n baz" setl noet - Expect Parse("\tx\n\t$VISUAL\nx") == ["\tx", "\t foo", "\tbar", "\t baz", "x"] + Expect Parse("\tx\n\t$VISUAL\nx") == [["\tx"], ["\t foo"], ["\tbar"], + \ ["\t baz"], ["x"]] + end + + it 'determines which var with an id is the stop' + let [snip, stops] = Parse("$1$1$1", 0, 1) + Expect snip == [[[1, "", stops[1]], [1, {}], [1, {}]]] + + let [snip, stops] = Parse("$1${1}$1", 0, 1) + Expect snip == [[[1, "", stops[1]], [1, {}], [1, {}]]] + + let [snip, stops] = Parse("$1${1:}$1", 0, 1) + Expect snip == [[[1, {}], [1, "", stops[1]], [1, {}]]] + + end + + it 'picks the first of many possible stops' + let [snip, stops] = Parse("$1${1:foo}${1:bar}", 0, 1) + Expect snip == [[[1, {}], [1, "foo", stops[1]], [1, {}]]] + end + + it 'represents empty lines as an empty string' + Expect Parse("foo\n\nbar") == [['foo'], [''], ['bar']] end end diff --git a/sources_non_forked/vim-snippets/UltiSnips/php-phpspec.snippets b/sources_non_forked/vim-snippets/UltiSnips/php-phpspec.snippets index b9ec0320..297b73d8 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/php-phpspec.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/php-phpspec.snippets @@ -1,8 +1,9 @@ -# Snippets for phpspec +# Snippets for phpspec, to use add the following to your .vimrc +# `autocmd BufRead,BufNewFile,BufEnter *Spec.php UltiSnipsAddFiletypes php-phpspec` priority -50 -snippet spec "phpspec class" b +snippet spec "class XYZSpec extends ObjectBehaviour" beConstructedWith($arg)" +$this->beConstructedWith(${1}); +endsnippet + +snippet ct "$this->beConstructedThrough($methodName, [$arg])" +$this->beConstructedThrough(${1:'methodName'}, [${2:'$arg'}]); +endsnippet + +# Identity and comparison matchers +snippet sreturn "$this->XYZ()->shouldReturn('value')" +$this->${1:method}()->shouldReturn(${2:'value'}); +endsnippet + +snippet snreturn "$this->XYZ()->shouldNotReturn('value')" +$this->${1:method}()->shouldNotReturn(${2:'value'}); +endsnippet + +snippet sbe "$this->XYZ()->shouldBe('value')" +$this->${1:method}()->shouldBe(${2:'value'}); +endsnippet + +snippet snbe "$this->XYZ()->shouldNotBe('value')" +$this->${1:method}()->shouldNotBe(${2:'value'}); +endsnippet + +snippet sequal "$this->XYZ()->shouldEqual('value')" +$this->${1:method}()->shouldEqual(${2:'value'}); +endsnippet + +snippet snequal "$this->XYZ()->shouldNotEqual('value')" +$this->${1:method}()->shouldNotEqual(${2:'value'}); +endsnippet + +snippet sbequalto "$this->XYZ()->shouldBeEqualTo('value')" +$this->${1:method}()->shouldBeEqualTo(${2:'value'}); +endsnippet + +snippet snbequalto "$this->XYZ()->shouldNotBeEqualTo('value')" +$this->${1:method}()->shouldNotBeEqualTo(${2:'value'}); +endsnippet + +snippet sblike "$this->XYZ()->shouldBeLike('value')" +$this->${1:method}()->shouldBeLike(${2:'value'}); +endsnippet + +snippet snblike "$this->XYZ()->shouldNotBeLike('value')" +$this->${1:method}()->shouldNotBeLike(${2:'value'}); +endsnippet + +# Throw matcher +snippet sthrowm "$this->shouldThrow('\Exception')->duringXYZ($arg)" +$this->shouldThrow(${1:'\Exception'})->during${2:Method}(${3:'$arg'}); +endsnippet + +snippet sthrowi "$this->shouldThrow('\Exception')->duringInstantiation()" +$this->shouldThrow(${1:'\Exception'})->duringInstantiation(); +endsnippet + +# Type matchers +snippet stype "$this->shouldHaveType('Type')" +$this->shouldHaveType(${1}); +endsnippet + +snippet sntype "$this->shouldNotHaveType('Type')" +$this->shouldNotHaveType(${1}); +endsnippet + +snippet srinstance "$this->shouldReturnAnInstanceOf('Type')" +$this->shouldReturnAnInstanceOf(${1}); +endsnippet + +snippet snrinstance "$this->shouldNotReturnAnInstanceOf('Type')" +$this->shouldNotReturnAnInstanceOf(${1}); +endsnippet + +snippet sbinstance "$this->shouldBeAnInstanceOf('Type')" +$this->shouldBeAnInstanceOf(${1}); +endsnippet + +snippet snbinstance "$this->shouldNotBeAnInstanceOf('Type')" +$this->shouldNotBeAnInstanceOf(${1}); +endsnippet + +snippet simplement "$this->shouldImplement('Type')" +$this->shouldImplement(${1}); +endsnippet + +snippet snimplement "$this->shouldNotImplement('Type')" +$this->shouldNotImplement(${1}); +endsnippet + +# Object state matchers +snippet sbstate "$this->shouldBeXYZ()" +$this->shouldBe${1}(); +endsnippet + +snippet snbstate "$this->shouldNotBeXYZ()" +$this->shouldNotBe${1}(); +endsnippet + +# Count matchers +snippet scount "$this->XYZ()->shouldHaveCount(7)" +$this->${1:method}()->shouldHaveCount(${2:7}); +endsnippet + +snippet sncount "$this->XYZ()->shouldNotHaveCount(7)" +$this->${1:method}()->shouldNotHaveCount(${2:7}); +endsnippet + +# Scalar type matchers +snippet sbscalar "$this->XYZ()->shouldBeString|Array|Bool()" +$this->${1:method}()->shouldBe(${2:'String|Array|Bool'}); +endsnippet + +snippet snbscalar "$this->XYZ()->shouldNotBeString|Array|Bool()" +$this->${1:method}()->shouldNotBe(${2:'String|Array|Bool'}); +endsnippet + +# Contain matcher +snippet scontain "$this->XYZ()->shouldContain('value')" +$this->${1:method}()->shouldContain(${2:'value'}); +endsnippet + +snippet sncontain "$this->XYZ()->shouldNotContain('value')" +$this->${1:method}()->shouldNotContain(${2:'value'}); +endsnippet + +# Array matchers +snippet skey "$this->XYZ()->shouldHaveKey('key')" +$this->${1:method}()->shouldHaveKey(${2:'key'}); +endsnippet + +snippet snkey "$this->XYZ()->shouldNotHaveKey('key')" +$this->${1:method}()->shouldNotHaveKey(${2:'key'}); +endsnippet + +snippet skeyvalue "$this->XYZ()->shouldHaveKeyWithValue('key', 'value')" +$this->${1:method}()->shouldHaveKeyWithValue(${2:'key'}, ${3:'value'}); +endsnippet + +snippet snkeyvalue "$this->XYZ()->shouldNotHaveKeyWithValue('key', 'value')" +$this->${1:method}()->shouldNotHaveKeyWithValue(${2:'key'}, ${3:'value'}); +endsnippet + +# String matchers +snippet sstart "$this->XYZ()->shouldStartWith('string')" +$this->${1:method}()->shouldStartWith(${2:'string'}); +endsnippet + +snippet snstart "$this->XYZ()->shouldNotStartWith('string')" +$this->${1:method}()->shouldNotStartWith(${2:'string'}); +endsnippet + +snippet send "$this->XYZ()->shouldEndWith('string')" +$this->${1:method}()->shouldEndWith(${2:'string'}); +endsnippet + +snippet snend "$this->XYZ()->shouldNotEndWith('string')" +$this->${1:method}()->shouldNotEndWith(${2:'string'}); +endsnippet + +snippet smatch "$this->XYZ()->shouldMatch('/wizard/i')" +$this->${1:method}()->shouldMatch(${2:'/wizard/i'}); +endsnippet + +snippet snmatch "$this->XYZ()->shouldNotMatch('/wizard/i')" +$this->${1:method}()->shouldNotMatch(${2:'/wizard/i'}); +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/php-phpunit.snippets b/sources_non_forked/vim-snippets/UltiSnips/php-phpunit.snippets deleted file mode 100644 index 9120406b..00000000 --- a/sources_non_forked/vim-snippets/UltiSnips/php-phpunit.snippets +++ /dev/null @@ -1,40 +0,0 @@ -# suggestion? report bugs? -# please go to https://github.com/chrisyue/vim-snippets/issues -priority -50 - -snippet test "phpunit test class" b -${1:once}()) - ->method('${2}') - ->with($this->equalTo(${3})${4}) - ->will($this->returnValue(${5})); -endsnippet - -snippet testcmt "phpunit comment with group" b -/** -* @group ${1} -*/ -endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/php.snippets b/sources_non_forked/vim-snippets/UltiSnips/php.snippets index ff3e6f39..74b51cc0 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/php.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/php.snippets @@ -3,119 +3,11 @@ priority -50 ## Snippets from SnipMate, taken from ## https://github.com/scrooloose/snipmate-snippets.git -snippet array "array" -$${1:arrayName} = array('${2}' => ${3});${4} -endsnippet - -snippet def "def" -define('${1:VARIABLE_NAME}', ${2:'definition'});${3} -endsnippet - -snippet wh "while" -while (${1}) { - ${0:${VISUAL}} -} -endsnippet - -snippet do "do" -do { - ${2:// code... } -} while (${1:/* condition */}); -endsnippet - -snippet doc_f "doc_f" -/** - * $2 - * @return ${4:void} - * @author ${5:`!v g:snips_author`} - **/ -${1:public }function ${2:someFunc}(${3}) -{${6} -} -endsnippet - -snippet doc_i "doc_i" -/** - * $1 - * @package ${2:default} - * @author ${3:`!v g:snips_author`} - **/ -interface ${1:someClass} -{${4} -} // END interface $1" -endsnippet - -snippet el "else" -else { - ${0:${VISUAL}} -} -endsnippet - -snippet for "for" -for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { - ${4:// code...} -} -endsnippet - -snippet foreachk "foreachk" -foreach ($${1:variable} as $${2:key} => $${3:value}) { - ${4:// code...} -} -endsnippet - -snippet get "get" -$_GET['${1}']${2} -endsnippet - -snippet if "if" -if (${1}) { - ${0:${VISUAL}} -} -endsnippet - -snippet eif "elseif" -elseif (${1}) { - ${0:${VISUAL}} -} -endsnippet - -snippet inc "inc" -include '${1:file}';${2} -endsnippet - -snippet log "log" -error_log(var_export(${1}, true));${2} -endsnippet - -snippet post "post" -$_POST['${1}']${2} -endsnippet - -snippet req "req1" -require_once '${1:file}';${2} -endsnippet - -snippet req1 "req1" -require_once '${1:file}';${2} -endsnippet - -snippet session "session" -$_SESSION['${1}']${2} -endsnippet - -snippet t "t" -$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5} -endsnippet - -snippet var "var" -var_export(${1});${2} -endsnippet - snippet getter "PHP Class Getter" b /** * Getter for $1 * - * ${2:return string} + * @return ${2:string} */ public function get${1/\w+\s*/\u$0/}() { @@ -127,7 +19,7 @@ snippet setter "PHP Class Setter" b /** * Setter for $1 * - * @param ${2:string} $$1 + * @param ${2:string} $$1 * @return ${3:`!p snip.rv=snip.basename`} */ public function set${1/\w+\s*/\u$0/}(${4:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1) @@ -143,7 +35,7 @@ snippet gs "PHP Class Getter Setter" b /** * Getter for $1 * - * return ${2:string} + * @return ${2:string} */ public function get${1/\w+\s*/\u$0/}() { @@ -251,27 +143,11 @@ function ${1:name}(${2:$param}) $0 endsnippet -snippet fore "Foreach loop" -foreach ($${1:variable} as $${3:value}) { - ${VISUAL}${4} -} -$0 -endsnippet - snippet new "New class instance" b $${1:variableName} = new ${2:${1/\w+\s*/\u$0/}}($3); $0 endsnippet -snippet ife "if else" -if (${1:/* condition */}) { - ${2:// code...} -} else { - ${3:// code...} -} -$0 -endsnippet - snippet ns "namespace declaration" b namespace ${1:`!p relpath = os.path.relpath(path) @@ -316,7 +192,7 @@ if m: */ interface $1 { - public function ${3:someFunction}();$4 + public function ${3:someFunction}();$4 } endsnippet @@ -349,18 +225,29 @@ public function __construct(${1:$dependencies}) $0 endsnippet -snippet ve "Dumb debug helper in HTML" - echo '
' . var_export($1, 1) . '
';$0 -endsnippet +# PHPUnit snippets +snippet testcase "class XYZTest extends \PHPUnit_Framework_TestCase { ... }" + -{% endjavascripts %} -endsnippet - -snippet css "twig stylesheets" b -{% stylesheets '${1}' %} - -{% endstylesheets %} -endsnippet - -snippet if "twig if" b -{% if ${1} %} -${0:${VISUAL}} -{% endif %} -endsnippet - -snippet ife "twig if ... else" b -{% if ${1} %} -${2} -{% else %} -${0} -{% endif %} -endsnippet - -snippet el "twig else" -{% else %} -${0:${VISUAL}} -endsnippet - -snippet eif "twig elseif" -{% elseif ${1} %} -${0:${VISUAL}} -endsnippet - -snippet for "twig for" b -{% for ${1} in ${2} %} -${3} -{% endfor %} -endsnippet - -snippet ext "twig extends" b -{% extends ${1} %} -endsnippet diff --git a/sources_non_forked/vim-snippets/snippets/_.snippets b/sources_non_forked/vim-snippets/snippets/_.snippets index d7f51bea..0153a146 100644 --- a/sources_non_forked/vim-snippets/snippets/_.snippets +++ b/sources_non_forked/vim-snippets/snippets/_.snippets @@ -7,6 +7,8 @@ snippet date `strftime("%Y-%m-%d")` snippet ddate `strftime("%B %d, %Y")` +snippet diso + `strftime("%Y-%m-%dT%H:%M:%S")` snippet time `strftime("%H:%M")` snippet datetime diff --git a/sources_non_forked/vim-snippets/snippets/cpp.snippets b/sources_non_forked/vim-snippets/snippets/cpp.snippets index 1539d5f9..d06b3c90 100644 --- a/sources_non_forked/vim-snippets/snippets/cpp.snippets +++ b/sources_non_forked/vim-snippets/snippets/cpp.snippets @@ -146,9 +146,9 @@ snippet itera ## Lambdas # lamda (one line) snippet ld - [${1}](${2}){${3}} + [${1}](${2}){${3}}; # lambda (multi-line) snippet lld [${1}](${2}){ ${3} - } + }; diff --git a/sources_non_forked/vim-snippets/snippets/elixir.snippets b/sources_non_forked/vim-snippets/snippets/elixir.snippets index 17cebbbb..851dc8be 100644 --- a/sources_non_forked/vim-snippets/snippets/elixir.snippets +++ b/sources_non_forked/vim-snippets/snippets/elixir.snippets @@ -114,7 +114,7 @@ snippet testa end snippet exunit defmodule ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} do - use ExUnit.Case + use ExUnit.Case, async: true ${0} end @@ -131,3 +131,6 @@ snippet qu quote do ${1} end +snippet beh + @behaviour ${1:Mix.Task} + ${0} diff --git a/sources_non_forked/vim-snippets/snippets/elm.snippets b/sources_non_forked/vim-snippets/snippets/elm.snippets new file mode 100644 index 00000000..6a15c83a --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/elm.snippets @@ -0,0 +1,50 @@ +snippet mod + module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` exposing (${1}) + ${0} +snippet imp + import ${0:List} +snippet impe + import ${1:List} exposing (${0:map}) +snippet fn + ${1:fn} : ${2:a} -> ${3:a} + $1 ${4} = + ${0} +snippet fn1 + ${1:fn} : ${2:a} -> ${3:a} + $1 ${4} = + ${0} +snippet fn2 + ${1:fn} : ${2:a} -> ${3:a} -> ${4:a} + $1 ${5} = + ${0} +snippet fn3 + ${1:fn} : ${2:a} -> ${3:a} -> ${4:a} -> ${5:a} + $1 ${6} = + ${0} +snippet fn0 + ${1:fn} : ${2:a} + $1 = + ${0} +snippet case + case ${1} of + ${2} -> + ${0} +snippet - + ${1} -> + ${0} +snippet let + let + ${1} = ${2} + in + ${0} +snippet if + if ${1} then + ${2} + else + ${0} +snippet ty + type ${1:Msg} + = ${0} +snippet tya + type alias ${1:Model} = + ${0} diff --git a/sources_non_forked/vim-snippets/snippets/erlang.snippets b/sources_non_forked/vim-snippets/snippets/erlang.snippets index ca92651b..5440d7c4 100644 --- a/sources_non_forked/vim-snippets/snippets/erlang.snippets +++ b/sources_non_forked/vim-snippets/snippets/erlang.snippets @@ -482,6 +482,37 @@ snippet gen_event %%%=================================================================== %%% Internal functions %%%=================================================================== +# EUnit snippets +snippet eunit + -module(${1:`vim_snippets#Filename('', 'my')`}). + -include_lib("eunit/include/eunit.hrl"). + + ${0} +snippet ieunit + -ifdef(TEST). + -include_lib("eunit/include/eunit.hrl"). + + ${0} + + -endif. +snippet as + ?assert(${0}) +snippet asn + ?assertNot(${0}) +snippet aseq + ?assertEqual(${1}, ${0}) +snippet asneq + ?assertNotEqual(${1}, ${0}) +snippet asmat + ?assertMatch(${1:Pattern}, ${0:Expression}) +snippet asnmat + ?assertNotMatch(${1:Pattern}, ${0:Expression}) +snippet aserr + ?assertError(${1:Pattern}, ${0:Expression}) +snippet asex + ?assertExit(${1:Pattern}, ${0:Expression}) +snippet asexc + ?assertException(${1:Class}, ${2:Pattern}, ${0:Expression}) # common_test test_SUITE snippet testsuite -module(${0:`vim_snippets#Filename('', 'my')`}). diff --git a/sources_non_forked/vim-snippets/snippets/javascript-mocha.snippets b/sources_non_forked/vim-snippets/snippets/javascript-mocha.snippets new file mode 100644 index 00000000..f08bf849 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/javascript-mocha.snippets @@ -0,0 +1,14 @@ +snippet des "Describe" b + describe('${1:}', () => { + ${0} + }); +snippet it "it" b + it('${1:}', () => { + ${0} + }); +snippet exp "expect" b + expect(${1:})${0}; +snippet expe "expect" b + expect(${1:}).to.equal(${0}); +snippet expd "expect" b + expect(${1:}).to.deep.equal(${0}); diff --git a/sources_non_forked/vim-snippets/snippets/make.snippets b/sources_non_forked/vim-snippets/snippets/make.snippets index 68a75e25..332d6fc9 100644 --- a/sources_non_forked/vim-snippets/snippets/make.snippets +++ b/sources_non_forked/vim-snippets/snippets/make.snippets @@ -43,3 +43,8 @@ snippet el # .DEFAULT_GOAL := target snippet default .DEFAULT_GOAL := ${1} +# help target for self-documented Makefile +snippet help + help: ## Prints help for targets with comments + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $\$1, $\$2}' + ${0} diff --git a/sources_non_forked/vim-snippets/snippets/mustache.snippets b/sources_non_forked/vim-snippets/snippets/mustache.snippets new file mode 100644 index 00000000..8296afcb --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/mustache.snippets @@ -0,0 +1,18 @@ +# if {{#value}} ... {{/value}} +snippet if + {{#${1:value}}} + ${0} + {{/$1}} +# if not {{^value}} ... {{/value}} +snippet ifn + {{^${1:value}}} + ${0} + {{/$1}} +# if else {{#value}} ... {{/value}} {{^value}} ... {{/value}} +snippet ife + {{#${1:value}}} + ${2} + {{/$1}} + {{^$1}} + ${3} + {{/$1}} diff --git a/sources_non_forked/vim-snippets/snippets/php.snippets b/sources_non_forked/vim-snippets/snippets/php.snippets index f611c7c1..d382a8b1 100644 --- a/sources_non_forked/vim-snippets/snippets/php.snippets +++ b/sources_non_forked/vim-snippets/snippets/php.snippets @@ -24,10 +24,7 @@ snippet ?i snippet ns namespace ${1:Foo\Bar\Baz}; ${0} -snippet use - use ${1:Foo\Bar\Baz}; - ${0} -snippet c +snippet c class ${1:`vim_snippets#Filename()`} { ${0} @@ -81,13 +78,14 @@ snippet $s #getter snippet $g ${1:$foo}->get${0:Bar}(); - # Tertiary conditional snippet =?: $${1:foo} = ${2:true} ? ${3:a} : ${0}; snippet ?: ${1:true} ? ${2:a} : ${0} - +snippet t "$retVal = (condition) ? a : b" + $${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b}; +# Predefined variables snippet C $_COOKIE['${1:variable}'] snippet E @@ -104,7 +102,12 @@ snippet S $_SERVER['${1:variable}'] snippet SS $_SESSION['${1:variable}'] - +snippet get "get" + $_GET['${1}'] +snippet post "post" + $_POST['${1}'] +snippet session "session" + $_SESSION['${1}'] # the following are old ones snippet inc include '${1:file}'; @@ -205,7 +208,19 @@ snippet doc_h * @copyright ${4:$2}, `strftime('%d %B, %Y')` * @package ${0:default} */ - +snippet doc_i "interface someClass {}" + /** + * $1 + * @package ${2:default} + * @author ${3:`!v g:snips_author`} + **/ + interface ${1:someClass} + {${4} + } +snippet inheritdoc "@inheritdoc docblock" + /** + * {@inheritdoc} + */ # Interface snippet interface /** @@ -254,55 +269,54 @@ snippet nc ${0} } # define(...) -snippet def - define('${1}'${2}); +snippet def "define('VARIABLE_NAME', 'definition')" + define('${1:VARIABLE_NAME}', ${2:'definition'}); # defined(...) snippet def? ${1}defined('${2}') -snippet wh +snippet wh "while (condition) { ... }" while (${1:/* condition */}) { ${0} } -# do ... while -snippet do +snippet do "do { ... } while (condition)" do { ${0} - } while (${1:/* condition */}); -snippet if - if (${1:/* condition */}) { + } while (${1}); +snippet if "if (condition) { ... }" + if (${1}) { ${0} } -snippet ifn - if (!${1:/* condition */}) { +snippet ifn "if (!condition) { ... }" + if (!${1}) { ${2} } -snippet ifil - +snippet ifil " ... " + ${0} -snippet ife - if (${1:/* condition */}) { +snippet ife "if (cond) { ... } else { ... }" + if (${1}) { ${2} } else { ${3} } ${0} -snippet ifeil - - ${2:} +snippet ifeil " ... ... " + + ${2} - ${3:} + ${3} ${0} -snippet el +snippet el "else { ... }" else { ${0} } -snippet eif +snippet eif "elseif(condition) { ... }" elseif (${1}) { ${0} } -snippet switch +snippet switch "switch($var) { case 'xyz': ... default: .... }" switch ($${1:variable}) { case '${2:value}': ${3} @@ -312,34 +326,33 @@ snippet switch ${4} break; } -snippet case +snippet case "case 'value': ... break" case '${1:value}': ${2} break; -snippet for +snippet for "for ($i = 0; $i < $count; $i++) { ... }" for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { ${0} } -snippet foreach +snippet foreach "foreach ($var as $value) { .. }" foreach ($${1:variable} as $${2:value}) { ${0} } -snippet foreachil +snippet foreachil " ... " - ${0:} + ${0} -snippet foreachk +snippet foreachk "foreach ($var as $key => $value) { .. }" foreach ($${1:variable} as $${2:key} => $${3:value}) { ${0} } -snippet foreachkil +snippet foreachkil " $value): ?> ... " $${3:value}): ?> ${0:} -# $... = array (...) -snippet array b +snippet array "$... = array(...)" $${1:arrayName} = array('${2}' => ${3}); -snippet try +snippet try "try { ... } catch (Exception $e) { ... }" try { ${0} } catch (${1:Exception} $e) { @@ -369,6 +382,14 @@ snippet http_redirect header ("HTTP/1.1 301 Moved Permanently"); header ("Location: ".URL); exit(); +snippet log "error_log(var_export($var, true));" + error_log(var_export(${1}, true)); +snippet var "var_export($var)" + var_export(${1}); +snippet ve "Dumb debug helper in HTML" + echo '
' . var_export(${1}, 1) . '
'; +snippet pc "Dumb debug helper in cli" + var_export($1);$0 # Getters & Setters snippet gs /** @@ -425,14 +446,12 @@ snippet aw array_walk($${1:foo}, function(&$${2:v}, $${3:k}) { $$2 = ${0}; }); - # static var assign once snippet static_var static $${1} = null; if (is_null($$1)){ $$1 = ${2}; } - snippet CSVWriter assertEquals()" $this->assertEquals(${1:expected}, ${2:actual}); - -snippet asne +snippet asne "$this->assertNotEquals()" $this->assertNotEquals(${1:expected}, ${2:actual}); - -snippet asf - $this->assertFalse(${1:Something}); - -snippet ast - $this->assertTrue(${1:Something}); - -snippet asfex - $this->assertFileExists(${1:path/to/file}); - -snippet asfnex - $this->assertFileNotExists(${1:path/to/file}); - -snippet ascon - $this->assertContains(${1:Search Value}, ${2:Array or Iterator}); - -snippet ashk - $this->assertArrayHasKey(${1:key}, ${2:array}); - -snippet asnhk - this->assertArrayNotHasKey(${1:value}, ${2:array}); - -snippet ascha - $this->assertClassHasAttribute('${1:Attribute Name}', '${2:ClassName}'); - -snippet asi +snippet asf "$this->assertFalse()" + $this->assertFalse(${1}); +snippet ast "$this->assertTrue()" + $this->assertTrue(${1}); +snippet asfex "$this->assertFileExists()" + $this->assertFileExists(${1:'path/to/file'}); +snippet asfnex "$this->assertFileNotExists()" + $this->assertFileNotExists(${1:'path/to/file'}); +snippet ascon "$this->assertContains()" + $this->assertContains(${1:$needle}, ${2:$haystack}); +snippet ashk "$this->assertArrayHasKey()" + $this->assertArrayHasKey(${1:$key}, ${2:$array}); +snippet asnhk "$this->assertArrayNotHasKey()" + this->assertArrayNotHasKey(${1:$key}, ${2:$array}); +snippet ascha "$this->assertClassHasAttribute()" + $this->assertClassHasAttribute(${1:$attributeName}, '${2:$className}'); +snippet asi "$this->assertInstanceOf(...)" $this->assertInstanceOf(${1:expected}, ${2:actual}); - -snippet tc - public function test${1:name_of_the_test}() +snippet test "public function testXYZ() { ... }" + public function test${1}() { - ${0:code} + ${0} } -snippet te +snippet setup "protected function setUp() { ... }" + protected function setUp() + { + ${0} + } +snippet teardown "protected function tearDown() { ... }" + protected function tearDown() + { + ${0} + } +snippet exp "phpunit expects" + expects($this->${1:once}()) + ->method('${2}') + ->with($this->equalTo(${3})${4}) + ->will($this->returnValue(${5})); +snippet testcmt "phpunit comment with group" + /** + * @group ${1} + */ +snippet fail "$this->fail()" + $this->fail(${1}); +snippet marki "$this->markTestIncomplete()" + $this->markTestIncomplete(${1}); +snippet marks "$this->markTestSkipped()" + $this->markTestSkipped(${1}); +# end of phpunit snippets +snippet te "throw new Exception()" throw new ${1:Exception}("${2:Error Processing Request}"); - snippet fpc "file_put_contents" b file_put_contents(${1:file}, ${2:content}${3:, FILE_APPEND});$0 - snippet sr "str_replace" str_replace(${1:search}, ${2:replace}, ${3:subject})$0 - snippet ia "in_array" in_array(${1:needle}, ${2:haystack})$0 - snippet is "isset" isset(${1:var})$0 - snippet isa "isset array" isset($${1:array}[${2:key}])$0 - snippet in "is_null" is_null($${1:var})$0 - snippet fe "file_exists" file_exists(${1:file})$0 - snippet id "is_dir" is_dir(${1:path})$0 diff --git a/sources_non_forked/vim-snippets/snippets/ruby.snippets b/sources_non_forked/vim-snippets/snippets/ruby.snippets index a6340e46..772f4644 100644 --- a/sources_non_forked/vim-snippets/snippets/ruby.snippets +++ b/sources_non_forked/vim-snippets/snippets/ruby.snippets @@ -1,5 +1,7 @@ snippet enc # encoding: utf-8 +snippet frozen + # frozen_string_literal: true snippet #! #!/usr/bin/env ruby # New Block diff --git a/sources_non_forked/vim-snippets/snippets/twig.snippets b/sources_non_forked/vim-snippets/snippets/twig.snippets index 50ae8232..47997c3b 100644 --- a/sources_non_forked/vim-snippets/snippets/twig.snippets +++ b/sources_non_forked/vim-snippets/snippets/twig.snippets @@ -1,43 +1,34 @@ -# twig block -snippet bl +snippet bl "{% block xyz %} .. {% endblock xyz %}" {% block ${1} %} ${2} {% endblock $1 %} -# twig javascripts -snippet js +snippet js "{% javascripts 'xyz' %} .. {% endjavascripts %}" {% javascripts '${1}' %} {% endjavascripts %} -# twig stylesheets -snippet css +snippet css "{% stylesheets 'xyz' %} .. {% endstylesheets %}" {% stylesheets '${1}' %} {% endstylesheets %} -# twig if -snippet if +snippet if "{% if %} .. {% endif %}" {% if ${1} %} ${2} {% endif %} -# twig if ... else -snippet ife +snippet ife "{% if %} .. {% else %} .. {% endif %}" {% if ${1} %} ${2} {% else %} ${0} {% endif %} -# twig else -snippet el +snippet el "{% else %}" {% else %} ${0} -# twig elseif -snippet eif +snippet eif "{% elseif %}" {% elseif ${1} %} ${0} -# twig for -snippet for +snippet for "{% for x in y %} .. {% endfor %}" {% for ${1} in ${2} %} ${3} {% endfor %} -# twig extends -snippet ext +snippet ext "{% extends xyz %}" {% extends ${1} %} diff --git a/sources_non_forked/vim-surround/plugin/surround.vim b/sources_non_forked/vim-surround/plugin/surround.vim index 6a986e89..46f32529 100644 --- a/sources_non_forked/vim-surround/plugin/surround.vim +++ b/sources_non_forked/vim-surround/plugin/surround.vim @@ -92,7 +92,7 @@ function! s:process(string) let m = matchstr(a:string,nr2char(i).'.\{-\}\ze'.nr2char(i)) if m != '' let m = substitute(strpart(m,1),'\r.*','','') - let repl_{i} = input(substitute(m,':\s*$','','').': ') + let repl_{i} = input(match(m,'\w\+$') >= 0 ? m.': ' : m) endif endfor let s = "" From b0cb820c5355244d80395a0f9452e640e49ca71c Mon Sep 17 00:00:00 2001 From: Amos Bird Date: Fri, 24 Jun 2016 11:54:43 +0800 Subject: [PATCH 3/8] Create the empty undodir. This patch aims to make the persistent undo functionality work out of the place. --- .gitignore | 1 - temp_dirs/undodir/.gitignore | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 temp_dirs/undodir/.gitignore diff --git a/.gitignore b/.gitignore index 66d01465..9588c166 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -temp_dirs/undodir* sources_non_forked/ack.vim/.netrwhist temp_dirs/yankring_history_v2.txt sources_forked/yankring/doc/tags diff --git a/temp_dirs/undodir/.gitignore b/temp_dirs/undodir/.gitignore new file mode 100644 index 00000000..47e856eb --- /dev/null +++ b/temp_dirs/undodir/.gitignore @@ -0,0 +1,2 @@ +# http://stackoverflow.com/a/932982 +!.gitignore From 0cb4702c1eff3901919ccbfb1a0193081777d4d1 Mon Sep 17 00:00:00 2001 From: amix Date: Sun, 26 Jun 2016 13:12:36 +0200 Subject: [PATCH 4/8] Updated plugins --- sources_non_forked/ack.vim/autoload/ack.vim | 5 + sources_non_forked/ack.vim/doc/ack.txt | 85 +- sources_non_forked/ack.vim/plugin/ack.vim | 2 +- sources_non_forked/ag.vim/README.md | 2 + .../ctrlp.vim/autoload/ctrlp.vim | 31 +- .../lightline.vim/autoload/lightline.vim | 6 +- .../nerdtree/autoload/nerdtree/ui_glue.vim | 16 +- sources_non_forked/syntastic/CONTRIBUTING.md | 24 +- sources_non_forked/syntastic/README.markdown | 153 +- .../autoload/syntastic/preprocess.vim | 48 + .../syntastic/doc/syntastic-checkers.txt | 6931 +++++++++++++++++ .../syntastic/doc/syntastic.txt | 17 +- .../syntastic/plugin/syntastic.vim | 2 +- .../syntax_checkers/cpp/clang_check.vim | 1 - .../syntax_checkers/cpp/clang_tidy.vim | 1 - .../syntastic/syntax_checkers/cpp/pc_lint.vim | 1 - .../syntax_checkers/javascript/tern_lint.vim | 53 + .../syntax_checkers/sass/sass_lint.vim | 51 + .../syntax_checkers/scss/sass_lint.vim | 23 + .../syntastic/syntax_checkers/vala/valac.vim | 30 +- .../syntastic/syntax_checkers/vim/vimlint.vim | 7 +- .../vim-fugitive/plugin/fugitive.vim | 4 +- sources_non_forked/vim-go/CHANGELOG.md | 6 +- .../vim-go/autoload/ctrlp/decls.vim | 219 +- .../vim-go/autoload/go/alternate.vim | 2 + .../vim-go/autoload/go/asmfmt.vim | 2 + sources_non_forked/vim-go/autoload/go/cmd.vim | 522 +- .../vim-go/autoload/go/complete.vim | 228 +- .../vim-go/autoload/go/coverage.vim | 395 +- sources_non_forked/vim-go/autoload/go/def.vim | 369 +- sources_non_forked/vim-go/autoload/go/doc.vim | 216 +- sources_non_forked/vim-go/autoload/go/fmt.vim | 317 +- .../vim-go/autoload/go/guru.vim | 424 +- .../vim-go/autoload/go/impl.vim | 196 +- .../vim-go/autoload/go/import.vim | 368 +- .../vim-go/autoload/go/jobcontrol.vim | 22 +- .../vim-go/autoload/go/lint.vim | 288 +- .../vim-go/autoload/go/list.vim | 158 +- .../vim-go/autoload/go/package.vim | 168 +- .../vim-go/autoload/go/path.vim | 166 +- .../vim-go/autoload/go/play.vim | 119 +- .../vim-go/autoload/go/rename.vim | 117 +- .../vim-go/autoload/go/term.vim | 174 +- .../vim-go/autoload/go/textobj.vim | 2 +- .../vim-go/autoload/go/tool.vim | 196 +- sources_non_forked/vim-go/autoload/go/ui.vim | 155 +- .../vim-go/autoload/go/util.vim | 122 +- sources_non_forked/vim-go/compiler/go.vim | 6 +- .../vim-go/ftdetect/gofiletype.vim | 14 +- sources_non_forked/vim-go/ftplugin/asm.vim | 4 +- sources_non_forked/vim-go/ftplugin/go.vim | 46 +- .../vim-go/ftplugin/go/commands.vim | 2 +- .../vim-go/ftplugin/go/mappings.vim | 10 +- .../vim-go/ftplugin/go/snippets.vim | 52 +- .../vim-go/ftplugin/go/tagbar.vim | 74 +- .../vim-go/ftplugin/gohtmltmpl.vim | 4 +- sources_non_forked/vim-go/indent/go.vim | 80 +- .../vim-go/indent/gohtmltmpl.vim | 2 + sources_non_forked/vim-go/plugin/go.vim | 255 +- sources_non_forked/vim-go/syntax/go.vim | 58 +- .../vim-go/syntax/godefstack.vim | 4 +- .../vim-go/syntax/gohtmltmpl.vim | 6 +- .../vim-go/syntax/gotexttmpl.vim | 4 +- sources_non_forked/vim-go/syntax/vimgo.vim | 4 +- .../vim-snipmate/autoload/snipMate.vim | 2 +- .../UltiSnips/htmldjango.snippets | 2 +- .../vim-snippets/UltiSnips/java.snippets | 19 +- .../vim-snippets/UltiSnips/json.snippets | 33 +- .../UltiSnips/php-phpspec.snippets | 8 +- .../vim-snippets/UltiSnips/php.snippets | 22 +- .../vim-snippets/snippets/eelixir.snippets | 2 + .../vim-snippets/snippets/php.snippets | 21 +- .../vim-snippets/snippets/sass.snippets | 36 + .../vim-snippets/snippets/tex.snippets | 64 +- 74 files changed, 10264 insertions(+), 3014 deletions(-) create mode 100644 sources_non_forked/syntastic/doc/syntastic-checkers.txt create mode 100644 sources_non_forked/syntastic/syntax_checkers/javascript/tern_lint.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/sass/sass_lint.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/scss/sass_lint.vim create mode 100644 sources_non_forked/vim-snippets/snippets/sass.snippets diff --git a/sources_non_forked/ack.vim/autoload/ack.vim b/sources_non_forked/ack.vim/autoload/ack.vim index 82d3de65..dbf84572 100644 --- a/sources_non_forked/ack.vim/autoload/ack.vim +++ b/sources_non_forked/ack.vim/autoload/ack.vim @@ -1,3 +1,7 @@ +if exists('g:autoloaded_ack') || &cp + finish +endif + if exists('g:ack_use_dispatch') if g:ack_use_dispatch && !exists(':Dispatch') call s:Warn('Dispatch not loaded! Falling back to g:ack_use_dispatch = 0.') @@ -238,4 +242,5 @@ function! s:Warn(msg) "{{{ echohl WarningMsg | echomsg 'Ack: ' . a:msg | echohl None endf "}}} +let g:autoloaded_ack = 1 " vim:set et sw=2 ts=2 tw=78 fdm=marker diff --git a/sources_non_forked/ack.vim/doc/ack.txt b/sources_non_forked/ack.vim/doc/ack.txt index 750f7c5a..33939516 100644 --- a/sources_non_forked/ack.vim/doc/ack.txt +++ b/sources_non_forked/ack.vim/doc/ack.txt @@ -4,6 +4,10 @@ Author: Antoine Imbert *ack-author* License: Same terms as Vim itself (see |license|) +This plugin is only available if 'compatible' is not set. + +{Vi does not have any of this} + ============================================================================== INTRODUCTION *ack* @@ -16,7 +20,7 @@ shows the results in a split window. Search recursively in {directory} (which defaults to the current directory) for the {pattern}. Behaves just like the |:grep| command, but will open the |Quickfix| window for you. If [!] is not given the first - occurence is jumped to. + occurrence is jumped to. :AckAdd [options] {pattern} [{directory}] *:AckAdd* @@ -90,7 +94,6 @@ Example: > let g:ackprg = "ag --vimgrep" < - *g:ack_default_options* g:ack_default_options Default: " -s -H --nocolor --nogroup --column" @@ -107,18 +110,17 @@ Example: let g:ack_default_options = \ " -s -H --nocolor --nogroup --column --smart-case --follow" < - *g:ack_apply_qmappings* g:ack_apply_qmappings Default: 1 -This option enable mappings on quickview window. +This option enables mappings on the |quickfix| window. *g:ack_apply_lmappings* g:ack_apply_lmappings Default: 1 -This option enable mappings on Location list window. +This option enables mappings on |location-list| windows. *g:ack_mappings* g:ack_mappings @@ -139,7 +141,6 @@ Example, if you want to open the result in the middle of the screen: > let g:ack_mappings = { "o": "zz" } < - *g:ack_qhandler* g:ack_qhandler Default: "botright copen" @@ -150,7 +151,6 @@ If you want to open a quickview window with 30 lines you can do: > let g:ack_qhandler = "botright copen 30" < - *g:ack_lhandler* g:ack_lhandler Default: "botright lopen" @@ -161,9 +161,7 @@ If you want to open a Location list window with 30 lines you can do: > let g:ack_lhandler = "botright lopen 30" < - *g:ackhighlight* - g:ackhighlight Default: 0 @@ -173,7 +171,6 @@ Example: > let g:ackhighlight = 1 < - *g:ack_autoclose* g:ack_autoclose Default: 0 @@ -185,9 +182,7 @@ Example: > let g:ack_autoclose = 1 < - *g:ack_autofold_results* - g:ack_autofold_results Default: 0 @@ -200,9 +195,7 @@ Example: > let g:ack_autofold_results = 1 < - *g:ackpreview* - g:ackpreview Default: 0 @@ -212,9 +205,7 @@ Example: > let g:ackpreview = 1 < - *g:ack_use_dispatch* - g:ack_use_dispatch Default: 0 @@ -229,9 +220,7 @@ Example: > let g:ack_use_dispatch = 1 < - *g:ack_use_cword_for_empty_search* - g:ack_use_cword_for_empty_search Default: 1 @@ -239,34 +228,76 @@ Use this option to enable blank searches to run against the word under the cursor. When this option is not set, blank searches will only output an error message. - Example: > let g:ack_use_cword_for_empty_search = 0 < - - ============================================================================== MAPPINGS *ack-mappings* -The following keyboard shortcuts are available in the quickfix window: +The following keyboard shortcuts are available in the |quickfix| and +|location-list| windows: -o open file (same as enter). +? display a quick summary of these mappings. -O open file and close quickfix window. +o open file (same as Enter). + +O open file and close the quickfix window. go preview file (open but maintain focus on ack.vim results). t open in a new tab. -T open in new tab silently. +T open in new tab without moving to it. h open in horizontal split. -H open in horizontal split silently. +H open in horizontal split, keeping focus on the results. v open in vertical split. -gv open in vertical split silently. +gv open in vertical split, keeping focus on the results. q close the quickfix window. + +To adjust these, see |g:ack_mappings|. + +============================================================================== +Ignoring files *ack-ignore* + +If you're using this plugin with ag, The Silver Searcher, bear in mind that: + + - It ignores file patterns from your .gitignore and .hgignore. + + - If there are other files in your source repository you don't wish to + search, you can add their patterns to an .agignore file. + +============================================================================== +ISSUES AND FAQ *ack-issues-and-faq* + +I use NERDTree and opening ack.vim results in a vertical split displaces it.~ + + You are probably using NERDTree with its default alignment at the left + side of the window. Set these custom mappings in your vimrc to work around + this: +> + let g:ack_mappings = { + \ 'v': 'LpJp', + \ 'gv': 'LpJ' } +< + This solution will be improved in the future. + +Results show a mix of relative and absolute paths, making them hard to read.~ + + This is a quirk of Vim that can happen with plain |:vimgrep| too. You can + try this in your vimrc to work around it: +> + autocmd BufAdd * exe "cd" fnameescape(getcwd()) +< + but for some users this may be disruptive to their Vim workflow. For more + details, see: + + http://vi.stackexchange.com/a/4816/7174 + https://github.com/mileszs/ack.vim/issues/143 + +vim:set et sw=4 ts=4 tw=78: diff --git a/sources_non_forked/ack.vim/plugin/ack.vim b/sources_non_forked/ack.vim/plugin/ack.vim index 8d18f569..202ae2ea 100644 --- a/sources_non_forked/ack.vim/plugin/ack.vim +++ b/sources_non_forked/ack.vim/plugin/ack.vim @@ -1,4 +1,4 @@ -if exists('g:loaded_ack') +if exists('g:loaded_ack') || &cp finish endif diff --git a/sources_non_forked/ag.vim/README.md b/sources_non_forked/ag.vim/README.md index 9e43262a..e02a4d3e 100644 --- a/sources_non_forked/ag.vim/README.md +++ b/sources_non_forked/ag.vim/README.md @@ -1,5 +1,7 @@ # ag.vim # +## Deprecated: See [this comment](https://github.com/rking/ag.vim/issues/124#issuecomment-227038003) for more info. Maybe try [ack.vim](https://github.com/mileszs/ack.vim#can-i-use-ag-the-silver-searcher-with-this) as an alternative. ## + This plugin is a front for ag, A.K.A. [the_silver_searcher](https://github.com/ggreer/the_silver_searcher). Ag can be used as a replacement for 153% of the uses of `ack`. This plugin will allow diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim index d8601794..04f1aa85 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim @@ -93,6 +93,7 @@ let [s:pref, s:bpref, s:opts, s:new_opts, s:lc_opts] = \ 'open_single_match': ['s:opensingle', []], \ 'brief_prompt': ['s:brfprt', 0], \ 'match_current_file': ['s:matchcrfile', 0], + \ 'match_natural_name': ['s:matchnatural', 0], \ 'compare_lim': ['s:compare_lim', 3000], \ 'bufname_mod': ['s:bufname_mod', ':t'], \ 'bufpath_mod': ['s:bufpath_mod', ':~:.:h'], @@ -425,7 +426,7 @@ fu! s:UserCmd(lscmd) let do_ign = \ type(s:usrcmd) == 4 && has_key(s:usrcmd, 'ignore') && s:usrcmd['ignore'] if do_ign && ctrlp#igncwd(s:cwd) | retu | en - if exists('+ssl') && &ssl + if exists('+ssl') && &ssl && &shell !~ 'sh' let [ssl, &ssl, path] = [&ssl, 0, tr(path, '/', '\')] en if (has('win32') || has('win64')) && match(&shellcmdflag, "/") != -1 @@ -653,9 +654,9 @@ fu! s:Update(str) endf fu! s:ForceUpdate() - let wv = winsaveview() + let pos = exists('*getcurpos') ? getcurpos() : getpos('.') sil! cal s:Update(escape(s:getinput(), '\')) - cal winrestview(wv) + cal setpos('.', pos) endf fu! s:BuildPrompt(upd) @@ -839,9 +840,9 @@ fu! s:PrtSelectMove(dir) let wht = winheight(0) let dirs = {'t': 'gg','b': 'G','j': 'j','k': 'k','u': wht.'k','d': wht.'j'} exe 'keepj norm!' dirs[a:dir] - let wv = winsaveview() + let pos = exists('*getcurpos') ? getcurpos() : getpos('.') cal s:BuildPrompt(0) - cal winrestview(wv) + cal setpos('.', pos) endf fu! s:PrtSelectJump(char) @@ -864,9 +865,9 @@ fu! s:PrtSelectJump(char) let [jmpln, s:jmpchr] = [npos == -1 ? pos : npos, [chr, npos]] en exe 'keepj norm!' ( jmpln + 1 ).'G' - let wv = winsaveview() + let pos = exists('*getcurpos') ? getcurpos() : getpos('.') cal s:BuildPrompt(0) - cal winrestview(wv) + cal setpos('.', pos) en endf " Misc {{{2 @@ -907,6 +908,7 @@ fu! s:PrtDeleteMRU() endf fu! s:PrtExit() + exe bufwinnr(s:bufnr).'winc w' if bufnr('%') == s:bufnr && bufname('%') == 'ControlP' noa cal s:Close(1) noa winc p @@ -1822,7 +1824,7 @@ fu! s:highlight(pat, grp) " occurrence of our letters. We also ensure that our matcher is case " insensitive or sensitive depending. cal matchadd(a:grp, beginning.middle.ending) - endfor + endfo en cal matchadd('CtrlPLinePre', '^>') @@ -2346,9 +2348,16 @@ endf fu! s:buildpat(lst) let pat = a:lst[0] - for item in range(1, len(a:lst) - 1) - let pat .= '[^'.a:lst[item - 1].']\{-}'.a:lst[item] - endfo + if s:matchnatural == 1 + for item in range(1, len(a:lst) - 1) + let c = a:lst[item - 1] + let pat .= (c == '/' ? '[^/]\{-}' : '[^'.c.'/]\{-}').a:lst[item] + endfo + else + for item in range(1, len(a:lst) - 1) + let pat .= '[^'.a:lst[item - 1].']\{-}'.a:lst[item] + endfo + en retu pat endf diff --git a/sources_non_forked/lightline.vim/autoload/lightline.vim b/sources_non_forked/lightline.vim/autoload/lightline.vim index 769fa7d9..045e2b85 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline.vim @@ -2,7 +2,7 @@ " Filename: autoload/lightline.vim " Author: itchyny " License: MIT License -" Last Change: 2016/06/11 14:05:27. +" Last Change: 2016/06/12 22:40:00. " ============================================================================= let s:save_cpo = &cpo @@ -263,7 +263,7 @@ endif function! lightline#highlight(...) abort let [c, f] = [s:lightline.palette, s:lightline.mode_fallback] let [s:lightline.llen, s:lightline.rlen] = [len(c.normal.left), len(c.normal.right)] - let [s:lightline.tab_llen, s:lightline.tab_rlen] = [len(has_key(get(c, 'tabline', {}), 'left') ? c.tabline.left : c.normal.left), len(has_key(get(c, 'tabline', {}), 'right') ? c.tabline.right : c.normal.right)] + let [s:lightline.tab_llen, s:lightline.tab_rlen] = [len(has_key(get(c, 'tabline', {}), 'left') ? c.tabline.left : c.normal.left), len(has_key(get(c, 'tabline', {}), 'right') ? c.tabline.right : c.normal.right)] let types = map(s:uniq(sort(filter(values(s:lightline.component_type), 'v:val !=# "raw"'))), '[v:val, 1]') let modes = a:0 ? [a:1] : extend(['normal', 'insert', 'replace', 'visual', 'inactive', 'command', 'select', 'tabline'], has('nvim') ? ['terminal'] : []) for mode in modes @@ -293,7 +293,7 @@ function! lightline#highlight(...) abort endfunction function! s:subseparator(components, subseparator, expanded) abort - let [a, c, f, v] = [ a:components, s:lightline.component, s:lightline.component_function, s:lightline.component_visible_condition ] + let [a, c, f, v] = [ a:components, s:lightline.component, s:lightline.component_function, s:lightline.component_visible_condition ] let xs = map(range(len(a:components)), 'a:expanded[v:val] ? "1" : \ has_key(f, a[v:val]) ? (exists("*".f[a[v:val]]) ? "" : "exists(\"*".f[a[v:val]]."\")&&").f[a[v:val]]."()!=#\"\"" : \ has_key(v, a[v:val]) ? "(" . v[a[v:val]] . ")" : has_key(c, a[v:val]) ? "1" : "0"') diff --git a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim index 0912faff..2aa3bece 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim @@ -187,17 +187,17 @@ endfunction " closes the parent dir of the current node function! s:closeCurrentDir(node) let parent = a:node.parent + while g:NERDTreeCascadeOpenSingleChildDir && !parent.isRoot() + let childNodes = parent.getVisibleChildren() + if len(childNodes) == 1 && childNodes[0].path.isDirectory + let parent = parent.parent + else + break + endif + endwhile if parent ==# {} || parent.isRoot() call nerdtree#echo("cannot close tree root") else - while g:NERDTreeCascadeOpenSingleChildDir && !parent.parent.isRoot() - if parent.parent.getVisibleChildCount() == 1 - call parent.close() - let parent = parent.parent - else - break - endif - endwhile call parent.close() call b:NERDTree.render() call parent.putCursorHere(0, 0) diff --git a/sources_non_forked/syntastic/CONTRIBUTING.md b/sources_non_forked/syntastic/CONTRIBUTING.md index 6dd17758..1949415e 100644 --- a/sources_non_forked/syntastic/CONTRIBUTING.md +++ b/sources_non_forked/syntastic/CONTRIBUTING.md @@ -11,7 +11,7 @@ ## 1. Bug reports / GitHub issues Please note that the preferred channel for posting bug reports is the -[issue tracker at GitHub][0]. Reports posted elsewhere are less likely +[issue tracker at GitHub][bug_tracker]. Reports posted elsewhere are less likely to be seen by the core team. When reporting a bug make sure you search the existing GitHub issues @@ -39,14 +39,14 @@ too: ## 2. Submitting a patch Before you consider adding features to syntastic, _please_ spend a few minutes -(re-)reading the latest version of the [manual][1]. Syntastic is changing +(re-)reading the latest version of the [manual][manual]. Syntastic is changing rapidly at times, and it's possible that some features you want to add exist already. To submit a patch: -* fork the [repo][2] on GitHub; -* make a [topic branch][3] and start hacking; +* fork the [repo][github] on GitHub; +* make a [topic branch][branches] and start hacking; * submit a pull request based off your topic branch. Small, focused patches are preferred. @@ -69,14 +69,14 @@ Follow the coding conventions/styles used in the syntastic core: * don't use `l:` prefixes for variables unless actually required (i.e. almost never); * code for maintainability; we would rather a function be a couple of -lines longer and have (for example) some [explaining variables][4] to +lines longer and have (for example) some [explaining variables][variables] to aid readability. ## 4. Syntax checker notes -Make sure to read the [guide][5] if you plan to add new syntax checkers. +Make sure to read the [guide][guide] if you plan to add new syntax checkers. Use the existing checkers as templates, rather than writing everything from scratch. @@ -97,9 +97,9 @@ let errorformat = \ '%-G%.%#' ``` -[0]: https://github.com/scrooloose/syntastic/issues -[1]: https://github.com/scrooloose/syntastic/blob/master/doc/syntastic.txt -[2]: https://github.com/scrooloose/syntastic -[3]: https://github.com/dchelimsky/rspec/wiki/Topic-Branches#using-topic-branches-when-contributing-patches -[4]: http://www.refactoring.com/catalog/extractVariable.html -[5]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide +[bug_tracker]: https://github.com/scrooloose/syntastic/issues +[manual]: https://github.com/scrooloose/syntastic/blob/master/doc/syntastic.txt +[github]: https://github.com/scrooloose/syntastic +[branches]: https://github.com/dchelimsky/rspec/wiki/Topic-Branches#using-topic-branches-when-contributing-patches +[variables]: http://www.refactoring.com/catalog/extractVariable.html +[guide]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide diff --git a/sources_non_forked/syntastic/README.markdown b/sources_non_forked/syntastic/README.markdown index 07106032..685d8408 100644 --- a/sources_non_forked/syntastic/README.markdown +++ b/sources_non_forked/syntastic/README.markdown @@ -46,37 +46,38 @@ ## 1\. Introduction -Syntastic is a syntax checking plugin for [Vim][13] that runs files through +Syntastic is a syntax checking plugin for [Vim][vim] that runs files through external syntax checkers and displays any resulting errors to the user. This 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, ASM, -BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal, Chef, CoffeeScript, Coco, -Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dockerfile, Dust, Elixir, +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 [wiki][3] for -details about the corresponding supported checkers. +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][30], [omnisharp-vim][25], [rust.vim][12], -[syntastic-extras][26], [syntastic-more][27], [vim-crystal][29], -[vim-eastwood][28], and [vim-swift][24]. +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]. 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 enabled. -![Screenshot 1][0] +![Screenshot 1][screenshot] 1. Errors are loaded into the location list for the corresponding window. 2. When the cursor is on a line containing an error, the error message is echoed in the command window. @@ -94,7 +95,7 @@ enabled. ### 2.1\. Requirements Syntastic itself has rather relaxed requirements: it doesn't have any external -dependencies, and it needs a version of [Vim][13] compiled with a few common +dependencies, and it needs a version of [Vim][vim] compiled with a few common features: `autocmd`, `eval`, `file_in_path`, `modify_fname`, `quickfix`, `reltime`, and `user_commands`. Not all possible combinations of features that include the ones above make equal sense on all operating systems, but Vim @@ -102,8 +103,8 @@ version 7 or later with the "normal", "big", or "huge" feature sets should be fine. Syntastic should work with any modern plugin managers for Vim, such as -[NeoBundle][14], [Pathogen][1], [Vim-Addon-Manager][15], [Vim-Plug][16], or -[Vundle][17]. Instructions for installing syntastic with [Pathogen][1] are +[NeoBundle][neobundle], [Pathogen][pathogen], [Vim-Addon-Manager][vam], [Vim-Plug][plug], or +[Vundle][vundle]. Instructions for installing syntastic with [Pathogen][pathogen] are included below for completeness. Starting with Vim version 7.4.1486 you can also load syntastic using the @@ -115,20 +116,21 @@ syntastic is present only in versions 7.4.1486 and later. Last but not least: syntastic doesn't know how to do any syntax checks by itself. In order to get meaningful results you need to install external checkers corresponding to the types of files you use. Please consult the -[wiki][3] for a list of supported checkers. +[manual][checkers] (`:help syntastic-checkers` in Vim) for a list of supported +checkers. ### 2.2\. Installing syntastic with Pathogen -If you already have [Pathogen][1] working then skip [Step 1](#step1) and go to +If you already have [Pathogen][pathogen] working then skip [Step 1](#step1) and go to [Step 2](#step2). #### 2.2.1\. Step 1: Install pathogen.vim -First I'll show you how to install Tim Pope's [Pathogen][1] so that it's easy to +First I'll show you how to install Tim Pope's [Pathogen][pathogen] so that it's easy to install syntastic. Do this in your terminal so that you get the `pathogen.vim` file and the directories it needs: ```sh @@ -155,7 +157,7 @@ Quit vim and start it back up to reload it, then type: :Helptags ``` If you get an error when you do this, then you probably didn't install -[Pathogen][1] right. Go back to [Step 1](#step1) and make sure you did the +[Pathogen][pathogen] right. Go back to [Step 1](#step1) and make sure you did the following: 1. Created both the `~/.vim/autoload` and `~/.vim/bundle` directories. @@ -192,10 +194,11 @@ __4.1. Q. I installed syntastic but it isn't reporting any errors...__ A. The most likely reason is that none of the syntax checkers that it requires are installed. For example: by default, python requires either `flake8` or -`pylint` to be installed and in your `$PATH`. To see which executables are -supported, look at the [wiki][3]. Note that aliases do not work; the actual -executables must be available in your `$PATH`. Symbolic links are okay though. -You can see syntastic's idea of available checkers by running `:SyntasticInfo`. +`pylint` to be installed and in your `$PATH`. Read the [manual][checkers] +(`:help syntastic-checkers` in Vim) to find out what executables are +supported. Note that aliases do not work; the actual executables must be +available in your `$PATH`. Symbolic links are okay though. You can see +syntastic's idea of available checkers by running `:SyntasticInfo`. A second probable reason is that none of the available checkers are enabled. Syntastic comes preconfigured with a default list of enabled checkers @@ -222,7 +225,7 @@ on Windows. Finally, another reason it could fail is that either the command line options or the error output for a syntax checker may have changed. In this case, make sure you have the latest version of the syntax checker installed. If it still -fails then post an [issue][4] - or better yet, create a pull request. +fails then post an [issue][bug_tracker] - or better yet, create a pull request. @@ -238,18 +241,18 @@ let g:syntastic_python_python_exec = '/path/to/python3' __4.3. Q. Are there any local checkers for HTML5 that I can use with syntastic?__ -[HTML Tidy][18] has a fork named [HTML Tidy for HTML5][19]. It's a drop +[HTML Tidy][tidy_old] has a fork named [HTML Tidy for HTML5][tidy]. It's a drop in replacement, and syntastic can use it without changes. Just install it somewhere and point `g:syntastic_html_tidy_exec` to its executable: ```vim let g:syntastic_html_tidy_exec = 'tidy5' ``` -Alternatively, you can install [vnu.jar][21] from the [validator.nu][20] -project and run it as a [HTTP server][23]: +Alternatively, you can install [vnu.jar][vnu_jar] from the [validator.nu][vnu] +project and run it as a [HTTP server][vnu_server]: ```sh $ java -Xss512k -cp /path/to/vnu.jar nu.validator.servlet.Main 8888 ``` -Then you can [configure][22] syntastic to use it: +Then you can configure syntastic to use it: ```vim let g:syntastic_html_validator_api = 'http://localhost:8888/' ``` @@ -260,7 +263,7 @@ __4.4. Q. The `perl` checker has stopped working...__ A. The `perl` checker runs `perl -c` against your file, which in turn __executes__ any `BEGIN`, `UNITCHECK`, and `CHECK` blocks, and any `use` -statements in your file (cf. [perlrun][10]). This is probably fine if you +statements in your file (cf. [perlrun][perlrun]). This is probably fine if you wrote the file yourself, but it's a security problem if you're checking third-party files. Since there is currently no way to disable this behaviour while still producing useful results, the checker is now disabled by default. @@ -274,7 +277,7 @@ let g:syntastic_enable_perl_checker = 1 __4.5. Q. What happened to the `rustc` checker?__ -A. It is now part of the [rust.vim][12] plugin. If you install this plugin the +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. @@ -282,7 +285,7 @@ checker should be picked up automatically by syntastic. __4.6. 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][24] plugin. If you +A better checker for __Swift__ is part of the [vim-swift][swift] plugin. If you install this plugin the checker should be picked up automatically by syntastic. @@ -324,8 +327,8 @@ A. Stick a line like this in your `vimrc`: let g:syntastic__checkers = [''] ``` -To see the list of supported checkers for your filetype look at the -[wiki][3]. +To see the list of supported checkers for your filetype read the +[manual][checkers] (`:help syntastic-checkers` in Vim). e.g. Python has the following checkers, among others: `flake8`, `pyflakes`, `pylint` and a native `python` checker. @@ -406,7 +409,7 @@ A. Vim provides several built-in commands for this. See `:help :lnext` and `:help :lprevious`. If you use these commands a lot then you may want to add shortcut mappings to -your `vimrc`, or install something like [unimpaired][2], which provides such +your `vimrc`, or install something like [unimpaired][unimpaired], which provides such mappings (among other things). @@ -427,50 +430,50 @@ cabbrev bd =(getcmdtype()==#':' && getcmdpos()==1 ? 'lclose\|bdele ## 5\. Resources The preferred place for posting suggestions, reporting bugs, and general -discussions related to syntastic is the [issue tracker at GitHub][4]. -A guide for writing syntax checkers can be found in the [wiki][11]. -There are also a dedicated [google group][5], and a -[syntastic tag at StackOverflow][6]. +discussions related to syntastic is the [issue tracker at GitHub][bug_tracker]. +A guide for writing syntax checkers can be found in the [wiki][guide]. +There are also a dedicated [google group][google_group], and a +[syntastic tag at StackOverflow][stack_overflow]. Syntastic aims to provide a common interface to syntax checkers for as many languages as possible. For particular languages, there are, of course, other plugins that provide more functionality than syntastic. You might want to take -a look at [ghcmod-vim][31], [jedi-vim][7], [python-mode][8], [vim-go][32], or -[YouCompleteMe][9]. +a look at [ghcmod-vim][ghcmod], [jedi-vim][jedi], [python-mode][python_mode], [vim-go][vimgo], or +[YouCompleteMe][ycm]. -[0]: https://github.com/scrooloose/syntastic/raw/master/_assets/screenshot_1.png -[1]: https://github.com/tpope/vim-pathogen -[2]: https://github.com/tpope/vim-unimpaired -[3]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers -[4]: https://github.com/scrooloose/syntastic/issues -[5]: https://groups.google.com/group/vim-syntastic -[6]: http://stackoverflow.com/questions/tagged/syntastic -[7]: https://github.com/davidhalter/jedi-vim -[8]: https://github.com/klen/python-mode -[9]: http://valloric.github.io/YouCompleteMe/ -[10]: http://perldoc.perl.org/perlrun.html#*-c* -[11]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide -[12]: https://github.com/rust-lang/rust.vim -[13]: http://www.vim.org/ -[14]: https://github.com/Shougo/neobundle.vim -[15]: https://github.com/MarcWeber/vim-addon-manager -[16]: https://github.com/junegunn/vim-plug/ -[17]: https://github.com/gmarik/Vundle.vim -[18]: http://tidy.sourceforge.net/ -[19]: http://www.htacg.org/tidy-html5/ -[20]: http://about.validator.nu/ -[21]: https://github.com/validator/validator/releases/latest -[22]: https://github.com/scrooloose/syntastic/wiki/HTML%3A---validator -[23]: http://validator.github.io/validator/#standalone -[24]: https://github.com/kballard/vim-swift -[25]: https://github.com/OmniSharp/omnisharp-vim -[26]: https://github.com/myint/syntastic-extras -[27]: https://github.com/roktas/syntastic-more -[28]: https://github.com/venantius/vim-eastwood -[29]: https://github.com/rhysd/vim-crystal -[30]: https://github.com/the-lambda-church/merlin -[31]: https://github.com/eagletmt/ghcmod-vim -[32]: https://github.com/fatih/vim-go +[screenshot]: https://github.com/scrooloose/syntastic/raw/master/_assets/screenshot_1.png + +[bug_tracker]: https://github.com/scrooloose/syntastic/issues +[checkers]: https://github.com/scrooloose/syntastic/blob/master/doc/syntastic-checkers.txt +[crystal]: https://github.com/rhysd/vim-crystal +[eastwood]: https://github.com/venantius/vim-eastwood +[ghcmod]: https://github.com/eagletmt/ghcmod-vim +[google_group]: https://groups.google.com/group/vim-syntastic +[guide]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide +[jedi]: https://github.com/davidhalter/jedi-vim +[merlin]: https://github.com/the-lambda-church/merlin +[myint]: https://github.com/myint/syntastic-extras +[neobundle]: https://github.com/Shougo/neobundle.vim +[omnisharp]: https://github.com/OmniSharp/omnisharp-vim +[pathogen]: https://github.com/tpope/vim-pathogen +[perlrun]: http://perldoc.perl.org/perlrun.html#*-c* +[plug]: https://github.com/junegunn/vim-plug/ +[python_mode]: https://github.com/klen/python-mode +[roktas]: https://github.com/roktas/syntastic-more +[rust]: https://github.com/rust-lang/rust.vim +[stack_overflow]: http://stackoverflow.com/questions/tagged/syntastic +[swift]: https://github.com/kballard/vim-swift +[tidy]: http://www.htacg.org/tidy-html5/ +[tidy_old]: http://tidy.sourceforge.net/ +[unimpaired]: https://github.com/tpope/vim-unimpaired +[vam]: https://github.com/MarcWeber/vim-addon-manager +[vim]: http://www.vim.org/ +[vimgo]: https://github.com/fatih/vim-go +[vnu]: http://about.validator.nu/ +[vnu_jar]: https://github.com/validator/validator/releases/latest +[vnu_server]: http://validator.github.io/validator/#standalone +[vundle]: https://github.com/gmarik/Vundle.vim +[ycm]: http://valloric.github.io/YouCompleteMe/ + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/indent/go.vim b/sources_non_forked/vim-go/indent/go.vim index a3fa2b7a..ba99d54d 100644 --- a/sources_non_forked/vim-go/indent/go.vim +++ b/sources_non_forked/vim-go/indent/go.vim @@ -9,7 +9,7 @@ " - general line splits (line ends in an operator) if exists("b:did_indent") - finish + finish endif let b:did_indent = 1 @@ -21,58 +21,58 @@ setlocal indentexpr=GoIndent(v:lnum) setlocal indentkeys+=<:>,0=},0=) if exists("*GoIndent") - finish + finish endif " use shiftwidth function only if it's available if exists('*shiftwidth') - func s:sw() - return shiftwidth() - endfunc + func s:sw() + return shiftwidth() + endfunc else - func s:sw() - return &sw - endfunc + func s:sw() + return &sw + endfunc endif function! GoIndent(lnum) - let prevlnum = prevnonblank(a:lnum-1) - if prevlnum == 0 - " top of file - return 0 - endif + let prevlnum = prevnonblank(a:lnum-1) + if prevlnum == 0 + " top of file + return 0 + endif - " grab the previous and current line, stripping comments. - let prevl = substitute(getline(prevlnum), '//.*$', '', '') - let thisl = substitute(getline(a:lnum), '//.*$', '', '') - let previ = indent(prevlnum) + " grab the previous and current line, stripping comments. + let prevl = substitute(getline(prevlnum), '//.*$', '', '') + let thisl = substitute(getline(a:lnum), '//.*$', '', '') + let previ = indent(prevlnum) - let ind = previ + let ind = previ - if prevl =~ '[({]\s*$' - " previous line opened a block - let ind += s:sw() - endif - if prevl =~# '^\s*\(case .*\|default\):$' - " previous line is part of a switch statement - let ind += s:sw() - endif - " TODO: handle if the previous line is a label. + if prevl =~ '[({]\s*$' + " previous line opened a block + let ind += s:sw() + endif + if prevl =~# '^\s*\(case .*\|default\):$' + " previous line is part of a switch statement + let ind += s:sw() + endif + " TODO: handle if the previous line is a label. - if thisl =~ '^\s*[)}]' - " this line closed a block - let ind -= s:sw() - endif + if thisl =~ '^\s*[)}]' + " this line closed a block + let ind -= s:sw() + endif - " Colons are tricky. - " We want to outdent if it's part of a switch ("case foo:" or "default:"). - " We ignore trying to deal with jump labels because (a) they're rare, and - " (b) they're hard to disambiguate from a composite literal key. - if thisl =~# '^\s*\(case .*\|default\):$' - let ind -= s:sw() - endif + " Colons are tricky. + " We want to outdent if it's part of a switch ("case foo:" or "default:"). + " We ignore trying to deal with jump labels because (a) they're rare, and + " (b) they're hard to disambiguate from a composite literal key. + if thisl =~# '^\s*\(case .*\|default\):$' + let ind -= s:sw() + endif - return ind + return ind endfunction -" vim:ts=4:sw=4:et +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/indent/gohtmltmpl.vim b/sources_non_forked/vim-go/indent/gohtmltmpl.vim index 94ea135a..d95cbc24 100644 --- a/sources_non_forked/vim-go/indent/gohtmltmpl.vim +++ b/sources_non_forked/vim-go/indent/gohtmltmpl.vim @@ -42,3 +42,5 @@ function! GetGoHTMLTmplIndent(lnum) return ind endfunction + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/plugin/go.vim b/sources_non_forked/vim-go/plugin/go.vim index 779f4e1b..f0d6c8d3 100644 --- a/sources_non_forked/vim-go/plugin/go.vim +++ b/sources_non_forked/vim-go/plugin/go.vim @@ -1,26 +1,26 @@ " install necessary Go tools if exists("g:go_loaded_install") - finish + finish endif let g:go_loaded_install = 1 " these packages are used by vim-go and can be automatically installed if " needed by the user with GoInstallBinaries let s:packages = [ - \ "github.com/nsf/gocode", - \ "github.com/alecthomas/gometalinter", - \ "golang.org/x/tools/cmd/goimports", - \ "golang.org/x/tools/cmd/guru", - \ "golang.org/x/tools/cmd/gorename", - \ "github.com/golang/lint/golint", - \ "github.com/rogpeppe/godef", - \ "github.com/kisielk/errcheck", - \ "github.com/jstemmer/gotags", - \ "github.com/klauspost/asmfmt/cmd/asmfmt", - \ "github.com/fatih/motion", - \ "github.com/zmb3/gogetdoc", - \ "github.com/josharian/impl", - \ ] + \ "github.com/nsf/gocode", + \ "github.com/alecthomas/gometalinter", + \ "golang.org/x/tools/cmd/goimports", + \ "golang.org/x/tools/cmd/guru", + \ "golang.org/x/tools/cmd/gorename", + \ "github.com/golang/lint/golint", + \ "github.com/rogpeppe/godef", + \ "github.com/kisielk/errcheck", + \ "github.com/jstemmer/gotags", + \ "github.com/klauspost/asmfmt/cmd/asmfmt", + \ "github.com/fatih/motion", + \ "github.com/zmb3/gogetdoc", + \ "github.com/josharian/impl", + \ ] " These commands are available on any filetypes command! GoInstallBinaries call s:GoInstallBinaries(-1) @@ -33,145 +33,144 @@ command! -nargs=? -complete=dir GoPath call go#path#GoPath() " target install directory. GoInstallBinaries doesn't install binaries if they " exist, to update current binaries pass 1 to the argument. function! s:GoInstallBinaries(updateBinaries) - if $GOPATH == "" - echohl Error - echomsg "vim.go: $GOPATH is not set" - echohl None - return + if $GOPATH == "" + echohl Error + echomsg "vim.go: $GOPATH is not set" + echohl None + return + endif + + let err = s:CheckBinaries() + if err != 0 + return + endif + + let go_bin_path = go#path#BinPath() + + " change $GOBIN so go get can automatically install to it + let $GOBIN = go_bin_path + + " old_path is used to restore users own path + let old_path = $PATH + + " vim's executable path is looking in PATH so add our go_bin path to it + let $PATH = go_bin_path . go#util#PathListSep() . $PATH + + " when shellslash is set on MS-* systems, shellescape puts single quotes + " around the output string. cmd on Windows does not handle single quotes + " correctly. Unsetting shellslash forces shellescape to use double quotes + " instead. + let resetshellslash = 0 + if has('win32') && &shellslash + let resetshellslash = 1 + set noshellslash + endif + + let cmd = "go get -v " + if get(g:, "go_get_update", 1) != 0 + let cmd .= "-u " + endif + + let s:go_version = matchstr(go#util#System("go version"), '\d.\d.\d') + + " https://github.com/golang/go/issues/10791 + if s:go_version > "1.4.0" && s:go_version < "1.5.0" + let cmd .= "-f " + endif + + for pkg in s:packages + let basename = fnamemodify(pkg, ":t") + let binname = "go_" . basename . "_bin" + + let bin = basename + if exists("g:{binname}") + let bin = g:{binname} endif - let err = s:CheckBinaries() - if err != 0 - return + if !executable(bin) || a:updateBinaries == 1 + if a:updateBinaries == 1 + echo "vim-go: Updating ". basename .". Reinstalling ". pkg . " to folder " . go_bin_path + else + echo "vim-go: ". basename ." not found. Installing ". pkg . " to folder " . go_bin_path + endif + + + let out = go#util#System(cmd . shellescape(pkg)) + if go#util#ShellError() != 0 + echo "Error installing ". pkg . ": " . out + endif endif + endfor - let go_bin_path = go#path#BinPath() - - " change $GOBIN so go get can automatically install to it - let $GOBIN = go_bin_path - - " old_path is used to restore users own path - let old_path = $PATH - - " vim's executable path is looking in PATH so add our go_bin path to it - let $PATH = go_bin_path . go#util#PathListSep() . $PATH - - " when shellslash is set on MS-* systems, shellescape puts single quotes - " around the output string. cmd on Windows does not handle single quotes - " correctly. Unsetting shellslash forces shellescape to use double quotes - " instead. - let resetshellslash = 0 - if has('win32') && &shellslash - let resetshellslash = 1 - set noshellslash - endif - - let cmd = "go get -v " - if get(g:, "go_get_update", 1) != 0 - let cmd .= "-u " - endif - - let s:go_version = matchstr(go#util#System("go version"), '\d.\d.\d') - - " https://github.com/golang/go/issues/10791 - if s:go_version > "1.4.0" && s:go_version < "1.5.0" - let cmd .= "-f " - endif - - for pkg in s:packages - let basename = fnamemodify(pkg, ":t") - let binname = "go_" . basename . "_bin" - - let bin = basename - if exists("g:{binname}") - let bin = g:{binname} - endif - - if !executable(bin) || a:updateBinaries == 1 - if a:updateBinaries == 1 - echo "vim-go: Updating ". basename .". Reinstalling ". pkg . " to folder " . go_bin_path - else - echo "vim-go: ". basename ." not found. Installing ". pkg . " to folder " . go_bin_path - endif - - - let out = go#util#System(cmd . shellescape(pkg)) - if go#util#ShellError() != 0 - echo "Error installing ". pkg . ": " . out - endif - endif - endfor - - " restore back! - let $PATH = old_path - if resetshellslash - set shellslash - endif + " restore back! + let $PATH = old_path + if resetshellslash + set shellslash + endif endfunction " CheckBinaries checks if the necessary binaries to install the Go tool " commands are available. function! s:CheckBinaries() - if !executable('go') - echohl Error | echomsg "vim-go: go executable not found." | echohl None - return -1 - endif + if !executable('go') + echohl Error | echomsg "vim-go: go executable not found." | echohl None + return -1 + endif - if !executable('git') - echohl Error | echomsg "vim-go: git executable not found." | echohl None - return -1 - endif + if !executable('git') + echohl Error | echomsg "vim-go: git executable not found." | echohl None + return -1 + endif endfunction " Autocommands " ============================================================================ " function! s:echo_go_info() - if !exists('v:completed_item') || empty(v:completed_item) - return - endif - let item = v:completed_item + if !exists('v:completed_item') || empty(v:completed_item) + return + endif + let item = v:completed_item - if !has_key(item, "info") - return - endif + if !has_key(item, "info") + return + endif - if empty(item.info) - return - endif + if empty(item.info) + return + endif - redraws! | echo "vim-go: " | echohl Function | echon item.info | echohl None + redraws! | echo "vim-go: " | echohl Function | echon item.info | echohl None endfunction augroup vim-go - autocmd! + autocmd! - " GoInfo automatic update - if get(g:, "go_auto_type_info", 0) - autocmd CursorHold *.go nested call go#complete#Info(1) - endif + " GoInfo automatic update + if get(g:, "go_auto_type_info", 0) + autocmd CursorHold *.go nested call go#complete#Info(1) + endif - " 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() - endif + " 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() + endif - " Go code formatting on save - if get(g:, "go_fmt_autosave", 1) - autocmd BufWritePre *.go call go#fmt#Format(-1) - 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 + " 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 + " run gometalinter on save + if get(g:, "go_metalinter_autosave", 0) + autocmd BufWritePost *.go call go#lint#Gometa(1) + endif augroup END - -" vim:ts=4:sw=4:et +" 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 f9cd2cba..f3e73c5c 100644 --- a/sources_non_forked/vim-go/syntax/go.vim +++ b/sources_non_forked/vim-go/syntax/go.vim @@ -68,7 +68,7 @@ if !exists("g:go_highlight_methods") endif if !exists("g:go_highlight_fields") - let g:go_highlight_fields = 0 + let g:go_highlight_fields = 0 endif if !exists("g:go_highlight_structs") @@ -336,35 +336,35 @@ hi def link goInterfaceDef Function " Build Constraints if g:go_highlight_build_constraints != 0 - syn match goBuildKeyword display contained "+build" - " Highlight the known values of GOOS, GOARCH, and other +build options. - syn keyword goBuildDirectives contained - \ android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 - \ solaris windows 386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 - \ ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc - \ s390 s390x sparc sparc64 cgo ignore race + syn match goBuildKeyword display contained "+build" + " Highlight the known values of GOOS, GOARCH, and other +build options. + syn keyword goBuildDirectives contained + \ android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 + \ solaris windows 386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 + \ ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc + \ s390 s390x sparc sparc64 cgo ignore race - " Other words in the build directive are build tags not listed above, so - " avoid highlighting them as comments by using a matchgroup just for the - " start of the comment. - " The rs=s+2 option lets the \s*+build portion be part of the inner region - " instead of the matchgroup so it will be highlighted as a goBuildKeyword. - syn region goBuildComment matchgroup=goBuildCommentStart - \ start="//\s*+build\s"rs=s+2 end="$" - \ contains=goBuildKeyword,goBuildDirectives - hi def link goBuildCommentStart Comment - hi def link goBuildDirectives Type - hi def link goBuildKeyword PreProc + " Other words in the build directive are build tags not listed above, so + " avoid highlighting them as comments by using a matchgroup just for the + " start of the comment. + " The rs=s+2 option lets the \s*+build portion be part of the inner region + " instead of the matchgroup so it will be highlighted as a goBuildKeyword. + syn region goBuildComment matchgroup=goBuildCommentStart + \ start="//\s*+build\s"rs=s+2 end="$" + \ contains=goBuildKeyword,goBuildDirectives + hi def link goBuildCommentStart Comment + hi def link goBuildDirectives Type + hi def link goBuildKeyword PreProc - " One or more line comments that are followed immediately by a "package" - " declaration are treated like package documentation, so these must be - " matched as comments to avoid looking like working build constraints. - " The he, me, and re options let the "package" itself be highlighted by - " the usual rules. - syn region goPackageComment start=/\v(\/\/.*\n)+\s*package/ - \ end=/\v\n\s*package/he=e-7,me=e-7,re=e-7 - \ contains=@goCommentGroup,@Spell - hi def link goPackageComment Comment + " One or more line comments that are followed immediately by a "package" + " declaration are treated like package documentation, so these must be + " matched as comments to avoid looking like working build constraints. + " The he, me, and re options let the "package" itself be highlighted by + " the usual rules. + syn region goPackageComment start=/\v(\/\/.*\n)+\s*package/ + \ end=/\v\n\s*package/he=e-7,me=e-7,re=e-7 + \ contains=@goCommentGroup,@Spell + hi def link goPackageComment Comment endif @@ -376,3 +376,5 @@ endif syn sync minlines=500 let b:current_syntax = "go" + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/syntax/godefstack.vim b/sources_non_forked/vim-go/syntax/godefstack.vim index 7574c21d..e4eefff4 100644 --- a/sources_non_forked/vim-go/syntax/godefstack.vim +++ b/sources_non_forked/vim-go/syntax/godefstack.vim @@ -1,5 +1,5 @@ if exists("b:current_syntax") - finish + finish endif syn match godefStackComment '^".*' @@ -16,3 +16,5 @@ hi def link godefStackComment Comment hi def link godefStackCurrentPosition Special hi def link godefStackFilename Directory hi def link godefStackEntryLocationNumber LineNr + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/syntax/gohtmltmpl.vim b/sources_non_forked/vim-go/syntax/gohtmltmpl.vim index 5aa6c98d..f53fbc67 100644 --- a/sources_non_forked/vim-go/syntax/gohtmltmpl.vim +++ b/sources_non_forked/vim-go/syntax/gohtmltmpl.vim @@ -1,9 +1,9 @@ if exists("b:current_syntax") - finish + finish endif if !exists("main_syntax") - let main_syntax = 'html' + let main_syntax = 'html' endif runtime! syntax/gotexttmpl.vim @@ -12,4 +12,4 @@ unlet b:current_syntax let b:current_syntax = "gohtmltmpl" -" vim:ts=4:sw=4:et +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/syntax/gotexttmpl.vim b/sources_non_forked/vim-go/syntax/gotexttmpl.vim index f8f4e682..de21d7fc 100644 --- a/sources_non_forked/vim-go/syntax/gotexttmpl.vim +++ b/sources_non_forked/vim-go/syntax/gotexttmpl.vim @@ -6,7 +6,7 @@ " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") - finish + finish endif syn case match @@ -82,4 +82,4 @@ hi def link goTplComment Comment let b:current_syntax = "gotexttmpl" -" vim:ts=4:sw=4:et +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/syntax/vimgo.vim b/sources_non_forked/vim-go/syntax/vimgo.vim index d62791d3..3a2204c4 100644 --- a/sources_non_forked/vim-go/syntax/vimgo.vim +++ b/sources_non_forked/vim-go/syntax/vimgo.vim @@ -1,5 +1,5 @@ if exists("b:current_syntax") - finish + finish endif let b:current_syntax = "vimgo" @@ -9,3 +9,5 @@ syn region goTitle start="\%1l" end=":" hi def link goInterface Type hi def link goTitle Label + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-snipmate/autoload/snipMate.vim b/sources_non_forked/vim-snipmate/autoload/snipMate.vim index 2157eeb1..74366fa8 100644 --- a/sources_non_forked/vim-snipmate/autoload/snipMate.vim +++ b/sources_non_forked/vim-snipmate/autoload/snipMate.vim @@ -110,7 +110,7 @@ function! s:build_stops(snippet, stops, lnum, col, indent) abort for line in a:snippet let col = s:build_loc_info(line, stops, lnum, col, []) - if line isnot line[-1] + if line isnot a:snippet[-1] let lnum += 1 let col = a:indent endif diff --git a/sources_non_forked/vim-snippets/UltiSnips/htmldjango.snippets b/sources_non_forked/vim-snippets/UltiSnips/htmldjango.snippets index ad571504..37fa85fd 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/htmldjango.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/htmldjango.snippets @@ -186,7 +186,7 @@ snippet iblock "" bi {% block ${1:blockname} %}${VISUAL}{% endblock $1 %} endsnippet -snippet csfr "" bi +snippet csrf "" bi {% csrf_token %} endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/java.snippets b/sources_non_forked/vim-snippets/UltiSnips/java.snippets index e8eb77cc..54d026df 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/java.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/java.snippets @@ -21,7 +21,7 @@ def nl(snip): snip.rv += " " def getArgs(group): import re - word = re.compile('[a-zA-Z><.]+ \w+') + word = re.compile('[a-zA-Z0-9><.]+ \w+') return [i.split(" ") for i in word.findall(group) ] def camel(word): @@ -109,7 +109,7 @@ for i in args: snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";" if len(args) > 0: snip.rv += "\n"` - public `!p snip.rv = snip.basename or "unknown"`($1) { `!p + public `!p snip.rv = snip.basename or "unknown"`($1) {`!p args = getArgs(t[1]) for i in args: snip.rv += "\n\t\tthis." + i[1] + " = " + i[1] + ";" @@ -123,8 +123,8 @@ for i in args: snip.rv += "\n\tpublic void set" + camel(i[1]) + "(" + i[0] + " " + i[1] + ") {\n" + "\ \tthis." + i[1] + " = " + i[1] + ";\n\t}\n" - snip.rv += "\n\tpublic " + i[0] + " get" + camel(i[1]) + "() {\ - \n\t\treturn " + i[1] + ";\n\t}\n" + snip.rv += "\n\tpublic " + i[0] + " get" + camel(i[1]) + "() {\n\ + \treturn " + i[1] + ";\n\t}\n" ` } endsnippet @@ -138,7 +138,7 @@ for i in args: snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";" if len(args) > 0: snip.rv += "\n"` - public `!p snip.rv = snip.basename or "unknown"`($1) { `!p + public `!p snip.rv = snip.basename or "unknown"`($1) {`!p args = getArgs(t[1]) for i in args: snip.rv += "\n\t\tthis.%s = %s;" % (i[1], i[1]) @@ -266,7 +266,7 @@ for i in args: snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";" if len(args) > 0: snip.rv += "\n"` -public `!p snip.rv = snip.basename or "unknown"`($1) { `!p +public `!p snip.rv = snip.basename or "unknown"`($1) {`!p args = getArgs(t[1]) for i in args: snip.rv += "\n\t\tthis.%s = %s;" % (i[1], i[1]) @@ -326,11 +326,11 @@ snippet md "Method With javadoc" b * ${7:Short Description}`!p for i in getArgs(t[4]): snip.rv += "\n\t * @param " + i[1] + " usage..."` - * `!p + *`!p if "throws" in t[5]: snip.rv = "\n\t * @throws " + t[6] else: - snip.rv = ""` `!p + snip.rv = ""``!p if not "void" in t[2]: snip.rv = "\n\t * @return object" else: @@ -356,8 +356,7 @@ endsnippet snippet /se?tge?t|ge?tse?t|gs/ "setter and getter" br public void set${1:Name}(${2:String} `!p snip.rv = mixedCase(t[1])`) { this.`!p snip.rv = mixedCase(t[1])` = `!p snip.rv = mixedCase(t[1])`; -} - +}`!p snip.rv += "\n"` public $2 get$1() { return `!p snip.rv = mixedCase(t[1])`; } diff --git a/sources_non_forked/vim-snippets/UltiSnips/json.snippets b/sources_non_forked/vim-snippets/UltiSnips/json.snippets index b0cad830..75edef9d 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/json.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/json.snippets @@ -4,7 +4,7 @@ snippet s "String" b "${1:key}": "${0:value}", endsnippet -snippet n "number" b +snippet n "Number" b "${1:key}": ${0:value}, endsnippet @@ -13,8 +13,39 @@ snippet a "Array" b ${VISUAL}$0 ], endsnippet + +snippet na "Named array" b +"${1:key}": [ + ${VISUAL}$0 +], +endsnippet + snippet o "Object" b { ${VISUAL}$0 }, endsnippet + +snippet no "Named object" b +"${1:key}": { + ${VISUAL}$0 +}, +endsnippet + +snippet null "Null" b +"${0:key}": null, +endsnippet + + +global !p +def compB(t, opts): + if t: + opts = [m[len(t):] for m in opts if m.startswith(t)] + if len(opts) == 1: + return opts[0] + return "(" + '|'.join(opts) + ')' +endglobal + +snippet b "Bool" b +"${1:key}": $2`!p snip.rv=compB(t[2], ['true', 'false'])`, +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/php-phpspec.snippets b/sources_non_forked/vim-snippets/UltiSnips/php-phpspec.snippets index 297b73d8..08d84a05 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/php-phpspec.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/php-phpspec.snippets @@ -23,7 +23,7 @@ class `!p snip.rv = re.match(r'.*(?=\.)', fn).group() ` extends ObjectBehavior { - function it${1}() + function it_${1}() { $0 } @@ -31,7 +31,7 @@ snip.rv = re.match(r'.*(?=\.)', fn).group() endsnippet snippet it "function it_does_something() { ... }" -function it${1}() +function it_${1}() { ${0:${VISUAL}} } @@ -163,11 +163,11 @@ endsnippet # Scalar type matchers snippet sbscalar "$this->XYZ()->shouldBeString|Array|Bool()" -$this->${1:method}()->shouldBe(${2:'String|Array|Bool'}); +$this->${1:method}()->shouldBe${2:String|Array|Bool}(); endsnippet snippet snbscalar "$this->XYZ()->shouldNotBeString|Array|Bool()" -$this->${1:method}()->shouldNotBe(${2:'String|Array|Bool'}); +$this->${1:method}()->shouldNotBe${2:String|Array|Bool}(); endsnippet # Contain matcher diff --git a/sources_non_forked/vim-snippets/UltiSnips/php.snippets b/sources_non_forked/vim-snippets/UltiSnips/php.snippets index 74b51cc0..7ba51c75 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/php.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/php.snippets @@ -3,7 +3,7 @@ priority -50 ## Snippets from SnipMate, taken from ## https://github.com/scrooloose/snipmate-snippets.git -snippet getter "PHP Class Getter" b +snippet gm "PHP Class Getter" b /** * Getter for $1 * @@ -11,11 +11,11 @@ snippet getter "PHP Class Getter" b */ public function get${1/\w+\s*/\u$0/}() { - return $this->$1;$3 + return $this->$1; } endsnippet -snippet setter "PHP Class Setter" b +snippet sm "PHP Class Setter" b /** * Setter for $1 * @@ -24,11 +24,10 @@ snippet setter "PHP Class Setter" b */ public function set${1/\w+\s*/\u$0/}(${4:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1) { - $this->$1 = $$1;$5 + $this->$1 = $$1; - ${6:return $this;} + ${5:return $this;} } -$0 endsnippet snippet gs "PHP Class Getter Setter" b @@ -39,22 +38,21 @@ snippet gs "PHP Class Getter Setter" b */ public function get${1/\w+\s*/\u$0/}() { - return $this->$1;$3 + return $this->$1; } /** * Setter for $1 * * @param $2 $$1 - * @return ${4:`!p snip.rv=snip.basename`} + * @return ${3:`!p snip.rv=snip.basename`} */ -public function set${1/\w+\s*/\u$0/}(${5:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1) +public function set${1/\w+\s*/\u$0/}(${4:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1) { - $this->$1 = $$1;$6 + $this->$1 = $$1; - ${7:return $this;} + ${5:return $this;} } -$0 endsnippet snippet pub "Public function" b diff --git a/sources_non_forked/vim-snippets/snippets/eelixir.snippets b/sources_non_forked/vim-snippets/snippets/eelixir.snippets index bb6c5d4a..3d6e33d4 100644 --- a/sources_non_forked/vim-snippets/snippets/eelixir.snippets +++ b/sources_non_forked/vim-snippets/snippets/eelixir.snippets @@ -1,3 +1,5 @@ +extends html + snippet % <% ${0} %> snippet = diff --git a/sources_non_forked/vim-snippets/snippets/php.snippets b/sources_non_forked/vim-snippets/snippets/php.snippets index d382a8b1..4faa1673 100644 --- a/sources_non_forked/vim-snippets/snippets/php.snippets +++ b/sources_non_forked/vim-snippets/snippets/php.snippets @@ -47,28 +47,27 @@ snippet m { ${0} } -# setter method -snippet sm +snippet sm "PHP Class Setter" /** * Sets the value of ${1:foo} * - * @param ${2:$1} $$1 ${3:description} + * @param ${2:string} $$1 ${3:description} * * @return ${4:`vim_snippets#Filename()`} */ - ${5:public} function set${6:$2}(${7:$2 }$$1) + ${5:public} function set${6:$1}(${7:$2 }$$1) { $this->${8:$1} = $$1; + return $this; } -# getter method -snippet gm +snippet gm "PHP Class Getter Setter" /** * Gets the value of ${1:foo} * - * @return ${2:$1} + * @return ${2:string} */ - ${3:public} function get${4:$2}() + ${3:public} function get${4:$1}() { return $this->${5:$1}; } @@ -391,13 +390,13 @@ snippet ve "Dumb debug helper in HTML" snippet pc "Dumb debug helper in cli" var_export($1);$0 # Getters & Setters -snippet gs +snippet gs "PHP Class Getter Setter" /** * Gets the value of ${1:foo} * - * @return ${2:$1} + * @return ${2:string} */ - public function get${3:$2}() + public function get${3:$1}() { return $this->${4:$1}; } diff --git a/sources_non_forked/vim-snippets/snippets/sass.snippets b/sources_non_forked/vim-snippets/snippets/sass.snippets new file mode 100644 index 00000000..7207360c --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/sass.snippets @@ -0,0 +1,36 @@ +extends css + +snippet $ + $${1:variable}: ${0:value} +snippet imp + @import '${0}' +snippet mix + @mixin ${1:name}(${2}) + ${0} +snippet inc + @include ${1:mixin}(${2}) +snippet ext + @extend ${0} +snippet fun + @function ${1:name}(${2:args}) + ${0} +snippet if + @if ${1:condition} + ${0} +snippet ife + @if ${1:condition} + ${2} + @else + ${0} +snippet eif + @else if ${1:condition} + ${0} +snippet for + @for ${1:$i} from ${2:1} through ${3:3} + ${0} +snippet each + @each ${1:$item} in ${2:items} + ${0} +snippet while + @while ${1:$i} ${2:>} ${3:0} + ${0} diff --git a/sources_non_forked/vim-snippets/snippets/tex.snippets b/sources_non_forked/vim-snippets/snippets/tex.snippets index a618ceb1..68ac5d05 100644 --- a/sources_non_forked/vim-snippets/snippets/tex.snippets +++ b/sources_non_forked/vim-snippets/snippets/tex.snippets @@ -16,57 +16,57 @@ snippet dmo \DeclareMathOperator # \begin{}...\end{} snippet begin \begin{} ... \end{} block \begin{${1:env}} - ${0} + ${0:${VISUAL}} \end{$1} # Tabular snippet tab tabular (or arbitrary) environment \begin{${1:tabular}}{${2:c}} - ${0} + ${0:${VISUAL}} \end{$1} snippet thm thm (or arbitrary) environment with optional argument \begin[${1:author}]{${2:thm}} - ${0} + ${0:${VISUAL}} \end{$2} snippet center center environment \begin{center} - ${0} + ${0:${VISUAL}} \end{center} # Align(ed) snippet ali align(ed) environment \begin{align${1:ed}} \label{eq:${2}} - ${0} + ${0:${VISUAL}} \end{align$1} # Gather(ed) snippet gat gather(ed) environment \begin{gather${1:ed}} - ${0} + ${0:${VISUAL}} \end{gather$1} # Equation snippet eq equation environment \begin{equation} - ${0} + ${0:${VISUAL}} \end{equation} # Equation snippet eql Labeled equation environment \begin{equation} \label{eq:${2}} - ${0} + ${0:${VISUAL}} \end{equation} # Equation snippet eq* unnumbered equation environment \begin{equation*} - ${0} + ${0:${VISUAL}} \end{equation*} # Unnumbered Equation snippet \ unnumbered equation: \[ ... \] \[ - ${0} + ${0:${VISUAL}} \] # Equation array snippet eqnarray eqnarray environment \begin{eqnarray} - ${0} + ${0:${VISUAL}} \end{eqnarray} # Label snippet lab \label @@ -90,7 +90,7 @@ snippet itemize itemize environment \item ${0} \end{itemize} snippet item \item - \item ${1} + \item ${1:${VISUAL}} # Description snippet desc description environment \begin{description} @@ -103,18 +103,18 @@ snippet ]i \item (recursive) # Matrix snippet mat smart matrix environment \begin{${1:p/b/v/V/B/small}matrix} - ${0} + ${0:${VISUAL}} \end{$1matrix} # Cases snippet cas cases environment \begin{cases} ${1:equation}, &\text{ if }${2:case}\\ - ${0} + ${0:${VISUAL}} \end{cases} # Split snippet spl split environment \begin{split} - ${0} + ${0:${VISUAL}} \end{split} # Part snippet part document \part @@ -203,32 +203,32 @@ snippet fcite \footcite[]{} \footcite[${1}]{${2}}${0} #Formating text: italic, bold, underline, small capital, emphase .. snippet it italic text - \textit{${0:text}} + \textit{${0:${VISUAL:text}}} snippet bf bold face text - \textbf{${0:text}} + \textbf{${0:${VISUAL:text}}} snippet under underline text - \underline{${0:text}} + \underline{${0:${VISUAL:text}}} snippet emp emphasize text - \emph{${0:text}} + \emph{${0:${VISUAL:text}}} snippet sc small caps text - \textsc{${0:text}} + \textsc{${0:${VISUAL:text}}} #Choosing font snippet sf sans serife text - \textsf{${0:text}} + \textsf{${0:${VISUAL:text}}} snippet rm roman font text - \textrm{${0:text}} + \textrm{${0:${VISUAL:text}}} snippet tt typewriter (monospace) text - \texttt{${0:text}} + \texttt{${0:${VISUAL:text}}} #Math font snippet mf mathfrak - \mathfrak{${0:text}} + \mathfrak{${0:${VISUAL:text}}} snippet mc mathcal - \mathcal{${0:text}} + \mathcal{${0:${VISUAL:text}}} snippet ms mathscr - \mathscr{${0:text}} + \mathscr{${0:${VISUAL:text}}} #misc snippet ft \footnote - \footnote{${0:text}} + \footnote{${0:${VISUAL:text}}} snippet fig figure environment (includegraphics) \begin{figure} \begin{center} @@ -260,19 +260,19 @@ snippet lim \lim_{} \lim_{${1:n \to \infty}} ${0} snippet frame frame environment \begin{frame}[${1:t}]{${2:title}} - ${0} + ${0:${VISUAL}} \end{frame} snippet block block environment \begin{block}{${1:title}} - ${0} + ${0:${VISUAL}} \end{block} snippet alert alertblock environment \begin{alertblock}{${1:title}} - ${0} + ${0:${VISUAL}} \end{alertblock} snippet example exampleblock environment \begin{exampleblock}{${1:title}} - ${0} + ${0:${VISUAL}} \end{exampleblock} snippet col2 two-column environment \begin{columns} @@ -301,7 +301,7 @@ snippet lra langle rangle # Code listings snippet lst \begin{listing}[language=${1:language}] - ${0} + ${0:${VISUAL}} \end{listing} snippet lsi \lstinline|${1}| ${0} From ae9d1c1f43b4789b7a0ad4446cddd7a3f3b6324d Mon Sep 17 00:00:00 2001 From: amix Date: Sun, 26 Jun 2016 13:14:51 +0200 Subject: [PATCH 5/8] Re-updated the undo dir git ignore --- .gitignore | 1 + temp_dirs/undodir/README.md | 1 + 2 files changed, 2 insertions(+) create mode 100644 temp_dirs/undodir/README.md diff --git a/.gitignore b/.gitignore index 9588c166..3b36388c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +temp_dirs/undodir/* sources_non_forked/ack.vim/.netrwhist temp_dirs/yankring_history_v2.txt sources_forked/yankring/doc/tags diff --git a/temp_dirs/undodir/README.md b/temp_dirs/undodir/README.md new file mode 100644 index 00000000..37f6debe --- /dev/null +++ b/temp_dirs/undodir/README.md @@ -0,0 +1 @@ +Undo dir for VIM From 3022dffeb456cd7ed335e3e05cd7786cd122d92b Mon Sep 17 00:00:00 2001 From: amix Date: Sun, 26 Jun 2016 13:17:50 +0200 Subject: [PATCH 6/8] Fixed https://github.com/amix/vimrc/issues/203 --- vimrcs/basic.vim | 4 ---- 1 file changed, 4 deletions(-) diff --git a/vimrcs/basic.vim b/vimrcs/basic.vim index e6e232ea..b060e92b 100644 --- a/vimrcs/basic.vim +++ b/vimrcs/basic.vim @@ -206,10 +206,6 @@ vnoremap # :call VisualSelection('', '')?=@/ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Moving around, tabs, windows and buffers """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Treat long lines as break lines (useful when moving around in them) -map j gj -map k gk - " Map to / (search) and Ctrl- to ? (backwards search) map / map ? From 2c35718f39e2a4ac9744f0271701f96c711f25f0 Mon Sep 17 00:00:00 2001 From: Amir Salihefendic Date: Sun, 26 Jun 2016 13:22:59 +0200 Subject: [PATCH 7/8] Update README.md Removed amix.dk blog links --- README.md | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/README.md b/README.md index ab559418..b43a9d73 100644 --- a/README.md +++ b/README.md @@ -312,18 +312,6 @@ Vimscript mappings: map n :cn map p :cp -## Useful blog tips regarding my Vim setup - -* [Vim: Annotate strings with gettext (the macro way)](http://amix.dk/blog/post/19678#Vim-Annotate-strings-with-gettext-the-macro-way) -* [vimgrep: Searching through multiple file extensions](http://amix.dk/blog/post/19672#vimgrep-Searching-through-multiple-file-extensions) -* [Filtering through vimgrep results using regular expressions](http://amix.dk/blog/post/19666#Filtering-through-vimgrep-results-using-regular-expressions) -* [PeepOpen - File auto completion for Mac editors](http://amix.dk/blog/post/19601#PeepOpen-File-auto-completion-for-Mac-editors) -* [Vim 7.3: Persistent undo and encryption!](http://amix.dk/blog/post/19548#Vim-7-3-Persistent-undo-and-encryption) -* [Vim tips: Visual Search](http://amix.dk/blog/post/19334#Vim-tips-Visual-Search) -* [Folding in Vim](http://amix.dk/blog/post/19132#Folding-in-Vim) -* [ -Zen room for Vim: Focusing only on the essential](http://amix.dk/blog/post/19744#zenroom-for-Vim-Focsuing-only-on-the-essential) - ## How to uninstall Do following: * Remove `~/.vim_runtime` From 2644909e1e6273e4317a077ef289833e7500be53 Mon Sep 17 00:00:00 2001 From: Amir Salihefendic Date: Sun, 26 Jun 2016 13:26:53 +0200 Subject: [PATCH 8/8] Update README.md --- README.md | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index b43a9d73..ad17e8cf 100644 --- a/README.md +++ b/README.md @@ -121,42 +121,33 @@ Now you have vim-rails installed ;-) ### Plugin related mappings -Open [bufexplorer](https://github.com/vim-scripts/bufexplorer.zip) and see and manage the current buffers: +Open [bufexplorer](https://github.com/vim-scripts/bufexplorer.zip) and see and manage the current buffers (`o`): map o :BufExplorer -Open [MRU.vim](https://github.com/vim-scripts/mru.vim) and see the recently open files: +Open [MRU.vim](https://github.com/vim-scripts/mru.vim) and see the recently open files (`f`): map f :MRU -Open [ctrlp.vim](https://github.com/kien/ctrlp.vim) plugin: +Open [ctrlp.vim](https://github.com/kien/ctrlp.vim) plugin (`j` or `f`): let g:ctrlp_map = '' -Open [PeepOpen](http://topfunky.github.io/PeepOpen/) plugin: - - map j :PeepOpen - Managing the [NERD Tree](https://github.com/scrooloose/nerdtree) plugin: map nn :NERDTreeToggle map nb :NERDTreeFromBookmark map nf :NERDTreeFind -[goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2) lets you only focus on one thing at a time. It removes all the distractions and centers the content. It has a special look when editing Markdown, reStructuredText and textfiles. It only has one mapping. +[goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2) lets you only focus on one thing at a time. It removes all the distractions and centers the content. It has a special look when editing Markdown, reStructuredText and textfiles. It only has one mapping. (`z`) map z :Goyo ### Normal mode mappings -Fast saving of a buffer: +Fast saving of a buffer (`w`): nmap w :w! - -Treat long lines as break lines (useful when moving around in them): - - map j gj - map k gk Map `` to `/` (search) and `+` to `?` (backwards search): @@ -168,14 +159,14 @@ Disable highlight when `` is pressed: map :noh -Smart way to move between windows: +Smart way to move between windows (`j` etc.): map j map k map h map l -Closing of current buffer(s): +Closing of current buffer(s) (`bd` and (`ba`)): " Close current buffer map bd :Bclose