From ccb7854aa265a90ece0c869ab6e7f491af89f392 Mon Sep 17 00:00:00 2001 From: amix Date: Tue, 7 Mar 2017 18:04:28 +0100 Subject: [PATCH] Updated plugins --- .../lightline/colorscheme/darcula.vim | 37 +++ .../lightline.vim/doc/lightline.txt | 3 +- .../nerdtree/lib/nerdtree/ui.vim | 166 ++++++------- sources_non_forked/syntastic/README.markdown | 8 +- .../syntastic/autoload/syntastic/util.vim | 4 +- .../syntastic/doc/syntastic.txt | 2 +- .../syntastic/plugin/syntastic.vim | 5 +- .../syntastic/syntax_checkers/asm/gcc.vim | 7 +- .../syntastic/syntax_checkers/c/pc_lint.vim | 3 +- .../syntastic/syntax_checkers/cabal/cabal.vim | 5 +- .../syntastic/syntax_checkers/cuda/nvcc.vim | 22 +- .../syntastic/syntax_checkers/d/dmd.vim | 3 +- .../syntax_checkers/elixir/elixir.vim | 3 +- .../syntax_checkers/erlang/escript.vim | 8 +- .../syntastic/syntax_checkers/eruby/ruby.vim | 5 +- .../syntastic/syntax_checkers/glsl/cgc.vim | 29 +-- .../syntastic/syntax_checkers/go/go.vim | 17 +- .../syntax_checkers/go/gometalinter.vim | 3 +- .../syntastic/syntax_checkers/go/gotype.vim | 5 +- .../syntastic/syntax_checkers/go/govet.vim | 3 +- .../syntax_checkers/haskell/hdevtools.vim | 3 +- .../syntax_checkers/haskell/hlint.vim | 3 +- .../syntastic/syntax_checkers/haxe/haxe.vim | 10 +- .../syntax_checkers/html/validator.vim | 3 +- .../syntastic/syntax_checkers/html/w3.vim | 3 +- .../syntax_checkers/java/checkstyle.vim | 4 +- .../syntastic/syntax_checkers/java/javac.vim | 4 +- .../javascript/closurecompiler.vim | 5 +- .../syntax_checkers/javascript/flow.vim | 3 +- .../syntastic/syntax_checkers/limbo/limbo.vim | 3 +- .../syntastic/syntax_checkers/nasm/nasm.vim | 3 +- .../syntax_checkers/ocaml/camlp4o.vim | 30 +-- .../syntastic/syntax_checkers/perl/perl.vim | 5 +- .../syntastic/syntax_checkers/r/lint.vim | 4 +- .../syntastic/syntax_checkers/r/lintr.vim | 6 +- .../syntastic/syntax_checkers/r/svtools.vim | 4 +- .../syntastic/syntax_checkers/rst/sphinx.vim | 13 +- .../syntastic/syntax_checkers/sass/sass.vim | 11 +- .../syntastic/syntax_checkers/scala/fsc.vim | 3 +- .../syntastic/syntax_checkers/sh/sh.vim | 36 +-- .../syntax_checkers/sh/shellcheck.vim | 13 +- .../syntastic/syntax_checkers/vala/valac.vim | 8 +- .../syntastic/syntax_checkers/vim/vimlint.vim | 14 +- .../syntax_checkers/xquery/basex.vim | 3 +- .../syntastic/syntax_checkers/yaml/yamlxs.vim | 16 +- .../vim-coffee-script/Copying.md | 39 +++ .../vim-coffee-script/Readme.md | 24 +- .../ftdetect/vim-literate-coffeescript.vim | 8 + .../vim-coffee-script/ftplugin/litcoffee.vim | 1 + .../vim-coffee-script/indent/litcoffee.vim | 22 ++ .../vim-coffee-script/syntax/coffee.vim | 2 +- .../vim-coffee-script/syntax/litcoffee.vim | 23 ++ .../vim-coffee-script/test/test.coffee.md | 117 +++++++++ .../vim-coffee-script/test/test.litcoffee | 117 +++++++++ .../vim-fugitive/plugin/fugitive.vim | 3 +- .../vim-go/.github/ISSUE_TEMPLATE.md | 9 +- sources_non_forked/vim-go/.travis.yml | 1 - sources_non_forked/vim-go/CHANGELOG.md | 23 +- sources_non_forked/vim-go/LICENSE | 2 +- sources_non_forked/vim-go/README.md | 8 +- .../vim-go/autoload/ctrlp/decls.vim | 6 +- sources_non_forked/vim-go/autoload/go/cmd.vim | 2 +- .../vim-go/autoload/go/complete.vim | 12 +- .../vim-go/autoload/go/coverage.vim | 22 +- sources_non_forked/vim-go/autoload/go/def.vim | 2 +- sources_non_forked/vim-go/autoload/go/doc.vim | 23 +- sources_non_forked/vim-go/autoload/go/fmt.vim | 20 +- .../vim-go/autoload/go/guru.vim | 24 +- .../vim-go/autoload/go/impl.vim | 4 +- .../vim-go/autoload/go/lint.vim | 8 +- .../vim-go/autoload/go/list.vim | 2 +- .../vim-go/autoload/go/play.vim | 2 +- .../vim-go/autoload/go/statusline.vim | 2 +- .../vim-go/autoload/go/tags.vim | 206 +++++++++++++++ .../vim-go/autoload/go/tags_test.vim | 28 +++ .../vim-go/autoload/go/textobj.vim | 2 +- .../vim-go/autoload/go/tool.vim | 2 +- .../vim-go/autoload/go/util.vim | 2 +- sources_non_forked/vim-go/doc/vim-go.txt | 42 +++- .../vim-go/ftplugin/go/commands.vim | 7 +- .../vim-go/ftplugin/go/tagbar.vim | 6 +- .../vim-go/gosnippets/UltiSnips/go.snippets | 2 +- sources_non_forked/vim-go/plugin/go.vim | 1 + sources_non_forked/vim-go/scripts/test.sh | 3 + sources_non_forked/vim-pug/syntax/pug.vim | 2 +- .../vim-snippets/UltiSnips/all.snippets | 4 + .../vim-snippets/UltiSnips/cpp.snippets | 37 +++ .../javascript-jasmine-arrow.snippets | 234 ++++++++++++++++++ .../UltiSnips/javascript-jasmine.snippets | 18 +- .../UltiSnips/javascript.snippets | 93 +++++-- .../vim-snippets/UltiSnips/matlab.snippets | 24 ++ .../vim-snippets/UltiSnips/ruby.snippets | 68 ++--- .../vim-snippets/UltiSnips/snippets.snippets | 6 +- .../pythonx/javascript_snippets.py | 48 ++++ .../vim-snippets/snippets/c.snippets | 109 +++++++- .../vim-snippets/snippets/cpp.snippets | 57 ++++- .../vim-snippets/snippets/fortran.snippets | 3 + .../vim-snippets/snippets/jinja.snippets | 2 +- .../vim-snippets/snippets/matlab.snippets | 64 +++++ .../vim-snippets/snippets/php.snippets | 4 +- .../vim-snippets/snippets/ruby.snippets | 15 -- .../vim-snippets/snippets/rust.snippets | 2 +- .../vim-snippets/snippets/snippets.snippets | 7 +- 103 files changed, 1729 insertions(+), 445 deletions(-) create mode 100644 sources_non_forked/lightline.vim/autoload/lightline/colorscheme/darcula.vim create mode 100644 sources_non_forked/vim-coffee-script/ftdetect/vim-literate-coffeescript.vim create mode 100644 sources_non_forked/vim-coffee-script/ftplugin/litcoffee.vim create mode 100644 sources_non_forked/vim-coffee-script/indent/litcoffee.vim create mode 100644 sources_non_forked/vim-coffee-script/syntax/litcoffee.vim create mode 100644 sources_non_forked/vim-coffee-script/test/test.coffee.md create mode 100644 sources_non_forked/vim-coffee-script/test/test.litcoffee create mode 100644 sources_non_forked/vim-go/autoload/go/tags.vim create mode 100644 sources_non_forked/vim-go/autoload/go/tags_test.vim create mode 100644 sources_non_forked/vim-snippets/UltiSnips/javascript-jasmine-arrow.snippets create mode 100644 sources_non_forked/vim-snippets/UltiSnips/matlab.snippets create mode 100644 sources_non_forked/vim-snippets/pythonx/javascript_snippets.py create mode 100644 sources_non_forked/vim-snippets/snippets/matlab.snippets diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/darcula.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/darcula.vim new file mode 100644 index 00000000..928e8b76 --- /dev/null +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/darcula.vim @@ -0,0 +1,37 @@ +" ============================================================================= +" Filename: autoload/lightline/colorscheme/darcula.vim +" Author: kkopec +" License: MIT License +" Last Change: 2017/02/11 21:18:54. +" ============================================================================= + +let s:black = [ '#2b2b2b', 235 ] +let s:gray = [ '#323232', 236 ] +let s:white = [ '#a9b7c6', 250 ] +let s:blue = [ '#6897bb' , 67 ] +let s:green = [ '#629755', 71 ] +let s:purple = [ '#9876aa', 104 ] +let s:red = [ '#ff6b68', 204 ] +let s:yellow = [ '#ffc66d', 222 ] + +let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} +let s:p.normal.left = [ [ s:black, s:purple ], [ s:purple, s:gray ] ] +let s:p.normal.right = [ [ s:black, s:purple ], [ s:purple, s:gray ] ] +let s:p.inactive.left = [ [ s:black, s:blue ], [ s:blue, s:gray ] ] +let s:p.inactive.right = [ [ s:black, s:blue ], [ s:blue, s:gray ] ] +let s:p.insert.left = [ [ s:black, s:green ], [ s:green, s:gray ] ] +let s:p.insert.right = [ [ s:black, s:green ], [ s:green, s:gray ] ] +let s:p.replace.left = [ [ s:black, s:red ], [ s:red, s:gray ] ] +let s:p.replace.right = [ [ s:black, s:red ], [ s:red, s:gray ] ] +let s:p.visual.left = [ [ s:black, s:yellow ], [ s:yellow, s:gray ] ] +let s:p.visual.right = [ [ s:black, s:yellow ], [ s:yellow, s:gray ] ] +let s:p.normal.middle = [ [ s:white, s:gray ] ] +let s:p.inactive.middle = [ [ s:white, s:gray ] ] +let s:p.tabline.left = [ [ s:blue, s:gray ] ] +let s:p.tabline.tabsel = [ [ s:black, s:blue ] ] +let s:p.tabline.middle = [ [ s:blue, s:gray ] ] +let s:p.tabline.right = [ [ s:black, s:blue ] ] +let s:p.normal.error = [ [ s:red, s:black ] ] +let s:p.normal.warning = [ [ s:yellow, s:black ] ] + +let g:lightline#colorscheme#darcula#palette = lightline#colorscheme#flatten(s:p) diff --git a/sources_non_forked/lightline.vim/doc/lightline.txt b/sources_non_forked/lightline.vim/doc/lightline.txt index 8b0a580d..1c08d82b 100644 --- a/sources_non_forked/lightline.vim/doc/lightline.txt +++ b/sources_non_forked/lightline.vim/doc/lightline.txt @@ -223,7 +223,8 @@ OPTIONS *lightline-option* The colorscheme for lightline.vim. Currently, wombat, solarized, powerline, jellybeans, Tomorrow, Tomorrow_Night, Tomorrow_Night_Blue, Tomorrow_Night_Eighties, - PaperColor, seoul256, landscape, one, Dracula, Molokai and 16color are available. + PaperColor, seoul256, landscape, one, Dracula, darcula, + Molokai and 16color are available. The default value is: > let g:lightline.colorscheme = 'default' diff --git a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim index d107814c..65ebfd91 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim @@ -20,108 +20,105 @@ endfunction "FUNCTION: s:UI._dumpHelp {{{1 "prints out the quick help function! s:UI._dumpHelp() - let old_h = @h if self.getShowHelp() - let @h= "\" NERD tree (" . nerdtree#version() . ") quickhelp~\n" - let @h=@h."\" ============================\n" - let @h=@h."\" File node mappings~\n" - let @h=@h."\" ". (g:NERDTreeMouseMode ==# 3 ? "single" : "double") ."-click,\n" - let @h=@h."\" ,\n" + let help = "\" NERD tree (" . nerdtree#version() . ") quickhelp~\n" + let help .= "\" ============================\n" + let help .= "\" File node mappings~\n" + let help .= "\" ". (g:NERDTreeMouseMode ==# 3 ? "single" : "double") ."-click,\n" + let help .= "\" ,\n" if self.nerdtree.isTabTree() - let @h=@h."\" ". g:NERDTreeMapActivateNode .": open in prev window\n" + let help .= "\" ". g:NERDTreeMapActivateNode .": open in prev window\n" else - let @h=@h."\" ". g:NERDTreeMapActivateNode .": open in current window\n" + let help .= "\" ". g:NERDTreeMapActivateNode .": open in current window\n" endif if self.nerdtree.isTabTree() - let @h=@h."\" ". g:NERDTreeMapPreview .": preview\n" + let help .= "\" ". g:NERDTreeMapPreview .": preview\n" endif - let @h=@h."\" ". g:NERDTreeMapOpenInTab.": open in new tab\n" - let @h=@h."\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" - let @h=@h."\" middle-click,\n" - let @h=@h."\" ". g:NERDTreeMapOpenSplit .": open split\n" - let @h=@h."\" ". g:NERDTreeMapPreviewSplit .": preview split\n" - let @h=@h."\" ". g:NERDTreeMapOpenVSplit .": open vsplit\n" - let @h=@h."\" ". g:NERDTreeMapPreviewVSplit .": preview vsplit\n" + let help .= "\" ". g:NERDTreeMapOpenInTab.": open in new tab\n" + let help .= "\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" + let help .= "\" middle-click,\n" + let help .= "\" ". g:NERDTreeMapOpenSplit .": open split\n" + let help .= "\" ". g:NERDTreeMapPreviewSplit .": preview split\n" + let help .= "\" ". g:NERDTreeMapOpenVSplit .": open vsplit\n" + let help .= "\" ". g:NERDTreeMapPreviewVSplit .": preview vsplit\n" - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Directory node mappings~\n" - let @h=@h."\" ". (g:NERDTreeMouseMode ==# 1 ? "double" : "single") ."-click,\n" - let @h=@h."\" ". g:NERDTreeMapActivateNode .": open & close node\n" - let @h=@h."\" ". g:NERDTreeMapOpenRecursively .": recursively open node\n" - let @h=@h."\" ". g:NERDTreeMapCloseDir .": close parent of node\n" - let @h=@h."\" ". g:NERDTreeMapCloseChildren .": close all child nodes of\n" - let @h=@h."\" current node recursively\n" - let @h=@h."\" middle-click,\n" - let @h=@h."\" ". g:NERDTreeMapOpenExpl.": explore selected dir\n" + let help .= "\"\n\" ----------------------------\n" + let help .= "\" Directory node mappings~\n" + let help .= "\" ". (g:NERDTreeMouseMode ==# 1 ? "double" : "single") ."-click,\n" + let help .= "\" ". g:NERDTreeMapActivateNode .": open & close node\n" + let help .= "\" ". g:NERDTreeMapOpenRecursively .": recursively open node\n" + let help .= "\" ". g:NERDTreeMapCloseDir .": close parent of node\n" + let help .= "\" ". g:NERDTreeMapCloseChildren .": close all child nodes of\n" + let help .= "\" current node recursively\n" + let help .= "\" middle-click,\n" + let help .= "\" ". g:NERDTreeMapOpenExpl.": explore selected dir\n" - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Bookmark table mappings~\n" - let @h=@h."\" double-click,\n" - let @h=@h."\" ". g:NERDTreeMapActivateNode .": open bookmark\n" - let @h=@h."\" ". g:NERDTreeMapOpenInTab.": open in new tab\n" - let @h=@h."\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" - let @h=@h."\" ". g:NERDTreeMapDeleteBookmark .": delete bookmark\n" + let help .= "\"\n\" ----------------------------\n" + let help .= "\" Bookmark table mappings~\n" + let help .= "\" double-click,\n" + let help .= "\" ". g:NERDTreeMapActivateNode .": open bookmark\n" + let help .= "\" ". g:NERDTreeMapOpenInTab.": open in new tab\n" + let help .= "\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" + let help .= "\" ". g:NERDTreeMapDeleteBookmark .": delete bookmark\n" - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Tree navigation mappings~\n" - let @h=@h."\" ". g:NERDTreeMapJumpRoot .": go to root\n" - let @h=@h."\" ". g:NERDTreeMapJumpParent .": go to parent\n" - let @h=@h."\" ". g:NERDTreeMapJumpFirstChild .": go to first child\n" - let @h=@h."\" ". g:NERDTreeMapJumpLastChild .": go to last child\n" - let @h=@h."\" ". g:NERDTreeMapJumpNextSibling .": go to next sibling\n" - let @h=@h."\" ". g:NERDTreeMapJumpPrevSibling .": go to prev sibling\n" + let help .= "\"\n\" ----------------------------\n" + let help .= "\" Tree navigation mappings~\n" + let help .= "\" ". g:NERDTreeMapJumpRoot .": go to root\n" + let help .= "\" ". g:NERDTreeMapJumpParent .": go to parent\n" + let help .= "\" ". g:NERDTreeMapJumpFirstChild .": go to first child\n" + let help .= "\" ". g:NERDTreeMapJumpLastChild .": go to last child\n" + let help .= "\" ". g:NERDTreeMapJumpNextSibling .": go to next sibling\n" + let help .= "\" ". g:NERDTreeMapJumpPrevSibling .": go to prev sibling\n" - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Filesystem mappings~\n" - let @h=@h."\" ". g:NERDTreeMapChangeRoot .": change tree root to the\n" - let @h=@h."\" selected dir\n" - let @h=@h."\" ". g:NERDTreeMapUpdir .": move tree root up a dir\n" - let @h=@h."\" ". g:NERDTreeMapUpdirKeepOpen .": move tree root up a dir\n" - let @h=@h."\" but leave old root open\n" - let @h=@h."\" ". g:NERDTreeMapRefresh .": refresh cursor dir\n" - let @h=@h."\" ". g:NERDTreeMapRefreshRoot .": refresh current root\n" - let @h=@h."\" ". g:NERDTreeMapMenu .": Show menu\n" - let @h=@h."\" ". g:NERDTreeMapChdir .":change the CWD to the\n" - let @h=@h."\" selected dir\n" - let @h=@h."\" ". g:NERDTreeMapCWD .":change tree root to CWD\n" + let help .= "\"\n\" ----------------------------\n" + let help .= "\" Filesystem mappings~\n" + let help .= "\" ". g:NERDTreeMapChangeRoot .": change tree root to the\n" + let help .= "\" selected dir\n" + let help .= "\" ". g:NERDTreeMapUpdir .": move tree root up a dir\n" + let help .= "\" ". g:NERDTreeMapUpdirKeepOpen .": move tree root up a dir\n" + let help .= "\" but leave old root open\n" + let help .= "\" ". g:NERDTreeMapRefresh .": refresh cursor dir\n" + let help .= "\" ". g:NERDTreeMapRefreshRoot .": refresh current root\n" + let help .= "\" ". g:NERDTreeMapMenu .": Show menu\n" + let help .= "\" ". g:NERDTreeMapChdir .":change the CWD to the\n" + let help .= "\" selected dir\n" + let help .= "\" ". g:NERDTreeMapCWD .":change tree root to CWD\n" - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Tree filtering mappings~\n" - let @h=@h."\" ". g:NERDTreeMapToggleHidden .": hidden files (" . (self.getShowHidden() ? "on" : "off") . ")\n" - let @h=@h."\" ". g:NERDTreeMapToggleFilters .": file filters (" . (self.isIgnoreFilterEnabled() ? "on" : "off") . ")\n" - let @h=@h."\" ". g:NERDTreeMapToggleFiles .": files (" . (self.getShowFiles() ? "on" : "off") . ")\n" - let @h=@h."\" ". g:NERDTreeMapToggleBookmarks .": bookmarks (" . (self.getShowBookmarks() ? "on" : "off") . ")\n" + let help .= "\"\n\" ----------------------------\n" + let help .= "\" Tree filtering mappings~\n" + let help .= "\" ". g:NERDTreeMapToggleHidden .": hidden files (" . (self.getShowHidden() ? "on" : "off") . ")\n" + let help .= "\" ". g:NERDTreeMapToggleFilters .": file filters (" . (self.isIgnoreFilterEnabled() ? "on" : "off") . ")\n" + let help .= "\" ". g:NERDTreeMapToggleFiles .": files (" . (self.getShowFiles() ? "on" : "off") . ")\n" + let help .= "\" ". g:NERDTreeMapToggleBookmarks .": bookmarks (" . (self.getShowBookmarks() ? "on" : "off") . ")\n" "add quickhelp entries for each custom key map - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Custom mappings~\n" + let help .= "\"\n\" ----------------------------\n" + let help .= "\" Custom mappings~\n" for i in g:NERDTreeKeyMap.All() if !empty(i.quickhelpText) - let @h=@h."\" ". i.key .": ". i.quickhelpText ."\n" + let help .= "\" ". i.key .": ". i.quickhelpText ."\n" endif endfor - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Other mappings~\n" - let @h=@h."\" ". g:NERDTreeMapQuit .": Close the NERDTree window\n" - let @h=@h."\" ". g:NERDTreeMapToggleZoom .": Zoom (maximize-minimize)\n" - let @h=@h."\" the NERDTree window\n" - let @h=@h."\" ". g:NERDTreeMapHelp .": toggle help\n" - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Bookmark commands~\n" - let @h=@h."\" :Bookmark []\n" - let @h=@h."\" :BookmarkToRoot \n" - let @h=@h."\" :RevealBookmark \n" - let @h=@h."\" :OpenBookmark \n" - let @h=@h."\" :ClearBookmarks []\n" - let @h=@h."\" :ClearAllBookmarks\n" - silent! put h + let help .= "\"\n\" ----------------------------\n" + let help .= "\" Other mappings~\n" + let help .= "\" ". g:NERDTreeMapQuit .": Close the NERDTree window\n" + let help .= "\" ". g:NERDTreeMapToggleZoom .": Zoom (maximize-minimize)\n" + let help .= "\" the NERDTree window\n" + let help .= "\" ". g:NERDTreeMapHelp .": toggle help\n" + let help .= "\"\n\" ----------------------------\n" + let help .= "\" Bookmark commands~\n" + let help .= "\" :Bookmark []\n" + let help .= "\" :BookmarkToRoot \n" + let help .= "\" :RevealBookmark \n" + let help .= "\" :OpenBookmark \n" + let help .= "\" :ClearBookmarks []\n" + let help .= "\" :ClearAllBookmarks\n" + silent! put =help elseif !self.isMinimal() - let @h="\" Press ". g:NERDTreeMapHelp ." for help\n" - silent! put h + let help ="\" Press ". g:NERDTreeMapHelp ." for help\n" + silent! put =help endif - - let @h = old_h endfunction @@ -440,10 +437,7 @@ function! s:UI.render() call cursor(line(".")+1, col(".")) "draw the tree - let old_o = @o - let @o = self.nerdtree.root.renderToString() - silent put o - let @o = old_o + silent put =self.nerdtree.root.renderToString() "delete the blank line at the top of the buffer silent 1,1delete _ diff --git a/sources_non_forked/syntastic/README.markdown b/sources_non_forked/syntastic/README.markdown index 7ed8cc87..4212c95a 100644 --- a/sources_non_forked/syntastic/README.markdown +++ b/sources_non_forked/syntastic/README.markdown @@ -101,10 +101,10 @@ enabled. Syntastic itself has rather relaxed requirements: it doesn't have any external 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 -version 7 or later with the "normal", "big", or "huge" feature sets should be -fine. +`reltime`, `statusline`, and `user_commands`. Not all possible combinations of +features that include the ones above make equal sense on all operating systems, +but Vim 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][neobundle], [Pathogen][pathogen], [Vim-Addon-Manager][vam], diff --git a/sources_non_forked/syntastic/autoload/syntastic/util.vim b/sources_non_forked/syntastic/autoload/syntastic/util.vim index deeb0f1f..6ead9ea2 100644 --- a/sources_non_forked/syntastic/autoload/syntastic/util.vim +++ b/sources_non_forked/syntastic/autoload/syntastic/util.vim @@ -132,9 +132,9 @@ endfunction " }}}2 " returns " " {'exe': '/usr/bin/perl', 'args': ['-f', '-bar']} -function! syntastic#util#parseShebang() abort " {{{2 +function! syntastic#util#parseShebang(buf) abort " {{{2 for lnum in range(1, 5) - let line = getline(lnum) + let line = get(getbufline(a:buf, lnum), 0, '') if line =~# '^#!' let line = substitute(line, '\v^#!\s*(\S+/env(\s+-\S+)*\s+)?', '', '') let exe = matchstr(line, '\m^\S*\ze') diff --git a/sources_non_forked/syntastic/doc/syntastic.txt b/sources_non_forked/syntastic/doc/syntastic.txt index db3e99e4..8bc455d3 100644 --- a/sources_non_forked/syntastic/doc/syntastic.txt +++ b/sources_non_forked/syntastic/doc/syntastic.txt @@ -164,7 +164,7 @@ When syntax errors are detected a flag will be shown. The content of the flag is derived from the |'syntastic_stl_format'| option. Please note that these settings might conflict with other Vim plugins that -change the way statusline works. Refer to the |syntastic-compatibility| notes +change the way 'statusline' works. Refer to the |syntastic-compatibility| notes below and to the respective plugins' documentation for possible solutions. In particular see |syntastic-airline| below if you're using the "airline" Vim diff --git a/sources_non_forked/syntastic/plugin/syntastic.vim b/sources_non_forked/syntastic/plugin/syntastic.vim index 4e65ea07..47f16cf0 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.8.0-21' +let g:_SYNTASTIC_VERSION = '3.8.0-26' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1 @@ -36,7 +36,8 @@ for s:feature in [ \ 'modify_fname', \ 'quickfix', \ 'reltime', - \ 'user_commands' + \ 'statusline', + \ 'user_commands', \ ] if !has(s:feature) call syntastic#log#error('need Vim compiled with feature ' . s:feature) diff --git a/sources_non_forked/syntastic/syntax_checkers/asm/gcc.vim b/sources_non_forked/syntastic/syntax_checkers/asm/gcc.vim index d352eeeb..f6a8b410 100644 --- a/sources_non_forked/syntastic/syntax_checkers/asm/gcc.vim +++ b/sources_non_forked/syntastic/syntax_checkers/asm/gcc.vim @@ -34,19 +34,20 @@ function! SyntaxCheckers_asm_gcc_IsAvailable() dict " {{{1 endfunction " }}}1 function! SyntaxCheckers_asm_gcc_GetLocList() dict " {{{1 + let buf = bufnr('') return syntastic#c#GetLocList('asm', 'gcc', { \ 'errorformat': \ '%-G%f:%s:,' . \ '%f:%l:%c: %trror: %m,' . \ '%f:%l:%c: %tarning: %m,' . \ '%f:%l: %m', - \ 'main_flags': '-x assembler -fsyntax-only' . (g:syntastic_asm_generic ? '' : ' -masm=' . s:GetDialect()) }) + \ 'main_flags': '-x assembler -fsyntax-only' . (g:syntastic_asm_generic ? '' : ' -masm=' . s:GetDialect(buf)) }) endfunction " }}}1 " Utilities {{{1 -function! s:GetDialect() " {{{2 - return syntastic#util#var('asm_dialect', expand('%:e', 1) ==? 'asm' ? 'intel' : 'att') +function! s:GetDialect(buf) " {{{2 + return syntastic#util#bufVar(a:buf, 'asm_dialect', fnamemodify(bufname(a:buf), ':e') ==? 'asm' ? 'intel' : 'att') endfunction " }}}2 " }}}1 diff --git a/sources_non_forked/syntastic/syntax_checkers/c/pc_lint.vim b/sources_non_forked/syntastic/syntax_checkers/c/pc_lint.vim index 6efd17a1..0f7f9da7 100644 --- a/sources_non_forked/syntastic/syntax_checkers/c/pc_lint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/c/pc_lint.vim @@ -23,7 +23,8 @@ if !exists('g:syntastic_pc_lint_config_file') endif function! SyntaxCheckers_c_pc_lint_GetLocList() dict - let config = syntastic#util#findFileInParent(g:syntastic_pc_lint_config_file, expand('%:p:h', 1)) + let buf = bufnr('') + let config = syntastic#util#findFileInParent(g:syntastic_pc_lint_config_file, fnamemodify(bufname(buf), ':p:h')) call self.log('config =', config) " -hFs1 - show filename, add space after messages, try to make message 1 line diff --git a/sources_non_forked/syntastic/syntax_checkers/cabal/cabal.vim b/sources_non_forked/syntastic/syntax_checkers/cabal/cabal.vim index e43aefaa..6aa58aff 100644 --- a/sources_non_forked/syntastic/syntax_checkers/cabal/cabal.vim +++ b/sources_non_forked/syntastic/syntax_checkers/cabal/cabal.vim @@ -31,6 +31,7 @@ function! SyntaxCheckers_cabal_cabal_GetHighlightRegex(item) endfunction function! SyntaxCheckers_cabal_cabal_GetLocList() dict + let buf = bufnr('') let makeprg = self.getExecEscaped() . ' check' let errorformat = @@ -40,9 +41,9 @@ function! SyntaxCheckers_cabal_cabal_GetLocList() dict return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'cwd': expand('%:p:h', 1), + \ 'cwd': fnamemodify(bufname(buf), ':p:h'), \ 'preprocess': 'cabal', - \ 'defaults': {'bufnr': bufnr('')} }) + \ 'defaults': {'bufnr': buf} }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/sources_non_forked/syntastic/syntax_checkers/cuda/nvcc.vim b/sources_non_forked/syntastic/syntax_checkers/cuda/nvcc.vim index 34760390..9601e73a 100644 --- a/sources_non_forked/syntastic/syntax_checkers/cuda/nvcc.vim +++ b/sources_non_forked/syntastic/syntax_checkers/cuda/nvcc.vim @@ -18,7 +18,8 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_cuda_nvcc_GetLocList() dict - let arch_flag = syntastic#util#var('cuda_arch') + let buf = bufnr('') + let arch_flag = syntastic#util#bufVar(buf, 'cuda_arch') if arch_flag !=# '' let arch_flag = '-arch=' . arch_flag call syntastic#log#oneTimeWarn('variable g:syntastic_cuda_arch is deprecated, ' . @@ -27,9 +28,9 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() dict 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' + if index(['h', 'hpp', 'cuh'], fnamemodify(bufname(buf), ':e'), 0, 1) >= 0 + if syntastic#util#bufVar(buf, 'cuda_check_header', 0) + let dummy = fnamemodify(bufname(buf), ':p:h') . syntastic#util#Slash() . '.syntastic_dummy.cu' let build_opts = { \ 'exe_before': 'echo > ' . syntastic#util#shescape(dummy) . ' ;', \ 'fname_before': '.syntastic_dummy.cu -include' } @@ -62,7 +63,18 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() dict \ '%DMaking %*\a in %f,'. \ '%f|%l| %m' - let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'type': 'E'} }) + + for e in loclist + let pat = matchstr(e['text'], '\m\c^\s*warning:\s*\zs.*') + if pat !=# '' + let e['text'] = pat + let e['type'] = 'W' + endif + endfor if dummy !=# '' call delete(dummy) diff --git a/sources_non_forked/syntastic/syntax_checkers/d/dmd.vim b/sources_non_forked/syntastic/syntax_checkers/d/dmd.vim index 88979956..de00b8eb 100644 --- a/sources_non_forked/syntastic/syntax_checkers/d/dmd.vim +++ b/sources_non_forked/syntastic/syntax_checkers/d/dmd.vim @@ -44,8 +44,9 @@ function! SyntaxCheckers_d_dmd_IsAvailable() dict " {{{1 endfunction " }}}1 function! SyntaxCheckers_d_dmd_GetLocList() dict " {{{1 + let buf = bufnr('') if !exists('g:syntastic_d_include_dirs') - let g:syntastic_d_include_dirs = s:GetIncludes(self, expand('%:p:h')) + let g:syntastic_d_include_dirs = s:GetIncludes(self, fnamemodify(bufname(buf), ':p:h')) endif return syntastic#c#GetLocList('d', 'dmd', { diff --git a/sources_non_forked/syntastic/syntax_checkers/elixir/elixir.vim b/sources_non_forked/syntastic/syntax_checkers/elixir/elixir.vim index f2ffe67e..939520ed 100644 --- a/sources_non_forked/syntastic/syntax_checkers/elixir/elixir.vim +++ b/sources_non_forked/syntastic/syntax_checkers/elixir/elixir.vim @@ -27,9 +27,10 @@ function! SyntaxCheckers_elixir_elixir_IsAvailable() dict endfunction function! SyntaxCheckers_elixir_elixir_GetLocList() dict + let buf = bufnr('') let make_options = {} let compile_command = 'elixir' - let mix_file = syntastic#util#findFileInParent('mix.exs', expand('%:p:h', 1)) + let mix_file = syntastic#util#findFileInParent('mix.exs', fnamemodify(bufname(buf), ':p:h')) if filereadable(mix_file) let compile_command = 'mix compile' diff --git a/sources_non_forked/syntastic/syntax_checkers/erlang/escript.vim b/sources_non_forked/syntastic/syntax_checkers/erlang/escript.vim index 9fd869fc..f931e6b1 100644 --- a/sources_non_forked/syntastic/syntax_checkers/erlang/escript.vim +++ b/sources_non_forked/syntastic/syntax_checkers/erlang/escript.vim @@ -25,11 +25,13 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_erlang_escript_GetLocList() dict - if expand('%:e', 1) ==# 'hrl' + let buf = bufnr('') + + if fnamemodify(bufname(buf), ':e') ==# 'hrl' return [] endif - let shebang = syntastic#util#parseShebang() + let shebang = syntastic#util#parseShebang(buf) if shebang['exe'] ==# 'escript' let args = '-s' let post_args = '' @@ -39,7 +41,7 @@ function! SyntaxCheckers_erlang_escript_GetLocList() dict endif let makeprg = self.makeprgBuild({ \ 'args_after': args, - \ 'fname': syntastic#util#shexpand('%:p'), + \ 'fname': syntastic#util#shexpand(fnamemodify(bufname(buf), ':p')), \ 'post_args_after': post_args }) let errorformat = diff --git a/sources_non_forked/syntastic/syntax_checkers/eruby/ruby.vim b/sources_non_forked/syntastic/syntax_checkers/eruby/ruby.vim index 16eed623..4850eeef 100644 --- a/sources_non_forked/syntastic/syntax_checkers/eruby/ruby.vim +++ b/sources_non_forked/syntastic/syntax_checkers/eruby/ruby.vim @@ -31,7 +31,8 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict let s:ruby_new = syntastic#util#versionIsAtLeast(self.getVersion(), [1, 9]) endif - let fname = "'" . escape(expand('%', 1), "\\'") . "'" + let buf = bufnr('') + let fname = "'" . escape(bufname(buf), "\\'") . "'" " TODO: encodings became useful in ruby 1.9 :) if s:ruby_new @@ -69,7 +70,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'env': env, - \ 'defaults': { 'bufnr': bufnr(''), 'vcol': 1 } }) + \ 'defaults': { 'bufnr': buf, 'vcol': 1 } }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/sources_non_forked/syntastic/syntax_checkers/glsl/cgc.vim b/sources_non_forked/syntastic/syntax_checkers/glsl/cgc.vim index 602399d7..e51f8335 100644 --- a/sources_non_forked/syntastic/syntax_checkers/glsl/cgc.vim +++ b/sources_non_forked/syntastic/syntax_checkers/glsl/cgc.vim @@ -28,8 +28,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_glsl_cgc_GetLocList() dict " {{{1 + let buf = bufnr('') let makeprg = self.makeprgBuild({ - \ 'args_before': '-oglsl -profile ' . s:GetProfile(), + \ 'args_before': '-oglsl -profile ' . s:GetProfile(buf), \ 'args': (exists('g:syntastic_glsl_options') ? ' ' . g:syntastic_glsl_options : '') }) let errorformat = @@ -43,27 +44,11 @@ endfunction " }}}1 " Utilities {{{1 -function! s:GetProfile() " {{{2 - let save_view = winsaveview() - let old_foldenable = &foldenable - let old_lazyredraw = &lazyredraw - - let &lazyredraw = 1 - let &foldenable = 0 - call cursor(1, 1) - - let magic = '\m\C^// profile:\s*' - let line = search(magic, 'c') - - call winrestview(save_view) - let &foldenable = old_foldenable - let &lazyredraw = old_lazyredraw - - if line - let profile = matchstr(getline(line), magic . '\zs.*') - else - let extensions = exists('g:syntastic_glsl_extensions') ? g:syntastic_glsl_extensions : s:glsl_extensions - let profile = get(extensions, tolower(expand('%:e', 1)), 'gpu_vert') +function! s:GetProfile(buf) " {{{2 + let profile = matchstr(get(filter(getbufline(a:buf, 1, 100), 'v:val =~# "\\m\\C^//\\s*profile:"'), 0, ''), '\m\C^//\s*profile:\s*\zs.*') + if profile ==# '' + let extensions = syntastic#util#bufVar(a:buf, 'glsl_extensions', s:glsl_extensions) + let profile = get(extensions, tolower(fnamemodify(bufname(a:buf), ':e')), 'gpu_vert') endif return profile diff --git a/sources_non_forked/syntastic/syntax_checkers/go/go.vim b/sources_non_forked/syntastic/syntax_checkers/go/go.vim index f32f505b..c45de08f 100644 --- a/sources_non_forked/syntastic/syntax_checkers/go/go.vim +++ b/sources_non_forked/syntastic/syntax_checkers/go/go.vim @@ -30,6 +30,7 @@ function! SyntaxCheckers_go_go_GetLocList() dict if !exists('s:go_new') let s:go_new = syntastic#util#versionIsAtLeast(self.getVersion(self.getExecEscaped() . ' version'), [1, 5]) endif + let buf = bufnr('') " Check with gofmt first, since `go build` and `go test` might not report " syntax errors in the current file if another file with syntax error is @@ -53,14 +54,14 @@ function! SyntaxCheckers_go_go_GetLocList() dict " Test files, i.e. files with a name ending in `_test.go`, are not " compiled by `go build`, therefore `go test` must be called for those. - if match(expand('%', 1), '\m_test\.go$') == -1 - let cmd = 'build' - let opts = syntastic#util#var('go_go_build_args', s:go_new ? '-buildmode=archive' : '') - let cleanup = 0 - else + if bufname(buf) =~# '\m_test\.go$' let cmd = 'test -c' - let opts = syntastic#util#var('go_go_test_args', s:go_new ? '-buildmode=archive' : '') + let opts = syntastic#util#bufVar(buf, 'go_go_test_args', s:go_new ? '-buildmode=archive' : '') let cleanup = 1 + else + let cmd = 'build' + let opts = syntastic#util#bufVar(buf, 'go_go_build_args', s:go_new ? '-buildmode=archive' : '') + let cleanup = 0 endif let opt_str = (type(opts) != type('') || opts !=# '') ? join(syntastic#util#argsescape(opts)) : opts let makeprg = self.getExecEscaped() . ' ' . cmd . ' ' . opt_str @@ -82,12 +83,12 @@ function! SyntaxCheckers_go_go_GetLocList() dict let errors = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'cwd': expand('%:p:h', 1), + \ 'cwd': fnamemodify(bufname(buf), ':p:h'), \ 'env': {'GOGC': 'off'}, \ 'defaults': {'type': 'e'} }) if cleanup - call delete(expand('%:p:h', 1) . syntastic#util#Slash() . expand('%:p:h:t', 1) . '.test') + call delete(fnamemodify(bufname(buf), ':p:h') . syntastic#util#Slash() . fnamemodify(bufname(buf), ':p:h') . '.test') endif return errors diff --git a/sources_non_forked/syntastic/syntax_checkers/go/gometalinter.vim b/sources_non_forked/syntastic/syntax_checkers/go/gometalinter.vim index 780f49b4..1e084fcf 100644 --- a/sources_non_forked/syntastic/syntax_checkers/go/gometalinter.vim +++ b/sources_non_forked/syntastic/syntax_checkers/go/gometalinter.vim @@ -19,9 +19,10 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_go_gometalinter_GetLocList() dict + let buf = bufnr('') let makeprg = self.makeprgBuild({ \ 'args': '-t', - \ 'fname': syntastic#util#shexpand('%:p:h') }) + \ 'fname': syntastic#util#shescape(fnamemodify(bufname(buf), ':p:h')) }) let errorformat = \ '%f:%l:%c:%trror: %m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/go/gotype.vim b/sources_non_forked/syntastic/syntax_checkers/go/gotype.vim index 37472eeb..ca276eb7 100644 --- a/sources_non_forked/syntastic/syntax_checkers/go/gotype.vim +++ b/sources_non_forked/syntastic/syntax_checkers/go/gotype.vim @@ -19,8 +19,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_go_gotype_GetLocList() dict + let buf = bufnr('') let makeprg = self.makeprgBuild({ - \ 'args': (expand('%', 1) =~# '\m_test\.go$' ? '-a' : ''), + \ 'args': (bufname(buf) =~# '\m_test\.go$' ? '-a' : ''), \ 'fname': '.' }) let errorformat = @@ -34,7 +35,7 @@ function! SyntaxCheckers_go_gotype_GetLocList() dict return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'cwd': expand('%:p:h', 1), + \ 'cwd': fnamemodify(bufname(buf), ':p:h'), \ 'defaults': {'type': 'e'} }) endfunction diff --git a/sources_non_forked/syntastic/syntax_checkers/go/govet.vim b/sources_non_forked/syntastic/syntax_checkers/go/govet.vim index 6c306311..1d8015c5 100644 --- a/sources_non_forked/syntastic/syntax_checkers/go/govet.vim +++ b/sources_non_forked/syntastic/syntax_checkers/go/govet.vim @@ -19,6 +19,7 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_go_govet_GetLocList() dict + let buf = bufnr('') let makeprg = self.getExecEscaped() . ' vet' let errorformat = @@ -33,7 +34,7 @@ function! SyntaxCheckers_go_govet_GetLocList() dict return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'cwd': expand('%:p:h', 1), + \ 'cwd': fnamemodify(bufname(buf), ':p:h'), \ 'defaults': {'type': 'w'} }) endfunction diff --git a/sources_non_forked/syntastic/syntax_checkers/haskell/hdevtools.vim b/sources_non_forked/syntastic/syntax_checkers/haskell/hdevtools.vim index f2313b3f..18346f76 100644 --- a/sources_non_forked/syntastic/syntax_checkers/haskell/hdevtools.vim +++ b/sources_non_forked/syntastic/syntax_checkers/haskell/hdevtools.vim @@ -25,9 +25,10 @@ function! SyntaxCheckers_haskell_hdevtools_GetLocList() dict let g:syntastic_haskell_hdevtools_args = g:hdevtools_options endif + let buf = bufnr('') let makeprg = self.makeprgBuild({ \ 'exe_after': 'check', - \ 'fname': syntastic#util#shexpand('%:p') }) + \ 'fname': syntastic#util#shescape(fnamemodify(bufname(buf), ':p')) }) let errorformat = \ '%-Z %#,'. diff --git a/sources_non_forked/syntastic/syntax_checkers/haskell/hlint.vim b/sources_non_forked/syntastic/syntax_checkers/haskell/hlint.vim index c75ea8b4..949a21b1 100644 --- a/sources_non_forked/syntastic/syntax_checkers/haskell/hlint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/haskell/hlint.vim @@ -14,8 +14,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_haskell_hlint_GetLocList() dict + let buf = bufnr('') let makeprg = self.makeprgBuild({ - \ 'fname': syntastic#util#shexpand('%:p')}) + \ 'fname': syntastic#util#shescape(fnamemodify(bufname(buf), ':p')) }) let errorformat = \ '%E%f:%l:%v: Error while reading hint file\, %m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/haxe/haxe.vim b/sources_non_forked/syntastic/syntax_checkers/haxe/haxe.vim index 99ab4a17..c799624d 100644 --- a/sources_non_forked/syntastic/syntax_checkers/haxe/haxe.vim +++ b/sources_non_forked/syntastic/syntax_checkers/haxe/haxe.vim @@ -19,12 +19,10 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_haxe_haxe_GetLocList() dict - if exists('b:vaxe_hxml') - let hxml = b:vaxe_hxml - elseif exists('g:vaxe_hxml') - let hxml = g:vaxe_hxml - else - let hxml = syntastic#util#findGlobInParent('*.hxml', expand('%:p:h', 1)) + let buf = bufnr('') + let hxml = syntastic#util#bufRawVar(buf, 'vaxe_hxml') + if hxml ==# '' + let hxml = syntastic#util#findGlobInParent('*.hxml', fnamemodify(bufname(buf), ':p:h')) endif let hxml = fnamemodify(hxml, ':p') diff --git a/sources_non_forked/syntastic/syntax_checkers/html/validator.vim b/sources_non_forked/syntastic/syntax_checkers/html/validator.vim index 14a4c64d..2fbb158e 100644 --- a/sources_non_forked/syntastic/syntax_checkers/html/validator.vim +++ b/sources_non_forked/syntastic/syntax_checkers/html/validator.vim @@ -31,7 +31,8 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_html_validator_GetLocList() dict - let fname = syntastic#util#shexpand('%') + let buf = bufnr('') + let fname = syntastic#util#shescape(fnamemodify(bufname(buf), ':p')) let makeprg = self.getExecEscaped() . ' -q -L -s --compressed -F out=gnu -F asciiquotes=yes' . \ (g:syntastic_html_validator_parser !=# '' ? ' -F parser=' . g:syntastic_html_validator_parser : '') . \ (g:syntastic_html_validator_nsfilter !=# '' ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') . diff --git a/sources_non_forked/syntastic/syntax_checkers/html/w3.vim b/sources_non_forked/syntastic/syntax_checkers/html/w3.vim index 37ff11a3..8701f99a 100644 --- a/sources_non_forked/syntastic/syntax_checkers/html/w3.vim +++ b/sources_non_forked/syntastic/syntax_checkers/html/w3.vim @@ -23,8 +23,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_html_w3_GetLocList() dict + let buf = bufnr('') let makeprg = self.getExecEscaped() . ' -q -L -s -F output=json ' . - \ '-F uploaded_file=@' . syntastic#util#shexpand('%:p') . '\;type=text/html ' . + \ '-F uploaded_file=@' . syntastic#util#shescape(fnamemodify(bufname(buf), ':p')) . '\;type=text/html ' . \ g:syntastic_html_w3_api let errorformat = diff --git a/sources_non_forked/syntastic/syntax_checkers/java/checkstyle.vim b/sources_non_forked/syntastic/syntax_checkers/java/checkstyle.vim index f4eee5e8..53018320 100644 --- a/sources_non_forked/syntastic/syntax_checkers/java/checkstyle.vim +++ b/sources_non_forked/syntastic/syntax_checkers/java/checkstyle.vim @@ -40,6 +40,8 @@ endfunction function! SyntaxCheckers_java_checkstyle_GetLocList() dict + let buf = bufnr('') + " classpath if !exists('s:sep') let s:sep = syntastic#util#isRunningWindows() || has('win32unix') ? ';' : ':' @@ -58,7 +60,7 @@ function! SyntaxCheckers_java_checkstyle_GetLocList() dict \ '-f', 'xml' ]) " filename - let fname = syntastic#util#shescape( expand('%:p:h', 1) . syntastic#util#Slash() . expand('%:t', 1) ) + let fname = syntastic#util#shescape( fnamemodify(bufname(buf), ':p:h') . syntastic#util#Slash() . fnamemodify(bufname(buf), ':t') ) if has('win32unix') let fname = substitute(syntastic#util#system('cygpath -m ' . fname), '\m\%x00', '', 'g') endif diff --git a/sources_non_forked/syntastic/syntax_checkers/java/javac.vim b/sources_non_forked/syntastic/syntax_checkers/java/javac.vim index 948c2441..3b5b234c 100644 --- a/sources_non_forked/syntastic/syntax_checkers/java/javac.vim +++ b/sources_non_forked/syntastic/syntax_checkers/java/javac.vim @@ -223,7 +223,7 @@ endfunction " }}}2 function! s:SaveClasspath() " {{{2 " build classpath from lines let path = '' - let lines = getline(1, line('$')) + let lines = getline(1, '$') for l in lines let path = s:AddToClasspath(path, l) endfor @@ -281,7 +281,7 @@ endfunction " }}}2 function! s:SaveConfig() " {{{2 " get lines - let lines = getline(1, line('$')) + let lines = getline(1, '$') if g:syntastic_java_javac_config_file_enabled " save config file lines call writefile(lines, expand(g:syntastic_java_javac_config_file, 1)) diff --git a/sources_non_forked/syntastic/syntax_checkers/javascript/closurecompiler.vim b/sources_non_forked/syntastic/syntax_checkers/javascript/closurecompiler.vim index 8c4190ad..41c1346d 100644 --- a/sources_non_forked/syntastic/syntax_checkers/javascript/closurecompiler.vim +++ b/sources_non_forked/syntastic/syntax_checkers/javascript/closurecompiler.vim @@ -42,11 +42,12 @@ function! SyntaxCheckers_javascript_closurecompiler_GetLocList() dict call syntastic#log#deprecationWarn('javascript_closure_compiler_options', 'javascript_closurecompiler_args') call syntastic#log#deprecationWarn('javascript_closure_compiler_file_list', 'javascript_closurecompiler_file_list') - let flist = expand(get(g:, 'syntastic_javascript_closurecompiler_file_list', ''), 1) + let buf = bufnr('') + let flist = expand(syntastic#util#bufVar(buf, 'javascript_closurecompiler_file_list'), 1) if filereadable(flist) let file_list = map( readfile(flist), 'expand(v:var, 1)' ) else - let file_list = [expand('%', 1)] + let file_list = [bufname(buf)] endif let makeprg = self.makeprgBuild({ diff --git a/sources_non_forked/syntastic/syntax_checkers/javascript/flow.vim b/sources_non_forked/syntastic/syntax_checkers/javascript/flow.vim index 456db2b2..5bed76f2 100644 --- a/sources_non_forked/syntastic/syntax_checkers/javascript/flow.vim +++ b/sources_non_forked/syntastic/syntax_checkers/javascript/flow.vim @@ -29,7 +29,8 @@ function! SyntaxCheckers_javascript_flow_IsAvailable() dict endfunction function! SyntaxCheckers_javascript_flow_GetLocList() dict - if syntastic#util#findFileInParent('.flowconfig', expand('%:p:h', 1)) ==# '' + let buf = bufnr('') + if syntastic#util#findFileInParent('.flowconfig', fnamemodify(bufname(buf), ':p:h')) ==# '' return [] endif diff --git a/sources_non_forked/syntastic/syntax_checkers/limbo/limbo.vim b/sources_non_forked/syntastic/syntax_checkers/limbo/limbo.vim index 0dfe03cd..0c639f95 100644 --- a/sources_non_forked/syntastic/syntax_checkers/limbo/limbo.vim +++ b/sources_non_forked/syntastic/syntax_checkers/limbo/limbo.vim @@ -19,6 +19,7 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_limbo_limbo_GetLocList() dict + let buf = bufnr('') let include = $INFERNO_HOME !=# '' ? '-I$INFERNO_HOME ' : '' " don't generate .dis in current dir while checking syntax, " .dis should be generated by `mk` @@ -27,7 +28,7 @@ function! SyntaxCheckers_limbo_limbo_GetLocList() dict let makeprg = self.makeprgBuild({ 'args_before': include . '-w' . output }) let errorformat = '%E%f:%l:%m' - if expand('%', 1) =~# '\m\.m$' + if bufname(buf) =~# '\m\.m$' let errorformat = '%-G%f:%l: near ` EOF ` : no implementation module,' . errorformat endif diff --git a/sources_non_forked/syntastic/syntax_checkers/nasm/nasm.vim b/sources_non_forked/syntastic/syntax_checkers/nasm/nasm.vim index 7ea86d1a..9797d847 100644 --- a/sources_non_forked/syntastic/syntax_checkers/nasm/nasm.vim +++ b/sources_non_forked/syntastic/syntax_checkers/nasm/nasm.vim @@ -19,9 +19,10 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_nasm_nasm_GetLocList() dict + let buf = bufnr('') let makeprg = self.makeprgBuild({ \ 'args_after': '-X gnu' . - \ ' -I ' . syntastic#util#shescape(expand('%:p:h', 1) . syntastic#util#Slash()) . + \ ' -I ' . syntastic#util#shescape(fnamemodify(bufname(buf), ':p:h') . syntastic#util#Slash()) . \ ' ' . syntastic#c#NullOutput() }) let errorformat = '%f:%l: %t%*[^:]: %m' diff --git a/sources_non_forked/syntastic/syntax_checkers/ocaml/camlp4o.vim b/sources_non_forked/syntastic/syntax_checkers/ocaml/camlp4o.vim index f7f34e71..0a1c4213 100644 --- a/sources_non_forked/syntastic/syntax_checkers/ocaml/camlp4o.vim +++ b/sources_non_forked/syntastic/syntax_checkers/ocaml/camlp4o.vim @@ -44,7 +44,8 @@ function! SyntaxCheckers_ocaml_camlp4o_IsAvailable() dict " {{{1 endfunction " }}}1 function! SyntaxCheckers_ocaml_camlp4o_GetLocList() dict " {{{1 - let makeprg = s:GetMakeprg() + let buf = bufnr('') + let makeprg = s:GetMakeprg(buf) if makeprg ==# '' return [] endif @@ -65,7 +66,7 @@ function! SyntaxCheckers_ocaml_camlp4o_GetLocList() dict " {{{1 let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr('')} }) + \ 'defaults': {'bufnr': buf} }) for e in loclist if get(e, 'col', 0) && get(e, 'nr', 0) @@ -79,40 +80,41 @@ endfunction " }}}1 " Utilities {{{1 -function! s:GetMakeprg() " {{{2 +function! s:GetMakeprg(buf) " {{{2 return \ g:syntastic_ocaml_use_ocamlc ? g:syntastic_ocaml_use_ocamlc : - \ (g:syntastic_ocaml_use_ocamlbuild && isdirectory('_build')) ? s:GetOcamlcMakeprg() : - \ s:GetOtherMakeprg() + \ (g:syntastic_ocaml_use_ocamlbuild && isdirectory('_build')) ? s:GetOcamlcMakeprg(a:buf) : + \ s:GetOtherMakeprg(a:buf) endfunction " }}}2 -function! s:GetOcamlcMakeprg() " {{{2 +function! s:GetOcamlcMakeprg(buf) " {{{2 let build_cmd = g:syntastic_ocaml_use_janestreet_core ? \ 'ocamlc -I ' . syntastic#util#shexpand(g:syntastic_ocaml_janestreet_core_dir) : 'ocamlc' - let build_cmd .= ' -c ' . syntastic#util#shexpand('%') + let build_cmd .= ' -c ' . syntastic#util#shescape(bufname(a:buf)) return build_cmd endfunction " }}}2 -function! s:GetOcamlBuildMakeprg() " {{{2 +function! s:GetOcamlBuildMakeprg(buf) " {{{2 return 'ocamlbuild -quiet -no-log -tag annot,' . s:ocamlpp . ' -no-links -no-hygiene -no-sanitize ' . - \ syntastic#util#shexpand('%:r') . '.cmi' + \ syntastic#util#shexpand(fnamemodify(bufname(a:buf), ':r')) . '.cmi' endfunction " }}}2 -function! s:GetOtherMakeprg() " {{{2 +function! s:GetOtherMakeprg(buf) " {{{2 "TODO: give this function a better name? " "TODO: should use throw/catch instead of returning an empty makeprg - let extension = expand('%:e', 1) + let fname = bufname(a:buf) + let extension = fnamemodify(fname, ':e') let makeprg = '' if stridx(extension, 'mly') >= 0 && executable('menhir') " ocamlyacc output can't be redirected, so use menhir - let makeprg = 'menhir --only-preprocess ' . syntastic#util#shexpand('%') . ' >' . syntastic#util#DevNull() + let makeprg = 'menhir --only-preprocess ' . syntastic#util#shescape(fname) . ' >' . syntastic#util#DevNull() elseif stridx(extension,'mll') >= 0 && executable('ocamllex') - let makeprg = 'ocamllex -q ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shexpand('%') + let makeprg = 'ocamllex -q ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shescape(fname) else - let makeprg = 'camlp4o ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shexpand('%') + let makeprg = 'camlp4o ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shescape(fname) endif return makeprg diff --git a/sources_non_forked/syntastic/syntax_checkers/perl/perl.vim b/sources_non_forked/syntastic/syntax_checkers/perl/perl.vim index ca3d0d76..c21de2c6 100644 --- a/sources_non_forked/syntastic/syntax_checkers/perl/perl.vim +++ b/sources_non_forked/syntastic/syntax_checkers/perl/perl.vim @@ -51,13 +51,14 @@ function! SyntaxCheckers_perl_perl_IsAvailable() dict " {{{1 endfunction " }}}1 function! SyntaxCheckers_perl_perl_GetLocList() dict " {{{1 + let buf = bufnr('') if type(g:syntastic_perl_lib_path) == type('') call syntastic#log#oneTimeWarn('variable g:syntastic_perl_lib_path should be a list') let includes = split(g:syntastic_perl_lib_path, ',') else - let includes = copy(syntastic#util#var('perl_lib_path', [])) + let includes = copy(syntastic#util#bufVar(buf, 'perl_lib_path', [])) endif - let shebang = syntastic#util#parseShebang() + let shebang = syntastic#util#parseShebang(buf) let extra = map(includes, '"-I" . v:val') + \ (index(shebang['args'], '-T') >= 0 ? ['-T'] : []) + \ (index(shebang['args'], '-t') >= 0 ? ['-t'] : []) diff --git a/sources_non_forked/syntastic/syntax_checkers/r/lint.vim b/sources_non_forked/syntastic/syntax_checkers/r/lint.vim index 854c1709..0e4f0441 100644 --- a/sources_non_forked/syntastic/syntax_checkers/r/lint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/r/lint.vim @@ -43,11 +43,13 @@ function! SyntaxCheckers_r_lint_IsAvailable() dict endfunction function! SyntaxCheckers_r_lint_GetLocList() dict + let buf = bufnr('') + let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : '' let makeprg = self.getExecEscaped() . ' --slave --restore --no-save' . \ ' -e ' . syntastic#util#shescape(setwd . 'library(lint); ' . \ 'try(lint(commandArgs(TRUE), ' . g:syntastic_r_lint_styles . '))') . - \ ' --args ' . syntastic#util#shexpand('%') + \ ' --args ' . syntastic#util#shescape(bufname(buf)) let errorformat = \ '%t:%f:%l:%v: %m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/r/lintr.vim b/sources_non_forked/syntastic/syntax_checkers/r/lintr.vim index 7c71ec07..19068c9c 100644 --- a/sources_non_forked/syntastic/syntax_checkers/r/lintr.vim +++ b/sources_non_forked/syntastic/syntax_checkers/r/lintr.vim @@ -38,7 +38,7 @@ set cpo&vim function! SyntaxCheckers_r_lintr_GetHighlightRegex(item) let term = matchstr(a:item['text'], "\\m'\\zs[^']\\+\\ze'") - return term != '' ? '\V' . escape(term, '\') : '' + return term !=# '' ? '\V' . escape(term, '\') : '' endfunction function! SyntaxCheckers_r_lintr_IsAvailable() dict @@ -50,11 +50,13 @@ function! SyntaxCheckers_r_lintr_IsAvailable() dict endfunction function! SyntaxCheckers_r_lintr_GetLocList() dict + let buf = bufnr('') + let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : '' let makeprg = self.getExecEscaped() . ' --slave --no-restore --no-save' . \ ' -e ' . syntastic#util#shescape(setwd . 'suppressPackageStartupMessages(library(lintr)); ' . \ 'lint(cache = ' . g:syntastic_r_lintr_cache . ', commandArgs(TRUE), ' . g:syntastic_r_lintr_linters . ')') . - \ ' --args ' . syntastic#util#shexpand('%') + \ ' --args ' . syntastic#util#shescape(bufname(buf)) let errorformat = \ '%W%f:%l:%c: style: %m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/r/svtools.vim b/sources_non_forked/syntastic/syntax_checkers/r/svtools.vim index d2a6a748..eb85f8aa 100644 --- a/sources_non_forked/syntastic/syntax_checkers/r/svtools.vim +++ b/sources_non_forked/syntastic/syntax_checkers/r/svtools.vim @@ -46,11 +46,13 @@ function! SyntaxCheckers_r_svtools_IsAvailable() dict endfunction function! SyntaxCheckers_r_svtools_GetLocList() dict + let buf = bufnr('') + let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : '' let makeprg = self.getExecEscaped() . ' --slave --restore --no-save' . \ ' -e ' . syntastic#util#shescape(setwd . 'library(svTools); ' . \ 'try(lint(commandArgs(TRUE), filename = commandArgs(TRUE), type = "flat", sep = ":"))') . - \ ' --args ' . syntastic#util#shexpand('%') + \ ' --args ' . syntastic#util#shescape(bufname(buf)) let errorformat = \ '%trror:%f:%\s%#%l:%\s%#%v:%m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/rst/sphinx.vim b/sources_non_forked/syntastic/syntax_checkers/rst/sphinx.vim index 3c211f4a..1ef058b3 100644 --- a/sources_non_forked/syntastic/syntax_checkers/rst/sphinx.vim +++ b/sources_non_forked/syntastic/syntax_checkers/rst/sphinx.vim @@ -26,11 +26,12 @@ augroup syntastic augroup END function! SyntaxCheckers_rst_sphinx_GetLocList() dict + let buf = bufnr('') - let srcdir = syntastic#util#var('rst_sphinx_source_dir') - call self.log('g:syntastic_rst_sphinx_source_dir =', srcdir) + let srcdir = syntastic#util#bufVar(buf, 'rst_sphinx_source_dir') + call self.log('syntastic_rst_sphinx_source_dir =', srcdir) if srcdir ==# '' - let config = syntastic#util#findFileInParent('conf.py', expand('%:p:h', 1)) + let config = syntastic#util#findFileInParent('conf.py', fnamemodify(bufname(buf), ':p:h')) if config ==# '' || !filereadable(config) call self.log('conf.py file not found') return [] @@ -38,10 +39,10 @@ function! SyntaxCheckers_rst_sphinx_GetLocList() dict let srcdir = fnamemodify(config, ':p:h') endif - let confdir = syntastic#util#var('rst_sphinx_config_dir') - call self.log('g:syntastic_rst_sphinx_config_dir =', confdir) + let confdir = syntastic#util#bufVar(buf, 'rst_sphinx_config_dir') + call self.log('syntastic_rst_sphinx_config_dir =', confdir) if confdir ==# '' - let config = syntastic#util#findFileInParent('conf.py', expand('%:p:h', 1)) + let config = syntastic#util#findFileInParent('conf.py', fnamemodify(bufname(buf), ':p:h')) let confdir = (config !=# '' && filereadable(config)) ? fnamemodify(config, ':p:h') : srcdir endif diff --git a/sources_non_forked/syntastic/syntax_checkers/sass/sass.vim b/sources_non_forked/syntastic/syntax_checkers/sass/sass.vim index 5f6194f2..f4dd2f6c 100644 --- a/sources_non_forked/syntastic/syntax_checkers/sass/sass.vim +++ b/sources_non_forked/syntastic/syntax_checkers/sass/sass.vim @@ -15,8 +15,8 @@ if exists('g:loaded_syntastic_sass_sass_checker') endif let g:loaded_syntastic_sass_sass_checker = 1 -"sass caching for large files drastically speeds up the checking, but store it -"in a temp location otherwise sass puts .sass_cache dirs in the users project +" sass caching for large files drastically speeds up the checking, but store it +" in a temp location otherwise sass puts .sass_cache dirs in the users project let s:sass_cache_location = syntastic#util#tmpdir() lockvar s:sass_cache_location @@ -24,12 +24,12 @@ augroup syntastic autocmd VimLeave * call syntastic#util#rmrf(s:sass_cache_location) augroup END -"By default do not check partials as unknown variables are a syntax error +" By default do not check partials as unknown variables are a syntax error if !exists('g:syntastic_sass_check_partials') let g:syntastic_sass_check_partials = 0 endif -"use compass imports if available +" use compass imports if available let s:imports = '' if executable('compass') let s:imports = '--compass' @@ -39,7 +39,8 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_sass_sass_GetLocList() dict - if !g:syntastic_sass_check_partials && expand('%:t', 1)[0] ==# '_' + let buf = bufnr('') + if !syntastic#util#bufVar(buf, 'sass_check_partials') && fnamemodify(bufname(buf), ':t')[0] ==# '_' return [] endif diff --git a/sources_non_forked/syntastic/syntax_checkers/scala/fsc.vim b/sources_non_forked/syntastic/syntax_checkers/scala/fsc.vim index 0398e7ac..811443dd 100644 --- a/sources_non_forked/syntastic/syntax_checkers/scala/fsc.vim +++ b/sources_non_forked/syntastic/syntax_checkers/scala/fsc.vim @@ -24,9 +24,10 @@ function! SyntaxCheckers_scala_fsc_GetLocList() dict " fsc has some serious problems with the " working directory changing after being started " that's why we better pass an absolute path + let buf = bufnr('') let makeprg = self.makeprgBuild({ \ 'args': '-Ystop-after:parser', - \ 'fname': syntastic#util#shexpand('%:p') }) + \ 'fname': syntastic#util#shescape(fnamemodify(bufname(buf), ':p')) }) let errorformat = \ '%E%f:%l: %trror: %m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/sh/sh.vim b/sources_non_forked/syntastic/syntax_checkers/sh/sh.vim index 395b81b3..007eec4c 100644 --- a/sources_non_forked/syntastic/syntax_checkers/sh/sh.vim +++ b/sources_non_forked/syntastic/syntax_checkers/sh/sh.vim @@ -19,21 +19,23 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_sh_sh_IsAvailable() dict " {{{1 - call self.log('shell =', s:GetShell()) - return s:IsShellValid() + let buf = bufnr('') + call self.log('shell =', s:GetShell(buf)) + return s:IsShellValid(buf) endfunction " }}}1 function! SyntaxCheckers_sh_sh_GetLocList() dict " {{{1 - if s:GetShell() ==# 'zsh' + let buf = bufnr('') + if s:GetShell(buf) ==# 'zsh' return s:ForwardToZshChecker() endif - if !s:IsShellValid() + if !s:IsShellValid(buf) return [] endif let makeprg = self.makeprgBuild({ - \ 'exe': s:GetShell(), + \ 'exe': s:GetShell(buf), \ 'args_after': '-n' }) let errorformat = '%f: line %l: %m' @@ -45,29 +47,29 @@ endfunction " }}}1 " Utilities {{{1 -function! s:GetShell() " {{{2 - if !exists('b:shell') || b:shell ==# '' - let b:shell = '' - let shebang = syntastic#util#parseShebang()['exe'] +function! s:GetShell(buf) " {{{2 + let shell = syntastic#util#getbufvar(a:buf, 'shell') + if shell ==# '' + let shebang = syntastic#util#parseShebang(a:buf)['exe'] if shebang !=# '' if shebang[-strlen('bash'):-1] ==# 'bash' - let b:shell = 'bash' + let shell = 'bash' elseif shebang[-strlen('zsh'):-1] ==# 'zsh' - let b:shell = 'zsh' + let shell = 'zsh' elseif shebang[-strlen('sh'):-1] ==# 'sh' - let b:shell = 'sh' + let shell = 'sh' endif endif " try to use env variable in case no shebang could be found - if b:shell ==# '' - let b:shell = fnamemodify($SHELL, ':t') + if shell ==# '' + let shell = fnamemodify($SHELL, ':t') endif endif - return b:shell + return shell endfunction " }}}2 -function! s:IsShellValid() " {{{2 - let shell = s:GetShell() +function! s:IsShellValid(buf) " {{{2 + let shell = s:GetShell(a:buf) return shell !=# '' && executable(shell) endfunction " }}}2 diff --git a/sources_non_forked/syntastic/syntax_checkers/sh/shellcheck.vim b/sources_non_forked/syntastic/syntax_checkers/sh/shellcheck.vim index 5189e199..cf86c7e3 100644 --- a/sources_non_forked/syntastic/syntax_checkers/sh/shellcheck.vim +++ b/sources_non_forked/syntastic/syntax_checkers/sh/shellcheck.vim @@ -12,8 +12,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_sh_shellcheck_GetLocList() dict " {{{1 + let buf = bufnr('') let makeprg = self.makeprgBuild({ - \ 'args': s:GetShell(), + \ 'args': s:GetShell(buf), \ 'args_after': '-f gcc' }) let errorformat = @@ -38,15 +39,15 @@ endfunction " }}}1 " Utilities {{{1 -function! s:GetShell() " {{{2 +function! s:GetShell(buf) " {{{2 let sh = '' - if syntastic#util#parseShebang()['exe'] ==# '' - if syntastic#util#rawVar('is_kornshell', 0) || syntastic#util#rawVar('is_posix', 0) + if syntastic#util#parseShebang(a:buf)['exe'] ==# '' + if syntastic#util#bufRawVar(a:buf, 'is_kornshell', 0) || syntastic#util#bufRawVar(a:buf, 'is_posix', 0) let sh = 'ksh' - elseif syntastic#util#rawVar('is_bash', 0) + elseif syntastic#util#bufRawVar(a:buf, 'is_bash', 0) let sh = 'bash' - elseif syntastic#util#rawVar('is_sh', 0) + elseif syntastic#util#bufRawVar(a:buf, 'is_sh', 0) let sh = 'sh' endif endif diff --git a/sources_non_forked/syntastic/syntax_checkers/vala/valac.vim b/sources_non_forked/syntastic/syntax_checkers/vala/valac.vim index 8b11d456..6c3fef70 100644 --- a/sources_non_forked/syntastic/syntax_checkers/vala/valac.vim +++ b/sources_non_forked/syntastic/syntax_checkers/vala/valac.vim @@ -44,19 +44,17 @@ endfunction " }}}1 " Utilities {{{1 function! s:GetValaOpts(buf, name, comment, cmd) " {{{2 - let var = syntastic#util#var('vala_' . a:name) + let var = syntastic#util#bufVar(a:buf, 'vala_' . a:name) if type(var) == type([]) let opts = map(copy(var), 'syntastic#util#shescape(v:val)') elseif type(var) == type('') if var !=# '' - let opts = split(var, '\s\+') + let opts = split(var, '\m\s\+') else let opts = [] for line in filter(getbufline(a:buf, 1, 100), 'v:val =~# ' . string('\m^//\s\+' . a:comment . ':\s*')) - call extend(opts, split( matchstr(line, '\m^//\s\+' . a:comment . ':\s*\zs.*'), '\s\+' )) + call extend(opts, split( matchstr(line, '\m^//\s\+' . a:comment . ':\s*\zs.*'), '\m\s\+' )) endfor - - call map( filter(opts, 'v:val !=# ""'), 'syntastic#util#shescape(v:val)' ) endif else call syntastic#log#error('syntastic_vala_' . a:name . ' must be either a list, or a string') diff --git a/sources_non_forked/syntastic/syntax_checkers/vim/vimlint.vim b/sources_non_forked/syntastic/syntax_checkers/vim/vimlint.vim index 19cab49e..210eeece 100644 --- a/sources_non_forked/syntastic/syntax_checkers/vim/vimlint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/vim/vimlint.vim @@ -44,6 +44,8 @@ function! SyntaxCheckers_vim_vimlint_IsAvailable() dict " {{{1 endfunction " }}}1 function! SyntaxCheckers_vim_vimlint_GetLocList() dict " {{{1 + let buf = bufnr('') + " EVL102: unused variable v " EVL103: unused argument v " EVL104: variable may not be initialized on some execution path: v @@ -67,17 +69,15 @@ function! SyntaxCheckers_vim_vimlint_GetLocList() dict " {{{1 \ 'EVL204': 3, \ 'EVL205': 3 } - if exists('g:syntastic_vimlint_options') || exists('b:syntastic_vimlint_options') - let opts = syntastic#util#var('vimlint_options') - if type(opts) == type({}) - let options = filter(copy(opts), 'v:key =~# "\\m^EVL"') - call extend(param, options, 'force') - endif + let opts = syntastic#util#bufVar(buf, 'vimlint_options') + if type(opts) == type({}) + let options = filter(copy(opts), 'v:key =~# "\\m^EVL"') + call extend(param, options, 'force') endif call self.log('options =', param) - return vimlint#vimlint(expand('%', 1), param) + return vimlint#vimlint(bufname(buf), param) endfunction " }}}1 " Utilities {{{1 diff --git a/sources_non_forked/syntastic/syntax_checkers/xquery/basex.vim b/sources_non_forked/syntastic/syntax_checkers/xquery/basex.vim index 640a1910..0d867ad3 100644 --- a/sources_non_forked/syntastic/syntax_checkers/xquery/basex.vim +++ b/sources_non_forked/syntastic/syntax_checkers/xquery/basex.vim @@ -18,10 +18,11 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_xquery_basex_GetLocList() dict + let buf = bufnr('') let makeprg = self.makeprgBuild({ \ 'args_after': '-z', \ 'fname_before': '-q', - \ 'fname': syntastic#util#shescape('inspect:module("' . escape(expand('%:p', 1), '"') . '")') }) + \ 'fname': syntastic#util#shescape('inspect:module("' . escape(fnamemodify(bufname(buf), ':p'), '"') . '")') }) let errorformat = \ '%f:%l:%c:%t:%n:%m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/yaml/yamlxs.vim b/sources_non_forked/syntastic/syntax_checkers/yaml/yamlxs.vim index ace118a4..55f8c64e 100644 --- a/sources_non_forked/syntastic/syntax_checkers/yaml/yamlxs.vim +++ b/sources_non_forked/syntastic/syntax_checkers/yaml/yamlxs.vim @@ -29,13 +29,14 @@ function! SyntaxCheckers_yaml_yamlxs_IsAvailable() dict " don't call executable() here, to allow things like " let g:syntastic_perl_interpreter='/usr/bin/env perl' - silent! call syntastic#util#system(self.getExecEscaped() . ' ' . s:Modules() . ' -e ' . syntastic#util#shescape('exit(0)')) + silent! call syntastic#util#system(self.getExecEscaped() . ' ' . s:Modules(bufnr('')) . ' -e ' . syntastic#util#shescape('exit(0)')) return v:shell_error == 0 endfunction function! SyntaxCheckers_yaml_yamlxs_GetLocList() dict + let buf = bufnr('') let makeprg = self.makeprgBuild({ - \ 'args_before': s:Modules() . ' -e ' . syntastic#util#shescape('YAML::XS::LoadFile($ARGV[0])') }) + \ 'args_before': s:Modules(buf) . ' -e ' . syntastic#util#shescape('YAML::XS::LoadFile($ARGV[0])') }) let errorformat = \ '%EYAML::XS::Load Error: The problem:,' . @@ -51,12 +52,13 @@ function! SyntaxCheckers_yaml_yamlxs_GetLocList() dict \ 'defaults': {'bufnr': bufnr('')} }) endfunction -function s:Modules() - if type(g:syntastic_perl_lib_path) == type('') - call syntastic#log#oneTimeWarn('variable g:syntastic_perl_lib_path should be a list') - let includes = split(g:syntastic_perl_lib_path, ',') +function s:Modules(buf) + let lib_path = syntastic#util#bufVar(a:buf, 'perl_lib_path') + if type(lib_path) == type('') + call syntastic#log#oneTimeWarn('variable syntastic_perl_lib_path should be a list') + let includes = split(lib_path, ',') else - let includes = copy(syntastic#util#var('perl_lib_path')) + let includes = copy(lib_path) endif return join(map(includes, '"-I" . v:val') + ['-MYAML::XS']) endfunction diff --git a/sources_non_forked/vim-coffee-script/Copying.md b/sources_non_forked/vim-coffee-script/Copying.md index a31ad2ff..9520fb91 100644 --- a/sources_non_forked/vim-coffee-script/Copying.md +++ b/sources_non_forked/vim-coffee-script/Copying.md @@ -1,3 +1,14 @@ +All files except: + +ftdetect/vim-literate-coffeescript.vim +indent/litcoffee.vim +syntax/litcoffee.vim +test/test.coffee.md +test/test.litcoffee +test/test.png + +Issued under WTFPL: + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 @@ -13,3 +24,31 @@ 0. You just DO WHAT THE FUCK YOU WANT TO. +These files issed under this license: + +ftdetect/vim-literate-coffeescript.vim +indent/litcoffee.vim +syntax/litcoffee.vim +test/test.coffee.md +test/test.litcoffee +test/test.png + +Copyright (c) 2013 Michael Smith + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sources_non_forked/vim-coffee-script/Readme.md b/sources_non_forked/vim-coffee-script/Readme.md index 08d61f1d..053a71b8 100644 --- a/sources_non_forked/vim-coffee-script/Readme.md +++ b/sources_non_forked/vim-coffee-script/Readme.md @@ -337,23 +337,15 @@ It behaves very similar to `:make`, described [above](#compile-to-javascript). ## Literate CoffeeScript -Literate CoffeeScript syntax and indent support is provided by -[vim-literate-coffeescript]. The `Coffee` commands detect when they're running -on a litcoffee file and pass the `--literate` flag to their respective tools, -but at this time the commands are not automatically loaded when a litcoffee file -is opened. +Literate CoffeeScript syntax and indent support is now built in! The `Coffee` +commands detect when they're running on a litcoffee file and pass the +`--literate` flag to their respective tools. -[vim-literate-coffeescript]: https://github.com/mintplant/vim-literate-coffeescript - -To load them, run - - runtime ftplugin/coffee.vim - -while inside a litcoffee buffer. To do this automatically, add - - autocmd FileType litcoffee runtime ftplugin/coffee.vim - -to your vimrc. +Literate CoffeeScript syntax and indent support was written by @mintplant +(Michael Smith). A standalone repo +[exists](https://github.com/jwhitley/vim-literate-coffeescript), but you'll +need to copy the `ftplugin/litcoffee.vim` file or set up an autocmd to get the +`Coffee` commands to be automatically loaded for litcoffee files. ## CoffeeScript in HTML diff --git a/sources_non_forked/vim-coffee-script/ftdetect/vim-literate-coffeescript.vim b/sources_non_forked/vim-coffee-script/ftdetect/vim-literate-coffeescript.vim new file mode 100644 index 00000000..7f666246 --- /dev/null +++ b/sources_non_forked/vim-coffee-script/ftdetect/vim-literate-coffeescript.vim @@ -0,0 +1,8 @@ +" Language: Literate CoffeeScript +" Maintainer: Michael Smith +" URL: https://github.com/mintplant/vim-literate-coffeescript +" License: MIT + +autocmd BufNewFile,BufRead *.litcoffee set filetype=litcoffee +autocmd BufNewFile,BufRead *.coffee.md set filetype=litcoffee + diff --git a/sources_non_forked/vim-coffee-script/ftplugin/litcoffee.vim b/sources_non_forked/vim-coffee-script/ftplugin/litcoffee.vim new file mode 100644 index 00000000..febc730c --- /dev/null +++ b/sources_non_forked/vim-coffee-script/ftplugin/litcoffee.vim @@ -0,0 +1 @@ +runtime ftplugin/coffee.vim diff --git a/sources_non_forked/vim-coffee-script/indent/litcoffee.vim b/sources_non_forked/vim-coffee-script/indent/litcoffee.vim new file mode 100644 index 00000000..599cbea8 --- /dev/null +++ b/sources_non_forked/vim-coffee-script/indent/litcoffee.vim @@ -0,0 +1,22 @@ +if exists('b:did_indent') + finish +endif + +runtime! indent/coffee.vim + +let b:did_indent = 1 + +setlocal indentexpr=GetLitCoffeeIndent() + +if exists('*GetLitCoffeeIndent') + finish +endif + +function GetLitCoffeeIndent() + if searchpair('^ \|\t', '', '$', 'bWnm') > 0 + return GetCoffeeIndent(v:lnum) + else + return -1 + endif +endfunc + diff --git a/sources_non_forked/vim-coffee-script/syntax/coffee.vim b/sources_non_forked/vim-coffee-script/syntax/coffee.vim index 973bb547..88917fe7 100644 --- a/sources_non_forked/vim-coffee-script/syntax/coffee.vim +++ b/sources_non_forked/vim-coffee-script/syntax/coffee.vim @@ -32,7 +32,7 @@ hi def link coffeeConditional Conditional syn match coffeeException /\<\%(try\|catch\|finally\)\>/ display hi def link coffeeException Exception -syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\|debugger\|import\|export\)\>/ +syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\|debugger\|import\|export\|await\)\>/ \ display " The `own` keyword is only a keyword after `for`. syn match coffeeKeyword /\/ contained containedin=coffeeRepeat diff --git a/sources_non_forked/vim-coffee-script/syntax/litcoffee.vim b/sources_non_forked/vim-coffee-script/syntax/litcoffee.vim new file mode 100644 index 00000000..c6a4423c --- /dev/null +++ b/sources_non_forked/vim-coffee-script/syntax/litcoffee.vim @@ -0,0 +1,23 @@ +" Language: Literate CoffeeScript +" Maintainer: Michael Smith +" URL: https://github.com/mintplant/vim-literate-coffeescript +" License: MIT + +if exists('b:current_syntax') && b:current_syntax == 'litcoffee' + finish +endif + +syn include @markdown syntax/markdown.vim +syn include @coffee syntax/coffee.vim + +" Partition the file into notCoffee and inlineCoffee. Each line will match +" exactly one of these regions. notCoffee matches with a zero-width +" look-behind. +syn region notCoffee start='^\%( \|\t\)\@ + @variables = [{name: 'arguments', type: 'arguments'}] + @positions = {} + Scope.root = this unless @parent + +Adds a new variable or overrides an existing one. + + add: (name, type, immediate) -> + return @parent.add name, type, immediate if @shared and not immediate + if Object::hasOwnProperty.call @positions, name + @variables[@positions[name]].type = type + else + @positions[name] = @variables.push({name, type}) - 1 + +When `super` is called, we need to find the name of the current method we're +in, so that we know how to invoke the same method of the parent class. This +can get complicated if super is being called from an inner function. +`namedMethod` will walk up the scope tree until it either finds the first +function object that has a name filled in, or bottoms out. + + namedMethod: -> + return @method if @method.name or !@parent + @parent.namedMethod() + +Look up a variable name in lexical scope, and declare it if it does not +already exist. + + find: (name) -> + return yes if @check name + @add name, 'var' + no + +Reserve a variable name as originating from a function parameter for this +scope. No `var` required for internal references. + + parameter: (name) -> + return if @shared and @parent.check name, yes + @add name, 'param' + +Just check to see if a variable has already been declared, without reserving, +walks up to the root scope. + + check: (name) -> + !!(@type(name) or @parent?.check(name)) + +Generate a temporary variable name at the given index. + + temporary: (name, index) -> + if name.length > 1 + '_' + name + if index > 1 then index - 1 else '' + else + '_' + (index + parseInt name, 36).toString(36).replace /\d/g, 'a' + +Gets the type of a variable. + + type: (name) -> + return v.type for v in @variables when v.name is name + null + +If we need to store an intermediate result, find an available name for a +compiler-generated variable. `_var`, `_var2`, and so on... + + freeVariable: (name, reserve=true) -> + index = 0 + index++ while @check((temp = @temporary name, index)) + @add temp, 'var', yes if reserve + temp + +Ensure that an assignment is made at the top of this scope +(or at the top-level scope, if requested). + + assign: (name, value) -> + @add name, {value, assigned: yes}, yes + @hasAssignments = yes + +Does this scope have any declared variables? + + hasDeclarations: -> + !!@declaredVariables().length + +Return the list of variables first declared in this scope. + + declaredVariables: -> + realVars = [] + tempVars = [] + for v in @variables when v.type is 'var' + (if v.name.charAt(0) is '_' then tempVars else realVars).push v.name + realVars.sort().concat tempVars.sort() + +Return the list of assignments that are supposed to be made at the top +of this scope. + + assignedVariables: -> + "#{v.name} = #{v.type.value}" for v in @variables when v.type.assigned + diff --git a/sources_non_forked/vim-coffee-script/test/test.litcoffee b/sources_non_forked/vim-coffee-script/test/test.litcoffee new file mode 100644 index 00000000..62b99b7d --- /dev/null +++ b/sources_non_forked/vim-coffee-script/test/test.litcoffee @@ -0,0 +1,117 @@ +The **Scope** class regulates lexical scoping within CoffeeScript. As you +generate code, you create a tree of scopes in the same shape as the nested +function bodies. Each scope knows about the variables declared within it, +and has a reference to its parent enclosing scope. In this way, we know which +variables are new and need to be declared with `var`, and which are shared +with external scopes. + +Import the helpers we plan to use. + + {extend, last} = require './helpers' + + exports.Scope = class Scope + +The `root` is the top-level **Scope** object for a given file. + + @root: null + +Initialize a scope with its parent, for lookups up the chain, +as well as a reference to the **Block** node it belongs to, which is +where it should declare its variables, and a reference to the function that +it belongs to. + + constructor: (@parent, @expressions, @method) -> + @variables = [{name: 'arguments', type: 'arguments'}] + @positions = {} + Scope.root = this unless @parent + +Adds a new variable or overrides an existing one. + + add: (name, type, immediate) -> + return @parent.add name, type, immediate if @shared and not immediate + if Object::hasOwnProperty.call @positions, name + @variables[@positions[name]].type = type + else + @positions[name] = @variables.push({name, type}) - 1 + +When `super` is called, we need to find the name of the current method we're +in, so that we know how to invoke the same method of the parent class. This +can get complicated if super is being called from an inner function. +`namedMethod` will walk up the scope tree until it either finds the first +function object that has a name filled in, or bottoms out. + + namedMethod: -> + return @method if @method.name or !@parent + @parent.namedMethod() + +Look up a variable name in lexical scope, and declare it if it does not +already exist. + + find: (name) -> + return yes if @check name + @add name, 'var' + no + +Reserve a variable name as originating from a function parameter for this +scope. No `var` required for internal references. + + parameter: (name) -> + return if @shared and @parent.check name, yes + @add name, 'param' + +Just check to see if a variable has already been declared, without reserving, +walks up to the root scope. + + check: (name) -> + !!(@type(name) or @parent?.check(name)) + +Generate a temporary variable name at the given index. + + temporary: (name, index) -> + if name.length > 1 + '_' + name + if index > 1 then index - 1 else '' + else + '_' + (index + parseInt name, 36).toString(36).replace /\d/g, 'a' + +Gets the type of a variable. + + type: (name) -> + return v.type for v in @variables when v.name is name + null + +If we need to store an intermediate result, find an available name for a +compiler-generated variable. `_var`, `_var2`, and so on... + + freeVariable: (name, reserve=true) -> + index = 0 + index++ while @check((temp = @temporary name, index)) + @add temp, 'var', yes if reserve + temp + +Ensure that an assignment is made at the top of this scope +(or at the top-level scope, if requested). + + assign: (name, value) -> + @add name, {value, assigned: yes}, yes + @hasAssignments = yes + +Does this scope have any declared variables? + + hasDeclarations: -> + !!@declaredVariables().length + +Return the list of variables first declared in this scope. + + declaredVariables: -> + realVars = [] + tempVars = [] + for v in @variables when v.type is 'var' + (if v.name.charAt(0) is '_' then tempVars else realVars).push v.name + realVars.sort().concat tempVars.sort() + +Return the list of assignments that are supposed to be made at the top +of this scope. + + assignedVariables: -> + "#{v.name} = #{v.type.value}" for v in @variables when v.type.assigned + diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index 1185ff15..66948f70 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -1060,13 +1060,14 @@ function! s:Commit(args, ...) abort else noautocmd silent execute '!'.command.' > '.outfile.' 2> '.errorfile endif + let error = v:shell_error finally execute cd.'`=dir`' endtry if !has('gui_running') redraw! endif - if !v:shell_error + if !error if filereadable(outfile) for line in readfile(outfile) echo line diff --git a/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md b/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md index 467b1287..e6b5f203 100644 --- a/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md +++ b/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md @@ -4,10 +4,10 @@ Write here what's happening and what you're expecting instead of... ### Steps to reproduce: -Please create a reproducible case of your problem. If this step is +Please create a reproducible case of your problem. If this step is not provided, the issue will be **closed** -Re produce it with a minimal `vimrc` with all plugins disabled and +Re produce it with a minimal `vimrc` with all plugins disabled and only `vim-go` enabled: 1. @@ -20,7 +20,6 @@ Add here your current configuration and additional information that might be useful, such as: * `vimrc` you used to reproduce -* vim version: +* vim version: * vim-go version: -* go version: - +* go version: diff --git a/sources_non_forked/vim-go/.travis.yml b/sources_non_forked/vim-go/.travis.yml index a5ee1559..d05b23ea 100644 --- a/sources_non_forked/vim-go/.travis.yml +++ b/sources_non_forked/vim-go/.travis.yml @@ -19,4 +19,3 @@ install: | cd - script: ./scripts/test.sh - diff --git a/sources_non_forked/vim-go/CHANGELOG.md b/sources_non_forked/vim-go/CHANGELOG.md index b2f47f58..46662bc8 100644 --- a/sources_non_forked/vim-go/CHANGELOG.md +++ b/sources_non_forked/vim-go/CHANGELOG.md @@ -2,6 +2,7 @@ FEATURES: +* New `:GoAddTags` and `:GoRemoveTags` command based on the tool [gomodifytags](https://github.com/fatih/gomodifytags). This fixes many old bugs that were due prior regexp based implementation. For the usage please read the docs and checkout the demo at: https://github.com/fatih/vim-go/pull/1204 [gh-1204] * Add new `errl` snippet that expands to [gh-1185]: ``` @@ -14,6 +15,10 @@ IMPROVEMENTS: * Lowercase `` in mappings examples for consisten documentation across the README [gh-1192] * All of files should be written in utf-8 if the file will be passed to external command. [gh-1184] +* `:GoAddTags` is now able to add options to existing tags with the syntax `:GoAddTags key,option`, i.e: `:GoAddTags json,omitempty` [gh-985] +* Document 'noshowmode' requirement for echo_go_info [gh-1197] +* Improve godoc view for vertical splits [gh-1195] +* Set GOPATH for both possible go guru execution paths (sync and async) [gh-1193] BUG FIXES: @@ -22,6 +27,15 @@ BUG FIXES: * Update statusline before and after `go#jobcontrol#Spawn` command is executed [gh-1176] * Correctly report the value of the 'g:go_guru_tags' variable [gh-1177] * Ensure no trailing `:` exist in GOPATH detection if initial GOPATH is not set [gh-1194] +* Fix `:GoAddTags` to allow modifying existing comments [gh-984] +* Fix `:GoAddTags` to work with nested structs [gh-990] +* Fix `:GoAddTags` adding tags twice for existing tags [gh-1064] +* Fix `:GoAddTags` not working for fiels of types `interface{}` [gh-1091] +* Fix `:GoAddTags` not working for fields with one line comments [gh-1181] +* Fix `:GoAddTags` not working if any field comment would contain `{}` [gh-1189] +* Respect go_fmt_options when running goimports [gh-1211] +* Set the filename in the location-list when there is an error with :GoFmt [gh-1199] + ## 1.11 - (January 9, 2017) @@ -80,7 +94,7 @@ FEATURES: you have at least Vim 8.0.0087. Backwards compatible with Vim 7.4.x. If you see any problems, please open an issue. -* We have now a [logo for vim-go](https://github.com/fatih/vim-go/blob/master/assets/vim-go.png)! Thanks to @egonelbre for his work on this. +* We have now a [logo for vim-go](https://github.com/fatih/vim-go/blob/master/assets/vim-go.png)! Thanks to @egonelbre for his work on this. * `:GoBuild`, `:GoTest`, `:GoTestCompile`, `:GoInstall` commands are now fully async. Async means it doesn't block your UI anymore. If the command finished it echoes the status. For a better experience use the statusline information @@ -95,7 +109,7 @@ FEATURES: `:GoMetaLinterAutoSaveToggle` (temporary) or add `let g:go_metalinter_autosave = 1` (persistent) to your virmc). -* All `guru` commands run asynchronously if Vim 8.0 is being used. Current +* All `guru` commands run asynchronously if Vim 8.0 is being used. Current Commands: * GoImplements * GoWhicherrs @@ -111,7 +125,7 @@ FEATURES: auto sameids mode. In this mode it constantly evaluates the identifier under the cursor whenever it's in hold position and then calls :GoSameIds. As a reminder, to enable auto info either call `:GoSameIdsAutoToggle`(temporary) - or add `let g:go_auto_sameids = 1` (persistent) to your vimrc. + or add `let g:go_auto_sameids = 1` (persistent) to your vimrc. * `:GoInfo` is now non blocking and works in async mode if `guru` is used in `g:go_info_mode`. This makes it useful especially for autoinfo mode. In this @@ -221,7 +235,7 @@ FEATURES: * The snippet expansion `json` is now much more smarter. It pre populates the placeholder according to the first word and it also applies `snake_case` or `camelCase` conversion. Together with `:GoAddTags` it gives `vim-go` users flexible ways of populating a field tag. Checkout the demo to see it in action: https://twitter.com/fatih/status/754477622042689536 [gh-927] * New **`:GoSameIds`** command. When called highlights all same identifiers in the current file. Can be also enabled to highlight identifiers automatically (with `:GoSameIdsAutoToggle` or `g:go_auto_sameids`). Checkout the demo to see it in action: https://twitter.com/fatih/status/753673709278339072. [gh-936] * New **`:GoWhicherrs`** command. It shows all possible values of the selected error variable. [gh-948] -* Add new `errp` snippet to expand an `if err != nil { panic() }` clause [gh-926] +* Add new `errp` snippet to expand an `if err != nil { panic() }` clause [gh-926] * If you open a new buffer with a Go filename it get automatically populated based on the directory. If there are no Go files a simple main package is created, otherwise the file will include the package declaration line based on the package in the current directory. Checkout the demo to see it in action: https://twitter.com/fatih/status/748333086643994624. This is enabled by default. Can be disabled with `let g:go_template_autocreate = 0`. You can use your own template with `let g:go_template_file = "foo.go"` and putting the file under the `templates/` folder. [gh-918] * Added new toggle commands to enable/disable feature that run for your automatic. For example if you have `let g:go_auto_type_info = 1` enabled, you @@ -371,4 +385,3 @@ BACKWARDS INCOMPATIBILITIES: ## Previous releases Previous changelogs can be found here: https://github.com/fatih/vim-go/releases - diff --git a/sources_non_forked/vim-go/LICENSE b/sources_non_forked/vim-go/LICENSE index fd538bde..d9493d4f 100644 --- a/sources_non_forked/vim-go/LICENSE +++ b/sources_non_forked/vim-go/LICENSE @@ -25,7 +25,7 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + This software includes some portions from Go. Go is used under the terms of the BSD like license. diff --git a/sources_non_forked/vim-go/README.md b/sources_non_forked/vim-go/README.md index b5542fb5..9e881747 100644 --- a/sources_non_forked/vim-go/README.md +++ b/sources_non_forked/vim-go/README.md @@ -1,4 +1,4 @@ -# vim-go [![Build Status](http://img.shields.io/travis/fatih/vim-go.svg?style=flat-square)](https://travis-ci.org/fatih/vim-go) +# vim-go [![Build Status](http://img.shields.io/travis/fatih/vim-go.svg?style=flat-square)](https://travis-ci.org/fatih/vim-go)

Vim-go logo @@ -235,9 +235,9 @@ 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 -to open bug, however I'm not using Neovim so it's hard for me to test it. -vim-go might not work well as good as in Vim. I'm happy to accept pull requests -or very detailed bug reports. If you're interested to improve the state of +to open bug, however I'm not using Neovim so it's hard for me to test it. +vim-go might not work well as good as in Vim. I'm happy to accept pull requests +or very detailed bug reports. If you're interested to improve the state of Neovim in vim-go you're always welcome! diff --git a/sources_non_forked/vim-go/autoload/ctrlp/decls.vim b/sources_non_forked/vim-go/autoload/ctrlp/decls.vim index e1465adb..e7426762 100644 --- a/sources_non_forked/vim-go/autoload/ctrlp/decls.vim +++ b/sources_non_forked/vim-go/autoload/ctrlp/decls.vim @@ -39,7 +39,7 @@ function! ctrlp#decls#accept(mode, str) abort let vals = matchlist(a:str, '|\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)|') " i.e: main.go - let filename = vals[1] + let filename = vals[1] let line = vals[2] let col = vals[3] @@ -119,7 +119,7 @@ function! ctrlp#decls#enter() abort let space .= " " endfor - call add(s:decls, printf("%s\t%s |%s:%s:%s|\t%s", + call add(s:decls, printf("%s\t%s |%s:%s:%s|\t%s", \ decl.ident . space, \ decl.keyword, \ fnamemodify(decl.filename, ":t"), @@ -135,7 +135,7 @@ function! s:enable_syntax() abort return endif - syntax match CtrlPIdent '\zs\h\+\ze\s' + syntax match CtrlPIdent '\zs\h\+\ze\s' syntax match CtrlPKeyword '\zs[^\t|]\+\ze|[^|]\+:\d\+:\d\+|' syntax match CtrlPFilename '|\zs[^|]\+:\d\+:\d\+\ze|' syntax match CtrlPSignature '\zs\t.*\ze$' contains=CtrlPKeyWord,CtrlPFilename diff --git a/sources_non_forked/vim-go/autoload/go/cmd.vim b/sources_non_forked/vim-go/autoload/go/cmd.vim index fbc62823..badca313 100644 --- a/sources_non_forked/vim-go/autoload/go/cmd.vim +++ b/sources_non_forked/vim-go/autoload/go/cmd.vim @@ -373,7 +373,7 @@ function! go#cmd#Generate(bang, ...) abort let errors = go#list#Get(l:listtype) call go#list#Window(l:listtype, len(errors)) - if !empty(errors) + if !empty(errors) if !a:bang call go#list#JumpToFirst(l:listtype) endif diff --git a/sources_non_forked/vim-go/autoload/go/complete.vim b/sources_non_forked/vim-go/autoload/go/complete.vim index 2bd4eae7..a5d0ec10 100644 --- a/sources_non_forked/vim-go/autoload/go/complete.vim +++ b/sources_non_forked/vim-go/autoload/go/complete.vim @@ -27,11 +27,11 @@ function! s:gocodeCommand(cmd, preargs, args) abort let $GOROOT = go#util#env("goroot") let socket_type = get(g:, 'go_gocode_socket_type', s:sock_type) - let cmd = printf('%s -sock %s %s %s %s', - \ go#util#Shellescape(bin_path), - \ socket_type, - \ join(a:preargs), - \ go#util#Shellescape(a:cmd), + let cmd = printf('%s -sock %s %s %s %s', + \ go#util#Shellescape(bin_path), + \ socket_type, + \ join(a:preargs), + \ go#util#Shellescape(a:cmd), \ join(a:args) \ ) @@ -55,7 +55,7 @@ endfunction let s:optionsEnabled = 0 function! s:gocodeEnableOptions() abort - if s:optionsEnabled + if s:optionsEnabled return endif diff --git a/sources_non_forked/vim-go/autoload/go/coverage.vim b/sources_non_forked/vim-go/autoload/go/coverage.vim index 56113b93..493d4205 100644 --- a/sources_non_forked/vim-go/autoload/go/coverage.vim +++ b/sources_non_forked/vim-go/autoload/go/coverage.vim @@ -34,7 +34,7 @@ function! go#coverage#Buffer(bang, ...) abort try execute cd . fnameescape(expand("%:p:h")) if empty(glob("*_test.go")) - call go#util#EchoError("no tests files available") + call go#util#EchoError("no test files available") return endif finally @@ -89,8 +89,8 @@ function! go#coverage#Clear() abort if exists("s:toggle") | let s:toggle = 0 | endif - " remove the autocmd we defined - if exists("#BufWinLeave#") + " remove the autocmd we defined + if exists("#BufWinLeave#") autocmd! BufWinLeave endif endfunction @@ -160,8 +160,8 @@ function! go#coverage#genmatch(cov) abort " example: foo.go:92.2,92.65 1 0 if a:cov.startline == a:cov.endline call add(matches, { - \ 'group': color, - \ 'pos': [[a:cov.startline, a:cov.startcol, a:cov.endcol - a:cov.startcol]], + \ 'group': color, + \ 'pos': [[a:cov.startline, a:cov.startcol, a:cov.endcol - a:cov.startcol]], \ 'priority': 2, \ }) return matches @@ -171,8 +171,8 @@ function! go#coverage#genmatch(cov) abort " the line, we assume it is at maximum 200 bytes. I know this is hacky, " but that's only way of fixing the issue call add(matches, { - \ 'group': color, - \ 'pos': [[a:cov.startline, a:cov.startcol, 200]], + \ 'group': color, + \ 'pos': [[a:cov.startline, a:cov.startcol, 200]], \ 'priority': 2, \ }) @@ -181,16 +181,16 @@ function! go#coverage#genmatch(cov) abort while start_line < a:cov.endline let start_line += 1 call add(matches, { - \ 'group': color, - \ 'pos': [[start_line]], + \ 'group': color, + \ 'pos': [[start_line]], \ 'priority': 2, \ }) endwhile " finally end columns call add(matches, { - \ 'group': color, - \ 'pos': [[a:cov.endline, a:cov.endcol-1]], + \ 'group': color, + \ 'pos': [[a:cov.endline, a:cov.endcol-1]], \ 'priority': 2, \ }) diff --git a/sources_non_forked/vim-go/autoload/go/def.vim b/sources_non_forked/vim-go/autoload/go/def.vim index cf7c5c4a..a3d5f84a 100644 --- a/sources_non_forked/vim-go/autoload/go/def.vim +++ b/sources_non_forked/vim-go/autoload/go/def.vim @@ -209,7 +209,7 @@ function! go#def#StackUI() abort let prefix = " " endif - call add(stackOut, printf("%s %d %s|%d col %d|%s", + 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 diff --git a/sources_non_forked/vim-go/autoload/go/doc.vim b/sources_non_forked/vim-go/autoload/go/doc.vim index 22ea8cc7..4ad28d82 100644 --- a/sources_non_forked/vim-go/autoload/go/doc.vim +++ b/sources_non_forked/vim-go/autoload/go/doc.vim @@ -32,10 +32,10 @@ function! go#doc#OpenBrowser(...) abort let import = out["import"] let name = out["name"] let decl = out["decl"] - + let godoc_url = "https://godoc.org/" . import if decl !~ "^package" - let godoc_url .= "#" . name + let godoc_url .= "#" . name endif echo godoc_url @@ -92,13 +92,20 @@ function! s:GodocView(newposition, position, content) abort execute bufwinnr(s:buf_nr) . 'wincmd w' endif - " cap buffer height to 20, but resize it for smaller contents - let max_height = 20 - let content_height = len(split(a:content, "\n")) - if content_height > max_height - exe 'resize ' . max_height + if a:position == "split" + " cap buffer height to 20, but resize it for smaller contents + let max_height = 20 + let content_height = len(split(a:content, "\n")) + if content_height > max_height + exe 'resize ' . max_height + else + exe 'resize ' . content_height + endif else - exe 'resize ' . content_height + " set a sane maximum width for vertical splits. In this case the minimum + " that fits the godoc for package http without extra linebreaks and line + " numbers on + exe 'vertical resize 84' endif setlocal filetype=godoc diff --git a/sources_non_forked/vim-go/autoload/go/fmt.vim b/sources_non_forked/vim-go/autoload/go/fmt.vim index 8a327d3b..666421b2 100644 --- a/sources_non_forked/vim-go/autoload/go/fmt.vim +++ b/sources_non_forked/vim-go/autoload/go/fmt.vim @@ -77,7 +77,7 @@ function! go#fmt#Format(withGoimport) abort if go#util#ShellError() == 0 call go#fmt#update_file(l:tmpname, expand('%')) elseif g:go_fmt_fail_silently == 0 - let errors = s:parse_errors(out) + let errors = s:parse_errors(expand('%'), out) call s:show_errors(errors) endif @@ -102,7 +102,7 @@ function! go#fmt#Format(withGoimport) abort endfunction " update_file updates the target file with the given formatted source -function! go#fmt#update_file(source, target) +function! go#fmt#update_file(source, target) " remove undo point caused via BufWritePre try | silent undojoin | catch | endtry @@ -133,8 +133,8 @@ endfunction " run runs the gofmt/goimport command for the given source file and returns " the the output of the executed command. Target is the real file to be -" formated. -function! go#fmt#run(bin_name, source, target) +" formated. +function! go#fmt#run(bin_name, source, target) let cmd = s:fmt_cmd(a:bin_name, a:source, a:target) if cmd[0] == "goimports" " change GOPATH too, so goimports can pick up the correct library @@ -168,10 +168,9 @@ function! s:fmt_cmd(bin_name, source, target) " start constructing the command let cmd = [bin_path] call add(cmd, "-w") + call extend(cmd, split(g:go_fmt_options, " ")) - if a:bin_name != "goimports" - call extend(cmd, split(g:go_fmt_options, " ")) - else + if a:bin_name == "goimports" " lazy check if goimports support `-srcdir`. We should eventually remove " this in the future if !exists('b:goimports_vendor_compatible') @@ -196,7 +195,7 @@ function! s:fmt_cmd(bin_name, source, target) endfunction " parse_errors parses the given errors and returns a list of parsed errors -function! s:parse_errors(content) abort +function! s:parse_errors(filename, content) abort let splitted = split(a:content, '\n') " list of errors to be put into location list @@ -205,6 +204,7 @@ function! s:parse_errors(content) abort let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)') if !empty(tokens) call add(errors,{ + \"filename": a:filename, \"lnum": tokens[2], \"col": tokens[3], \"text": tokens[4], @@ -218,13 +218,13 @@ endfunction " show_errors opens a location list and shows the given errors. If the given " errors is empty, it closes the the location list function! s:show_errors(errors) abort - let l:listtype = "locationlist" + let l:listtype = "locationlist" if !empty(a:errors) call go#list#Populate(l:listtype, a:errors, 'Format') echohl Error | echomsg "Gofmt returned error" | echohl None endif - " this closes the window if there are no errors or it opens + " this closes the window if there are no errors or it opens " it if there is any call go#list#Window(l:listtype, len(a:errors)) endfunction diff --git a/sources_non_forked/vim-go/autoload/go/guru.vim b/sources_non_forked/vim-go/autoload/go/guru.vim index 206ca87b..df31d1b3 100644 --- a/sources_non_forked/vim-go/autoload/go/guru.vim +++ b/sources_non_forked/vim-go/autoload/go/guru.vim @@ -25,7 +25,7 @@ function! s:guru_cmd(args) range abort endif "return with a warning if the binary doesn't exist - let bin_path = go#path#CheckBinPath("guru") + let bin_path = go#path#CheckBinPath("guru") if empty(bin_path) return {'err': "bin path not found"} endif @@ -41,7 +41,7 @@ function! s:guru_cmd(args) range abort endif " enable outputting in json format - if format == "json" + if format == "json" call add(cmd, "-json") endif @@ -120,8 +120,6 @@ function! s:sync_guru(args) abort endif endif - let old_gopath = $GOPATH - let $GOPATH = go#path#Detect() " run, forrest run!!! let command = join(result.cmd, " ") @@ -131,8 +129,6 @@ function! s:sync_guru(args) abort let out = go#util#System(command) endif - let $GOPATH = old_gopath - if has_key(a:args, 'custom_parse') call a:args.custom_parse(go#util#ShellError(), out) else @@ -217,11 +213,17 @@ endfunc " run_guru runs the given guru argument function! s:run_guru(args) abort + let old_gopath = $GOPATH + let $GOPATH = go#path#Detect() if go#util#has_job() - return s:async_guru(a:args) + let res = s:async_guru(a:args) + else + let res = s:sync_guru(a:args) endif - return s:sync_guru(a:args) + let $GOPATH = old_gopath + + return res endfunction " Show 'implements' relation for selected package @@ -270,7 +272,7 @@ endfunction function! go#guru#DescribeInfo() abort " json_encode() and friends are introduced with this patch (7.4.1304) " vim: https://groups.google.com/d/msg/vim_dev/vLupTNhQhZ8/cDGIk0JEDgAJ - " nvim: https://github.com/neovim/neovim/pull/4131 + " nvim: https://github.com/neovim/neovim/pull/4131 if !exists("*json_decode") call go#util#EchoError("requires 'json_decode'. Update your Vim/Neovim version.") return @@ -465,7 +467,7 @@ function! go#guru#SameIds() abort " json_encode() and friends are introduced with this patch (7.4.1304) " vim: https://groups.google.com/d/msg/vim_dev/vLupTNhQhZ8/cDGIk0JEDgAJ - " nvim: https://github.com/neovim/neovim/pull/4131 + " nvim: https://github.com/neovim/neovim/pull/4131 if !exists("*json_decode") call go#util#EchoError("GoSameIds requires 'json_decode'. Update your Vim/Neovim version.") return @@ -547,7 +549,7 @@ function! go#guru#ClearSameIds() abort endfunction function! go#guru#ToggleSameIds() abort - if len(getmatches()) != 0 + if len(getmatches()) != 0 call go#guru#ClearSameIds() else call go#guru#SameIds() diff --git a/sources_non_forked/vim-go/autoload/go/impl.vim b/sources_non_forked/vim-go/autoload/go/impl.vim index 139dba75..a4b696de 100644 --- a/sources_non_forked/vim-go/autoload/go/impl.vim +++ b/sources_non_forked/vim-go/autoload/go/impl.vim @@ -18,7 +18,7 @@ function! go#impl#Impl(...) abort return endif elseif a:0 == 1 - " we assume the user only passed the interface type, + " we assume the user only passed the interface type, " i.e: ':GoImpl io.Writer' let receiveType = expand("") let recv = printf("%s *%s", tolower(receiveType)[0], receiveType) @@ -44,7 +44,7 @@ function! go#impl#Impl(...) abort end let pos = getpos('.') - put ='' + put ='' put =result call setpos('.', pos) endfunction diff --git a/sources_non_forked/vim-go/autoload/go/lint.vim b/sources_non_forked/vim-go/autoload/go/lint.vim index c62f2520..84d8ba45 100644 --- a/sources_non_forked/vim-go/autoload/go/lint.vim +++ b/sources_non_forked/vim-go/autoload/go/lint.vim @@ -109,9 +109,9 @@ endfunction " Golint calls 'golint' on the current directory. Any warnings are populated in " the location list function! go#lint#Golint(...) abort - let bin_path = go#path#CheckBinPath(g:go_golint_bin) - if empty(bin_path) - return + let bin_path = go#path#CheckBinPath(g:go_golint_bin) + if empty(bin_path) + return endif if a:0 == 0 @@ -280,7 +280,7 @@ function s:lint_job(args) call go#statusline#Update(status_dir, status) let errors = go#list#Get(l:listtype) - if empty(errors) + if empty(errors) call go#list#Window(l:listtype, len(errors)) elseif has("patch-7.4.2200") if l:listtype == 'quickfix' diff --git a/sources_non_forked/vim-go/autoload/go/list.vim b/sources_non_forked/vim-go/autoload/go/list.vim index 56d6115d..dbd1e254 100644 --- a/sources_non_forked/vim-go/autoload/go/list.vim +++ b/sources_non_forked/vim-go/autoload/go/list.vim @@ -124,7 +124,7 @@ function! go#list#Type(listtype) abort if g:go_list_type == "locationlist" return "locationlist" elseif g:go_list_type == "quickfix" - return "quickfix" + return "quickfix" else return a:listtype endif diff --git a/sources_non_forked/vim-go/autoload/go/play.vim b/sources_non_forked/vim-go/autoload/go/play.vim index ac5bba42..4674d5b6 100644 --- a/sources_non_forked/vim-go/autoload/go/play.vim +++ b/sources_non_forked/vim-go/autoload/go/play.vim @@ -70,7 +70,7 @@ function! s:get_visual_selection() abort return join(lines, "\n") endfunction -" following two functions are from: https://github.com/mattn/gist-vim +" following two functions are from: https://github.com/mattn/gist-vim " thanks @mattn function! s:get_browser_command() abort let go_play_browser_command = get(g:, 'go_play_browser_command', '') diff --git a/sources_non_forked/vim-go/autoload/go/statusline.vim b/sources_non_forked/vim-go/autoload/go/statusline.vim index c832797c..ba63c6da 100644 --- a/sources_non_forked/vim-go/autoload/go/statusline.vim +++ b/sources_non_forked/vim-go/autoload/go/statusline.vim @@ -4,7 +4,7 @@ " s:statuses is a global reference to all statuses. It stores the statuses per " import paths (map[string]status), where each status is unique per its " type. Current status dict is in form: -" { +" { " 'desc' : 'Job description', " 'state' : 'Job state, such as success, failure, etc..', " 'type' : 'Job type, such as build, test, etc..' diff --git a/sources_non_forked/vim-go/autoload/go/tags.vim b/sources_non_forked/vim-go/autoload/go/tags.vim new file mode 100644 index 00000000..4ef7d282 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/tags.vim @@ -0,0 +1,206 @@ +function! go#tags#Add(start, end, count, ...) abort + let fname = fnamemodify(expand("%"), ':p:gs?\\?/?') + if &modified + " Write current unsaved buffer to a temp file and use the modified content + let l:tmpname = tempname() + call writefile(getline(1, '$'), l:tmpname) + let fname = l:tmpname + endif + + let offset = 0 + if a:count == -1 + let offset = go#util#OffsetCursor() + endif + + let test_mode = 0 + call call("go#tags#run", [a:start, a:end, offset, "add", fname, test_mode] + a:000) + + " if exists, delete it as we don't need it anymore + if exists("l:tmpname") + call delete(l:tmpname) + endif +endfunction + +function! go#tags#Remove(start, end, count, ...) abort + let fname = fnamemodify(expand("%"), ':p:gs?\\?/?') + if &modified + " Write current unsaved buffer to a temp file and use the modified content + let l:tmpname = tempname() + call writefile(getline(1, '$'), l:tmpname) + let fname = l:tmpname + endif + + let offset = 0 + if a:count == -1 + let offset = go#util#OffsetCursor() + endif + + let test_mode = 0 + call call("go#tags#run", [a:start, a:end, offset, "remove", fname, test_mode] + a:000) + + " if exists, delete it as we don't need it anymore + if exists("l:tmpname") + call delete(l:tmpname) + endif +endfunction + +" run runs gomodifytag. This is an internal test so we can test it +function! go#tags#run(start, end, offset, mode, fname, test_mode, ...) abort + " do not split this into multiple lines, somehow tests fail in that case + let args = {'mode': a:mode,'start': a:start,'end': a:end,'offset': a:offset,'fname': a:fname,'cmd_args': a:000} + + let result = s:create_cmd(args) + if has_key(result, 'err') + call go#util#EchoError(result.err) + return -1 + endif + + let command = join(result.cmd, " ") + + call go#cmd#autowrite() + let out = go#util#System(command) + if go#util#ShellError() != 0 + call go#util#EchoError(out) + return + endif + + if a:test_mode + exe 'edit ' . a:fname + endif + + call s:write_out(out) + + if a:test_mode + exe 'write! ' . a:fname + endif +endfunc + + +" write_out writes back the given output to the current buffer +func s:write_out(out) abort + " not a json output + if a:out[0] !=# '{' + return + endif + + " nothing to do + if empty(a:out) || type(a:out) != type("") + return + endif + + let result = json_decode(a:out) + if type(result) != type({}) + call go#util#EchoError(printf("malformed output from gomodifytags: %s", a:out)) + return + endif + + let lines = result['lines'] + let start_line = result['start'] + let end_line = result['end'] + + let index = 0 + for line in range(start_line, end_line) + call setline(line, lines[index]) + let index += 1 + endfor +endfunc + + +" create_cmd returns a dict that contains the command to execute gomodifytags +func s:create_cmd(args) abort + if !exists("*json_decode") + return {'err': "requires 'json_decode'. Update your Vim/Neovim version."} + endif + + let bin_path = go#path#CheckBinPath('gomodifytags') + if empty(bin_path) + return {'err': "gomodifytags does not exist"} + endif + + let l:start = a:args.start + let l:end = a:args.end + let l:offset = a:args.offset + let l:mode = a:args.mode + let l:cmd_args = a:args.cmd_args + + " start constructing the command + let cmd = [bin_path] + call extend(cmd, ["-format", "json"]) + call extend(cmd, ["-file", a:args.fname]) + + if l:offset != 0 + call extend(cmd, ["-offset", l:offset]) + else + let range = printf("%d,%d", l:start, l:end) + call extend(cmd, ["-line", range]) + endif + + if l:mode == "add" + let l:tags = [] + let l:options = [] + + if !empty(l:cmd_args) + for item in l:cmd_args + let splitted = split(item, ",") + + " tag only + if len(splitted) == 1 + call add(l:tags, splitted[0]) + endif + + " options only + if len(splitted) == 2 + call add(l:tags, splitted[0]) + call add(l:options, printf("%s=%s", splitted[0], splitted[1])) + endif + endfor + endif + + " construct options + if !empty(l:options) + call extend(cmd, ["-add-options", join(l:options, ",")]) + else + " default value + if empty(l:tags) + let l:tags = ["json"] + endif + + " construct tags + call extend(cmd, ["-add-tags", join(l:tags, ",")]) + endif + elseif l:mode == "remove" + if empty(l:cmd_args) + call add(cmd, "-clear-tags") + else + let l:tags = [] + let l:options = [] + for item in l:cmd_args + let splitted = split(item, ",") + + " tag only + if len(splitted) == 1 + call add(l:tags, splitted[0]) + endif + + " options only + if len(splitted) == 2 + call add(l:options, printf("%s=%s", splitted[0], splitted[1])) + endif + endfor + + " construct tags + if !empty(l:tags) + call extend(cmd, ["-remove-tags", join(l:tags, ",")]) + endif + + " construct options + if !empty(l:options) + call extend(cmd, ["-remove-options", join(l:options, ",")]) + endif + endif + else + return {'err': printf("unknown mode: %s", l:mode)} + endif + + return {'cmd': cmd} +endfunc diff --git a/sources_non_forked/vim-go/autoload/go/tags_test.vim b/sources_non_forked/vim-go/autoload/go/tags_test.vim new file mode 100644 index 00000000..9d740c85 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/tags_test.vim @@ -0,0 +1,28 @@ +func Test_add_tags() + let input_file = tempname() + call writefile(readfile("test-fixtures/tags/add_all_input.go"), input_file) + + let expected = join(readfile("test-fixtures/tags/add_all_golden.go"), "\n") + + " run for offset 40, which is inside the struct + call go#tags#run(0, 0, 40, "add", input_file, 1) + + let actual = join(readfile(input_file), "\n") + + call assert_equal(expected, actual) +endfunc + + +func Test_remove_tags() + let input_file = tempname() + call writefile(readfile("test-fixtures/tags/remove_all_input.go"), input_file) + + let expected = join(readfile("test-fixtures/tags/remove_all_golden.go"), "\n") + + " run for offset 40, which is inside the struct + call go#tags#run(0, 0, 40, "remove", input_file, 1) + + let actual = join(readfile(input_file), "\n") + + call assert_equal(expected, actual) +endfunc diff --git a/sources_non_forked/vim-go/autoload/go/textobj.vim b/sources_non_forked/vim-go/autoload/go/textobj.vim index da0bb7e2..21789dc4 100644 --- a/sources_non_forked/vim-go/autoload/go/textobj.vim +++ b/sources_non_forked/vim-go/autoload/go/textobj.vim @@ -67,7 +67,7 @@ function! go#textobj#Function(mode) abort normal! v call cursor(info.rbrace.line, info.rbrace.col) return - endif + endif " rest is inner mode, a:mode == 'i' diff --git a/sources_non_forked/vim-go/autoload/go/tool.vim b/sources_non_forked/vim-go/autoload/go/tool.vim index 7b7e1af2..99577f4e 100644 --- a/sources_non_forked/vim-go/autoload/go/tool.vim +++ b/sources_non_forked/vim-go/autoload/go/tool.vim @@ -164,7 +164,7 @@ function! go#tool#Exists(importpath) abort endfunction -" following two functions are from: https://github.com/mattn/gist-vim +" following two functions are from: https://github.com/mattn/gist-vim " thanks @mattn function! s:get_browser_command() abort let go_play_browser_command = get(g:, 'go_play_browser_command', '') diff --git a/sources_non_forked/vim-go/autoload/go/util.vim b/sources_non_forked/vim-go/autoload/go/util.vim index 65cf2750..86d0726c 100644 --- a/sources_non_forked/vim-go/autoload/go/util.vim +++ b/sources_non_forked/vim-go/autoload/go/util.vim @@ -53,7 +53,7 @@ let s:env_cache = {} " env returns the go environment variable for the given key. Where key can be " GOARCH, GOOS, GOROOT, etc... It caches the result and returns the cached -" version. +" version. function! go#util#env(key) abort let l:key = tolower(a:key) if has_key(s:env_cache, l:key) diff --git a/sources_non_forked/vim-go/doc/vim-go.txt b/sources_non_forked/vim-go/doc/vim-go.txt index 2d7a03b2..d37df28f 100644 --- a/sources_non_forked/vim-go/doc/vim-go.txt +++ b/sources_non_forked/vim-go/doc/vim-go.txt @@ -576,7 +576,7 @@ CTRL-t *:GoSameIdsToggle* :GoSameIdsToggle - Toggle between |:GoSameIds| and |:GoSameIdsClear|. + Toggle between |:GoSameIds| and |:GoSameIdsClear|. *:GoSameIdsAutoToggle* :GoSameIdsAutoToggle @@ -669,12 +669,13 @@ CTRL-t :GoImpl T io.ReadWriteCloser < *:GoAddTags* -:[range]GoAddTags [key] [key1] ... +:[range]GoAddTags [key],[option] [key1],[option] ... Adds field tags for the fields of a struct. If called inside a struct it automatically add field tags with the `json` key and the value automatically generated based on the field name. An error message is given - if it's called outside a struct definition. + if it's called outside a struct definition or if the file is not correctly + formatted. If [range] is given, only the selected fields will be changed. @@ -682,6 +683,37 @@ CTRL-t arguments. An example of adding `xml` and `db` would be: > :GoAddTags xml db +< + If [option] is passed it'll either add a new tag with an option or will + modify exising tags. An example of adding `omitempty` to all `json` fields + would be: +> + :GoAddTags json,omitempty +< + You can define a constant value instead of the default field based value. + For example the following command will add ``valid:"1"`` to all fields. +> + :GoAddTags valid=1 +< + *:GoRemoveTags* +:[range]GoRemoveTags [key],[option] [key1],[option1] ... + + Rmove field tags for the fields of a struct. If called inside a struct it + automatically remove all field tags. An error message is given if it's + called outside a struct definition or if the file is not correctly + formatted + + If [range] is given, only the selected fields will be changed. + + If [key] is given, it will only remove those keys. Example: +> + :GoRemoveTags json +< + If [option] is passed with a [key], it will only remove the options. + Example, this will only remove `omitempty` options from fields containing + `json`: +> + :GoRemoveTags json,omitempty < *:GoAutoTypeInfoToggle* :GoAutoTypeInfoToggle @@ -958,7 +990,7 @@ Shows the status of a job running asynchronously. Can be used to plug into the statusline. It works to show the status per package instead of per file. Assume you have three files open, all belonging to the same package, if the package build (`:GoBuild`) is successful, all statusline's will show -`success`, if you it fails all file's statusline will show `failed`. +`success`, if you it fails all file's statusline will show `failed`. To avoid always showing old status information, the status information is cleaned for each package after `60` seconds. This can be changed with the @@ -1488,6 +1520,8 @@ default it's enabled > let g:go_echo_go_info = 1 < +Please note that 'noshowmode' must be set for this feature to work correctly. + *'g:go_statusline_duration'* Specifices the duration of statusline information being showed per package. By diff --git a/sources_non_forked/vim-go/ftplugin/go/commands.vim b/sources_non_forked/vim-go/ftplugin/go/commands.vim index d8bff665..6f108a67 100644 --- a/sources_non_forked/vim-go/ftplugin/go/commands.vim +++ b/sources_non_forked/vim-go/ftplugin/go/commands.vim @@ -14,14 +14,15 @@ command! -range=% GoChannelPeers call go#guru#ChannelPeers() command! -range=% GoReferrers call go#guru#Referrers() command! -nargs=? GoGuruTags call go#guru#Tags() - -command! -nargs=* -range GoAddTags call go#util#AddTags(, , ) - command! -range=0 GoSameIds call go#guru#SameIds() command! -range=0 GoSameIdsClear call go#guru#ClearSameIds() command! -range=0 GoSameIdsToggle call go#guru#ToggleSameIds() command! -range=0 GoSameIdsAutoToggle call go#guru#AutoToogleSameIds() +" -- tags +command! -nargs=* -range GoAddTags call go#tags#Add(, , , ) +command! -nargs=* -range GoRemoveTags call go#tags#Remove(, , , ) + " -- tool command! -nargs=0 GoFiles echo go#tool#Files() command! -nargs=0 GoDeps echo go#tool#Deps() diff --git a/sources_non_forked/vim-go/ftplugin/go/tagbar.vim b/sources_non_forked/vim-go/ftplugin/go/tagbar.vim index efdc397b..2d22fd7c 100644 --- a/sources_non_forked/vim-go/ftplugin/go/tagbar.vim +++ b/sources_non_forked/vim-go/ftplugin/go/tagbar.vim @@ -15,9 +15,9 @@ endif function! s:SetTagbar() - let bin_path = go#path#CheckBinPath(g:go_gotags_bin) - if empty(bin_path) - return + let bin_path = go#path#CheckBinPath(g:go_gotags_bin) + if empty(bin_path) + return endif if !exists("g:tagbar_type_go") diff --git a/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets b/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets index 4a5b87f8..9db78db1 100644 --- a/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets +++ b/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets @@ -175,7 +175,7 @@ if err != nil { ${0} endsnippet -# error test +# error test snippet errt "Error test fatal " !b if err != nil { t.Fatal(err) diff --git a/sources_non_forked/vim-go/plugin/go.vim b/sources_non_forked/vim-go/plugin/go.vim index 26547310..8a381453 100644 --- a/sources_non_forked/vim-go/plugin/go.vim +++ b/sources_non_forked/vim-go/plugin/go.vim @@ -18,6 +18,7 @@ let s:packages = [ \ "github.com/jstemmer/gotags", \ "github.com/klauspost/asmfmt/cmd/asmfmt", \ "github.com/fatih/motion", + \ "github.com/fatih/gomodifytags", \ "github.com/zmb3/gogetdoc", \ "github.com/josharian/impl", \ ] diff --git a/sources_non_forked/vim-go/scripts/test.sh b/sources_non_forked/vim-go/scripts/test.sh index cda33504..b22fd7d7 100644 --- a/sources_non_forked/vim-go/scripts/test.sh +++ b/sources_non_forked/vim-go/scripts/test.sh @@ -4,6 +4,9 @@ set -e cd $(dirname $0) +# install dependencies +go get github.com/fatih/gomodifytags + # cleanup test.log if [ -f "test.log" ]; then rm test.log diff --git a/sources_non_forked/vim-pug/syntax/pug.vim b/sources_non_forked/vim-pug/syntax/pug.vim index 2d80f471..9e5ea3da 100644 --- a/sources_non_forked/vim-pug/syntax/pug.vim +++ b/sources_non_forked/vim-pug/syntax/pug.vim @@ -30,7 +30,7 @@ syn region pugJavascript matchgroup=pugJavascriptOutputChar start="[!&]\==\|\~" syn region pugJavascript matchgroup=pugJavascriptChar start="-" skip=",\s*$" end="$" contained contains=@htmlJavascript keepend syn cluster pugTop contains=pugBegin,pugComment,pugHtmlComment,pugJavascript syn match pugBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=pugTag,pugClassChar,pugIdChar,pugPlainChar,pugJavascript,pugScriptConditional,pugScriptStatement,pugPipedText -syn match pugTag "+\?\w\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@pugComponent +syn match pugTag "+\?[[:alnum:]_-]\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@pugComponent syn cluster pugComponent contains=pugAttributes,pugIdChar,pugBlockExpansionChar,pugClassChar,pugPlainChar,pugJavascript,pugTagBlockChar,pugTagInlineText syntax keyword pugCommentTodo contained TODO FIXME XXX TBD syn match pugComment '\(\s\+\|^\)\/\/.*$' contains=pugCommentTodo diff --git a/sources_non_forked/vim-snippets/UltiSnips/all.snippets b/sources_non_forked/vim-snippets/UltiSnips/all.snippets index 49a9c80e..6d77cc59 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/all.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/all.snippets @@ -96,4 +96,8 @@ snippet datetime "YYYY-MM-DD hh:mm" w `!v strftime("%Y-%m-%d %H:%M")` endsnippet +snippet todo "TODO comment" bw +`!p snip.rv=get_comment_format()[0]` ${2:TODO}: $0${3: <${4:`!v strftime('%d-%m-%y')`}${5:, `!v g:snips_author`}>} `!p snip.rv=get_comment_format()[2]` +endsnippet + # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets b/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets index c83ec605..bb79a0e1 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets @@ -4,6 +4,28 @@ extends c # We want to overwrite everything in parent ft. priority -49 +########################################################################### +# Global functions # +########################################################################### + +global !p + +def write_docstring_args(arglist, snip): + args = str(arglist).split(',') + + if len(args) > 1: + c = 0 + for arg in args: + if c == 0: + snip.rv += arg + c = 1 + else: + snip += '* : %s' % arg.strip() + else: + snip.rv = args[0] + + +endglobal ########################################################################### # TextMate Snippets # @@ -70,4 +92,19 @@ public: #endif /* $2 */ endsnippet + + +snippet fnc "Basic c++ doxygen function template" b +/** +* @brief: ${4:brief} +* +* @param: `!p write_docstring_args(t[3],snip)` +* +* @return: `!p snip.rv = t[1]` +*/ +${1:ReturnType} ${2:FunctionName}(${3:param}) +{ + ${0:FunctionBody} +} +endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript-jasmine-arrow.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript-jasmine-arrow.snippets new file mode 100644 index 00000000..fa7f9364 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript-jasmine-arrow.snippets @@ -0,0 +1,234 @@ +priority -50 + +# JavaScript versions -- from the TextMate bundle + some additions +# for jasmine-jquery matchers +# + +snippet des "Describe (js)" b +describe('${1:description}', () => { + $0 +}); +endsnippet + +snippet it "it (js)" b +it('${1:description}', () => { + $0 +}); +endsnippet + +snippet bef "before each (js)" b +beforeEach(() => { + $0 +}); +endsnippet + +snippet aft "after each (js)" b +afterEach(() => { + $0 +}); +endsnippet + +snippet befa "before all (js)" b +beforeAll(() => { + $0 +}); +endsnippet + +snippet afta "after all (js)" b +afterAll(() => { + $0 +}); +endsnippet + +snippet any "any (js)" b +jasmine.any($1) +endsnippet + +snippet anyt "anything (js)" b +jasmine.anything() +endsnippet + +snippet objc "object containing (js)" b +jasmine.objectContaining({ + ${VISUAL}$0 +}); +endsnippet + +snippet arrc "array containing (js)" b +jasmine.arrayContaining([${1:value1}]); +endsnippet + +snippet strm "string matching (js)" b +jasmine.stringMatching("${1:matcher}") +endsnippet + +snippet ru "runs (js)" b +runs(() => { + $0 +}); +endsnippet + +snippet wa "waits (js)" b +waits($1); +endsnippet + +snippet ex "expect (js)" b +expect(${1:target})$0; +endsnippet + +snippet ee "expect to equal (js)" b +expect(${1:target}).toEqual(${2:value}); +endsnippet + +snippet el "expect to be less than (js)" b +expect(${1:target}).toBeLessThan(${2:value}); +endsnippet + +snippet eg "expect to be greater than (js)" b +expect(${1:target}).toBeGreaterThan(${2:value}); +endsnippet + +snippet eb "expect to be (js)" b +expect(${1:target}).toBe(${2:value}); +endsnippet + +snippet em "expect to match (js)" b +expect(${1:target}).toMatch(${2:pattern}); +endsnippet + +snippet eha "expect to have attribute (js)" b +expect(${1:target}).toHaveAttr('${2:attr}'${3:, '${4:value}'}); +endsnippet + +snippet et "expect to be truthy (js)" b +expect(${1:target}).toBeTruthy(); +endsnippet + +snippet ef "expect to be falsy (js)" b +expect(${1:target}).toBeFalsy(); +endsnippet + +snippet ed "expect to be defined (js)" b +expect(${1:target}).toBeDefined(); +endsnippet + +snippet eud "expect to be defined (js)" b +expect(${1:target}).toBeUndefined(); +endsnippet + +snippet en "expect to be null (js)" b +expect(${1:target}).toBeNull(); +endsnippet + +snippet ec "expect to contain (js)" b +expect(${1:target}).toContain(${2:value}); +endsnippet + +snippet ev "expect to be visible (js)" b +expect(${1:target}).toBeVisible(); +endsnippet + +snippet eh "expect to be hidden (js)" b +expect(${1:target}).toBeHidden(); +endsnippet + +snippet eth "expect to throw (js)" b +expect(${1:target}).toThrow(${2:value}); +endsnippet + +snippet ethe "expect to throw error (js)" b +expect(${1:target}).toThrowError(${2:value}); +endsnippet + +snippet notx "expect not (js)" b +expect(${1:target}).not$0; +endsnippet + +snippet note "expect not to equal (js)" b +expect(${1:target}).not.toEqual(${2:value}); +endsnippet + +snippet notl "expect to not be less than (js)" b +expect(${1:target}).not.toBeLessThan(${2:value}); +endsnippet + +snippet notg "expect to not be greater than (js)" b +expect(${1:target}).not.toBeGreaterThan(${2:value}); +endsnippet + +snippet notm "expect not to match (js)" b +expect(${1:target}).not.toMatch(${2:pattern}); +endsnippet + +snippet notha "expect to not have attribute (js)" b +expect(${1:target}).not.toHaveAttr('${2:attr}'${3:, '${4:value}'}); +endsnippet + +snippet nott "expect not to be truthy (js)" b +expect(${1:target}).not.toBeTruthy(); +endsnippet + +snippet notf "expect not to be falsy (js)" b +expect(${1:target}).not.toBeFalsy(); +endsnippet + +snippet notd "expect not to be defined (js)" b +expect(${1:target}).not.toBeDefined(); +endsnippet + +snippet notn "expect not to be null (js)" b +expect(${1:target}).not.toBeNull(); +endsnippet + +snippet notc "expect not to contain (js)" b +expect(${1:target}).not.toContain(${2:value}); +endsnippet + +snippet notv "expect not to be visible (js)" b +expect(${1:target}).not.toBeVisible(); +endsnippet + +snippet noth "expect not to be hidden (js)" b +expect(${1:target}).not.toBeHidden(); +endsnippet + +snippet notth "expect not to throw (js)" b +expect(${1:target}).not.toThrow(${2:value}); +endsnippet + +snippet notthe "expect not to throw error (js)" b +expect(${1:target}).not.toThrowError(${2:value}); +endsnippet + +snippet s "spy on (js)" b +spyOn(${1:object}, '${2:method}')$0; +endsnippet + +snippet sr "spy on and return (js)" b +spyOn(${1:object}, '${2:method}').and.returnValue(${3:arguments}); +endsnippet + +snippet st "spy on and throw (js)" b +spyOn(${1:object}, '${2:method}').and.throwError(${3:exception}); +endsnippet + +snippet sct "spy on and call through (js)" b +spyOn(${1:object}, '${2:method}').and.callThrough(); +endsnippet + +snippet scf "spy on and call fake (js)" b +spyOn(${1:object}, '${2:method}').and.callFake(${3:function}); +endsnippet + +snippet ethbc "expect to have been called (js)" b +expect(${1:target}).toHaveBeenCalled(); +endsnippet + +snippet nthbc "expect not to have been called (js)" b +expect(${1:target}).not.toHaveBeenCalled(); +endsnippet + +snippet ethbcw "expect to have been called with (js)" b +expect(${1:target}).toHaveBeenCalledWith(${2:arguments}); +endsnippet + diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript-jasmine.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript-jasmine.snippets index 77aec773..2efbf266 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript-jasmine.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript-jasmine.snippets @@ -132,6 +132,14 @@ snippet eh "expect to be hidden (js)" b expect(${1:target}).toBeHidden(); endsnippet +snippet eth "expect to throw (js)" b +expect(${1:target}).toThrow(${2:value}); +endsnippet + +snippet ethe "expect to throw error (js)" b +expect(${1:target}).toThrowError(${2:value}); +endsnippet + snippet notx "expect not (js)" b expect(${1:target}).not$0; endsnippet @@ -145,7 +153,7 @@ expect(${1:target}).not.toBeLessThan(${2:value}); endsnippet snippet notg "expect to not be greater than (js)" b -expect(${1:target})..not.toBeGreaterThan(${2:value}); +expect(${1:target}).not.toBeGreaterThan(${2:value}); endsnippet snippet notm "expect not to match (js)" b @@ -184,6 +192,14 @@ snippet noth "expect not to be hidden (js)" b expect(${1:target}).not.toBeHidden(); endsnippet +snippet notth "expect not to throw (js)" b +expect(${1:target}).not.toThrow(${2:value}); +endsnippet + +snippet notthe "expect not to throw error (js)" b +expect(${1:target}).not.toThrowError(${2:value}); +endsnippet + snippet s "spy on (js)" b spyOn(${1:object}, '${2:method}')$0; endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets index 29bf9ed1..652dd707 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets @@ -1,5 +1,19 @@ priority -50 +############ +# COMMON # +############ + +# The smart snippets use a global options called +# "g:ultisnips_javascript.{option}" which can control the format +# of trailing semicolon, space before function paren, etc. + +global !p +from javascript_snippets import ( + semi, space_before_function_paren, keyword_spacing +) +endglobal + ########################################################################### # TextMate Snippets # ########################################################################### @@ -8,13 +22,13 @@ getElement${1/(T)|.*/(?1:s)/}By${1:T}${1/(T)|(I)|.*/(?1:agName)(?2:d)/}('$2') endsnippet snippet '':f "object method string" -'${1:${2:#thing}:${3:click}}': function(element) { +'${1:${2:#thing}:${3:click}}': function`!p snip.rv = space_before_function_paren(snip)`(element) { ${VISUAL}$0 }${10:,} endsnippet snippet :f "Object Method" -${1:method_name}: function(${3:attribute}) { +${1:method_name}: function`!p snip.rv = space_before_function_paren(snip)`(${3:attribute}) { ${VISUAL}$0 }${10:,} endsnippet @@ -28,48 +42,99 @@ ${1:key}: ${2:"${3:value}"}${4:, } endsnippet snippet proto "Prototype (proto)" -${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) { +${1:class_name}.prototype.${2:method_name} = function`!p snip.rv = space_before_function_paren(snip)`(${3:first_argument}) { ${VISUAL}$0 -}; +}`!p snip.rv = semi(snip)` endsnippet snippet fun "function (fun)" w -function ${1:function_name}(${2:argument}) { +function ${1:function_name}`!p snip.rv = space_before_function_paren(snip)`(${2:argument}) { ${VISUAL}$0 } endsnippet snippet vf "Function assigned to var" -${1:var }${2:function_name} = function $2($3) { +${1:var }${2:function_name} = function $2`!p snip.rv = space_before_function_paren(snip)`($3) { ${VISUAL}$0 -}; +}`!p snip.rv = semi(snip)` endsnippet snippet af "Anonymous Function" i -function($1) { +function`!p snip.rv = space_before_function_paren(snip)`($1) { ${VISUAL}$0 } endsnippet snippet iife "Immediately-Invoked Function Expression (iife)" -(function(${1:window}) { +(function`!p snip.rv = space_before_function_paren(snip)`(${1:window}) { ${VISUAL}$0 -}(${2:$1})); +}(${2:$1}))`!p snip.rv = semi(snip)` +endsnippet + +snippet ;fe "Minify safe iife" +;(function`!p snip.rv = space_before_function_paren(snip)`(${1}) { + ${VISUAL}$0 +}(${2})) endsnippet snippet timeout "setTimeout function" -setTimeout(function() { +setTimeout(function`!p snip.rv = space_before_function_paren(snip)`() { ${VISUAL}$0 -}${2:.bind(${3:this})}, ${1:10}); +}${2:.bind(${3:this})}, ${1:10})`!p snip.rv = semi(snip)` endsnippet snippet fi "for prop in obj using hasOwnProperty" b -for (${1:prop} in ${2:obj}){ - if ($2.hasOwnProperty($1)) { +for`!p snip.rv = keyword_spacing(snip)`(${1:prop} in ${2:obj}){ + if`!p snip.rv = keyword_spacing(snip)`($2.hasOwnProperty($1)) { ${VISUAL}$0 } } endsnippet +snippet if "if (condition) { ... }" +if`!p snip.rv = keyword_spacing(snip)`(${1:true}) { + ${VISUAL}$0 +} +endsnippet + +snippet ife "if (condition) { ... } else { ... }" +if`!p snip.rv = keyword_spacing(snip)`(${1:true}) { + ${VISUAL}$0 +}`!p snip.rv = keyword_spacing(snip)`else`!p snip.rv = keyword_spacing(snip)`{ + ${2} +} +endsnippet + +snippet switch +switch`!p snip.rv = keyword_spacing(snip)`(${VISUAL}${1:expression}) { + case '${VISUAL}${3:case}': + ${4} + break`!p snip.rv = semi(snip)` + ${0} + default: + ${2} +} +endsnippet + +snippet case "case 'xyz': ... break" +case`!p snip.rv = keyword_spacing(snip)`'${VISUAL}${1:case}': + ${VISUAL}$0 + break`!p snip.rv = semi(snip)` +endsnippet + +snippet do "do { ... } while (condition)" +do`!p snip.rv = keyword_spacing(snip)`{ + ${VISUAL}$0 +}`!p snip.rv = keyword_spacing(snip)`while`!p snip.rv = keyword_spacing(snip)`(${1:/* condition */})`!p snip.rv = semi(snip)` +endsnippet + +snippet ret "Return statement" +return ${VISUAL}$0`!p snip.rv = semi(snip)` +endsnippet + +snippet us +'use strict'`!p snip.rv = semi(snip)` +endsnippet + # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/matlab.snippets b/sources_non_forked/vim-snippets/UltiSnips/matlab.snippets new file mode 100644 index 00000000..4dc332bd --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/matlab.snippets @@ -0,0 +1,24 @@ +priority -50 + +snippet switch "switch ... otherwise" +switch ${1:n} + case ${2:0} + ${3}${4: + otherwise + ${5}} +end +endsnippet + +snippet clc "class with constructor" b +classdef ${1:`!p +snip.rv = snip.basename or "class_name"`} + properties + ${2} + end + methods + function obj = $1(${3}) + ${4} + end${0} + end +end +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/ruby.snippets b/sources_non_forked/vim-snippets/UltiSnips/ruby.snippets index b7124f83..c61b2766 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/ruby.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/ruby.snippets @@ -1,5 +1,26 @@ priority -50 +# +# Global functions +# + +global !p + +def write_instance_vars(arglist, snip): + args = str(arglist).split(',') + for arg in args: + name = arg.strip().replace(':', ' ').split(' ', 1)[0] + if name: + snip += ' @{} = {}'.format(name, name) + else: + snip += '' + +endglobal + +# +# Snippets +# + snippet "^#!" "#!/usr/bin/env ruby" r #!/usr/bin/env ruby $0 @@ -17,8 +38,7 @@ end endsnippet snippet defi "def initialize ..." -def initialize${1:(${2:*args})} - $0 +def initialize($1)`!p write_instance_vars(t[1],snip)`$0 end endsnippet @@ -212,32 +232,6 @@ except: end endsnippet -snippet "(\S+)\.Each_?w(ith)?_?i(ndex)?" ".each_with_index { |,| }" r -`!p snip.rv=match.group(1)`.each_with_index { |${1:`!p -element_name = match.group(1).lstrip('$@') -ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name) -try: - wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1)) - snip.rv = wmatch.group(1).lower() -except: - snip.rv = 'element' -`},${2:i}| $0 } -endsnippet - -snippet "(\S+)\.each_?w(ith)?_?i(ndex)?" ".each_with_index do |,| end" r -`!p snip.rv=match.group(1)`.each_with_index do |${1:`!p -element_name = match.group(1).lstrip('$@') -ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name) -try: - wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1)) - snip.rv = wmatch.group(1).lower() -except: - snip.rv = 'element' -`},${2:i}| - $0 -end -endsnippet - snippet "(\S+)\.Each_?p(air)?" ".each_pair { |,| }" r `!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| $0 } endsnippet @@ -298,20 +292,6 @@ rescue end endsnippet -snippet begin "begin ... rescue ... else ... ensure ... end" -begin - ${1:# Raise exception} -rescue Exception => e - puts e.message - puts e.backtrace.inspect - ${2:# Rescue} -else - ${3:# other exception} -ensure - ${0:# always excute} -end -endsnippet - snippet rescue rescue Exception => e puts e.message @@ -326,10 +306,6 @@ $0 end endsnippet -snippet alias "alias : :" -alias :${1:new_name} :${2:old_name} -endsnippet - snippet class "class def initialize ... end end" class ${1:class_name} def initialize(${2:*args}) diff --git a/sources_non_forked/vim-snippets/UltiSnips/snippets.snippets b/sources_non_forked/vim-snippets/UltiSnips/snippets.snippets index ee0c8c76..6fc26688 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/snippets.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/snippets.snippets @@ -2,15 +2,15 @@ priority -50 # We use a little hack so that the snippet is expanded # and parsed correctly -snippet snip "Snippet definition" b +snippet usnip "Ultisnips snippet definition" b `!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:b} -$0 +${0:${VISUAL}} `!p snip.rv = "endsnippet"` endsnippet snippet global "Global snippet" b `!p snip.rv = "global"` !p -$0 +${0:${VISUAL}} `!p snip.rv = "endglobal"` endsnippet diff --git a/sources_non_forked/vim-snippets/pythonx/javascript_snippets.py b/sources_non_forked/vim-snippets/pythonx/javascript_snippets.py new file mode 100644 index 00000000..8757d49b --- /dev/null +++ b/sources_non_forked/vim-snippets/pythonx/javascript_snippets.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Helper utilities to format javascript snippets. +""" + +ALWAYS = 'always' +NEVER = 'never' + + +def get_option(snip, option, default=None): + return snip.opt('g:ultisnips_javascript["{}"]'.format(option), default) + + +def semi(snip): + option = get_option(snip, 'semi', ALWAYS) + + if option == NEVER: + ret = '' + elif option == ALWAYS: + ret = ';' + else: + ret = ';' + return ret + + +def space_before_function_paren(snip): + option = get_option(snip, 'space-before-function-paren', NEVER) + + if option == NEVER: + ret = '' + elif option == ALWAYS: + ret = ' ' + else: + ret = '' + return ret + + +def keyword_spacing(snip): + option = get_option(snip, 'keyword-spacing', ALWAYS) + + if option == NEVER: + ret = '' + elif option == ALWAYS: + ret = ' ' + else: + ret = '' + return ret diff --git a/sources_non_forked/vim-snippets/snippets/c.snippets b/sources_non_forked/vim-snippets/snippets/c.snippets index ea744d54..6e8fb0a5 100644 --- a/sources_non_forked/vim-snippets/snippets/c.snippets +++ b/sources_non_forked/vim-snippets/snippets/c.snippets @@ -130,6 +130,84 @@ snippet fun { ${4} } +# function definition with zero parameters +snippet fun0 + ${1:void} ${2:function_name}() + { + ${3} + } +# function definition with Doxygen documentation +snippet dfun0 + /*! \brief ${1:Brief function description here} + * + * ${2:Detailed description of the function} + * + * \return ${3:Return parameter description} + */ + ${4:void} ${5:function_name}() + { + ${6} + } +# function definition with one parameter +snippet fun1 + ${1:void} ${2:function_name}(${3:Type} ${4:Parameter}) + { + ${5} + } +# function definition with one parameter with Doxygen documentation +snippet dfun1 + /*! \brief ${1:Brief function description here} + * + * ${2:Detailed description of the function} + * + * \param $3 ${4:Parameter description} + * \return ${5:Return parameter description} + */ + ${6:void} ${7:function_name}(${8:Type} ${3:Parameter}) + { + ${9} + } +# function definition with two parameters +snippet fun2 + ${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}) + { + ${7} + } +# function definition with two parameters with Doxygen documentation +snippet dfun2 + /*! \brief ${1:Brief function description here} + * + * ${2:Detailed description of the function} + * + * \param $3 ${4:Parameter description} + * \param $5 ${6:Parameter description} + * \return ${7:Return parameter description} + */ + ${8:void} ${9:function_name}(${10:Type} ${3:Parameter}, ${11:Type} ${5:Parameter}) + { + ${12} + } +# function definition with two parameters +snippet fun3 + ${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}, ${7:Type} ${8:Parameter}) + { + ${9} + } +# function definition with two parameters with Doxygen documentation +snippet dfun3 + /*! \brief ${1:Brief function description here} + * + * ${2:Detailed description of the function} + * + * \param $3 ${4:Parameter description} + * \param $5 ${6:Parameter description} + * \param $7 ${8:Parameter description} + * \return ${9:Return parameter description} + */ + ${10:void} ${11:function_name}(${12:Type} ${3:Parameter}, ${13:Type} ${5:Parameter}, ${14:Type} ${7:Parameter}) + { + ${15} + } # function declaration snippet fund ${1:void} ${2:function_name}(${3}); @@ -140,21 +218,39 @@ snippet td typedef ${1:int} ${2:MyCustomType}; # struct snippet st + /*! \struct $1 + * \brief ${3:Brief struct description} + * + * ${4:Detailed description} + */ struct ${1:`vim_snippets#Filename('$1_t', 'name')`} { - ${2:/* data */} - }${3: /* optional variable list */}; + ${2:Data} /*!< ${4:Description} */ + }${5: /* optional variable list */}; # typedef struct snippet tds + /*! \struct $2 + * \brief ${5:Brief struct description} + * + * ${6:Detailed description} + */ typedef struct ${2:_$1 }{ - ${3:/* data */} + m_${3:Data} /*!< ${4:Description} */ } ${1:`vim_snippets#Filename('$1_t', 'name')`}; snippet enum + /*! \enum $1 + * + * ${2:Detailed description} + */ enum ${1:name} { ${0} }; # typedef enum snippet tde + /*! \enum $2 + * + * ${4:Detailed description} + */ typedef enum { - ${1:/* data */} + ${1:Data} /*!< ${3:Description} */ } ${2:foo}; ## ## Input/Output @@ -228,6 +324,11 @@ snippet getopt } } ## +# TODO section +snippet todo + /*! TODO: ${1:Todo description here} + * \todo $1 + */ ## Miscellaneous # This is kind of convenient snippet . diff --git a/sources_non_forked/vim-snippets/snippets/cpp.snippets b/sources_non_forked/vim-snippets/snippets/cpp.snippets index 42c37341..7a55b95e 100644 --- a/sources_non_forked/vim-snippets/snippets/cpp.snippets +++ b/sources_non_forked/vim-snippets/snippets/cpp.snippets @@ -78,20 +78,61 @@ snippet mu ## Class # class snippet cl + /*! \class $1 + * \brief ${3:Brief class description} + * + * ${4:Detailed description} + */ class ${1:`vim_snippets#Filename('$1', 'name')`} { public: $1(${2}); - ~$1(); + virtual ~$1(); - private: - ${0:/* data */} + protected: + m_${5}; /*!< ${6:Member description} */ }; # member function implementation snippet mfun ${4:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) { ${0} } +# member function implementation without parameters +snippet dmfun0 + /*! \brief ${4:Brief function description here} + * + * ${5:Detailed description} + * + * \return ${6:Return parameter description} + */ + ${3:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}() { + ${0} + } +# member function implementation with one parameter +snippet dmfun1 + /*! \brief ${6:Brief function description here} + * + * ${7:Detailed description} + * + * \param $4 ${8:Parameter description} + * \return ${9:Return parameter description} + */ + ${5:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3:Type} ${4:Parameter}) { + ${0} + } +# member function implementation with two parameter +snippet dmfun2 + /*! \brief ${8:Brief function description here} + * + * ${9:Detailed description} + * + * \param $4 ${10:Parameter description} + * \param $6 ${11:Parameter description} + * \return ${12:Return parameter description} + */ + ${7:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3:Type} ${4:Parameter},${5:Type} ${6:Parameter}) { + ${0} + } # namespace snippet ns namespace ${1:`vim_snippets#Filename('', 'my')`} { @@ -152,3 +193,13 @@ snippet lld [${1}](${2}){ ${3} }; +# snippets exception +snippet try + try { + + }catch(${1}) { + + } + + + diff --git a/sources_non_forked/vim-snippets/snippets/fortran.snippets b/sources_non_forked/vim-snippets/snippets/fortran.snippets index 8fecd330..e61d3fb5 100644 --- a/sources_non_forked/vim-snippets/snippets/fortran.snippets +++ b/sources_non_forked/vim-snippets/snippets/fortran.snippets @@ -28,9 +28,12 @@ snippet doc $0 snippet dox !> @brief ${1} + !! !> ${2} !> @author `g:snips_author` ${0} +snippet doxp + !> @param[${1}]${0} # Variables definitions # Boolean snippet bool diff --git a/sources_non_forked/vim-snippets/snippets/jinja.snippets b/sources_non_forked/vim-snippets/snippets/jinja.snippets index 7d14ca83..a6f274ab 100644 --- a/sources_non_forked/vim-snippets/snippets/jinja.snippets +++ b/sources_non_forked/vim-snippets/snippets/jinja.snippets @@ -78,7 +78,7 @@ snippet spaceless snippet ssi {% ssi ${0} %} snippet trans - {% trans "${0:string}" %} + {% trans %}${0}{% endtrans %} snippet url {% url ${1} as ${0} %} snippet widthratio diff --git a/sources_non_forked/vim-snippets/snippets/matlab.snippets b/sources_non_forked/vim-snippets/snippets/matlab.snippets new file mode 100644 index 00000000..19b6fe87 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/matlab.snippets @@ -0,0 +1,64 @@ +snippet if if + if ${1} + ${0} + end + +snippet ife if ... else + if ${1} + ${2} + else + ${0} + end + +snippet el else + else + ${0} + +snippet eif elsif + elseif ${1} + ${0} + +snippet wh while + while ${1} + ${0} + end + +snippet for for + for ${1:i} = ${2:1:n} + ${0} + end + +snippet parfor parfor + parfor ${1:i} = ${2:1:n} + ${0} + end + +snippet fun function + function [${3:out}] = ${1:`vim_snippets#Filename("$1", "fun_name")`}(${2}) + ${0} + +snippet try try ... catch + try + ${1} + catch ${2:err} + ${0} + end + +snippet switch switch + switch ${1:n} + case ${2:0} + ${0} + end + +snippet @ anonymous function + @(${1:x}) ${0:x*x} + +snippet cl class + classdef ${1:`vim_snippets#Filename("$1", "class_name")`} + properties + ${2} + end + methods + ${0} + end + end diff --git a/sources_non_forked/vim-snippets/snippets/php.snippets b/sources_non_forked/vim-snippets/snippets/php.snippets index 52572da9..fb313b84 100644 --- a/sources_non_forked/vim-snippets/snippets/php.snippets +++ b/sources_non_forked/vim-snippets/snippets/php.snippets @@ -94,9 +94,9 @@ snippet E $_ENV['${1:variable}'] snippet F $_FILES['${1:variable}'] -snippet G +snippet G "_GET array" $_GET['${1:variable}'] -snippet P +snippet P "_POST array" $_POST['${1:variable}'] snippet R $_REQUEST['${1:variable}'] diff --git a/sources_non_forked/vim-snippets/snippets/ruby.snippets b/sources_non_forked/vim-snippets/snippets/ruby.snippets index 9dc984fd..340391eb 100644 --- a/sources_non_forked/vim-snippets/snippets/ruby.snippets +++ b/sources_non_forked/vim-snippets/snippets/ruby.snippets @@ -142,21 +142,6 @@ snippet mod module .. end module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} ${0} end -snippet mod module .. ClassMethods .. end - module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} - module ClassMethods - ${0} - end - - module InstanceMethods - - end - - def self.included(receiver) - receiver.extend ClassMethods - receiver.send :include, InstanceMethods - end - end # attr_reader snippet r attr_reader :${0:attr_names} diff --git a/sources_non_forked/vim-snippets/snippets/rust.snippets b/sources_non_forked/vim-snippets/snippets/rust.snippets index 2a353e49..25effe6e 100644 --- a/sources_non_forked/vim-snippets/snippets/rust.snippets +++ b/sources_non_forked/vim-snippets/snippets/rust.snippets @@ -142,7 +142,7 @@ snippet stn "Struct with new constructor" } impl $1 { - pub fn new(${2}) -> $1 { + pub fn new(${2}) -> Self { $1 { ${3} } } } diff --git a/sources_non_forked/vim-snippets/snippets/snippets.snippets b/sources_non_forked/vim-snippets/snippets/snippets.snippets index dc8de42f..c2d932ae 100644 --- a/sources_non_forked/vim-snippets/snippets/snippets.snippets +++ b/sources_non_forked/vim-snippets/snippets/snippets.snippets @@ -1,10 +1,7 @@ # snippets for making snippets :) snippet snip - snippet ${1:trigger} - ${0} -snippet msnip - snippet ${1:trigger} ${2:description} - ${0} + snippet ${1:trigger} "${2:description}" + ${0:${VISUAL}} snippet v {VISUAL} snippet $