From 7267320d1d84f1695483875ea75b1dc3ad75f9f4 Mon Sep 17 00:00:00 2001 From: Dennis Hodapp Date: Sun, 12 Oct 2014 21:03:28 -0500 Subject: [PATCH 01/10] Add support for mouse if it is available --- vimrcs/basic.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vimrcs/basic.vim b/vimrcs/basic.vim index 0ad89416..57b9ac9d 100644 --- a/vimrcs/basic.vim +++ b/vimrcs/basic.vim @@ -102,6 +102,11 @@ set hid set backspace=eol,start,indent set whichwrap+=<,>,h,l +" In many terminal emulators the mouse works just fine, thus enable it. +if has('mouse') + set mouse=a +endif + " Ignore case when searching set ignorecase From a304deea5643868964ce2ded9b33855fc8a5f540 Mon Sep 17 00:00:00 2001 From: amix Date: Fri, 31 Oct 2014 21:30:24 +0000 Subject: [PATCH 02/10] Updated plugins --- sources_non_forked/nerdtree/README.markdown | 4 +- .../nerdtree/lib/nerdtree/path.vim | 24 +- .../nerdtree/nerdtree_plugin/fs_menu.vim | 7 +- sources_non_forked/syntastic/README.markdown | 54 +- .../syntastic/autoload/syntastic/log.vim | 4 +- .../autoload/syntastic/preprocess.vim | 50 ++ .../syntastic/autoload/syntastic/util.vim | 4 +- .../syntastic/doc/syntastic.txt | 53 +- .../syntastic/plugin/syntastic.vim | 218 ++++--- .../plugin/syntastic/autoloclist.vim | 4 +- .../syntastic/plugin/syntastic/balloons.vim | 22 +- .../syntastic/plugin/syntastic/checker.vim | 37 +- .../syntastic/plugin/syntastic/cursor.vim | 4 +- .../plugin/syntastic/highlighting.vim | 4 +- .../syntastic/plugin/syntastic/loclist.vim | 29 +- .../syntastic/plugin/syntastic/modemap.vim | 2 +- .../syntastic/plugin/syntastic/notifiers.vim | 20 +- .../syntastic/plugin/syntastic/registry.vim | 16 +- .../syntastic/plugin/syntastic/signs.vim | 2 +- .../syntax_checkers/c/clang_check.vim | 10 +- .../syntax_checkers/c/clang_tidy.vim | 10 +- .../syntastic/syntax_checkers/c/oclint.vim | 6 +- .../syntax_checkers/css/prettycss.vim | 6 +- .../syntax_checkers/elixir/elixir.vim | 2 +- .../syntax_checkers/haskell/scan.vim | 10 +- .../syntastic/syntax_checkers/html/jshint.vim | 2 - .../syntastic/syntax_checkers/html/tidy.vim | 24 +- .../javascript/closurecompiler.vim | 10 +- .../syntax_checkers/javascript/eslint.vim | 6 +- .../syntax_checkers/javascript/jscs.vim | 10 +- .../syntax_checkers/javascript/jshint.vim | 6 +- .../syntax_checkers/markdown/mdl.vim | 10 +- .../syntax_checkers/python/prospector.vim | 78 +++ .../syntax_checkers/python/pylama.vim | 6 +- .../syntax_checkers/python/pylint.vim | 8 +- .../syntastic/syntax_checkers/r/lint.vim | 6 +- .../syntax_checkers/racket/code-ayatollah.vim | 6 +- .../syntastic/syntax_checkers/sh/bashate.vim | 48 ++ .../syntastic/syntax_checkers/tex/chktex.vim | 16 +- .../syntax_checkers/text/atdtool.vim | 6 +- .../syntax_checkers/typescript/tsc.vim | 10 +- .../syntax_checkers/typescript/tslint.vim | 10 +- .../syntastic/syntax_checkers/xhtml/tidy.vim | 4 +- sources_non_forked/vim-airline/README.md | 10 + .../autoload/airline/extensions/eclim.vim | 16 +- .../autoload/airline/extensions/tabline.vim | 4 +- .../autoload/airline/themes/kalisi.vim | 56 +- .../autoload/airline/themes/murmur.vim | 88 ++- .../vim-commentary/plugin/commentary.vim | 2 +- sources_non_forked/vim-go/.gitignore | 1 + sources_non_forked/vim-go/README.md | 269 +++++++++ sources_non_forked/vim-go/addon-info.json | 6 + sources_non_forked/vim-go/autoload/go/cmd.vim | 144 +++++ .../vim-go/autoload/go/complete.vim | 142 +++++ sources_non_forked/vim-go/autoload/go/def.vim | 106 ++++ sources_non_forked/vim-go/autoload/go/doc.vim | 159 +++++ .../vim-go/autoload/go/errcheck.vim | 36 ++ sources_non_forked/vim-go/autoload/go/fmt.vim | 141 +++++ .../vim-go/autoload/go/import.vim | 236 ++++++++ .../vim-go/autoload/go/lint.vim | 30 + .../vim-go/autoload/go/oracle.vim | 224 +++++++ .../vim-go/autoload/go/package.vim | 152 +++++ .../vim-go/autoload/go/play.vim | 94 +++ .../vim-go/autoload/go/rename.vim | 52 ++ .../vim-go/autoload/go/tool.vim | 181 ++++++ sources_non_forked/vim-go/autoload/go/ui.vim | 89 +++ .../vim-go/autoload/webapi/json.vim | 135 +++++ sources_non_forked/vim-go/compiler/go.vim | 31 + sources_non_forked/vim-go/doc/vim-go.txt | 571 ++++++++++++++++++ .../vim-go/ftdetect/gofiletype.vim | 23 + sources_non_forked/vim-go/ftplugin/go.vim | 63 ++ .../vim-go/ftplugin/go/commands.vim | 92 +++ .../vim-go/ftplugin/go/snippets.vim | 36 ++ .../vim-go/ftplugin/go/tagbar.vim | 55 ++ .../vim-go/gosnippets/UltiSnips/go.snippets | 215 +++++++ .../vim-go/gosnippets/snippets/go.snip | 243 ++++++++ sources_non_forked/vim-go/indent/go.vim | 65 ++ sources_non_forked/vim-go/plugin/go.vim | 134 ++++ sources_non_forked/vim-go/scripts/test.sh | 78 +++ sources_non_forked/vim-go/syntax/go.vim | 276 +++++++++ sources_non_forked/vim-go/syntax/godoc.vim | 47 ++ sources_non_forked/vim-go/syntax/vimgo.vim | 11 + sources_non_forked/vim-golang/README.md | 8 - .../vim-snippets/UltiSnips/css.snippets | 156 ++++- .../vim-snippets/UltiSnips/haskell.snippets | 9 +- .../vim-snippets/UltiSnips/html.snippets | 12 +- .../UltiSnips/javascript_jasmine.snippets | 13 + .../vim-snippets/UltiSnips/python.snippets | 54 +- .../vim-snippets/snippets/eruby.snippets | 2 +- .../vim-snippets/snippets/haskell.snippets | 10 +- .../vim-snippets/snippets/html.snippets | 4 +- .../vim-snippets/snippets/scala.snippets | 5 + .../vim-snippets/snippets/snippets.snippets | 2 + update_plugins.py | 2 +- 94 files changed, 5065 insertions(+), 393 deletions(-) create mode 100644 sources_non_forked/syntastic/syntax_checkers/python/prospector.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/sh/bashate.vim create mode 100644 sources_non_forked/vim-go/.gitignore create mode 100644 sources_non_forked/vim-go/README.md create mode 100644 sources_non_forked/vim-go/addon-info.json create mode 100644 sources_non_forked/vim-go/autoload/go/cmd.vim create mode 100644 sources_non_forked/vim-go/autoload/go/complete.vim create mode 100644 sources_non_forked/vim-go/autoload/go/def.vim create mode 100644 sources_non_forked/vim-go/autoload/go/doc.vim create mode 100644 sources_non_forked/vim-go/autoload/go/errcheck.vim create mode 100644 sources_non_forked/vim-go/autoload/go/fmt.vim create mode 100644 sources_non_forked/vim-go/autoload/go/import.vim create mode 100644 sources_non_forked/vim-go/autoload/go/lint.vim create mode 100644 sources_non_forked/vim-go/autoload/go/oracle.vim create mode 100644 sources_non_forked/vim-go/autoload/go/package.vim create mode 100644 sources_non_forked/vim-go/autoload/go/play.vim create mode 100644 sources_non_forked/vim-go/autoload/go/rename.vim create mode 100644 sources_non_forked/vim-go/autoload/go/tool.vim create mode 100644 sources_non_forked/vim-go/autoload/go/ui.vim create mode 100644 sources_non_forked/vim-go/autoload/webapi/json.vim create mode 100644 sources_non_forked/vim-go/compiler/go.vim create mode 100644 sources_non_forked/vim-go/doc/vim-go.txt create mode 100644 sources_non_forked/vim-go/ftdetect/gofiletype.vim create mode 100644 sources_non_forked/vim-go/ftplugin/go.vim create mode 100644 sources_non_forked/vim-go/ftplugin/go/commands.vim create mode 100644 sources_non_forked/vim-go/ftplugin/go/snippets.vim create mode 100644 sources_non_forked/vim-go/ftplugin/go/tagbar.vim create mode 100644 sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets create mode 100644 sources_non_forked/vim-go/gosnippets/snippets/go.snip create mode 100644 sources_non_forked/vim-go/indent/go.vim create mode 100644 sources_non_forked/vim-go/plugin/go.vim create mode 100644 sources_non_forked/vim-go/scripts/test.sh create mode 100644 sources_non_forked/vim-go/syntax/go.vim create mode 100644 sources_non_forked/vim-go/syntax/godoc.vim create mode 100644 sources_non_forked/vim-go/syntax/vimgo.vim delete mode 100644 sources_non_forked/vim-golang/README.md diff --git a/sources_non_forked/nerdtree/README.markdown b/sources_non_forked/nerdtree/README.markdown index 9dacf682..4234b54f 100644 --- a/sources_non_forked/nerdtree/README.markdown +++ b/sources_non_forked/nerdtree/README.markdown @@ -87,7 +87,9 @@ A. Stick this in your vimrc __Q. How can I map a specific key or shortcut to open NERDTree?__ -A. Stick this in your vimrc to open NERDTree with `Ctrl+n` (you can set whatever key you want): `map :NERDTreeToggle` +A. Stick this in your vimrc to open NERDTree with `Ctrl+n` (you can set whatever key you want): + +`map :NERDTreeToggle` __Q. How can I close vim if the only window left open is a NERDTree?__ diff --git a/sources_non_forked/nerdtree/lib/nerdtree/path.vim b/sources_non_forked/nerdtree/lib/nerdtree/path.vim index 5de1dfe2..ea6aa032 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/path.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/path.vim @@ -652,25 +652,15 @@ endfunction "Return: the string for this path that is suitable to be used with the :edit "command function! s:Path._strForEdit() - let p = escape(self.str({'format': 'UI'}), self._escChars()) - let cwd = getcwd() . s:Path.Slash() + let p = escape(self.str(), self._escChars()) - "return a relative path if we can - let isRelative = 0 - if nerdtree#runningWindows() - let isRelative = stridx(tolower(p), tolower(cwd)) == 0 - else - let isRelative = stridx(p, cwd) == 0 - endif + "make it relative + let p = fnamemodify(p, ':.') - if isRelative - let p = strpart(p, strlen(cwd)) - - "handle the edge case where the file begins with a + (vim interprets - "the +foo in `:e +foo` as an option to :edit) - if p[0] == "+" - let p = '\' . p - endif + "handle the edge case where the file begins with a + (vim interprets + "the +foo in `:e +foo` as an option to :edit) + if p[0] == "+" + let p = '\' . p endif if p ==# '' diff --git a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim index 4e03f35e..e99a85be 100644 --- a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim +++ b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim @@ -24,7 +24,7 @@ call NERDTreeAddMenuItem({'text': '(a)dd a childnode', 'shortcut': 'a', 'callbac call NERDTreeAddMenuItem({'text': '(m)ove the current node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'}) call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'}) -if has("gui_mac") || has("gui_macvim") +if has("gui_mac") || has("gui_macvim") call NERDTreeAddMenuItem({'text': '(r)eveal in Finder the current node', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'}) call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFile'}) call NERDTreeAddMenuItem({'text': '(q)uicklook the current node', 'shortcut': 'q', 'callback': 'NERDTreeQuickLook'}) @@ -86,10 +86,11 @@ function! s:promptToRenameBuffer(bufnum, msg, newFileName) " 1. ensure that a new buffer is loaded exec "badd " . quotedFileName " 2. ensure that all windows which display the just deleted filename - " display a buffer for a new 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! " . quotedFileName . "\" | endif" + let editStr = g:NERDTreePath.New(a:newFileName).str({'format': 'Edit'}) + exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':e! " . editStr . "' | endif" exec "tabnext " . s:originalTabNumber exec s:originalWindowNumber . "wincmd w" " 3. We don't need a previous buffer anymore diff --git a/sources_non_forked/syntastic/README.markdown b/sources_non_forked/syntastic/README.markdown index 03a62f56..1f8ede1a 100644 --- a/sources_non_forked/syntastic/README.markdown +++ b/sources_non_forked/syntastic/README.markdown @@ -28,11 +28,11 @@ ## 1\. Introduction -Syntastic is a syntax checking plugin for Vim that runs files through external -syntax checkers and displays any resulting errors to the user. This can be done -on demand, or automatically as files are saved. If syntax errors are detected, -the user is notified and is happy because they didn't have to compile their -code or execute their script to find them. +Syntastic is a syntax checking plugin for [Vim][13] that runs files through +external syntax checkers and displays any resulting errors to the user. This +can be done on demand, or automatically as files are saved. If syntax errors +are detected, the user is notified and is happy because they didn't have to +compile their code or execute their script to find them. At the time of this writing, syntax checking plugins exist for ActionScript, Ada, AppleScript, Arduino, AsciiDoc, ASM, BEMHTML, Bro, Bourne shell, C, @@ -64,16 +64,40 @@ enabled. ## 2\. Installation -Installing syntastic is easy but first you need to have the [pathogen][1] -plugin installed. If you already have [pathogen][1] working then skip -[Step 1](#step1) and go to [Step 2](#step2). + +### 2.1\. Requirements + +Syntastic itself has rather relaxed requirements: it doesn't have any external +dependencies, and it needs a version of [Vim][13] compiled with a few common +features: `autocmd`, `eval`, `file_in_path`, `modify_fname`, `quickfix`, +`reltime`, and `user_commands`. Not all possible combinations of features that +include the ones above make equal sense on all operating systems, but Vim +version 7 or later with the "normal", "big", or "huge" feature sets should be +fine. + +Syntastic should work with any modern plugin managers for Vim, such as +[NeoBundle][14], [Pathogen][1], [Vim-Addon-Manager][15], [Vim-Plug][16], or +[Vundle][17]. Instructions for installing syntastic with [Pathogen][1] are +included below for completeness. + +Last but not least: syntastic doesn't know how to do any syntax checks by +itself. In order to get meaningful results you need to install external +checkers corresponding to the types of files you use. Please consult the +[wiki][3] for a list of supported checkers. + + + +### 2.2\. Installing syntastic with Pathogen + +If you already have [Pathogen][1] working then skip [Step 1](#step1) and go to +[Step 2](#step2). -### 2.1\. Step 1: Install pathogen.vim +#### 2.2.1\. Step 1: Install pathogen.vim -First I'll show you how to install Tim Pope's [pathogen][1] so that it's easy to +First I'll show you how to install Tim Pope's [Pathogen][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 @@ -87,7 +111,7 @@ execute pathogen#infect() -### 2.2\. Step 2: Install syntastic as a pathogen bundle +#### 2.2.2\. Step 2: Install syntastic as a Pathogen bundle You now have pathogen installed and can put syntastic into `~/.vim/bundle` like this: @@ -100,7 +124,8 @@ Quit vim and start it back up to reload it, then type: :Helptags ``` If you get an error when you do this, then you probably didn't install -[pathogen][1] right. Go back to [Step 1](#step1) and make sure you did the following: +[Pathogen][1] right. Go back to [Step 1](#step1) and make sure you did the +following: 1. Created both the `~/.vim/autoload` and `~/.vim/bundle` directories. 2. Added the `call pathogen#infect()` line to your `~/.vimrc` file @@ -328,6 +353,11 @@ a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9]. [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/ +[13]: http://www.vim.org/ +[14]: https://github.com/Shougo/neobundle.vim +[15]: https://github.com/MarcWeber/vim-addon-manager +[16]: https://github.com/junegunn/vim-plug/ +[17]: https://github.com/gmarik/Vundle.vim }} + + ============================================================================== SNIPPET SOURCES *SnipMate-snippet-sources* @@ -398,19 +480,13 @@ See |SnipMate-syntax| for more details about all possible relative locations to 'rtp' can be found in. ============================================================================== -DISADVANTAGES *SnipMate-disadvantages* +KNOWN ISSUES *SnipMate-known-issues* SnipMate.vim currently has the following disadvantages to TextMate's snippets: - - Nested placeholders are not currently possible. E.g.: > - '${3}' -< In TextMate this would first highlight ' id="some_id"', and if - you hit delete it would automatically skip ${2} and go to ${3} - on the next , but if you didn't delete it it would highlight - "some_id" first. You cannot do this in SnipMate.vim. - - Regex cannot be performed on variables, such as "${1/.*/\U&}" - Placeholders cannot span multiple lines. - Activating snippets in different scopes of the same file is not possible. + - Vim formatting with fo=t or fo=a can mess up SnipMate. Perhaps some of these features will be added in a later release. diff --git a/sources_non_forked/vim-snipmate/plugin/snipMate.vim b/sources_non_forked/vim-snipmate/plugin/snipMate.vim index 72f7ebc1..5c1b48fc 100644 --- a/sources_non_forked/vim-snipmate/plugin/snipMate.vim +++ b/sources_non_forked/vim-snipmate/plugin/snipMate.vim @@ -91,9 +91,11 @@ let g:snipMate['get_snippets'] = get(g:snipMate, 'get_snippets', funcref#Functio " List of paths where snippets/ dirs are located, or a function returning such " a list -let g:snipMate['snippet_dirs'] = get(g:snipMate, 'snippet_dirs', funcref#Function('return split(&runtimepath,",")')) -if type(g:snipMate['snippet_dirs']) == type([]) - call map(g:snipMate['snippet_dirs'], 'expand(v:val)') +let g:snipMate['snippet_dirs'] = get(g:snipMate, 'snippet_dirs', split(&rtp, ',')) +if type(g:snipMate['snippet_dirs']) != type([]) + echohl WarningMsg + echom "g:snipMate['snippet_dirs'] must be a List" + echohl None endif " _ is default scope added always @@ -107,7 +109,7 @@ function! s:grab_visual() let a_save = @a try normal! gv"ay - let b:snipmate_content_visual = @a + let b:snipmate_visual = @a finally let @a = a_save endtry diff --git a/sources_non_forked/vim-snipmate/t/jumping.vim b/sources_non_forked/vim-snipmate/t/jumping.vim new file mode 100644 index 00000000..7bc22b3b --- /dev/null +++ b/sources_non_forked/vim-snipmate/t/jumping.vim @@ -0,0 +1,175 @@ +function! Setup(snip) + return snipMate#expandSnip(join(a:snip, "\n"), 1) +endfunction + +function! s:to_be_file(expected) + return a:expected == getline(1,'$') +endfunction + +function! s:to_be_in(item, list) + return !empty(filter(copy(a:list), 'v:val is a:item')) +endfunction + +call vspec#customize_matcher('to_be_file', function('s:to_be_file')) +call vspec#customize_matcher('to_be_in', function('s:to_be_in')) + +describe 'snippet state' + + before + enew + let b:snip_state = snipmate#jumping#state() + end + + after + bwipeout! + end + + describe '.remove()' + + it 'removes the state object' + Expect exists('b:snip_state') to_be_true + call b:snip_state.remove() + Expect exists('b:snip_state') to_be_false + end + + it 'removes snippet related autocommands' + function! ReadAutocmds() + redir => autocmds + 0verbose au snipmate_changes * + redir END + return split(autocmds, "\n") + endfunction + aug snipmate_changes + au CursorMoved,CursorMovedI echo 'event' + aug END + + Expect len(ReadAutocmds()) > 1 + call b:snip_state.remove() + Expect len(ReadAutocmds()) == 1 + end + + end + + describe '.find_next_stop()' + + it 'increments/decrements the stop_no' + let b:snip_state.stops = { 1 : {}, 2 : {} } + let b:snip_state.stop_no = 1 + let b:snip_state.stop_count = 4 + + call b:snip_state.find_next_stop(0) + Expect b:snip_state.stop_no == 2 + call b:snip_state.find_next_stop(1) + Expect b:snip_state.stop_no == 1 + end + + it 'continues iterating if the next/previous stop does not exist' + let b:snip_state.stops = { 3 : {} } + let b:snip_state.stop_count = 6 + let b:snip_state.stop_no = 1 + call b:snip_state.find_next_stop(0) + Expect b:snip_state.stop_no == 3 + let b:snip_state.stop_no = 5 + call b:snip_state.find_next_stop(1) + Expect b:snip_state.stop_no == 3 + end + + it 'does something at the ends' + " + end + + end + + describe '.remove_nested()' + + it 'removes nested mirrors and only nested mirrors' + let mirror = { 'line' : 0 } + let b:snip_state.stops = { 1 : { 'placeholder' : [[2, mirror]] }, + \ 2 : { 'mirrors' : [mirror, {}] } } + + call b:snip_state.remove_nested(1) + Expect len(b:snip_state.stops[2].mirrors) == 1 + Expect b:snip_state.stops[2].mirrors[0] isnot mirror + end + + it 'removes nested stops' + let stop = [2, 'abc'] + let b:snip_state.stops = { 1 : { 'placeholder' : [stop] }, + \ 2 : { 'placeholder' : stop[1:1] } } + + call b:snip_state.remove_nested(1) + Expect len(b:snip_state.stops) == 1 + Expect keys(b:snip_state.stops) == ['1'] + end + + end + + describe '.find_update_objects()' + + it 'finds mirrors/stops on the same line and after cur_stop' + let b:snip_state.stops = { + \ 1 : { 'line' : 1, 'col' : 5, + \ 'placeholder' : ['x'] }, + \ 2 : { 'line' : 1, 'col' : 7, + \ 'mirrors' : [{ 'line' : 1, 'col' : 7 }] } + \ } + let stop = b:snip_state.stops[1] + + call b:snip_state.find_update_objects(stop) + for obj in stop.update_objects + Expect obj to_be_in [ b:snip_state.stops[2], + \ b:snip_state.stops[2].mirrors[0] ] + endfor + end + + it 'finds mirrors/stops on the same line and after cur_stop mirrors' + let b:snip_state.stops = { + \ 1 : { 'line' : 1, 'col' : 5, + \ 'mirrors' : [{ 'line' : 2, 'col' : 5 }], + \ 'placeholder' : ['x'] }, + \ 2 : { 'line' : 2, 'col' : 7, + \ 'mirrors' : [{ 'line' : 2, 'col' : 7 }] } + \ } + let stop = b:snip_state.stops[1] + + call b:snip_state.find_update_objects(stop) + for obj in stop.update_objects + Expect obj to_be_in [ b:snip_state.stops[2], + \ b:snip_state.stops[2].mirrors[0] ] + endfor + end + + it 'ignores mirrors/stops on other lines' + let b:snip_state.stops = { + \ 1 : { 'line' : 2, 'col' : 5, + \ 'placeholder' : ['x'] }, + \ 2 : { 'line' : 1, 'col' : 7, + \ 'mirrors' : [{ 'line' : 1, 'col' : 7 }] }, + \ 3 : { 'line' : 3, 'col' : 7, + \ 'mirrors' : [{ 'line' : 3, 'col' : 7 }] } + \ } + let stop = b:snip_state.stops[1] + + call b:snip_state.find_update_objects(stop) + Expect empty(stop.update_objects) to_be_true + end + + it 'ignores mirrors/stops on the same line but before cur_stop/mirrors' + let b:snip_state.stops = { + \ 1 : { 'line' : 1, 'col' : 5, + \ 'mirrors' : [{ 'line' : 2, 'col' : 5 }], + \ 'placeholder' : ['x'] }, + \ 2 : { 'line' : 1, 'col' : 1, + \ 'mirrors' : [{ 'line' : 2, 'col' : 1 }] }, + \ 3 : { 'line' : 2, 'col' : 3, + \ 'mirrors' : [{ 'line' : 1, 'col' : 3 }] }, + \ } + let stop = b:snip_state.stops[1] + + call b:snip_state.find_update_objects(stop) + Expect empty(stop.update_objects) to_be_true + end + + end + +end diff --git a/sources_non_forked/vim-snipmate/t/parser.vim b/sources_non_forked/vim-snipmate/t/parser.vim new file mode 100644 index 00000000..053bad8a --- /dev/null +++ b/sources_non_forked/vim-snipmate/t/parser.vim @@ -0,0 +1,116 @@ +describe 'snippet parser' + + before + function! Parse(snippet, ...) + let [snip, stops] = snipmate#parse#snippet(a:snippet) + return a:0 ? [snip, stops] : snip + endfunction + let b:snipmate_visual = 'testvisual' + end + + it 'parses numeric $id and ${id} vars as [id] lists' + let expect = [[1234567890]] + Expect Parse('$1234567890') == expect + Expect Parse('${1234567890}') == expect + end + + it 'disregards $ or ${ followed by a non-id' + Expect Parse('$x1') == ['x1'] + Expect Parse('${x}1') == ['x}1'] + Expect Parse('$VISUA1') == ['VISUA1'] + Expect Parse('${VISUA}1') == ['VISUA}1'] + end + + it 'gathers references to each instance of each stop id' + let [snip, b:stops] = Parse('x$1x${2:x$1x}x$1x${1/a/b}x$VISUALx', 1) + function! InstanceFound(list) + return !empty(filter(copy(b:stops[a:list[0]].instances), + \ 'v:val is a:list')) + endfunction + function! CheckList(list) + for item in a:list + if type(item) == type([]) + Expect InstanceFound(item) to_be_true + call CheckList(item) + endif + unlet item " E732 + endfor + endfunction + call CheckList(snip) + end + + it 'parses mirror substitutions ${n/pat/sub} as [n, {...}]' + let expect = [[1, { 'pat' : 'abc', 'sub' : 'def' }]] + Expect Parse('${1/abc/def}') == expect + let expect[0][1].flags = '' + Expect Parse('${1/abc/def/}') == expect + let expect[0][1].flags = 'g' + Expect Parse('${1/abc/def/g}') == expect + end + + it 'parses vars with placeholders as [id, placeholder] lists' + Expect Parse('${1:abc}') == [[1, 'abc']] + end + + it 'evaluates backtick expressions' + Expect Parse('`fnamemodify("x.y", ":r")`') == ['x'] + end + + it 'parses placeholders for vars and other specials' + let text = 'a `fnamemodify("x.y", ":r")` ${2:(${3/a/b})}' + let expect = ['a x ', [2, '(', [3, { 'pat' : 'a', 'sub' : 'b' }], ')']] + Expect Parse(text) == expect + Expect Parse(printf('${1:%s}', text)) == [[1] + expect] + end + + it 'converts tabs according to &et, &sts, &sw' + " &noet -> leave tabs alone + setl noet + Expect Parse("abc\tdef\n\t\tghi") == ["abc\tdef", "\t\tghi"] + + " &et -> &sts or &sw + setl et sts=2 sw=3 + Expect Parse("abc\tdef\n\t\tghi") == ["abc def", " ghi"] + + setl et sts=0 sw=3 + Expect Parse("abc\tdef\n\t\tghi") == ["abc def", " ghi"] + + setl et sts=-1 sw=3 + Expect Parse("abc\tdef\n\t\tghi") == ["abc def", " ghi"] + end + + it 'parses backslashes as escaping the next character or joining lines' + Expect Parse('x\x') == ['xx'] + Expect Parse('x\\x') == ['x\x'] + Expect Parse("x\\\nx") == ['xx'] + Expect Parse('x\$1') == ['x$1'] + Expect Parse('${1:\}}') == [[1, '}']] + Expect Parse('${1/\//\}}') == [[1, { 'pat' : '/', 'sub' : '}' }]] + Expect Parse('`fnamemodify("\`.x", ":r")`') == ['`'] + Expect Parse('\`x\`') == ['`x`'] + end + + it 'splits text at newlines' + Expect Parse("x\nx") == ['x', 'x'] + end + + it 'joins evaluated expressions to surrounding text on the same line' + let g:foo = 'bar' + Expect Parse("x`g:foo`x") == ['xbarx'] + Expect Parse("x`g:foo`\nx") == ['xbar', 'x'] + Expect Parse("x\n`g:foo`x") == ['x', 'barx'] + end + + it 'adds empty strings before/after vars if at the start/end of a line' + Expect Parse("x$1\nx") == ['x', [1], '', 'x'] + Expect Parse("x\n$1x") == ['x', '', [1], 'x'] + end + + it 'expands $VISUAL placeholders with any indents' + Expect Parse("x$VISUALx") == ['xtestvisualx'] + let b:snipmate_visual = " foo\nbar\n baz" + setl noet + Expect Parse("\tx\n\t$VISUAL\nx") == ["\tx", "\t foo", "\tbar", "\t baz", "x"] + end + +end diff --git a/sources_non_forked/vim-snipmate/t/tests.sh b/sources_non_forked/vim-snipmate/t/tests.sh new file mode 100644 index 00000000..c1da250f --- /dev/null +++ b/sources_non_forked/vim-snipmate/t/tests.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +tmp="$(mktemp || tmpfile)" +vim -Es $tmp <<- EOF + source ~/.vimrc + %delete _ + call append(0, split(&rtp, ',')) + delete _ + wq +EOF + +rtp="$(grep -iE 'vspec|snipmate|tlib|mw-utils' < $tmp | grep -v after)" +vspec="$(grep -iE 'vspec' < $tmp | grep -v after)" +test_files="${*:-parser jumping}" + +for test in $test_files; do + $vspec/bin/vspec $rtp ${test%%.vim}.vim +done + +rm $tmp diff --git a/sources_non_forked/vim-snippets/UltiSnips/erlang.snippets b/sources_non_forked/vim-snippets/UltiSnips/erlang.snippets index e27fbefa..f317685c 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/erlang.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/erlang.snippets @@ -5,12 +5,12 @@ priority -50 snippet pat "Case:Receive:Try Clause" -${1:pattern}${2: when ${3:guard}} ->; +${1:pattern}${2: when ${3:guard}} -> ${4:body} endsnippet -snippet beh "Behaviour Directive" --behaviour (${1:behaviour}). +snippet beh "Behaviour Directive" b +-behaviour(${1:behaviour}). endsnippet snippet case "Case Expression" @@ -20,12 +20,12 @@ case ${1:expression} of end endsnippet -snippet def "Define Directive" --define (${1:macro}${2: (${3:param})}, ${4:body}). +snippet def "Define Directive" b +-define(${1:macro}${2: (${3:param})}, ${4:body}). endsnippet -snippet exp "Export Directive" --export ([${1:function}/${2:arity}]). +snippet exp "Export Directive" b +-export([${1:function}/${2:arity}]). endsnippet snippet fun "Fun Expression" @@ -36,7 +36,7 @@ end endsnippet snippet fu "Function" -${1:function} (${2:param})${3: when ${4:guard}} -> +${1:function}(${2:param})${3: when ${4:guard}} -> ${5:body} endsnippet @@ -47,24 +47,24 @@ if end endsnippet -snippet ifdef "Ifdef Directive" --ifdef (${1:macro}). +snippet ifdef "Ifdef Directive" b +-ifdef(${1:macro}). endsnippet -snippet ifndef "Ifndef Directive" --ifndef (${1:macro}). +snippet ifndef "Ifndef Directive" b +-ifndef(${1:macro}). endsnippet -snippet imp "Import Directive" --import (${1:module}, [${2:function}/${3:arity}]). +snippet imp "Import Directive" b +-import(${1:module}, [${2:function}/${3:arity}]). endsnippet -snippet inc "Include Directive" --include ("${1:file}"). +snippet inc "Include Directive" b +-include("${1:file}"). endsnippet -snippet mod "Module Directive" --module (${1:`!p snip.rv = snip.basename or "module"`}). +snippet mod "Module Directive" b +-module(${1:`!p snip.rv = snip.basename or "module"`}). endsnippet snippet rcv "Receive Expression" @@ -77,8 +77,8 @@ ${6:after end endsnippet -snippet rec "Record Directive" --record (${1:record}, {${2:field}${3: = ${4:value}}}). +snippet rec "Record Directive" b +-record(${1:record}, {${2:field}${3: = ${4:value}}}). endsnippet snippet try "Try Expression" @@ -93,8 +93,16 @@ ${13:after end endsnippet -snippet undef "Undef Directive" --undef (${1:macro}). +snippet undef "Undef Directive" b +-undef(${1:macro}). +endsnippet + +snippet || "List Comprehension" +[${1:X} || ${2:X} <- ${3:List}${4:, gen}] +endsnippet + +snippet gen "Generator Expression" +${1:X} <- ${2:List}${3:, gen} endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/html_minimal.snippets b/sources_non_forked/vim-snippets/UltiSnips/html_minimal.snippets index 48ff4b72..6867e866 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/html_minimal.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/html_minimal.snippets @@ -17,7 +17,7 @@ snippet label_and_input endsnippet snippet input -${7} endsnippet snippet submit diff --git a/sources_non_forked/vim-snippets/UltiSnips/php.snippets b/sources_non_forked/vim-snippets/UltiSnips/php.snippets index def2116b..366346a6 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/php.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/php.snippets @@ -102,44 +102,54 @@ var_export(${1});${2} endsnippet snippet getter "PHP Class Getter" b -/* +/** * Getter for $1 + * + * ${2:return string} */ public function get${1/\w+\s*/\u$0/}() { - return $this->$1;$2 + return $this->$1;$3 } -$4 +$0 endsnippet snippet setter "PHP Class Setter" b -/* +/** * Setter for $1 + * + * @param ${2:string} $$1 + * @return ${3:`!p snip.rv=snip.basename`} */ -public function set${1/\w+\s*/\u$0/}($$1) +public function set${1/\w+\s*/\u$0/}(${4:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1) { - $this->$1 = $$1;$3 - ${4:return $this;} + $this->$1 = $$1;$5 + ${6:return $this;} } $0 endsnippet snippet gs "PHP Class Getter Setter" b -/* +/** * Getter for $1 + * + * return ${2:string} */ public function get${1/\w+\s*/\u$0/}() { - return $this->$1;$2 + return $this->$1;$3 } -/* +/** * Setter for $1 + * + * @param $2 $$1 + * @return ${4:`!p snip.rv=snip.basename`} */ -public function set${1/\w+\s*/\u$0/}($$1) +public function set${1/\w+\s*/\u$0/}(${5:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1) { - $this->$1 = $$1;$3 - ${4:return $this;} + $this->$1 = $$1;$6 + ${7:return $this;} } $0 endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/php_laravel.snippets b/sources_non_forked/vim-snippets/UltiSnips/php_laravel.snippets index 9f817a8d..30f3f369 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/php_laravel.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/php_laravel.snippets @@ -7,33 +7,30 @@ snippet l_rsc "Laravel resource controller" b * \date `!v strftime('%d-%m-%y')` */ -class $1 { - public function index() { - ${3} - } - - public function create() { +class $1 extends ${3: BaseController} { + function __construct() { ${4} } + public function index() { + } + + public function create() { + } + public function store($id) { - ${5} } public function show($id) { - ${6} } public function edit($id) { - ${7} } public function update($id) { - ${8} } public function destroy($id) { - ${9} } } endsnippet @@ -117,7 +114,7 @@ namespace $1; class $2 extends \Eloquent { protected $table = '${4:`!p snip.rv = t[2].lower()`}'; - public $timestamps = '${5:false}'; + public $timestamps = ${5:false}; protected $hidden = array(${6}); @@ -196,7 +193,7 @@ snippet l_r "Laravel Repository" b /*! * \namespace ${1:Repositories\\${2}} * \class ${3:`!v expand('%:t:r')`} - * \implements ${4:BaseRepositoryInterface} + * \implements ${4:$3RepositoryInterface} * * \author ${5:`!v g:snips_author`} * \date `!v strftime('%d-%m-%y')` @@ -204,8 +201,8 @@ snippet l_r "Laravel Repository" b namespace $1; -class $3 extends \\$1 implements $4 { - ${6} +class $3 extends \\${6} implements $4 { + ${7} } endsnippet diff --git a/sources_non_forked/vim-snippets/snippets/_.snippets b/sources_non_forked/vim-snippets/snippets/_.snippets index b556554c..ff52c0a5 100644 --- a/sources_non_forked/vim-snippets/snippets/_.snippets +++ b/sources_non_forked/vim-snippets/snippets/_.snippets @@ -29,7 +29,6 @@ snippet GPL2 You should have received a copy of the GNU General Public License along with this program; if not, see . - ${0} snippet LGPL2 ${1:One line to give the program's name and a brief description.} @@ -47,7 +46,6 @@ snippet LGPL2 You should have received a copy of the GNU Lesser General Public License along with this library; if not, see . - ${0} snippet GPL3 ${1:one line to give the program's name and a brief description.} @@ -65,7 +63,6 @@ snippet GPL3 You should have received a copy of the GNU General Public License along with this program. If not, see . - ${0} snippet LGPL3 ${1:One line to give the program's name and a brief description.} @@ -83,7 +80,6 @@ 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.} @@ -101,7 +97,6 @@ snippet AGPL3 You should have received a copy of the GNU Affero General Public License along with this program. If not, see . - ${0} snippet GMGPL linking exception As a special exception, if other files instantiate generics from @@ -140,7 +135,6 @@ snippet BSD2 The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressedor implied, of $2. - ${0} snippet BSD3 ${1:one line to give the program's name and a brief description} @@ -168,7 +162,6 @@ snippet BSD3 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ${0} snippet BSD4 ${1:one line to give the program's name and a brief description} @@ -199,7 +192,6 @@ snippet BSD4 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ${0} snippet MIT ${1:one line to give the program's name and a brief description} @@ -222,7 +214,6 @@ snippet MIT DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ${0} snippet APACHE ${1:one line to give the program's name and a brief description} @@ -239,7 +230,6 @@ snippet APACHE WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - ${0} snippet BEERWARE ${1:one line to give the program's name and a brief description} @@ -249,7 +239,6 @@ snippet BEERWARE $2 wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer or coffee in return - ${0} snippet WTFPL DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE @@ -271,5 +260,4 @@ snippet MPL2 This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. - ${0} diff --git a/sources_non_forked/vim-snippets/snippets/markdown.snippets b/sources_non_forked/vim-snippets/snippets/markdown.snippets index d3667d05..d258aa8b 100644 --- a/sources_non_forked/vim-snippets/snippets/markdown.snippets +++ b/sources_non_forked/vim-snippets/snippets/markdown.snippets @@ -75,6 +75,8 @@ snippet === `repeat('=', strlen(getline(line(".") - 1)) - strlen(getline('.')))` ${0} +snippet - + - ${0} snippet --- `repeat('-', strlen(getline(line(".") - 1)) - strlen(getline('.')))` diff --git a/sources_non_forked/vim-snippets/snippets/puppet.snippets b/sources_non_forked/vim-snippets/snippets/puppet.snippets index a4fdf19f..8b0a4109 100644 --- a/sources_non_forked/vim-snippets/snippets/puppet.snippets +++ b/sources_non_forked/vim-snippets/snippets/puppet.snippets @@ -90,7 +90,7 @@ snippet class ${0} } snippet node - node '${1:`vim_snippets#Filename('', 'fqdn')`}' { + node "${1:`vim_snippets#Filename('', 'fqdn')`}" { ${0} } snippet case @@ -107,13 +107,21 @@ snippet if if $${1:variable} { ${0} } +snippet ifd + if defined(${1:Resource}["${2:name}"]) { + ${0} + } +snippet ifnd + if !defined(${1:Resource}["${2:name}"]) { + ${0} + } snippet el else { ${0} } snippet ? ? { - '${1}' => ${0} + "${1}" => ${0} } # # blocks etc and general syntax sugar @@ -122,98 +130,98 @@ snippet [ snippet > ${1} => ${0} snippet p: - 'puppet://puppet/${1:module name}/${0:file name}' + "puppet://puppet/${1:module name}/${0:file name}" # # Functions snippet alert - alert('${1:message}') + alert("${1:message}") snippet crit - crit('${1:message}') + crit("${1:message}") snippet debug - debug('${1:message}') + debug("${1:message}") snippet defined - defined(${1:Resource}['${2:name}']) + defined(${1:Resource}["${2:name}"]) snippet emerg - emerg('${1:message}') + emerg("${1:message}") snippet extlookup Simple extlookup - extlookup('${1:variable}') + extlookup("${1:variable}") snippet extlookup Extlookup with defaults - extlookup('${1:variable}', '${2:default}') + extlookup("${1:variable}", "${2:default}") snippet extlookup Extlookup with defaults and custom data file - extlookup('${1:variable}', '${2:default}', '${3:data source}') + extlookup("${1:variable}", "${2:default}", "${3:data source}") snippet fail - fail('${1:message}') + fail("${1:message}") snippet info - info('${1:message}') + info("${1:message}") snippet inline_template - inline_template('<%= ${1} %>') + inline_template("<%= ${1} %>") snippet notice - notice('${1:message}') + notice("${1:message}") snippet realize realize(${1:Resource}[${2:name}]) snippet regsubst - regsubst(${1:hay stack}, ${2:needle}, '${3:replacement}') + regsubst(${1:hay stack}, ${2:needle}, "${3:replacement}") snippet inc include ${1:classname} snippet split - split(${1:hay stack}, '${2:patten}') + split(${1:hay stack}, "${2:patten}") snippet versioncmp - versioncmp('${1:version}', '${2:version}') + versioncmp("${1:version}", "${2:version}") snippet warning - warning('${1:message}') + warning("${1:message}") # # Types snippet cron - cron { '${1:name}': - command => '${2}', - user => '${3:root}', + cron { "${1:name}": + command => "${2}", + user => "${3:root}", ${4} => ${0}, } snippet exec - exec { '${1:name}': - command => '${2:$1}', - user => '${3:root}', + exec { "${1:name}": + command => "${2:$1}", + user => "${3:root}", ${4} => ${0}, } snippet user - user { '${1:user}': + user { "${1:user}": ensure => present, - comment => '${2:$1}', + comment => "${2:$1}", managehome => true, - home => '${0:/home/$1}', + home => "${0:/home/$1}", } snippet group - group { '${1:group}': + group { "${1:group}": ensure => ${0:present}, } snippet host - host { '${1:hostname}': + host { "${1:hostname}": ip => ${0:127.0.0.1}, } snippet mailalias - mailalias { '${1:localpart}': - recipient => '${0:recipient}', + mailalias { "${1:localpart}": + recipient => "${0:recipient}", } snippet mount - mount { '${1:destination path}': + mount { "${1:destination path}": ensure => ${2:mounted}, - device => '${0:device name or path}', + device => "${0:device name or path}", } snippet package - package { '${1:package name}': + package { "${1:package name}": ensure => ${0:present}, } snippet yumrepo - yumrepo { '${1:repo name}': - Descr => '${2:$1}', + yumrepo { "${1:repo name}": + Descr => "${2:$1}", enabled => ${0:1}, } @@ -223,22 +231,39 @@ snippet define } snippet service - service { '${1:service}' : + service { "${1:service}" : ensure => running, enable => true, - require => [ Package['${2:package}'], File['${3:file}'], ], - subscribe => [ File['${4:configfile1}'], File['${5:configfile2}'], Package['${6:package}'], ], + require => [ Package["${2:package}"], File["${3:file}"], ], + subscribe => [ File["${4:configfile1}"], File["${5:configfile2}"], Package["${6:package}"], ], } snippet file - file { '${1:filename}' : + file { "${1:filename}" : ensure => ${2:present}, - owner => '${3:root}', - group => '${4:root}', - mode => '${5:0644}', - source => 'puppet:///modules/${6:module}/${7:source}', - content => template('/etc/puppet/templates/${8:template}'), - alias => '${9:alias}', - require => [ Package['${10:package}'], File['${11:file}'], ], + owner => "${3:root}", + group => "${4:root}", + mode => "${5:0644}", + source => "puppet:///modules/${6:module}/${7:source}", + content => template("${8:module}/${9:template}"), + alias => "${10:alias}", + require => [ Package["${11:package}"], File["${12:file}"], ], + } + +snippet archive + archive { "${1:filename}" : + ensure => ${2:present}, + url => "http://${3:url}", + extension => "${4:tgz}", + target => "${5:target}", + checksum => ${6:false}, + src_target => "${7:/tmp}", + } + +snippet firewall + firewall { "${1:comment}" : + proto => ${2:tcp}, + action => ${3:accept}, + port => ${4}, } diff --git a/sources_non_forked/vim-snippets/snippets/python.snippets b/sources_non_forked/vim-snippets/snippets/python.snippets index 77d74e4d..3fa72b07 100644 --- a/sources_non_forked/vim-snippets/snippets/python.snippets +++ b/sources_non_forked/vim-snippets/snippets/python.snippets @@ -135,6 +135,9 @@ snippet iem # ipython debugger (pdbbb) snippet pdbbb import pdbpp; pdbpp.set_trace() +# remote python debugger (rpdb) +snippet rpdb + import rpdb; rpdb.set_trace() # python_prompt_toolkit snippet ppt from prompt_toolkit.contrib.repl import embed diff --git a/sources_non_forked/vim-surround/doc/surround.txt b/sources_non_forked/vim-surround/doc/surround.txt index 30a642ae..41943e7c 100644 --- a/sources_non_forked/vim-surround/doc/surround.txt +++ b/sources_non_forked/vim-surround/doc/surround.txt @@ -39,8 +39,9 @@ easiest to understand with some examples:
Yo!*
dst Yo! Change surroundings is *cs* . It takes two arguments, a target like with -|ds|, and a replacement. Details about the second argument can be found -below in |surround-replacements|. Once again, examples are in order. +|ds|, and a replacement. *cS* changes surroundings, placing the surrounded +text on its own line(s) like |yS|. Details about the second argument can be +found below in |surround-replacements|. Once again, examples are in order. Old text Command New text ~ "Hello *world!" cs"' 'Hello world!' diff --git a/sources_non_forked/vim-surround/plugin/surround.vim b/sources_non_forked/vim-surround/plugin/surround.vim index 148a5c9a..e283ed22 100644 --- a/sources_non_forked/vim-surround/plugin/surround.vim +++ b/sources_non_forked/vim-surround/plugin/surround.vim @@ -441,7 +441,8 @@ function! s:dosurround(...) " {{{1 endif call setreg('"',keeper,regtype) if newchar != "" - call s:wrapreg('"',newchar) + let special = a:0 > 2 ? a:3 : 0 + call s:wrapreg('"',newchar, special) endif silent exe 'norm! ""'.pcmd.'`[' if removed =~ '\n' || okeeper =~ '\n' || getreg('"') =~ '\n' @@ -456,11 +457,11 @@ function! s:dosurround(...) " {{{1 if newchar == "" silent! call repeat#set("\Dsurround".char,scount) else - silent! call repeat#set("\Csurround".char.newchar.s:input,scount) + silent! call repeat#set("\C".(a:0 > 2 && a:3 ? "S" : "s")."urround".char.newchar.s:inpur,scount) endif endfunction " }}}1 -function! s:changesurround() " {{{1 +function! s:changesurround(...) " {{{1 let a = s:inputtarget() if a == "" return s:beep() @@ -469,7 +470,7 @@ function! s:changesurround() " {{{1 if b == "" return s:beep() endif - call s:dosurround(a,b) + call s:dosurround(a,b,a:0 && a:1) endfunction " }}}1 function! s:opfunc(type,...) " {{{1 @@ -558,6 +559,7 @@ endfunction " }}}1 nnoremap SurroundRepeat . nnoremap Dsurround :call dosurround(inputtarget()) nnoremap Csurround :call changesurround() +nnoremap CSurround :call changesurround(1) nnoremap Yssurround :call opfunc(v:count1) nnoremap YSsurround :call opfunc2(v:count1) " discards the numerical argument but there's not much we can do with it @@ -571,6 +573,7 @@ inoremap ISurround =insert(1) if !exists("g:surround_no_mappings") || ! g:surround_no_mappings nmap ds Dsurround nmap cs Csurround + nmap cS CSurround nmap ys Ysurround nmap yS YSurround nmap yss Yssurround From 00f043f0de96e0b1447892c0bff63eed317a67c8 Mon Sep 17 00:00:00 2001 From: amix Date: Fri, 13 Feb 2015 00:19:27 +0000 Subject: [PATCH 07/10] Updated vim plugins. Nerd tree is on the right by default --- .../syntastic/plugin/syntastic.vim | 2 +- .../syntax_checkers/python/prospector.vim | 1 - .../syntastic/syntax_checkers/xml/xmllint.vim | 4 +- sources_non_forked/vim-airline/README.md | 1 + .../autoload/airline/extensions/tabline.vim | 23 ++- .../vim-fugitive/plugin/fugitive.vim | 6 +- sources_non_forked/vim-go/indent/go.vim | 9 +- .../vim-multiple-cursors/README.md | 1 + .../autoload/multiple_cursors.vim | 51 +++++ .../spec/multiple_cursors_spec.rb | 191 ++++++++++++++++++ .../vim-multiple-cursors/spec/spec_helper.rb | 2 +- .../vim-snipmate/after/plugin/snipMate.vim | 2 +- .../vim-snipmate/autoload/snipMate.vim | 61 +++--- .../autoload/snipMate_python_demo.vim | 6 +- .../autoload/snipmate/jumping.vim | 26 +-- .../vim-snipmate/autoload/snipmate/legacy.vim | 6 +- .../vim-snipmate/autoload/snipmate/parse.vim | 32 +-- .../vim-snipmate/autoload/snipmate/util.vim | 2 +- .../ftplugin/html_snip_helper.vim | 2 +- .../vim-snipmate/plugin/snipMate.vim | 4 +- sources_non_forked/vim-snipmate/t/jumping.vim | 6 +- .../vim-snippets/UltiSnips/all.snippets | 4 +- .../vim-snippets/UltiSnips/php.snippets | 48 +++-- .../vim-surround/plugin/surround.vim | 4 +- vimrcs/plugins_config.vim | 1 + 25 files changed, 386 insertions(+), 109 deletions(-) diff --git a/sources_non_forked/syntastic/plugin/syntastic.vim b/sources_non_forked/syntastic/plugin/syntastic.vim index d72bf1ad..c6ab15d8 100644 --- a/sources_non_forked/syntastic/plugin/syntastic.vim +++ b/sources_non_forked/syntastic/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:_SYNTASTIC_START endif -let g:_SYNTASTIC_VERSION = '3.6.0-14' +let g:_SYNTASTIC_VERSION = '3.6.0-16' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1 diff --git a/sources_non_forked/syntastic/syntax_checkers/python/prospector.vim b/sources_non_forked/syntastic/syntax_checkers/python/prospector.vim index 4f451012..871a81b4 100644 --- a/sources_non_forked/syntastic/syntax_checkers/python/prospector.vim +++ b/sources_non_forked/syntastic/syntax_checkers/python/prospector.vim @@ -31,7 +31,6 @@ endfunction function! SyntaxCheckers_python_prospector_GetLocList() dict let makeprg = self.makeprgBuild({ - \ 'args': '--external-config merge', \ 'args_after': '--messages-only --absolute-paths --die-on-tool-error --zero-exit --output-format json' }) let errorformat = '%f:%l:%c: %m' diff --git a/sources_non_forked/syntastic/syntax_checkers/xml/xmllint.vim b/sources_non_forked/syntastic/syntax_checkers/xml/xmllint.vim index 108abed7..9a7027f0 100644 --- a/sources_non_forked/syntastic/syntax_checkers/xml/xmllint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/xml/xmllint.vim @@ -23,7 +23,9 @@ set cpo&vim " and http://www.xmlsoft.org/catalog.html for more information. function! SyntaxCheckers_xml_xmllint_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args_after': '--xinclude --noout --postvalid' }) + let makeprg = self.makeprgBuild({ + \ 'args': '--xinclude --postvalid', + \ 'args_after': '--noout' }) let errorformat= \ '%E%f:%l: error : %m,' . diff --git a/sources_non_forked/vim-airline/README.md b/sources_non_forked/vim-airline/README.md index eaf1a47e..fafd4116 100644 --- a/sources_non_forked/vim-airline/README.md +++ b/sources_non_forked/vim-airline/README.md @@ -118,6 +118,7 @@ This plugin follows the standard runtime path structure, and as such it can be i * [Pathogen][11] * `git clone https://github.com/bling/vim-airline ~/.vim/bundle/vim-airline` + * Remember to run `:Helptags` to generate help tags * [NeoBundle][12] * `NeoBundle 'bling/vim-airline'` * [Vundle][13] diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline.vim index 4681a2a4..978eacdc 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline.vim @@ -59,19 +59,22 @@ function! s:toggle_on() let [ s:original_tabline, s:original_showtabline ] = [ &tabline, &showtabline ] set tabline=%!airline#extensions#tabline#get() - if s:buf_min_count <= 0 && s:tab_min_count <= 1 - set showtabline=2 - else - augroup airline_tabline - autocmd! + augroup airline_tabline + autocmd! + " Invalidate cache. + autocmd BufAdd,BufUnload * unlet! s:current_buffer_list + + if s:buf_min_count <= 0 && s:tab_min_count <= 1 + set showtabline=2 + else if s:show_buffers == 1 autocmd BufEnter * call show_tabline(s:buf_min_count, len(s:get_buffer_list())) autocmd BufUnload * call show_tabline(s:buf_min_count, len(s:get_buffer_list()) - 1) else autocmd TabEnter * call show_tabline(s:tab_min_count, tabpagenr('$')) endif - augroup END - endif + endif + augroup END endfunction function! airline#extensions#tabline#load_theme(palette) @@ -130,10 +133,14 @@ function! airline#extensions#tabline#title(n) endfunction function! airline#extensions#tabline#get_buffer_name(nr) - return airline#extensions#tabline#{s:formatter}#format(a:nr, get(s:, 'current_buffer_list', s:get_buffer_list())) + return airline#extensions#tabline#{s:formatter}#format(a:nr, s:get_buffer_list()) endfunction function! s:get_buffer_list() + if exists('s:current_buffer_list') + return s:current_buffer_list + endif + let buffers = [] let cur = bufnr('%') for nr in range(1, bufnr('$')) diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index 65e6665e..b61e49c0 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -2225,7 +2225,11 @@ function! s:Browse(bang,line1,count,...) abort elseif exists(':Browse') == 2 return 'echomsg '.string(url).'|Browse '.url else - return 'echomsg '.string(url).'|call netrw#NetrwBrowseX('.string(url).', 0)' + if has("patch-7.4.567") + return 'echomsg '.string(url).'|call netrw#BrowseX('.string(url).', 0)' + else + return 'echomsg '.string(url).'|call netrw#NetrwBrowseX('.string(url).', 0)' + endif endif catch /^fugitive:/ return 'echoerr v:errmsg' diff --git a/sources_non_forked/vim-go/indent/go.vim b/sources_non_forked/vim-go/indent/go.vim index faf4d79e..660aa506 100644 --- a/sources_non_forked/vim-go/indent/go.vim +++ b/sources_non_forked/vim-go/indent/go.vim @@ -37,20 +37,21 @@ function! GoIndent(lnum) let previ = indent(prevlnum) let ind = previ + let s:shiftwidth = shiftwidth() if prevl =~ '[({]\s*$' " previous line opened a block - let ind += &sw + let ind += s:shiftwidth endif if prevl =~# '^\s*\(case .*\|default\):$' " previous line is part of a switch statement - let ind += &sw + let ind += s:shiftwidth endif " TODO: handle if the previous line is a label. if thisl =~ '^\s*[)}]' " this line closed a block - let ind -= &sw + let ind -= s:shiftwidth endif " Colons are tricky. @@ -58,7 +59,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:shiftwidth endif return ind diff --git a/sources_non_forked/vim-multiple-cursors/README.md b/sources_non_forked/vim-multiple-cursors/README.md index ea10d46c..5a425e9e 100644 --- a/sources_non_forked/vim-multiple-cursors/README.md +++ b/sources_non_forked/vim-multiple-cursors/README.md @@ -32,6 +32,7 @@ To see what keystrokes are used for the above example, see [this issue](https:// ## Installation Install using [Pathogen], [Vundle], [Neobundle], or your favorite Vim package manager. +Requires vim 7.4 or later for full functionality. ## Quick Start Out of the box, all you need to know is a single key `Ctrl-n`. Pressing the key in Normal mode highlights the current word under the cursor in Visual mode and places a virtual cursor at the end of it. Pressing it again finds the next ocurrence and places another virtual cursor at the end of the visual selection. If you select multiple lines in Visual mode, pressing the key puts a virtual cursor at every line and leaves you in Normal mode. diff --git a/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim b/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim index fe86d4e2..ab529b39 100644 --- a/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim +++ b/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim @@ -54,6 +54,11 @@ if !hlexists(s:hi_group_visual) exec "highlight link ".s:hi_group_visual." Visual" endif +" Temporary buffer that is used for individual paste buffer save/restore +" operations +let s:paste_buffer_temporary_text = '' +let s:paste_buffer_temporary_type = '' + "=============================================================================== " Internal Mappings "=============================================================================== @@ -258,6 +263,9 @@ function! s:Cursor.new(position) let obj = copy(self) let obj.position = copy(a:position) let obj.visual = [] + " Stores text that was yanked after any commands in Normal or Visual mode + let obj.paste_buffer_text = getreg('"') + let obj.paste_buffer_type = getregtype('"') let obj.cursor_hi_id = s:highlight_cursor(a:position) let obj.visual_hi_id = 0 let obj.line_length = col([a:position[0], '$']) @@ -325,6 +333,17 @@ function! s:Cursor.remove_visual_selection() dict let self.visual_hi_id = 0 endfunction +" Restore unnamed register from paste buffer +function! s:Cursor.restore_unnamed_register() dict + call setreg('"', self.paste_buffer_text, self.paste_buffer_type) +endfunction + +" Save contents of the unnamed register into paste buffer +function! s:Cursor.save_unnamed_register() dict + let self.paste_buffer_text = getreg('"') + let self.paste_buffer_type = getregtype('"') +endfunction + "=============================================================================== " CursorManager class "=============================================================================== @@ -345,6 +364,7 @@ function! s:CursorManager.new() \ 'cursorline': &cursorline, \ 'lazyredraw': &lazyredraw, \ 'paste': &paste, + \ 'clipboard': &clipboard, \ } " We save the window view when multicursor mode is entered let obj.saved_winview = [] @@ -465,9 +485,17 @@ function! s:CursorManager.update_current() dict exec "normal! gv\" call cur.update_visual_selection(s:get_visual_region(s:pos('.'))) elseif s:from_mode ==# 'v' || s:from_mode ==# 'V' + " Save contents of unnamed register after each operation in Visual mode. + " This should be executed after user input is processed, when unnamed + " register already contains the text. + call cur.save_unnamed_register() + call cur.remove_visual_selection() elseif s:from_mode ==# 'i' && s:to_mode ==# 'n' && self.current_index != self.size() - 1 normal! h + elseif s:from_mode ==# 'n' + " Save contents of unnamed register after each operation in Normal mode. + call cur.save_unnamed_register() endif let vdelta = line('$') - s:saved_linecount " If the total number of lines changed in the buffer, we need to potentially @@ -551,19 +579,28 @@ endfunction " cursors on screen " paste mode needs to be switched off since it turns off a bunch of features " that's critical for the plugin to function +" clipboard should not have unnamed and unnamedplus otherwise plugin cannot +" reliably use unnamed register ('"') function! s:CursorManager.initialize() dict let self.saved_settings['virtualedit'] = &virtualedit let self.saved_settings['cursorline'] = &cursorline let self.saved_settings['lazyredraw'] = &lazyredraw let self.saved_settings['paste'] = &paste + let self.saved_settings['clipboard'] = &clipboard let &virtualedit = "onemore" let &cursorline = 0 let &lazyredraw = 1 let &paste = 0 + set clipboard-=unnamed clipboard-=unnamedplus " We could have already saved the view from multiple_cursors#find if !self.start_from_find let self.saved_winview = winsaveview() endif + + " Save contents and type of unnamed register upon entering multicursor mode + " to restore it later when leaving mode + let s:paste_buffer_temporary_text = getreg('"') + let s:paste_buffer_temporary_type = getregtype('"') endfunction " Restore user settings. @@ -573,7 +610,15 @@ function! s:CursorManager.restore_user_settings() dict let &cursorline = self.saved_settings['cursorline'] let &lazyredraw = self.saved_settings['lazyredraw'] let &paste = self.saved_settings['paste'] + let &clipboard = self.saved_settings['clipboard'] endif + + " Restore original contents and type of unnamed register. This method is + " called from reset, which calls us only when restore_setting argument is + " true, which happens only when we leave multicursor mode. This should be + " symmetrical to saving of unnamed register upon the start of multicursor + " mode. + call setreg('"', s:paste_buffer_temporary_text, s:paste_buffer_temporary_type) endfunction " Reselect the current cursor's region in visual mode @@ -814,6 +859,12 @@ function! s:process_user_input() call s:cm.get_current().update_line_length() let s:saved_linecount = line('$') + " Restore unnamed register only in Normal mode. This should happen before user + " input is processed. + if s:from_mode ==# 'n' || s:from_mode ==# 'v' || s:from_mode ==# 'V' + call s:cm.get_current().restore_unnamed_register() + endif + " Apply the user input. Note that the above could potentially change mode, we " use the mapping below to help us determine what the new mode is " Note that it's possible that \(multiple-cursors-apply) never gets called, we have a diff --git a/sources_non_forked/vim-multiple-cursors/spec/multiple_cursors_spec.rb b/sources_non_forked/vim-multiple-cursors/spec/multiple_cursors_spec.rb index 1e8fc89c..e95e21fa 100644 --- a/sources_non_forked/vim-multiple-cursors/spec/multiple_cursors_spec.rb +++ b/sources_non_forked/vim-multiple-cursors/spec/multiple_cursors_spec.rb @@ -12,6 +12,7 @@ def get_file_content() end def before(string) + options.each { |x| vim.command(x) } set_file_content(string) end @@ -29,8 +30,198 @@ def type(string) end end +describe "Multiple Cursors op pending & exit from insert|visual mode" do + let(:filename) { 'test.txt' } + let(:options) { ['let g:multi_cursor_normal_maps = {"d": 1, "c": 1}', + 'let g:multi_cursor_exit_from_insert_mode = 0', + 'let g:multi_cursor_exit_from_visual_mode = 0'] } + + specify "#paste from unnamed register to 3 cursors" do + before <<-EOF + yankme + a b c + a b c + a b c + EOF + + type 'yiwjvwwp' + + after <<-EOF + yankme + a b cyankme + a b cyankme + a b cyankme + EOF + end + + specify "#paste buffer normal caw then p" do + before <<-EOF + hello jan world + hello feb world + hello mar world + EOF + + type 'vwcawbP' + + after <<-EOF + jan hello world + feb hello world + mar hello world + EOF + end + + specify "#paste buffer normal C then ABC then p" do + before <<-EOF + hello jan world + hello feb world + hello mar world + EOF + + type 'vwCABC p' + + after <<-EOF + hello ABC jan world + hello ABC feb world + hello ABC mar world + EOF + end + + specify "#paste buffer normal daw then P" do + before <<-EOF + hello jan world + hello feb world + hello mar world + EOF + + type 'vwdawbP' + + after <<-EOF + jan hello world + feb hello world + mar hello world + EOF + end + + specify "#paste buffer normal D then P" do + before <<-EOF + hello jan world + hello feb world + hello mar world + EOF + + type 'vwwhDbhP' + + after <<-EOF + hello world jan + hello world feb + hello world mar + EOF + end + + specify "#paste buffer normal s then p" do + before <<-EOF + hello jan world + hello feb world + hello mar world + EOF + + type 'vws1p' + + after <<-EOF + hello 1jan world + hello 1feb world + hello 1mar world + EOF + end + +end + describe "Multiple Cursors" do let(:filename) { 'test.txt' } + let(:options) { [] } + + specify "#paste buffer normal x then p" do + before <<-EOF + jan + feb + mar + EOF + + type 'jjxp' + + after <<-EOF + ajn + efb + amr + EOF + end + + specify "#paste buffer visual y then p" do + before <<-EOF + hello jan world + hello feb world + hello mar world + EOF + + type 'vwvelywhp' + + after <<-EOF + hello jan jan world + hello feb feb world + hello mar mar world + EOF + end + + specify "#paste buffer initial visual y then P" do + before <<-EOF + hello jan world + hello feb world + hello mar world + EOF + + type 'wywbp' + + after <<-EOF + jan jan world + jan feb world + jan mar world + EOF + end + + specify "#paste buffer visual y then P" do + before <<-EOF + hello jan world + hello feb world + hello mar world + EOF + + type 'vwvely^P' + + after <<-EOF + jan hello jan world + feb hello feb world + mar hello mar world + EOF + end + + specify "#paste buffer visual Y then P" do + before <<-EOF + hello jan world + hello feb world + hello mar world + EOF + + type 'vwvY^P' + + after <<-EOF + hello jan world + hello jan world + hello feb world + hello feb world + hello mar world + hello mar world + EOF + end specify "#multiline replacement" do before <<-EOF diff --git a/sources_non_forked/vim-multiple-cursors/spec/spec_helper.rb b/sources_non_forked/vim-multiple-cursors/spec/spec_helper.rb index d5a4233c..4e0ad99d 100644 --- a/sources_non_forked/vim-multiple-cursors/spec/spec_helper.rb +++ b/sources_non_forked/vim-multiple-cursors/spec/spec_helper.rb @@ -5,7 +5,7 @@ Vimrunner::RSpec.configure do |config| # Use a single Vim instance for the test suite. Set to false to use an # instance per test (slower, but can be easier to manage). - config.reuse_server = true + config.reuse_server = false # Decide how to start a Vim instance. In this block, an instance should be # spawned and set up with anything project-specific. diff --git a/sources_non_forked/vim-snipmate/after/plugin/snipMate.vim b/sources_non_forked/vim-snipmate/after/plugin/snipMate.vim index d7379c22..3d6bac70 100644 --- a/sources_non_forked/vim-snipmate/after/plugin/snipMate.vim +++ b/sources_non_forked/vim-snipmate/after/plugin/snipMate.vim @@ -5,7 +5,7 @@ let s:save_cpo = &cpo set cpo&vim -function! s:map_if_not_mapped(lhs, rhs, mode) +function! s:map_if_not_mapped(lhs, rhs, mode) abort let l:unique = s:overwrite ? '' : ' ' if !hasmapto(a:rhs, a:mode) silent! exe a:mode . 'map' . l:unique a:lhs a:rhs diff --git a/sources_non_forked/vim-snipmate/autoload/snipMate.vim b/sources_non_forked/vim-snipmate/autoload/snipMate.vim index 9196ae4d..ceff8b92 100644 --- a/sources_non_forked/vim-snipmate/autoload/snipMate.vim +++ b/sources_non_forked/vim-snipmate/autoload/snipMate.vim @@ -9,7 +9,7 @@ catch /.*/ echoe "you're missing tlib. See install instructions at ".expand(':h:h').'/README.md' endtry -fun! Filename(...) +fun! Filename(...) abort let filename = expand('%:t:r') if filename == '' | return a:0 == 2 ? a:2 : '' | endif return !a:0 || a:1 == '' ? filename : substitute(a:1, '$1', filename, 'g') @@ -17,7 +17,7 @@ endf let s:cache = {} -function! snipMate#expandSnip(snip, version, col) +function! snipMate#expandSnip(snip, version, col) abort let lnum = line('.') let col = a:col let line = getline(lnum) @@ -76,11 +76,11 @@ function! snipMate#expandSnip(snip, version, col) return b:snip_state.set_stop(0) endfunction -function! snipMate#placeholder_str(num, stops) +function! snipMate#placeholder_str(num, stops) abort return snipMate#sniplist_str(a:stops[a:num].placeholder, a:stops)[0] endfunction -function! snipMate#sniplist_str(snippet, stops) +function! snipMate#sniplist_str(snippet, stops) abort let lines = [''] let pos = 0 let add_to = 1 @@ -108,7 +108,7 @@ function! snipMate#sniplist_str(snippet, stops) return lines endfunction -function! s:build_stops(snippet, stops, lnum, col, indent) +function! s:build_stops(snippet, stops, lnum, col, indent) abort let stops = a:stops let line = a:lnum let col = a:col @@ -146,7 +146,7 @@ function! s:build_stops(snippet, stops, lnum, col, indent) return stop_count endfunction -function! s:build_loc_info(snippet, stops, line, col, indent) +function! s:build_loc_info(snippet, stops, line, col, indent) abort let stops = a:stops let line = a:line let col = a:col @@ -183,7 +183,7 @@ function! s:build_loc_info(snippet, stops, line, col, indent) return [line, col] endfunction -function! s:add_mirror(stops, id, line, col, item) +function! s:add_mirror(stops, id, line, col, item) abort let stops = a:stops let item = a:item let stops[a:id].mirrors = get(stops[a:id], 'mirrors', []) @@ -201,7 +201,7 @@ endfunction " ['triggername', 'name', 'contents'] " if triggername is not set 'default' is assumed " TODO: better error checking -fun! snipMate#ReadSnippetsFile(file) +fun! snipMate#ReadSnippetsFile(file) abort let result = [] let new_scopes = [] if !filereadable(a:file) | return [result, new_scopes] | endif @@ -245,7 +245,7 @@ fun! snipMate#ReadSnippetsFile(file) return [result, new_scopes] endf -function! s:GetScopes() +function! s:GetScopes() abort let ret = exists('b:snipMate.scope_aliases') ? copy(b:snipMate.scope_aliases) : {} let global = get(g:snipMate, 'scope_aliases', {}) for alias in keys(global) @@ -262,7 +262,7 @@ endfunction " adds scope aliases to list. " returns new list " the aliases of aliases are added recursively -fun! s:AddScopeAliases(list) +fun! s:AddScopeAliases(list) abort let did = {} let scope_aliases = s:GetScopes() let new = a:list @@ -282,7 +282,7 @@ endf au SourceCmd *.snippet,*.snippets call s:source_snippet() -function! s:info_from_filename(file) +function! s:info_from_filename(file) abort let parts = split(fnamemodify(a:file, ':r'), '/') let snipidx = len(parts) - index(reverse(copy(parts)), 'snippets') - 1 let rtp_prefix = join(parts[(snipidx - @@ -293,7 +293,7 @@ function! s:info_from_filename(file) return [rtp_prefix, trigger, desc] endfunction -function! s:source_snippet() +function! s:source_snippet() abort let file = expand(':p') let [rtp_prefix, trigger, desc] = s:info_from_filename(file) let new_snips = [] @@ -316,7 +316,7 @@ function! s:source_snippet() call extend(s:lookup_state.snips, new_snips) endfunction -function! s:CachedSnips(file) +function! s:CachedSnips(file) abort let mtime = getftime(a:file) if has_key(s:cache, a:file) && s:cache[a:file].mtime >= mtime return s:cache[a:file].contents @@ -327,15 +327,14 @@ function! s:CachedSnips(file) return s:cache[a:file].contents endfunction -function! s:snippet_filenames(scope, trigger) +function! s:snippet_filenames(scope, trigger) abort let mid = ['', '_*', '/*'] - return join(map(extend(mid, map(filter(copy(mid), 'v:key != 1'), - \ "'/' . a:trigger . '*' . v:val")), - \ "'snippets/' . a:scope . v:val . '.snippet'" + let mid += map(copy(mid[1:]), "'/' . a:trigger . '*' . v:val") + return join(map(mid, "'snippets/' . a:scope . v:val . '.snippet'" \ . ". (v:key < 3 ? 's' : '')")) endfunction -function! snipMate#SetByPath(dict, trigger, path, snippet, bang, snipversion) +function! snipMate#SetByPath(dict, trigger, path, snippet, bang, snipversion) abort let d = a:dict if !has_key(d, a:trigger) || a:bang let d[a:trigger] = {} @@ -344,7 +343,7 @@ function! snipMate#SetByPath(dict, trigger, path, snippet, bang, snipversion) endfunction " default triggers based on paths -function! snipMate#DefaultPool(scopes, trigger, result) +function! snipMate#DefaultPool(scopes, trigger, result) abort let scopes = s:AddScopeAliases(a:scopes) let scopes_done = [] let rtp_save = &rtp @@ -377,7 +376,7 @@ endfunction " scopes: list of scopes. usually this is the filetype. eg ['c','cpp'] " trigger may contain glob patterns. Thus use '*' to get all triggers " -fun! snipMate#GetSnippets(scopes, trigger) +fun! snipMate#GetSnippets(scopes, trigger) abort let result = {} for F in values(g:snipMateSources) @@ -389,7 +388,7 @@ endf " adds leading tab " and replaces leading spaces by tabs " see ftplugin/snippet.vim -fun! snipMate#RetabSnip() range +fun! snipMate#RetabSnip() range abort let leadingTab = expand('%:e') == 'snippets' let lines = getline(a:firstline, a:lastline) @@ -424,7 +423,7 @@ fun! snipMate#RetabSnip() range endfor endf -fun! snipMate#OpenSnippetFiles() +fun! snipMate#OpenSnippetFiles() abort let dict = snipMate#GetSnippetFiles(0, snipMate#ScopesByFile(), '*') " sort by files wether they exist - put existing files first let exists = [] @@ -445,13 +444,13 @@ fun! snipMate#OpenSnippetFiles() endfor endf -fun! snipMate#ScopesByFile() +fun! snipMate#ScopesByFile() abort " duplicates are removed in AddScopeAliases return filter(funcref#Call(g:snipMate.get_scopes), "v:val != ''") endf " used by both: completion and insert snippet -fun! snipMate#GetSnippetsForWordBelowCursor(word, exact) +fun! snipMate#GetSnippetsForWordBelowCursor(word, exact) abort " Setup lookups: '1.2.3' becomes [1.2.3] + [3, 2.3] let parts = split(a:word, '\W\zs') " Since '\W\zs' results in splitting *after* a non-keyword character, the @@ -499,7 +498,7 @@ endf " snippets: dict containing snippets by name " usually this is just {'default' : snippet_contents } -fun! s:ChooseSnippet(snippets) +fun! s:ChooseSnippet(snippets) abort let snippet = [] let keys = keys(a:snippets) let i = 1 @@ -521,22 +520,22 @@ fun! s:ChooseSnippet(snippets) return funcref#Call(a:snippets[keys(a:snippets)[idx]]) endf -fun! snipMate#WordBelowCursor() +fun! snipMate#WordBelowCursor() abort return matchstr(getline('.'), '\S\+\%' . col('.') . 'c') endf -fun! snipMate#GetSnippetsForWordBelowCursorForComplete(word) +fun! snipMate#GetSnippetsForWordBelowCursorForComplete(word) abort let snippets = map(snipMate#GetSnippetsForWordBelowCursor(a:word, 0), 'v:val[0]') return filter(snippets, 'v:val =~# "\\V\\^' . escape(a:word, '"\') . '"') endf -fun! snipMate#CanBeTriggered() +fun! snipMate#CanBeTriggered() abort let word = snipMate#WordBelowCursor() let matches = snipMate#GetSnippetsForWordBelowCursorForComplete(word) return len(matches) > 0 endf -fun! snipMate#ShowAvailableSnips() +fun! snipMate#ShowAvailableSnips() abort let col = col('.') let word = snipMate#WordBelowCursor() let matches = snipMate#GetSnippetsForWordBelowCursorForComplete(word) @@ -552,7 +551,7 @@ fun! snipMate#ShowAvailableSnips() endf " Pass an argument to force snippet expansion instead of triggering or jumping -function! snipMate#TriggerSnippet(...) +function! snipMate#TriggerSnippet(...) abort if exists('g:SuperTabMappingForward') if g:SuperTabMappingForward == "" let SuperTabPlug = maparg('SuperTabForward', 'i') @@ -610,7 +609,7 @@ function! snipMate#TriggerSnippet(...) \ : "\=snipMate#ShowAvailableSnips()\" endfunction -fun! snipMate#BackwardsSnippet() +fun! snipMate#BackwardsSnippet() abort if exists('b:snip_state') | return b:snip_state.jump_stop(1) | endif if exists('g:SuperTabMappingForward') diff --git a/sources_non_forked/vim-snipmate/autoload/snipMate_python_demo.vim b/sources_non_forked/vim-snipmate/autoload/snipMate_python_demo.vim index 33d0f28c..de495d27 100644 --- a/sources_non_forked/vim-snipmate/autoload/snipMate_python_demo.vim +++ b/sources_non_forked/vim-snipmate/autoload/snipMate_python_demo.vim @@ -9,7 +9,7 @@ " will create a snippet on the fly which looks like this: " abc(${1:a}, ${2:b}, ${3:c=None}) -fun! snipMate_python_demo#Activate() +fun! snipMate_python_demo#Activate() abort if !exists('g:snipMateSources') let g:snipMateSources = {} endif @@ -17,7 +17,7 @@ fun! snipMate_python_demo#Activate() let g:snipMateSources['python'] = funcref#Function('snipMate_python_demo#FunctionsFromCurrentFileAndTags') endf -fun! s:Add(dict, line, source, trigger) +fun! s:Add(dict, line, source, trigger) abort let matched = matchlist(a:line,'def\s\+\([^( \t]\+\)[ \t]*(\([^)]*\)') if len(matched) > 2 let name = matched[1] @@ -34,7 +34,7 @@ fun! s:Add(dict, line, source, trigger) let sd[a:source] = name.'('.join(args,', ').')' endif endf -fun! snipMate_python_demo#FunctionsFromCurrentFileAndTags(scopes, trigger, result) +fun! snipMate_python_demo#FunctionsFromCurrentFileAndTags(scopes, trigger, result) abort " getting all might be too much if a:trigger == '*' | return | endif if index(a:scopes, 'python') < 0 | return | endif diff --git a/sources_non_forked/vim-snipmate/autoload/snipmate/jumping.vim b/sources_non_forked/vim-snipmate/autoload/snipmate/jumping.vim index 1bce416e..25db9614 100644 --- a/sources_non_forked/vim-snipmate/autoload/snipmate/jumping.vim +++ b/sources_non_forked/vim-snipmate/autoload/snipmate/jumping.vim @@ -1,25 +1,25 @@ -function! s:sfile() +function! s:sfile() abort return expand('') endfunction let s:state_proto = {} -function! snipmate#jumping#state() +function! snipmate#jumping#state() abort return copy(s:state_proto) endfunction -function! s:listize_mirror(mirrors) +function! s:listize_mirror(mirrors) abort return map(copy(a:mirrors), '[v:val.line, v:val.col]') endfunction " Removes snippet state info -function! s:state_remove() dict +function! s:state_remove() dict abort " Remove all autocmds in group snipmate_changes in the current buffer unlet! b:snip_state silent! au! snipmate_changes * endfunction -function! s:state_find_next_stop(backwards) dict +function! s:state_find_next_stop(backwards) dict abort let self.stop_no += a:backwards? -1 : 1 while !has_key(self.stops, self.stop_no) if self.stop_no == self.stop_count @@ -33,7 +33,7 @@ function! s:state_find_next_stop(backwards) dict endfunction " Update state information to correspond to the given tab stop -function! s:state_set_stop(backwards) dict +function! s:state_set_stop(backwards) dict abort call self.find_next_stop(a:backwards) let self.cur_stop = self.stops[self.stop_no] let self.stop_len = (type(self.cur_stop.placeholder) == type(0)) @@ -54,7 +54,7 @@ function! s:state_set_stop(backwards) dict endfunction " Jump to the next/previous tab stop -function! s:state_jump_stop(backwards) dict +function! s:state_jump_stop(backwards) dict abort " Update changes just in case " This seems to be only needed because insert completion does not trigger " the CursorMovedI event @@ -72,7 +72,7 @@ function! s:state_jump_stop(backwards) dict return self.set_stop(a:backwards) endfunction -function! s:state_remove_nested(...) dict +function! s:state_remove_nested(...) dict abort let id = a:0 ? a:1 : self.stop_no if type(self.stops[id].placeholder) == type([]) for i in self.stops[id].placeholder @@ -90,7 +90,7 @@ function! s:state_remove_nested(...) dict endfunction " Select the placeholder for the current tab stop -function! s:state_select_word() dict +function! s:state_select_word() dict abort let len = self.stop_len if !len | return '' | endif let l = col('.') != 1 ? 'l' : '' @@ -103,7 +103,7 @@ endfunction " Update the snippet as text is typed. The self.update_mirrors() function does " the actual work. " If the cursor moves outside of a placeholder, call self.remove() -function! s:state_update_changes() dict +function! s:state_update_changes() dict abort let change_len = col('$') - self.prev_len let self.changed = self.changed || change_len != 0 let self.end_col += change_len @@ -122,7 +122,7 @@ function! s:state_update_changes() dict endfunction " Actually update the mirrors for any changed text -function! s:state_update_mirrors(change) dict +function! s:state_update_mirrors(change) dict abort let newWordLen = self.end_col - self.start_col let newWord = strpart(getline('.'), self.start_col - 1, newWordLen) let changeLen = a:change @@ -159,7 +159,7 @@ function! s:state_update_mirrors(change) dict endif endfunction -function! s:state_find_update_objects(item) dict +function! s:state_find_update_objects(item) dict abort let item = a:item let item.update_objects = [] @@ -179,7 +179,7 @@ function! s:state_find_update_objects(item) dict return item.update_objects endfunction -function! s:state_update(item, change_len) dict +function! s:state_update(item, change_len) dict abort let item = a:item if exists('item.update_objects') let to_update = item.update_objects diff --git a/sources_non_forked/vim-snipmate/autoload/snipmate/legacy.vim b/sources_non_forked/vim-snipmate/autoload/snipmate/legacy.vim index 53eb0cbd..6d4563a3 100644 --- a/sources_non_forked/vim-snipmate/autoload/snipmate/legacy.vim +++ b/sources_non_forked/vim-snipmate/autoload/snipmate/legacy.vim @@ -2,7 +2,7 @@ let s:sigil = nr2char(31) let snipmate#legacy#sigil = s:sigil " Prepare snippet to be processed by s:BuildTabStops -function! snipmate#legacy#process_snippet(snip) +function! snipmate#legacy#process_snippet(snip) abort let snippet = a:snip let esc_bslash = '\%(\\\@') endfunction let s:parser_proto = {} -function! s:new_parser(text) +function! s:new_parser(text) abort let ret = copy(s:parser_proto) let ret.input = a:text let ret.len = strlen(ret.input) @@ -18,12 +18,12 @@ function! s:new_parser(text) return ret endfunction -function! s:parser_advance(...) dict +function! s:parser_advance(...) dict abort let self.pos += a:0 ? a:1 : 1 let self.next = self.input[self.pos] endfunction -function! s:parser_same(tok) dict +function! s:parser_same(tok) dict abort if self.next == a:tok call self.advance() return 1 @@ -32,7 +32,7 @@ function! s:parser_same(tok) dict endif endfunction -function! s:parser_id() dict +function! s:parser_id() dict abort if self.input[(self.pos):(self.pos+5)] == 'VISUAL' call self.advance(6) return 'VISUAL' @@ -45,7 +45,7 @@ function! s:parser_id() dict return -1 endfunction -function! s:parser_add_var(var) dict +function! s:parser_add_var(var) dict abort let id = a:var[0] if !has_key(self.vars, id) let self.vars[id] = { 'instances' : [] } @@ -53,7 +53,7 @@ function! s:parser_add_var(var) dict call add(self.vars[id].instances, a:var) endfunction -function! s:parser_var() dict +function! s:parser_var() dict abort let ret = [] if self.same('{') let id = self.id() @@ -70,7 +70,7 @@ function! s:parser_var() dict return ret endfunction -function! s:parser_varend() dict +function! s:parser_varend() dict abort let ret = [] if self.same(':') call extend(ret, self.placeholder()) @@ -81,11 +81,11 @@ function! s:parser_varend() dict return ret endfunction -function! s:parser_placeholder() dict +function! s:parser_placeholder() dict abort return self.parse('}') endfunction -function! s:parser_subst() dict +function! s:parser_subst() dict abort let ret = {} let ret.pat = join(self.text('/', 1)) if self.same('/') @@ -97,14 +97,14 @@ function! s:parser_subst() dict return ret endfunction -function! s:parser_expr() dict +function! s:parser_expr() dict abort let str = join(self.text('`', 1)) let ret = eval(str) call self.same('`') return type(ret) == type('') ? ret : string(ret) endfunction -function! s:parser_text(...) dict +function! s:parser_text(...) dict abort let res = [] let val = '' if a:0 == 2 && a:2 @@ -140,7 +140,7 @@ function! s:parser_text(...) dict return res endfunction -function! s:parser_parse(...) dict +function! s:parser_parse(...) dict abort let ret = a:0 ? [] : self.value while self.pos < self.len if self.same('$') @@ -186,7 +186,7 @@ call extend(s:parser_proto, snipmate#util#add_methods(s:sfile(), 'parser', \ [ 'advance', 'same', 'id', 'add_var', 'var', 'varend', \ 'placeholder', 'subst', 'expr', 'text', 'parse' ]), 'error') -function! s:indent(count) +function! s:indent(count) abort if &expandtab let shift = repeat(' ', (&sts > 0) ? &sts : &sw) else @@ -195,7 +195,7 @@ function! s:indent(count) return repeat(shift, a:count) endfunction -function! s:visual_placeholder(var, indent) +function! s:visual_placeholder(var, indent) abort let arg = get(a:var, 1, {}) if type(arg) == type({}) let pat = get(arg, 'pat', '') @@ -212,7 +212,7 @@ function! s:visual_placeholder(var, indent) return content endfunction -function! snipmate#parse#snippet(text) +function! snipmate#parse#snippet(text) abort let parser = s:new_parser(a:text) call parser.parse() unlet! b:snipmate_visual diff --git a/sources_non_forked/vim-snipmate/autoload/snipmate/util.vim b/sources_non_forked/vim-snipmate/autoload/snipmate/util.vim index 654c0ae3..5ba21cc2 100644 --- a/sources_non_forked/vim-snipmate/autoload/snipmate/util.vim +++ b/sources_non_forked/vim-snipmate/autoload/snipmate/util.vim @@ -1,6 +1,6 @@ " The next function was based on s:function and s:add_methods in fugitive " -function! snipmate#util#add_methods(sfile, namespace, methods) +function! snipmate#util#add_methods(sfile, namespace, methods) abort let dict = {} for name in a:methods let dict[name] = function(join([matchstr(a:sfile, '\d\+'), diff --git a/sources_non_forked/vim-snipmate/ftplugin/html_snip_helper.vim b/sources_non_forked/vim-snipmate/ftplugin/html_snip_helper.vim index 2e545707..4d523922 100644 --- a/sources_non_forked/vim-snipmate/ftplugin/html_snip_helper.vim +++ b/sources_non_forked/vim-snipmate/ftplugin/html_snip_helper.vim @@ -5,6 +5,6 @@ endif let s:did_snip_helper = 1 " Automatically closes tag if in xhtml -fun! Close() +fun! Close() abort return stridx(&ft, 'xhtml') == -1 ? '' : ' /' endf diff --git a/sources_non_forked/vim-snipmate/plugin/snipMate.vim b/sources_non_forked/vim-snipmate/plugin/snipMate.vim index 5c1b48fc..c82e43a0 100644 --- a/sources_non_forked/vim-snipmate/plugin/snipMate.vim +++ b/sources_non_forked/vim-snipmate/plugin/snipMate.vim @@ -105,7 +105,7 @@ let g:snipMate['get_scopes'] = get(g:snipMate, 'get_scopes', funcref#Function('r " Modified from Luc Hermitte's function on StackOverflow " -function! s:grab_visual() +function! s:grab_visual() abort let a_save = @a try normal! gv"ay @@ -116,7 +116,7 @@ function! s:grab_visual() endfunction " TODO: Allow specifying an arbitrary snippets file -function! s:load_scopes(bang, ...) +function! s:load_scopes(bang, ...) abort let gb = a:bang ? g: : b: let gb.snipMate = get(gb, 'snipMate', {}) let gb.snipMate.scope_aliases = get(gb.snipMate, 'scope_aliases', {}) diff --git a/sources_non_forked/vim-snipmate/t/jumping.vim b/sources_non_forked/vim-snipmate/t/jumping.vim index 7bc22b3b..1c3ab0d3 100644 --- a/sources_non_forked/vim-snipmate/t/jumping.vim +++ b/sources_non_forked/vim-snipmate/t/jumping.vim @@ -1,12 +1,12 @@ -function! Setup(snip) +function! Setup(snip) abort return snipMate#expandSnip(join(a:snip, "\n"), 1) endfunction -function! s:to_be_file(expected) +function! s:to_be_file(expected) abort return a:expected == getline(1,'$') endfunction -function! s:to_be_in(item, list) +function! s:to_be_in(item, list) abort return !empty(filter(copy(a:list), 'v:val is a:item')) endfunction diff --git a/sources_non_forked/vim-snippets/UltiSnips/all.snippets b/sources_non_forked/vim-snippets/UltiSnips/all.snippets index e33d2c51..75783785 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/all.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/all.snippets @@ -29,7 +29,7 @@ def _parse_comments(s): if len(flags) == 0: rv.append((text, text, text, "")) # parse 3-part comment, but ignore those with O flag - elif flags[0] == 's' and 'O' not in flags: + elif 's' in flags and 'O' not in flags: ctriple = [] indent = "" @@ -47,7 +47,7 @@ def _parse_comments(s): ctriple.append(indent) rv.append(ctriple) - elif flags[0] == 'b': + elif 'b' in flags: if len(text) == 1: rv.insert(0, (text,text,text, "")) except StopIteration: diff --git a/sources_non_forked/vim-snippets/UltiSnips/php.snippets b/sources_non_forked/vim-snippets/UltiSnips/php.snippets index 366346a6..cd9c55b9 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/php.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/php.snippets @@ -261,36 +261,56 @@ if (${1:/* condition */}) { $0 endsnippet +snippet ns "namespace declaration" b +namespace ${1:`!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: +› snip.rv = m.group().replace('/', '\\') +`}; +endsnippet + snippet class "Class declaration template" b + -" Version: 2.0 +" Version: 2.1 " GetLatestVimScripts: 1697 1 :AutoInstall: surround.vim if exists("g:loaded_surround") || &cp || v:version < 700 @@ -457,7 +457,7 @@ function! s:dosurround(...) " {{{1 if newchar == "" silent! call repeat#set("\Dsurround".char,scount) else - silent! call repeat#set("\C".(a:0 > 2 && a:3 ? "S" : "s")."urround".char.newchar.s:inpur,scount) + silent! call repeat#set("\C".(a:0 > 2 && a:3 ? "S" : "s")."urround".char.newchar.s:input,scount) endif endfunction " }}}1 diff --git a/vimrcs/plugins_config.vim b/vimrcs/plugins_config.vim index fc0072bd..dd385672 100644 --- a/vimrcs/plugins_config.vim +++ b/vimrcs/plugins_config.vim @@ -76,6 +76,7 @@ set grepprg=/bin/grep\ -nH """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Nerd Tree """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +let g:NERDTreeWinPos = "right" map nn :NERDTreeToggle map nb :NERDTreeFromBookmark map nf :NERDTreeFind From d195ccb777951d53b02c7f5251693bb9a3738916 Mon Sep 17 00:00:00 2001 From: amix Date: Tue, 24 Feb 2015 10:45:22 +0000 Subject: [PATCH 08/10] Updated vim plugins --- sources_non_forked/ack.vim/README.md | 187 ++++++----- sources_non_forked/ack.vim/autoload/ack.vim | 303 ++++++++++------- sources_non_forked/ack.vim/doc/ack.txt | 14 +- .../ack.vim/doc/ack_quick_help.txt | 2 +- sources_non_forked/ack.vim/plugin/ack.vim | 12 +- sources_non_forked/goyo.vim/autoload/goyo.vim | 25 +- sources_non_forked/syntastic/README.markdown | 70 ++-- .../syntastic/autoload/syntastic/c.vim | 26 +- .../syntastic/autoload/syntastic/log.vim | 28 +- .../autoload/syntastic/postprocess.vim | 10 +- .../autoload/syntastic/preprocess.vim | 126 +++++-- .../syntastic/autoload/syntastic/util.vim | 56 ++-- .../syntastic/plugin/syntastic.vim | 81 ++--- .../plugin/syntastic/autoloclist.vim | 6 +- .../syntastic/plugin/syntastic/balloons.vim | 10 +- .../syntastic/plugin/syntastic/checker.vim | 59 ++-- .../syntastic/plugin/syntastic/cursor.vim | 14 +- .../plugin/syntastic/highlighting.vim | 12 +- .../syntastic/plugin/syntastic/loclist.vim | 66 ++-- .../syntastic/plugin/syntastic/modemap.vim | 22 +- .../syntastic/plugin/syntastic/notifiers.vim | 8 +- .../syntastic/plugin/syntastic/registry.vim | 28 +- .../syntastic/plugin/syntastic/signs.vim | 14 +- .../syntastic/syntax_checkers/java/javac.vim | 29 +- .../syntax_checkers/javascript/standard.vim | 47 +++ .../syntax_checkers/json/jsonval.vim | 2 +- .../syntastic/syntax_checkers/nasm/nasm.vim | 2 +- .../syntax_checkers/ocaml/camlp4o.vim | 2 +- .../syntax_checkers/python/flake8.vim | 2 +- .../syntastic/syntax_checkers/r/lint.vim | 2 +- .../syntastic/syntax_checkers/ruby/reek.vim | 5 +- .../syntax_checkers/ruby/rubylint.vim | 4 +- .../syntastic/syntax_checkers/slim/slimrb.vim | 8 +- .../{swift/xcrun.vim => sml/smlnj.vim} | 41 ++- .../syntastic/syntax_checkers/vim/vint.vim | 55 ++++ sources_non_forked/vim-airline/LICENSE | 2 +- sources_non_forked/vim-airline/README.md | 2 +- .../vim-airline/autoload/airline.vim | 2 +- .../vim-airline/autoload/airline/builder.vim | 4 +- .../vim-airline/autoload/airline/debug.vim | 2 +- .../autoload/airline/deprecation.vim | 2 +- .../autoload/airline/extensions.vim | 2 +- .../autoload/airline/extensions/branch.vim | 2 +- .../airline/extensions/bufferline.vim | 2 +- .../autoload/airline/extensions/commandt.vim | 2 +- .../autoload/airline/extensions/csv.vim | 2 +- .../autoload/airline/extensions/ctrlp.vim | 2 +- .../autoload/airline/extensions/default.vim | 2 +- .../autoload/airline/extensions/eclim.vim | 2 +- .../autoload/airline/extensions/example.vim | 2 +- .../autoload/airline/extensions/hunks.vim | 2 +- .../autoload/airline/extensions/netrw.vim | 2 +- .../autoload/airline/extensions/nrrwrgn.vim | 2 +- .../airline/extensions/promptline.vim | 2 +- .../autoload/airline/extensions/quickfix.vim | 2 +- .../autoload/airline/extensions/syntastic.vim | 2 +- .../autoload/airline/extensions/tabline.vim | 308 +----------------- .../airline/extensions/tabline/autoshow.vim | 51 +++ .../airline/extensions/tabline/buffers.vim | 185 +++++++++++ .../airline/extensions/tabline/buflist.vim | 38 +++ .../tabline/{ => formatters}/default.vim | 8 +- .../tabline/{ => formatters}/unique_tail.vim | 8 +- .../{ => formatters}/unique_tail_improved.vim | 10 +- .../airline/extensions/tabline/tabs.vim | 80 +++++ .../autoload/airline/extensions/tagbar.vim | 2 +- .../autoload/airline/extensions/tmuxline.vim | 2 +- .../autoload/airline/extensions/undotree.vim | 2 +- .../autoload/airline/extensions/unite.vim | 2 +- .../airline/extensions/virtualenv.vim | 2 +- .../airline/extensions/whitespace.vim | 2 +- .../autoload/airline/highlighter.vim | 10 +- .../vim-airline/autoload/airline/init.vim | 2 +- .../vim-airline/autoload/airline/parts.vim | 2 +- .../vim-airline/autoload/airline/section.vim | 2 +- .../vim-airline/autoload/airline/themes.vim | 2 +- .../autoload/airline/themes/badwolf.vim | 2 +- .../autoload/airline/themes/base16.vim | 8 +- .../vim-airline/autoload/airline/util.vim | 2 +- .../vim-airline/doc/airline.txt | 36 +- .../vim-airline/plugin/airline.vim | 38 +-- .../vim-fugitive/plugin/fugitive.vim | 11 +- sources_non_forked/vim-go/README.md | 32 +- sources_non_forked/vim-go/autoload/go/fmt.vim | 2 +- .../vim-go/autoload/go/oracle.vim | 190 ++++------- .../vim-go/autoload/webapi/json.vim | 135 -------- sources_non_forked/vim-go/doc/vim-go.txt | 124 ++++++- .../vim-go/ftplugin/go/commands.vim | 26 +- .../vim-go/gosnippets/UltiSnips/go.snippets | 39 ++- .../vim-go/gosnippets/snippets/go.snip | 32 ++ sources_non_forked/vim-go/indent/go.vim | 80 +++-- .../vim-multiple-cursors/README.md | 9 +- .../doc/multiple_cursors.txt | 26 +- .../vim-repeat/autoload/repeat.vim | 15 +- .../vim-snipmate/Contributors.md | 1 + sources_non_forked/vim-snipmate/README.md | 4 +- .../vim-snipmate/autoload/snipMate.vim | 8 +- sources_non_forked/vim-snippets/README.md | 2 - .../vim-snippets/UltiSnips/elixir.snippets | 168 ---------- .../vim-snippets/UltiSnips/php.snippets | 10 +- .../vim-snippets/snippets/elixir.snippets | 24 +- .../snippets/javascript/javascript.snippets | 4 +- .../vim-surround/doc/surround.txt | 7 +- .../vim-surround/plugin/surround.vim | 30 +- vimrcs/plugins_config.vim | 2 + 104 files changed, 1743 insertions(+), 1464 deletions(-) create mode 100644 sources_non_forked/syntastic/syntax_checkers/javascript/standard.vim rename sources_non_forked/syntastic/syntax_checkers/{swift/xcrun.vim => sml/smlnj.vim} (50%) create mode 100644 sources_non_forked/syntastic/syntax_checkers/vim/vint.vim create mode 100644 sources_non_forked/vim-airline/autoload/airline/extensions/tabline/autoshow.vim create mode 100644 sources_non_forked/vim-airline/autoload/airline/extensions/tabline/buffers.vim create mode 100644 sources_non_forked/vim-airline/autoload/airline/extensions/tabline/buflist.vim rename sources_non_forked/vim-airline/autoload/airline/extensions/tabline/{ => formatters}/default.vim (75%) rename sources_non_forked/vim-airline/autoload/airline/extensions/tabline/{ => formatters}/unique_tail.vim (56%) rename sources_non_forked/vim-airline/autoload/airline/extensions/tabline/{ => formatters}/unique_tail_improved.vim (85%) create mode 100644 sources_non_forked/vim-airline/autoload/airline/extensions/tabline/tabs.vim delete mode 100644 sources_non_forked/vim-go/autoload/webapi/json.vim delete mode 100644 sources_non_forked/vim-snippets/UltiSnips/elixir.snippets diff --git a/sources_non_forked/ack.vim/README.md b/sources_non_forked/ack.vim/README.md index 008fb3dd..59f00f1d 100644 --- a/sources_non_forked/ack.vim/README.md +++ b/sources_non_forked/ack.vim/README.md @@ -1,131 +1,148 @@ # ack.vim -This plugin is a front for the Perl module -[App::Ack](http://search.cpan.org/~petdance/ack/ack). Ack can be used as a -replacement for 99% of the uses of _grep_. This plugin will allow you to run -ack from vim, and shows the results in a split window. +Run your favorite search tool from Vim, with an enhanced results list. + +This plugin was designed as a Vim frontend for the Perl module [App::Ack]. Ack +can be used as a replacement for 99% of the uses of _grep_. The plugin allows +you to run ack from vim, and shows the results in a split window. + +But here's a little secret for the Vim-seasoned: it's just a light wrapper for +Vim's [grepprg] and the [quickfix] window for match results. This makes it easy +to integrate with your own Vim configuration and use existing knowledge of core +features. It also means the plugin is flexible to use with other search tools. + +[App::Ack]: http://search.cpan.org/~petdance/ack/ack +[grepprg]: http://vimdoc.sourceforge.net/htmldoc/options.html#'grepprg' +[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix ## Installation ### Ack -You will need the ack(>= 2.0), of course, to install it follow the -[manual](http://beyondgrep.com/install/) +You will need ack (>= 2.0), of course. To install it follow the +[manual](http://beyondgrep.com/install/). ### The Plugin -To install it is recommended to use one of the popular package managers for Vim, -rather than installing by drag and drop all required files into your `.vim` folder. - -#### Manual (not recommended) - -Just -[download](https://github.com/mileszs/ack.vim/archive/kb-improve-readme.zip) the -plugin and put it in your `~/.vim/`(or `%PROGRAMFILES%/Vim/vimfiles` on windows) +It is recommended to use one of the popular plugin managers for Vim. There are +many and you probably already have a preferred one, but a few examples for your +copy-and-paste convenience: #### Vundle - Bundle 'mileszs/ack.vim' + Plugin 'mileszs/ack.vim' #### NeoBundle NeoBundle 'mileszs/ack.vim' +#### Manual (not recommended) + +[Download][releases] the plugin and extract it in `~/.vim/` (or +`%PROGRAMFILES%/Vim/vimfiles` on Windows). + +[zipball]: https://github.com/mileszs/ack.vim/archive/master.zip + ## Usage :Ack [options] {pattern} [{directories}] -Search recursively in {directory} (which defaults to the current directory) for -the {pattern}. +Search recursively in `{directories}` (which defaults to the current directory) +for the `{pattern}`. -Files containing the search term will be listed in the split window, along with -the line number of the occurrence, once for each occurrence. [Enter] on a line -in this window will open the file, and place the cursor on the matching line. +Files containing the search term will be listed in the quickfix window, along +with the line number of the occurrence, once for each occurrence. `` on +a line in this window will open the file, and place the cursor on the matching +line. -Just like where you use :grep, :grepadd, :lgrep, and :lgrepadd, you can use -`:Ack`, `:AckAdd`, `:LAck`, and `:LAckAdd` respectively. -(See `doc/ack.txt`, or install and `:h Ack` for more information.) +Just like where you use `:grep`, `:grepadd`, `:lgrep`, and :`lgrepadd`, you can +use `:Ack`, `:AckAdd`, `:LAck`, and `:LAckAdd` respectively. (See `:help Ack` +after installing, or [`doc/ack.txt`][doc] in the repo, for more information.) -For more ack options see -[ack documentation](http://beyondgrep.com/documentation/) +For more ack help see [ack documentation](http://beyondgrep.com/documentation/). + +[doc]: https://github.com/mileszs/ack.vim/blob/master/doc/ack.txt ### Keyboard Shortcuts -In the quickfix window, you can use: +The quickfix results window is augmented with these convenience mappings: - o to open (same as enter) - O to open and close quickfix window - go to preview file (open but maintain focus on ack.vim results) + ? a quick summary of these keys, repeat to close + o to open (same as Enter) + O to open and close the quickfix window + go to preview file, open but maintain focus on ack.vim results t to open in new tab - T to open in new tab silently + T to open in new tab without moving to it h to open in horizontal split - H to open in horizontal split silently + H to open in horizontal split, keeping focus on the results v to open in vertical split - gv to open in vertical split silently + gv to open in vertical split, keeping focus on the results q to close the quickfix window -This Vim plugin is derived (and by derived, I mean copied, essentially) from -Antoine Imbert's blog post -[Ack and Vim Integration](http://blog.ant0ine.com/typepad/2007/03/ack-and-vim-integration.html) -(in particular, the function at the bottom of the post). I added a help file that -provides just enough reference to get you going. I also highly recommend you -check out the docs for the Perl script 'ack', for obvious reasons: -[ack - grep-like text finder](http://beyondgrep.com/). - ### 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.) +Some characters have special meaning, and need to be escaped in your search +pattern. For instance, `#`. You need to escape it with `:Ack '\\\#define +foo'` to search for '#define foo'. See [issue #5]. + +[issue #5]: https://github.com/mileszs/ack.vim/issues/5 + +## Possibly FAQ + +#### Can I use `ag` ([The Silver Searcher]) with this? + +Absolutely, and probably other tools if their output is similar or you can +write a pattern match for it--just set `g:ackprg`. If you like, you can fall +back to Ack in case you use your vimrc on a system without Ag available: + +```vim +if executable('ag') + let g:ackprg = 'ag --vimgrep' +endif +``` + +Since Ack is quite portable you might check a copy of it into your dotfiles +repository in `~/bin` so you'll nearly always have it available. + +#### What's the difference from ag.vim? + +Well... not a lot really. + +Present maintainer, yours truly, [kind of wishes they never forked][sadface], +contributes to both, and wouldn't mind seeing them merged again. ag.vim got a +nice code clean-up (which ack.vim is now hopefully getting), and ack.vim picked +up a few features that haven't made their way to ag.vim, like `:AckWindow`, +optional background search execution with [vim-dispatch], and auto-previewing. + +[The Silver Searcher]: https://github.com/ggreer/the_silver_searcher +[sadface]: https://github.com/mileszs/ack.vim/commit/d97090fb502d40229e6976dfec0e06636ba227d5#commitcomment-5771145 ## Changelog -### 1.0 +Please see [the Github releases page][releases]. -* Remove support to ack 1.x -* Start to use a Changelog -* Use `autoload` directory to define functions, instead of `plugin`. -* Add option to auto fold the results(`g:ack_autofold_results`) -* Improve documentation, list all options and shortcuts -* Improve highlight option to work when passes directories or use quotes. -* Add g:ack_mapping -* Add g:ack_default_options -* Add a help toggle `?`(like NERDTree) +### 1.0.9 (unreleased) -### 1.0.1 +* Fix location list and layout of quickfix when using Dispatch (#154) +* Fix the quick help overlay clobbering the list mappings +* Fix `:AckFile` when using Dispatch +* Restore original `'makeprg'` and `'errorformat'` when using Dispatch +* Internal refactoring and clean-up -* Fixes #124. Bug with `g:ack_autofold_results` +## Credits -### 1.0.2 +This plugin is derived from Antoine Imbert's blog post [Ack and Vim +Integration][] (in particular, the function in the update to the post). [Miles +Sterrett][mileszs] packaged it up as a plugin and documented it in Vim's help +format, and since then [many contributors][contributors] have submitted +enhancements and fixes. -* Add compatibility with [vim-dispatch](https://github.com/tpope/vim-dispatch) +And of course, where would we be without [Ack]. And, you know, Vim. -### 1.0.3 +[Ack and Vim Integration]: http://blog.ant0ine.com/typepad/2007/03/ack-and-vim-integration.html +[mileszs]: https://github.com/mileszs +[contributors]: https://github.com/mileszs/ack.vim/graphs/contributors +[Ack]: http://beyondgrep.com/ -* 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 +[vim-dispatch]: https://github.com/tpope/vim-dispatch +[releases]: https://github.com/mileszs/ack.vim/releases diff --git a/sources_non_forked/ack.vim/autoload/ack.vim b/sources_non_forked/ack.vim/autoload/ack.vim index fae73b1f..fd6e54ca 100644 --- a/sources_non_forked/ack.vim/autoload/ack.vim +++ b/sources_non_forked/ack.vim/autoload/ack.vim @@ -1,6 +1,30 @@ -function! ack#Ack(cmd, args) +if exists('g:ack_use_dispatch') + if g:ack_use_dispatch && !exists(':Dispatch') + call s:Warn('Dispatch not loaded! Falling back to g:ack_use_dispatch = 0.') + let g:ack_use_dispatch = 0 + endif +else + let g:ack_use_dispatch = 0 +end + +"----------------------------------------------------------------------------- +" Public API +"----------------------------------------------------------------------------- + +function! ack#Ack(cmd, args) "{{{ + call s:Init(a:cmd) redraw - echo "Searching ..." + + " Local values that we'll temporarily set as options when searching + let l:grepprg = g:ackprg + let l:grepformat = '%f:%l:%c:%m,%f:%l:%m' " Include column number + + " Strip some options that are meaningless for path search and set match + " format accordingly. + if s:SearchingFilepaths() + let l:grepprg = substitute(l:grepprg, '-H\|--column', '', 'g') + let l:grepformat = '%f' + endif " If no pattern is provided, search for the word under the cursor if empty(a:args) @@ -8,89 +32,129 @@ 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 - if a:cmd =~# '-g$' - let g:ackformat="%f" - let l:ackprg_run = substitute(l:ackprg_run, '-H\|--column', '', 'g') + " NOTE: we escape special chars, but not everything using shellescape to + " allow for passing arguments etc + let l:escaped_args = escape(l:grepargs, '|#%') + + echo "Searching ..." + + if g:ack_use_dispatch + call s:SearchWithDispatch(l:grepprg, l:escaped_args, l:grepformat) else - let g:ackformat="%f:%l:%c:%m,%f:%l:%m" + call s:SearchWithGrep(a:cmd, l:grepprg, l:escaped_args, l:grepformat) endif - let grepprg_bak = &grepprg - let grepformat_bak = &grepformat - let &grepprg=l:ackprg_run - let &grepformat=g:ackformat + " Dispatch has no callback mechanism currently, we just have to display the + " list window early and wait for it to populate :-/ + call ack#ShowResults() + call s:Highlight(l:grepargs) +endfunction "}}} - try - " NOTE: we escape special chars, but not everything using shellescape to - " allow for passing arguments etc - 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 +function! ack#AckFromSearch(cmd, args) "{{{ + let search = getreg('/') + " translate vim regular expression to perl regular expression. + let search = substitute(search, '\(\\<\|\\>\)', '\\b', 'g') + call ack#Ack(a:cmd, '"' . search . '" ' . a:args) +endfunction "}}} - finally - let &grepprg=grepprg_bak - let &grepformat=grepformat_bak - endtry +function! ack#AckHelp(cmd, args) "{{{ + let args = a:args . ' ' . s:GetDocLocations() + call ack#Ack(a:cmd, args) +endfunction "}}} - if a:cmd =~# '^l' - let s:handler = g:ack_lhandler - let s:apply_mappings = g:ack_apply_lmappings - let s:close_cmd = ':lclose' - else - let s:handler = g:ack_qhandler - let s:apply_mappings = g:ack_apply_qmappings - let s:close_cmd = ':cclose' - endif +function! ack#AckWindow(cmd, args) "{{{ + let files = tabpagebuflist() - if !g:ack_use_dispatch - call ack#show_results() - else - copen - endif - call apply_maps() - call highlight(l:grepargs) + " remove duplicated filenames (files appearing in more than one window) + let files = filter(copy(sort(files)), 'index(files,v:val,v:key+1)==-1') + call map(files, "bufname(v:val)") + " remove unnamed buffers as quickfix (empty strings before shellescape) + call filter(files, 'v:val != ""') + + " expand to full path (avoid problems with cd/lcd in au QuickFixCmdPre) + let files = map(files, "shellescape(fnamemodify(v:val, ':p'))") + let args = a:args . ' ' . join(files) + + call ack#Ack(a:cmd, args) +endfunction "}}} + +function! ack#ShowResults() "{{{ + let l:handler = s:UsingLocList() ? g:ack_lhandler : g:ack_qhandler + execute l:handler + call s:ApplyMappings() redraw! -endfunction +endfunction "}}} -function! ack#show_results() - execute s:handler -endfunction +"----------------------------------------------------------------------------- +" Private API +"----------------------------------------------------------------------------- -function! s:apply_maps() - let g:ack_mappings.q = s:close_cmd - - execute "nnoremap ? :call ack#quick_help()" - - if s:apply_mappings && &ft == "qf" - if g:ack_autoclose - for key_map in items(g:ack_mappings) - execute printf("nnoremap %s %s", get(key_map, 0), get(key_map, 1) . s:close_cmd) - endfor - execute "nnoremap " . s:close_cmd - else - for key_map in items(g:ack_mappings) - execute printf("nnoremap %s %s", get(key_map, 0), get(key_map, 1)) - endfor - endif - - if exists("g:ackpreview") " if auto preview in on, remap j and k keys - execute "nnoremap j j" - execute "nnoremap k k" - endif +function! s:ApplyMappings() "{{{ + if !s:UsingListMappings() || &filetype != 'qf' + return endif -endfunction -function! ack#quick_help() - execute "edit " . globpath(&rtp, "doc/ack_quick_help.txt") + let l:wintype = s:UsingLocList() ? 'l' : 'c' + let l:closemap = ':' . l:wintype . 'close' + let g:ack_mappings.q = l:closemap + + nnoremap ? :call QuickHelp() + + if g:ack_autoclose + " We just map the 'go' and 'gv' mappings to close on autoclose, wtf? + for key_map in items(g:ack_mappings) + execute printf("nnoremap %s %s", get(key_map, 0), get(key_map, 1) . l:closemap) + endfor + + execute "nnoremap " . l:closemap + else + for key_map in items(g:ack_mappings) + execute printf("nnoremap %s %s", get(key_map, 0), get(key_map, 1)) + endfor + endif + + if exists("g:ackpreview") " if auto preview in on, remap j and k keys + nnoremap j j + nnoremap k k + endif +endfunction "}}} + +function! s:GetDocLocations() "{{{ + let dp = '' + for p in split(&rtp, ',') + let p = p . '/doc/' + if isdirectory(p) + let dp = p . '*.txt ' . dp + endif + endfor + + return dp +endfunction "}}} + +function! s:Highlight(args) "{{{ + if !g:ackhighlight + return + endif + + let @/ = matchstr(a:args, "\\v(-)\@", "n") +endfunction "}}} + +" Initialize state for an :Ack* or :LAck* search +function! s:Init(cmd) "{{{ + let s:searching_filepaths = (a:cmd =~# '-g$') ? 1 : 0 + let s:using_loclist = (a:cmd =~# '^l') ? 1 : 0 + + if g:ack_use_dispatch && s:using_loclist + call s:Warn('Dispatch does not support location lists! Proceeding with quickfix...') + let s:using_loclist = 0 + endif +endfunction "}}} + +function! s:QuickHelp() "{{{ + execute 'edit' globpath(&rtp, 'doc/ack_quick_help.txt') silent normal gg setlocal buftype=nofile @@ -104,51 +168,68 @@ function! ack#quick_help() setlocal nowrap setlocal foldlevel=20 setlocal foldmethod=diff - nnoremap ? :q!:call ack#show_results() -endfunction -function! s:highlight(args) - if !g:ackhighlight - return + nnoremap ? :q!:call ack#ShowResults() +endfunction "}}} + +function! s:SearchWithDispatch(grepprg, grepargs, grepformat) "{{{ + let l:makeprg_bak = &l:makeprg + let l:errorformat_bak = &l:errorformat + + " We don't execute a :grep command for Dispatch, so add -g here instead + if s:SearchingFilepaths() + let l:grepprg = a:grepprg . ' -g' + else + let l:grepprg = a:grepprg endif - let @/ = matchstr(a:args, "\\v(-)\@", "n") -endfunction + try + let &l:makeprg = l:grepprg . ' ' . a:grepargs + let &l:errorformat = a:grepformat -function! ack#AckFromSearch(cmd, args) - let search = getreg('/') - " translate vim regular expression to perl regular expression. - let search = substitute(search, '\(\\<\|\\>\)', '\\b', 'g') - call ack#Ack(a:cmd, '"' . search . '" ' . a:args) -endfunction + Make + finally + let &l:makeprg = l:makeprg_bak + let &l:errorformat = l:errorformat_bak + endtry +endfunction "}}} -function! s:GetDocLocations() - let dp = '' - for p in split(&rtp, ',') - let p = p . '/doc/' - if isdirectory(p) - let dp = p . '*.txt ' . dp - endif - endfor +function! s:SearchWithGrep(grepcmd, grepprg, grepargs, grepformat) "{{{ + let l:grepprg_bak = &l:grepprg + let l:grepformat_bak = &grepformat - return dp -endfunction + try + let &l:grepprg = a:grepprg + let &grepformat = a:grepformat -function! ack#AckHelp(cmd, args) - let args = a:args . ' ' . s:GetDocLocations() - call ack#Ack(a:cmd, args) -endfunction + silent execute a:grepcmd a:grepargs + finally + let &l:grepprg = l:grepprg_bak + let &grepformat = l:grepformat_bak + endtry +endfunction "}}} -function! ack#AckWindow(cmd, args) - let files = tabpagebuflist() - " remove duplicated filenames (files appearing in more than one window) - let files = filter(copy(sort(files)), 'index(files,v:val,v:key+1)==-1') - call map(files, "bufname(v:val)") - " remove unnamed buffers as quickfix (empty strings before shellescape) - call filter(files, 'v:val != ""') - " expand to full path (avoid problems with cd/lcd in au QuickFixCmdPre) - let files = map(files, "shellescape(fnamemodify(v:val, ':p'))") - let args = a:args . ' ' . join(files) - call ack#Ack(a:cmd, args) -endfunction +" Are we finding matching files, not lines? (the -g option -- :AckFile) +function! s:SearchingFilepaths() "{{{ + return get(s:, 'searching_filepaths', 0) +endfunction "}}} + +" Predicate for whether mappings are enabled for list type of current search. +function! s:UsingListMappings() "{{{ + if s:UsingLocList() + return g:ack_apply_lmappings + else + return g:ack_apply_qmappings + endif +endfunction "}}} + +" Were we invoked with a :LAck command? +function! s:UsingLocList() "{{{ + return get(s:, 'using_loclist', 0) +endfunction "}}} + +function! s:Warn(msg) "{{{ + echohl WarningMsg | echomsg 'Ack: ' . a:msg | echohl None +endf "}}} + +" vim:set et sw=2 ts=2 tw=78 fdm=marker diff --git a/sources_non_forked/ack.vim/doc/ack.txt b/sources_non_forked/ack.vim/doc/ack.txt index 6b1be331..71d74548 100644 --- a/sources_non_forked/ack.vim/doc/ack.txt +++ b/sources_non_forked/ack.vim/doc/ack.txt @@ -68,7 +68,12 @@ with the line number of the occurrence, once for each occurrence. on a line in this window will open the file, and place the cursor on the matching line. -See http://betterthangrep.com/ for more information. +Note that if you are using Dispatch.vim with |g:ack_use_dispatch|, location +lists are not supported, because Dispatch does not support them at this time. +`:LAck` versions of commands above will give a warning and proceed to use the +quickfix list instead. + +See http://beyondgrep.com/ for more information on searching with ack. ============================================================================== @@ -208,7 +213,12 @@ Example: g:ack_use_dispatch Default: 0 -Use this option to use vim-dispatch to search the results in background +Use this option to use vim-dispatch to run searches in the background, with a +variety of execution backends for different systems. + +Due to limitations in Dispatch at this time, location lists are unsupported +and result windows will appear before results are ready. Still, these may be +acceptable tradeoffs for very large projects where searches are slow. Example: > diff --git a/sources_non_forked/ack.vim/doc/ack_quick_help.txt b/sources_non_forked/ack.vim/doc/ack_quick_help.txt index 5c52f6cb..bcdf5160 100644 --- a/sources_non_forked/ack.vim/doc/ack_quick_help.txt +++ b/sources_non_forked/ack.vim/doc/ack_quick_help.txt @@ -1,6 +1,6 @@ ==== ack.vim quick help =============== - *?:* Show this help + *?:* Show/quit this help *t:* Open in a new tab *T:* Open in a new tab silently *o:* Open diff --git a/sources_non_forked/ack.vim/plugin/ack.vim b/sources_non_forked/ack.vim/plugin/ack.vim index 6d6c55bc..2cc48036 100644 --- a/sources_non_forked/ack.vim/plugin/ack.vim +++ b/sources_non_forked/ack.vim/plugin/ack.vim @@ -1,3 +1,7 @@ +if exists('g:loaded_ack') + finish +endif + if !exists("g:ack_default_options") let g:ack_default_options = " -s -H --nocolor --nogroup --column" endif @@ -22,10 +26,6 @@ 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", @@ -73,3 +73,7 @@ command! -bang -nargs=* -complete=help AckHelp call ack#AckHelp('grep', ) command! -bang -nargs=* -complete=help AckWindow call ack#AckWindow('grep', ) command! -bang -nargs=* -complete=help LAckWindow call ack#AckWindow('lgrep', ) + +let g:loaded_ack = 1 + +" vim:set et sw=2 ts=2 tw=78 fdm=marker diff --git a/sources_non_forked/goyo.vim/autoload/goyo.vim b/sources_non_forked/goyo.vim/autoload/goyo.vim index e4a904f7..b790e893 100644 --- a/sources_non_forked/goyo.vim/autoload/goyo.vim +++ b/sources_non_forked/goyo.vim/autoload/goyo.vim @@ -160,6 +160,18 @@ endfunction function! s:goyo_on(width) let s:orig_tab = tabpagenr() + let settings = + \ { 'laststatus': &laststatus, + \ 'showtabline': &showtabline, + \ 'fillchars': &fillchars, + \ 'winminwidth': &winminwidth, + \ 'winwidth': &winwidth, + \ 'winminheight': &winminheight, + \ 'winheight': &winheight, + \ 'ruler': &ruler, + \ 'sidescroll': &sidescroll, + \ 'sidescrolloff': &sidescrolloff + \ } " New tab tab split @@ -170,18 +182,7 @@ function! s:goyo_on(width) let t:goyo_margin_bottom = get(g:, 'goyo_margin_bottom', 4) let t:goyo_initial_dim = [t:goyo_width, t:goyo_margin_top, t:goyo_margin_bottom] let t:goyo_pads = {} - let t:goyo_revert = - \ { 'laststatus': &laststatus, - \ 'showtabline': &showtabline, - \ 'fillchars': &fillchars, - \ 'winminwidth': &winminwidth, - \ 'winwidth': &winwidth, - \ 'winminheight': &winminheight, - \ 'winheight': &winheight, - \ 'ruler': &ruler, - \ 'sidescroll': &sidescroll, - \ 'sidescrolloff': &sidescrolloff - \ } + let t:goyo_revert = settings let t:goyo_maps = extend(s:maps_nop(), s:maps_resize()) if has('gui_running') let t:goyo_revert.guioptions = &guioptions diff --git a/sources_non_forked/syntastic/README.markdown b/sources_non_forked/syntastic/README.markdown index f8cf88b7..73c09c66 100644 --- a/sources_non_forked/syntastic/README.markdown +++ b/sources_non_forked/syntastic/README.markdown @@ -29,14 +29,15 @@ 4.3. [Are there any local checkers for HTML5 that I can use with syntastic?](#faqhtml5) 4.4. [The `perl` checker has stopped working...](#faqperl) 4.5. [What happened to the `rustc` checker?](#faqrust) -4.6. [I run a checker and the location list is not updated...](#faqloclist) -4.6. [I run`:lopen` or `:lwindow` and the error window is empty...](#faqloclist) -4.7. [How can I pass additional arguments to a checker?](#faqargs) -4.8. [Syntastic supports several checkers for my filetype - how do I tell which one(s) to use?](#faqcheckers) -4.9. [What is the difference between syntax checkers and style checkers?](#faqstyle) -4.10. [I have enabled multiple checkers for the current filetype. How can I display all of the errors from all of the checkers together?](#faqaggregate) -4.11. [How can I jump between the different errors without using the location list at the bottom of the window?](#faqlnext) -4.12. [The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?](#faqbdelete) +4.6. [What happened to the `xcrun` checker?](#faqxcrun) +4.7. [I run a checker and the location list is not updated...](#faqloclist) +4.7. [I run`:lopen` or `:lwindow` and the error window is empty...](#faqloclist) +4.8. [How can I pass additional arguments to a checker?](#faqargs) +4.9. [Syntastic supports several checkers for my filetype - how do I tell which one(s) to use?](#faqcheckers) +4.10. [What is the difference between syntax checkers and style checkers?](#faqstyle) +4.11. [I have enabled multiple checkers for the current filetype. How can I display all of the errors from all of the checkers together?](#faqaggregate) +4.12. [How can I jump between the different errors without using the location list at the bottom of the window?](#faqlnext) +4.13. [The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?](#faqbdelete) 5. [Resources](#otherresources) - - - @@ -51,7 +52,7 @@ can be done on demand, or automatically as files are saved. If syntax errors are detected, the user is notified and is happy because they didn't have to compile their code or execute their script to find them. -At the time of this writing, syntax checking plugins exist for ActionScript, +At the time of this writing, syntastic has checking plugins for ActionScript, 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, @@ -59,11 +60,15 @@ Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, Markdown, MATLAB, NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X and iOS property lists, Puppet, Python, R, Racket, Relax NG, reStructuredText, RPM -spec, Ruby, SASS/SCSS, Scala, Slim, Swift, Tcl, TeX, Texinfo, Twig, TypeScript, +spec, Ruby, SASS/SCSS, Scala, Slim, SML, 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. +A number of third-party Vim plugins also provide checkers for syntastic, +for example: [omnisharp-vim][25], [rust.vim][12], [syntastic-extras][26], +[syntastic-more][27], and [vim-swift][24]. + Below is a screenshot showing the methods that Syntastic uses to display syntax errors. Note that, in practise, you will only have a subset of these methods enabled. @@ -183,10 +188,18 @@ supported, look at the [wiki][3]. Note that aliases do not work; the actual executables must be available in your `$PATH`. Symbolic links are okay though. You can see syntastic's idea of available checkers by running `:SyntasticInfo`. +A second probable reason is that none of the available checkers are +enabled. Syntastic comes preconfigured with a default list of enabled checkers +per filetype, but this list is kept short in order to prevent slowing down Vim +or trying to run conflicting checks. The command `:SyntasticInfo` will show you +which checkers are enabled. You can tell syntastic which checkers (among the +available ones) you want to run by setting `g:syntastic__checkers` in +your `vimrc` (see [below](#faqcheckers)). + Another reason it could fail is that either the command line options or the error output for a syntax checker may have changed. In this case, make sure you have the latest version of the syntax checker installed. If it still fails then -create an issue - or better yet, create a pull request. +post an [issue][4] - or better yet, create a pull request. @@ -236,14 +249,21 @@ let g:syntastic_enable_perl_checker = 1 __4.5. 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. +A. It is now part of the [rust.vim][12] plugin. If you install this plugin the +checker should be picked up automatically by syntastic. + + + +__4.6. Q. What happened to the `xcrun` checker?__ + +A. The `xcrun` checker used to have a security problem and it has been removed. +A better checker for __Swift__ is part of the [vim-swift][24] plugin. If you +install this plugin the checker should be picked up automatically by syntastic. -__4.6. Q. I run a checker and the location list is not updated...__ -__4.6. Q. I run`:lopen` or `:lwindow` and the error window is empty...__ +__4.7. Q. I run a checker and the location list is not updated...__ +__4.7. Q. I run`:lopen` or `:lwindow` and the error window is empty...__ A. By default the location list is changed only when you run the `:Errors` command, in order to minimise conflicts with other plugins. If you want the @@ -255,7 +275,7 @@ let g:syntastic_always_populate_loc_list = 1 -__4.7. Q. How can I pass additional arguments to a checker?__ +__4.8. Q. How can I pass additional arguments to a checker?__ A. Almost all syntax checkers use the `makeprgBuild()` function. Those checkers that do can be configured using global variables. The general form of the @@ -271,7 +291,7 @@ See `:help syntastic-checker-options` for more information. -__4.8. Q. Syntastic supports several checkers for my filetype - how do I tell it +__4.9. Q. Syntastic supports several checkers for my filetype - how do I tell it which one(s) to use?__ A. Stick a line like this in your `vimrc`: @@ -312,7 +332,7 @@ filetype of the current file is `php`). -__4.9. Q. What is the difference between syntax checkers and style checkers?__ +__4.10. Q. What is the difference between syntax checkers and style checkers?__ A. The errors and warnings they produce are highlighted differently and can be filtered by different rules, but otherwise the distinction is pretty much @@ -342,7 +362,7 @@ See `:help syntastic_quiet_messages` for details. -__4.10. Q. I have enabled multiple checkers for the current filetype. How can I +__4.11. Q. I have enabled multiple checkers for the current filetype. How can I display all of the errors from all of the checkers together?__ A. Set `g:syntastic_aggregate_errors` to 1 in your `vimrc`: @@ -354,7 +374,7 @@ See `:help syntastic-aggregating-errors` for more details. -__4.11. Q. How can I jump between the different errors without using the location +__4.12. Q. How can I jump between the different errors without using the location list at the bottom of the window?__ A. Vim provides several built-in commands for this. See `:help :lnext` and @@ -366,7 +386,7 @@ mappings (among other things). -__4.12. Q. The error window is closed automatically when I :quit the current buffer +__4.13. Q. The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?__ A. There is no safe way to handle that situation automatically, but you can @@ -404,7 +424,7 @@ a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9]. [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/ +[12]: https://github.com/rust-lang/rust.vim [13]: http://www.vim.org/ [14]: https://github.com/Shougo/neobundle.vim [15]: https://github.com/MarcWeber/vim-addon-manager @@ -416,6 +436,10 @@ a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9]. [21]: https://github.com/validator/validator/releases/latest [22]: https://github.com/scrooloose/syntastic/wiki/HTML%3A---validator [23]: http://validator.github.io/validator/#standalone +[24]: https://github.com/kballard/vim-swift +[25]: https://github.com/OmniSharp/omnisharp-vim +[26]: https://github.com/myint/syntastic-extras +[27]: https://github.com/roktas/syntastic-more