From 1dba960b75349fd8e2f31cb97f45b232a7bc7b6c Mon Sep 17 00:00:00 2001 From: amix Date: Wed, 2 Jul 2014 12:18:18 +0100 Subject: [PATCH] Updated plugins --- sources_non_forked/ack.vim/README.md | 44 +- sources_non_forked/ack.vim/autoload/ack.vim | 23 +- sources_non_forked/ack.vim/doc/ack.txt | 16 +- sources_non_forked/ack.vim/ftplugin/qf.vim | 2 +- sources_non_forked/ack.vim/plugin/ack.vim | 8 +- sources_non_forked/goyo.vim/plugin/goyo.vim | 7 +- sources_non_forked/nerdtree/README.markdown | 7 +- .../nerdtree/autoload/nerdtree.vim | 14 +- sources_non_forked/nerdtree/doc/NERD_tree.txt | 62 ++- .../nerdtree/lib/nerdtree/bookmark.vim | 8 +- .../nerdtree/lib/nerdtree/creator.vim | 2 +- .../nerdtree/lib/nerdtree/menu_item.vim | 2 +- .../nerdtree/lib/nerdtree/path.vim | 21 + .../nerdtree/lib/nerdtree/tree_dir_node.vim | 4 +- .../nerdtree/nerdtree_plugin/fs_menu.vim | 19 +- .../nerdtree/plugin/NERD_tree.vim | 6 +- .../nerdtree/syntax/nerdtree.vim | 90 ++-- sources_non_forked/syntastic/CONTRIBUTING.md | 122 +++-- sources_non_forked/syntastic/README.markdown | 37 +- .../syntastic/autoload/syntastic/c.vim | 2 +- .../syntastic/autoload/syntastic/log.vim | 34 +- .../autoload/syntastic/postprocess.vim | 2 + .../autoload/syntastic/preprocess.vim | 24 + .../syntastic/autoload/syntastic/util.vim | 1 + .../syntastic/doc/syntastic.txt | 40 +- .../syntastic/plugin/syntastic.vim | 84 ++-- .../syntastic/plugin/syntastic/checker.vim | 16 +- .../syntastic/plugin/syntastic/cursor.vim | 4 +- .../plugin/syntastic/highlighting.vim | 11 +- .../syntastic/plugin/syntastic/loclist.vim | 30 +- .../syntastic/plugin/syntastic/notifiers.vim | 1 + .../syntastic/plugin/syntastic/registry.vim | 84 ++-- .../syntastic/plugin/syntastic/signs.vim | 23 +- .../syntax_checkers/actionscript/mxmlc.vim | 12 +- .../syntax_checkers/bemhtml/bemhtmllint.vim | 5 +- .../syntastic/syntax_checkers/bro/bro.vim | 45 ++ .../syntax_checkers/c/checkpatch.vim | 25 +- .../syntastic/syntax_checkers/c/make.vim | 2 +- .../syntastic/syntax_checkers/cabal/cabal.vim | 55 ++ .../syntastic/syntax_checkers/co/coco.vim | 3 +- .../syntax_checkers/coffee/coffeelint.vim | 6 +- .../syntastic/syntax_checkers/css/csslint.vim | 10 +- .../syntastic/syntax_checkers/css/recess.vim | 26 + .../syntastic/syntax_checkers/d/dmd.vim | 6 + .../syntastic/syntax_checkers/eruby/ruby.vim | 27 +- .../syntastic/syntax_checkers/haml/haml.vim | 10 +- .../syntax_checkers/haskell/hdevtools.vim | 4 +- .../syntastic/syntax_checkers/html/jshint.vim | 23 +- .../syntastic/syntax_checkers/html/tidy.vim | 4 + .../syntastic/syntax_checkers/java/javac.vim | 116 ++--- .../javascript/closurecompiler.vim | 32 +- .../syntax_checkers/javascript/eslint.vim | 19 +- .../syntax_checkers/javascript/gjslint.vim | 7 +- .../syntax_checkers/javascript/jshint.vim | 21 +- .../syntax_checkers/javascript/jsl.vim | 9 +- .../syntax_checkers/javascript/jslint.vim | 2 +- .../syntastic/syntax_checkers/less/recess.vim | 44 ++ .../syntastic/syntax_checkers/lisp/clisp.vim | 7 +- .../syntastic/syntax_checkers/perl/perl.vim | 20 +- .../syntastic/syntax_checkers/php/phpcs.vim | 4 +- .../syntax_checkers/puppet/puppetlint.vim | 7 +- .../syntax_checkers/python/flake8.vim | 3 +- .../syntax_checkers/python/frosted.vim | 4 +- .../syntax_checkers/python/pep257.vim | 34 +- .../syntastic/syntax_checkers/python/pep8.vim | 3 +- .../syntax_checkers/python/py3kwarn.vim | 3 +- .../syntax_checkers/python/pyflakes.vim | 15 +- .../syntax_checkers/python/pylama.vim | 4 +- .../syntax_checkers/python/pylint.vim | 1 + .../syntax_checkers/python/python.vim | 4 +- .../syntastic/syntax_checkers/r/lint.vim | 5 +- .../syntastic/syntax_checkers/r/svtools.vim | 3 +- .../syntastic/syntax_checkers/ruby/jruby.vim | 12 +- .../syntax_checkers/ruby/macruby.vim | 2 +- .../syntastic/syntax_checkers/ruby/mri.vim | 18 +- .../syntax_checkers/ruby/rubylint.vim | 6 +- .../syntastic/syntax_checkers/sass/sass.vim | 1 + .../{rust/rustc.vim => sass/sassc.vim} | 24 +- .../syntastic/syntax_checkers/scala/fsc.vim | 7 +- .../syntax_checkers/scala/scalac.vim | 10 +- .../syntastic/syntax_checkers/scss/sass.vim | 1 - .../syntastic/syntax_checkers/scss/sassc.vim | 25 + .../syntastic/syntax_checkers/sh/sh.vim | 71 +-- .../syntax_checkers/typescript/tslint.vim | 46 ++ .../syntastic/syntax_checkers/vala/valac.vim | 2 +- .../syntastic/syntax_checkers/vhdl/ghdl.vim | 2 +- .../syntastic/syntax_checkers/vim/vimlint.vim | 5 +- .../syntastic/syntax_checkers/yaml/yamlxs.vim | 13 +- .../syntax_checkers/z80/z80syntaxchecker.vim | 2 +- .../tlib/autoload/tlib/Filter_cnf.vim | 26 +- .../tlib/autoload/tlib/World.vim | 4 +- .../tlib/autoload/tlib/string.vim | 8 +- sources_non_forked/tlib/doc/tlib.txt | 4 +- sources_non_forked/tlib/plugin/02tlib.vim | 4 +- sources_non_forked/vim-airline/README.md | 2 +- .../vim-airline/autoload/airline.vim | 10 +- .../autoload/airline/extensions.vim | 40 +- .../autoload/airline/extensions/branch.vim | 9 +- .../autoload/airline/extensions/hunks.vim | 17 +- .../autoload/airline/extensions/nrrwrgn.vim | 54 ++ .../tabline/unique_tail_improved.vim | 6 +- .../airline/extensions/whitespace.vim | 37 +- .../autoload/airline/highlighter.vim | 5 +- .../autoload/airline/themes/bubblegum.vim | 2 +- .../vim-airline/doc/airline.txt | 34 +- .../vim-commentary/README.markdown | 4 +- .../vim-commentary/doc/commentary.txt | 3 + .../vim-commentary/plugin/commentary.vim | 1 + .../vim-fugitive/README.markdown | 4 +- .../vim-fugitive/doc/fugitive.txt | 58 ++- .../vim-fugitive/plugin/fugitive.vim | 470 ++++++++++++++---- .../vim-golang/autoload/go/complete.vim | 2 +- sources_non_forked/vim-golang/ftplugin/go.vim | 4 +- sources_non_forked/vim-golang/indent/go.vim | 20 +- sources_non_forked/vim-golang/readme.txt | 8 +- .../vim-markdown/README.markdown | 17 + .../vim-markdown/ftplugin/markdown.vim | 2 +- .../vim-markdown/syntax/markdown.vim | 4 +- .../vim-snipmate/after/plugin/snipMate.vim | 5 - .../vim-snipmate/autoload/snipMate.vim | 38 +- .../vim-snipmate/doc/snipMate.txt | 8 +- .../vim-snipmate/plugin/snipMate.vim | 36 +- sources_non_forked/vim-snippets/README.md | 38 +- .../vim-snippets/UltiSnips/c.snippets | 24 +- .../vim-snippets/UltiSnips/cpp.snippets | 2 +- .../vim-snippets/UltiSnips/d.snippets | 58 +-- .../vim-snippets/UltiSnips/go.snippets | 6 + .../vim-snippets/UltiSnips/java.snippets | 10 +- .../UltiSnips/javascript.snippets | 12 + .../UltiSnips/javascript_angular.snippets | 25 + .../vim-snippets/UltiSnips/julia.snippets | 34 ++ .../vim-snippets/UltiSnips/markdown.snippets | 11 + .../vim-snippets/UltiSnips/pandoc.snippets | 3 + .../UltiSnips/php_symfony2.snippets | 22 + .../vim-snippets/UltiSnips/r.snippets | 37 +- .../vim-snippets/UltiSnips/rust.snippets | 167 ++++--- .../vim-snippets/UltiSnips/tex.snippets | 2 +- .../vim-snippets/UltiSnips/vim.snippets | 42 +- .../vim-snippets/snippets/_.snippets | 18 + .../vim-snippets/snippets/css.snippets | 20 + .../vim-snippets/snippets/elixir.snippets | 33 +- .../vim-snippets/snippets/go.snippets | 12 + .../vim-snippets/snippets/html.snippets | 5 +- .../snippets/html_minimal.snippets | 72 --- .../vim-snippets/snippets/java.snippets | 77 ++- .../snippets/javascript/javascript.snippets | 2 +- .../vim-snippets/snippets/julia.snippets | 102 ++++ .../vim-snippets/snippets/php.snippets | 2 +- .../vim-snippets/snippets/r.snippets | 16 +- .../vim-snippets/snippets/ruby.snippets | 4 +- .../vim-snippets/snippets/rust.snippets | 125 +++++ .../vim-snippets/snippets/scheme.snippets | 36 ++ .../vim-snippets/snippets/sh.snippets | 2 +- .../vim-snippets/snippets/tex.snippets | 159 +++--- .../vim-snippets/snippets/vim.snippets | 26 +- .../vim-surround/plugin/surround.vim | 14 +- 156 files changed, 2657 insertions(+), 1234 deletions(-) create mode 100644 sources_non_forked/syntastic/syntax_checkers/bro/bro.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/cabal/cabal.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/css/recess.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/less/recess.vim rename sources_non_forked/syntastic/syntax_checkers/{rust/rustc.vim => sass/sassc.vim} (57%) create mode 100644 sources_non_forked/syntastic/syntax_checkers/scss/sassc.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/typescript/tslint.vim create mode 100644 sources_non_forked/vim-airline/autoload/airline/extensions/nrrwrgn.vim create mode 100644 sources_non_forked/vim-markdown/README.markdown create mode 100644 sources_non_forked/vim-snippets/UltiSnips/javascript_angular.snippets create mode 100644 sources_non_forked/vim-snippets/UltiSnips/julia.snippets create mode 100644 sources_non_forked/vim-snippets/UltiSnips/pandoc.snippets delete mode 100644 sources_non_forked/vim-snippets/snippets/html_minimal.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/julia.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/rust.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/scheme.snippets diff --git a/sources_non_forked/ack.vim/README.md b/sources_non_forked/ack.vim/README.md index d9dbb929..008fb3dd 100644 --- a/sources_non_forked/ack.vim/README.md +++ b/sources_non_forked/ack.vim/README.md @@ -9,7 +9,7 @@ ack from vim, and shows the results in a split window. ### Ack -You will need the ack, of course, to install it follow the +You will need the ack(>= 2.0), of course, to install it follow the [manual](http://beyondgrep.com/install/) ### The Plugin @@ -75,8 +75,8 @@ check out the docs for the Perl script 'ack', for obvious reasons: ### Gotchas Some characters have special meaning, and need to be escaped your search -pattern. For instance, '#'. You have to escape it like this :Ack '\\\#define -foo' to search for #define foo. (From blueyed in issue #5.) +pattern. For instance, '#'. You have to escape it like this `:Ack '\\\#define +foo'` to search for '#define foo'. (From blueyed in issue #5.) ## Changelog @@ -91,3 +91,41 @@ foo' to search for #define foo. (From blueyed in issue #5.) * Add g:ack_mapping * Add g:ack_default_options * Add a help toggle `?`(like NERDTree) + +### 1.0.1 + +* Fixes #124. Bug with `g:ack_autofold_results` + +### 1.0.2 + +* Add compatibility with [vim-dispatch](https://github.com/tpope/vim-dispatch) + +### 1.0.3 + +* Fixes #127. Use `&l:hlsearch` instead of `v:hlsearch` to keep compatibility +with versions that does not have this variable. + +### 1.0.4 + +* Fixes #128. Always apply mappings, even when using vim-dispatch. + +### 1.0.5 + +* Fixes #128. Fixes the `errorformat` for ack when using vim-dispatch. +* Do not use vim-dispatch by default. To use vim-dispath must set +`g:ack_use_dispatch` + +### 1.0.6 + +* Fixes highlight function to work when user passes options. Ex.: Ack -i test + Thank's @mannih. (#131, #134) + +### 1.0.7 + +* Fixes highlight function to work when passes more than one option, or options +with double dashes(--option) Thank's to @MiguelLatorre and @mannih + +### 1.0.8 + +* Fixes (again) highlight, now using negative look behind. +* Change mappings `o` and `O` to behave as documented diff --git a/sources_non_forked/ack.vim/autoload/ack.vim b/sources_non_forked/ack.vim/autoload/ack.vim index ff8d8eb6..fae73b1f 100644 --- a/sources_non_forked/ack.vim/autoload/ack.vim +++ b/sources_non_forked/ack.vim/autoload/ack.vim @@ -8,6 +8,7 @@ function! ack#Ack(cmd, args) else let l:grepargs = a:args . join(a:000, ' ') end + echom l:grepargs let l:ackprg_run = g:ackprg " Format, used to manage column jump @@ -26,7 +27,14 @@ function! ack#Ack(cmd, args) try " NOTE: we escape special chars, but not everything using shellescape to " allow for passing arguments etc - silent execute a:cmd . " " . escape(l:grepargs, '|#%') + if g:ack_use_dispatch + let &l:errorformat = g:ackformat + let &l:makeprg=g:ackprg." " . escape(l:grepargs, '|#%') + Make + else + silent execute a:cmd . " " . escape(l:grepargs, '|#%') + endif + finally let &grepprg=grepprg_bak let &grepformat=grepformat_bak @@ -42,7 +50,12 @@ function! ack#Ack(cmd, args) let s:close_cmd = ':cclose' endif - call ack#show_results() + if !g:ack_use_dispatch + call ack#show_results() + else + copen + endif + call apply_maps() call highlight(l:grepargs) redraw! @@ -50,7 +63,6 @@ endfunction function! ack#show_results() execute s:handler - call apply_maps() endfunction function! s:apply_maps() @@ -100,9 +112,8 @@ function! s:highlight(args) return endif - let @/ = matchstr(a:args, "\\v\\w+\>|['\"]\\zs[^\"]+\\ze['\"]") - setlocal hlsearch - call feedkeys(":let v:hlsearch=1 \| echo \", "n") + let @/ = matchstr(a:args, "\\v(-)\@", "n") endfunction function! ack#AckFromSearch(cmd, args) diff --git a/sources_non_forked/ack.vim/doc/ack.txt b/sources_non_forked/ack.vim/doc/ack.txt index 33c10529..6b1be331 100644 --- a/sources_non_forked/ack.vim/doc/ack.txt +++ b/sources_non_forked/ack.vim/doc/ack.txt @@ -86,7 +86,7 @@ Example: let g:ackprg = "other-bin-ack" < - g:ack_default_options* + *g:ack_default_options* g:ack_default_options Default: " -s -H --nocolor --nogroup --column" @@ -94,7 +94,7 @@ Use this option to specify the options used by ack Example: > - let g:ackprg = + let g:ack_default_options = \ " -s -H --nocolor --nogroup --column --smart-case --follow" < @@ -203,6 +203,18 @@ Example: let g:ackpreview = 1 < + *g:ack_use_dispatch* + +g:ack_use_dispatch +Default: 0 + +Use this option to use vim-dispatch to search the results in background + +Example: +> + let g:ack_use_dispatch = 1 +< + ============================================================================== MAPPINGS *ack-mappings* diff --git a/sources_non_forked/ack.vim/ftplugin/qf.vim b/sources_non_forked/ack.vim/ftplugin/qf.vim index 7da45a4c..27564fa7 100644 --- a/sources_non_forked/ack.vim/ftplugin/qf.vim +++ b/sources_non_forked/ack.vim/ftplugin/qf.vim @@ -1,4 +1,4 @@ -if g:ack_autofold_results +if exists("g:ack_autofold_results") && g:ack_autofold_results setlocal foldlevel=0 setlocal foldmethod=expr setlocal foldexpr=matchstr(getline(v:lnum),'^[^\|]\\+')==#matchstr(getline(v:lnum+1),'^[^\|]\\+')?1:'<1' diff --git a/sources_non_forked/ack.vim/plugin/ack.vim b/sources_non_forked/ack.vim/plugin/ack.vim index e5d0507b..6d6c55bc 100644 --- a/sources_non_forked/ack.vim/plugin/ack.vim +++ b/sources_non_forked/ack.vim/plugin/ack.vim @@ -22,12 +22,16 @@ if !exists("g:ack_apply_lmappings") let g:ack_apply_lmappings = !exists("g:ack_lhandler") endif +if !exists("g:ack_use_dispatch") + let g:ack_use_dispatch = 0 +end + let s:ack_mappings = { \ "t": "T", \ "T": "TgTj", \ "o": "", - \ "O": ":ccl", - \ "go": "j", + \ "O": "pc", + \ "go": "p", \ "h": "K", \ "H": "Kb", \ "v": "HbJt", diff --git a/sources_non_forked/goyo.vim/plugin/goyo.vim b/sources_non_forked/goyo.vim/plugin/goyo.vim index 311589ed..4265e14f 100644 --- a/sources_non_forked/goyo.vim/plugin/goyo.vim +++ b/sources_non_forked/goyo.vim/plugin/goyo.vim @@ -104,13 +104,13 @@ function! s:tranquilize() \ 'StatusLine', 'StatusLineNC', 'SignColumn'] " -1 on Vim / '' on GVim if bg == -1 || empty(bg) - call s:set_color(grp, '', 'NONE') call s:set_color(grp, 'fg', get(g:, 'goyo_bg', 'black')) call s:set_color(grp, 'bg', 'NONE') else call s:set_color(grp, 'fg', bg) call s:set_color(grp, 'bg', bg) endif + call s:set_color(grp, '', 'NONE') endfor endfunction @@ -244,6 +244,8 @@ function! s:goyo_off() let goyo_disabled_airline = t:goyo_disabled_airline let goyo_disabled_powerline = t:goyo_disabled_powerline let goyo_disabled_lightline = t:goyo_disabled_lightline + let goyo_orig_buffer = t:goyo_master + let [line, col] = [line('.'), col('.')] if tabpagenr() == 1 tabnew @@ -252,6 +254,9 @@ function! s:goyo_off() endif tabclose execute 'normal! '.s:orig_tab.'gt' + if winbufnr(0) == goyo_orig_buffer + execute printf('normal! %dG%d|', line, col) + endif let wmh = remove(goyo_revert, 'winminheight') let wh = remove(goyo_revert, 'winheight') diff --git a/sources_non_forked/nerdtree/README.markdown b/sources_non_forked/nerdtree/README.markdown index e6178091..bfae5c68 100644 --- a/sources_non_forked/nerdtree/README.markdown +++ b/sources_non_forked/nerdtree/README.markdown @@ -60,7 +60,7 @@ Installation cd ~/.vim/bundle git clone https://github.com/scrooloose/nerdtree.git -Then reload vim, run `:helptags`, and check out `:help NERD_tree.txt`. +Then reload vim, run `:Helptags`, and check out `:help NERD_tree.txt`. Faq @@ -80,7 +80,10 @@ A. Stick this in your vimrc: `autocmd vimenter * NERDTree` __Q. How can I open a NERDTree automatically when vim starts up if no files were specified?__ -A. Stick this in your vimrc `autocmd vimenter * if !argc() | NERDTree | endif` +A. Stick this in your vimrc + + autocmd StdinReadPre * let s:std_in=1 + autocmd VimEnter * if !argc() == 0 && !exists("s:std_in") | NERDTree | endif __Q. How can I map a specific key or shortcut to open NERDTree?__ diff --git a/sources_non_forked/nerdtree/autoload/nerdtree.vim b/sources_non_forked/nerdtree/autoload/nerdtree.vim index 3a2d71a6..35919320 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree.vim @@ -513,7 +513,7 @@ function! nerdtree#dumpHelp() 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."\" :Bookmark []\n" let @h=@h."\" :BookmarkToRoot \n" let @h=@h."\" :RevealBookmark \n" let @h=@h."\" :OpenBookmark \n" @@ -1068,9 +1068,17 @@ function! s:closeCurrentDir(node) if parent ==# {} || parent.isRoot() call nerdtree#echo("cannot close tree root") else - call a:node.parent.close() + while g:NERDTreeCascadeOpenSingleChildDir && !parent.parent.isRoot() + if parent.parent.getVisibleChildCount() == 1 + call parent.close() + let parent = parent.parent + else + break + endif + endwhile + call parent.close() call nerdtree#renderView() - call a:node.parent.putCursorHere(0, 0) + call parent.putCursorHere(0, 0) endif endfunction diff --git a/sources_non_forked/nerdtree/doc/NERD_tree.txt b/sources_non_forked/nerdtree/doc/NERD_tree.txt index bf038962..4ddc2507 100644 --- a/sources_non_forked/nerdtree/doc/NERD_tree.txt +++ b/sources_non_forked/nerdtree/doc/NERD_tree.txt @@ -109,7 +109,7 @@ The following features and functionality are provided by the NERD tree: < :NERDTreeFromBookmark *:NERDTreeFromBookmark* Opens a fresh NERD tree with the root initialized to the dir for - . This only reason to use this command over :NERDTree is for + . The only reason to use this command over :NERDTree is for the completion (which is for bookmarks rather than directories). :NERDTreeToggle [ | ] *:NERDTreeToggle* @@ -160,7 +160,7 @@ click bookmarks or use the |NERDTree-o| mapping to activate them. See also, Note that the following commands are only available in the NERD tree buffer. -:Bookmark +:Bookmark [] Bookmark the current node as . If there is already a bookmark, it is overwritten. must not contain spaces. If is not provided, it defaults to the file or directory name. @@ -358,7 +358,7 @@ Default key: O Map option: NERDTreeMapOpenRecursively Applies to: directories. -Recursively opens the selelected directory. +Recursively opens the selected directory. All files and directories are cached, but if a directory would not be displayed due to file filters (see |'NERDTreeIgnore'| |NERDTree-f|) or the @@ -609,17 +609,19 @@ NERD tree. These options should be set in your vimrc. |'loaded_nerd_tree'| Turns off the script. -|'NERDChristmasTree'| Tells the NERD tree to make itself colourful - and pretty. - |'NERDTreeAutoCenter'| Controls whether the NERD tree window centers when the cursor moves within a specified distance to the top/bottom of the window. + |'NERDTreeAutoCenterThreshold'| Controls the sensitivity of autocentering. |'NERDTreeCaseSensitiveSort'| Tells the NERD tree whether to be case sensitive or not when sorting nodes. +|'NERDTreeSortHiddenFirst'| Tells the NERD tree whether to take the dot + at the beginning of the hidden file names + into account when sorting nodes. + |'NERDTreeChDirMode'| Tells the NERD tree if/when it should change vim's current working directory. @@ -631,8 +633,13 @@ NERD tree. These options should be set in your vimrc. |'NERDTreeIgnore'| Tells the NERD tree which files to ignore. +|'NERDTreeRespectWildIgnore'| Tells the NERD tree to respect |'wildignore'|. + |'NERDTreeBookmarksFile'| Where the bookmarks are stored. +|'NERDTreeBookmarksSort'| Whether the bookmarks list is sorted on + display. + |'NERDTreeMouseMode'| Tells the NERD tree how to handle mouse clicks. @@ -667,8 +674,8 @@ NERD tree. These options should be set in your vimrc. |'NERDTreeDirArrows'| Tells the NERD tree to use arrows instead of + ~ chars when displaying directories. -|'NERDTreeCasadeOpenSingleChildDir'| - Casade open while selected directory has only +|'NERDTreeCascadeOpenSingleChildDir'| + Cascade open while selected directory has only one child that also is a directory. |'NERDTreeAutoDeleteBuffer'| Tells the NERD tree to automatically remove @@ -686,15 +693,6 @@ If this plugin is making you feel homicidal, it may be a good idea to turn it off with this line in your vimrc: > let loaded_nerd_tree=1 < ------------------------------------------------------------------------------- - *'NERDChristmasTree'* -Values: 0 or 1. -Default: 1. - -If this option is set to 1 then some extra syntax highlighting elements are -added to the nerd tree to make it more colourful. - -Set it to 0 for a more vanilla looking tree. ------------------------------------------------------------------------------ *'NERDTreeAutoCenter'* @@ -817,6 +815,13 @@ line: > The file filters can be turned on and off dynamically with the |NERDTree-f| mapping. +------------------------------------------------------------------------------ + *'NERDTreeRespectWildIgnore'* +Values: 0 or 1. +Default: 0. + +If set to 1, the |'wildignore'| setting is respected. + ------------------------------------------------------------------------------ *'NERDTreeBookmarksFile'* Values: a path @@ -824,6 +829,14 @@ Default: $HOME/.NERDTreeBookmarks This is where bookmarks are saved. See |NERDTreeBookmarkCommands|. +------------------------------------------------------------------------------ + *'NERDTreeBookmarksSort'* +Values: 0 or 1 +Default: 1 + +If set to 0 then the bookmarks list is not sorted. +If set to 1 the bookmarks list is sorted. + ------------------------------------------------------------------------------ *'NERDTreeMouseMode'* Values: 1, 2 or 3. @@ -987,16 +1000,17 @@ option: > < ------------------------------------------------------------------------------ - *'NERDTreeCasadeOpenSingleChildDir'* + *'NERDTreeCascadeOpenSingleChildDir'* Values: 0 or 1 Default: 1. When opening dir nodes, this option tells NERDTree to recursively open dirs that have only one child which is also a dir. NERDTree will stop when it finds -a dir that contains anything but another single dir. This option may be useful -for Java projects. Use one of the follow lines to set this option: > - let NERDTreeCasadeOpenSingleChildDir=0 - let NERDTreeCasadeOpenSingleChildDir=1 +a dir that contains anything but another single dir. This option also causes +the |NERDTree-x| mapping to close dirs in the same manner. This option may be +useful for Java projects. Use one of the follow lines to set this option: > + let NERDTreeCascadeOpenSingleChildDir=0 + let NERDTreeCascadeOpenSingleChildDir=1 < ------------------------------------------------------------------------------ @@ -1062,8 +1076,8 @@ NERDTreeAddKeyMap({options}) *NERDTreeAddKeyMap()* call NERDTreeAddKeyMap({ \ 'key': 'foo', \ 'callback': 'NERDTreeCDHandler', - \ 'quickhelpText': 'echo full path of current node' }) - \ 'scope': 'DirNode' + \ 'quickhelpText': 'echo full path of current node', + \ 'scope': 'DirNode' }) function! NERDTreeCDHandler(dirnode) call a:dirnode.changeToDir() diff --git a/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim b/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim index 5b845d81..84a6099f 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim @@ -19,7 +19,9 @@ function! s:Bookmark.AddBookmark(name, path) endif endfor call add(s:Bookmark.Bookmarks(), s:Bookmark.New(a:name, a:path)) - call s:Bookmark.Sort() + if g:NERDTreeBookmarksSort ==# 1 + call s:Bookmark.Sort() + endif endfunction " FUNCTION: Bookmark.Bookmarks() {{{1 @@ -101,7 +103,9 @@ function! s:Bookmark.CacheBookmarks(silent) call nerdtree#echo(invalidBookmarksFound . " invalid bookmarks were read. See :help NERDTreeInvalidBookmarks for info.") endif endif - call s:Bookmark.Sort() + if g:NERDTreeBookmarksSort ==# 1 + call s:Bookmark.Sort() + endif endif endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim index 7f0721f0..19c51ffb 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim @@ -279,8 +279,8 @@ function! s:Creator._setCommonBufOptions() let b:NERDTreeShowFiles = g:NERDTreeShowFiles let b:NERDTreeShowHidden = g:NERDTreeShowHidden let b:NERDTreeShowBookmarks = g:NERDTreeShowBookmarks - setfiletype nerdtree call self._bindMappings() + setlocal filetype=nerdtree endfunction "FUNCTION: s:Creator._setupStatusline() {{{1 diff --git a/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim b/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim index 6fb9d9e3..92c1bbbf 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim @@ -90,7 +90,7 @@ endfunction "callback function! s:MenuItem.execute() if len(self.children) - let mc = s:MenuController.New(self.children) + let mc = g:NERDTreeMenuController.New(self.children) call mc.showMenu() else if self.callback != -1 diff --git a/sources_non_forked/nerdtree/lib/nerdtree/path.vim b/sources_non_forked/nerdtree/lib/nerdtree/path.vim index 58bb0138..047a72a6 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/path.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/path.vim @@ -103,6 +103,10 @@ function! s:Path.compareTo(path) elseif thisSS > thatSS return 1 else + if !g:NERDTreeSortHiddenFirst + let thisPath = substitute(thisPath, '^[._]', '', '') + let thatPath = substitute(thatPath, '^[._]', '', '') + endif "if the sort sequences are the same then compare the paths "alphabetically let pathCompare = g:NERDTreeCaseSensitiveSort ? thisPath <# thatPath : thisPath = 703 - let filesStr = globpath(globDir, '*', 1) . "\n" . globpath(globDir, '.*', 1) + let filesStr = globpath(globDir, '*', !g:NERDTreeRespectWildIgnore) . "\n" . globpath(globDir, '.*', !g:NERDTreeRespectWildIgnore) else let filesStr = globpath(globDir, '*') . "\n" . globpath(globDir, '.*') endif @@ -500,7 +500,7 @@ function! s:TreeDirNode.toggleOpen(...) if self.isOpen ==# 1 call self.close() else - if g:NERDTreeCasadeOpenSingleChildDir == 0 + if g:NERDTreeCascadeOpenSingleChildDir == 0 call self.open(opts) else call self.openAlong(opts) diff --git a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim index 9b81ed37..4fdc5d2a 100644 --- a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim +++ b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim @@ -82,13 +82,14 @@ endfunction function! s:promptToRenameBuffer(bufnum, msg, newFileName) echo a:msg if g:NERDTreeAutoDeleteBuffer || nr2char(getchar()) ==# 'y' + let quotedFileName = "'" . a:newFileName . "'" " 1. ensure that a new buffer is loaded - exec "badd " . a:newFileName + exec "badd " . quotedFileName " 2. ensure that all windows which display the just deleted filename " display a buffer for a new filename. let s:originalTabNumber = tabpagenr() let s:originalWindowNumber = winnr() - exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':e! " . a:newFileName . "' | endif" + exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec \":e! " . quotedFileName . "\" | endif" exec "tabnext " . s:originalTabNumber exec s:originalWindowNumber . "wincmd w" " 3. We don't need a previous buffer anymore @@ -114,7 +115,10 @@ function! NERDTreeAddNode() let parentNode = b:NERDTreeRoot.findNode(newPath.getParent()) let newTreeNode = g:NERDTreeFileNode.New(newPath) - if parentNode.isOpen || !empty(parentNode.children) + if empty(parentNode) + call b:NERDTreeRoot.refresh() + call nerdtree#renderView() + elseif parentNode.isOpen || !empty(parentNode.children) call parentNode.addChild(newTreeNode, 1) call NERDTreeRender() call newTreeNode.putCursorHere(1, 0) @@ -138,7 +142,7 @@ function! NERDTreeMoveNode() endif try - let bufnum = bufnr(curNode.path.str()) + let bufnum = bufnr("^".curNode.path.str()."$") call curNode.rename(newNodePath) call NERDTreeRender() @@ -186,7 +190,7 @@ function! NERDTreeDeleteNode() "if the node is open in a buffer, ask the user if they want to "close that buffer - let bufnum = bufnr(currentNode.path.str()) + let bufnum = bufnr("^".currentNode.path.str()."$") if buflisted(bufnum) let prompt = "\nNode deleted.\n\nThe file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)" call s:promptToDelBuffer(bufnum, prompt) @@ -224,7 +228,10 @@ function! NERDTreeCopyNode() if confirmed try let newNode = currentNode.copy(newNodePath) - if !empty(newNode) + if empty(newNode) + call b:NERDTreeRoot.refresh() + call nerdtree#renderView() + else call NERDTreeRender() call newNode.putCursorHere(0, 0) endif diff --git a/sources_non_forked/nerdtree/plugin/NERD_tree.vim b/sources_non_forked/nerdtree/plugin/NERD_tree.vim index 5bee03ad..cbfa884e 100644 --- a/sources_non_forked/nerdtree/plugin/NERD_tree.vim +++ b/sources_non_forked/nerdtree/plugin/NERD_tree.vim @@ -45,28 +45,30 @@ function! s:initVariable(var, value) endfunction "SECTION: Init variable calls and other random constants {{{2 -call s:initVariable("g:NERDChristmasTree", 1) call s:initVariable("g:NERDTreeAutoCenter", 1) call s:initVariable("g:NERDTreeAutoCenterThreshold", 3) call s:initVariable("g:NERDTreeCaseSensitiveSort", 0) +call s:initVariable("g:NERDTreeSortHiddenFirst", 1) call s:initVariable("g:NERDTreeChDirMode", 0) call s:initVariable("g:NERDTreeMinimalUI", 0) if !exists("g:NERDTreeIgnore") let g:NERDTreeIgnore = ['\~$'] endif call s:initVariable("g:NERDTreeBookmarksFile", expand('$HOME') . '/.NERDTreeBookmarks') +call s:initVariable("g:NERDTreeBookmarksSort", 1) call s:initVariable("g:NERDTreeHighlightCursorline", 1) call s:initVariable("g:NERDTreeHijackNetrw", 1) call s:initVariable("g:NERDTreeMouseMode", 1) call s:initVariable("g:NERDTreeNotificationThreshold", 100) call s:initVariable("g:NERDTreeQuitOnOpen", 0) +call s:initVariable("g:NERDTreeRespectWildIgnore", 0) call s:initVariable("g:NERDTreeShowBookmarks", 0) call s:initVariable("g:NERDTreeShowFiles", 1) call s:initVariable("g:NERDTreeShowHidden", 0) call s:initVariable("g:NERDTreeShowLineNumbers", 0) call s:initVariable("g:NERDTreeSortDirs", 1) call s:initVariable("g:NERDTreeDirArrows", !nerdtree#runningWindows()) -call s:initVariable("g:NERDTreeCasadeOpenSingleChildDir", 1) +call s:initVariable("g:NERDTreeCascadeOpenSingleChildDir", 1) if !exists("g:NERDTreeSortOrder") let g:NERDTreeSortOrder = ['\/$', '*', '\.swp$', '\.bak$', '\~$'] diff --git a/sources_non_forked/nerdtree/syntax/nerdtree.vim b/sources_non_forked/nerdtree/syntax/nerdtree.vim index 636d2af7..7cbba6ee 100644 --- a/sources_non_forked/nerdtree/syntax/nerdtree.vim +++ b/sources_non_forked/nerdtree/syntax/nerdtree.vim @@ -7,38 +7,54 @@ syn match NERDTreeFlag #\[RO\]# "highlighting for the .. (up dir) line at the top of the tree execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#" -"highlighting for the ~/+ symbols for the directory nodes -syn match NERDTreeClosable #\~\<# -syn match NERDTreeClosable #\~\.# -syn match NERDTreeOpenable #+\<# -syn match NERDTreeOpenable #+\.#he=e-1 - -"highlighting for the tree structural parts -syn match NERDTreePart #|# -syn match NERDTreePart #`# -syn match NERDTreePartFile #[|`]-#hs=s+1 contains=NERDTreePart - "quickhelp syntax elements -syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#hs=s+2,he=e-1 -syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#hs=s+2,he=e-1 -syn match NERDTreeHelpTitle #" .*\~#hs=s+2,he=e-1 contains=NERDTreeFlag -syn match NERDTreeToggleOn #".*(on)#hs=e-2,he=e-1 contains=NERDTreeHelpKey -syn match NERDTreeToggleOff #".*(off)#hs=e-3,he=e-1 contains=NERDTreeHelpKey +syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#ms=s+2,me=e-1 +syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#ms=s+2,me=e-1 +syn match NERDTreeHelpTitle #" .*\~#ms=s+2,me=e-1 +syn match NERDTreeToggleOn #(on)#ms=s+1,he=e-1 +syn match NERDTreeToggleOff #(off)#ms=e-3,me=e-1 syn match NERDTreeHelpCommand #" :.\{-}\>#hs=s+3 syn match NERDTreeHelp #^".*# contains=NERDTreeHelpKey,NERDTreeHelpTitle,NERDTreeFlag,NERDTreeToggleOff,NERDTreeToggleOn,NERDTreeHelpCommand -"highlighting for readonly files -syn match NERDTreeRO #.*\[RO\]#hs=s+2 contains=NERDTreeFlag,NERDTreeBookmark,NERDTreePart,NERDTreePartFile - "highlighting for sym links -syn match NERDTreeLink #[^-| `].* -> # contains=NERDTreeBookmark,NERDTreeOpenable,NERDTreeClosable,NERDTreeDirSlash +syn match NERDTreeLinkTarget #->.*# containedin=NERDTreeDir,NERDTreeFile +syn match NERDTreeLinkFile #.* ->#me=e-3 containedin=NERDTreeFile +syn match NERDTreeLinkDir #.*/ ->#me=e-3 containedin=NERDTreeDir "highlighing for directory nodes and file nodes -syn match NERDTreeDirSlash #/# -syn match NERDTreeDir #[^-| `].*/# contains=NERDTreeLink,NERDTreeDirSlash,NERDTreeOpenable,NERDTreeClosable -syn match NERDTreeExecFile #[|` ].*\*\($\| \)# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark -syn match NERDTreeFile #|-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile -syn match NERDTreeFile #`-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile +syn match NERDTreeDirSlash #/# containedin=NERDTreeDir + +if g:NERDTreeDirArrows + syn match NERDTreeClosable #▾# containedin=NERDTreeDir,NERDTreeFile + syn match NERDTreeOpenable #▸# containedin=NERDTreeDir,NERDTreeFile + + syn match NERDTreeDir #[^▾▸ ].*/# + syn match NERDTreeExecFile #^ .*\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark + syn match NERDTreeFile #^[^"\.▾▸] *[^▾▸]*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile + + "highlighting for readonly files + syn match NERDTreeRO # *\zs.*\ze \[RO\]# contains=NERDTreeFlag,NERDTreeBookmark,NERDTreeFile +else + "highlighting for the ~/+ symbols for the directory nodes + syn match NERDTreeClosable #\~\<# + syn match NERDTreeClosable #\~\.# + syn match NERDTreeOpenable #+\<# + syn match NERDTreeOpenable #+\.#he=e-1 + + "highlighting for the tree structural parts + syn match NERDTreePart #|# + syn match NERDTreePart #`# + syn match NERDTreePartFile #[|`]-#hs=s+1 contains=NERDTreePart + + syn match NERDTreeDir #[^-| `].*/# contains=NERDTreeLink,NERDTreeOpenable,NERDTreeClosable + syn match NERDTreeExecFile #[|` ].*\*\($\| \)# contains=NERDTreeLink,NERDTreePart,NERDTreePartFile,NERDTreeBookmark + syn match NERDTreeFile #|-.*# contains=NERDTreeLink,NERDTreePart,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile + syn match NERDTreeFile #`-.*# contains=NERDTreeLink,NERDTreePart,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile + + "highlighting for readonly files + syn match NERDTreeRO #|-.*\[RO\]#he=e-5 contains=NERDTreeFlag,NERDTreeBookmark,NERDTreePart,NERDTreePartFile +endif + syn match NERDTreeCWD #^[-\+Bookmarks-\+$# contains=NERDTreeBookmark syn match NERDTreeBookmarkName #^>.\{-} #he=e-1 contains=NERDTreeBookmarksLeader syn match NERDTreeBookmark #^>.*$# contains=NERDTreeBookmarksLeader,NERDTreeBookmarkName,NERDTreeBookmarksHeader -if exists("g:NERDChristmasTree") && g:NERDChristmasTree - hi def link NERDTreePart Special - hi def link NERDTreePartFile Type - hi def link NERDTreeFile Normal - hi def link NERDTreeExecFile Title - hi def link NERDTreeDirSlash Identifier - hi def link NERDTreeClosable Type -else - hi def link NERDTreePart Normal - hi def link NERDTreePartFile Normal - hi def link NERDTreeFile Normal - hi def link NERDTreeClosable Title -endif +hi def link NERDTreePart Special +hi def link NERDTreePartFile Type +hi def link NERDTreeExecFile Title +hi def link NERDTreeDirSlash Identifier hi def link NERDTreeBookmarksHeader statement hi def link NERDTreeBookmarksLeader ignore @@ -76,11 +83,16 @@ hi def link NERDTreeHelpTitle Macro hi def link NERDTreeToggleOn Question hi def link NERDTreeToggleOff WarningMsg +hi def link NERDTreeLinkTarget Type +hi def link NERDTreeLinkFile Macro +hi def link NERDTreeLinkDir Macro + hi def link NERDTreeDir Directory hi def link NERDTreeUp Directory +hi def link NERDTreeFile Normal hi def link NERDTreeCWD Statement -hi def link NERDTreeLink Macro hi def link NERDTreeOpenable Title +hi def link NERDTreeClosable Title hi def link NERDTreeFlag ignore hi def link NERDTreeRO WarningMsg hi def link NERDTreeBookmark Statement diff --git a/sources_non_forked/syntastic/CONTRIBUTING.md b/sources_non_forked/syntastic/CONTRIBUTING.md index 2eac8325..378b53b3 100644 --- a/sources_non_forked/syntastic/CONTRIBUTING.md +++ b/sources_non_forked/syntastic/CONTRIBUTING.md @@ -1,49 +1,105 @@ -# Bug reports / Github issues +# CONTRIBUTING +- - - +1\. [Bug reports / GitHub issues](#bugreps) +2\. [Submitting a patch](#patches) +3\. [General style notes](#generalstyle) +4\. [Syntax checker notes](#checkerstyle) +- - - -When reporting a bug make sure you search the existing github issues for the -same/similar issues. If you find one, feel free to add a `+1` comment with any -additional information that may help us solve the issue. + + +## 1. Bug reports / GitHub issues + +Please note that the preferred channel for posting bug reports is the +[issue tracker at GitHub][0]. Reports posted elsewhere are less likely +to be seen by the core team. + +When reporting a bug make sure you search the existing GitHub issues +for the same/similar issues. If you find one, feel free to add a `+1` +comment with any additional information that may help us solve the +issue. When creating a new issue be sure to state the following: -* Steps to reproduce the bug. -* The version of vim you are using. -* The version of syntastic you are using. +* steps to reproduce the bug; +* the version of Vim you are using (run `:ver` to find out); +* the version of syntastic you are using (see `:SyntasticInfo`). -For syntax checker bugs also state the version of the checker executable that you are using. +For syntax checker bugs also state the version of the checker executable +that you are using. Adding debugging information is typically useful +too: -# Submitting a patch +* open a file handled by your checker; +* set `g:syntastic_debug` to 1 or 3; +* run the checker; +* copy the output of `:mes`. -* Fork the repo on github -* Make a [topic branch](https://github.com/dchelimsky/rspec/wiki/Topic-Branches#using-topic-branches-when-contributing-patches) and start hacking -* Submit a pull request based off your topic branch + -Small focused patches are preferred. +## 2. Submitting a patch -Large changes to the code should be discussed with the core team first. Create an issue and explain your plan and see what we say. +Before you consider adding features to syntastic, _please_ spend a few +minutes (re-)reading the latest version of the [manual][1]. Syntastic +is changing rapidly at times, and it's quite possible that some of the +features you want to add exist already. -# General style notes +To submit a patch: -Following the coding conventions/styles used in the syntastic core: +* fork the [repo][2] on GitHub; +* make a [topic branch][3] and start hacking; +* submit a pull request based off your topic branch. -* Use 4 space indents. -* Don't use abbreviated keywords - e.g. use `endfunction`, not `endfun` (there's always room for more fun!). -* Don't use `l:` prefixes for variables unless actually required (i.e. almost never). -* Code for maintainability. We would rather a function be a couple of lines longer and have (for example) some [explaining variables](http://www.refactoring.com/catalog/extractVariable.html) to aid readability. +Small, focused patches are preferred. -# Syntax checker style notes +Large changes to the code should be discussed with the core team first. +Create an issue and explain your plan and see what we say. -The preferred style for error format strings is one "clause" per line. E.g. -(from the coffeelint checker): +Also make sure to update the manual whenever applicable. Nobody can use +features that aren't documented. -```viml -let errorformat = '%E%f:%l:%c: %trror: %m,' . - \ 'Syntax%trror: In %f\, %m on line %l,' . - \ '%EError: In %f\, Parse error on line %l: %m,' . - \ '%EError: In %f\, %m on line %l,' . - \ '%W%f(%l): lint warning: %m,' . - \ '%W%f(%l): warning: %m,' . - \ '%E%f(%l): SyntaxError: %m,' . - \ '%-Z%p^,' . - \ '%-G%.%#' + + +## 3. General style notes + +Follow the coding conventions/styles used in the syntastic core: + +* use 4 space indents; +* don't use abbreviated keywords - e.g. use `endfunction`, not `endfun` +(there's always room for more fun!); +* don't use `l:` prefixes for variables unless actually required (i.e. +almost never); +* code for maintainability; we would rather a function be a couple of +lines longer and have (for example) some [explaining variables][4] to +aid readability. + + + +## 4. Syntax checker notes + +Make sure to read the [guide][5] if you plan to add new syntax checkers. + +Use the existing checkers as templates, rather than writing everything +from scratch. + +The preferred style for error format strings is one "clause" per line. +E.g. (from the `coffee` checker): + +```vim +let errorformat = + \ '%E%f:%l:%c: %trror: %m,' . + \ 'Syntax%trror: In %f\, %m on line %l,' . + \ '%EError: In %f\, Parse error on line %l: %m,' . + \ '%EError: In %f\, %m on line %l,' . + \ '%W%f(%l): lint warning: %m,' . + \ '%W%f(%l): warning: %m,' . + \ '%E%f(%l): SyntaxError: %m,' . + \ '%-Z%p^,' . + \ '%-G%.%#' ``` + +[0]: https://github.com/scrooloose/syntastic/issues +[1]: https://github.com/scrooloose/syntastic/blob/master/doc/syntastic.txt +[2]: https://github.com/scrooloose/syntastic +[3]: https://github.com/dchelimsky/rspec/wiki/Topic-Branches#using-topic-branches-when-contributing-patches +[4]: http://www.refactoring.com/catalog/extractVariable.html +[5]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide diff --git a/sources_non_forked/syntastic/README.markdown b/sources_non_forked/syntastic/README.markdown index cdb6f559..950f7273 100644 --- a/sources_non_forked/syntastic/README.markdown +++ b/sources_non_forked/syntastic/README.markdown @@ -35,16 +35,16 @@ the user is notified and is happy because they didn't have to compile their code or execute their script to find them. At the time of this writing, syntax checking plugins exist for ActionScript, -Ada, AppleScript, AsciiDoc, ASM, BEMHTML, Bourne shell, C, C++, C#, Chef, -CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, -Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, +Ada, AppleScript, AsciiDoc, ASM, BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal, +Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, +Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X and iOS property -lists, Puppet, Python, Racket, R, reStructuredText, Ruby, Rust, SASS/SCSS, -Scala, Slim, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL, -xHtml, XML, XSLT, YACC, YAML, z80, Zope page templates, and zsh. See the -[wiki][3] for details about the corresponding supported checkers. +lists, Puppet, Python, Racket, R, reStructuredText, Ruby, SASS/SCSS, Scala, +Slim, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml, +XML, XSLT, YACC, YAML, z80, Zope page templates, and zsh. See the [wiki][3] +for details about the corresponding supported checkers. Below is a screenshot showing the methods that Syntastic uses to display syntax errors. Note that, in practise, you will only have a subset of these methods @@ -76,9 +76,8 @@ First I'll show you how to install Tim Pope's [pathogen][1] so that it's easy to install syntastic. Do this in your terminal so that you get the `pathogen.vim` file and the directories it needs: ```sh -mkdir -p ~/.vim/autoload ~/.vim/bundle; \ -curl -so ~/.vim/autoload/pathogen.vim \ - https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim +mkdir -p ~/.vim/autoload ~/.vim/bundle && \ +curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim ``` Next you *need* to add this to your `~/.vimrc`: ```vim @@ -92,7 +91,7 @@ execute pathogen#infect() You now have pathogen installed and can put syntastic into `~/.vim/bundle` like this: ```sh -cd ~/.vim/bundle +cd ~/.vim/bundle && \ git clone https://github.com/scrooloose/syntastic.git ``` Quit vim and start it back up to reload it, then type: @@ -143,6 +142,14 @@ still producing useful results, the checker is now disabled by default. To let g:syntastic_enable_perl_checker = 1 ``` + + +__Q. What happened to the `rustc` checker?__ + +A. It has been included in the [Rust compiler package][12]. If you have +a recent version of the Rust compiler, the checker should be picked up +automatically by syntastic. + __Q. I run a checker and the location list is not updated...__ @@ -272,8 +279,10 @@ cabbrev bd lclose\|bdelete ## 4\. Other resources The preferred place for posting suggestions, reporting bugs, and general -discussions related to syntastic is the [issue tracker at GitHub][4]. There -are also a [google group][5], and a [syntastic tag at StackOverflow][6]. +discussions related to syntastic is the [issue tracker at GitHub][4]. +A guide for writing syntax checkers can be found in the [wiki][11]. +There are also a dedicated [google group][5], and a +[syntastic tag at StackOverflow][6]. Syntastic aims to provide a common interface to syntax checkers for as many languages as possible. For particular languages, there are, of course, other @@ -291,3 +300,5 @@ a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9]. [8]: https://github.com/klen/python-mode [9]: http://valloric.github.io/YouCompleteMe/ [10]: http://perldoc.perl.org/perlrun.html#*-c* +[11]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide +[12]: https://github.com/rust-lang/rust/ diff --git a/sources_non_forked/syntastic/autoload/syntastic/c.vim b/sources_non_forked/syntastic/autoload/syntastic/c.vim index 4bd79472..22fb0ede 100644 --- a/sources_non_forked/syntastic/autoload/syntastic/c.vim +++ b/sources_non_forked/syntastic/autoload/syntastic/c.vim @@ -180,7 +180,7 @@ endfunction " }}}2 function! s:getIncludeDirs(filetype) " {{{2 let include_dirs = [] - if a:filetype =~# '\v^%(c|cpp|d|objc|objcpp)$' && + if a:filetype =~# '\v^%(c|cpp|objc|objcpp)$' && \ (!exists('g:syntastic_'.a:filetype.'_no_default_include_dirs') || \ !g:syntastic_{a:filetype}_no_default_include_dirs) let include_dirs = copy(s:default_includes) diff --git a/sources_non_forked/syntastic/autoload/syntastic/log.vim b/sources_non_forked/syntastic/autoload/syntastic/log.vim index 05a3d24e..e227f53e 100644 --- a/sources_non_forked/syntastic/autoload/syntastic/log.vim +++ b/sources_non_forked/syntastic/autoload/syntastic/log.vim @@ -6,7 +6,7 @@ let g:loaded_syntastic_log_autoload = 1 let s:save_cpo = &cpo set cpo&vim -let s:deprecation_notices_issued = [] +let s:one_time_notices_issued = [] " Public functions {{{1 @@ -27,15 +27,39 @@ function! syntastic#log#error(msg) " {{{2 echohl None endfunction " }}}2 -function! syntastic#log#deprecationWarn(msg) " {{{2 - if index(s:deprecation_notices_issued, a:msg) >= 0 +function! syntastic#log#oneTimeWarn(msg) " {{{2 + if index(s:one_time_notices_issued, a:msg) >= 0 return endif - call add(s:deprecation_notices_issued, a:msg) + call add(s:one_time_notices_issued, a:msg) call syntastic#log#warn(a:msg) endfunction " }}}2 +" @vimlint(EVL102, 1, l:OLD_VAR) +function! syntastic#log#deprecationWarn(old, new, ...) " {{{2 + if exists('g:syntastic_' . a:old) && !exists('g:syntastic_' . a:new) + let msg = 'variable g:syntastic_' . a:old . ' is deprecated, please use ' + + if a:0 + let OLD_VAR = g:syntastic_{a:old} + try + let NEW_VAR = eval(a:1) + let msg .= 'in its stead: let g:syntastic_' . a:new . ' = ' . string(NEW_VAR) + let g:syntastic_{a:new} = NEW_VAR + catch + let msg .= 'g:syntastic_' . a:new . ' instead' + endtry + else + let msg .= 'g:syntastic_' . a:new . ' instead' + let g:syntastic_{a:new} = g:syntastic_{a:old} + endif + + call syntastic#log#oneTimeWarn(msg) + endif +endfunction " }}}2 +" @vimlint(EVL102, 0, l:OLD_VAR) + function! syntastic#log#debug(level, msg, ...) " {{{2 if !s:isDebugEnabled(a:level) return @@ -113,6 +137,7 @@ function! s:isDebugEnabled_dumb(level) " {{{2 endfunction " }}}2 let s:isDebugEnabled = function(exists('*and') ? 's:isDebugEnabled_smart' : 's:isDebugEnabled_dumb') +lockvar s:isDebugEnabled function! s:logRedirect(on) " {{{2 if exists("g:syntastic_debug_file") @@ -138,6 +163,7 @@ function! s:logTimestamp_dumb() " {{{2 endfunction " }}}2 let s:logTimestamp = function(has('reltime') ? 's:logTimestamp_smart' : 's:logTimestamp_dumb') +lockvar s:logTimestamp function! s:formatVariable(name) " {{{2 let vals = [] diff --git a/sources_non_forked/syntastic/autoload/syntastic/postprocess.vim b/sources_non_forked/syntastic/autoload/syntastic/postprocess.vim index 377e64a7..65570d98 100644 --- a/sources_non_forked/syntastic/autoload/syntastic/postprocess.vim +++ b/sources_non_forked/syntastic/autoload/syntastic/postprocess.vim @@ -14,6 +14,8 @@ function! syntastic#postprocess#compressWhitespace(errors) " {{{2 let e['text'] = substitute(e['text'], "\001", '', 'g') let e['text'] = substitute(e['text'], '\n', ' ', 'g') let e['text'] = substitute(e['text'], '\m\s\{2,}', ' ', 'g') + let e['text'] = substitute(e['text'], '\m^\s\+', '', '') + let e['text'] = substitute(e['text'], '\m\s\+$', '', '') endfor return a:errors diff --git a/sources_non_forked/syntastic/autoload/syntastic/preprocess.vim b/sources_non_forked/syntastic/autoload/syntastic/preprocess.vim index 4501e3ff..56998d26 100644 --- a/sources_non_forked/syntastic/autoload/syntastic/preprocess.vim +++ b/sources_non_forked/syntastic/autoload/syntastic/preprocess.vim @@ -8,6 +8,26 @@ set cpo&vim " Public functions {{{1 +function! syntastic#preprocess#cabal(errors) " {{{2 + let out = [] + let star = 0 + for err in a:errors + if star + if err == '' + let star = 0 + else + let out[-1] .= ' ' . err + endif + else + call add(out, err) + if err =~ '\m^*\s' + let star = 1 + endif + endif + endfor + return out +endfunction " }}}2 + function! syntastic#preprocess#checkstyle(errors) " {{{2 let out = [] let fname = expand('%') @@ -95,6 +115,10 @@ function! syntastic#preprocess#rparse(errors) " {{{2 return out endfunction " }}}2 +function! syntastic#preprocess#tslint(errors) " {{{2 + return map(copy(a:errors), 'substitute(v:val, ''\m^\(([^)]\+)\)\s\(.\+\)$'', ''\2 \1'', "")') +endfunction " }}}2 + function! syntastic#preprocess#validator(errors) " {{{2 let out = [] for e in a:errors diff --git a/sources_non_forked/syntastic/autoload/syntastic/util.vim b/sources_non_forked/syntastic/autoload/syntastic/util.vim index d4fa034b..b4b900b1 100644 --- a/sources_non_forked/syntastic/autoload/syntastic/util.vim +++ b/sources_non_forked/syntastic/autoload/syntastic/util.vim @@ -88,6 +88,7 @@ endfunction " }}}2 " strwidth() was added in Vim 7.3; if it doesn't exist, we use strlen() " and hope for the best :) let s:width = function(exists('*strwidth') ? 'strwidth' : 'strlen') +lockvar s:width "print as much of a:msg as possible without "Press Enter" prompt appearing function! syntastic#util#wideMsg(msg) " {{{2 diff --git a/sources_non_forked/syntastic/doc/syntastic.txt b/sources_non_forked/syntastic/doc/syntastic.txt index fd0fb2b9..bb222094 100644 --- a/sources_non_forked/syntastic/doc/syntastic.txt +++ b/sources_non_forked/syntastic/doc/syntastic.txt @@ -38,9 +38,10 @@ CONTENTS *syntastic-contents* 6.1.Handling of composite filetypes........|syntastic-composite| 6.2.Interaction with python-mode...........|syntastic-pymode| 6.3.Interaction with the fish shell........|syntastic-fish| - 6.4.Using syntastic with the fizsh shell...|syntastic-fizsh| - 6.5.Interaction with Eclim.................|syntastic-eclim| - 6.6.Interaction with vim-virtualenv........|syntastic-vim-virtualenv| + 6.4.Interaction with PowerShell............|syntastic-powershell| + 6.5.Using syntastic with the fizsh shell...|syntastic-fizsh| + 6.6.Interaction with Eclim.................|syntastic-eclim| + 6.7.Interaction with vim-virtualenv........|syntastic-vim-virtualenv| 7.About........................................|syntastic-about| 8.License......................................|syntastic-license| @@ -83,7 +84,7 @@ see |syntastic-checker-options| for details. You can also change the arguments passed to a specific checker as well. Use |:SyntasticCheck| to manually check right now. Use |:SyntasticToggleMode| -to switch between active (checking on writting the buffer) and passive (manual) +to switch between active (checking on writing the buffer) and passive (manual) checking. ============================================================================== @@ -93,7 +94,7 @@ Syntax checking can be done automatically or on demand (see |'syntastic_mode_map'| and |:SyntasticToggleMode| for configuring this). When syntax checking is done, the features below can be used to notify the -user of errors. See |syntastic-options| for how to configure and +user of errors. See |syntastic-global-options| for how to configure and activate/deactivate these features. * A statusline flag @@ -169,6 +170,8 @@ and the SpellCap group is used for warnings. If you wish to customize the colors for highlighting you can use the following groups: SyntasticError - Links to 'SpellBad' by default SyntasticWarning - Links to 'SpellCap' by default + SyntasticStyleError - Links to SyntasticError by default + SyntasticStyleWarning - Links to SyntasticWarning by default Example: > highlight SyntasticError guibg=#2f0000 @@ -288,10 +291,12 @@ to label error messages with the names of the checkers that created them. > < *'syntastic_sort_aggregated_errors'* Default: 1 -By default, when |syntastic_aggregate_errors| is enabled, errors are grouped -by file, then sorted by line number, then grouped by type (namely, errors take -precedence over warnings), then they are sorted by column number. If you want -to leave messages grouped by checker output, set this variable to 0. > +By default, when results from multiple checkers are aggregated in a single +error list (that is either when |syntastic_aggregate_errors| is enabled, or +when checking a file with a composite filetype), errors are grouped by file, +then sorted by line number, then grouped by type (namely errors take precedence +over warnings), then they are sorted by column number. If you want to leave +messages grouped by checker output, set this variable to 0. > let g:syntastic_sort_aggregated_errors = 0 < *'syntastic_echo_current_error'* @@ -593,7 +598,7 @@ Checkers that use 'makeprgBuild()' construct a 'makeprg' like this: > \ 'tail': '> /tmp/output' }) < The result is a 'makeprg' of the form: > - + < *'syntastic___exe'* All arguments above are optional, and can be overridden by setting global @@ -666,7 +671,16 @@ traditional shell, such as 'zsh', 'bash', 'ksh', or even the original Bourne set shell=bash < ------------------------------------------------------------------------------ -6.4. Using syntastic with the fizsh shell *syntastic-fizsh* +6.4. Interaction with PowerShell *syntastic-powershell* + +At the time of this writing, syntastic is not compatible with using 'Windows +PowerShell' (http://technet.microsoft.com/en-us/library/bb978526.aspx) as Vim's +'shell'. You may still run Vim from 'PowerShell', but you do have to point +Vim's 'shell' to a more traditional program, such as 'cmd.exe': > + set shell=cmd.exe +< +------------------------------------------------------------------------------ +6.5. Using syntastic with the fizsh shell *syntastic-fizsh* Using syntastic with the 'fizsh' shell (see https://github.com/zsh-users/fizsh) is possible, but potentially problematic. In order to do it you'll need to set @@ -679,7 +693,7 @@ interactive features of 'fizsh'. Using a more traditional shell such as 'zsh', set shell=zsh < ------------------------------------------------------------------------------ -6.5. Interaction with Eclim *syntastic-eclim* +6.6. Interaction with Eclim *syntastic-eclim* As far as syntastic is concerned there shouldn't be any compatibility problems with the 'Eclim' Vim plugin (see http://eclim.org/). However, at the time of @@ -688,7 +702,7 @@ makes syntastic forget some of its configuration parameters. No solutions or workarounds are known for now. ------------------------------------------------------------------------------ -6.6. Interaction with vim-virtualenv *syntastic-vim-virtualenv* +6.7. Interaction with vim-virtualenv *syntastic-vim-virtualenv* At the time of this writing, syntastic can't run checkers installed in Python virtual environments activated by 'vim-virtualenv' (see diff --git a/sources_non_forked/syntastic/plugin/syntastic.vim b/sources_non_forked/syntastic/plugin/syntastic.vim index 39b22805..f3724d9f 100644 --- a/sources_non_forked/syntastic/plugin/syntastic.vim +++ b/sources_non_forked/syntastic/plugin/syntastic.vim @@ -16,9 +16,11 @@ let g:loaded_syntastic_plugin = 1 if has('reltime') let g:syntastic_start = reltime() + lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-34' +let g:syntastic_version = '3.4.0-90' +lockvar g:syntastic_version " Sanity checks {{{1 @@ -30,6 +32,8 @@ for s:feature in ['autocmd', 'eval', 'modify_fname', 'quickfix', 'user_commands' endfor let s:running_windows = syntastic#util#isRunningWindows() +lockvar s:running_windows + if !s:running_windows && executable('uname') try let s:uname = system('uname') @@ -37,6 +41,7 @@ if !s:running_windows && executable('uname') call syntastic#log#error("your shell " . &shell . " doesn't use traditional UNIX syntax for redirections") finish endtry + lockvar s:uname endif " }}}1 @@ -70,6 +75,7 @@ let g:syntastic_defaults = { \ 'style_warning_symbol': 'S>', \ 'warning_symbol': '>>' \ } +lockvar! g:syntastic_defaults for s:key in keys(g:syntastic_defaults) if !exists('g:syntastic_' . s:key) @@ -78,7 +84,7 @@ for s:key in keys(g:syntastic_defaults) endfor if exists("g:syntastic_quiet_warnings") - call syntastic#log#deprecationWarn("variable g:syntastic_quiet_warnings is deprecated, please use let g:syntastic_quiet_messages = {'level': 'warnings'} instead") + call syntastic#log#oneTimeWarn("variable g:syntastic_quiet_warnings is deprecated, please use let g:syntastic_quiet_messages = {'level': 'warnings'} instead") if g:syntastic_quiet_warnings let s:quiet_warnings = get(g:syntastic_quiet_messages, 'type', []) if type(s:quiet_warnings) != type([]) @@ -106,13 +112,19 @@ let s:debug_dump_options = [ if v:version > 703 || (v:version == 703 && has('patch446')) call add(s:debug_dump_options, 'shellxescape') endif +lockvar! s:debug_dump_options " debug constants -let g:SyntasticDebugTrace = 1 -let g:SyntasticDebugLoclist = 2 -let g:SyntasticDebugNotifications = 4 -let g:SyntasticDebugAutocommands = 8 -let g:SyntasticDebugVariables = 16 +let g:SyntasticDebugTrace = 1 +lockvar g:SyntasticDebugTrace +let g:SyntasticDebugLoclist = 2 +lockvar g:SyntasticDebugLoclist +let g:SyntasticDebugNotifications = 4 +lockvar g:SyntasticDebugNotifications +let g:SyntasticDebugAutocommands = 8 +lockvar g:SyntasticDebugAutocommands +let g:SyntasticDebugVariables = 16 +lockvar g:SyntasticDebugVariables " }}}1 @@ -130,7 +142,7 @@ let s:modemap = g:SyntasticModeMap.Instance() function! s:CompleteCheckerName(argLead, cmdLine, cursorPos) " {{{2 let checker_names = [] for ft in s:resolveFiletypes() - call extend(checker_names, keys(s:registry.getCheckersMap(ft))) + call extend(checker_names, s:registry.getNamesOfAvailableCheckers(ft)) endfor return join(checker_names, "\n") endfunction " }}}2 @@ -169,11 +181,6 @@ command! SyntasticSetLoclist call g:SyntasticLoclist.current().setloclist() augroup syntastic autocmd BufReadPost * call s:BufReadPostHook() autocmd BufWritePost * call s:BufWritePostHook() - - autocmd BufWinEnter * call s:BufWinEnterHook() - - " TODO: the next autocmd should be "autocmd BufWinLeave * if &buftype == '' | lclose | endif" - " but in recent versions of Vim lclose can no longer be called from BufWinLeave autocmd BufEnter * call s:BufEnterHook() augroup END @@ -198,24 +205,22 @@ function! s:BufWritePostHook() " {{{2 call s:UpdateErrors(1) endfunction " }}}2 -function! s:BufWinEnterHook() " {{{2 - call syntastic#log#debug(g:SyntasticDebugAutocommands, - \ 'autocmd: BufWinEnter, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))) . - \ ', &buftype = ' . string(&buftype)) - if &buftype == '' - call s:notifiers.refresh(g:SyntasticLoclist.current()) - endif -endfunction " }}}2 - function! s:BufEnterHook() " {{{2 call syntastic#log#debug(g:SyntasticDebugAutocommands, \ 'autocmd: BufEnter, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))) . \ ', &buftype = ' . string(&buftype)) - " TODO: at this point there is no b:syntastic_loclist - let loclist = filter(getloclist(0), 'v:val["valid"] == 1') - let buffers = syntastic#util#unique(map( loclist, 'v:val["bufnr"]' )) - if &buftype == 'quickfix' && !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' )) - call g:SyntasticLoclistHide() + if &buftype == '' + call s:notifiers.refresh(g:SyntasticLoclist.current()) + elseif &buftype == 'quickfix' + " TODO: this is needed because in recent versions of Vim lclose + " can no longer be called from BufWinLeave + " TODO: at this point there is no b:syntastic_loclist + let loclist = filter(copy(getloclist(0)), 'v:val["valid"] == 1') + let owner = str2nr(getbufvar(bufnr(""), 'syntastic_owner_buffer')) + let buffers = syntastic#util#unique(map(loclist, 'v:val["bufnr"]') + (owner ? [owner] : [])) + if !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' )) + call SyntasticLoclistHide() + endif endif endfunction " }}}2 @@ -223,7 +228,7 @@ function! s:QuitPreHook() " {{{2 call syntastic#log#debug(g:SyntasticDebugAutocommands, \ 'autocmd: QuitPre, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr(""))))) let b:syntastic_skip_checks = !g:syntastic_check_on_wq - call g:SyntasticLoclistHide() + call SyntasticLoclistHide() endfunction " }}}2 " }}}1 @@ -278,7 +283,7 @@ endfunction " }}}2 "clear the loc list for the buffer function! s:ClearCache() " {{{2 call s:notifiers.reset(g:SyntasticLoclist.current()) - unlet! b:syntastic_loclist + call b:syntastic_loclist.destroy() endfunction " }}}2 "detect and cache all syntax errors in this buffer @@ -296,8 +301,8 @@ function! s:CacheErrors(checker_names) " {{{2 " }}}3 let filetypes = s:resolveFiletypes() - let aggregate_errors = syntastic#util#var('aggregate_errors') - let decorate_errors = (aggregate_errors || len(filetypes) > 1) && syntastic#util#var('id_checkers') + let aggregate_errors = syntastic#util#var('aggregate_errors') || len(filetypes) > 1 + let decorate_errors = aggregate_errors && syntastic#util#var('id_checkers') let sort_aggregated_errors = aggregate_errors && syntastic#util#var('sort_aggregated_errors') let clist = [] @@ -306,8 +311,15 @@ function! s:CacheErrors(checker_names) " {{{2 endfor let names = [] + let unavailable_checkers = 0 for checker in clist let cname = checker.getFiletype() . '/' . checker.getName() + if !checker.isAvailable() + call syntastic#log#debug(g:SyntasticDebugTrace, 'CacheErrors: Checker ' . cname . ' is not available') + let unavailable_checkers += 1 + continue + endif + call syntastic#log#debug(g:SyntasticDebugTrace, 'CacheErrors: Invoking checker: ' . cname) let loclist = checker.getLocList() @@ -317,6 +329,10 @@ function! s:CacheErrors(checker_names) " {{{2 call loclist.decorate(cname) endif call add(names, cname) + if checker.getWantSort() && !sort_aggregated_errors + call loclist.sort() + call syntastic#log#debug(g:SyntasticDebugLoclist, 'sorted:', loclist) + endif let newLoclist = newLoclist.extend(loclist) @@ -340,7 +356,7 @@ function! s:CacheErrors(checker_names) " {{{2 " }}}3 " issue warning about no active checkers {{{3 - if empty(clist) + if len(clist) == unavailable_checkers if !empty(a:checker_names) if len(a:checker_names) == 1 call syntastic#log#warn('checker ' . a:checker_names[0] . ' is not available') @@ -360,7 +376,8 @@ function! s:CacheErrors(checker_names) " {{{2 endif endif - let b:syntastic_loclist = newLoclist + call newLoclist.setOwner(bufnr('')) + call newLoclist.deploy() endfunction " }}}2 function! s:ToggleMode() " {{{2 @@ -550,6 +567,7 @@ endfunction " }}}2 function! s:uname() " {{{2 if !exists('s:uname') let s:uname = system('uname') + lockvar s:uname endif return s:uname endfunction " }}}2 diff --git a/sources_non_forked/syntastic/plugin/syntastic/checker.vim b/sources_non_forked/syntastic/plugin/syntastic/checker.vim index e93291ba..273f0521 100644 --- a/sources_non_forked/syntastic/plugin/syntastic/checker.vim +++ b/sources_non_forked/syntastic/plugin/syntastic/checker.vim @@ -69,7 +69,6 @@ function! g:SyntasticChecker.getLocListRaw() " {{{2 call self._populateHighlightRegexes(list) call syntastic#log#debug(g:SyntasticDebugLoclist, name . ' raw:', list) call self._quietMessages(list) - call self._sortMessages(list) return list endfunction " }}}2 @@ -99,7 +98,10 @@ function! g:SyntasticChecker.makeprgBuild(opts) " {{{2 endfunction " }}}2 function! g:SyntasticChecker.isAvailable() " {{{2 - return self._isAvailableFunc() + if !has_key(self, '_available') + let self._available = self._isAvailableFunc() + endif + return self._available endfunction " }}}2 " }}}1 @@ -131,20 +133,12 @@ function! g:SyntasticChecker._quietMessages(errors) " {{{2 endif endfunction " }}}2 -function! g:SyntasticChecker._sortMessages(errors) " {{{2 - " don't sort now if we're going to sort the aggregated list later - if self._sort && !(syntastic#util#var('aggregate_errors') && syntastic#util#var('sort_aggregated_errors')) - call syntastic#util#sortLoclist(a:errors) - call syntastic#log#debug(g:SyntasticDebugLoclist, 'sorted:', a:errors) - endif -endfunction " }}}2 - function! g:SyntasticChecker._populateHighlightRegexes(errors) " {{{2 if has_key(self, '_highlightRegexFunc') for e in a:errors if e['valid'] let term = self._highlightRegexFunc(e) - if len(term) > 0 + if term != '' let e['hl'] = term endif endif diff --git a/sources_non_forked/syntastic/plugin/syntastic/cursor.vim b/sources_non_forked/syntastic/plugin/syntastic/cursor.vim index 71492543..ab66fd01 100644 --- a/sources_non_forked/syntastic/plugin/syntastic/cursor.vim +++ b/sources_non_forked/syntastic/plugin/syntastic/cursor.vim @@ -22,7 +22,7 @@ function! g:SyntasticCursorNotifier.refresh(loclist) " {{{2 let b:syntastic_messages = copy(a:loclist.messages(bufnr(''))) let b:oldLine = -1 autocmd! syntastic CursorMoved - autocmd syntastic CursorMoved * call g:SyntasticRefreshCursor() + autocmd syntastic CursorMoved * call SyntasticRefreshCursor() endif endfunction " }}}2 @@ -40,7 +40,7 @@ endfunction " }}}2 " Private methods {{{1 " The following defensive nonsense is needed because of the nature of autocmd -function! g:SyntasticRefreshCursor() " {{{2 +function! SyntasticRefreshCursor() " {{{2 if !exists('b:syntastic_messages') || empty(b:syntastic_messages) " file not checked return diff --git a/sources_non_forked/syntastic/plugin/syntastic/highlighting.vim b/sources_non_forked/syntastic/plugin/syntastic/highlighting.vim index 997b2e32..e3451d82 100644 --- a/sources_non_forked/syntastic/plugin/syntastic/highlighting.vim +++ b/sources_non_forked/syntastic/plugin/syntastic/highlighting.vim @@ -5,6 +5,7 @@ let g:loaded_syntastic_notifier_highlighting = 1 " Highlighting requires getmatches introduced in 7.1.040 let s:has_highlighting = v:version > 701 || (v:version == 701 && has('patch040')) +lockvar s:has_highlighting let g:SyntasticHighlightingNotifier = {} @@ -18,6 +19,7 @@ function! g:SyntasticHighlightingNotifier.New() " {{{2 if !s:setup_done call self._setup() let s:setup_done = 1 + lockvar s:setup_done endif return newObj @@ -35,7 +37,7 @@ function! g:SyntasticHighlightingNotifier.refresh(loclist) " {{{2 let buf = bufnr('') let issues = filter(a:loclist.copyRaw(), 'v:val["bufnr"] == buf') for item in issues - let group = item['type'] ==? 'E' ? 'SyntasticError' : 'SyntasticWarning' + let group = 'Syntastic' . get(item, 'subtype', '') . ( item['type'] ==? 'E' ? 'Error' : 'Warning' ) " The function `Syntastic_{filetype}_{checker}_GetHighlightRegex` is " used to override default highlighting. @@ -80,11 +82,16 @@ function! g:SyntasticHighlightingNotifier._setup() " {{{2 if s:has_highlighting if !hlexists('SyntasticError') highlight link SyntasticError SpellBad - endif if !hlexists('SyntasticWarning') highlight link SyntasticWarning SpellCap endif + if !hlexists('SyntasticStyleError') + highlight link SyntasticStyleError SyntasticError + endif + if !hlexists('SyntasticStyleWarning') + highlight link SyntasticStyleWarning SyntasticWarning + endif endif endfunction " }}}2 diff --git a/sources_non_forked/syntastic/plugin/syntastic/loclist.vim b/sources_non_forked/syntastic/plugin/syntastic/loclist.vim index 074c4fc6..b4471dad 100644 --- a/sources_non_forked/syntastic/plugin/syntastic/loclist.vim +++ b/sources_non_forked/syntastic/plugin/syntastic/loclist.vim @@ -20,12 +20,13 @@ function! g:SyntasticLoclist.New(rawLoclist) " {{{2 let newObj._rawLoclist = llist let newObj._name = '' + let newObj._owner = bufnr('') return newObj endfunction " }}}2 function! g:SyntasticLoclist.current() " {{{2 - if !exists("b:syntastic_loclist") + if !exists("b:syntastic_loclist") || empty(b:syntastic_loclist) let b:syntastic_loclist = g:SyntasticLoclist.New([]) endif return b:syntastic_loclist @@ -53,6 +54,10 @@ function! g:SyntasticLoclist.getRaw() " {{{2 return self._rawLoclist endfunction " }}}2 +function! g:SyntasticLoclist.getBuffers() " {{{2 + return syntastic#util#unique(map(copy(self._rawLoclist), 'str2nr(v:val["bufnr"])') + [self._owner]) +endfunction " }}}2 + function! g:SyntasticLoclist.getStatuslineFlag() " {{{2 if !exists("self._stl_format") let self._stl_format = '' @@ -118,6 +123,26 @@ function! g:SyntasticLoclist.setName(name) " {{{2 let self._name = a:name endfunction " }}}2 +function! g:SyntasticLoclist.getOwner() " {{{2 + return self._owner +endfunction " }}}2 + +function! g:SyntasticLoclist.setOwner(buffer) " {{{2 + let self._owner = type(a:buffer) == type(0) ? a:buffer : str2nr(a:buffer) +endfunction " }}}2 + +function! g:SyntasticLoclist.deploy() " {{{2 + for buf in self.getBuffers() + call setbufvar(buf, 'syntastic_loclist', self) + endfor +endfunction " }}}2 + +function! g:SyntasticLoclist.destroy() " {{{2 + for buf in self.getBuffers() + call setbufvar(buf, 'syntastic_loclist', {}) + endfor +endfunction " }}}2 + function! g:SyntasticLoclist.decorate(tag) " {{{2 for e in self._rawLoclist let e['text'] .= ' [' . a:tag . ']' @@ -216,6 +241,7 @@ function! g:SyntasticLoclist.show() " {{{2 if strpart(title, 0, 16) ==# ':SyntasticCheck ' || \ ( (title == '' || title ==# ':setloclist()') && errors == getloclist(0) ) call setwinvar(win, 'quickfix_title', ':SyntasticCheck ' . self._name) + call setbufvar(buf, 'syntastic_owner_buffer', self._owner) endif endif endfor @@ -226,7 +252,7 @@ endfunction " }}}2 " Non-method functions {{{1 -function! g:SyntasticLoclistHide() " {{{2 +function! SyntasticLoclistHide() " {{{2 call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: hide') silent! lclose endfunction " }}}2 diff --git a/sources_non_forked/syntastic/plugin/syntastic/notifiers.vim b/sources_non_forked/syntastic/plugin/syntastic/notifiers.vim index c268c19b..62821cde 100644 --- a/sources_non_forked/syntastic/plugin/syntastic/notifiers.vim +++ b/sources_non_forked/syntastic/plugin/syntastic/notifiers.vim @@ -6,6 +6,7 @@ let g:loaded_syntastic_notifiers = 1 let g:SyntasticNotifiers = {} let s:notifier_types = ['signs', 'balloons', 'highlighting', 'cursor', 'autoloclist'] +lockvar! s:notifier_types " Public methods {{{1 diff --git a/sources_non_forked/syntastic/plugin/syntastic/registry.vim b/sources_non_forked/syntastic/plugin/syntastic/registry.vim index 72ba93ad..3ab771e1 100644 --- a/sources_non_forked/syntastic/plugin/syntastic/registry.vim +++ b/sources_non_forked/syntastic/plugin/syntastic/registry.vim @@ -11,8 +11,10 @@ let s:defaultCheckers = { \ 'applescript': ['osacompile'], \ 'asciidoc': ['asciidoc'], \ 'asm': ['gcc'], + \ 'bro': ['bro'], \ 'bemhtml': ['bemhtmllint'], \ 'c': ['gcc'], + \ 'cabal': ['cabal'], \ 'chef': ['foodcritic'], \ 'co': ['coco'], \ 'cobol': ['cobc'], @@ -64,7 +66,6 @@ let s:defaultCheckers = { \ 'racket': ['racket'], \ 'rst': ['rst2pseudoxml'], \ 'ruby': ['mri'], - \ 'rust': ['rustc'], \ 'sass': ['sass'], \ 'scala': ['fsc', 'scalac'], \ 'scss': ['sass', 'scss_lint'], @@ -89,12 +90,14 @@ let s:defaultCheckers = { \ 'zpt': ['zptlint'], \ 'zsh': ['zsh', 'shellcheck'] \ } +lockvar! s:defaultCheckers let s:defaultFiletypeMap = { \ 'gentoo-metadata': 'xml', \ 'lhaskell': 'haskell', \ 'litcoffee': 'coffee' \ } +lockvar! s:defaultFiletypeMap let g:SyntasticRegistry = {} @@ -102,14 +105,13 @@ let g:SyntasticRegistry = {} " Public methods {{{1 -" TODO: Handling of filetype aliases: all public methods take aliases as +" Note: Handling of filetype aliases: all public methods take aliases as " parameters, all private methods take normalized filetypes. Public methods " are thus supposed to normalize filetypes before calling private methods. function! g:SyntasticRegistry.Instance() " {{{2 if !exists('s:SyntasticRegistryInstance') let s:SyntasticRegistryInstance = copy(self) - let s:SyntasticRegistryInstance._checkerRaw = {} let s:SyntasticRegistryInstance._checkerMap = {} endif @@ -122,29 +124,23 @@ function! g:SyntasticRegistry.CreateAndRegisterChecker(args) " {{{2 call registry._registerChecker(checker) endfunction " }}}2 -function! g:SyntasticRegistry.isCheckable(ftalias) " {{{2 +" Given a list of checker names hints_list, return a map name --> checker. +" If hints_list is empty, user settings are are used instead. Checkers are +" not checked for availability (that is, the corresponding IsAvailable() are +" not run). +function! g:SyntasticRegistry.getCheckers(ftalias, hints_list) " {{{2 let ft = s:normaliseFiletype(a:ftalias) - call self._loadCheckers(ft) - return !empty(self._checkerMap[ft]) -endfunction " }}}2 + call self._loadCheckersFor(ft) -function! g:SyntasticRegistry.getCheckersMap(ftalias) " {{{2 - let ft = s:normaliseFiletype(a:ftalias) - call self._loadCheckers(ft) - return self._checkerMap[ft] -endfunction " }}}2 - -function! g:SyntasticRegistry.getCheckers(ftalias, list) " {{{2 - let checkers_map = self.getCheckersMap(a:ftalias) + let checkers_map = self._checkerMap[ft] if empty(checkers_map) return [] endif - let ft = s:normaliseFiletype(a:ftalias) call self._checkDeprecation(ft) let names = - \ !empty(a:list) ? a:list : + \ !empty(a:hints_list) ? syntastic#util#unique(a:hints_list) : \ exists('b:syntastic_checkers') ? b:syntastic_checkers : \ exists('g:syntastic_' . ft . '_checkers') ? g:syntastic_{ft}_checkers : \ get(s:defaultCheckers, ft, 0) @@ -153,6 +149,12 @@ function! g:SyntasticRegistry.getCheckers(ftalias, list) " {{{2 \ self._filterCheckersByName(checkers_map, names) : [checkers_map[keys(checkers_map)[0]]] endfunction " }}}2 +" Same as getCheckers(), but keep only the checkers available. This runs the +" corresponding IsAvailable() functions for all checkers. +function! g:SyntasticRegistry.getCheckersAvailable(ftalias, hints_list) " {{{2 + return filter(self.getCheckers(a:ftalias, a:hints_list), 'v:val.isAvailable()') +endfunction " }}}2 + function! g:SyntasticRegistry.getKnownFiletypes() " {{{2 let types = keys(s:defaultCheckers) @@ -169,8 +171,15 @@ function! g:SyntasticRegistry.getKnownFiletypes() " {{{2 return syntastic#util#unique(types) endfunction " }}}2 +function! g:SyntasticRegistry.getNamesOfAvailableCheckers(ftalias) " {{{2 + let ft = s:normaliseFiletype(a:ftalias) + call self._loadCheckersFor(ft) + return keys(filter( copy(self._checkerMap[ft]), 'v:val.isAvailable()' )) +endfunction " }}}2 + function! g:SyntasticRegistry.echoInfoFor(ftalias_list) " {{{2 - echomsg "Syntastic info for filetype: " . join(a:ftalias_list, '.') + echomsg "Syntastic version: " . g:syntastic_version + echomsg "Info for filetype: " . join(a:ftalias_list, '.') let ft_list = syntastic#util#unique(map( copy(a:ftalias_list), 's:normaliseFiletype(v:val)' )) if len(ft_list) != 1 @@ -178,13 +187,13 @@ function! g:SyntasticRegistry.echoInfoFor(ftalias_list) " {{{2 let active = [] for ft in ft_list - call extend(available, map( keys(self.getCheckersMap(ft)), 'ft . "/" . v:val' )) - call extend(active, map( self.getCheckers(ft, []), 'ft . "/" . v:val.getName()' )) + call extend(available, map( self.getNamesOfAvailableCheckers(ft), 'ft . "/" . v:val' )) + call extend(active, map( self.getCheckersAvailable(ft, []), 'ft . "/" . v:val.getName()' )) endfor else let ft = ft_list[0] - let available = keys(self.getCheckersMap(ft)) - let active = map(self.getCheckers(ft, []), 'v:val.getName()') + let available = self.getNamesOfAvailableCheckers(ft) + let active = map(self.getCheckersAvailable(ft, []), 'v:val.getName()') endif echomsg "Available checker(s): " . join(sort(available)) @@ -197,52 +206,39 @@ endfunction " }}}2 function! g:SyntasticRegistry._registerChecker(checker) abort " {{{2 let ft = a:checker.getFiletype() - - if !has_key(self._checkerRaw, ft) - let self._checkerRaw[ft] = [] + if !has_key(self._checkerMap, ft) let self._checkerMap[ft] = {} endif - call self._validateUniqueName(a:checker) - let name = a:checker.getName() - call add(self._checkerRaw[ft], name) - - if a:checker.isAvailable() - let self._checkerMap[ft][name] = a:checker + if has_key(self._checkerMap[ft], name) + throw 'Syntastic: Duplicate syntax checker name: ' . ft . '/' . name endif + + let self._checkerMap[ft][name] = a:checker endfunction " }}}2 function! g:SyntasticRegistry._filterCheckersByName(checkers_map, list) " {{{2 return filter( map(copy(a:list), 'get(a:checkers_map, v:val, {})'), '!empty(v:val)' ) endfunction " }}}2 -function! g:SyntasticRegistry._loadCheckers(filetype) " {{{2 - if has_key(self._checkerRaw, a:filetype) +function! g:SyntasticRegistry._loadCheckersFor(filetype) " {{{2 + if has_key(self._checkerMap, a:filetype) return endif execute "runtime! syntax_checkers/" . a:filetype . "/*.vim" - if !has_key(self._checkerRaw, a:filetype) - let self._checkerRaw[a:filetype] = [] + if !has_key(self._checkerMap, a:filetype) let self._checkerMap[a:filetype] = {} endif endfunction " }}}2 -function! g:SyntasticRegistry._validateUniqueName(checker) abort " {{{2 - let ft = a:checker.getFiletype() - let name = a:checker.getName() - if index(self._checkerRaw[ft], name) > -1 - throw 'Syntastic: Duplicate syntax checker name: ' . ft . '/' . name - endif -endfunction " }}}2 - " Check for obsolete variable g:syntastic__checker function! g:SyntasticRegistry._checkDeprecation(filetype) " {{{2 if exists('g:syntastic_' . a:filetype . '_checker') && !exists('g:syntastic_' . a:filetype . '_checkers') let g:syntastic_{a:filetype}_checkers = [g:syntastic_{a:filetype}_checker] - call syntastic#log#deprecationWarn('variable g:syntastic_' . a:filetype . '_checker is deprecated') + call syntastic#log#oneTimeWarn('variable g:syntastic_' . a:filetype . '_checker is deprecated') endif endfunction " }}}2 diff --git a/sources_non_forked/syntastic/plugin/syntastic/signs.vim b/sources_non_forked/syntastic/plugin/syntastic/signs.vim index 9c860da2..7f713c69 100644 --- a/sources_non_forked/syntastic/plugin/syntastic/signs.vim +++ b/sources_non_forked/syntastic/plugin/syntastic/signs.vim @@ -25,6 +25,7 @@ function! g:SyntasticSignsNotifier.New() " {{{2 if !s:setup_done call self._setup() let s:setup_done = 1 + lockvar s:setup_done endif return newObj @@ -41,7 +42,7 @@ function! g:SyntasticSignsNotifier.refresh(loclist) " {{{2 call self._signErrors(a:loclist) endif call self._removeSigns(old_signs) - let s:first_sign_id = s:next_sign_id + let s:first_sign_id = exists('s:next_sign_id') ? s:next_sign_id : 5000 endfunction " }}}2 " }}}1 @@ -98,13 +99,15 @@ function! g:SyntasticSignsNotifier._signErrors(loclist) " {{{2 if !has_key(seen, i['lnum']) let seen[i['lnum']] = 1 - let sign_severity = i['type'] ==? 'W' ? 'Warning' : 'Error' - let sign_subtype = get(i, 'subtype', '') - let sign_type = 'Syntastic' . sign_subtype . sign_severity + if i['lnum'] > 0 + let sign_severity = i['type'] ==? 'W' ? 'Warning' : 'Error' + let sign_subtype = get(i, 'subtype', '') + let sign_type = 'Syntastic' . sign_subtype . sign_severity - execute "sign place " . s:next_sign_id . " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr'] - call add(self._bufSignIds(), s:next_sign_id) - let s:next_sign_id += 1 + execute "sign place " . s:next_sign_id . " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr'] + call add(self._bufSignIds(), s:next_sign_id) + let s:next_sign_id += 1 + endif endif endfor endif @@ -113,9 +116,9 @@ endfunction " }}}2 " Remove the signs with the given ids from this buffer function! g:SyntasticSignsNotifier._removeSigns(ids) " {{{2 if has('signs') - for i in a:ids - execute "sign unplace " . i - call remove(self._bufSignIds(), index(self._bufSignIds(), i)) + for s in reverse(copy(a:ids)) + execute "sign unplace " . s + call remove(self._bufSignIds(), index(self._bufSignIds(), s)) endfor endif endfunction " }}}2 diff --git a/sources_non_forked/syntastic/syntax_checkers/actionscript/mxmlc.vim b/sources_non_forked/syntastic/syntax_checkers/actionscript/mxmlc.vim index 0c4d09db..dd47287d 100644 --- a/sources_non_forked/syntastic/syntax_checkers/actionscript/mxmlc.vim +++ b/sources_non_forked/syntastic/syntax_checkers/actionscript/mxmlc.vim @@ -14,10 +14,6 @@ if exists('g:loaded_syntastic_actionscript_mxmlc_checker') endif let g:loaded_syntastic_actionscript_mxmlc_checker = 1 -if !exists('g:syntastic_actionscript_mxmlc_conf') - let g:syntastic_actionscript_mxmlc_conf = '' -endif - let s:save_cpo = &cpo set cpo&vim @@ -45,10 +41,10 @@ function! SyntaxCheckers_actionscript_mxmlc_GetHighlightRegex(item) endfunction function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'args_before': (g:syntastic_actionscript_mxmlc_conf != '' ? - \ ' -load-config+=' . syntastic#util#shexpand(g:syntastic_actionscript_mxmlc_conf) : ''), - \ 'args_after': '-output=' . syntastic#util#DevNull() }) + call syntastic#log#deprecationWarn('actionscript_mxmlc_conf', 'actionscript_mxmlc_args', + \ "'-load-config+=' . syntastic#util#shexpand(OLD_VAR)") + + let makeprg = self.makeprgBuild({ 'args_after': '-output=' . syntastic#util#DevNull() }) let errorformat = \ '%f(%l): col: %c %trror: %m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/bemhtml/bemhtmllint.vim b/sources_non_forked/syntastic/syntax_checkers/bemhtml/bemhtmllint.vim index e6582163..7f52ed3b 100644 --- a/sources_non_forked/syntastic/syntax_checkers/bemhtml/bemhtmllint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/bemhtml/bemhtmllint.vim @@ -8,7 +8,7 @@ " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ -" + if exists("g:loaded_syntastic_bemhtml_bemhtmllint_checker") finish endif @@ -29,6 +29,7 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'name': 'bemhtmllint', \ 'exec': 'bemhtml-lint' }) - let &cpo = s:save_cpo unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/sources_non_forked/syntastic/syntax_checkers/bro/bro.vim b/sources_non_forked/syntastic/syntax_checkers/bro/bro.vim new file mode 100644 index 00000000..5d75c8ad --- /dev/null +++ b/sources_non_forked/syntastic/syntax_checkers/bro/bro.vim @@ -0,0 +1,45 @@ +"============================================================================ +"File: bro.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Justin Azoff +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_bro_bro_checker") + finish +endif +let g:loaded_syntastic_bro_bro_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_bro_bro_IsAvailable() dict + return system(self.getExecEscaped() . ' --help') =~# '--parse-only' +endfunction + +function! SyntaxCheckers_bro_bro_GetLocList() dict + let makeprg = self.makeprgBuild({ 'args_before': '--parse-only' }) + + "example: error in ./foo.bro, line 3: unknown identifier banana, at or "near "banana" + let errorformat = + \ '%trror in %f\, line %l: %m,' . + \ '%tarning in %f\, line %l: %m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'bro', + \ 'name': 'bro'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/sources_non_forked/syntastic/syntax_checkers/c/checkpatch.vim b/sources_non_forked/syntastic/syntax_checkers/c/checkpatch.vim index f8601d80..957af2de 100644 --- a/sources_non_forked/syntastic/syntax_checkers/c/checkpatch.vim +++ b/sources_non_forked/syntastic/syntax_checkers/c/checkpatch.vim @@ -14,24 +14,27 @@ if exists("g:loaded_syntastic_c_checkpatch_checker") endif let g:loaded_syntastic_c_checkpatch_checker = 1 -" Bail if the user doesn't have `checkpatch.pl` or ./scripts/checkpatch.pl installed. -if executable("checkpatch.pl") - let g:syntastic_c_checker_checkpatch_location = 'checkpatch.pl' -elseif executable("./scripts/checkpatch.pl") - let g:syntastic_c_checker_checkpatch_location = './scripts/checkpatch.pl' -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_checkpatch_IsAvailable() dict - return exists("g:syntastic_c_checker_checkpatch_location") + call syntastic#log#deprecationWarn('c_checker_checkpatch_location', 'c_checkpatch_exe') + + if !exists('g:syntastic_c_checkpatch_exe') && !executable(self.getExec()) + if executable('checkpatch') + let g:syntastic_c_checkpatch_exe = 'checkpatch' + elseif executable('./scripts/checkpatch.pl') + let g:syntastic_c_checkpatch_exe = fnamemodify('./scripts/checkpatch.pl', ':p') + elseif executable('./scripts/checkpatch') + let g:syntastic_c_checkpatch_exe = fnamemodify('./scripts/checkpatch', ':p') + endif + endif + + return executable(self.getExec()) endfunction function! SyntaxCheckers_c_checkpatch_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'exe': g:syntastic_c_checker_checkpatch_location, - \ 'args_after': '--no-summary --no-tree --terse --file' }) + let makeprg = self.makeprgBuild({ 'args_after': '--no-summary --no-tree --terse --file' }) let errorformat = \ '%f:%l: %tARNING: %m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/c/make.vim b/sources_non_forked/syntastic/syntax_checkers/c/make.vim index fa27273a..8b84173f 100644 --- a/sources_non_forked/syntastic/syntax_checkers/c/make.vim +++ b/sources_non_forked/syntastic/syntax_checkers/c/make.vim @@ -19,7 +19,7 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_make_GetLocList() dict - let makeprg = self.getExecEscaped() . ' -sk' + let makeprg = self.makeprgBuild({ 'args': '-sk', 'fname': '' }) let errorformat = \ '%-G%f:%s:,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/cabal/cabal.vim b/sources_non_forked/syntastic/syntax_checkers/cabal/cabal.vim new file mode 100644 index 00000000..191969be --- /dev/null +++ b/sources_non_forked/syntastic/syntax_checkers/cabal/cabal.vim @@ -0,0 +1,55 @@ +"============================================================================ +"File: cabal.vim +"Description: Haskell package description (.cabal file) linting and syntax +" validation via 'cabal check' +"Maintainer: Ian D. Bollinger +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ + +if exists('g:loaded_syntastic_cabal_cabal_checker') + finish +endif +let g:loaded_syntastic_cabal_cabal_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_cabal_cabal_GetHighlightRegex(item) + let field = matchstr(a:item['text'], "\\vParse of field '\\zs[^']+") + if field != '' + return '\v\c^\s*' . field . '\s*:\s*\zs.*$' + endif + let field = matchstr(a:item['text'], "\\v(^|\\s)'\\zs[^']+\\ze'") + if field != '' + return '\V\c\<' . escape(field, '\') . '\>' + endif + return '' +endfunction + +function! SyntaxCheckers_cabal_cabal_GetLocList() dict + let makeprg = self.getExecEscaped() . ' check' + + let errorformat = + \ '%Ecabal: %f:%l: %m,' . + \ '%W* %m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'cwd': expand('%:p:h'), + \ 'preprocess': 'cabal', + \ 'defaults': {'bufnr': bufnr('')} }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'cabal', + \ 'name': 'cabal'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/sources_non_forked/syntastic/syntax_checkers/co/coco.vim b/sources_non_forked/syntastic/syntax_checkers/co/coco.vim index 3ef5d967..1a58c451 100644 --- a/sources_non_forked/syntastic/syntax_checkers/co/coco.vim +++ b/sources_non_forked/syntastic/syntax_checkers/co/coco.vim @@ -19,7 +19,8 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_co_coco_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args_after': '-c -o /tmp' }) + let tmpdir = $TMPDIR != '' ? $TMPDIR : $TMP != '' ? $TMP : '/tmp' + let makeprg = self.makeprgBuild({ 'args_after': '-c -o ' . tmpdir }) let errorformat = \ '%EFailed at: %f,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/coffee/coffeelint.vim b/sources_non_forked/syntastic/syntax_checkers/coffee/coffeelint.vim index ccc6349a..99f2fad8 100644 --- a/sources_non_forked/syntastic/syntax_checkers/coffee/coffeelint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/coffee/coffeelint.vim @@ -19,7 +19,11 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_coffee_coffeelint_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args_after': '--csv' }) + if !exists('s:coffeelint_new') + let s:coffeelint_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion( + \ self.getExecEscaped() . ' --version'), [1, 4]) + endif + let makeprg = self.makeprgBuild({ 'args_after': (s:coffeelint_new ? '--reporter csv' : '--csv') }) let errorformat = \ '%f\,%l\,%\d%#\,%trror\,%m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/css/csslint.vim b/sources_non_forked/syntastic/syntax_checkers/css/csslint.vim index fe84aaa1..0fc06269 100644 --- a/sources_non_forked/syntastic/syntax_checkers/css/csslint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/css/csslint.vim @@ -19,17 +19,13 @@ if exists('g:loaded_syntastic_css_csslint_checker') endif let g:loaded_syntastic_css_csslint_checker = 1 -if !exists('g:syntastic_csslint_options') - let g:syntastic_csslint_options = '' -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_css_csslint_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'args': g:syntastic_csslint_options, - \ 'args_after': '--format=compact' }) + call syntastic#log#deprecationWarn('csslint_options', 'css_csslint_args') + + let makeprg = self.makeprgBuild({ 'args_after': '--format=compact' }) " Print CSS Lint's error/warning messages from compact format. Ignores blank lines. let errorformat = diff --git a/sources_non_forked/syntastic/syntax_checkers/css/recess.vim b/sources_non_forked/syntastic/syntax_checkers/css/recess.vim new file mode 100644 index 00000000..6d043e44 --- /dev/null +++ b/sources_non_forked/syntastic/syntax_checkers/css/recess.vim @@ -0,0 +1,26 @@ +"============================================================================ +"File: recess.vim +"Description: Syntax checking plugin for syntastic.vim using `recess` +" (http://twitter.github.io/recess/). +"Maintainer: Tim Carry +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_css_recess_checker") + finish +endif +let g:loaded_syntastic_css_recess_checker = 1 + +runtime! syntax_checkers/less/*.vim + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'css', + \ 'name': 'recess', + \ 'redirect': 'less/recess'}) + +" vim: set et sts=4 sw=4: diff --git a/sources_non_forked/syntastic/syntax_checkers/d/dmd.vim b/sources_non_forked/syntastic/syntax_checkers/d/dmd.vim index 4f70979b..05e7b6a1 100644 --- a/sources_non_forked/syntastic/syntax_checkers/d/dmd.vim +++ b/sources_non_forked/syntastic/syntax_checkers/d/dmd.vim @@ -35,6 +35,12 @@ function! SyntaxCheckers_d_dmd_IsAvailable() dict endfunction function! SyntaxCheckers_d_dmd_GetLocList() dict + if !exists('g:syntastic_d_include_dirs') + let g:syntastic_d_include_dirs = filter(glob($HOME . '/.dub/packages/*', 1, 1), 'isdirectory(v:val)') + call map(g:syntastic_d_include_dirs, 'isdirectory(v:val . "/source") ? v:val . "/source" : v:val') + call add(g:syntastic_d_include_dirs, './source') + endif + return syntastic#c#GetLocList('d', 'dmd', { \ 'errorformat': \ '%-G%f:%s:,%f(%l): %m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/eruby/ruby.vim b/sources_non_forked/syntastic/syntax_checkers/eruby/ruby.vim index 34dc9bdc..47378e0f 100644 --- a/sources_non_forked/syntastic/syntax_checkers/eruby/ruby.vim +++ b/sources_non_forked/syntastic/syntax_checkers/eruby/ruby.vim @@ -19,22 +19,27 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_eruby_ruby_IsAvailable() dict - if !exists("g:syntastic_ruby_exec") - let g:syntastic_ruby_exec = self.getExec() + if !exists('g:syntastic_eruby_ruby_exec') && exists('g:syntastic_ruby_exec') + let g:syntastic_eruby_ruby_exec = g:syntastic_ruby_exec endif - return executable(expand(g:syntastic_ruby_exec)) + let s:exe = self.getExec() + + if executable(s:exe) + let s:exe = syntastic#util#shescape(s:exe) + if !syntastic#util#isRunningWindows() + let s:exe = 'RUBYOPT= ' . s:exe + endif + return 1 + endif + + return 0 endfunction function! SyntaxCheckers_eruby_ruby_GetLocList() dict - let exe = syntastic#util#shexpand(g:syntastic_ruby_exec) - if !syntastic#util#isRunningWindows() - let exe = 'RUBYOPT= ' . exe - endif - let fname = "'" . escape(expand('%'), "\\'") . "'" " TODO: encodings became useful in ruby 1.9 :) - if syntastic#util#versionIsAtLeast(syntastic#util#getVersion(exe . ' --version'), [1, 9]) + if syntastic#util#versionIsAtLeast(syntastic#util#getVersion(s:exe . ' --version'), [1, 9]) let enc = &fileencoding != '' ? &fileencoding : &encoding let encoding_spec = ', :encoding => "' . (enc ==? 'utf-8' ? 'UTF-8' : 'BINARY') . '"' else @@ -43,11 +48,11 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict "gsub fixes issue #7, rails has it's own eruby syntax let makeprg = - \ exe . ' -rerb -e ' . + \ s:exe . ' -rerb -e ' . \ syntastic#util#shescape('puts ERB.new(File.read(' . \ fname . encoding_spec . \ ').gsub(''<%='',''<%''), nil, ''-'').src') . - \ ' | ' . exe . ' -c' + \ ' | ' . s:exe . ' -c' let errorformat = \ '%-GSyntax OK,'. diff --git a/sources_non_forked/syntastic/syntax_checkers/haml/haml.vim b/sources_non_forked/syntastic/syntax_checkers/haml/haml.vim index b01143e9..a26fa6cc 100644 --- a/sources_non_forked/syntastic/syntax_checkers/haml/haml.vim +++ b/sources_non_forked/syntastic/syntax_checkers/haml/haml.vim @@ -19,16 +19,12 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_haml_haml_IsAvailable() dict - if !exists('g:syntastic_haml_interpreter') - let g:syntastic_haml_interpreter = self.getExec() - endif - return executable(expand(g:syntastic_haml_interpreter)) + call syntastic#log#deprecationWarn('haml_interpreter', 'haml_haml_exec') + return executable(self.getExec()) endfunction function! SyntaxCheckers_haml_haml_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'exe': syntastic#util#shexpand(g:syntastic_haml_interpreter), - \ 'args_after': '-c' }) + let makeprg = self.makeprgBuild({ 'args_after': '-c' }) let errorformat = \ 'Haml error on line %l: %m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/haskell/hdevtools.vim b/sources_non_forked/syntastic/syntax_checkers/haskell/hdevtools.vim index 81954916..978abd20 100644 --- a/sources_non_forked/syntastic/syntax_checkers/haskell/hdevtools.vim +++ b/sources_non_forked/syntastic/syntax_checkers/haskell/hdevtools.vim @@ -19,7 +19,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_haskell_hdevtools_GetLocList() dict - if exists('g:hdevtools_options') + if !exists('g:syntastic_haskell_hdevtools_args') && exists('g:hdevtools_options') + call syntastic#log#oneTimeWarn('variable g:hdevtools_options is deprecated, ' . + \ 'please use g:syntastic_haskell_hdevtools_args instead') let g:syntastic_haskell_hdevtools_args = g:hdevtools_options endif diff --git a/sources_non_forked/syntastic/syntax_checkers/html/jshint.vim b/sources_non_forked/syntastic/syntax_checkers/html/jshint.vim index 2c64fb62..a7274c1b 100644 --- a/sources_non_forked/syntastic/syntax_checkers/html/jshint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/html/jshint.vim @@ -14,29 +14,20 @@ if exists('g:loaded_syntastic_html_jshint_checker') endif let g:loaded_syntastic_html_jshint_checker = 1 -if !exists('g:syntastic_jshint_exec') - let g:syntastic_jshint_exec = 'jshint' -endif - -if !exists('g:syntastic_html_jshint_conf') - let g:syntastic_html_jshint_conf = '' -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_html_jshint_IsAvailable() dict - let exe = expand(g:syntastic_jshint_exec) - return executable(exe) && - \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(exe . ' --version'), [2,4]) + call syntastic#log#deprecationWarn('jshint_exec', 'html_jshint_exec') + return executable(self.getExec()) && + \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(self.getExecEscaped() . ' --version'), [2,4]) endfunction function! SyntaxCheckers_html_jshint_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'exe': expand(g:syntastic_jshint_exec), - \ 'args': (g:syntastic_html_jshint_conf != '' ? - \ '--config ' . syntastic#util#shexpand(g:syntastic_html_jshint_conf) : ''), - \ 'args_after': '--verbose --extract always' }) + call syntastic#log#deprecationWarn('html_jshint_conf', 'html_jshint_args', + \ "'--config ' . syntastic#util#shexpand(OLD_VAR)") + + let makeprg = self.makeprgBuild({ 'args_after': '--verbose --extract always' }) let errorformat = '%A%f: line %l\, col %v\, %m \(%t%*\d\)' diff --git a/sources_non_forked/syntastic/syntax_checkers/html/tidy.vim b/sources_non_forked/syntastic/syntax_checkers/html/tidy.vim index 67dab605..c13451c3 100644 --- a/sources_non_forked/syntastic/syntax_checkers/html/tidy.vim +++ b/sources_non_forked/syntastic/syntax_checkers/html/tidy.vim @@ -123,6 +123,7 @@ let s:ignore_errors = [ \ "proprietary attribute \"aria-valuenow\"", \ "proprietary attribute \"aria-valuetext\"" \ ] +lockvar! s:ignore_errors let s:blocklevel_tags = [ \ "main", @@ -135,6 +136,7 @@ let s:blocklevel_tags = [ \ "figure", \ "figcaption" \ ] +lockvar! s:blocklevel_tags let s:inline_tags = [ \ "video", @@ -153,11 +155,13 @@ let s:inline_tags = [ \ "details", \ "datalist" \ ] +lockvar! s:inline_tags let s:empty_tags = [ \ "wbr", \ "keygen" \ ] +lockvar! s:empty_tags function! s:IgnoreError(text) for i in s:ignore_errors + g:syntastic_html_tidy_ignore_errors diff --git a/sources_non_forked/syntastic/syntax_checkers/java/javac.vim b/sources_non_forked/syntastic/syntax_checkers/java/javac.vim index cf15b4ba..ecf54725 100644 --- a/sources_non_forked/syntastic/syntax_checkers/java/javac.vim +++ b/sources_non_forked/syntastic/syntax_checkers/java/javac.vim @@ -10,32 +10,36 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ -if exists("g:loaded_syntastic_java_javac_checker") +if exists('g:loaded_syntastic_java_javac_checker') finish endif let g:loaded_syntastic_java_javac_checker = 1 -let g:syntastic_java_javac_maven_pom_tags = ["build", "properties"] +let g:syntastic_java_javac_maven_pom_tags = ['build', 'properties'] let g:syntastic_java_javac_maven_pom_properties = {} let s:has_maven = 0 " Global Options -if !exists("g:syntastic_java_javac_executable") +if !exists('g:syntastic_java_javac_executable') let g:syntastic_java_javac_executable = 'javac' endif -if !exists("g:syntastic_java_maven_executable") +if !exists('g:syntastic_java_maven_executable') let g:syntastic_java_maven_executable = 'mvn' endif -if !exists("g:syntastic_java_javac_options") +if !exists('g:syntastic_java_javac_options') let g:syntastic_java_javac_options = '-Xlint' endif -if !exists("g:syntastic_java_javac_classpath") +if !exists('g:syntastic_java_maven_options') + let g:syntastic_java_maven_options = '' +endif + +if !exists('g:syntastic_java_javac_classpath') let g:syntastic_java_javac_classpath = '' endif -if !exists("g:syntastic_java_javac_delete_output") +if !exists('g:syntastic_java_javac_delete_output') let g:syntastic_java_javac_delete_output = 1 endif @@ -43,20 +47,22 @@ let s:save_cpo = &cpo set cpo&vim function! s:CygwinPath(path) - return substitute(system("cygpath -m " . syntastic#util#shescape(a:path)), '\n', '', 'g') + return substitute(system('cygpath -m ' . syntastic#util#shescape(a:path)), "\n", '', 'g') endfunction -if !exists("g:syntastic_java_javac_temp_dir") +if !exists('g:syntastic_java_javac_temp_dir') if has('win32') || has('win64') - let g:syntastic_java_javac_temp_dir = $TEMP."\\vim-syntastic-javac" + let g:syntastic_java_javac_temp_dir = $TEMP . syntastic#util#Slash() . 'vim-syntastic-javac' elseif has('win32unix') let g:syntastic_java_javac_temp_dir = s:CygwinPath('/tmp/vim-syntastic-javac') + elseif $TMPDIR != '' + let g:syntastic_java_javac_temp_dir = $TMPDIR . '/vim-syntastic-javac' else let g:syntastic_java_javac_temp_dir = '/tmp/vim-syntastic-javac' endif endif -if !exists("g:syntastic_java_javac_autoload_maven_classpath") +if !exists('g:syntastic_java_javac_autoload_maven_classpath') let g:syntastic_java_javac_autoload_maven_classpath = 1 endif @@ -72,16 +78,16 @@ if !exists('g:syntastic_java_javac_custom_classpath_command') let g:syntastic_java_javac_custom_classpath_command = '' endif -if !exists("g:syntastic_java_javac_maven_pom_ftime") +if !exists('g:syntastic_java_javac_maven_pom_ftime') let g:syntastic_java_javac_maven_pom_ftime = {} endif -if !exists("g:syntastic_java_javac_maven_pom_classpath") +if !exists('g:syntastic_java_javac_maven_pom_classpath') let g:syntastic_java_javac_maven_pom_classpath = {} endif function! s:RemoveCarriageReturn(line) - return substitute(a:line, '\r', '', 'g') + return substitute(a:line, "\r", '', 'g') endfunction " recursively remove directory and all it's sub-directories @@ -90,36 +96,25 @@ function! s:RemoveDir(dir) for f in split(globpath(a:dir, '*'), "\n") call s:RemoveDir(f) endfor - silent! call system('rmdir ' . a:dir) + silent! call system('rmdir ' . syntastic#util#shescape(a:dir)) else silent! call delete(a:dir) endif endfunction +function! s:ClassSep() + return (syntastic#util#isRunningWindows() || has('win32unix')) ? ';' : ':' +endfunction + function! s:AddToClasspath(classpath, path) if a:path == '' return a:classpath endif - if a:classpath != '' && a:path != '' - if has('win32') || has('win32unix') || has('win64') - return a:classpath . ";" . a:path - else - return a:classpath . ":" . a:path - endif - else - return a:path - endif + return (a:classpath != '') ? a:classpath . s:ClassSep() . a:path : a:path endfunction function! s:SplitClasspath(classpath) - if a:classpath == '' - return [] - endif - if has('win32') || has('win32unix') || has('win64') - return split(a:classpath, ";") - else - return split(a:classpath, ":") - endif + return split(a:classpath, s:ClassSep()) endfunction function! s:LoadConfigFile() @@ -145,15 +140,15 @@ function! s:SaveClasspath() while i < len(lines) if match(lines[i], 'g:syntastic_java_javac_classpath') != -1 call remove(lines, i) - let i -= 1 + else + let i += 1 endif - let i += 1 endwhile else let lines = [] endif " add new g:syntastic_java_javac_classpath option to config - call add(lines, 'let g:syntastic_java_javac_classpath = "'.path.'"') + call add(lines, 'let g:syntastic_java_javac_classpath = ' . string(path)) " save config file lines call writefile(lines, expand(g:syntastic_java_javac_config_file)) endif @@ -169,7 +164,7 @@ function! s:EditClasspath() let path = [] let pathlines = split(g:syntastic_java_javac_classpath, "\n") for p in pathlines - let path += s:SplitClasspath(p) + call extend(path, s:SplitClasspath(p)) endfor execute (len(path) + 5) . 'sp ' . fnameescape(command) @@ -223,10 +218,12 @@ endfunction function! s:GetMavenProperties() let mvn_properties = {} - let pom = findfile("pom.xml", ".;") + let pom = findfile('pom.xml', '.;') if s:has_maven && filereadable(pom) if !has_key(g:syntastic_java_javac_maven_pom_properties, pom) - let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) . ' -f ' . pom + let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) . + \ ' -f ' . syntastic#util#shescape(pom) . + \ ' ' . g:syntastic_java_maven_options let mvn_is_managed_tag = 1 let mvn_settings_output = split(system(mvn_cmd . ' help:effective-pom'), "\n") let current_path = 'project' @@ -239,7 +236,7 @@ function! s:GetMavenProperties() let matches = matchlist(line, '\m^\s*\s*$') if !empty(matches) let mvn_is_managed_tag = index(g:syntastic_java_javac_maven_pom_tags, matches[1]) < 0 - let current_path = substitute(current_path, '\m\.' . matches[1] . "$", '', '') + let current_path = substitute(current_path, '\m\.' . matches[1] . '$', '', '') else let matches = matchlist(line, '\m^\s*<\([a-zA-Z0-9\-\.]\+\)>\(.\+\)\s*$') if mvn_is_managed_tag && !empty(matches) @@ -262,10 +259,12 @@ if g:syntastic_java_javac_config_file_enabled endif function! s:GetMavenClasspath() - let pom = findfile("pom.xml", ".;") + let pom = findfile('pom.xml', '.;') if s:has_maven && filereadable(pom) if !has_key(g:syntastic_java_javac_maven_pom_ftime, pom) || g:syntastic_java_javac_maven_pom_ftime[pom] != getftime(pom) - let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) . ' -f ' . pom + let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) . + \ ' -f ' . syntastic#util#shescape(pom) . + \ ' ' . g:syntastic_java_maven_options let mvn_classpath_output = split(system(mvn_cmd . ' dependency:build-classpath'), "\n") let mvn_classpath = '' let class_path_next = 0 @@ -308,20 +307,20 @@ function! SyntaxCheckers_java_javac_IsAvailable() dict endfunction function! s:MavenOutputDirectory() - let pom = findfile("pom.xml", ".;") + let pom = findfile('pom.xml', '.;') if s:has_maven && filereadable(pom) let mvn_properties = s:GetMavenProperties() let output_dir = getcwd() if has_key(mvn_properties, 'project.properties.build.dir') let output_dir = mvn_properties['project.properties.build.dir'] endif - if stridx(expand( '%:p:h' ), "src.main.java") >= 0 + if stridx(expand( '%:p:h' ), 'src.main.java') >= 0 let output_dir .= '/target/classes' if has_key(mvn_properties, 'project.build.outputDirectory') let output_dir = mvn_properties['project.build.outputDirectory'] endif endif - if stridx(expand( '%:p:h' ), "src.test.java") >= 0 + if stridx(expand( '%:p:h' ), 'src.test.java') >= 0 let output_dir .= '/target/test-classes' if has_key(mvn_properties, 'project.build.testOutputDirectory') let output_dir = mvn_properties['project.build.testOutputDirectory'] @@ -337,13 +336,12 @@ function! s:MavenOutputDirectory() endfunction function! SyntaxCheckers_java_javac_GetLocList() dict - let javac_opts = g:syntastic_java_javac_options - let output_dir = "" + let output_dir = '' if g:syntastic_java_javac_delete_output let output_dir = g:syntastic_java_javac_temp_dir - let javac_opts .= ' -d ' . output_dir + let javac_opts .= ' -d ' . syntastic#util#shescape(output_dir) endif " load classpath from config file @@ -354,12 +352,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict let javac_classpath = '' " add classpathes to javac_classpath - if has('win32') || has('win32unix') || has('win64') - let javac_classpath_split = ';' - else - let javac_classpath_split = ':' - endif - for path in split(g:syntastic_java_javac_classpath, javac_classpath_split) + for path in split(g:syntastic_java_javac_classpath, s:ClassSep()) if path != '' try let ps = glob(path, 0, 1) @@ -378,7 +371,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict if s:has_maven && g:syntastic_java_javac_autoload_maven_classpath if !g:syntastic_java_javac_delete_output - let javac_opts .= ' -d ' . s:MavenOutputDirectory() + let javac_opts .= ' -d ' . syntastic#util#shescape(s:MavenOutputDirectory()) endif let javac_classpath = s:AddToClasspath(javac_classpath, s:GetMavenClasspath()) endif @@ -386,7 +379,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " load custom classpath if g:syntastic_java_javac_custom_classpath_command != '' let lines = system(g:syntastic_java_javac_custom_classpath_command) - if has('win32') || has('win32unix') || has('win64') + if syntastic#util#isRunningWindows() || has('win32unix') let lines = substitute(lines, "\r\n", "\n", 'g') endif for l in split(lines, "\n") @@ -395,17 +388,10 @@ function! SyntaxCheckers_java_javac_GetLocList() dict endif if javac_classpath != '' - let javac_opts .= ' -cp "' . fnameescape(javac_classpath) . '"' + let javac_opts .= ' -cp ' . syntastic#util#shexpand(javac_classpath) endif - " path seperator - if has('win32') || has('win32unix') || has('win64') - let sep = "\\" - else - let sep = '/' - endif - - let fname = fnameescape(expand ( '%:p:h' ) . sep . expand ( '%:t' )) + let fname = expand('%:p:h') . syntastic#util#Slash() . expand ('%:t') if has('win32unix') let fname = s:CygwinPath(fname) @@ -413,7 +399,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'args': javac_opts, - \ 'fname': fname, + \ 'fname': syntastic#util#shescape(fname), \ 'tail': '2>&1' }) " unashamedly stolen from *errorformat-javac* (quickfix.txt) and modified to include error types diff --git a/sources_non_forked/syntastic/syntax_checkers/javascript/closurecompiler.vim b/sources_non_forked/syntastic/syntax_checkers/javascript/closurecompiler.vim index d23fad05..5dac3abe 100644 --- a/sources_non_forked/syntastic/syntax_checkers/javascript/closurecompiler.vim +++ b/sources_non_forked/syntastic/syntax_checkers/javascript/closurecompiler.vim @@ -8,48 +8,36 @@ " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ -" -" To enable this plugin, edit the .vimrc like this: -" -" let g:syntastic_javascript_checker = "closurecompiler" -" -" and set the path to the Google Closure Compiler: -" -" let g:syntastic_javascript_closure_compiler_path = '/path/to/google-closure-compiler.jar' -" -" It takes additional options for Google Closure Compiler with the variable -" g:syntastic_javascript_closure_compiler_options. -" if exists("g:loaded_syntastic_javascript_closurecompiler_checker") finish endif let g:loaded_syntastic_javascript_closurecompiler_checker = 1 -if !exists("g:syntastic_javascript_closure_compiler_options") - let g:syntastic_javascript_closure_compiler_options = "" -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_javascript_closurecompiler_IsAvailable() dict + call syntastic#log#deprecationWarn('javascript_closure_compiler_path', 'javascript_closurecompiler_path') + return \ executable("java") && - \ exists("g:syntastic_javascript_closure_compiler_path") && - \ filereadable(g:syntastic_javascript_closure_compiler_path) + \ exists("g:syntastic_javascript_closurecompiler_path") && + \ filereadable(g:syntastic_javascript_closurecompiler_path) endfunction function! SyntaxCheckers_javascript_closurecompiler_GetLocList() dict - if exists("g:syntastic_javascript_closure_compiler_file_list") - let file_list = join(readfile(g:syntastic_javascript_closure_compiler_file_list)) + call syntastic#log#deprecationWarn('javascript_closure_compiler_options', 'javascript_closurecompiler_args') + call syntastic#log#deprecationWarn('javascript_closure_compiler_file_list', 'javascript_closurecompiler_file_list') + + if exists("g:syntastic_javascript_closurecompiler_file_list") + let file_list = join(readfile(g:syntastic_javascript_closurecompiler_file_list)) else let file_list = syntastic#util#shexpand('%') endif let makeprg = self.makeprgBuild({ - \ 'exe': 'java -jar ' . g:syntastic_javascript_closure_compiler_path, - \ 'args': g:syntastic_javascript_closure_compiler_options, + \ 'exe_after': '-jar ' . g:syntastic_javascript_closurecompiler_path, \ 'args_after': '--js' , \ 'fname': file_list }) diff --git a/sources_non_forked/syntastic/syntax_checkers/javascript/eslint.vim b/sources_non_forked/syntastic/syntax_checkers/javascript/eslint.vim index ee744acb..96919c8f 100644 --- a/sources_non_forked/syntastic/syntax_checkers/javascript/eslint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/javascript/eslint.vim @@ -14,27 +14,24 @@ if exists('g:loaded_syntastic_javascript_eslint_checker') endif let g:loaded_syntastic_javascript_eslint_checker = 1 -if !exists('g:syntastic_javascript_eslint_conf') - let g:syntastic_javascript_eslint_conf = '' -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_javascript_eslint_IsAvailable() dict return - \ executable('eslint') && - \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion('eslint --version'), [0, 1]) + \ executable(self.getExec()) && + \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(self.getExecEscaped() . ' --version'), [0, 1]) endfunction function! SyntaxCheckers_javascript_eslint_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'args_before': '-f compact', - \ 'args': (g:syntastic_javascript_eslint_conf != '' ? - \ '--config ' . syntastic#util#shexpand(g:syntastic_javascript_eslint_conf) : '') }) + call syntastic#log#deprecationWarn('javascript_eslint_conf', 'javascript_eslint_args', + \ "'--config ' . syntastic#util#shexpand(OLD_VAR)") + + let makeprg = self.makeprgBuild({ 'args_before': '-f compact' }) let errorformat = - \ '%E%f: line %l\, col %c\, Error - %m' + \ '%E%f: line %l\, col %c\, Error - %m,' . + \ '%W%f: line %l\, col %c\, Warning - %m' let loclist = SyntasticMake({ \ 'makeprg': makeprg, diff --git a/sources_non_forked/syntastic/syntax_checkers/javascript/gjslint.vim b/sources_non_forked/syntastic/syntax_checkers/javascript/gjslint.vim index 1b171c9c..1704ac27 100644 --- a/sources_non_forked/syntastic/syntax_checkers/javascript/gjslint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/javascript/gjslint.vim @@ -14,16 +14,13 @@ if exists("g:loaded_syntastic_javascript_gjslint_checker") endif let g:loaded_syntastic_javascript_gjslint_checker = 1 -if !exists("g:syntastic_javascript_gjslint_conf") - let g:syntastic_javascript_gjslint_conf = "" -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_javascript_gjslint_GetLocList() dict + call syntastic#log#deprecationWarn('javascript_gjslint_conf', 'javascript_gjslint_args') + let makeprg = self.makeprgBuild({ - \ 'args': g:syntastic_javascript_gjslint_conf, \ 'args_after': '--nosummary --unix_mode --nodebug_indentation --nobeep' }) let errorformat = diff --git a/sources_non_forked/syntastic/syntax_checkers/javascript/jshint.vim b/sources_non_forked/syntastic/syntax_checkers/javascript/jshint.vim index 712fe16e..997871fe 100644 --- a/sources_non_forked/syntastic/syntax_checkers/javascript/jshint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/javascript/jshint.vim @@ -14,34 +14,27 @@ if exists('g:loaded_syntastic_javascript_jshint_checker') endif let g:loaded_syntastic_javascript_jshint_checker = 1 -if !exists('g:syntastic_javascript_jshint_conf') - let g:syntastic_javascript_jshint_conf = '' -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_javascript_jshint_IsAvailable() dict - if !exists('g:syntastic_jshint_exec') - let g:syntastic_jshint_exec = self.getExec() - endif - if !executable(expand(g:syntastic_jshint_exec)) + call syntastic#log#deprecationWarn('jshint_exec', 'javascript_jshint_exec') + if !executable(self.getExec()) return 0 endif - let s:jshint_version = syntastic#util#getVersion(syntastic#util#shexpand(g:syntastic_jshint_exec) . ' --version') + let s:jshint_version = syntastic#util#getVersion(self.getExecEscaped() . ' --version') return syntastic#util#versionIsAtLeast(s:jshint_version, [1]) endfunction function! SyntaxCheckers_javascript_jshint_GetLocList() dict + call syntastic#log#deprecationWarn('javascript_jshint_conf', 'javascript_jshint_args', + \ "'--config ' . syntastic#util#shexpand(OLD_VAR)") + if !exists('s:jshint_new') let s:jshint_new = syntastic#util#versionIsAtLeast(s:jshint_version, [1, 1]) endif - let makeprg = self.makeprgBuild({ - \ 'exe': syntastic#util#shexpand(g:syntastic_jshint_exec), - \ 'args': (g:syntastic_javascript_jshint_conf != '' ? - \ '--config ' . syntastic#util#shexpand(g:syntastic_javascript_jshint_conf) : ''), - \ 'args_after': (s:jshint_new ? '--verbose ' : '') }) + let makeprg = self.makeprgBuild({ 'args_after': (s:jshint_new ? '--verbose ' : '') }) let errorformat = s:jshint_new ? \ '%A%f: line %l\, col %v\, %m \(%t%*\d\)' : diff --git a/sources_non_forked/syntastic/syntax_checkers/javascript/jsl.vim b/sources_non_forked/syntastic/syntax_checkers/javascript/jsl.vim index 13328c20..8f4148d6 100644 --- a/sources_non_forked/syntastic/syntax_checkers/javascript/jsl.vim +++ b/sources_non_forked/syntastic/syntax_checkers/javascript/jsl.vim @@ -14,17 +14,14 @@ if exists("g:loaded_syntastic_javascript_jsl_checker") endif let g:loaded_syntastic_javascript_jsl_checker = 1 -if !exists("g:syntastic_javascript_jsl_conf") - let g:syntastic_javascript_jsl_conf = "" -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_javascript_jsl_GetLocList() dict + call syntastic#log#deprecationWarn('javascript_jsl_conf', 'javascript_jsl_args', + \ "'-conf ' . syntastic#util#shexpand(OLD_VAR)") + let makeprg = self.makeprgBuild({ - \ 'args': (g:syntastic_javascript_jsl_conf != '' ? - \ '-conf ' . syntastic#util#shexpand(g:syntastic_javascript_jsl_conf) : ''), \ 'args_after': '-nologo -nofilelisting -nosummary -nocontext -process' }) let errorformat = diff --git a/sources_non_forked/syntastic/syntax_checkers/javascript/jslint.vim b/sources_non_forked/syntastic/syntax_checkers/javascript/jslint.vim index 89d3a802..63bb4101 100644 --- a/sources_non_forked/syntastic/syntax_checkers/javascript/jslint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/javascript/jslint.vim @@ -22,7 +22,7 @@ set cpo&vim function! SyntaxCheckers_javascript_jslint_GetHighlightRegex(item) let term = matchstr(a:item['text'], '\mExpected .* and instead saw ''\zs.*\ze''') if term != '' - let term = '\V' . escape(term, '\') + let term = '\V\<' . escape(term, '\') . '\>' endif return term endfunction diff --git a/sources_non_forked/syntastic/syntax_checkers/less/recess.vim b/sources_non_forked/syntastic/syntax_checkers/less/recess.vim new file mode 100644 index 00000000..92944189 --- /dev/null +++ b/sources_non_forked/syntastic/syntax_checkers/less/recess.vim @@ -0,0 +1,44 @@ +"============================================================================ +"File: recess.vim +"Description: Syntax checking plugin for syntastic.vim using `recess` +" (http://twitter.github.io/recess/). +"Maintainer: Tim Carry +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists('g:loaded_syntastic_less_recess_checker') + finish +endif +let g:loaded_syntastic_less_recess_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_less_recess_GetLocList() dict + let makeprg = self.makeprgBuild({ + \ 'post_args_after': '--format=compact --stripColors' }) + + let errorformat = + \ '%E%m in %f,' . + \ '%Z %#%l.%.%#,' . + \ '%f:%l:%m,' . + \ '%-G%.%#' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'less', + \ 'name': 'recess'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/sources_non_forked/syntastic/syntax_checkers/lisp/clisp.vim b/sources_non_forked/syntastic/syntax_checkers/lisp/clisp.vim index 2c3876da..5e726a92 100644 --- a/sources_non_forked/syntastic/syntax_checkers/lisp/clisp.vim +++ b/sources_non_forked/syntastic/syntax_checkers/lisp/clisp.vim @@ -20,13 +20,14 @@ set cpo&vim function! SyntaxCheckers_lisp_clisp_GetLocList() dict let makeprg = self.makeprgBuild({ - \ 'args_after': '-q -c ' . syntastic#c#NullOutput() }) + \ 'args_after': '-q', + \ 'fname_before': '-c' }) let errorformat = \ '%-G;%.%#,' . - \ '%W%>WARNING:%.%#line %l : %m,' . + \ '%W%>WARNING:%.%# line %l : %m,' . \ '%Z %#%m,' . - \ '%W%>WARNING:%.%#lines %l..%\d\# : %m,' . + \ '%W%>WARNING:%.%# lines %l%\%.%\%.%\d%\+ : %m,' . \ '%Z %#%m,' . \ '%E%>The following functions were %m,' . \ '%Z %m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/perl/perl.vim b/sources_non_forked/syntastic/syntax_checkers/perl/perl.vim index 2ac6ec98..553c55a5 100644 --- a/sources_non_forked/syntastic/syntax_checkers/perl/perl.vim +++ b/sources_non_forked/syntastic/syntax_checkers/perl/perl.vim @@ -50,25 +50,25 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_perl_perl_IsAvailable() dict - if !exists('g:syntastic_perl_interpreter') - let g:syntastic_perl_interpreter = self.getExec() + if !exists('g:syntastic_perl_perl_exec') && exists('g:syntastic_perl_interpreter') + let g:syntastic_perl_perl_exec = g:syntastic_perl_interpreter endif " don't call executable() here, to allow things like " let g:syntastic_perl_interpreter='/usr/bin/env perl' - silent! call system(syntastic#util#shexpand(g:syntastic_perl_interpreter) . ' -e ' . syntastic#util#shescape('exit(0)')) + silent! call system(self.getExecEscaped() . ' -e ' . syntastic#util#shescape('exit(0)')) return v:shell_error == 0 endfunction function! SyntaxCheckers_perl_perl_GetLocList() dict if !exists('g:syntastic_enable_perl_checker') || !g:syntastic_enable_perl_checker - call syntastic#log#error('checker perl/perl: checks disabled for security reasons; set g:syntastic_enable_perl_checker to 1 to override') + call syntastic#log#error('checker perl/perl: checks disabled for security reasons; ' . + \ 'set g:syntastic_enable_perl_checker to 1 to override') return [] endif - let exe = expand(g:syntastic_perl_interpreter) if type(g:syntastic_perl_lib_path) == type('') - call syntastic#log#deprecationWarn('variable g:syntastic_perl_lib_path should be a list') + 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')) @@ -79,9 +79,7 @@ function! SyntaxCheckers_perl_perl_GetLocList() dict \ (index(shebang['args'], '-t') >= 0 ? ' -t' : '') let errorformat = '%f:%l:%m' - let makeprg = self.makeprgBuild({ - \ 'exe': exe, - \ 'args_before': '-c -X ' . extra }) + let makeprg = self.makeprgBuild({ 'args_before': '-c -X ' . extra }) let errors = SyntasticMake({ \ 'makeprg': makeprg, @@ -92,9 +90,7 @@ function! SyntaxCheckers_perl_perl_GetLocList() dict return errors endif - let makeprg = self.makeprgBuild({ - \ 'exe': exe, - \ 'args_before': '-c -Mwarnings ' . extra }) + let makeprg = self.makeprgBuild({ 'args_before': '-c -Mwarnings ' . extra }) return SyntasticMake({ \ 'makeprg': makeprg, diff --git a/sources_non_forked/syntastic/syntax_checkers/php/phpcs.vim b/sources_non_forked/syntastic/syntax_checkers/php/phpcs.vim index 23d539df..e6600ac6 100644 --- a/sources_non_forked/syntastic/syntax_checkers/php/phpcs.vim +++ b/sources_non_forked/syntastic/syntax_checkers/php/phpcs.vim @@ -27,8 +27,8 @@ function! SyntaxCheckers_php_phpcs_GetLocList() dict \ 'args_after': '--report=csv' }) let errorformat = - \ '%-GFile\,Line\,Column\,Type\,Message\,Source\,Severity,'. - \ '"%f"\,%l\,%v\,%t%*[a-zA-Z]\,"%m"\,%*[a-zA-Z0-9_.-]\,%*[0-9]' + \ '%-GFile\,Line\,Column\,Type\,Message\,Source\,Severity%.%#,'. + \ '"%f"\,%l\,%v\,%t%*[a-zA-Z]\,"%m"\,%*[a-zA-Z0-9_.-]\,%*[0-9]%.%#' return SyntasticMake({ \ 'makeprg': makeprg, diff --git a/sources_non_forked/syntastic/syntax_checkers/puppet/puppetlint.vim b/sources_non_forked/syntastic/syntax_checkers/puppet/puppetlint.vim index 2a32a8fa..ff4ba071 100644 --- a/sources_non_forked/syntastic/syntax_checkers/puppet/puppetlint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/puppet/puppetlint.vim @@ -18,11 +18,6 @@ let g:loaded_syntastic_puppet_puppetlint_checker = 1 let s:save_cpo = &cpo set cpo&vim -if exists("g:syntastic_puppet_lint_arguments") - let g:syntastic_puppet_puppetlint_args = g:syntastic_puppet_lint_arguments - call syntastic#log#deprecationWarn("variable g:syntastic_puppet_lint_arguments is deprecated, please use g:syntastic_puppet_puppetlint_args instead") -endif - function! SyntaxCheckers_puppet_puppetlint_IsAvailable() dict return \ executable("puppet") && @@ -32,6 +27,8 @@ function! SyntaxCheckers_puppet_puppetlint_IsAvailable() dict endfunction function! SyntaxCheckers_puppet_puppetlint_GetLocList() dict + call syntastic#log#deprecationWarn('puppet_lint_arguments', 'puppet_puppetlint_args') + let makeprg = self.makeprgBuild({ \ 'args_after': '--log-format "%{KIND} [%{check}] %{message} at %{fullpath}:%{linenumber}"' }) diff --git a/sources_non_forked/syntastic/syntax_checkers/python/flake8.vim b/sources_non_forked/syntastic/syntax_checkers/python/flake8.vim index 61d55cc9..ebc484f2 100644 --- a/sources_non_forked/syntastic/syntax_checkers/python/flake8.vim +++ b/sources_non_forked/syntastic/syntax_checkers/python/flake8.vim @@ -19,7 +19,8 @@ function! SyntaxCheckers_python_flake8_GetHighlightRegex(item) endfunction function! SyntaxCheckers_python_flake8_GetLocList() dict - let makeprg = self.makeprgBuild({}) + let makeprg = self.makeprgBuild({ + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') }) let errorformat = \ '%E%f:%l: could not compile,%-Z%p^,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/python/frosted.vim b/sources_non_forked/syntastic/syntax_checkers/python/frosted.vim index 5c47de5c..e96a8cc1 100644 --- a/sources_non_forked/syntastic/syntax_checkers/python/frosted.vim +++ b/sources_non_forked/syntastic/syntax_checkers/python/frosted.vim @@ -19,7 +19,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_python_frosted_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args_after': '-vb' }) + let makeprg = self.makeprgBuild({ + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'), + \ 'args_after': '-vb' }) let errorformat = \ '%f:%l:%c:%m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/python/pep257.vim b/sources_non_forked/syntastic/syntax_checkers/python/pep257.vim index 7bd2d91d..60cf916e 100644 --- a/sources_non_forked/syntastic/syntax_checkers/python/pep257.vim +++ b/sources_non_forked/syntastic/syntax_checkers/python/pep257.vim @@ -5,7 +5,7 @@ " " For details about pep257 see: https://github.com/GreenSteam/pep257 -if exists("g:loaded_syntastic_python_pep257_checker") +if exists('g:loaded_syntastic_python_pep257_checker') finish endif let g:loaded_syntastic_python_pep257_checker = 1 @@ -14,12 +14,24 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_python_pep257_GetLocList() dict - let makeprg = self.makeprgBuild({}) + if !exists('s:pep257_new') + let s:pep257_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion( + \ self.getExecEscaped() . ' --version'), [0, 3]) + endif - let errorformat = - \ '%E%f:%l:%c%\%.%\%.%\d%\+:%\d%\+: %m,' . - \ '%E%f:%l:%c: %m,' . - \ '%+C %m' + let makeprg = self.makeprgBuild({ + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') }) + + if s:pep257_new + let errorformat = + \ '%E%f:%l %.%#:,' . + \ '%+C %m' + else + let errorformat = + \ '%E%f:%l:%c%\%.%\%.%\d%\+:%\d%\+: %m,' . + \ '%E%f:%l:%c: %m,' . + \ '%+C %m' + endif let loclist = SyntasticMake({ \ 'makeprg': makeprg, @@ -28,10 +40,12 @@ function! SyntaxCheckers_python_pep257_GetLocList() dict \ 'preprocess': 'killEmpty', \ 'postprocess': ['compressWhitespace'] }) - " pep257 outputs byte offsets rather than column numbers - for e in loclist - let e['col'] = get(e, 'col', 0) + 1 - endfor + if s:pep257_new == 0 + " byte offsets rather than column numbers + for e in loclist + let e['col'] = get(e, 'col', 0) + 1 + endfor + endif return loclist endfunction diff --git a/sources_non_forked/syntastic/syntax_checkers/python/pep8.vim b/sources_non_forked/syntastic/syntax_checkers/python/pep8.vim index 310746b3..64c9e640 100644 --- a/sources_non_forked/syntastic/syntax_checkers/python/pep8.vim +++ b/sources_non_forked/syntastic/syntax_checkers/python/pep8.vim @@ -21,7 +21,8 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_python_pep8_GetLocList() dict - let makeprg = self.makeprgBuild({}) + let makeprg = self.makeprgBuild({ + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') }) let errorformat = '%f:%l:%c: %m' diff --git a/sources_non_forked/syntastic/syntax_checkers/python/py3kwarn.vim b/sources_non_forked/syntastic/syntax_checkers/python/py3kwarn.vim index 5ceb51ab..1a4465e0 100644 --- a/sources_non_forked/syntastic/syntax_checkers/python/py3kwarn.vim +++ b/sources_non_forked/syntastic/syntax_checkers/python/py3kwarn.vim @@ -14,7 +14,8 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_python_py3kwarn_GetLocList() dict - let makeprg = self.makeprgBuild({}) + let makeprg = self.makeprgBuild({ + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') }) let errorformat = '%W%f:%l:%c: %m' diff --git a/sources_non_forked/syntastic/syntax_checkers/python/pyflakes.vim b/sources_non_forked/syntastic/syntax_checkers/python/pyflakes.vim index 5903b2ef..351eb206 100644 --- a/sources_non_forked/syntastic/syntax_checkers/python/pyflakes.vim +++ b/sources_non_forked/syntastic/syntax_checkers/python/pyflakes.vim @@ -26,21 +26,22 @@ function! SyntaxCheckers_python_pyflakes_GetHighlightRegex(i) \ || stridx(a:i['text'], 'shadowed by loop variable') >= 0 " fun with Python's %r: try "..." first, then '...' - let terms = split(a:i['text'], '"', 1) - if len(terms) > 2 - return terms[1] + let term = matchstr(a:i['text'], '\m^.\{-}"\zs.\{-1,}\ze"') + if term != '' + return '\V\<' . escape(term, '\') . '\>' endif - let terms = split(a:i['text'], "'", 1) - if len(terms) > 2 - return terms[1] + let term = matchstr(a:i['text'], '\m^.\{-}''\zs.\{-1,}\ze''') + if term != '' + return '\V\<' . escape(term, '\') . '\>' endif endif return '' endfunction function! SyntaxCheckers_python_pyflakes_GetLocList() dict - let makeprg = self.makeprgBuild({}) + let makeprg = self.makeprgBuild({ + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') }) let errorformat = \ '%E%f:%l: could not compile,'. diff --git a/sources_non_forked/syntastic/syntax_checkers/python/pylama.vim b/sources_non_forked/syntastic/syntax_checkers/python/pylama.vim index 25219d77..b8611814 100644 --- a/sources_non_forked/syntastic/syntax_checkers/python/pylama.vim +++ b/sources_non_forked/syntastic/syntax_checkers/python/pylama.vim @@ -23,7 +23,9 @@ function! SyntaxCheckers_python_pylama_GetHighlightRegex(item) endfunction function! SyntaxCheckers_python_pylama_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args_after': '-f pep8' }) + let makeprg = self.makeprgBuild({ + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'), + \ 'args_after': '-f pep8' }) " TODO: "WARNING:pylama:..." messages are probably a logging bug let errorformat = diff --git a/sources_non_forked/syntastic/syntax_checkers/python/pylint.vim b/sources_non_forked/syntastic/syntax_checkers/python/pylint.vim index 4c4b88e0..131ca482 100644 --- a/sources_non_forked/syntastic/syntax_checkers/python/pylint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/python/pylint.vim @@ -23,6 +23,7 @@ endfunction function! SyntaxCheckers_python_pylint_GetLocList() dict let makeprg = self.makeprgBuild({ + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'), \ 'args_after': (s:pylint_new ? '-f text --msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg}" -r n' : '-f parseable -r n -i y') }) let errorformat = diff --git a/sources_non_forked/syntastic/syntax_checkers/python/python.vim b/sources_non_forked/syntastic/syntax_checkers/python/python.vim index eced4d30..e962065d 100644 --- a/sources_non_forked/syntastic/syntax_checkers/python/python.vim +++ b/sources_non_forked/syntastic/syntax_checkers/python/python.vim @@ -26,7 +26,9 @@ function! SyntaxCheckers_python_python_IsAvailable() dict endfunction function! SyntaxCheckers_python_python_GetLocList() dict - let makeprg = self.makeprgBuild({ 'exe': [self.getExec(), s:compiler] }) + let makeprg = self.makeprgBuild({ + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'), + \ 'exe': [self.getExec(), s:compiler] }) let errorformat = '%E%f:%l:%c: %m' diff --git a/sources_non_forked/syntastic/syntax_checkers/r/lint.vim b/sources_non_forked/syntastic/syntax_checkers/r/lint.vim index b0cae68d..9112905b 100644 --- a/sources_non_forked/syntastic/syntax_checkers/r/lint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/r/lint.vim @@ -39,8 +39,11 @@ function! SyntaxCheckers_r_lint_IsAvailable() dict endfunction function! SyntaxCheckers_r_lint_GetLocList() dict + let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : '' + let setwd = 'setwd("' . escape(getcwd(), '"\') . '"); ' let makeprg = self.getExecEscaped() . ' --slave --restore --no-save' . - \ ' -e ' . syntastic#util#shescape('library(lint); try(lint(commandArgs(TRUE), ' . g:syntastic_r_lint_styles . '))') . + \ ' -e ' . syntastic#util#shescape(setwd . 'library(lint); ' . + \ 'try(lint(commandArgs(TRUE), ' . g:syntastic_r_lint_styles . '))') . \ ' --args ' . syntastic#util#shexpand('%') let errorformat = diff --git a/sources_non_forked/syntastic/syntax_checkers/r/svtools.vim b/sources_non_forked/syntastic/syntax_checkers/r/svtools.vim index 1b15c693..ec924c38 100644 --- a/sources_non_forked/syntastic/syntax_checkers/r/svtools.vim +++ b/sources_non_forked/syntastic/syntax_checkers/r/svtools.vim @@ -51,8 +51,9 @@ function! SyntaxCheckers_r_svtools_GetLocList() dict return [] endif + let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : '' let makeprg = self.getExecEscaped() . ' --slave --restore --no-save' . - \ ' -e ' . syntastic#util#shescape('library(svTools); ' . + \ ' -e ' . syntastic#util#shescape(setwd . 'library(svTools); ' . \ 'try(lint(commandArgs(TRUE), filename = commandArgs(TRUE), type = "flat", sep = ":"))') . \ ' --args ' . syntastic#util#shexpand('%') diff --git a/sources_non_forked/syntastic/syntax_checkers/ruby/jruby.vim b/sources_non_forked/syntastic/syntax_checkers/ruby/jruby.vim index fc7ea63e..9dba591a 100644 --- a/sources_non_forked/syntastic/syntax_checkers/ruby/jruby.vim +++ b/sources_non_forked/syntastic/syntax_checkers/ruby/jruby.vim @@ -19,17 +19,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_ruby_jruby_GetLocList() dict - if syntastic#util#isRunningWindows() - let exe = self.getExecEscaped() - let args = '-T1' - else - let exe = 'RUBYOPT= ' . self.getExecEscaped() - let args = '' - endif - let makeprg = self.makeprgBuild({ - \ 'exe': exe, - \ 'args': args, + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'RUBYOPT='), + \ 'args': (syntastic#util#isRunningWindows() ? '-T1' : ''), \ 'args_after': '-W1 -c' }) let errorformat = diff --git a/sources_non_forked/syntastic/syntax_checkers/ruby/macruby.vim b/sources_non_forked/syntastic/syntax_checkers/ruby/macruby.vim index d66595ca..a5fc1c40 100644 --- a/sources_non_forked/syntastic/syntax_checkers/ruby/macruby.vim +++ b/sources_non_forked/syntastic/syntax_checkers/ruby/macruby.vim @@ -19,7 +19,7 @@ set cpo&vim function! SyntaxCheckers_ruby_macruby_GetLocList() dict let makeprg = self.makeprgBuild({ - \ 'exe': 'RUBYOPT= ' . self.getExecEscaped(), + \ 'exe_before': 'RUBYOPT=', \ 'args_after': '-W1 -c' }) let errorformat = diff --git a/sources_non_forked/syntastic/syntax_checkers/ruby/mri.vim b/sources_non_forked/syntastic/syntax_checkers/ruby/mri.vim index aa7de267..08af1b45 100644 --- a/sources_non_forked/syntastic/syntax_checkers/ruby/mri.vim +++ b/sources_non_forked/syntastic/syntax_checkers/ruby/mri.vim @@ -18,6 +18,13 @@ let g:loaded_syntastic_ruby_mri_checker = 1 let s:save_cpo = &cpo set cpo&vim +function! SyntaxCheckers_ruby_mri_IsAvailable() dict + if !exists('g:syntastic_ruby_mri_exec') && exists('g:syntastic_ruby_exec') + let g:syntastic_ruby_mri_exec = g:syntastic_ruby_exec + endif + return executable(self.getExec()) +endfunction + function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i) if stridx(a:i['text'], 'assigned but unused variable') >= 0 let term = split(a:i['text'], ' - ')[1] @@ -28,17 +35,8 @@ function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i) endfunction function! SyntaxCheckers_ruby_mri_GetLocList() dict - if !exists('g:syntastic_ruby_exec') - let g:syntastic_ruby_exec = self.getExec() - endif - - let exe = syntastic#util#shexpand(g:syntastic_ruby_exec) - if !syntastic#util#isRunningWindows() - let exe = 'RUBYOPT= ' . exe - endif - let makeprg = self.makeprgBuild({ - \ 'exe': exe, + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'RUBYOPT='), \ 'args_after': '-w -T1 -c' }) "this is a hack to filter out a repeated useless warning in rspec files diff --git a/sources_non_forked/syntastic/syntax_checkers/ruby/rubylint.vim b/sources_non_forked/syntastic/syntax_checkers/ruby/rubylint.vim index 02ed2f2f..07f0d4f0 100644 --- a/sources_non_forked/syntastic/syntax_checkers/ruby/rubylint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/ruby/rubylint.vim @@ -20,7 +20,11 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_ruby_rubylint_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args': 'analyze --presenter=syntastic' }) + if !exists('s:rubylint_new') + let s:rubylint_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion( + \ self.getExecEscaped() . ' --version'), [2]) + endif + let makeprg = self.makeprgBuild({ 'args': (s:rubylint_new ? '' : 'analyze ') . '--presenter=syntastic' }) let errorformat = '%f:%t:%l:%c: %m' diff --git a/sources_non_forked/syntastic/syntax_checkers/sass/sass.vim b/sources_non_forked/syntastic/syntax_checkers/sass/sass.vim index 353c1a93..a515fe5f 100644 --- a/sources_non_forked/syntastic/syntax_checkers/sass/sass.vim +++ b/sources_non_forked/syntastic/syntax_checkers/sass/sass.vim @@ -18,6 +18,7 @@ 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 let s:sass_cache_location = tempname() +lockvar s:sass_cache_location "By default do not check partials as unknown variables are a syntax error if !exists("g:syntastic_sass_check_partials") diff --git a/sources_non_forked/syntastic/syntax_checkers/rust/rustc.vim b/sources_non_forked/syntastic/syntax_checkers/sass/sassc.vim similarity index 57% rename from sources_non_forked/syntastic/syntax_checkers/rust/rustc.vim rename to sources_non_forked/syntastic/syntax_checkers/sass/sassc.vim index 97ef66a0..731d1789 100644 --- a/sources_non_forked/syntastic/syntax_checkers/rust/rustc.vim +++ b/sources_non_forked/syntastic/syntax_checkers/sass/sassc.vim @@ -1,7 +1,7 @@ "============================================================================ -"File: rust.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Chad Jablonski +"File: sassc.vim +"Description: Syntax checking plugin for syntastic +"Maintainer: LCD 47 "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You @@ -10,22 +10,18 @@ " "============================================================================ -if exists("g:loaded_syntastic_rust_rustc_checker") +if exists("g:loaded_syntastic_sass_sassc_checker") finish endif -let g:loaded_syntastic_rust_rustc_checker = 1 +let g:loaded_syntastic_sass_sassc_checker = 1 let s:save_cpo = &cpo set cpo&vim -function! SyntaxCheckers_rust_rustc_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args_after': '--no-trans' }) +function! SyntaxCheckers_sass_sassc_GetLocList() dict + let makeprg = self.makeprgBuild({ 'fname_after': syntastic#util#DevNull() }) - let errorformat = - \ '%E%f:%l:%c: %\d%#:%\d%# %.%\{-}error:%.%\{-} %m,' . - \ '%W%f:%l:%c: %\d%#:%\d%# %.%\{-}warning:%.%\{-} %m,' . - \ '%C%f:%l %m,' . - \ '%-Z%.%#' + let errorformat = '%f:%l: %trror: %m' return SyntasticMake({ \ 'makeprg': makeprg, @@ -33,8 +29,8 @@ function! SyntaxCheckers_rust_rustc_GetLocList() dict endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'rust', - \ 'name': 'rustc'}) + \ 'filetype': 'sass', + \ 'name': 'sassc'}) let &cpo = s:save_cpo unlet s:save_cpo diff --git a/sources_non_forked/syntastic/syntax_checkers/scala/fsc.vim b/sources_non_forked/syntastic/syntax_checkers/scala/fsc.vim index 92912423..6f1fcf6d 100644 --- a/sources_non_forked/syntastic/syntax_checkers/scala/fsc.vim +++ b/sources_non_forked/syntastic/syntax_checkers/scala/fsc.vim @@ -15,19 +15,16 @@ if exists('g:loaded_syntastic_scala_fsc_checker') endif let g:loaded_syntastic_scala_fsc_checker = 1 -if !exists('g:syntastic_scala_options') - let g:syntastic_scala_options = '' -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_scala_fsc_GetLocList() dict + call syntastic#log#deprecationWarn('scala_options', 'scala_fsc_args') + " fsc has some serious problems with the " working directory changing after being started " that's why we better pass an absolute path let makeprg = self.makeprgBuild({ - \ 'args': g:syntastic_scala_options, \ 'args_after': '-Ystop-after:parser', \ 'fname': syntastic#util#shexpand('%:p') }) diff --git a/sources_non_forked/syntastic/syntax_checkers/scala/scalac.vim b/sources_non_forked/syntastic/syntax_checkers/scala/scalac.vim index ea465f08..0d0c15aa 100644 --- a/sources_non_forked/syntastic/syntax_checkers/scala/scalac.vim +++ b/sources_non_forked/syntastic/syntax_checkers/scala/scalac.vim @@ -15,17 +15,13 @@ if exists("g:loaded_syntastic_scala_scalac_checker") endif let g:loaded_syntastic_scala_scalac_checker = 1 -if !exists('g:syntastic_scala_options') - let g:syntastic_scala_options = '' -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_scala_scalac_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'args': g:syntastic_scala_options, - \ 'args_after': '-Ystop-after:parser' }) + call syntastic#log#deprecationWarn('scala_options', 'scala_scalac_args') + + let makeprg = self.makeprgBuild({ 'args_after': '-Ystop-after:parser' }) let errorformat = \ '%E%f:%l: %trror: %m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/scss/sass.vim b/sources_non_forked/syntastic/syntax_checkers/scss/sass.vim index 61bd6de7..0f837ca5 100644 --- a/sources_non_forked/syntastic/syntax_checkers/scss/sass.vim +++ b/sources_non_forked/syntastic/syntax_checkers/scss/sass.vim @@ -1,4 +1,3 @@ - "============================================================================ "File: scss.vim "Description: scss syntax checking plugin for syntastic diff --git a/sources_non_forked/syntastic/syntax_checkers/scss/sassc.vim b/sources_non_forked/syntastic/syntax_checkers/scss/sassc.vim new file mode 100644 index 00000000..75fdc2aa --- /dev/null +++ b/sources_non_forked/syntastic/syntax_checkers/scss/sassc.vim @@ -0,0 +1,25 @@ +"============================================================================ +"File: sassc.vim +"Description: Syntax checking plugin for syntastic +"Maintainer: LCD 47 +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_scss_sassc_checker") + finish +endif +let g:loaded_syntastic_scss_sassc_checker = 1 + +runtime! syntax_checkers/sass/*.vim + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'scss', + \ 'name': 'sassc', + \ 'redirect': 'sass/sassc'}) + +" vim: set et sts=4 sw=4: diff --git a/sources_non_forked/syntastic/syntax_checkers/sh/sh.vim b/sources_non_forked/syntastic/syntax_checkers/sh/sh.vim index 0cae2429..d736f296 100644 --- a/sources_non_forked/syntastic/syntax_checkers/sh/sh.vim +++ b/sources_non_forked/syntastic/syntax_checkers/sh/sh.vim @@ -18,41 +18,6 @@ let g:loaded_syntastic_sh_sh_checker = 1 let s:save_cpo = &cpo set cpo&vim -function! s:GetShell() - if !exists('b:shell') || b:shell == '' - let b:shell = '' - let shebang = getbufline(bufnr('%'), 1)[0] - if shebang != '' - if stridx(shebang, 'bash') >= 0 - let b:shell = 'bash' - elseif stridx(shebang, 'zsh') >= 0 - let b:shell = 'zsh' - elseif stridx(shebang, 'sh') >= 0 - let b:shell = 'sh' - endif - endif - " try to use env variable in case no shebang could be found - if b:shell == '' - let b:shell = fnamemodify(expand('$SHELL'), ':t') - endif - endif - return b:shell -endfunction - -function! s:ForwardToZshChecker() - let registry = g:SyntasticRegistry.Instance() - if registry.isCheckable('zsh') - return registry.getCheckers('zsh', ['zsh'])[0].getLocListRaw() - else - return [] - endif -endfunction - -function! s:IsShellValid() - return len(s:GetShell()) > 0 && executable(s:GetShell()) -endfunction - - function! SyntaxCheckers_sh_sh_IsAvailable() dict return s:IsShellValid() endfunction @@ -77,6 +42,42 @@ function! SyntaxCheckers_sh_sh_GetLocList() dict \ 'errorformat': errorformat }) endfunction +function! s:GetShell() + if !exists('b:shell') || b:shell == '' + let b:shell = '' + let shebang = syntastic#util#parseShebang()['exe'] + if shebang != '' + if shebang[-strlen('bash'):-1] ==# 'bash' + let b:shell = 'bash' + elseif shebang[-strlen('zsh'):-1] ==# 'zsh' + let b:shell = 'zsh' + elseif shebang[-strlen('sh'):-1] ==# 'sh' + let b:shell = 'sh' + endif + endif + " try to use env variable in case no shebang could be found + if b:shell == '' + let b:shell = fnamemodify(expand('$SHELL'), ':t') + endif + endif + return b:shell +endfunction + +function! s:IsShellValid() + let shell = s:GetShell() + return shell != '' && executable(shell) +endfunction + +function! s:ForwardToZshChecker() + let registry = g:SyntasticRegistry.Instance() + let zsh_checkers = registry.getCheckersAvailable('zsh', ['zsh']) + if !empty(zsh_checkers) + return zsh_checkers[0].getLocListRaw() + else + return [] + endif +endfunction + call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'sh', \ 'name': 'sh' }) diff --git a/sources_non_forked/syntastic/syntax_checkers/typescript/tslint.vim b/sources_non_forked/syntastic/syntax_checkers/typescript/tslint.vim new file mode 100644 index 00000000..80ca8817 --- /dev/null +++ b/sources_non_forked/syntastic/syntax_checkers/typescript/tslint.vim @@ -0,0 +1,46 @@ +"============================================================================ +"File: typescript/tslint.vim +"Description: TypeScript linter +"Maintainer: Seon-Wook Park +"============================================================================ + +if exists("g:loaded_syntastic_typescript_tslint_checker") + finish +endif +let g:loaded_syntastic_typescript_tslint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_typescript_tslint_GetHighlightRegex(item) + let term = matchstr(a:item['text'], "\\m\\s'\\zs.\\{-}\\ze'\\s") + return term != '' ? '\V' . escape(term, '\') : '' +endfunction + +function! SyntaxCheckers_typescript_tslint_GetLocList() dict + let makeprg = self.makeprgBuild({ + \ 'args_after': '--format verbose', + \ 'fname_before': '-f' }) + + " (comment-format) ts/app.ts[12, 36]: comment must start with lowercase letter + let errorformat = '%f[%l\, %c]: %m' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'preprocess': 'tslint', + \ 'returns': [0, 2] }) + + call self.setWantSort(1) + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'typescript', + \ 'name': 'tslint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/sources_non_forked/syntastic/syntax_checkers/vala/valac.vim b/sources_non_forked/syntastic/syntax_checkers/vala/valac.vim index e6c1b88d..912e298d 100644 --- a/sources_non_forked/syntastic/syntax_checkers/vala/valac.vim +++ b/sources_non_forked/syntastic/syntax_checkers/vala/valac.vim @@ -37,7 +37,7 @@ set cpo&vim function! SyntaxCheckers_vala_valac_GetHighlightRegex(pos) let length = strlen(matchstr(a:pos['text'], '\m\^\+$')) - return '\%>' . (a:pos['col'] - 1) . 'c.*\%<' . (a:pos['col'] + length + 1) . 'c' + return '\%>' . (a:pos['col'] - 1) . 'c\%<' . (a:pos['col'] + length) . 'c' endfunction function! s:GetValaModules() diff --git a/sources_non_forked/syntastic/syntax_checkers/vhdl/ghdl.vim b/sources_non_forked/syntastic/syntax_checkers/vhdl/ghdl.vim index f101d37f..ff02224a 100644 --- a/sources_non_forked/syntastic/syntax_checkers/vhdl/ghdl.vim +++ b/sources_non_forked/syntastic/syntax_checkers/vhdl/ghdl.vim @@ -19,7 +19,7 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_vhdl_ghdl_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args_after': '-s' }) + let makeprg = self.makeprgBuild({ 'args_before': '-s' }) let errorformat = '%f:%l:%c: %m' diff --git a/sources_non_forked/syntastic/syntax_checkers/vim/vimlint.vim b/sources_non_forked/syntastic/syntax_checkers/vim/vimlint.vim index 49a6ecd3..309e5878 100644 --- a/sources_non_forked/syntastic/syntax_checkers/vim/vimlint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/vim/vimlint.vim @@ -29,7 +29,7 @@ function! SyntaxCheckers_vim_vimlint_GetHighlightRegex(item) endif endif - return '\V' . (col ? '\%' . col . 'c' : '') . escape(term, '\') + return col ? '\%>' . (col - 1) . 'c\%<' . (col + strlen(term)) . 'c' : '\V' . escape(term, '\') endif return '' @@ -81,7 +81,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'vim', - \ 'name': 'vimlint'}) + \ 'name': 'vimlint', + \ 'exec': 'vim' }) let &cpo = s:save_cpo unlet s:save_cpo diff --git a/sources_non_forked/syntastic/syntax_checkers/yaml/yamlxs.vim b/sources_non_forked/syntastic/syntax_checkers/yaml/yamlxs.vim index e9d33771..6c12a627 100644 --- a/sources_non_forked/syntastic/syntax_checkers/yaml/yamlxs.vim +++ b/sources_non_forked/syntastic/syntax_checkers/yaml/yamlxs.vim @@ -24,19 +24,18 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_yaml_yamlxs_IsAvailable() dict - if !exists('g:syntastic_perl_interpreter') - let g:syntastic_perl_interpreter = self.getExec() + if !exists('g:syntastic_yaml_yamlxs_exec') && exists('g:syntastic_perl_interpreter') + let g:syntastic_yaml_yamlxs_exec = g:syntastic_perl_interpreter endif " don't call executable() here, to allow things like " let g:syntastic_perl_interpreter='/usr/bin/env perl' - silent! call system(s:Exe() . ' ' . s:Modules() . ' -e ' . syntastic#util#shescape('exit(0)')) + silent! call system(self.getExecEscaped() . ' ' . s:Modules() . ' -e ' . syntastic#util#shescape('exit(0)')) return v:shell_error == 0 endfunction function! SyntaxCheckers_yaml_yamlxs_GetLocList() dict let makeprg = self.makeprgBuild({ - \ 'exe': s:Exe(), \ 'args_before': s:Modules() . ' -e ' . syntastic#util#shescape('YAML::XS::LoadFile($ARGV[0])') }) let errorformat = @@ -53,13 +52,9 @@ function! SyntaxCheckers_yaml_yamlxs_GetLocList() dict \ 'defaults': {'bufnr': bufnr("")} }) endfunction -function! s:Exe() - return syntastic#util#shexpand(g:syntastic_perl_interpreter) -endfunction - function s:Modules() if type(g:syntastic_perl_lib_path) == type('') - call syntastic#log#deprecationWarn('variable g:syntastic_perl_lib_path should be a list') + 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')) diff --git a/sources_non_forked/syntastic/syntax_checkers/z80/z80syntaxchecker.vim b/sources_non_forked/syntastic/syntax_checkers/z80/z80syntaxchecker.vim index bbf3e48d..6a3998a3 100644 --- a/sources_non_forked/syntastic/syntax_checkers/z80/z80syntaxchecker.vim +++ b/sources_non_forked/syntastic/syntax_checkers/z80/z80syntaxchecker.vim @@ -14,7 +14,7 @@ " - Install this python package: " https://github.com/rgiot/pycpcdemotools " - Copy/paste this script in your search path: -" https://raw.github.com/rgiot/pycpcdemotools/master/cpcdemotools/source_checker/z80_syntax_checker.py +" https://raw.githubusercontent.com/rgiot/pycpcdemotools/master/cpcdemotools/source_checker/z80_syntax_checker.py if exists("g:loaded_syntastic_z80_z80syntaxchecker_checker") finish diff --git a/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim b/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim index beb04943..568a4f25 100644 --- a/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim +++ b/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2008-11-25. -" @Last Change: 2014-01-23. -" @Revision: 0.0.108 +" @Last Change: 2014-06-02. +" @Revision: 0.0.109 let s:prototype = tlib#Object#New({'_class': ['Filter_cnf'], 'name': 'cnf'}) "{{{2 let s:prototype.highlight = g:tlib#input#higroup @@ -57,28 +57,6 @@ function! s:prototype.AssessName(world, name) dict "{{{3 elseif a:name =~ '\A'. flt .'\|'. flt .'\A' let xa += 1 endif - - " if a:name =~ '\^'. flt .'\|'. flt .'\$' - " let xa += 4 - " elseif a:name =~ '\<'. flt .'\|'. flt .'\>' - " let xa += 3 - " " elseif a:name =~ flt .'\>' - " " let xa += 2 - " elseif a:name =~ '\A'. flt .'\|'. flt .'\A' - " let xa += 1 - " endif - " if flt[0] =~# '\u' && matchstr(a:name, '\V\.\ze'. flt) =~# '\U' - " let xa += 1 - " endif - " if flt[0] =~# '\U' && matchstr(a:name, '\V\.\ze'. flt) =~# '\u' - " let xa += 1 - " endif - " if flt[-1] =~# '\u' && matchstr(a:name, '\V'. flt .'\zs\.') =~# '\U' - " let xa += 1 - " endif - " if flt[-1] =~# '\U' && matchstr(a:name, '\V'. flt .'\zs\.') =~# '\u' - " let xa += 1 - " endif endfor " TLogVAR a:name, xa return xa diff --git a/sources_non_forked/tlib/autoload/tlib/World.vim b/sources_non_forked/tlib/autoload/tlib/World.vim index ccccf639..b6a8581d 100644 --- a/sources_non_forked/tlib/autoload/tlib/World.vim +++ b/sources_non_forked/tlib/autoload/tlib/World.vim @@ -1,7 +1,7 @@ " @Author: Tom Link (micathom AT gmail com?subject=[vim]) " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Revision: 1391 +" @Revision: 1393 " :filedoc: " A prototype used by |tlib#input#List|. @@ -500,6 +500,7 @@ function! s:prototype.SetPrefIdx() dict "{{{3 let pref_idx = -1 let pref_weight = -1 " TLogVAR self.filter_pos, self.filter_neg + " let t0 = localtime() " DBG for idx in range(1, self.llen) let item = self.GetItem(idx) let weight = self.matcher.AssessName(self, item) @@ -509,6 +510,7 @@ function! s:prototype.SetPrefIdx() dict "{{{3 let pref_weight = weight endif endfor + " TLogVAR localtime() - t0 " TLogVAR pref_idx " TLogDBG self.GetItem(pref_idx) if pref_idx == -1 diff --git a/sources_non_forked/tlib/autoload/tlib/string.vim b/sources_non_forked/tlib/autoload/tlib/string.vim index 8c077cd4..d2ca319b 100644 --- a/sources_non_forked/tlib/autoload/tlib/string.vim +++ b/sources_non_forked/tlib/autoload/tlib/string.vim @@ -4,7 +4,7 @@ " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-06-30. " @Last Change: 2009-02-15. -" @Revision: 0.0.110 +" @Revision: 0.0.115 if &cp || exists("loaded_tlib_string_autoload") finish @@ -23,8 +23,10 @@ function! tlib#string#RemoveBackslashes(text, ...) "{{{3 endf -function! tlib#string#Chomp(string) "{{{3 - return substitute(a:string, '[[:cntrl:][:space:]]*$', '', '') +" :display: tlib#string#Chomp(string, ?max=0) +function! tlib#string#Chomp(string, ...) "{{{3 + let quant = a:0 >= 1 ? '\{,'. a:1 .'}' : '\+' + return substitute(a:string, '[[:cntrl:][:space:]]'. quant .'$', '', '') endf diff --git a/sources_non_forked/tlib/doc/tlib.txt b/sources_non_forked/tlib/doc/tlib.txt index b92c0c2c..9c509b3a 100644 --- a/sources_non_forked/tlib/doc/tlib.txt +++ b/sources_non_forked/tlib/doc/tlib.txt @@ -2066,7 +2066,7 @@ tlib#string#RemoveBackslashes(text, ?chars=' ') chars). *tlib#string#Chomp()* -tlib#string#Chomp(string) +tlib#string#Chomp(string, ?max=0) *tlib#string#Format()* tlib#string#Format(template, dict) @@ -2092,4 +2092,4 @@ tlib#string#Count(string, rx) -vim:tw=78:fo=tcq2:isk=!-~,^*,^|,^":ts=8:ft=help:norl: +vim:tw=78:fo=w2croql:isk=!-~,^*,^|,^":ts=8:ft=help:norl: diff --git a/sources_non_forked/tlib/plugin/02tlib.vim b/sources_non_forked/tlib/plugin/02tlib.vim index 7fd693e8..78a8818e 100644 --- a/sources_non_forked/tlib/plugin/02tlib.vim +++ b/sources_non_forked/tlib/plugin/02tlib.vim @@ -2,7 +2,7 @@ " @Created: 2007-04-10. " @Last Change: 2013-09-25. " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Revision: 750 +" @Revision: 751 " @Website: http://www.vim.org/account/profile.php?user_id=4037 " GetLatestVimScripts: 1863 1 tlib.vim " tlib.vim -- Some utility functions @@ -14,7 +14,7 @@ if v:version < 700 "{{{2 echoerr "tlib requires Vim >= 7" finish endif -let loaded_tlib = 109 +let loaded_tlib = 110 let s:save_cpo = &cpo set cpo&vim diff --git a/sources_non_forked/vim-airline/README.md b/sources_non_forked/vim-airline/README.md index 22d06872..b98e3485 100644 --- a/sources_non_forked/vim-airline/README.md +++ b/sources_non_forked/vim-airline/README.md @@ -121,7 +121,7 @@ This plugin follows the standard runtime path structure, and as such it can be i * [NeoBundle][12] * `NeoBundle 'bling/vim-airline'` * [Vundle][13] - * `Bundle 'bling/vim-airline'` + * `Plugin 'bling/vim-airline'` * [VAM][22] * `call vam#ActivateAddons([ 'vim-airline' ])` * manual diff --git a/sources_non_forked/vim-airline/autoload/airline.vim b/sources_non_forked/vim-airline/autoload/airline.vim index de66fbac..b4a88817 100644 --- a/sources_non_forked/vim-airline/autoload/airline.vim +++ b/sources_non_forked/vim-airline/autoload/airline.vim @@ -148,16 +148,18 @@ function! airline#check_mode(winnr) let w:airline_current_mode = get(g:airline_mode_map, '__') endif - if g:airline_detect_modified - if &modified - call add(l:mode, 'modified') - endif + if g:airline_detect_modified && &modified + call add(l:mode, 'modified') endif if g:airline_detect_paste && &paste call add(l:mode, 'paste') endif + if &readonly + call add(l:mode, 'readonly') + endif + let mode_string = join(l:mode) if get(w:, 'airline_lastmode', '') != mode_string call airline#highlighter#highlight_modified_inactive(context.bufnr) diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions.vim b/sources_non_forked/vim-airline/autoload/airline/extensions.vim index e07bd607..c6408d56 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions.vim @@ -148,7 +148,7 @@ function! airline#extensions#load() endif if (get(g:, 'airline#extensions#hunks#enabled', 1) && get(g:, 'airline_enable_hunks', 1)) - \ && (exists('g:loaded_signify') || exists('g:loaded_gitgutter')) + \ && (exists('g:loaded_signify') || exists('g:loaded_gitgutter') || exists('g:loaded_changes')) call airline#extensions#hunks#init(s:ext) endif @@ -207,22 +207,28 @@ function! airline#extensions#load() call airline#extensions#promptline#init(s:ext) endif - " Load all other extensions, which are not part of the default distribution. - " (autoload/airline/extensions/*.vim outside of our s:script_path). - for file in split(globpath(&rtp, "autoload/airline/extensions/*.vim"), "\n") - " we have to check both resolved and unresolved paths, since it's possible - " that they might not get resolved properly (see #187) - if stridx(tolower(resolve(fnamemodify(file, ':p'))), s:script_path) < 0 - \ && stridx(tolower(fnamemodify(file, ':p')), s:script_path) < 0 - let name = fnamemodify(file, ':t:r') - if !get(g:, 'airline#extensions#'.name.'#enabled', 1) - continue + if get(g:, 'airline#extensions#nrrwrgn#enabled', 1) && exists(':NR') == 2 + call airline#extensions#nrrwrgn#init(s:ext) + endif + + if !get(g:, 'airline#extensions#disable_rtp_load', 0) + " load all other extensions, which are not part of the default distribution. + " (autoload/airline/extensions/*.vim outside of our s:script_path). + for file in split(globpath(&rtp, "autoload/airline/extensions/*.vim"), "\n") + " we have to check both resolved and unresolved paths, since it's possible + " that they might not get resolved properly (see #187) + if stridx(tolower(resolve(fnamemodify(file, ':p'))), s:script_path) < 0 + \ && stridx(tolower(fnamemodify(file, ':p')), s:script_path) < 0 + let name = fnamemodify(file, ':t:r') + if !get(g:, 'airline#extensions#'.name.'#enabled', 1) + continue + endif + try + call airline#extensions#{name}#init(s:ext) + catch + endtry endif - try - call airline#extensions#{name}#init(s:ext) - catch - endtry - endif - endfor + endfor + endif endfunction diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/branch.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/branch.vim index 12be43fd..954b0f68 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/branch.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/branch.vim @@ -42,7 +42,7 @@ function! airline#extensions#branch#head() let b:airline_head = fugitive#head() if empty(b:airline_head) && !exists('b:git_dir') - let b:airline_head = s:get_git_branch(getcwd()) + let b:airline_head = s:get_git_branch(expand("%:p:h")) endif endif @@ -65,6 +65,13 @@ function! airline#extensions#branch#head() let b:airline_head = '' endif + if exists("g:airline#extensions#branch#displayed_head_limit") + let w:displayed_head_limit = g:airline#extensions#branch#displayed_head_limit + if len(b:airline_head) > w:displayed_head_limit - 1 + let b:airline_head = b:airline_head[0:w:displayed_head_limit - 1].'…' + endif + endif + return b:airline_head endfunction diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/hunks.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/hunks.vim index 6827f5d7..968fd66f 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/hunks.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/hunks.vim @@ -1,7 +1,7 @@ " MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 -if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0) +if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0) && !get(g:, 'loaded_changes', 0) finish endif @@ -27,6 +27,19 @@ function! s:get_hunks_gitgutter() return GitGutterGetHunkSummary() endfunction +function! s:get_hunks_changes() + if !get(b:, 'changes_view_enabled', 0) || s:is_branch_empty() + return [] + endif + let hunks = changes#GetStats() + for i in hunks + if i > 0 + return hunks + endif + endfor + return [] +endfunction + function! s:get_hunks_empty() return '' endfunction @@ -38,6 +51,8 @@ function! s:get_hunks() let s:source_func = 's:get_hunks_signify' elseif exists('*GitGutterGetHunkSummary') let s:source_func = 's:get_hunks_gitgutter' + elseif exists('*changes#GetStats') + let s:source_func = 's:get_hunks_changes' else let s:source_func = 's:get_hunks_empty' endif diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/nrrwrgn.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/nrrwrgn.vim new file mode 100644 index 00000000..338f6e05 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/nrrwrgn.vim @@ -0,0 +1,54 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !get(g:, 'loaded_nrrw_rgn', 0) + finish +endif + +function! airline#extensions#nrrwrgn#apply(...) + if exists(":WidenRegion") == 2 + let spc = g:airline_symbols.space + if !exists("*nrrwrgn#NrrwRgnStatus()") || empty(nrrwrgn#NrrwRgnStatus()) + call a:1.add_section('airline_a', printf('%s[Narrowed%s#%d]', spc, spc, b:nrrw_instn)) + let bufname=(get(b:, 'orig_buf', 0) ? bufname(b:orig_buf) : substitute(bufname('%'), '^Nrrwrgn_\zs.*\ze_\d\+$', submatch(0), '')) + call a:1.add_section('airline_c', spc.bufname.spc) + call a:1.split() + else + let dict=nrrwrgn#NrrwRgnStatus() + let vmode = { 'v': 'Char ', 'V': 'Line ', '': 'Block '} + let mode = dict.visual ? vmode[dict.visual] : vmode['V'] + let winwidth = winwidth(0) + if winwidth < 80 + let mode = mode[0] + endif + let title = (winwidth < 80 ? "Nrrw" : "Narrowed ") + let multi = (winwidth < 80 ? 'M' : 'Multi') + call a:1.add_section('airline_a', printf('[%s%s%s#%d]%s', (dict.multi ? multi : ""), + \ title, mode, b:nrrw_instn, spc)) + let name = dict.fullname + if name !=# '[No Name]' + if winwidth > 100 + " need some space + let name = fnamemodify(dict.fullname, ':~') + if strlen(name) > 8 + " shorten name + let name = substitute(name, '\(.\)[^/\\]*\([/\\]\)', '\1\2', 'g') + endif + else + let name = fnamemodify(dict.fullname, ':t') + endif + endif + let range=(dict.multi ? '' : printf("[%d-%d]", dict.start[1], dict.end[1])) + call a:1.add_section('airline_c', printf("%s %s %s", name, range, dict.enabled ? "\u2713" : '!')) + call a:1.split() + call a:1.add_section('airline_x', get(g:, 'airline_section_x').spc) + call a:1.add_section('airline_y', spc.get(g:, 'airline_section_y').spc) + call a:1.add_section('airline_z', spc.get(g:, 'airline_section_z')) + endif + return 1 + endif +endfunction + +function! airline#extensions#nrrwrgn#init(ext) + call a:ext.add_statusline_func('airline#extensions#nrrwrgn#apply') +endfunction diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/unique_tail_improved.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/unique_tail_improved.vim index 6b13dcf0..3590fbb5 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/unique_tail_improved.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/unique_tail_improved.vim @@ -14,9 +14,9 @@ function! airline#extensions#tabline#unique_tail_improved#format(bufnr, buffers) for nr in a:buffers let name = bufname(nr) - if !empty(name) && nr != a:bufnr && fnamemodify(name, ':t') == curbuf_tail + if !empty(name) && nr != a:bufnr && fnamemodify(name, ':t') == curbuf_tail " only perform actions if curbuf_tail isn't unique let do_deduplicate = 1 - let tokens = reverse(split(substitute(fnamemodify(name, ':p:.:h'), '\\', '/', 'g'), '/')) + let tokens = reverse(split(substitute(fnamemodify(name, ':p:h'), '\\', '/', 'g'), '/')) let token_index = 0 for token in tokens if token == '' | continue | endif @@ -33,7 +33,7 @@ function! airline#extensions#tabline#unique_tail_improved#format(bufnr, buffers) if do_deduplicate == 1 let path = [] let token_index = 0 - for token in reverse(split(substitute(fnamemodify(bufname(a:bufnr), ':p:.:h'), '\\', '/', 'g'), '/')) + for token in reverse(split(substitute(fnamemodify(bufname(a:bufnr), ':p:h'), '\\', '/', 'g'), '/')) if token == '.' | break | endif let duplicated = 0 let uniq = 1 diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/whitespace.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/whitespace.vim index 9dd0cd47..86574129 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/whitespace.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/whitespace.vim @@ -15,10 +15,25 @@ let s:default_checks = ['indent', 'trailing'] let s:trailing_format = get(g:, 'airline#extensions#whitespace#trailing_format', 'trailing[%s]') let s:mixed_indent_format = get(g:, 'airline#extensions#whitespace#mixed_indent_format', 'mixed-indent[%s]') +let s:indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0) let s:max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000) -let s:enabled = 1 +let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1) + +function! s:check_mixed_indent() + if s:indent_algo == 1 + " [] + " spaces before or between tabs are not allowed + let t_s_t = '(^\t* +\t\s*\S)' + " ( x count) + " count of spaces at the end of tabs should be less then tabstop value + let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)' + return search('\v' . t_s_t . '|' . t_l_s, 'nw') + else + return search('\v(^\t+ +)|(^ +\t+)', 'nw') + endif +endfunction function! airline#extensions#whitespace#check() if &readonly || !&modifiable || !s:enabled || line('$') > s:max_lines @@ -36,13 +51,7 @@ function! airline#extensions#whitespace#check() let mixed = 0 if index(checks, 'indent') > -1 - " [] - " Spaces before or between tabs are not allowed - let t_s_t = '(^\t* +\t\s*\S)' - " ( x count) - " Count of spaces at the end of tabs should be less then tabstop value - let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)' - let mixed = search('\v' . t_s_t . '|' . t_l_s, 'nw') + let mixed = s:check_mixed_indent() endif if trailing != 0 || mixed != 0 @@ -62,13 +71,23 @@ endfunction! function! airline#extensions#whitespace#toggle() if s:enabled - autocmd! airline_whitespace CursorHold,BufWritePost + augroup airline_whitespace + autocmd! + augroup END augroup! airline_whitespace let s:enabled = 0 else call airline#extensions#whitespace#init() let s:enabled = 1 endif + + if exists("g:airline#extensions#whitespace#enabled") + let g:airline#extensions#whitespace#enabled = s:enabled + if s:enabled && match(g:airline_section_warning, '#whitespace#check') < 0 + let g:airline_section_warning .= airline#section#create(['whitespace']) + call airline#update_statusline() + endif + endif echo 'Whitespace checking: '.(s:enabled ? 'Enabled' : 'Disabled') endfunction diff --git a/sources_non_forked/vim-airline/autoload/airline/highlighter.vim b/sources_non_forked/vim-airline/autoload/airline/highlighter.vim index 65a95cc9..17a6cf51 100644 --- a/sources_non_forked/vim-airline/autoload/airline/highlighter.vim +++ b/sources_non_forked/vim-airline/autoload/airline/highlighter.vim @@ -42,7 +42,10 @@ endfunction function! airline#highlighter#get_highlight(group, ...) let fg = s:get_syn(a:group, 'fg') let bg = s:get_syn(a:group, 'bg') - let reverse = synIDattr(synIDtrans(hlID(a:group)), 'reverse', has('gui_running') ? 'gui' : 'term') + let reverse = has('gui_running') + \ ? synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'gui') + \ : synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'cterm') + \|| synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'term') return reverse ? s:get_array(bg, fg, a:000) : s:get_array(fg, bg, a:000) endfunction diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/bubblegum.vim b/sources_non_forked/vim-airline/autoload/airline/themes/bubblegum.vim index d18e0324..b941eae7 100644 --- a/sources_non_forked/vim-airline/autoload/airline/themes/bubblegum.vim +++ b/sources_non_forked/vim-airline/autoload/airline/themes/bubblegum.vim @@ -54,7 +54,7 @@ let g:airline#themes#bubblegum#palette.visual = airline#themes#generate_color_ma let g:airline#themes#bubblegum#palette.visual_modified = copy(g:airline#themes#bubblegum#palette.insert_modified) " Inactive window -let s:IA = [s:gui_dark_gray, s:gui_med_gray_hi, s:cterm_dark_gray, s:cterm_med_gray_hi, ''] +let s:IA = [s:gui_light_gray, s:gui_med_gray_hi, s:cterm_light_gray, s:cterm_med_gray_hi, ''] let g:airline#themes#bubblegum#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) let g:airline#themes#bubblegum#palette.inactive_modified = { \ 'airline_c': [s:gui_orange, '', s:cterm_orange, '', ''], diff --git a/sources_non_forked/vim-airline/doc/airline.txt b/sources_non_forked/vim-airline/doc/airline.txt index 5a7df84d..1206a65a 100644 --- a/sources_non_forked/vim-airline/doc/airline.txt +++ b/sources_non_forked/vim-airline/doc/airline.txt @@ -217,6 +217,14 @@ EXTENSIONS *airline-extensions* Most extensions are enabled by default and lazily loaded when the corresponding plugin (if any) is detected. +By default, airline will attempt to load any extension it can find in the +'runtimepath'. On some systems this can result in an undersirable startup +cost. You can disable the check with the following flag. > + let g:airline#extensions#disable_rtp_load = 1 +< + Note: Third party plugins that rely on this behavior will be affected. You + will need to manually load them. + ------------------------------------- *airline-default* The default extension understands all of the `g:` variables in the |airline-configuration| section, however it also has some more fine-tuned @@ -228,7 +236,7 @@ configuration values that you can use. \ 'x': 60, \ 'y': 88, \ 'z': 45, - \ }) + \ } " Note: set to an empty dictionary to disable truncation. let g:airline#extensions#default#section_truncate_width = {} @@ -238,9 +246,8 @@ configuration values that you can use. let g:airline#extensions#default#layout = [ \ [ 'a', 'b', 'c' ], \ [ 'x', 'y', 'z', 'warning' ] - \ ]) + \ ] < - ------------------------------------- *airline-quickfix* The quickfix extension is a simple built-in extension which determines whether the buffer is a quickfix or location list buffer, and adjusts the @@ -275,7 +282,10 @@ vcscommand * use vcscommand.vim if available > let g:airline#extensions#branch#use_vcscommand = 0 -< + +* truncate long branch names to a fixed length > + let g:airline#extensions#branch#displayed_head_limit = 10 + ------------------------------------- *airline-syntastic* syntastic @@ -289,7 +299,7 @@ tagbar let g:airline#extensions#tagbar#enabled = 1 < * change how tags are displayed (:help tagbar-statusline) > - let g:airline#extensions#tagbar#flags = '' "default + let g:airline#extensions#tagbar#flags = '' (default) let g:airline#extensions#tagbar#flags = 'f' let g:airline#extensions#tagbar#flags = 's' let g:airline#extensions#tagbar#flags = 'p' @@ -307,6 +317,7 @@ csv.vim ------------------------------------- *airline-hunks* vim-gitgutter vim-signify +changesPlugin * enable/disable showing a summary of changed hunks under source control. > let g:airline#extensions#hunks#enabled = 1 @@ -349,6 +360,14 @@ eclim * enable/disable detection of whitespace errors. > let g:airline#extensions#whitespace#enabled = 1 < +* customize the type of mixed indent checking to perform. > + " must be all spaces or all tabs before the first non-whitespace character + let g:airline#extensions#whitespace#mixed_indent_algo = 0 (default) + + " certain number of spaces are allowed after tabs, but not in between + " this algorithm works well for /** */ style comments in a tab-indented file + let g:airline#extensions#whitespace#mixed_indent_algo = 1 +< * customize the whitespace symbol. > let g:airline#extensions#whitespace#symbol = '!' < @@ -477,6 +496,11 @@ promptline let airline#extensions#promptline#color_template = 'visual' let airline#extensions#promptline#color_template = 'replace' < +------------------------------------- *airline-nrrwrgn* +NrrwRgn + +* enable/disable NrrwRgn integration > + let g:airline#extensions#nrrwrgn#enabled = 1 ============================================================================== ADVANCED CUSTOMIZATION *airline-advanced-customization* diff --git a/sources_non_forked/vim-commentary/README.markdown b/sources_non_forked/vim-commentary/README.markdown index 84144237..a39b19c7 100644 --- a/sources_non_forked/vim-commentary/README.markdown +++ b/sources_non_forked/vim-commentary/README.markdown @@ -3,7 +3,9 @@ Comment stuff out. Use `gcc` to comment out a line (takes a count), `gc` to comment out the target of a motion (for example, `gcap` to comment out a paragraph), `gc` in visual mode to comment out the selection, -and `gc` in operator pending mode to target a comment. That's it. +and `gc` in operator pending mode to target a comment. You can also use +it as a command, either with a range like `:7,17Commentary`, or as part of a +`:global` invocation like with `:g/TODO/Commentary`. That's it. I wrote this because 5 years after Vim added support for mapping an operator, I still couldn't find a commenting plugin that leveraged that diff --git a/sources_non_forked/vim-commentary/doc/commentary.txt b/sources_non_forked/vim-commentary/doc/commentary.txt index 0e5fcf76..d6deed05 100644 --- a/sources_non_forked/vim-commentary/doc/commentary.txt +++ b/sources_non_forked/vim-commentary/doc/commentary.txt @@ -26,6 +26,9 @@ gc Text object for a comment (operator pending mode gcgc Uncomment the current and adjacent commented lines. gcu + *:Commentary* +:[range]Commentary Comment or uncomment [range] lines + The |User| CommentaryPost autocommand fires after a successful operation and can be used for advanced customization. diff --git a/sources_non_forked/vim-commentary/plugin/commentary.vim b/sources_non_forked/vim-commentary/plugin/commentary.vim index 0404e028..cce7b8ac 100644 --- a/sources_non_forked/vim-commentary/plugin/commentary.vim +++ b/sources_non_forked/vim-commentary/plugin/commentary.vim @@ -79,6 +79,7 @@ nnoremap CommentaryLine :set opfunc=goexe 'norm! ' onoremap Commentary :call textobject(0) nnoremap ChangeCommentary c:call textobject(1) nmap CommentaryUndo CommentaryCommentary +command! -range -bar Commentary call s:go(,) if 1 || !hasmapto('Commentary') || maparg('gc','n') ==# '' xmap gc Commentary diff --git a/sources_non_forked/vim-fugitive/README.markdown b/sources_non_forked/vim-fugitive/README.markdown index 68a61e6a..0c5b3071 100644 --- a/sources_non_forked/vim-fugitive/README.markdown +++ b/sources_non_forked/vim-fugitive/README.markdown @@ -11,8 +11,8 @@ Vim's diff handling capabilities to stage a subset of the file's changes. Bring up the output of `git status` with `:Gstatus`. Press `-` to -`add`/`reset` a file's changes, or `p` to `add`/`reset` `--patch` that -mofo. And guess what `:Gcommit` does! +`add`/`reset` a file's changes, or `p` to `add`/`reset` `--patch`. And guess +what `:Gcommit` does! `:Gblame` brings up an interactive vertical split with `git blame` output. Press enter on a line to edit the commit where the line diff --git a/sources_non_forked/vim-fugitive/doc/fugitive.txt b/sources_non_forked/vim-fugitive/doc/fugitive.txt index 58708377..0d186bff 100644 --- a/sources_non_forked/vim-fugitive/doc/fugitive.txt +++ b/sources_non_forked/vim-fugitive/doc/fugitive.txt @@ -55,7 +55,7 @@ that are part of Git repositories). p |:Git| add --patch p |:Git| reset --patch (staged files) q close status - R reload status + r reload status S |:Gvsplit| *fugitive-:Gcommit* @@ -63,12 +63,32 @@ that are part of Git repositories). to commit, |:Gstatus| is called instead. Unless the arguments given would skip the invocation of an editor (e.g., -m), a split window will be used to obtain a - commit message. Write and close that window (:wq or - |:Gwrite|) to finish the commit. Unlike when running - the actual git-commit command, it is possible (but - unadvisable) to muck with the index with commands like - git-add and git-reset while a commit message is - pending. + commit message, or a new tab if -v is given. Write + and close that window (:wq or |:Gwrite|) to finish the + commit. Unlike when running the actual git-commit + command, it is possible (but unadvisable) to alter the + index with commands like git-add and git-reset while a + commit message is pending. + + *fugitive-:Gmerge* +:Gmerge [args] Calls git-merge and loads errors and conflicted files + into the quickfix list. Opens a |:Gcommit| style + split window for the commit message if the merge + succeeds. If called during a merge conflict, the + conflicted files from the current index are loaded + into the quickfix list. + + *fugitive-:Gpull* +:Gpull [args] Like |:Gmerge|, but for git-pull. + + *fugitive-:Gpush* +:Gpush [args] Invoke git-push, load the results into the quickfix + list, and invoke |:cwindow| to reveal any errors. + |:Dispatch| is used if available for asynchronous + invocation. + + *fugitive-:Gfetch* +:Gfetch [args] Like |:Gpush|, but for git-fetch. *fugitive-:Ggrep* :Ggrep [args] |:grep| with git-grep as 'grepprg'. @@ -84,6 +104,11 @@ that are part of Git repositories). previous commits rather than previous file revisions are loaded. +:{range}Glog [args] Use git-log -L to load previous revisions of the given + range of the current file into the quickfix list. The + cursor is positioned on the first line of the first + diff hunk for each commit. + *fugitive-:Gllog* :Gllog [args] Like |:Glog|, but use the location list instead of the quickfix list. @@ -149,14 +174,16 @@ that are part of Git repositories). index is used (which means a three-way diff during a merge conflict, making it a git-mergetool alternative). The newer of the two files is placed - to the right. Use |do| and |dp| and write to the - index file to simulate "git add --patch". + to the right or bottom, depending on 'diffopt' and + the width of the window relative to 'textwidth'. Use + |do| and |dp| and write to the index file to simulate + "git add --patch". *fugitive-:Gsdiff* -:Gsdiff [revision] Like |:Gdiff|, but split horizontally. +:Gsdiff [revision] Like |:Gdiff|, but always split horizontally. *fugitive-:Gvdiff* -:Gvdiff [revision] Identical to |:Gdiff|. For symmetry with |:Gsdiff|. +:Gvdiff [revision] Like |:Gdiff|, but always split vertically. *fugitive-:Gmove* :Gmove {destination} Wrapper around git-mv that renames the buffer @@ -172,11 +199,10 @@ that are part of Git repositories). *fugitive-:Gblame* :Gblame [flags] Run git-blame on the file and open the results in a - scroll bound vertical split. Press enter on a line to - reblame the file as it was in that commit. You can - give any of ltfnsewMC as flags and they will be passed - along to git-blame. The following maps, which work on - the cursor line commit where sensible, are provided: + scroll bound vertical split. You can give any of + ltfnsewMC as flags and they will be passed along to + git-blame. The following maps, which work on the + cursor line commit where sensible, are provided: g? show this help A resize to end of author column diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index 2043dfec..7232066b 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -1,6 +1,6 @@ " fugitive.vim - A Git wrapper so awesome, it should be illegal " Maintainer: Tim Pope -" Version: 2.0 +" Version: 2.1 " GetLatestVimScripts: 2975 1 :AutoInstall: fugitive.vim if exists('g:loaded_fugitive') || &cp @@ -12,7 +12,7 @@ if !exists('g:fugitive_git_executable') let g:fugitive_git_executable = 'git' endif -" Utility {{{1 +" Section: Utility function! s:function(name) abort return function(substitute(a:name,'^s:',matchstr(expand(''), '\d\+_'),'')) @@ -26,10 +26,14 @@ function! s:gsub(str,pat,rep) abort return substitute(a:str,'\v\C'.a:pat,a:rep,'g') endfunction +function! s:winshell() abort + return &shell =~? 'cmd' || exists('+shellslash') && !&shellslash +endfunction + function! s:shellesc(arg) abort if a:arg =~ '^[A-Za-z0-9_/.-]\+$' return a:arg - elseif &shell =~# 'cmd' || &shell =~# 'power' + elseif s:winshell() return '"'.s:gsub(s:gsub(a:arg, '"', '""'), '\%', '"%"').'"' else return shellescape(a:arg) @@ -57,7 +61,7 @@ function! s:warn(str) abort endfunction function! s:shellslash(path) abort - if exists('+shellslash') && !&shellslash + if s:winshell() return s:gsub(a:path,'\\','/') else return a:path @@ -115,8 +119,7 @@ augroup END let s:abstract_prototype = {} -" }}}1 -" Initialization {{{1 +" Section: Initialization function! fugitive#is_git_dir(path) abort let path = s:sub(a:path, '[\/]$', '') . '/' @@ -202,8 +205,7 @@ augroup fugitive autocmd BufWinLeave * execute getwinvar(+bufwinnr(+expand('')), 'fugitive_leave') augroup END -" }}}1 -" Repository {{{1 +" Section: Repository let s:repo_prototype = {} let s:repos = {} @@ -442,8 +444,7 @@ endfunction call s:add_methods('repo',['keywordprg']) -" }}}1 -" Buffer {{{1 +" Section: Buffer let s:buffer_prototype = {} @@ -618,8 +619,7 @@ endfunction call s:add_methods('buffer',['getvar','setvar','getline','repo','type','spec','name','commit','path','rev','sha1','expand','containing_commit','up']) -" }}}1 -" Git {{{1 +" Section: Git call s:command("-bang -nargs=? -complete=customlist,s:GitComplete Git :execute s:Git(0,)") @@ -634,36 +634,37 @@ function! s:ExecuteInTree(cmd) abort endtry endfunction -function! s:Git(bang,cmd) abort +function! s:Git(bang, args) abort if a:bang - return s:Edit('edit',1,a:cmd) + return s:Edit('edit', 1, a:args) endif - let git = s:repo().git_command() + let git = g:fugitive_git_executable if has('gui_running') && !has('win32') let git .= ' --no-pager' endif - let cmd = matchstr(a:cmd,'\v\C.{-}%($|\\@ `=s:repo().bare() ? s:repo().dir() : s:repo().tree()`") call s:command("-bar -bang -nargs=? -complete=customlist,s:DirComplete Glcd :lcd `=s:repo().bare() ? s:repo().dir() : s:repo().tree()`") -" }}}1 -" Gstatus {{{1 +" Section: Gstatus call s:command("-bar Gstatus :execute s:Status()") augroup fugitive_status @@ -744,7 +744,7 @@ function! s:stage_info(lnum) abort return ['', ''] elseif (getline(lnum+1) =~# '^# .*\ '.filename) + endif +endfunction + function! s:StageDiff(diff) abort let [filename, section] = s:stage_info(line('.')) if filename ==# '' && section ==# 'staged' @@ -864,9 +886,6 @@ function! s:StageToggle(lnum1,lnum2) abort if filename ==# '' continue endif - if !exists('first_filename') - let first_filename = filename - endif execute lnum if filename =~ ' -> ' let cmd = ['mv','--'] + reverse(split(filename,' -> ')) @@ -880,6 +899,9 @@ function! s:StageToggle(lnum1,lnum2) abort else let cmd = ['add','-A','--',filename] endif + if !exists('first_filename') + let first_filename = filename + endif let output .= call(repo.git_chomp_in_tree,cmd,s:repo())."\n" endfor if exists('first_filename') @@ -938,28 +960,28 @@ function! s:StagePatch(lnum1,lnum2) abort return 'checktime' endfunction -" }}}1 -" Gcommit {{{1 +" Section: Gcommit call s:command("-nargs=? -complete=customlist,s:CommitComplete Gcommit :execute s:Commit()") -function! s:Commit(args) abort +function! s:Commit(args, ...) abort + let repo = a:0 ? a:1 : s:repo() let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' let dir = getcwd() - let msgfile = s:repo().dir('COMMIT_EDITMSG') + let msgfile = repo.dir('COMMIT_EDITMSG') let outfile = tempname() let errorfile = tempname() try try - execute cd.s:fnameescape(s:repo().tree()) - if &shell =~# 'cmd' || &shell =~# 'power' + execute cd.s:fnameescape(repo.tree()) + if s:winshell() let command = '' let old_editor = $GIT_EDITOR let $GIT_EDITOR = 'false' else let command = 'env GIT_EDITOR=false ' endif - let command .= s:repo().git_command('commit').' '.a:args + let command .= repo.git_command('commit').' '.a:args if &shell =~# 'csh' noautocmd silent execute '!('.command.' > '.outfile.') >& '.errorfile elseif a:args =~# '\%(^\| \)-\%(-interactive\|p\|-patch\)\>' @@ -986,7 +1008,7 @@ function! s:Commit(args) abort if error =~# 'false''\=\.$' let args = a:args let args = s:gsub(args,'%(%(^| )-- )@' @@ -994,6 +1016,8 @@ function! s:Commit(args) abort endif if bufname('%') == '' && line('$') == 1 && getline(1) == '' && !&mod execute 'keepalt edit '.s:fnameescape(msgfile) + elseif a:args =~# '\%(^\| \)-\%(-verbose\|\w*v\)\>' + execute 'keepalt tabedit '.s:fnameescape(msgfile) elseif s:buffer().type() ==# 'index' execute 'keepalt edit '.s:fnameescape(msgfile) execute (search('^#','n')+1).'wincmd+' @@ -1035,18 +1059,131 @@ function! s:FinishCommit() abort let args = getbufvar(+expand(''),'fugitive_commit_arguments') if !empty(args) call setbufvar(+expand(''),'fugitive_commit_arguments','') - return s:Commit(args) + return s:Commit(args, s:repo(getbufvar(+expand(''),'git_dir'))) endif return '' endfunction -augroup fugitive_commit - autocmd! - autocmd VimLeavePre,BufDelete COMMIT_EDITMSG execute s:sub(s:FinishCommit(), '^echoerr (.*)', 'echohl ErrorMsg|echo \1|echohl NONE') -augroup END +" Section: Gmerge, Gpull -" }}}1 -" Ggrep, Glog {{{1 +call s:command("-nargs=? -bang -complete=custom,s:RevisionComplete Gmerge " . + \ "execute s:Merge('merge', 0, )") +call s:command("-nargs=? -bang -complete=custom,s:RemoteComplete Gpull " . + \ "execute s:Merge('pull --progress', 0, )") + +function! s:RevisionComplete(A, L, P) abort + return s:repo().git_chomp('rev-parse', '--symbolic', '--branches', '--tags', '--remotes') + \ . "\nHEAD\nFETCH_HEAD\nORIG_HEAD" +endfunction + +function! s:RemoteComplete(A, L, P) abort + let remote = matchstr(a:L, ' \zs\S\+\ze ') + if !empty(remote) + let matches = split(s:repo().git_chomp('ls-remote', remote), "\n") + call filter(matches, 'v:val =~# "\t" && v:val !~# "{"') + call map(matches, 's:sub(v:val, "^.*\t%(refs/%(heads/|tags/)=)=", "")') + else + let matches = split(s:repo().git_chomp('remote'), "\n") + endif + return join(matches, "\n") +endfunction + +function! fugitive#cwindow() abort + if &buftype == 'quickfix' + cwindow + else + botright cwindow + if &buftype == 'quickfix' + wincmd p + endif + endif +endfunction + +let s:common_efm = '' + \ . '%+Egit:%.%#,' + \ . '%+Eusage:%.%#,' + \ . '%+Eerror:%.%#,' + \ . '%+Efatal:%.%#,' + \ . '%-G%.%#%\e[K%.%#,' + \ . '%-G%.%#%\r%.%\+' + +function! s:Merge(cmd, bang, args) abort + let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' + let cwd = getcwd() + let [mp, efm] = [&l:mp, &l:efm] + let had_merge_msg = filereadable(s:repo().dir('MERGE_MSG')) + try + let &l:errorformat = '' + \ . '%-Gerror:%.%#false''.,' + \ . '%-G%.%# ''git commit'' %.%#,' + \ . '%+Emerge:%.%#,' + \ . s:common_efm . ',' + \ . '%+ECannot %.%#: You have unstaged changes.,' + \ . '%+ECannot %.%#: Your index contains uncommitted changes.,' + \ . '%+EThere is no tracking information for the current branch.,' + \ . '%+EYou are not currently on a branch. Please specify which,' + \ . 'CONFLICT (%m): %f deleted in %.%#,' + \ . 'CONFLICT (%m): Merge conflict in %f,' + \ . 'CONFLICT (%m): Rename \"%f\"->%.%#,' + \ . 'CONFLICT (%m): Rename %.%#->%f %.%#,' + \ . 'CONFLICT (%m): There is a directory with name %f in %.%#,' + \ . '%+ECONFLICT %.%#,' + \ . '%+EKONFLIKT %.%#,' + \ . '%+ECONFLIT %.%#,' + \ . "%+EXUNG \u0110\u1ed8T %.%#," + \ . "%+E\u51b2\u7a81 %.%#," + \ . 'U%\t%f' + if a:cmd =~# '^merge' && empty(a:args) && + \ (had_merge_msg || isdirectory(s:repo().dir('rebase-apply')) || + \ !empty(s:repo().git_chomp('diff-files', '--diff-filter=U'))) + let &l:makeprg = g:fugitive_git_executable.' diff-files --name-status --diff-filter=U' + else + let &l:makeprg = s:sub(g:fugitive_git_executable.' -c core.editor=false '. + \ a:cmd . (a:args =~# ' \%(--no-edit\|--abort\|-m\)\>' ? '' : ' --edit') . ' ' . a:args, + \ ' *$', '') + endif + if !empty($GIT_EDITOR) + let old_editor = $GIT_EDITOR + let $GIT_EDITOR = 'false' + endif + execute cd fnameescape(s:repo().tree()) + silent noautocmd make! + catch /^Vim\%((\a\+)\)\=:E211/ + let err = v:exception + finally + redraw! + let [&l:mp, &l:efm] = [mp, efm] + if exists('old_editor') + let $GIT_EDITOR = old_editor + endif + execute cd fnameescape(cwd) + endtry + call fugitive#reload_status() + if empty(filter(getqflist(),'v:val.valid')) + if !had_merge_msg && filereadable(s:repo().dir('MERGE_MSG')) + cclose + return 'Gcommit --no-status -t '.s:shellesc(s:repo().dir('MERGE_MSG')) + endif + endif + let qflist = getqflist() + let found = 0 + for e in qflist + if !empty(e.bufnr) + let found = 1 + let e.pattern = '^<<<<<<<' + endif + endfor + call fugitive#cwindow() + if found + call setqflist(qflist, 'r') + if !a:bang + return 'cfirst' + endif + endif + return exists('err') ? 'echoerr '.string(err) : '' +endfunction + +" Section: Ggrep, Glog if !exists('g:fugitive_summary_format') let g:fugitive_summary_format = '%s' @@ -1054,8 +1191,8 @@ endif call s:command("-bang -nargs=? -complete=customlist,s:EditComplete Ggrep :execute s:Grep('grep',0,)") call s:command("-bang -nargs=? -complete=customlist,s:EditComplete Glgrep :execute s:Grep('lgrep',0,)") -call s:command("-bar -bang -nargs=* -complete=customlist,s:EditComplete Glog :execute s:Log('grep',)") -call s:command("-bar -bang -nargs=* -complete=customlist,s:EditComplete Gllog :execute s:Log('lgrep',)") +call s:command("-bar -bang -nargs=* -range=0 -complete=customlist,s:EditComplete Glog :call s:Log('grep',,,)") +call s:command("-bar -bang -nargs=* -complete=customlist,s:EditComplete Gllog :call s:Log('lgrep',,,)") function! s:Grep(cmd,bang,arg) abort let grepprg = &grepprg @@ -1072,14 +1209,16 @@ function! s:Grep(cmd,bang,arg) abort if bufname(entry.bufnr) =~ ':' let entry.filename = s:repo().translate(bufname(entry.bufnr)) unlet! entry.bufnr + let changed = 1 elseif a:arg =~# '\%(^\| \)--cached\>' let entry.filename = s:repo().translate(':0:'.bufname(entry.bufnr)) unlet! entry.bufnr + let changed = 1 endif endfor - if a:cmd =~# '^l' + if a:cmd =~# '^l' && exists('changed') call setloclist(0, list, 'r') - else + elseif exists('changed') call setqflist(list, 'r') endif if !a:bang && !empty(list) @@ -1094,7 +1233,7 @@ function! s:Grep(cmd,bang,arg) abort endtry endfunction -function! s:Log(cmd,...) abort +function! s:Log(cmd, line1, line2, ...) abort let path = s:buffer().path('/') if path =~# '^/\.git\%(/\|$\)' || index(a:000,'--') != -1 let path = '' @@ -1110,7 +1249,11 @@ function! s:Log(cmd,...) abort end let cmd += map(copy(a:000),'s:sub(v:val,"^\\%(%(:\\w)*)","\\=fnamemodify(s:buffer().path(),submatch(1))")') if path =~# '/.' - let cmd += ['--',path[1:-1]] + if a:line2 + let cmd += ['-L', a:line1 . ',' . a:line2 . ':' . path[1:-1]] + else + let cmd += ['--', path[1:-1]] + endif endif let grepformat = &grepformat let grepprg = &grepprg @@ -1119,7 +1262,7 @@ function! s:Log(cmd,...) abort try execute cd.'`=s:repo().tree()`' let &grepprg = escape(call(s:repo().git_command,cmd,s:repo()),'%#') - let &grepformat = '%f::%m' + let &grepformat = '%Cdiff %.%#,%C--- %.%#,%C+++ %.%#,%Z@@ -%\d%\+\,%\d%\+ +%l\,%\d%\+ @@,%-G-%.%#,%-G+%.%#,%-G %.%#,%A%f::%m,%-G%.%#' exe a:cmd finally let &grepformat = grepformat @@ -1128,8 +1271,7 @@ function! s:Log(cmd,...) abort endtry endfunction -" }}}1 -" Gedit, Gpedit, Gsplit, Gvsplit, Gtabedit, Gread {{{1 +" Section: Gedit, Gpedit, Gsplit, Gvsplit, Gtabedit, Gread function! s:Edit(cmd,bang,...) abort let buffer = s:buffer() @@ -1142,7 +1284,9 @@ function! s:Edit(cmd,bang,...) abort if winnr != mywinnr && getwinvar(winnr,'&diff') execute winnr.'wincmd w' close - wincmd p + if winnr('$') > 1 + wincmd p + endif endif endfor endif @@ -1164,7 +1308,7 @@ function! s:Edit(cmd,bang,...) abort return 'redraw|echo '.string(':!'.git.' '.args) else let temp = resolve(tempname()) - let s:temp_files[temp] = { 'dir': buffer.repo().dir(), 'args': arglist } + let s:temp_files[tolower(temp)] = { 'dir': buffer.repo().dir(), 'args': arglist } silent execute a:cmd.' '.temp if a:cmd =~# 'pedit' wincmd P @@ -1226,8 +1370,7 @@ call s:command("-bar -bang -nargs=* -complete=customlist,s:EditRunComplete Gvspl call s:command("-bar -bang -nargs=* -complete=customlist,s:EditRunComplete Gtabedit :execute s:Edit('tabedit',0,)") call s:command("-bar -bang -nargs=* -count -complete=customlist,s:EditRunComplete Gread :execute s:Edit((! && ? '' : ).'read',0,)") -" }}}1 -" Gwrite, Gwq {{{1 +" Section: Gwrite, Gwq call s:command("-bar -bang -nargs=* -complete=customlist,s:EditComplete Gwrite :execute s:Write(0,)") call s:command("-bar -bang -nargs=* -complete=customlist,s:EditComplete Gw :execute s:Write(0,)") @@ -1314,9 +1457,9 @@ function! s:Write(force,...) abort endif if a:force - let error = s:repo().git_chomp_in_tree('add', '--force', file) + let error = s:repo().git_chomp_in_tree('add', '--force', '--', path) else - let error = s:repo().git_chomp_in_tree('add', file) + let error = s:repo().git_chomp_in_tree('add', '--', path) endif if v:shell_error let v:errmsg = 'fugitive: '.error @@ -1383,19 +1526,81 @@ function! s:Wq(force,...) abort endif endfunction -" }}}1 -" Gdiff {{{1 +augroup fugitive_commit + autocmd! + autocmd VimLeavePre,BufDelete COMMIT_EDITMSG execute s:sub(s:FinishCommit(), '^echoerr (.*)', 'echohl ErrorMsg|echo \1|echohl NONE') +augroup END -call s:command("-bang -bar -nargs=* -complete=customlist,s:EditComplete Gdiff :execute s:Diff(0,)") -call s:command("-bar -nargs=* -complete=customlist,s:EditComplete Gvdiff :execute s:Diff(0,)") -call s:command("-bar -nargs=* -complete=customlist,s:EditComplete Gsdiff :execute s:Diff(1,)") +" Section: Gpush, Gfetch + +call s:command("-nargs=? -bang -complete=custom,s:RemoteComplete Gpush execute s:Dispatch('', 'push '.)") +call s:command("-nargs=? -bang -complete=custom,s:RemoteComplete Gfetch execute s:Dispatch('', 'fetch '.)") + +function! s:Dispatch(bang, args) + let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' + let cwd = getcwd() + let [mp, efm, cc] = [&l:mp, &l:efm, get(b:, 'current_compiler', '')] + try + let b:current_compiler = 'git' + let &l:errorformat = s:common_efm + let &l:makeprg = g:fugitive_git_executable . ' ' . a:args + execute cd fnameescape(s:repo().tree()) + if exists(':Make') == 2 + noautocmd Make + else + silent noautocmd make! + redraw! + return 'call fugitive#cwindow()' + endif + return '' + finally + let [&l:mp, &l:efm, b:current_compiler] = [mp, efm, cc] + if empty(cc) | unlet! b:current_compiler | endif + execute cd fnameescape(cwd) + endtry +endfunction + +" Section: Gdiff + +call s:command("-bang -bar -nargs=* -complete=customlist,s:EditComplete Gdiff :execute s:Diff('',)") +call s:command("-bar -nargs=* -complete=customlist,s:EditComplete Gvdiff :execute s:Diff('keepalt vert ',)") +call s:command("-bar -nargs=* -complete=customlist,s:EditComplete Gsdiff :execute s:Diff('keepalt ',)") augroup fugitive_diff autocmd! - autocmd BufWinLeave * if &diff && s:diff_window_count() == 2 && getbufvar(+expand(''), 'git_dir') !=# '' | call s:diffoff_all(getbufvar(+expand(''), 'git_dir')) | endif - autocmd BufWinEnter * if &diff && s:diff_window_count() == 1 && getbufvar(+expand(''), 'git_dir') !=# '' | call s:diffoff() | endif + autocmd BufWinLeave * + \ if s:can_diffoff(+expand('')) && s:diff_window_count() == 2 | + \ call s:diffoff_all(getbufvar(+expand(''), 'git_dir')) | + \ endif + autocmd BufWinEnter * + \ if s:can_diffoff(+expand('')) && s:diff_window_count() == 1 | + \ call s:diffoff() | + \ endif augroup END +function! s:can_diffoff(buf) abort + return getwinvar(bufwinnr(a:buf), '&diff') && + \ !empty(getbufvar(a:buf, 'git_dir')) && + \ !empty(getwinvar(bufwinnr(a:buf), 'fugitive_diff_restore')) +endfunction + +function! fugitive#can_diffoff(buf) abort + return s:can_diffoff(a:buf) +endfunction + +function! s:diff_modifier(count) abort + let fdc = matchstr(&diffopt, 'foldcolumn:\zs\d\+') + if &diffopt =~# 'horizontal' && &diffopt !~# 'vertical' + return 'keepalt ' + elseif &diffopt =~# 'vertical' + return 'keepalt vert ' + elseif winwidth(0) <= a:count * ((&tw ? &tw : 80) + (empty(fdc) ? 2 : fdc)) + return 'keepalt ' + else + return 'keepalt vert ' + endif +endfunction + function! s:diff_window_count() abort let c = 0 for nr in range(1,winnr('$')) @@ -1412,6 +1617,7 @@ function! s:diff_restore() abort \ . ' foldmethod=' . &l:foldmethod \ . ' foldcolumn=' . &l:foldcolumn \ . ' foldlevel=' . &l:foldlevel + \ . (&l:foldenable ? ' foldenable' : ' nofoldenable') if has('cursorbind') let restore .= (&l:cursorbind ? ' ' : ' no') . 'cursorbind' endif @@ -1470,11 +1676,12 @@ endfunction call s:add_methods('buffer',['compare_age']) -function! s:Diff(bang,...) abort - let vert = a:bang ? '' : 'vertical ' +function! s:Diff(vert,...) abort + let vert = empty(a:vert) ? s:diff_modifier(2) : a:vert if exists(':DiffGitCached') return 'DiffGitCached' elseif (!a:0 || a:1 == ':') && s:buffer().commit() =~# '^[0-1]\=$' && s:repo().git_chomp_in_tree('ls-files', '--unmerged', '--', s:buffer().path()) !=# '' + let vert = empty(a:vert) ? s:diff_modifier(3) : a:vert let nr = bufnr('') execute 'leftabove '.vert.'split `=fugitive#buffer().repo().translate(s:buffer().expand('':2''))`' execute 'nnoremap dp :diffput '.nr.'diffupdate' @@ -1534,8 +1741,7 @@ function! s:Diff(bang,...) abort endtry endfunction -" }}}1 -" Gmove, Gremove {{{1 +" Section: Gmove, Gremove function! s:Move(force,destination) abort if a:destination =~# '^/' @@ -1611,8 +1817,7 @@ augroup fugitive_remove \ endif augroup END -" }}}1 -" Gblame {{{1 +" Section: Gblame augroup fugitive_blame autocmd! @@ -1620,6 +1825,7 @@ augroup fugitive_blame autocmd FileType fugitiveblame setlocal nomodeline | if exists('b:git_dir') | let &l:keywordprg = s:repo().keywordprg() | endif autocmd Syntax fugitiveblame call s:BlameSyntax() autocmd User Fugitive if s:buffer().type('file', 'blob') | exe "command! -buffer -bar -bang -range=0 -nargs=* Gblame :execute s:Blame(0,,,,[])" | endif + autocmd ColorScheme,GUIEnter * call s:RehighlightBlame() augroup END function! s:linechars(pattern) abort @@ -1633,6 +1839,9 @@ function! s:linechars(pattern) abort endfunction function! s:Blame(bang,line1,line2,count,args) abort + if exists('b:fugitive_blamed_bufnr') + return 'bdelete' + endif try if s:buffer().path() == '' call s:throw('file or blob required') @@ -1674,12 +1883,18 @@ function! s:Blame(bang,line1,line2,count,args) abort endif for winnr in range(winnr('$'),1,-1) call setwinvar(winnr, '&scrollbind', 0) + if exists('+cursorbind') + call setwinvar(winnr, '&cursorbind', 0) + endif if getbufvar(winbufnr(winnr), 'fugitive_blamed_bufnr') execute winbufnr(winnr).'bdelete' endif endfor let bufnr = bufnr('') let restore = 'call setwinvar(bufwinnr('.bufnr.'),"&scrollbind",0)' + if exists('+cursorbind') + let restore .= '|call setwinvar(bufwinnr('.bufnr.'),"&cursorbind",0)' + endif if &l:wrap let restore .= '|call setwinvar(bufwinnr('.bufnr.'),"&wrap",1)' endif @@ -1687,9 +1902,12 @@ function! s:Blame(bang,line1,line2,count,args) abort let restore .= '|call setwinvar(bufwinnr('.bufnr.'),"&foldenable",1)' endif setlocal scrollbind nowrap nofoldenable + if exists('+cursorbind') + setlocal cursorbind + endif let top = line('w0') + &scrolloff let current = line('.') - let s:temp_files[temp] = { 'dir': s:repo().dir(), 'args': cmd } + let s:temp_files[tolower(temp)] = { 'dir': s:repo().dir(), 'args': cmd } exe 'keepalt leftabove vsplit '.temp let b:fugitive_blamed_bufnr = bufnr let w:fugitive_leave = restore @@ -1697,6 +1915,9 @@ function! s:Blame(bang,line1,line2,count,args) abort execute top normal! zt execute current + if exists('+cursorbind') + setlocal cursorbind + endif setlocal nomodified nomodifiable nonumber scrollbind nowrap foldcolumn=0 nofoldenable winfixwidth filetype=fugitiveblame if exists('+concealcursor') setlocal concealcursor=nc conceallevel=2 @@ -1765,7 +1986,7 @@ function! s:BlameCommit(cmd) abort let offset -= 1 endif endwhile - return 'if foldlevel(".")|foldopen!|endif' + return 'normal! zv' endif endwhile execute head @@ -1808,6 +2029,8 @@ function! s:BlameJump(suffix) abort return '' endfunction +let s:hash_colors = {} + function! s:BlameSyntax() abort let b:current_syntax = 'fugitiveblame' let conceal = has('conceal') ? ' conceal' : '' @@ -1826,7 +2049,7 @@ function! s:BlameSyntax() abort syn match FugitiveblameNotCommittedYet "(\@<=Not Committed Yet\>" contained containedin=FugitiveblameAnnotation hi def link FugitiveblameBoundary Keyword hi def link FugitiveblameHash Identifier - hi def link FugitiveblameUncommitted Function + hi def link FugitiveblameUncommitted Ignore hi def link FugitiveblameTime PreProc hi def link FugitiveblameLineNumber Number hi def link FugitiveblameOriginalFile String @@ -1834,10 +2057,40 @@ function! s:BlameSyntax() abort hi def link FugitiveblameShort FugitiveblameDelimiter hi def link FugitiveblameDelimiter Delimiter hi def link FugitiveblameNotCommittedYet Comment + let seen = {} + for lnum in range(1, line('$')) + let hash = matchstr(getline(lnum), '^\^\=\zs\x\{6\}') + if hash ==# '' || hash ==# '000000' || has_key(seen, hash) + continue + endif + let seen[hash] = 1 + if &t_Co > 16 && exists('g:CSApprox_loaded') + \ && empty(get(s:hash_colors, hash)) + let [s, r, g, b; __] = map(matchlist(hash, '\(\x\x\)\(\x\x\)\(\x\x\)'), 'str2nr(v:val,16)') + let color = csapprox#per_component#Approximate(r, g, b) + if color == 16 && &background ==# 'dark' + let color = 8 + endif + let s:hash_colors[hash] = ' ctermfg='.color + else + let s:hash_colors[hash] = '' + endif + exe 'syn match FugitiveblameHash'.hash.' "\%(^\^\=\)\@<='.hash.'\x\{1,34\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameOriginalLineNumber,fugitiveblameOriginalFile skipwhite' + endfor + call s:RehighlightBlame() endfunction -" }}}1 -" Gbrowse {{{1 +function! s:RehighlightBlame() abort + for [hash, cterm] in items(s:hash_colors) + if !empty(cterm) || has('gui_running') + exe 'hi FugitiveblameHash'.hash.' guifg=#'.hash.get(s:hash_colors, hash, '') + else + exe 'hi link FugitiveblameHash'.hash.' Identifier' + endif + endfor +endfunction + +" Section: Gbrowse call s:command("-bar -bang -range -nargs=* -complete=customlist,s:EditComplete Gbrowse :execute s:Browse(0,,,)") @@ -1931,8 +2184,10 @@ function! s:Browse(bang,line1,count,...) abort if a:bang let @* = url return 'echomsg '.string(url) + elseif exists(':Browse') == 2 + return 'echomsg '.string(url).'|Browse '.url else - return 'echomsg '.string(url).'|call fugitive#buffer().repo().git_chomp("web--browse",'.string(url).')' + return 'echomsg '.string(url).'|call netrw#NetrwBrowseX('.string(url).', 0)' endif catch /^fugitive:/ return 'echoerr v:errmsg' @@ -2039,8 +2294,7 @@ function! s:instaweb_url(repo,rev,commit,path,type,...) abort return url endfunction -" }}}1 -" File access {{{1 +" Section: File access function! s:ReplaceCmd(cmd,...) abort let fn = expand('%:p') @@ -2048,14 +2302,14 @@ function! s:ReplaceCmd(cmd,...) abort let prefix = '' try if a:0 && a:1 != '' - if &shell =~# 'cmd' || &shell =~# 'power' + if s:winshell() let old_index = $GIT_INDEX_FILE let $GIT_INDEX_FILE = a:1 else let prefix = 'env GIT_INDEX_FILE='.s:shellesc(a:1).' ' endif endif - if &shell =~# 'cmd' || &shell =~# 'power' + if s:winshell() let cmd_escape_char = &shellxquote == '(' ? '^' : '^^^' call system('cmd /c "'.prefix.s:gsub(a:cmd,'[<>]', cmd_escape_char.'&').' > '.tmp.'"') else @@ -2070,7 +2324,10 @@ function! s:ReplaceCmd(cmd,...) abort try silent edit! finally - silent exe 'keepalt file '.s:fnameescape(fn) + try + silent exe 'keepalt file '.s:fnameescape(fn) + catch /^Vim\%((\a\+)\)\=:E302/ + endtry call delete(tmp) if fnamemodify(bufname('$'), ':p') ==# tmp silent execute 'bwipeout '.bufnr('$') @@ -2105,6 +2362,7 @@ function! s:BufReadIndex() abort let cmd = s:repo().git_command( \ '-c', 'status.displayCommentPrefix=true', \ '-c', 'color.status=false', + \ '-c', 'status.short=false', \ 'status') endif try @@ -2135,8 +2393,8 @@ function! s:BufReadIndex() abort nnoremap cc :Gcommit nnoremap cva :Gcommit --amend --verbose nnoremap cvc :Gcommit --verbose - nnoremap D :execute StageDiff('Gvdiff') - nnoremap dd :execute StageDiff('Gvdiff') + nnoremap D :execute StageDiff('Gdiff') + nnoremap dd :execute StageDiff('Gdiff') nnoremap dh :execute StageDiff('Gsdiff') nnoremap ds :execute StageDiff('Gsdiff') nnoremap dp :execute StageDiffEdit() @@ -2144,7 +2402,9 @@ function! s:BufReadIndex() abort nnoremap p :execute StagePatch(line('.'),line('.')+v:count1-1) xnoremap p :execute StagePatch(line("'<"),line("'>")) nnoremap q :if bufnr('$') == 1quitelsebdeleteendif + nnoremap r :edit nnoremap R :edit + nnoremap U :execute StageUndo() nnoremap g? :help fugitive-:Gstatus nnoremap :help fugitive-:Gstatus catch /^fugitive:/ @@ -2203,7 +2463,7 @@ function! s:BufWriteIndexFile() abort endif let info = old_mode.' '.sha1.' '.stage."\t".path call writefile([info],tmp) - if &shell =~# 'cmd' || &shell =~# 'power' + if s:winshell() let error = system('type '.s:gsub(tmp,'/','\\').'|'.s:repo().git_command('update-index','--index-info')) else let error = system(s:repo().git_command('update-index','--index-info').' < '.tmp) @@ -2289,7 +2549,7 @@ function! s:BufReadObject() abort setlocal bufhidden=delete endif if b:fugitive_type !=# 'blob' - set filetype=git + setlocal filetype=git foldmethod=syntax nnoremap a :let b:fugitive_display_format += v:count1exe BufReadObject() nnoremap i :let b:fugitive_display_format -= v:count1exe BufReadObject() else @@ -2323,8 +2583,7 @@ augroup fugitive_files \ endif augroup END -" }}}1 -" Temp files {{{1 +" Section: Temp files if !exists('s:temp_files') let s:temp_files = {} @@ -2333,18 +2592,17 @@ endif augroup fugitive_temp autocmd! autocmd BufNewFile,BufReadPost * - \ if has_key(s:temp_files,expand(':p')) | - \ let b:git_dir = s:temp_files[expand(':p')].dir | + \ if has_key(s:temp_files,tolower(expand(':p'))) | + \ let b:git_dir = s:temp_files[tolower(expand(':p'))].dir | \ let b:git_type = 'temp' | - \ let b:git_args = s:temp_files[expand(':p')].args | + \ let b:git_args = s:temp_files[tolower(expand(':p'))].args | \ call fugitive#detect(expand(':p')) | \ setlocal bufhidden=delete | \ nnoremap q :bdelete| \ endif augroup END -" }}}1 -" Go to file {{{1 +" Section: Go to file function! s:JumpInit() abort nnoremap :exe GF("edit") @@ -2476,7 +2734,7 @@ function! s:GF(mode) abort endwhile let offset += matchstr(getline(lnum), type.'\zs\d\+') let ref = getline(search('^'.type.'\{3\} [ab]/','bnW'))[4:-1] - let dcmd = '+'.offset.'|if foldlevel(".")|foldopen!|endif' + let dcmd = '+'.offset.'|normal! zv' let dref = '' elseif getline('.') =~# '^rename from ' @@ -2497,6 +2755,10 @@ function! s:GF(mode) abort elseif line('$') == 1 && getline('.') =~ '^\x\{40\}$' let ref = getline('.') + + elseif expand('') =~# '^\x\{7,40\}\>' + return s:Edit(a:mode,0,expand('')) + else let ref = '' endif @@ -2533,8 +2795,7 @@ function! s:GF(mode) abort endtry endfunction -" }}}1 -" Statusline {{{1 +" Section: Statusline function! s:repo_head_ref() dict abort if !filereadable(self.dir('HEAD')) @@ -2569,8 +2830,7 @@ function! fugitive#head(...) abort return s:repo().head(a:0 ? a:1 : 0) endfunction -" }}}1 -" Folding {{{1 +" Section: Folding function! fugitive#foldtext() abort if &foldmethod !=# 'syntax' @@ -2618,7 +2878,3 @@ augroup fugitive_foldtext \ set foldtext=fugitive#foldtext() | \ endif augroup END - -" }}}1 - -" vim:set et sw=2: diff --git a/sources_non_forked/vim-golang/autoload/go/complete.vim b/sources_non_forked/vim-golang/autoload/go/complete.vim index 8dd43de4..a4fa6b66 100644 --- a/sources_non_forked/vim-golang/autoload/go/complete.vim +++ b/sources_non_forked/vim-golang/autoload/go/complete.vim @@ -58,7 +58,7 @@ function! go#complete#Package(ArgLead, CmdLine, CursorPos) if executable('go') let goroot = substitute(system('go env GOROOT'), '\n', '', 'g') if v:shell_error - echomsg '\'go env GOROOT\' failed' + echomsg '''go env GOROOT'' failed' endif else let goroot = $GOROOT diff --git a/sources_non_forked/vim-golang/ftplugin/go.vim b/sources_non_forked/vim-golang/ftplugin/go.vim index 8066733c..532fb172 100644 --- a/sources_non_forked/vim-golang/ftplugin/go.vim +++ b/sources_non_forked/vim-golang/ftplugin/go.vim @@ -9,9 +9,11 @@ if exists("b:did_ftplugin") endif let b:did_ftplugin = 1 +setlocal formatoptions-=t + setlocal comments=s1:/*,mb:*,ex:*/,:// setlocal commentstring=//\ %s -let b:undo_ftplugin = "setl com< cms<" +let b:undo_ftplugin = "setl fo< com< cms<" " vim:ts=4:sw=4:et diff --git a/sources_non_forked/vim-golang/indent/go.vim b/sources_non_forked/vim-golang/indent/go.vim index faf4d79e..e3d6e841 100644 --- a/sources_non_forked/vim-golang/indent/go.vim +++ b/sources_non_forked/vim-golang/indent/go.vim @@ -24,6 +24,18 @@ if exists("*GoIndent") finish endif +" The shiftwidth() function is relatively new. +" Don't require it to exist. +if exists('*shiftwidth') + func s:sw() + return shiftwidth() + endfunc +else + func s:sw() + return &shiftwidth + endfunc +endif + function! GoIndent(lnum) let prevlnum = prevnonblank(a:lnum-1) if prevlnum == 0 @@ -40,17 +52,17 @@ function! GoIndent(lnum) if prevl =~ '[({]\s*$' " previous line opened a block - let ind += &sw + let ind += s:sw() endif if prevl =~# '^\s*\(case .*\|default\):$' " previous line is part of a switch statement - let ind += &sw + let ind += s:sw() endif " TODO: handle if the previous line is a label. if thisl =~ '^\s*[)}]' " this line closed a block - let ind -= &sw + let ind -= s:sw() endif " Colons are tricky. @@ -58,7 +70,7 @@ function! GoIndent(lnum) " We ignore trying to deal with jump labels because (a) they're rare, and " (b) they're hard to disambiguate from a composite literal key. if thisl =~# '^\s*\(case .*\|default\):$' - let ind -= &sw + let ind -= s:sw() endif return ind diff --git a/sources_non_forked/vim-golang/readme.txt b/sources_non_forked/vim-golang/readme.txt index b8469f92..9a9e2287 100644 --- a/sources_non_forked/vim-golang/readme.txt +++ b/sources_non_forked/vim-golang/readme.txt @@ -5,9 +5,11 @@ To use all the Vim plugins, add these lines to your $HOME/.vimrc. " Some Linux distributions set filetype in /etc/vimrc. " Clear filetype flags before changing runtimepath to force Vim to reload them. - filetype off - filetype plugin indent off - set runtimepath+=$GOROOT/misc/vim + if exists("g:did_load_filetypes") + filetype off + filetype plugin indent off + endif + set runtimepath+=$GOROOT/misc/vim " replace $GOROOT with the output of: go env GOROOT filetype plugin indent on syntax on diff --git a/sources_non_forked/vim-markdown/README.markdown b/sources_non_forked/vim-markdown/README.markdown new file mode 100644 index 00000000..055b8de2 --- /dev/null +++ b/sources_non_forked/vim-markdown/README.markdown @@ -0,0 +1,17 @@ +# Vim Markdown runtime files + +This is the development version of Vim's included syntax highlighting and +filetype plugins for Markdown. Generally you don't need to install these if +you are running a recent version of Vim. + +One difference between this repository and the upstream files in Vim is that +the former forces `*.md` as Markdown, while the latter detects it as Modula-2, +with an exception for `README.md`. If you'd like to force Markdown without +installing from this repository, add the following to your vimrc: + + autocmd BufNewFile,BufReadPost *.md set filetype=markdown + +## License + +Copyright © Tim Pope. Distributed under the same terms as Vim itself. +See `:help license`. diff --git a/sources_non_forked/vim-markdown/ftplugin/markdown.vim b/sources_non_forked/vim-markdown/ftplugin/markdown.vim index ae3bd262..e8627ccc 100644 --- a/sources_non_forked/vim-markdown/ftplugin/markdown.vim +++ b/sources_non_forked/vim-markdown/ftplugin/markdown.vim @@ -11,7 +11,7 @@ runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o -setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+ +setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]: if exists('b:undo_ftplugin') let b:undo_ftplugin .= "|setl cms< com< fo< flp<" diff --git a/sources_non_forked/vim-markdown/syntax/markdown.vim b/sources_non_forked/vim-markdown/syntax/markdown.vim index 8fc47278..607488d9 100644 --- a/sources_non_forked/vim-markdown/syntax/markdown.vim +++ b/sources_non_forked/vim-markdown/syntax/markdown.vim @@ -85,8 +85,8 @@ syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepe syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*```.*$" end="^\s*```\ze\s*$" keepend -syn match markdownFootnote "\[^[^\]]\]\s*$" -syn match markdownFootnoteDefinition "^\[^[^\]]\]:" +syn match markdownFootnote "\[^[^\]]\+\]" +syn match markdownFootnoteDefinition "^\[^[^\]]\+\]:" if main_syntax ==# 'markdown' for s:type in g:markdown_fenced_languages diff --git a/sources_non_forked/vim-snipmate/after/plugin/snipMate.vim b/sources_non_forked/vim-snipmate/after/plugin/snipMate.vim index 668b2241..d7379c22 100644 --- a/sources_non_forked/vim-snipmate/after/plugin/snipMate.vim +++ b/sources_non_forked/vim-snipmate/after/plugin/snipMate.vim @@ -41,11 +41,6 @@ if !exists('g:snips_no_mappings') || !g:snips_no_mappings call s:map_if_not_mapped('', 'snipMateShow', 'i') endif -" FIXME: Without this map, in select mode deletes the current selection and -" returns to normal mode. This doesn't update placeholders. Ideally there's some -" way to update the placeholders without this otherwise useless map. -silent! snoremap b - let &cpo = s:save_cpo " vim:noet: diff --git a/sources_non_forked/vim-snipmate/autoload/snipMate.vim b/sources_non_forked/vim-snipmate/autoload/snipMate.vim index 44184be6..1a60cc32 100644 --- a/sources_non_forked/vim-snipmate/autoload/snipMate.vim +++ b/sources_non_forked/vim-snipmate/autoload/snipMate.vim @@ -262,7 +262,7 @@ function! s:state_proto.update_stops() for pos in self.stops if pos == self.cur_stop | continue | endif - let changed = pos[0] == curLine && pos[1] > self.start_col + let changed = pos[0] == curLine && pos[1] > self.cur_stop[1] let changedVars = 0 let endPlaceholder = pos[2] - 1 + pos[1] " Subtract changeLen from each tab stop that was after any of @@ -321,10 +321,13 @@ function! s:state_proto.update_changes() let self.end_col += change_len let col = col('.') - if line('.') != self.cur_stop[0] || col < self.start_col || col > self.end_col - call self.remove() - elseif self.has_vars - call self.update_vars(change_len) + if mode() == 'i' + if line('.') != self.cur_stop[0] + \ || col < self.start_col || col > self.end_col + call self.remove() + elseif self.has_vars + call self.update_vars(change_len) + endif endif let self.prev_len = col('$') @@ -336,6 +339,7 @@ function! s:state_proto.update_vars(change) let newWord = strpart(getline('.'), self.start_col - 1, newWordLen) let changeLen = a:change let curLine = line('.') + let curCol = col('.') let oldStartSnip = self.start_col let updateTabStops = changeLen != 0 let i = 0 @@ -374,7 +378,7 @@ function! s:state_proto.update_vars(change) " Reposition the cursor in case a var updates on the same line but before " the current tabstop if oldStartSnip != self.start_col || mode() == 'i' - call cursor(0, col('.') + self.start_col - oldStartSnip) + call cursor(0, curCol + self.start_col - oldStartSnip) endif endfunction @@ -382,12 +386,16 @@ endfunction " returns list of " ['triggername', 'name', 'contents'] " if triggername is not set 'default' is assumed +" TODO: better error checking fun! snipMate#ReadSnippetsFile(file) let result = [] let new_scopes = [] if !filereadable(a:file) | return [result, new_scopes] | endif let inSnip = 0 + let line_no = 0 for line in readfile(a:file) + ["\n"] + let line_no += 1 + if inSnip && (line[0] == "\t" || line == '') let content .= strpart(line, 1)."\n" continue @@ -406,6 +414,10 @@ fun! snipMate#ReadSnippetsFile(file) let trigger = strpart(trigger, 0, space - 1) endif let content = '' + if trigger =~ '^\s*$' " discard snippets with empty triggers + echom 'Invalid snippet in' a:file 'near line' line_no + let inSnip = 0 + endif elseif line[:6] == 'extends' call extend(new_scopes, map(split(strpart(line, 8)), \ "substitute(v:val, ',*$', '', '')")) @@ -415,7 +427,7 @@ fun! snipMate#ReadSnippetsFile(file) endf function! s:GetScopes() - let ret = exists('b:snipMate_scope_aliases') ? copy(b:snipMate.scope_aliases) : {} + let ret = exists('b:snipMate.scope_aliases') ? copy(b:snipMate.scope_aliases) : {} let global = get(g:snipMate, 'scope_aliases', {}) for alias in keys(global) if has_key(ret, alias) @@ -449,11 +461,7 @@ fun! s:AddScopeAliases(list) return keys(did) endf -if v:version >= 704 - function! s:Glob(path, expr) - return split(globpath(a:path, a:expr), "\n") - endfunction -else +if v:version < 704 || has('win32') function! s:Glob(path, expr) let res = [] for p in split(a:path, ',') @@ -464,6 +472,10 @@ else endfor return filter(res, 'filereadable(v:val)') endfunction +else + function! s:Glob(path, expr) + return split(globpath(a:path, a:expr), "\n") + endfunction endif " returns dict of @@ -517,7 +529,7 @@ function! snipMate#GetSnippetFiles(mustExist, scopes, trigger) endfunction " should be moved to utils or such? -function! snipMate#SetByPath(dict, trigger, path, snippet) +function! snipMate#SetByPath(dict, trigger, path, snippet) abort let d = a:dict if !has_key(d, a:trigger) let d[a:trigger] = {} diff --git a/sources_non_forked/vim-snipmate/doc/snipMate.txt b/sources_non_forked/vim-snipmate/doc/snipMate.txt index 4a353375..aa49586a 100644 --- a/sources_non_forked/vim-snipmate/doc/snipMate.txt +++ b/sources_non_forked/vim-snipmate/doc/snipMate.txt @@ -115,7 +115,9 @@ g:snipMate.scope_aliases A |Dictionary| associating certain filetypes variant b:snipMate_scope_aliases is merged with the global variant. -g:snipMate_no_default_aliases +g:snipMate_no_default_aliases Note: This has been renamed to the following. + +g:snipMate.no_default_aliases When set to 1, prevents SnipMate from loading default scope aliases. The defaults are: Filetype Alias ~ @@ -128,6 +130,10 @@ g:snipMate_no_default_aliases php php,html,javascript ur html,javascript xhtml html + Individual defaults can be disabled by setting + them to an empty value: > + let g:snipMate.scope_aliases.php = '' +< will disable the default PHP alias. Note: Setting this option does not disable scope aliases entirely, only those made by SnipMate itself. Any scope aliases created by diff --git a/sources_non_forked/vim-snipmate/plugin/snipMate.vim b/sources_non_forked/vim-snipmate/plugin/snipMate.vim index 5528b734..1d280903 100644 --- a/sources_non_forked/vim-snipmate/plugin/snipMate.vim +++ b/sources_non_forked/vim-snipmate/plugin/snipMate.vim @@ -56,16 +56,31 @@ let g:snipMate['no_match_completion_feedkeys_chars'] = " Add default scope aliases, without overriding user settings let g:snipMate.scope_aliases = get(g:snipMate, 'scope_aliases', {}) -if !exists('g:snipMate_no_default_aliases') || !g:snipMate_no_default_aliases - let g:snipMate.scope_aliases.objc = get(g:snipMate.scope_aliases, 'objc', 'c') - let g:snipMate.scope_aliases.cpp = get(g:snipMate.scope_aliases, 'cpp', 'c') - let g:snipMate.scope_aliases.cu = get(g:snipMate.scope_aliases, 'cu', 'c') - let g:snipMate.scope_aliases.xhtml = get(g:snipMate.scope_aliases, 'xhtml', 'html') - let g:snipMate.scope_aliases.html = get(g:snipMate.scope_aliases, 'html', 'javascript') - let g:snipMate.scope_aliases.php = get(g:snipMate.scope_aliases, 'php', 'php,html,javascript') - let g:snipMate.scope_aliases.ur = get(g:snipMate.scope_aliases, 'ur', 'html,javascript') - let g:snipMate.scope_aliases.mxml = get(g:snipMate.scope_aliases, 'mxml', 'actionscript') - let g:snipMate.scope_aliases.eruby = get(g:snipMate.scope_aliases, 'eruby', 'eruby-rails,html') +if exists('g:snipMate_no_default_aliases') + echom 'The g:snipMate_no_default_aliases option has been renamed.' + \ 'See :h snipMate-options.' +endif +if (!exists('g:snipMate_no_default_aliases') || !g:snipMate_no_default_aliases) + \ && (!exists('g:snipMate.no_default_aliases') + \ || !g:snipMate.no_default_aliases) + let g:snipMate.scope_aliases.objc = + \ get(g:snipMate.scope_aliases, 'objc', 'c') + let g:snipMate.scope_aliases.cpp = + \ get(g:snipMate.scope_aliases, 'cpp', 'c') + let g:snipMate.scope_aliases.cu = + \ get(g:snipMate.scope_aliases, 'cu', 'c') + let g:snipMate.scope_aliases.xhtml = + \ get(g:snipMate.scope_aliases, 'xhtml', 'html') + let g:snipMate.scope_aliases.html = + \ get(g:snipMate.scope_aliases, 'html', 'javascript') + let g:snipMate.scope_aliases.php = + \ get(g:snipMate.scope_aliases, 'php', 'php,html,javascript') + let g:snipMate.scope_aliases.ur = + \ get(g:snipMate.scope_aliases, 'ur', 'html,javascript') + let g:snipMate.scope_aliases.mxml = + \ get(g:snipMate.scope_aliases, 'mxml', 'actionscript') + let g:snipMate.scope_aliases.eruby = + \ get(g:snipMate.scope_aliases, 'eruby', 'eruby-rails,html') endif let g:snipMate['get_snippets'] = get(g:snipMate, 'get_snippets', funcref#Function("snipMate#GetSnippets")) @@ -94,6 +109,7 @@ function! s:grab_visual() endtry endfunction +" TODO: Allow specifying an arbitrary snippets file function! s:load_scopes(bang, ...) let gb = a:bang ? g: : b: let gb.snipMate = get(gb, 'snipMate', {}) diff --git a/sources_non_forked/vim-snippets/README.md b/sources_non_forked/vim-snippets/README.md index 7a94766f..bf8b3346 100644 --- a/sources_non_forked/vim-snippets/README.md +++ b/sources_non_forked/vim-snippets/README.md @@ -46,6 +46,19 @@ If you have VimL only (vim without python support) your best option is using minor bugs found in the engine. +Q: Should "snipmate be deprecated in favour of UltiSnips"? + +A: No, because snimpate is VimL, and UltiSnips requires Python. +Some people want to use snippets without having to install Vim with Python +support. Yes - this sucks. + +One solution would be: Use snippets if they are good enough, but allow overriding them +in UltiSnips. This would avoid most duplication while still serving most users. +AFAIK there is a nested-placeholder branch for snipmate too. snipmate is still +improved by Adnan Zafar. So maybe time is not ready to make a final decision yet. + +[github issue/discussion](https://github.com/honza/vim-snippets/issues/363) + Installation ------------ @@ -70,8 +83,8 @@ Is the place to discuss plugin managers and repository resources. About how to install snipate see [snipmate@garbas](https://github.com/garbas/vim-snipmate) (Bundle, Pathogen, git clone - keywords to make people find this link by ctrl-f search) -I know that I should be reading the docs of the snippet engine, just let me copy paste into my .vmirc: -(See this pull request)[https://github.com/honza/vim-snippets/pull/307/files]. +I know that I should be reading the docs of the snippet engine, just let me copy paste into my .vimrc: +[See this pull request](https://github.com/honza/vim-snippets/pull/307/files). TROUBLE ======= @@ -117,6 +130,13 @@ What about one line if ee then .. else .. vs if \n .. then \n ... \n else \n .. Which additional policies to add? Discuss at: https://github.com/honza/vim-snippets/issues/230 +*folding markers*: +Until further work is done on `vim-snipmate`, please don't add folding markers +into snippets. `vim-snipmate` has some comments about how to patch all snippets +on the fly adding those. + +Currently all snippets from UltiSnips have been put into UltiSnips - some work +on merging should be done (dropping duplicates etc). Also see engines section above. Related repositories -------------------- @@ -193,20 +213,6 @@ This list is kept up-to-date on a best effort basis. * Falcon - [steveno](https://github.com/steveno) * Elixir - [iurifq](https://github.com/iurifq) -Contributing notes ------------------- - -Until further work is done on `vim-snipmate`, please don't add folding markers -into snippets. `vim-snipmate` has some comments about how to patch all snippets -on the fly adding those. - -Because UltiSnips reads snipmate-snippets too there is no need to duplicate all -snippets - only those snippets who use advanced UltiSnips features should be -duplicated in UltiSnips. - -Currently all snippets from UltiSnips have been put into UltiSnips - some work -on merging should be done (dropping duplicates etc) - License ------- diff --git a/sources_non_forked/vim-snippets/UltiSnips/c.snippets b/sources_non_forked/vim-snippets/UltiSnips/c.snippets index 5b8eae84..e6ea2f9d 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/c.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/c.snippets @@ -16,7 +16,7 @@ endsnippet snippet #if "#if #endif" b #if ${1:0} -${VISUAL}${0:${VISUAL/(.*)/(?1::code)/}} +${VISUAL}${0} #endif endsnippet @@ -40,7 +40,7 @@ endsnippet snippet main "main() (main)" int main(int argc, char *argv[]) { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} return 0; } endsnippet @@ -48,14 +48,14 @@ endsnippet snippet for "for loop (for)" for (${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet snippet fori "for int loop (fori)" for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet @@ -74,7 +74,7 @@ else: snip.rv = snip.c`} #define $1 -${0} +${VISUAL}${0} #endif /* end of include guard: $1 */ @@ -86,13 +86,13 @@ endsnippet snippet wh "while loop" while(${1:/* condition */}) { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet snippet do "do...while loop (do)" do { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } while(${1:/* condition */}); endsnippet @@ -103,26 +103,26 @@ endsnippet snippet if "if .. (if)" if (${1:/* condition */}) { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet snippet el "else .. (else)" else { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet snippet eli "else if .. (eli)" else if (${1:/* condition */}) { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet snippet ife "if .. else (ife)" if (${1:/* condition */}) { - ${2:/* code */} + ${2} } else { @@ -144,7 +144,7 @@ endsnippet snippet fun "function" b ${1:void} ${2:function_name}(${3}) { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets b/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets index 3d79a64e..c2cb3d03 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets @@ -27,7 +27,7 @@ endsnippet snippet ns "namespace .. (namespace)" namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`} { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} }${1/.+/ \/* /m}$1${1/.+/ *\/ /m} endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/d.snippets b/sources_non_forked/vim-snippets/UltiSnips/d.snippets index 99da292e..9ce27513 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/d.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/d.snippets @@ -106,14 +106,14 @@ endsnippet snippet if "if .. (if)" if(${1:/*condition*/}) { - ${VISUAL}${0:/*code*/} + ${VISUAL}${0} } endsnippet snippet ife "if .. else (ife)" b if(${1:/*condition*/}) { - ${2:/*code*/} + ${2} } else { @@ -124,14 +124,14 @@ endsnippet snippet el "else (el)" b else { - ${VISUAL}${1:/*code*/} + ${VISUAL}${1} } endsnippet snippet elif "else if (elif)" b else if(${1:/*condition*/}) { - ${VISUAL}${0:/*code*/} + ${VISUAL}${0} } endsnippet @@ -139,10 +139,10 @@ snippet sw "switch (sw)" switch(${1:/*var*/}) { case ${2:/*value*/}: - ${3:/*code*/} + ${3} break; case ${4:/*value*/}: - ${5:/*code*/} + ${5} break; ${7:/*more cases*/} default: @@ -151,13 +151,13 @@ switch(${1:/*var*/}) endsnippet snippet fsw "final switch (fsw)" -switch(${1:/*var*/}) +final switch(${1:/*var*/}) { case ${2:/*value*/}: - ${3:/*code*/} + ${3} break; case ${4:/*value*/}: - ${5:/*code*/} + ${5} break; ${7:/*more cases*/} } @@ -165,7 +165,7 @@ endsnippet snippet case "case (case)" b case ${1:/*value*/}: - ${2:/*code*/} + ${2} break; endsnippet @@ -178,42 +178,42 @@ endsnippet snippet do "do while (do)" b do { - ${VISUAL}${2:/*code*/} + ${VISUAL}${2} } while(${1:/*condition*/}); endsnippet snippet wh "while (wh)" b while(${1:/*condition*/}) { - ${VISUAL}${2:/*code*/} + ${VISUAL}${2} } endsnippet snippet for "for (for)" b for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { - ${VISUAL}${0:/*code*/} + ${VISUAL}${0} } endsnippet snippet forever "forever (forever)" b for(;;) { - ${VISUAL}${0:/*code*/} + ${VISUAL}${0} } endsnippet snippet fore "foreach (fore)" foreach(${1:/*elem*/}; ${2:/*range*/}) { - ${VISUAL}${3:/*code*/} + ${VISUAL}${3} } endsnippet snippet forif "foreach if (forif)" b foreach(${1:/*elem*/}; ${2:/*range*/}) if(${3:/*condition*/}) { - ${VISUAL}${4:/*code*/} + ${VISUAL}${4} } endsnippet @@ -249,21 +249,21 @@ endsnippet snippet fun "function definition (fun)" ${1:void} ${2:/*function name*/}(${3:/*args*/}) ${4:@safe pure nothrow} { - ${VISUAL}${5:/*code*/} + ${VISUAL}${5} } endsnippet snippet void "void function definition (void)" void ${1:/*function name*/}(${2:/*args*/}) ${3:@safe pure nothrow} { - ${VISUAL}${4:/*code*/} + ${VISUAL}${4} } endsnippet snippet this "ctor (this)" w this(${1:/*args*/}) { - ${VISUAL}${2:/*code*/} + ${VISUAL}${2} } endsnippet @@ -295,7 +295,7 @@ endsnippet snippet scope "scope (scope)" b scope(${1:exit}) { - ${VISUAL}${2:/*code*/} + ${VISUAL}${2} } endsnippet @@ -304,7 +304,7 @@ endsnippet snippet with "with (with)" with(${1}) { - ${VISUAL}${2:/*code*/} + ${VISUAL}${2} } endsnippet @@ -405,14 +405,14 @@ endsnippet snippet version "version (version)" b version(${1:/*version name*/}) { - ${VISUAL}${2:/*code*/} + ${VISUAL}${2} } endsnippet snippet debug "debug" b debug { - ${VISUAL}${1:/*code*/} + ${VISUAL}${1} } endsnippet @@ -422,7 +422,7 @@ endsnippet snippet temp "template (temp)" b template ${2:/*name*/}(${1:/*args*/}) { - ${3:/*code*/} + ${3} } endsnippet @@ -440,7 +440,7 @@ endsnippet snippet unittest "unittest (unittest)" b unittest { - ${1:/*code*/} + ${1} } endsnippet @@ -450,21 +450,21 @@ endsnippet snippet opDis "opDispatch (opDis)" b ${1:/*return type*/} opDispatch(string s)() { - ${2:/*code*/}; + ${2}; } endsnippet snippet op= "opAssign (op=)" b void opAssign(${1} rhs) ${2:@safe pure nothrow} { - ${2:/*code*/} + ${2} } endsnippet snippet opCmp "opCmp (opCmp)" b int opCmp(${1} rhs) @safe const pure nothrow { - ${2:/*code*/} + ${2} } endsnippet @@ -484,7 +484,7 @@ endsnippet snippet toString "toString (toString)" b string toString() @safe const pure nothrow { - ${1:/*code*/} + ${1} } endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/go.snippets b/sources_non_forked/vim-snippets/UltiSnips/go.snippets index d01e3f1c..efd15892 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/go.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/go.snippets @@ -52,6 +52,12 @@ for ${1:condition}${1/(.+)/ /}{ } endsnippet +snippet fori "Integer for loop" b +for ${1:i} := 0; $1 < ${2:N}; $1++ { + ${0:${VISUAL}} +} +endsnippet + snippet forr "For range loop" b for ${2:name} := range ${1:collection} { ${0:${VISUAL}} diff --git a/sources_non_forked/vim-snippets/UltiSnips/java.snippets b/sources_non_forked/vim-snippets/UltiSnips/java.snippets index 21be6bef..02b95e1e 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/java.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/java.snippets @@ -60,7 +60,7 @@ abstract $0 endsnippet snippet as "assert" b -assert ${1:test}${2/(.+)/(?1: \: ")/}${2:Failure message}${2/(.+)/(?1:")/};$0 +assert ${1:test}${2/(.+)/(?1: \: ")/}${2:Failure message}${2/(.+)/(?1:")/}; endsnippet snippet at "assert true" b @@ -68,7 +68,7 @@ assertTrue(${1:actual}); endsnippet snippet af "assert false" b -assertFalse(${1:actual});$0 +assertFalse(${1:actual}); endsnippet snippet ae "assert equals" b @@ -141,7 +141,7 @@ if len(args) > 0: public `!p snip.rv = snip.basename or "unknown"`($1) { `!p args = getArgs(t[1]) for i in args: - snip.rv += "\n\t\tthis." + i[1] + " = " + i[1] + snip.rv += "\n\t\tthis.%s = %s;" % (i[1], i[1]) if len(args) == 0: snip.rv += "\n"` } @@ -224,7 +224,7 @@ $0 endsnippet snippet im "import" b -import ${1:java}.${2:util}.$0 +import ${1:java}.${2:util}.$0; endsnippet snippet in "interface" b @@ -269,7 +269,7 @@ if len(args) > 0: public `!p snip.rv = snip.basename or "unknown"`($1) { `!p args = getArgs(t[1]) for i in args: - snip.rv += "\n\t\tthis." + i[1] + " = " + i[1] + snip.rv += "\n\t\tthis.%s = %s;" % (i[1], i[1]) if len(args) == 0: snip.rv += "\n"` } diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets index f8d4790e..5889e059 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets @@ -79,6 +79,14 @@ setTimeout(function() { }${2:.bind(${3:this})}, ${1:10}); endsnippet +snippet fi "for prop in obj using hasOwnProperty" b +for (${1:prop} in ${2:obj}){ + if ($2.hasOwnProperty($1)) { + ${VISUAL}$0 + } +} +endsnippet + # Snippets for Console Debug Output snippet ca "console.assert" b @@ -121,6 +129,10 @@ snippet cl "console.log" b console.log(${1:"${2:value}"}); endsnippet +snippet cd "console.debug" b +console.debug(${1:"${2:value}"}); +endsnippet + snippet cprof "console.profile" b console.profile("${1:label}"); ${VISUAL}$0 diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript_angular.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript_angular.snippets new file mode 100644 index 00000000..76e9ca1d --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript_angular.snippets @@ -0,0 +1,25 @@ +priority -50 + +snippet iti "it (js, inject)" b +it('${1:description}', inject(function($2) { + $0 +})); +endsnippet + +snippet befi "before each (js, inject)" b +beforeEach(inject(function($1) { + $0 +})); +endsnippet + +snippet aconf "angular config" i +config(function($1) { + $0 +}); +endsnippet + +snippet acont "angular controller" i +controller('${1:name}', function($2) { + $0 +}); +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/julia.snippets b/sources_non_forked/vim-snippets/UltiSnips/julia.snippets new file mode 100644 index 00000000..259c5f4c --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/julia.snippets @@ -0,0 +1,34 @@ +# Documentation +snippet docf "function documentation" b +#' @description +#' +#' ${1:function description} +#' +#' ${2:@param ${3:name}::${4:Type} ${5:Description}} +#' +#' ${6:@returns ${7:name}::${8:Type} ${9:Description}} +#' +#' @examples +#' +#' ${10: function call examples} +endsnippet + +snippet doct "type definition" b +#' @description +#' +#' ${1:type description} +#' +#' ${2:@field ${3:name}::${4:Type} ${5:Description}} +#' +#' @examples +#' +#' ${10: constructor examples} +endsnippet + +snippet par "function parameter documentation" b +#' @param ${1:name}::${2:Type} ${0:Description} +endsnippet + +snippet fld "type field documentation" b +#' @field ${1:name}::${2:Type} ${0:Description} +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets b/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets index fa708ab8..0720cbfc 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets @@ -39,4 +39,15 @@ snippet img "Image" ![${1:pic alt}](${2:path}${3/.+/ "/}${3:opt title}${3/.+/"/})$0 endsnippet +snippet ilc "Inline Code" i +\`$1\`$0 +endsnippet + +snippet cbl "Codeblock" b +\`\`\` +$1 +\`\`\` +$0 +endsnippet + # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/pandoc.snippets b/sources_non_forked/vim-snippets/UltiSnips/pandoc.snippets new file mode 100644 index 00000000..157c9ef0 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/pandoc.snippets @@ -0,0 +1,3 @@ +priority -49 + +extends markdown diff --git a/sources_non_forked/vim-snippets/UltiSnips/php_symfony2.snippets b/sources_non_forked/vim-snippets/UltiSnips/php_symfony2.snippets index 3d433169..55423e71 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/php_symfony2.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/php_symfony2.snippets @@ -3,6 +3,28 @@ priority -50 +snippet classn "Basic class with namespace snippet" b +namespace `!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`; + +/** + * ${1:@author `whoami`} + */ +class `!p +snip.rv = re.match(r'.*(?=\.)', fn).group() +`$2 +{ + public function __construct(${3:$options}) + { + ${4:// code} + }$0 +} +endsnippet + snippet contr "Symfony2 controller" b namespace `!p abspath = os.path.abspath(path) diff --git a/sources_non_forked/vim-snippets/UltiSnips/r.snippets b/sources_non_forked/vim-snippets/UltiSnips/r.snippets index d78a1d72..10c818c0 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/r.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/r.snippets @@ -1,9 +1,42 @@ priority -50 +global !p +import os +from vimsnippets import complete + +FIELD_TYPES = [ +'character', +'data.frame', +'integer', +'list', +'logical', +'matrix', +'numeric', +'vector'] +endglobal + snippet #! "Hashbang for Rscript (#!)" b #!/usr/bin/env Rscript endsnippet +snippet setwd "Set workingdir" b +setwd("${1:`!p snip.rv = os.getcwd()`}") +endsnippet + +snippet as "Apply type on variable" w +as.$1`!p snip.rv = complete(t[1], FIELD_TYPES)`(${2}${VISUAL}) +endsnippet + +snippet is "Test type on variable" w +is.$1`!p snip.rv = complete(t[1], FIELD_TYPES)`(${2}${VISUAL}) +endsnippet + +snippet dl "Download and install a package" b +download.file("${1:${VISUAL:url to package}}", destfile = "${2:${1/.*\/(\S*)$/(?1:$1)/ga}}") +install.packages("$2", type = "source", repos = NULL) +library("${3:${2/^(\w+)_.*$/(?1:$1)/ga}}") +endsnippet + snippet lib "Import a library" library(${0:package}) endsnippet @@ -48,7 +81,7 @@ while(${1}) { endsnippet snippet for "for loop" -for ({${1:item} in ${2:list}) { +for (${1:item} in ${2:list}) { ${3} } endsnippet @@ -88,7 +121,7 @@ lapply(${1:list}, ${0:function}) endsnippet snippet sapply "sapply function" -lapply(${1:list}, ${0:function}) +sapply(${1:list}, ${0:function}) endsnippet snippet vapply "vapply function" diff --git a/sources_non_forked/vim-snippets/UltiSnips/rust.snippets b/sources_non_forked/vim-snippets/UltiSnips/rust.snippets index 98a371ff..d7f0047c 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/rust.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/rust.snippets @@ -2,45 +2,70 @@ # Rust Snippets # ####################################################################### -############### -# Functions # -############### -snippet fn "A function, optionally with arguments and return type." +priority -50 + +snippet fn "A function, optionally with arguments and return type." b fn ${1:function_name}(${2})${3/..*/ -> /}${3} { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet -snippet test "Test function" +snippet test "Test function" b #[test] fn ${1:test_function_name}() { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} -} -endsnippet - -snippet new "A new function" -pub fn new(${2}) -> ${1:Name} { - ${VISUAL}${0}return $1 { ${3} }; -} -endsnippet - -snippet main "The main function" -pub fn main() { ${VISUAL}${0} } endsnippet +snippet bench "Bench function" b +#[bench] +fn ${1:bench_function_name}(b: &mut test::Bencher) { + b.iter(|| { + ${VISUAL}${0} + }) +} +endsnippet -snippet let "A let statement" +snippet new "A new function" b +pub fn new(${2}) -> ${1:Name} { + ${VISUAL}${0}return $1 { ${3} }; +} +endsnippet + +snippet main "The main function" b +pub fn main() { + ${VISUAL}${0} +} +endsnippet + +snippet let "A let statement" b let ${1:name}${3} = ${VISUAL}${2}; endsnippet +snippet lmut "let mut = .." b +let mut ${1:name}${3} = ${VISUAL}${2}; +endsnippet + +snippet pri "print!(..)" b +print!("${1}"${2/..*/, /}${2}); +endsnippet + snippet pln "println!(..)" b println!("${1}"${2/..*/, /}${2}); endsnippet +snippet fmt "format!(..)" +format!("${1}"${2/..*/, /}${2}); +endsnippet +snippet macro "macro_rules!" b +macro_rules! ${1:name} ( + (${2:matcher}) => ( + ${3} + ) +) +endsnippet snippet ec "extern crate ..." b extern crate ${1:sync}; @@ -51,10 +76,10 @@ snippet ecl "...extern crate log;" b #[phase(syntax, link)] extern crate log; endsnippet -snippet mod "A mod." b +snippet mod "A module" b mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} -} /* $1 */ + ${VISUAL}${0} +} endsnippet snippet crate "Create header information" b @@ -78,24 +103,45 @@ snippet feat "#![feature(..)]" b #![feature(${1:macro_rules})] endsnippet +snippet der "#[deriving(..)]" b +#[deriving(${1:Show})] +endsnippet + +snippet attr "#[..]" b +#[${1:inline}] +endsnippet -################## -# Common types # -################## snippet opt "Option<..>" Option<${1:int}> endsnippet snippet res "Result<.., ..>" -Result<${1:~str}, ${2:()}> +Result<${1:int}, ${2:()}> endsnippet - - - snippet if "if .. (if)" b -if ${1:/* condition */} { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} +if ${1} { + ${VISUAL}${0} +} +endsnippet + +snippet el "else .. (el)" +else { + ${VISUAL}${0} +} +endsnippet + +snippet eli "else if .. (eli)" +else if ${1} { + ${VISUAL}${0} +} +endsnippet + +snippet ife "if .. else (ife)" +if ${1} { + ${2} +} else { + ${3} } endsnippet @@ -105,21 +151,27 @@ match ${1} { } endsnippet +snippet loop "loop {}" b +loop { + ${VISUAL}${0} +} +endsnippet + snippet while "while .. {}" b -while ${1:condition} { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} +while ${1} { + ${VISUAL}${0} } endsnippet snippet for "for .. in .." b for ${1:i} in ${2:range(0u, 10)} { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet snippet spawn "spawn(proc() { .. });" b spawn(proc() { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} }); endsnippet @@ -131,26 +183,23 @@ snippet duplex "Duplex stream" b let (${1:from_child}, ${2:to_child}) = sync::duplex(); endsnippet -##################### -# TODO commenting # -##################### snippet todo "A Todo comment" // [TODO]: ${1:Description} - `!v strftime("%Y-%m-%d %I:%M%P")` endsnippet +snippet fixme "FIXME comment" +// FIXME: ${1} +endsnippet -############ -# Struct # -############ snippet st "Struct" b -struct ${1:`!p snip.rv = snip.basename.title() or "name"`} { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} +struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} { + ${VISUAL}${0} } endsnippet snippet stn "Struct with new constructor." b -pub struct ${1:`!p snip.rv = snip.basename.title() or "name"`} { - ${3:/* code */} +pub struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} { + ${3} } impl $1 { @@ -162,48 +211,36 @@ impl $1 { } endsnippet - -########## -# Enum # -########## snippet enum "An enum" b -enum ${1:enum_name} { +enum ${1:Name} { ${VISUAL}${0}, } endsnippet +snippet type "A type" b +type ${1:NewName} = ${VISUAL}${0}; +endsnippet -########## -# Impl # -########## snippet imp "An impl" b impl ${1:Name} { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet snippet drop "Drop implementation" b impl Drop for ${1:Name} { fn drop(&mut self) { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } } endsnippet - -############ -# Traits # -############ -snippet trait "Trait block" b +snippet trait "Trait definition" b trait ${1:Name} { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet - -############# -# Statics # -############# snippet ss "A static string." static ${1}: &'static str = "${VISUAL}${0}"; endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/tex.snippets b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets index c32d21f1..ede9090d 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/tex.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets @@ -8,7 +8,7 @@ snippet "b(egin)?" "begin{} / end{}" br \end{$1} endsnippet -snippet tab +snippet tab "tabular / array environment" b \begin{${1:t}${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}{${2:c}} $0${2/((?<=.)c|l|r)|./(?1: & )/g} \end{$1${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}} diff --git a/sources_non_forked/vim-snippets/UltiSnips/vim.snippets b/sources_non_forked/vim-snippets/UltiSnips/vim.snippets index 5ff22d2e..dbb2396d 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/vim.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/vim.snippets @@ -3,58 +3,22 @@ priority -50 ########################################################################### # SnipMate Snippets # ########################################################################### -snippet header -" File: ${1:`!v expand('%:t')`} -" Author: ${2:`!v g:snips_author`} -" Description: ${3} -${4:" Last Modified: `!v strftime("%B %d, %Y")`} - -$0 -endsnippet - -snippet gvar "Global / configuration variable" +snippet gvar "Global / configuration variable" b if !exists("g:${1:MyUltraImportantVar}") let g:$1 = ${2:"${3:}"} endif endsnippet -snippet guard +snippet guard "script reload guard" b if exists('${1:did_`!p snip.rv = snip.fn.replace('.','_')`}') || &cp${2: || version < 700} finish endif let $1 = 1${3} endsnippet -snippet f +snippet f "function" b fun ${1:function_name}(${2}) ${3:" code} endf endsnippet - -snippet for -for ${1:needle} in ${2:haystack} - ${3:" code} -endfor -endsnippet - -snippet wh -while ${1:condition} - ${2:" code} -endw -endsnippet - -snippet if -if ${1:condition} - ${2:" code} -endif -endsnippet - -snippet ife -if ${1:condition} - ${2} -else - ${3} -endif -endsnippet - # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/snippets/_.snippets b/sources_non_forked/vim-snippets/snippets/_.snippets index 6a3d8b28..85616018 100644 --- a/sources_non_forked/vim-snippets/snippets/_.snippets +++ b/sources_non_forked/vim-snippets/snippets/_.snippets @@ -84,6 +84,24 @@ snippet LGPL3 You should have received a copy of the GNU Lesser General Public License along with this library; if not, see . + ${0} +snippet AGPL3 + ${1:one line to give the program's name and a brief description.} + Copyright (C) `strftime("%Y")` ${2:copyright holder} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + ${0} snippet BSD2 ${1:one line to give the program's name and a brief description} diff --git a/sources_non_forked/vim-snippets/snippets/css.snippets b/sources_non_forked/vim-snippets/snippets/css.snippets index 8886643a..c4a74dec 100644 --- a/sources_non_forked/vim-snippets/snippets/css.snippets +++ b/sources_non_forked/vim-snippets/snippets/css.snippets @@ -965,3 +965,23 @@ snippet z:a z-index: auto; snippet zoo zoom: 1; +snippet :h + :hover +snippet :fc + :first-child +snippet :lc + :last-child +snippet :nc + :nth-child(${0}) +snippet :nlc + :nth-last-child(${0}) +snippet :oc + :only-child +snippet :a + :after +snippet :b + :before +snippet ::a + ::after +snippet ::b + ::before diff --git a/sources_non_forked/vim-snippets/snippets/elixir.snippets b/sources_non_forked/vim-snippets/snippets/elixir.snippets index bd84cd96..077cf031 100644 --- a/sources_non_forked/vim-snippets/snippets/elixir.snippets +++ b/sources_non_forked/vim-snippets/snippets/elixir.snippets @@ -6,122 +6,95 @@ snippet if if .. do .. end if ${1} do ${0} end - snippet if if .. do: .. if ${1:condition}, do: ${0} - snippet ife if .. do .. else .. end if ${1:condition} do ${2} else ${0} end - snippet ife if .. do: .. else: if ${1:condition}, do: ${2}, else: ${0} - snippet unless unless .. do .. end unless ${1} do ${0} end - snippet unless unless .. do: .. unless ${1:condition}, do: ${0} - snippet unlesse unless .. do .. else .. end unless ${1:condition} do ${2} else ${0} end - snippet unlesse unless .. do: .. else: unless ${1:condition}, do: ${2}, else: ${0} - snippet cond cond do ${1} -> ${0} end - snippet case case ${1} do ${2} -> ${0} end - snippet df def ${1:name}, do: ${2} - snippet def def ${1:name} do ${0} end - snippet defim defimpl ${1:protocol_name}, for: ${2:data_type} do ${0} end - snippet defma defmacro ${1:name} do ${0} end - snippet defmo defmodule ${1:module_name} do ${0} end - snippet defp defp ${1:name} do ${0} end - snippet defpr defprotocol ${1:name}, [${0:function}] - snippet defr defrecord ${1:record_name}, ${0:fields} - snippet doc @doc """ ${0} """ - snippet fn fn(${1:args}) -> ${0} end - snippet fun - function do - ${0} - end - + function do + ${0} + end snippet mdoc @moduledoc """ ${0} """ - snippet rec receive do ${1} -> ${0} end - snippet req require ${0:module_name} - snippet imp import ${0:module_name} - snippet ali alias ${0:module_name} - snippet test test "${1:test_name}" do ${0} end - snippet try try .. rescue .. end try do ${1} diff --git a/sources_non_forked/vim-snippets/snippets/go.snippets b/sources_non_forked/vim-snippets/snippets/go.snippets index 0239a3fb..8623eda2 100644 --- a/sources_non_forked/vim-snippets/snippets/go.snippets +++ b/sources_non_forked/vim-snippets/snippets/go.snippets @@ -230,3 +230,15 @@ snippet ga go func(${1} ${2:type}) { ${3:/* code */} }(${0}) +snippet test test function + func Test${1:name}(t *testing.T) { + ${2} + } + ${0} +snippet bench benchmark function + func Benchmark${1:name}(b *testing.B) { + for i := 0; i < b.N; i++ { + ${2} + } + } + ${0} diff --git a/sources_non_forked/vim-snippets/snippets/html.snippets b/sources_non_forked/vim-snippets/snippets/html.snippets index 567003f7..5620caae 100644 --- a/sources_non_forked/vim-snippets/snippets/html.snippets +++ b/sources_non_forked/vim-snippets/snippets/html.snippets @@ -147,6 +147,8 @@ snippet a:ext ${0:$1} snippet a:mail ${0:email me} +snippet ac + ${0:`@+`} snippet abbr ${0} snippet address @@ -449,7 +451,8 @@ snippet html5 - + + ${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`} ${2:meta} diff --git a/sources_non_forked/vim-snippets/snippets/html_minimal.snippets b/sources_non_forked/vim-snippets/snippets/html_minimal.snippets deleted file mode 100644 index 43e5d4a4..00000000 --- a/sources_non_forked/vim-snippets/snippets/html_minimal.snippets +++ /dev/null @@ -1,72 +0,0 @@ -# file containing most useful mappings only -# when editing this file please be aware that there is ZenCoding and sparkup - -# html 5 is recommended from now on -snippet html5 - - - - - $2 - $3 - - - $4 - - - -# ==== TAGS -# you always need these: -snippet . - class="${1}" -snippet n - name="${1}" -snippet r - rel="${1}" -snippet t - title="${1}" - -# not using # because id is faster to type -snippet id - id="${1}" -snippet idn - id="${1}" name="${0:$1}" - -snippet label_and_input - - - - -# FORMS -# use idn . or n to add id -snippet input - -snippet submit - -snippet textarea - - -# if you need id or class use snippets above -snippet form -
- $3 -
- -# other tags -snippet br -
-snippet a - $3 -snippet img - $2 -# JS/CSS -snippet css_file - -snippet css_block - -snippet script_block - -snippet script_file - diff --git a/sources_non_forked/vim-snippets/snippets/java.snippets b/sources_non_forked/vim-snippets/snippets/java.snippets index 1595ffc1..ea2ec7aa 100644 --- a/sources_non_forked/vim-snippets/snippets/java.snippets +++ b/sources_non_forked/vim-snippets/snippets/java.snippets @@ -1,10 +1,10 @@ ## Access Modifiers snippet po - protected + protected ${0} snippet pu - public + public ${0} snippet pr - private + private ${0} ## ## Annotations snippet before @@ -25,7 +25,7 @@ snippet oo ## ## Basic Java packages and import snippet im - import + import ${0} snippet j.b java.beans. snippet j.i @@ -39,17 +39,17 @@ snippet j.u ## ## Class snippet cl - class ${1:`vim_snippets#Filename("", "untitled")`} ${0} + class ${1:`vim_snippets#Filename("$1", "untitled")`} ${0} snippet in - interface ${1:`vim_snippets#Filename("", "untitled")`} ${2:extends Parent} + interface ${1:`vim_snippets#Filename("$1", "untitled")`} ${2:extends Parent} snippet tc - public class ${1:`vim_snippets#Filename()`} extends ${0:TestCase} + public class ${1:`vim_snippets#Filename("$1")`} extends ${0:TestCase} ## ## Class Enhancements snippet ext - extends + extends ${0} snippet imp - implements + implements ${0} ## ## Comments snippet /* @@ -89,15 +89,40 @@ snippet m snippet v ${1:String} ${2:var}${3: = null}${4}; ## +## Declaration for ArrayList +snippet d.al + List<${1:Object}> ${2:list} = new ArrayList<$1>();${0} +## Declaration for HashMap +snippet d.hm + Map<${1:Object}, ${2:Object}> ${3:map} = new HashMap<$1, $2>();${0} +## Declaration for HashSet +snippet d.hs + Set<${1:Object}> ${2:set} = new HashSet<$1>();${0} +## Declaration for Stack +snippet d.st + Stack<${1:Object}> ${2:stack} = new Stack<$1>();${0} +## +## Singleton Pattern +snippet singlet + private static class Holder { + private static final ${1:`vim_snippets#Filename("$1")`} INSTANCE = new $1(); + } + + private $1() { } + + public static $1 getInstance() { + return Holder.INSTANCE; + } +## ## Enhancements to Methods, variables, classes, etc. snippet ab - abstract + abstract ${0} snippet fi - final + final ${0} snippet st - static + static ${0} snippet sy - synchronized + synchronized ${0} ## ## Error Methods snippet err @@ -110,12 +135,30 @@ snippet errln ## Exception Handling snippet as assert ${1:test} : "${2:Failure message}"; +snippet ae + assertEquals("${1:Failure message}", ${2:expected}, ${3:actual}); +snippet aae + assertArrayEquals("${1:Failure message}", ${2:expecteds}, ${3:actuals}); +snippet af + assertFalse("${1:Failure message}", ${2:condition}); +snippet at + assertTrue("${1:Failure message}", ${2:condition}); +snippet an + assertNull("${1:Failure message}", ${2:object}); +snippet ann + assertNotNull("${1:Failure message}", ${2:object}); +snippet ass + assertSame("${1:Failure message}", ${2:expected}, ${3:actual}); +snippet asns + assertNotSame("${1:Failure message}", ${2:expected}, ${3:actual}); +snippet fa + fail("${1:Failure message}"); snippet ca catch(${1:Exception} ${2:e}) ${0} snippet thr - throw + throw ${0} snippet ths - throws + throws ${0} snippet try try { ${0} @@ -144,7 +187,7 @@ snippet @au snippet @br @brief ${0:Description} snippet @fi - @file ${0:`vim_snippets#Filename()`}.java + @file ${0:`vim_snippets#Filename("$1")`}.java snippet @pa @param ${0:param} snippet @re @@ -206,7 +249,7 @@ snippet get ## ## Terminate Methods or Loops snippet re - return + return ${0} snippet br break; ## diff --git a/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets b/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets index 0a046dbf..39a008ef 100644 --- a/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets +++ b/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets @@ -13,7 +13,7 @@ snippet fun snippet f function (${1}) { ${0} - }${2:;} + } # Immediate function snippet (f (function (${1}) { diff --git a/sources_non_forked/vim-snippets/snippets/julia.snippets b/sources_non_forked/vim-snippets/snippets/julia.snippets new file mode 100644 index 00000000..1876ed84 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/julia.snippets @@ -0,0 +1,102 @@ +snippet #! + #!/usr/bin/env julia + +# Functions +snippet fun function definition + function ${1}(${2}) + ${0} + end + +snippet ret return + return(${0}) + +# Printing to console +snippet pr print + print("${1}") + ${0} + +snippet prl print line + println("${1}") + ${0} + +# Includes +snippet use load a package + using ${0} + +snippet incl include source code + include("${1}") + ${0} + +# Loops +snippet forc for loop iterating over iterable container + for ${1} in ${2} + ${0} + end + +snippet for standard for loop + for ${1} = ${2} + ${0} + end + +snippet fornest nested for loop + for ${1} = ${2}, ${3} = ${4} + ${0} + end + +snippet wh while loop + while ${1} ${2:<=} ${3} + ${0} + end + +# Conditionals +snippet if if statement + if ${1} + ${0} + end + +snippet el else part of statement + else + ${0} + +snippet eif else if part of if statement + else if ${1} + ${0} + +snippet ife full if-else statement + if ${1} + ${2} + else + ${0} + end + +snippet tern ternary operator + ${1} ? ${2} : ${3:nothing} + +# Exceptions +snippet try try catch + try + ${1} + catch ${2} + ${0} + end + +snippet fin finally statement + finally + ${0} + +snippet thr throw + throw(${1}) + ${0} + +# Messages +snippet in + info("${1}") + ${0} + +snippet wa + warn("${1}") + ${0} + +snippet err + error("${1}") + ${0} diff --git a/sources_non_forked/vim-snippets/snippets/php.snippets b/sources_non_forked/vim-snippets/snippets/php.snippets index d7b21eb5..831d53db 100644 --- a/sources_non_forked/vim-snippets/snippets/php.snippets +++ b/sources_non_forked/vim-snippets/snippets/php.snippets @@ -40,7 +40,7 @@ snippet i snippet t. $this-> snippet f - function ${1:foo}(${2:array }${3:$bar}) + function ${1}(${3}) { ${0} } diff --git a/sources_non_forked/vim-snippets/snippets/r.snippets b/sources_non_forked/vim-snippets/snippets/r.snippets index c7ca5aca..7bdeeec0 100644 --- a/sources_non_forked/vim-snippets/snippets/r.snippets +++ b/sources_non_forked/vim-snippets/snippets/r.snippets @@ -23,9 +23,19 @@ snippet ei ${0} } +# loops +snippet wh + while(${1}) { + ${2} + } +snippet for + for (${1:item} in ${2:list}) { + ${3} + } + # functions snippet fun - ${1:name} = function (${2:variables}) { + ${1:name} <- function (${2:variables}) { ${0} } snippet ret @@ -39,7 +49,7 @@ snippet c snippet li list(${0:items}) snippet mat - matrix(${1:data}, nrow=${2:rows}, ncol=${0:cols}) + matrix(${1:data}, nrow = ${2:rows}, ncol = ${0:cols}) # apply functions snippet apply @@ -100,7 +110,7 @@ snippet pl snippet ggp ggplot(${1:data}, aes(${0:aesthetics})) snippet img - ${1:(jpeg,bmp,png,tiff)}(filename="${2:filename}", width=${3}, height=${4}, unit="${5}") + ${1:(jpeg,bmp,png,tiff)}(filename = '${2:filename}', width = ${3}, height = ${4}, unit = '${5}') ${0:plot} dev.off() diff --git a/sources_non_forked/vim-snippets/snippets/ruby.snippets b/sources_non_forked/vim-snippets/snippets/ruby.snippets index 6ee11d4b..5d9c01ea 100644 --- a/sources_non_forked/vim-snippets/snippets/ruby.snippets +++ b/sources_non_forked/vim-snippets/snippets/ruby.snippets @@ -1030,9 +1030,9 @@ snippet aft ${0} end snippet let - let(:${1:object}) ${0} + let(:${1:object}) { ${0} } snippet let! - let!(:${1:object}) ${0} + let!(:${1:object}) { ${0} } snippet subj subject { ${0} } snippet s. diff --git a/sources_non_forked/vim-snippets/snippets/rust.snippets b/sources_non_forked/vim-snippets/snippets/rust.snippets new file mode 100644 index 00000000..d4b9264d --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/rust.snippets @@ -0,0 +1,125 @@ +################# +# Rust Snippets # +################# + +# Functions +snippet fn + fn ${1:function_name}(${2}) { + ${0} + } +snippet fn- + fn ${1:function_name}(${2}) -> ${3} { + ${0} + } +snippet test + #[test] + fn ${1:test_function_name}() { + ${0} + } +snippet new + pub fn new(${2}) -> ${1:Name} { + ${0}return $1 { ${3} }; + } +snippet main + pub fn main() { + ${0} + } +snippet let + let ${1:name}${3} = ${2}; +snippet pln + println!("${1}"); +snippet pln, + println!("${1}", ${2}); +snippet ec + extern crate ${1:sync}; +snippet ecl + #![feature(phase)] + #[phase(syntax, link)] extern crate log; +snippet mod + mod ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} { + ${0} + } /* $1 */ +snippet crate + // Crate ID + #![crate_id = "${1:crate_name}#${2:0.0.1}"] + // Additional metadata attributes + #![desc = "${3:Descrption.}"] + #![license = "${4:BSD}"] + #![comment = "${5:Comment.}"] + // Specify the output type + #![crate_type = "${6:lib}"] +snippet allow + #[allow(${1:unused_variable})] +snippet feat + #![feature(${1:macro_rules})] +# Common types +snippet opt + Option<${1:int}> +snippet res + Result<${1:~str}, ${2:()}> +snippet if + if ${1:/* condition */} { + ${0} + } +snippet mat + match ${1} { + ${2} => ${3}, + } +snippet while + while ${1:condition} { + ${0} + } +snippet for + for ${1:i} in ${2:range(0u, 10)} { + ${0} + } +snippet spawn + spawn(proc() { + ${0} + }); +snippet chan + let (${1:tx}, ${2:rx}): (Sender<${3:int}>, Receiver<${4:int}>) = channel(); +snippet duplex + let (${1:from_child}, ${2:to_child}) = sync::duplex(); +# TODO commenting +snippet todo + // [TODO]: ${1:Description} +# Struct +snippet st + struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} { + ${0} + } + + impl $1 { + pub fn new(${2}) -> $1 { + ${4}return $1 { + ${5} + }; + } + } +# Enum +snippet enum + enum ${1:enum_name} { + ${0}, + } +# Impl +snippet imp + impl ${1:Name} { + ${0} + } +snippet drop + impl Drop for ${1:Name} { + fn drop(&mut self) { + ${0} + } + } +# Traits +snippet trait + trait ${1:Name} { + ${0} + } +# Statics +snippet ss + static ${1}: &'static str = "${0}"; +snippet stat + static ${1}: ${2:uint} = ${0}; diff --git a/sources_non_forked/vim-snippets/snippets/scheme.snippets b/sources_non_forked/vim-snippets/snippets/scheme.snippets new file mode 100644 index 00000000..035d5348 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/scheme.snippets @@ -0,0 +1,36 @@ +snippet + + (+ ${1} + ${0}) + +snippet - + (- ${1} + ${0}) + +snippet / + (/ ${1} + ${0}) + +snippet * + (* ${1} + ${0}) + +# Definition +snippet def + (define (${1:name}) + (${0:definition})) + +# Definition with lambda +snippet defl + (define ${1:name} + (lambda (x)(${0:definition}))) + +# Condition +snippet cond + (cond ((${1:predicate}) (${2:action})) + ((${3:predicate}) (${0:action}))) + +# If statement +snippet if + (if (${1:predicate}) + (${2:true-action}) + (${0:false-action})) diff --git a/sources_non_forked/vim-snippets/snippets/sh.snippets b/sources_non_forked/vim-snippets/snippets/sh.snippets index 6bf7089c..c9c6ebc3 100644 --- a/sources_non_forked/vim-snippets/snippets/sh.snippets +++ b/sources_non_forked/vim-snippets/snippets/sh.snippets @@ -81,7 +81,7 @@ snippet getopt done shift $(($OPTIND-1)) snippet root - if [ $(id -u) -ne 0 ]; then exec sudo $0; fi + if [ \$(id -u) -ne 0 ]; then exec sudo \$0; fi snippet fun ${1:function_name}() { ${0:#function_body} diff --git a/sources_non_forked/vim-snippets/snippets/tex.snippets b/sources_non_forked/vim-snippets/snippets/tex.snippets index f3c090e6..37fcc91b 100644 --- a/sources_non_forked/vim-snippets/snippets/tex.snippets +++ b/sources_non_forked/vim-snippets/snippets/tex.snippets @@ -1,215 +1,224 @@ #PREAMBLE #newcommand -snippet nc +snippet nc \newcommand \newcommand{\${1:cmd}}[${2:opt}]{${3:realcmd}} ${0} #usepackage -snippet up +snippet up \usepackage \usepackage[${1:options}]{${2:package}} ${0} #newunicodechar -snippet nuc +snippet nuc \newunicodechar \newunicodechar{${1}}{${2:\ensuremath}${3:tex-substitute}}} ${0} #DeclareMathOperator -snippet dmo +snippet dmo \DeclareMathOperator \DeclareMathOperator{${1}}{${2}} ${0} #DOCUMENT # \begin{}...\end{} -snippet begin +snippet begin \begin{} ... \end{} block \begin{${1:env}} ${0} \end{$1} # Tabular -snippet tab +snippet tab tabular (or arbitrary) environment \begin{${1:tabular}}{${2:c}} - ${0} + ${0} \end{$1} -snippet thm +snippet thm thm (or arbitrary) environment with optional argument \begin[${1:author}]{${2:thm}} - ${0} + ${0} \end{$2} -snippet center +snippet center center environment \begin{center} ${0} \end{center} # Align(ed) -snippet ali +snippet ali align(ed) environment \begin{align${1:ed}} + \label{eq:${2}} ${0} \end{align$1} # Gather(ed) -snippet gat +snippet gat gather(ed) environment \begin{gather${1:ed}} ${0} \end{gather$1} # Equation -snippet eq +snippet eq equation environment \begin{equation} + \label{eq:${2}} ${0} \end{equation} # Equation -snippet eq* +snippet eq* unnumbered equation environment \begin{equation*} ${0} \end{equation*} # Unnumbered Equation -snippet \ +snippet \ unnumbered equation: \[ ... \] \[ ${0} \] # Equation array -snippet eqnarray +snippet eqnarray eqnarray environment \begin{eqnarray} ${0} \end{eqnarray} +# Label +snippet lab \label + \label{${1:eq:}${2:fig:}${3:tab:}${0}} # Enumerate -snippet enum +snippet enum enumerate environment \begin{enumerate} \item ${0} \end{enumerate} # Itemize -snippet itemize +snippet itemize itemize environment \begin{itemize} \item ${0} \end{itemize} -snippet item +snippet item \item \item ${1} # Description -snippet desc +snippet desc description environment \begin{description} \item[${1}] ${0} \end{description} # Endless new item -snippet ]i +snippet ]i \item (recursive) \item ${1} - ${0:]i} + ${0:]i} # Matrix -snippet mat +snippet mat smart matrix environment \begin{${1:p/b/v/V/B/small}matrix} ${0} \end{$1matrix} # Cases -snippet cas +snippet cas cases environment \begin{cases} ${1:equation}, &\text{ if }${2:case}\\ ${0} \end{cases} # Split -snippet spl +snippet spl split environment \begin{split} ${0} \end{split} # Part -snippet part +snippet part document \part \part{${1:part name}} % (fold) \label{prt:${2:$1}} ${0} % part $2 (end) # Chapter -snippet cha +snippet cha \chapter \chapter{${1:chapter name}} \label{cha:${2:$1}} ${0} # Section -snippet sec +snippet sec \section \section{${1:section name}} \label{sec:${2:$1}} ${0} # Section without number -snippet sec* +snippet sec* \section* \section*{${1:section name}} \label{sec:${2:$1}} ${0} # Sub Section -snippet sub +snippet sub \subsection \subsection{${1:subsection name}} \label{sub:${2:$1}} ${0} # Sub Section without number -snippet sub* +snippet sub* \subsection* \subsection*{${1:subsection name}} \label{sub:${2:$1}} ${0} # Sub Sub Section -snippet subs +snippet subs \subsubsection \subsubsection{${1:subsubsection name}} \label{ssub:${2:$1}} ${0} # Sub Sub Section without number -snippet subs* +snippet subs* \subsubsection* \subsubsection*{${1:subsubsection name}} \label{ssub:${2:$1}} ${0} # Paragraph -snippet par +snippet par \paragraph \paragraph{${1:paragraph name}} \label{par:${2:$1}} ${0} # Sub Paragraph -snippet subp +snippet subp \subparagraph \subparagraph{${1:subparagraph name}} \label{subp:${2:$1}} ${0} -snippet ni +snippet ni \noindent \noindent ${0} #References -snippet itd +snippet itd description \item \item[${1:description}] ${0:item} -snippet figure +snippet figure reference to a figure ${1:Figure}~\ref{${2:fig:}} -snippet table +snippet table reference to a table ${1:Table}~\ref{${2:tab:}} -snippet listing +snippet listing reference to a listing ${1:Listing}~\ref{${2:list}} -snippet section +snippet section reference to a section ${1:Section}~\ref{sec:${2}} ${0} -snippet page +snippet page reference to a page ${1:page}~\pageref{${2}} ${0} -snippet index +snippet index \index \index{${1:index}} ${0} #Citations -snippet citen - \cite{$1} ${0} -# bibtex commands -snippet citep - \citep{$1} ${0} -snippet citet - \citet{$1} ${0} -snippet cite +snippet citen \citen + \citen{${1}} ${0} +# natbib citations +snippet citep \citep + \citep{${1}} ${0} +snippet citet \citet + \citet{${1}} ${0} +snippet cite \cite[]{} \cite[${1}]{${2}} ${0} -snippet fcite +snippet citea \citeauthor + \citeauthor{${1}} ${0} +snippet citey \citeyear + \citeyear{${1}} ${0} +snippet fcite \footcite[]{} \footcite[${1}]{${2}}${0} #Formating text: italic, bold, underline, small capital, emphase .. -snippet it +snippet it italic text \textit{${0:text}} -snippet bf +snippet bf bold face text \textbf{${0:text}} -snippet under +snippet under underline text \underline{${0:text}} -snippet emp +snippet emp emphasize text \emph{${0:text}} -snippet sc +snippet sc small caps text \textsc{${0:text}} #Choosing font -snippet sf +snippet sf sans serife text \textsf{${0:text}} -snippet rm +snippet rm roman font text \textrm{${0:text}} -snippet tt +snippet tt typewriter (monospace) text \texttt{${0:text}} #misc -snippet ft +snippet ft \footnote \footnote{${0:text}} -snippet fig +snippet fig figure environment (includegraphics) \begin{figure} \begin{center} - \includegraphics[scale=${1}]{Figures/${2}} + \includegraphics[scale=${1}]{Figures/${2}} \end{center} \caption{${3}} \label{fig:${4}} \end{figure} ${0} -snippet tikz +snippet tikz figure environment (tikzpicture) \begin{figure} \begin{center} \begin{tikzpicture}[scale=${1:1}] @@ -221,33 +230,31 @@ snippet tikz \end{figure} ${0} #math -snippet stackrel +snippet stackrel \stackrel{}{} \stackrel{${1:above}}{${2:below}} ${0} -snippet frac +snippet frac \frac{}{} \frac{${1:num}}{${2:denom}} ${0} -snippet sum +snippet sum \sum^{}_{} \sum^{${1:n}}_{${2:i=1}} ${0} -snippet lim +snippet lim \lim_{} \lim_{${1:x \to +\infty}} ${0} -snippet frame - \begin{frame}[<+->] - \frametitle{${1:title}} - +snippet frame frame environment + \begin{frame}[${1:t}]{${2:title}} ${0} \end{frame} -snippet block +snippet block block environment \begin{block}{${1:title}} ${0} \end{block} -snippet alert +snippet alert alertblock environment \begin{alertblock}{${1:title}} ${0} \end{alertblock} -snippet example +snippet example exampleblock environment \begin{exampleblock}{${1:title}} ${0} \end{exampleblock} -snippet col2 +snippet col2 two-column environment \begin{columns} \begin{column}{0.5\textwidth} ${1} diff --git a/sources_non_forked/vim-snippets/snippets/vim.snippets b/sources_non_forked/vim-snippets/snippets/vim.snippets index 8e8093b9..b299f512 100644 --- a/sources_non_forked/vim-snippets/snippets/vim.snippets +++ b/sources_non_forked/vim-snippets/snippets/vim.snippets @@ -1,50 +1,52 @@ -snippet header +snippet header standard Vim script file header " File: ${1:`expand('%:t')`} " Author: ${2:`g:snips_author`} " Description: ${3} ${0:" Last Modified: `strftime("%B %d, %Y")`} -snippet guard +snippet guard script reload guard if exists('${1:did_`vim_snippets#Filename()`}') || &cp${2: || version < 700} finish endif let $1 = 1${0} -snippet f +snippet f function fun! ${1:`expand('%') =~ 'autoload' ? substitute(matchstr(expand('%:p'),'autoload/\zs.*\ze.vim'),'[/\\]','#','g').'#' : ''`}${2:function_name}(${3}) ${0} endf -snippet t +snippet t try ... catch statement try ${1} catch ${2} ${0} endtry -snippet for +snippet for for ... in loop for ${1} in ${2} ${0} endfor -snippet forkv +snippet forkv for [key, value] in loop for [${1},${2}] in items(${3}) ${0} unlet $1 $2 endfor -snippet wh +snippet wh while loop while ${1} ${0} endw -snippet if +snippet if if statement if ${1} ${0} endif -snippet ife +snippet ife if ... else statement if ${1} ${2} else ${0} endif -snippet au +snippet au augroup ... autocmd block augroup ${1:AU_NAME} " this one is which you're most likely to use? autocmd ${2:BufRead,BufNewFile} ${3:*.ext,*.ext3|} ${0} augroup end -snippet bun - Bundle '${0}' +snippet bun Vundle.vim Plugin definition + Plugin '${0}' +snippet plug Vundle.vim Plugin definition + Plugin '${0}' diff --git a/sources_non_forked/vim-surround/plugin/surround.vim b/sources_non_forked/vim-surround/plugin/surround.vim index 05b1c5c3..18a49358 100644 --- a/sources_non_forked/vim-surround/plugin/surround.vim +++ b/sources_non_forked/vim-surround/plugin/surround.vim @@ -127,7 +127,7 @@ endfunction function! s:wrap(string,char,type,...) let keeper = a:string let newchar = a:char - let s:tag = "" + let s:input = "" let type = a:type let linemode = type ==# 'V' ? 1 : 0 let special = a:0 ? a:1 : 0 @@ -185,10 +185,10 @@ function! s:wrap(string,char,type,...) if dounmapb silent! cunmap > endif - let s:tag = tag + let s:input = tag if tag != "" let tag = substitute(tag,'>*$','','') - let s:tag = tag . '>' + let s:input = tag . '>' let before = '<'.tag.'>' if tag =~ '/$' let after = '' @@ -217,6 +217,7 @@ function! s:wrap(string,char,type,...) elseif newchar ==# 'f' || newchar ==# 'F' let fnc = input('function: ') if fnc != "" + let s:input = fnc."\" let before = substitute(fnc,'($','','').'(' let after = ')' if newchar ==# 'F' @@ -226,6 +227,7 @@ function! s:wrap(string,char,type,...) endif elseif newchar ==# "\" let fnc = input('function: ') + let s:input = fnc."\" let before = '('.fnc.' ' let after = ')' elseif idx >= 0 @@ -454,7 +456,7 @@ function! s:dosurround(...) " {{{1 if newchar == "" silent! call repeat#set("\Dsurround".char,scount) else - silent! call repeat#set("\Csurround".char.newchar.s:tag,scount) + silent! call repeat#set("\Csurround".char.newchar.s:input,scount) endif endfunction " }}}1 @@ -527,9 +529,9 @@ function! s:opfunc(type,...) " {{{1 let &selection = sel_save let &clipboard = cb_save if a:type =~ '^\d\+$' - silent! call repeat#set("\Y".(a:0 && a:1 ? "S" : "s")."surround".char.s:tag,a:type) + silent! call repeat#set("\Y".(a:0 && a:1 ? "S" : "s")."surround".char.s:input,a:type) else - silent! call repeat#set("\SurroundRepeat".char.s:tag) + silent! call repeat#set("\SurroundRepeat".char.s:input) endif endfunction