From 754e831d9e7e30bfdad1777d40c48ef337bac171 Mon Sep 17 00:00:00 2001 From: Chuan Jin Date: Mon, 24 Oct 2016 22:00:55 +0200 Subject: [PATCH 01/74] Update extended.vim Should be my_configs.vim with path --- vimrcs/extended.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vimrcs/extended.vim b/vimrcs/extended.vim index 499959a2..7d5bf3f9 100644 --- a/vimrcs/extended.vim +++ b/vimrcs/extended.vim @@ -36,7 +36,7 @@ colorscheme peaksea " => Fast editing and reloading of vimrc configs """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" map e :e! ~/.vim_runtime/my_configs.vim -autocmd! bufwritepost vimrc source ~/.vim_runtime/my_configs.vim +autocmd! bufwritepost ~/.vim_runtime/my_configs.vim source ~/.vim_runtime/my_configs.vim """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" From bf879c50251b5f3b1cf6c07b6c029bfff77cc2a6 Mon Sep 17 00:00:00 2001 From: Julen Pardo Date: Sun, 30 Oct 2016 14:55:53 +0100 Subject: [PATCH 02/74] Set HTML syntax for Twig files --- vimrcs/filetypes.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vimrcs/filetypes.vim b/vimrcs/filetypes.vim index 8c4eb9db..f1e572f9 100644 --- a/vimrcs/filetypes.vim +++ b/vimrcs/filetypes.vim @@ -65,3 +65,9 @@ au FileType gitcommit call setpos('.', [0, 1, 1, 0]) if exists('$TMUX') set term=screen-256color endif + + +"""""""""""""""""""""""""""""" +" => Twig section +"""""""""""""""""""""""""""""" +autocmd BufRead *.twig set syntax=html filetype=html From 3a876f2be09200e22bb211dc8315fca4ef311f57 Mon Sep 17 00:00:00 2001 From: Pascal Jufer Date: Tue, 22 Nov 2016 09:36:31 +0100 Subject: [PATCH 03/74] Fix #243 Cleanup corrupt submodules and add them again via update_plugins.py script --- sources_non_forked/gruvbox | 1 - sources_non_forked/gruvbox/CHANGELOG.md | 117 ++ sources_non_forked/gruvbox/README.md | 110 ++ .../autoload/airline/themes/gruvbox.vim | 79 ++ .../gruvbox/autoload/gruvbox.vim | 41 + .../lightline/colorscheme/gruvbox.vim | 53 + sources_non_forked/gruvbox/colors/gruvbox.vim | 1239 +++++++++++++++++ .../gruvbox/gruvbox_256palette.sh | 118 ++ .../gruvbox/gruvbox_256palette_osx.sh | 116 ++ sources_non_forked/vim-colorschemes | 1 - sources_non_forked/vim-gitgutter | 1 - sources_non_forked/vim-gitgutter/.gitignore | 5 + sources_non_forked/vim-gitgutter/README.mkd | 499 +++++++ .../vim-gitgutter/autoload/gitgutter.vim | 253 ++++ .../autoload/gitgutter/async.vim | 211 +++ .../autoload/gitgutter/debug.vim | 119 ++ .../vim-gitgutter/autoload/gitgutter/diff.vim | 342 +++++ .../autoload/gitgutter/highlight.vim | 115 ++ .../vim-gitgutter/autoload/gitgutter/hunk.vim | 137 ++ .../vim-gitgutter/autoload/gitgutter/sign.vim | 179 +++ .../autoload/gitgutter/utility.vim | 212 +++ .../vim-gitgutter/doc/gitgutter.txt | 340 +++++ .../vim-gitgutter/plugin/gitgutter.vim | 241 ++++ .../vim-gitgutter/screenshot.png | Bin 0 -> 16191 bytes .../vim-gitgutter/test/fixture.txt | 11 + .../vim-gitgutter/test/runner.vim | 162 +++ sources_non_forked/vim-gitgutter/test/test | 19 + .../vim-gitgutter/test/test_gitgutter.vim | 400 ++++++ 28 files changed, 5118 insertions(+), 3 deletions(-) delete mode 160000 sources_non_forked/gruvbox create mode 100644 sources_non_forked/gruvbox/CHANGELOG.md create mode 100644 sources_non_forked/gruvbox/README.md create mode 100644 sources_non_forked/gruvbox/autoload/airline/themes/gruvbox.vim create mode 100644 sources_non_forked/gruvbox/autoload/gruvbox.vim create mode 100644 sources_non_forked/gruvbox/autoload/lightline/colorscheme/gruvbox.vim create mode 100644 sources_non_forked/gruvbox/colors/gruvbox.vim create mode 100644 sources_non_forked/gruvbox/gruvbox_256palette.sh create mode 100644 sources_non_forked/gruvbox/gruvbox_256palette_osx.sh delete mode 160000 sources_non_forked/vim-colorschemes delete mode 160000 sources_non_forked/vim-gitgutter create mode 100644 sources_non_forked/vim-gitgutter/.gitignore create mode 100644 sources_non_forked/vim-gitgutter/README.mkd create mode 100644 sources_non_forked/vim-gitgutter/autoload/gitgutter.vim create mode 100644 sources_non_forked/vim-gitgutter/autoload/gitgutter/async.vim create mode 100644 sources_non_forked/vim-gitgutter/autoload/gitgutter/debug.vim create mode 100644 sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim create mode 100644 sources_non_forked/vim-gitgutter/autoload/gitgutter/highlight.vim create mode 100644 sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim create mode 100644 sources_non_forked/vim-gitgutter/autoload/gitgutter/sign.vim create mode 100644 sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim create mode 100644 sources_non_forked/vim-gitgutter/doc/gitgutter.txt create mode 100644 sources_non_forked/vim-gitgutter/plugin/gitgutter.vim create mode 100644 sources_non_forked/vim-gitgutter/screenshot.png create mode 100644 sources_non_forked/vim-gitgutter/test/fixture.txt create mode 100644 sources_non_forked/vim-gitgutter/test/runner.vim create mode 100644 sources_non_forked/vim-gitgutter/test/test create mode 100644 sources_non_forked/vim-gitgutter/test/test_gitgutter.vim diff --git a/sources_non_forked/gruvbox b/sources_non_forked/gruvbox deleted file mode 160000 index 705e68d9..00000000 --- a/sources_non_forked/gruvbox +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 705e68d90d6596c621093a28bf480a572a41ad02 diff --git a/sources_non_forked/gruvbox/CHANGELOG.md b/sources_non_forked/gruvbox/CHANGELOG.md new file mode 100644 index 00000000..90fd3a29 --- /dev/null +++ b/sources_non_forked/gruvbox/CHANGELOG.md @@ -0,0 +1,117 @@ +# Change Log + +## [Unreleased](https://github.com/morhetz/gruvbox/tree/HEAD) + +[Full Changelog](https://github.com/morhetz/gruvbox/compare/v1.3.5...HEAD) + +**Fixed bugs:** + +- Lighter background on terminal [\#8](https://github.com/morhetz/gruvbox/issues/8) + +**Closed issues:** + +- Installation issue. [\#54](https://github.com/morhetz/gruvbox/issues/54) + +- Italic font in terminal\(urxvt\) [\#49](https://github.com/morhetz/gruvbox/issues/49) + +- Unable to log in when sourcing the palette shellscript [\#48](https://github.com/morhetz/gruvbox/issues/48) + +- How can i modify multiple comment scheme [\#46](https://github.com/morhetz/gruvbox/issues/46) + +- Remove comment highlight in iterm [\#44](https://github.com/morhetz/gruvbox/issues/44) + +- Comments looking strange withing tmux [\#43](https://github.com/morhetz/gruvbox/issues/43) + +- comments are reverse-video in xterm [\#41](https://github.com/morhetz/gruvbox/issues/41) + +- What font are you using in the screenshots? [\#39](https://github.com/morhetz/gruvbox/issues/39) + +- vim-signature crashes when I use gruvbox [\#38](https://github.com/morhetz/gruvbox/issues/38) + +- Color of statusbar in inactive windows [\#37](https://github.com/morhetz/gruvbox/issues/37) + +- Go method and struct highlighting missing [\#36](https://github.com/morhetz/gruvbox/issues/36) + +- gruvbox\_256palette.sh doesn't work for Konsole [\#35](https://github.com/morhetz/gruvbox/issues/35) + +- Contrast in jekyll markdown files [\#33](https://github.com/morhetz/gruvbox/issues/33) + +- Pentadactyl Gruvbox Theme [\#32](https://github.com/morhetz/gruvbox/issues/32) + +- make vertsplit better [\#31](https://github.com/morhetz/gruvbox/issues/31) + +- Console support. [\#30](https://github.com/morhetz/gruvbox/issues/30) + +- How can I change the background color? [\#29](https://github.com/morhetz/gruvbox/issues/29) + +- Some words are not bold [\#28](https://github.com/morhetz/gruvbox/issues/28) + +- Terminal theme on base gruvbox [\#25](https://github.com/morhetz/gruvbox/issues/25) + +- Markdown has inverted colors when using \* [\#24](https://github.com/morhetz/gruvbox/issues/24) + +- how install it on mac osx [\#23](https://github.com/morhetz/gruvbox/issues/23) + +- Comments color for Terminal Vim [\#22](https://github.com/morhetz/gruvbox/issues/22) + +- Move palette files to gruvbox-generalized [\#20](https://github.com/morhetz/gruvbox/issues/20) + +- Maybe add Gruvbox Airline theme? [\#19](https://github.com/morhetz/gruvbox/issues/19) + +- For Sublime text [\#18](https://github.com/morhetz/gruvbox/issues/18) + +**Merged pull requests:** + +- Fix the 256 palette script failed login issue [\#53](https://github.com/morhetz/gruvbox/pull/53) ([jonasmalacofilho](https://github.com/jonasmalacofilho)) + +- add minimal coloring for gitcommit highlighting [\#52](https://github.com/morhetz/gruvbox/pull/52) ([daniely](https://github.com/daniely)) + +- For terminals, turn off italics by default. [\#47](https://github.com/morhetz/gruvbox/pull/47) ([ryanmjacobs](https://github.com/ryanmjacobs)) + +- Change color of vertical/horizontal seperators between split windows [\#45](https://github.com/morhetz/gruvbox/pull/45) ([deshtop](https://github.com/deshtop)) + +- Improve gruvbox with C code [\#34](https://github.com/morhetz/gruvbox/pull/34) ([gladiac](https://github.com/gladiac)) + +- Fix for linux console [\#27](https://github.com/morhetz/gruvbox/pull/27) ([vyp](https://github.com/vyp)) + +- Colors for plugin vimshell.vim [\#21](https://github.com/morhetz/gruvbox/pull/21) ([joelmo](https://github.com/joelmo)) + +## [v1.3.5](https://github.com/morhetz/gruvbox/tree/v1.3.5) (2014-03-19) + +[Full Changelog](https://github.com/morhetz/gruvbox/compare/v0.0.8...v1.3.5) + +**Implemented enhancements:** + +- Better selection colors [\#15](https://github.com/morhetz/gruvbox/issues/15) + +- When hlsearch is on, the cursor inverts the search color and not visible [\#2](https://github.com/morhetz/gruvbox/issues/2) + +**Fixed bugs:** + +- Problem with changing between dark and light on 256 color terminal [\#7](https://github.com/morhetz/gruvbox/issues/7) + +- IndentGuides coloring doesn't show up [\#1](https://github.com/morhetz/gruvbox/issues/1) + +**Closed issues:** + +- Requesting rxvt-unicode theme [\#17](https://github.com/morhetz/gruvbox/issues/17) + +- gruvbox\_256palette.sh gets reset \(gnome-terminal on Ubuntu\) [\#13](https://github.com/morhetz/gruvbox/issues/13) + +- Powerline colors [\#12](https://github.com/morhetz/gruvbox/issues/12) + +- Info necessary for making a port of this colorscheme [\#10](https://github.com/morhetz/gruvbox/issues/10) + +**Merged pull requests:** + +- Fix GNU screen detection for \*-bce [\#16](https://github.com/morhetz/gruvbox/pull/16) ([blueyed](https://github.com/blueyed)) + +- Added iTerm2 dark theme [\#11](https://github.com/morhetz/gruvbox/pull/11) ([Greduan](https://github.com/Greduan)) + +- Fix typo in Readme [\#5](https://github.com/morhetz/gruvbox/pull/5) ([ViViDboarder](https://github.com/ViViDboarder)) + +## [v0.0.8](https://github.com/morhetz/gruvbox/tree/v0.0.8) (2012-12-08) + + + +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/sources_non_forked/gruvbox/README.md b/sources_non_forked/gruvbox/README.md new file mode 100644 index 00000000..917abdb9 --- /dev/null +++ b/sources_non_forked/gruvbox/README.md @@ -0,0 +1,110 @@ +

+ +gruvbox is heavily inspired by [badwolf][], [jellybeans][] and [solarized][]. + +Designed as a bright theme with pastel 'retro groove' colors and light/dark mode switching in the way of [solarized][]. The main focus when developing gruvbox is to keep colors easily distinguishable, contrast enough and still pleasant for the eyes. + + [badwolf]: https://github.com/sjl/badwolf + [jellybeans]: https://github.com/nanotech/jellybeans.vim + [solarized]: http://ethanschoonover.com/solarized + +Attention +--------- + +1. [Read this first](https://github.com/morhetz/gruvbox/wiki/Terminal-specific) +2. Typeface from gallery is [Fantasque Sans Mono](https://github.com/belluzj/fantasque-sans) +3. Typeface from screenshots below is [Fira Mono](http://www.carrois.com/fira-4-1/) + +Screenshots +----------- + +Refer [Gallery][] for more syntax-specific screenshots. + + [Gallery]: https://github.com/morhetz/gruvbox/wiki/Gallery + +### Dark mode + +![Screenshot Dark](http://i.imgur.com/GkIl8Fn.png) + +### Light mode + +![Screenshot Light](http://i.imgur.com/X75niEa.png) + +### Airline theme + +![Screenshot Airline](http://i.imgur.com/wRQceUR.png) + +Palette +------- + +### Dark mode + +![Palette Dark](http://i.imgur.com/wa666xg.png) + +### Light mode + +![Palette Light](http://i.imgur.com/49qKyYW.png) + +Contrast options +---------------- + +Refer [wiki section][] for contrast configuration and other options. + + [wiki section]: https://github.com/morhetz/gruvbox/wiki/Configuration#ggruvbox_contrast_dark + +![Contrast Options](http://i.imgur.com/5MSbe6T.png) + +Documentation +------------- + +Please check [wiki][] for installation details, terminal-specific setup, troubleshooting, configuration options and others. + + [wiki]: https://github.com/morhetz/gruvbox/wiki + +Features +-------- + +* Lots of style-customization options (contrast, color invertion, italics usage etc.) +* Extended filetype highlighting: Html, Xml, Vim (and ES6 with [yajs.vim](https://github.com/othree/yajs.vim)), Clojure, C, Python, JavaScript, CoffeeScript, Ruby, Objective-C, Go, Lua, MoonScript, Java, Markdown, Haskell +* Supported plugins: [EasyMotion][], [vim-sneak][], [Indent Guides][], [indentLine][], [Rainbow Parentheses][], [Airline][], [Lightline][], [GitGutter][], [Signify][], [ShowMarks][], [Signature][], [Syntastic][], [CtrlP][], [Startify][] + + [EasyMotion]: https://github.com/Lokaltog/vim-easymotion + [vim-sneak]: https://github.com/justinmk/vim-sneak + [Indent Guides]: https://github.com/nathanaelkane/vim-indent-guides + [indentLine]: https://github.com/Yggdroot/indentLine + [Rainbow Parentheses]: https://github.com/kien/rainbow_parentheses.vim + [Airline]: https://github.com/bling/vim-airline + [Lightline]: https://github.com/itchyny/lightline.vim + [GitGutter]: https://github.com/airblade/vim-gitgutter + [Signify]: https://github.com/mhinz/vim-signify + [ShowMarks]: http://www.vim.org/scripts/script.php?script_id=152 + [Signature]: https://github.com/kshenoy/vim-signature + [Syntastic]: https://github.com/scrooloose/syntastic + [CtrlP]: https://github.com/kien/ctrlp.vim + [Startify]: https://github.com/mhinz/vim-startify + +Contributions +------------- + +See [gruvbox-contrib][] repo for contributions, ports and extras. + +[gruvbox-contrib]: https://github.com/morhetz/gruvbox-contrib + +ToDo +---- + +* Filetype syntax highlighting (R, TeX, Swift, Erlang, Purescript and I'm still dissatisfied with CSS) +* Plugin support (MiniBufExplorer, Tagbar, Netrw, VimPLug) + +Self-Promotion +-------------- + +If you like gruvbox follow the repository on +[GitHub](https://github.com/morhetz/gruvbox) and vote for it on +[vim.org](http://www.vim.org/scripts/script.php?script_id=4349). + +License +------- +[MIT/X11][] + + [MIT/X11]: https://en.wikipedia.org/wiki/MIT_License diff --git a/sources_non_forked/gruvbox/autoload/airline/themes/gruvbox.vim b/sources_non_forked/gruvbox/autoload/airline/themes/gruvbox.vim new file mode 100644 index 00000000..84793190 --- /dev/null +++ b/sources_non_forked/gruvbox/autoload/airline/themes/gruvbox.vim @@ -0,0 +1,79 @@ +" ----------------------------------------------------------------------------- +" File: gruvbox.vim +" Description: Retro groove color scheme for Airline +" Author: morhetz +" Source: https://github.com/morhetz/gruvbox +" Last Modified: 22 Aug 2014 +" ----------------------------------------------------------------------------- + +let g:airline#themes#gruvbox#palette = {} + +function! airline#themes#gruvbox#refresh() + + let M0 = airline#themes#get_highlight('Identifier') + let accents_group = airline#themes#get_highlight('Special') + let modified_group = [M0[0], '', M0[2], '', ''] + let warning_group = airline#themes#get_highlight2(['Normal', 'bg'], ['Question', 'fg']) + let error_group = airline#themes#get_highlight2(['Normal', 'bg'], ['WarningMsg', 'fg']) + + let s:N1 = airline#themes#get_highlight2(['Normal', 'bg'], ['StatusLineNC', 'bg']) + let s:N2 = airline#themes#get_highlight2(['StatusLineNC', 'bg'], ['StatusLineNC', 'fg']) + let s:N3 = airline#themes#get_highlight2(['StatusLineNC', 'bg'], ['CursorLine', 'bg']) + let g:airline#themes#gruvbox#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) + let g:airline#themes#gruvbox#palette.normal_modified = { 'airline_c': modified_group } + let g:airline#themes#gruvbox#palette.normal.airline_warning = warning_group + let g:airline#themes#gruvbox#palette.normal_modified.airline_warning = warning_group + let g:airline#themes#gruvbox#palette.normal.airline_error = error_group + let g:airline#themes#gruvbox#palette.normal_modified.airline_error = error_group + + let s:I1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Identifier', 'fg']) + let s:I2 = s:N2 + let s:I3 = airline#themes#get_highlight2(['Normal', 'fg'], ['StatusLineNC', 'fg']) + let g:airline#themes#gruvbox#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) + let g:airline#themes#gruvbox#palette.insert_modified = g:airline#themes#gruvbox#palette.normal_modified + let g:airline#themes#gruvbox#palette.insert.airline_warning = g:airline#themes#gruvbox#palette.normal.airline_warning + let g:airline#themes#gruvbox#palette.insert_modified.airline_warning = g:airline#themes#gruvbox#palette.normal_modified.airline_warning + let g:airline#themes#gruvbox#palette.insert.airline_error = g:airline#themes#gruvbox#palette.normal.airline_error + let g:airline#themes#gruvbox#palette.insert_modified.airline_error = g:airline#themes#gruvbox#palette.normal_modified.airline_error + + let s:R1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Structure', 'fg']) + let s:R2 = s:I2 + let s:R3 = s:I3 + let g:airline#themes#gruvbox#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) + let g:airline#themes#gruvbox#palette.replace_modified = g:airline#themes#gruvbox#palette.normal_modified + let g:airline#themes#gruvbox#palette.replace.airline_warning = g:airline#themes#gruvbox#palette.normal.airline_warning + let g:airline#themes#gruvbox#palette.replace_modified.airline_warning = g:airline#themes#gruvbox#palette.normal_modified.airline_warning + let g:airline#themes#gruvbox#palette.replace.airline_error = g:airline#themes#gruvbox#palette.normal.airline_error + let g:airline#themes#gruvbox#palette.replace_modified.airline_error = g:airline#themes#gruvbox#palette.normal_modified.airline_error + + let s:V1 = airline#themes#get_highlight2(['Normal', 'bg'], ['ModeMsg', 'fg']) + let s:V2 = s:N2 + let s:V3 = airline#themes#get_highlight2(['Normal', 'bg'], ['TabLine', 'fg']) + let g:airline#themes#gruvbox#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) + let g:airline#themes#gruvbox#palette.visual_modified = { 'airline_c': [ s:V3[0], '', s:V3[2], '', '' ] } + let g:airline#themes#gruvbox#palette.visual.airline_warning = g:airline#themes#gruvbox#palette.normal.airline_warning + let g:airline#themes#gruvbox#palette.visual_modified.airline_warning = g:airline#themes#gruvbox#palette.normal_modified.airline_warning + let g:airline#themes#gruvbox#palette.visual.airline_error = g:airline#themes#gruvbox#palette.normal.airline_error + let g:airline#themes#gruvbox#palette.visual_modified.airline_error = g:airline#themes#gruvbox#palette.normal_modified.airline_error + + let s:IA = airline#themes#get_highlight2(['TabLine', 'fg'], ['CursorLine', 'bg']) + let g:airline#themes#gruvbox#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) + let g:airline#themes#gruvbox#palette.inactive_modified = { 'airline_c': modified_group } + + let g:airline#themes#gruvbox#palette.accents = { 'red': accents_group } + + let s:TF = airline#themes#get_highlight2(['Normal', 'bg'], ['Normal', 'bg']) + let g:airline#themes#gruvbox#palette.tabline = { + \ 'airline_tab': s:N2, + \ 'airline_tabsel': s:N1, + \ 'airline_tabtype': s:V1, + \ 'airline_tabfill': s:TF, + \ 'airline_tabhid': s:IA, + \ 'airline_tabmod': s:I1 + \ } + +endfunction + +call airline#themes#gruvbox#refresh() + +" vim: set sw=2 ts=2 sts=2 et tw=80 ft=vim fdm=marker: diff --git a/sources_non_forked/gruvbox/autoload/gruvbox.vim b/sources_non_forked/gruvbox/autoload/gruvbox.vim new file mode 100644 index 00000000..44bec6e1 --- /dev/null +++ b/sources_non_forked/gruvbox/autoload/gruvbox.vim @@ -0,0 +1,41 @@ +" ----------------------------------------------------------------------------- +" File: gruvbox.vim +" Description: Retro groove color scheme for Vim +" Author: morhetz +" Source: https://github.com/morhetz/gruvbox +" Last Modified: 09 Apr 2014 +" ----------------------------------------------------------------------------- + +function! gruvbox#invert_signs_toggle() + if g:gruvbox_invert_signs == 0 + let g:gruvbox_invert_signs=1 + else + let g:gruvbox_invert_signs=0 + endif + + colorscheme gruvbox +endfunction + +" Search Highlighting {{{ + +function! gruvbox#hls_show() + set hlsearch + call GruvboxHlsShowCursor() +endfunction + +function! gruvbox#hls_hide() + set nohlsearch + call GruvboxHlsHideCursor() +endfunction + +function! gruvbox#hls_toggle() + if &hlsearch + call gruvbox#hls_hide() + else + call gruvbox#hls_show() + endif +endfunction + +" }}} + +" vim: set sw=2 ts=2 sts=2 et tw=80 ft=vim fdm=marker: diff --git a/sources_non_forked/gruvbox/autoload/lightline/colorscheme/gruvbox.vim b/sources_non_forked/gruvbox/autoload/lightline/colorscheme/gruvbox.vim new file mode 100644 index 00000000..78babce5 --- /dev/null +++ b/sources_non_forked/gruvbox/autoload/lightline/colorscheme/gruvbox.vim @@ -0,0 +1,53 @@ +" ----------------------------------------------------------------------------- +" File: gruvbox.vim +" Description: Gruvbox colorscheme for Lightline (itchyny/lightline.vim) +" Author: gmoe +" Source: https://github.com/morhetz/gruvbox +" Last Modified: 31 Oct 2015 +" ----------------------------------------------------------------------------- + +function! s:getGruvColor(group) + let guiColor = synIDattr(hlID(a:group), "fg", "gui") + let termColor = synIDattr(hlID(a:group), "fg", "cterm") + return [ guiColor, termColor ] +endfunction + +if exists('g:lightline') + + let s:bg0 = s:getGruvColor('GruvboxBg0') + let s:bg1 = s:getGruvColor('GruvboxBg1') + let s:bg2 = s:getGruvColor('GruvboxBg2') + let s:bg4 = s:getGruvColor('GruvboxBg4') + let s:fg1 = s:getGruvColor('GruvboxFg1') + let s:fg4 = s:getGruvColor('GruvboxFg4') + + let s:yellow = s:getGruvColor('GruvboxYellow') + let s:blue = s:getGruvColor('GruvboxBlue') + let s:aqua = s:getGruvColor('GruvboxAqua') + let s:orange = s:getGruvColor('GruvboxOrange') + + let s:p = {'normal':{}, 'inactive':{}, 'insert':{}, 'replace':{}, 'visual':{}, 'tabline':{}} + let s:p.normal.left = [ [ s:bg0, s:fg4 ], [ s:fg4, s:bg2 ] ] + let s:p.normal.right = [ [ s:bg0, s:fg4 ], [ s:fg4, s:bg2 ] ] + let s:p.normal.middle = [ [ s:fg4, s:bg1 ] ] + let s:p.inactive.right = [ [ s:bg4, s:bg1 ], [ s:bg4, s:bg1 ] ] + let s:p.inactive.left = [ [ s:bg4, s:bg1 ], [ s:bg4, s:bg1 ] ] + let s:p.inactive.middle = [ [ s:bg4, s:bg1 ] ] + let s:p.insert.left = [ [ s:bg0, s:blue ], [ s:fg1, s:bg2 ] ] + let s:p.insert.right = [ [ s:bg0, s:blue ], [ s:fg1, s:bg2 ] ] + let s:p.insert.middle = [ [ s:fg4, s:bg2 ] ] + let s:p.replace.left = [ [ s:bg0, s:aqua ], [ s:fg1, s:bg2 ] ] + let s:p.replace.right = [ [ s:bg0, s:aqua ], [ s:fg1, s:bg2 ] ] + let s:p.replace.middle = [ [ s:fg4, s:bg2 ] ] + let s:p.visual.left = [ [ s:bg0, s:orange ], [ s:bg0, s:bg4 ] ] + let s:p.visual.right = [ [ s:bg0, s:orange ], [ s:bg0, s:bg4 ] ] + let s:p.visual.middle = [ [ s:fg4, s:bg1 ] ] + let s:p.tabline.left = [ [ s:fg4, s:bg2 ] ] + let s:p.tabline.tabsel = [ [ s:bg0, s:fg4 ] ] + let s:p.tabline.middle = [ [ s:bg0, s:bg0 ] ] + let s:p.tabline.right = [ [ s:bg0, s:orange ] ] + let s:p.normal.error = [ [ s:bg0, s:orange ] ] + let s:p.normal.warning = [ [ s:bg2, s:yellow ] ] + + let g:lightline#colorscheme#gruvbox#palette = lightline#colorscheme#flatten(s:p) +endif diff --git a/sources_non_forked/gruvbox/colors/gruvbox.vim b/sources_non_forked/gruvbox/colors/gruvbox.vim new file mode 100644 index 00000000..ebc9efff --- /dev/null +++ b/sources_non_forked/gruvbox/colors/gruvbox.vim @@ -0,0 +1,1239 @@ +" ----------------------------------------------------------------------------- +" File: gruvbox.vim +" Description: Retro groove color scheme for Vim +" Author: morhetz +" Source: https://github.com/morhetz/gruvbox +" Last Modified: 04 Sep 2015 +" ----------------------------------------------------------------------------- + +" Supporting code ------------------------------------------------------------- +" Initialisation: {{{ + +if version > 580 + hi clear + if exists("syntax_on") + syntax reset + endif +endif + +let g:colors_name='gruvbox' + +if !has('gui_running') && &t_Co != 256 + finish +endif + +" }}} +" Global Settings: {{{ + +if !exists('g:gruvbox_bold') + let g:gruvbox_bold=1 +endif +if !exists('g:gruvbox_italic') + if has('gui_running') || $TERM_ITALICS == 'true' + let g:gruvbox_italic=1 + else + let g:gruvbox_italic=0 + endif +endif +if !exists('g:gruvbox_undercurl') + let g:gruvbox_undercurl=1 +endif +if !exists('g:gruvbox_underline') + let g:gruvbox_underline=1 +endif +if !exists('g:gruvbox_inverse') + let g:gruvbox_inverse=1 +endif + +if !exists('g:gruvbox_guisp_fallback') || index(['fg', 'bg'], g:gruvbox_guisp_fallback) == -1 + let g:gruvbox_guisp_fallback='NONE' +endif + +if !exists('g:gruvbox_improved_strings') + let g:gruvbox_improved_strings=0 +endif + +if !exists('g:gruvbox_improved_warnings') + let g:gruvbox_improved_warnings=0 +endif + +if !exists('g:gruvbox_termcolors') + let g:gruvbox_termcolors=256 +endif + +if !exists('g:gruvbox_invert_indent_guides') + let g:gruvbox_invert_indent_guides=0 +endif + +if exists('g:gruvbox_contrast') + echo 'g:gruvbox_contrast is deprecated; use g:gruvbox_contrast_light and g:gruvbox_contrast_dark instead' +endif + +if !exists('g:gruvbox_contrast_dark') + let g:gruvbox_contrast_dark='medium' +endif + +if !exists('g:gruvbox_contrast_light') + let g:gruvbox_contrast_light='medium' +endif + +let s:is_dark=(&background == 'dark') + +" }}} +" Palette: {{{ + +" setup palette dictionary +let s:gb = {} + +" fill it with absolute colors +let s:gb.dark0_hard = ['#1d2021', 234] " 29-32-33 +let s:gb.dark0 = ['#282828', 235] " 40-40-40 +let s:gb.dark0_soft = ['#32302f', 236] " 50-48-47 +let s:gb.dark1 = ['#3c3836', 237] " 60-56-54 +let s:gb.dark2 = ['#504945', 239] " 80-73-69 +let s:gb.dark3 = ['#665c54', 241] " 102-92-84 +let s:gb.dark4 = ['#7c6f64', 243] " 124-111-100 +let s:gb.dark4_256 = ['#7c6f64', 243] " 124-111-100 + +let s:gb.gray_245 = ['#928374', 245] " 146-131-116 +let s:gb.gray_244 = ['#928374', 244] " 146-131-116 + +let s:gb.light0_hard = ['#f9f5d7', 230] " 249-245-215 +let s:gb.light0 = ['#fbf1c7', 229] " 253-244-193 +let s:gb.light0_soft = ['#f2e5bc', 228] " 242-229-188 +let s:gb.light1 = ['#ebdbb2', 223] " 235-219-178 +let s:gb.light2 = ['#d5c4a1', 250] " 213-196-161 +let s:gb.light3 = ['#bdae93', 248] " 189-174-147 +let s:gb.light4 = ['#a89984', 246] " 168-153-132 +let s:gb.light4_256 = ['#a89984', 246] " 168-153-132 + +let s:gb.bright_red = ['#fb4934', 167] " 251-73-52 +let s:gb.bright_green = ['#b8bb26', 142] " 184-187-38 +let s:gb.bright_yellow = ['#fabd2f', 214] " 250-189-47 +let s:gb.bright_blue = ['#83a598', 109] " 131-165-152 +let s:gb.bright_purple = ['#d3869b', 175] " 211-134-155 +let s:gb.bright_aqua = ['#8ec07c', 108] " 142-192-124 +let s:gb.bright_orange = ['#fe8019', 208] " 254-128-25 + +let s:gb.neutral_red = ['#cc241d', 124] " 204-36-29 +let s:gb.neutral_green = ['#98971a', 106] " 152-151-26 +let s:gb.neutral_yellow = ['#d79921', 172] " 215-153-33 +let s:gb.neutral_blue = ['#458588', 66] " 69-133-136 +let s:gb.neutral_purple = ['#b16286', 132] " 177-98-134 +let s:gb.neutral_aqua = ['#689d6a', 72] " 104-157-106 +let s:gb.neutral_orange = ['#d65d0e', 166] " 214-93-14 + +let s:gb.faded_red = ['#9d0006', 88] " 157-0-6 +let s:gb.faded_green = ['#79740e', 100] " 121-116-14 +let s:gb.faded_yellow = ['#b57614', 136] " 181-118-20 +let s:gb.faded_blue = ['#076678', 24] " 7-102-120 +let s:gb.faded_purple = ['#8f3f71', 96] " 143-63-113 +let s:gb.faded_aqua = ['#427b58', 66] " 66-123-88 +let s:gb.faded_orange = ['#af3a03', 130] " 175-58-3 + +" }}} +" Setup Emphasis: {{{ + +let s:bold = 'bold,' +if g:gruvbox_bold == 0 + let s:bold = '' +endif + +let s:italic = 'italic,' +if g:gruvbox_italic == 0 + let s:italic = '' +endif + +let s:underline = 'underline,' +if g:gruvbox_underline == 0 + let s:underline = '' +endif + +let s:undercurl = 'undercurl,' +if g:gruvbox_undercurl == 0 + let s:undercurl = '' +endif + +let s:inverse = 'inverse,' +if g:gruvbox_inverse == 0 + let s:inverse = '' +endif + +" }}} +" Setup Colors: {{{ + +let s:vim_bg = ['bg', 'bg'] +let s:vim_fg = ['fg', 'fg'] +let s:none = ['NONE', 'NONE'] + +" determine relative colors +if s:is_dark + let s:bg0 = s:gb.dark0 + if g:gruvbox_contrast_dark == 'soft' + let s:bg0 = s:gb.dark0_soft + elseif g:gruvbox_contrast_dark == 'hard' + let s:bg0 = s:gb.dark0_hard + endif + + let s:bg1 = s:gb.dark1 + let s:bg2 = s:gb.dark2 + let s:bg3 = s:gb.dark3 + let s:bg4 = s:gb.dark4 + + let s:gray = s:gb.gray_245 + + let s:fg0 = s:gb.light0 + let s:fg1 = s:gb.light1 + let s:fg2 = s:gb.light2 + let s:fg3 = s:gb.light3 + let s:fg4 = s:gb.light4 + + let s:fg4_256 = s:gb.light4_256 + + let s:red = s:gb.bright_red + let s:green = s:gb.bright_green + let s:yellow = s:gb.bright_yellow + let s:blue = s:gb.bright_blue + let s:purple = s:gb.bright_purple + let s:aqua = s:gb.bright_aqua + let s:orange = s:gb.bright_orange +else + let s:bg0 = s:gb.light0 + if g:gruvbox_contrast_light == 'soft' + let s:bg0 = s:gb.light0_soft + elseif g:gruvbox_contrast_light == 'hard' + let s:bg0 = s:gb.light0_hard + endif + + let s:bg1 = s:gb.light1 + let s:bg2 = s:gb.light2 + let s:bg3 = s:gb.light3 + let s:bg4 = s:gb.light4 + + let s:gray = s:gb.gray_244 + + let s:fg0 = s:gb.dark0 + let s:fg1 = s:gb.dark1 + let s:fg2 = s:gb.dark2 + let s:fg3 = s:gb.dark3 + let s:fg4 = s:gb.dark4 + + let s:fg4_256 = s:gb.dark4_256 + + let s:red = s:gb.faded_red + let s:green = s:gb.faded_green + let s:yellow = s:gb.faded_yellow + let s:blue = s:gb.faded_blue + let s:purple = s:gb.faded_purple + let s:aqua = s:gb.faded_aqua + let s:orange = s:gb.faded_orange +endif + +" reset to 16 colors fallback +if g:gruvbox_termcolors == 16 + let s:bg0[1] = 0 + let s:fg4[1] = 7 + let s:gray[1] = 8 + let s:red[1] = 9 + let s:green[1] = 10 + let s:yellow[1] = 11 + let s:blue[1] = 12 + let s:purple[1] = 13 + let s:aqua[1] = 14 + let s:fg1[1] = 15 +endif + +" save current relative colors back to palette dictionary +let s:gb.bg0 = s:bg0 +let s:gb.bg1 = s:bg1 +let s:gb.bg2 = s:bg2 +let s:gb.bg3 = s:bg3 +let s:gb.bg4 = s:bg4 + +let s:gb.gray = s:gray + +let s:gb.fg0 = s:fg0 +let s:gb.fg1 = s:fg1 +let s:gb.fg2 = s:fg2 +let s:gb.fg3 = s:fg3 +let s:gb.fg4 = s:fg4 + +let s:gb.fg4_256 = s:fg4_256 + +let s:gb.red = s:red +let s:gb.green = s:green +let s:gb.yellow = s:yellow +let s:gb.blue = s:blue +let s:gb.purple = s:purple +let s:gb.aqua = s:aqua +let s:gb.orange = s:orange + +" }}} + +" Overload Setting: {{{ + +let s:hls_cursor = s:orange +if exists('g:gruvbox_hls_cursor') + let s:hls_cursor = get(s:gb, g:gruvbox_hls_cursor) +endif + +let s:number_column = s:none +if exists('g:gruvbox_number_column') + let s:number_column = get(s:gb, g:gruvbox_number_column) +endif + +let s:sign_column = s:bg1 + +if exists('g:gitgutter_override_sign_column_highlight') && + \ g:gitgutter_override_sign_column_highlight == 1 + let s:sign_column = s:number_column +else + let g:gitgutter_override_sign_column_highlight = 0 + + if exists('g:gruvbox_sign_column') + let s:sign_column = get(s:gb, g:gruvbox_sign_column) + endif +endif + +let s:color_column = s:bg1 +if exists('g:gruvbox_color_column') + let s:color_column = get(s:gb, g:gruvbox_color_column) +endif + +let s:vert_split = s:bg2 +if exists('g:gruvbox_vert_split') + let s:vert_split = get(s:gb, g:gruvbox_vert_split) +endif + +let s:invert_signs = '' +if exists('g:gruvbox_invert_signs') + if g:gruvbox_invert_signs == 1 + let s:invert_signs = s:inverse + endif +endif + +let s:invert_selection = s:inverse +if exists('g:gruvbox_invert_selection') + if g:gruvbox_invert_selection == 0 + let s:invert_selection = '' + endif +endif + +let s:invert_tabline = '' +if exists('g:gruvbox_invert_tabline') + if g:gruvbox_invert_tabline == 1 + let s:invert_tabline = s:inverse + endif +endif + +let s:italicize_comments = s:italic +if exists('g:gruvbox_italicize_comments') + if g:gruvbox_italicize_comments == 0 + let s:italicize_comments = '' + endif +endif + +let s:italicize_strings = '' +if exists('g:gruvbox_italicize_strings') + if g:gruvbox_italicize_strings == 1 + let s:italicize_strings = s:italic + endif +endif + +" }}} +" Highlighting Function: {{{ + +function! s:HL(group, fg, ...) + " Arguments: group, guifg, guibg, gui, guisp + + " foreground + let fg = a:fg + + " background + if a:0 >= 1 + let bg = a:1 + else + let bg = s:none + endif + + " emphasis + if a:0 >= 2 && strlen(a:2) + let emstr = a:2 + else + let emstr = 'NONE,' + endif + + " special fallback + if a:0 >= 3 + if g:gruvbox_guisp_fallback != 'NONE' + let fg = a:3 + endif + + " bg fallback mode should invert higlighting + if g:gruvbox_guisp_fallback == 'bg' + let emstr .= 'inverse,' + endif + endif + + let histring = [ 'hi', a:group, + \ 'guifg=' . fg[0], 'ctermfg=' . fg[1], + \ 'guibg=' . bg[0], 'ctermbg=' . bg[1], + \ 'gui=' . emstr[:-2], 'cterm=' . emstr[:-2] + \ ] + + " special + if a:0 >= 3 + call add(histring, 'guisp=' . a:3[0]) + endif + + execute join(histring, ' ') +endfunction + +" }}} +" Gruvbox Hi Groups: {{{ + +" memoize common hi groups +call s:HL('GruvboxFg0', s:fg0) +call s:HL('GruvboxFg1', s:fg1) +call s:HL('GruvboxFg2', s:fg2) +call s:HL('GruvboxFg3', s:fg3) +call s:HL('GruvboxFg4', s:fg4) +call s:HL('GruvboxGray', s:gray) +call s:HL('GruvboxBg0', s:bg0) +call s:HL('GruvboxBg1', s:bg1) +call s:HL('GruvboxBg2', s:bg2) +call s:HL('GruvboxBg3', s:bg3) +call s:HL('GruvboxBg4', s:bg4) + +call s:HL('GruvboxRed', s:red) +call s:HL('GruvboxRedBold', s:red, s:none, s:bold) +call s:HL('GruvboxGreen', s:green) +call s:HL('GruvboxGreenBold', s:green, s:none, s:bold) +call s:HL('GruvboxYellow', s:yellow) +call s:HL('GruvboxYellowBold', s:yellow, s:none, s:bold) +call s:HL('GruvboxBlue', s:blue) +call s:HL('GruvboxBlueBold', s:blue, s:none, s:bold) +call s:HL('GruvboxPurple', s:purple) +call s:HL('GruvboxPurpleBold', s:purple, s:none, s:bold) +call s:HL('GruvboxAqua', s:aqua) +call s:HL('GruvboxAquaBold', s:aqua, s:none, s:bold) +call s:HL('GruvboxOrange', s:orange) +call s:HL('GruvboxOrangeBold', s:orange, s:none, s:bold) + +call s:HL('GruvboxRedSign', s:red, s:sign_column, s:invert_signs) +call s:HL('GruvboxGreenSign', s:green, s:sign_column, s:invert_signs) +call s:HL('GruvboxYellowSign', s:yellow, s:sign_column, s:invert_signs) +call s:HL('GruvboxBlueSign', s:blue, s:sign_column, s:invert_signs) +call s:HL('GruvboxPurpleSign', s:purple, s:sign_column, s:invert_signs) +call s:HL('GruvboxAquaSign', s:aqua, s:sign_column, s:invert_signs) + +" }}} + +" Vanilla colorscheme --------------------------------------------------------- +" General UI: {{{ + +" Normal text +call s:HL('Normal', s:fg1, s:bg0) + +" Correct background (see issue #7): +" --- Problem with changing between dark and light on 256 color terminal +" --- https://github.com/morhetz/gruvbox/issues/7 +if s:is_dark + set background=dark +else + set background=light +endif + +if version >= 700 + " Screen line that the cursor is + call s:HL('CursorLine', s:none, s:bg1) + " Screen column that the cursor is + hi! link CursorColumn CursorLine + + " Tab pages line filler + call s:HL('TabLineFill', s:bg4, s:vim_bg, s:invert_tabline) + " Active tab page label + call s:HL('TabLineSel', s:vim_bg, s:bg4, s:bold . s:invert_tabline) + " Not active tab page label + hi! link TabLine TabLineFill + + " Match paired bracket under the cursor + call s:HL('MatchParen', s:none, s:bg3, s:bold) +endif + +if version >= 703 + " Highlighted screen columns + call s:HL('ColorColumn', s:none, s:color_column) + + " Concealed element: \lambda → λ + call s:HL('Conceal', s:blue, s:none) + + " Line number of CursorLine + call s:HL('CursorLineNr', s:yellow, s:bg1) +endif + +hi! link NonText GruvboxBg2 +hi! link SpecialKey GruvboxBg2 + +call s:HL('Visual', s:none, s:bg3, s:invert_selection) +hi! link VisualNOS Visual + +call s:HL('Search', s:yellow, s:bg0, s:inverse) +call s:HL('IncSearch', s:hls_cursor, s:bg0, s:inverse) + +call s:HL('Underlined', s:blue, s:none, s:underline) + +call s:HL('StatusLine', s:bg4, s:bg0, s:bold . s:inverse) +call s:HL('StatusLineNC', s:bg2, s:fg4, s:bold . s:inverse) + +" The column separating vertically split windows +call s:HL('VertSplit', s:fg4, s:vert_split) + +" Current match in wildmenu completion +call s:HL('WildMenu', s:blue, s:bg2, s:bold) + +" Directory names, special names in listing +hi! link Directory GruvboxGreenBold + +" Titles for output from :set all, :autocmd, etc. +hi! link Title GruvboxGreenBold + +" Error messages on the command line +call s:HL('ErrorMsg', s:bg0, s:red, s:bold) +" More prompt: -- More -- +hi! link MoreMsg GruvboxYellowBold +" Current mode message: -- INSERT -- +hi! link ModeMsg GruvboxYellowBold +" 'Press enter' prompt and yes/no questions +hi! link Question GruvboxOrangeBold +" Warning messages +hi! link WarningMsg GruvboxRedBold + +" }}} +" Gutter: {{{ + +" Line number for :number and :# commands +call s:HL('LineNr', s:bg4, s:number_column) + +" Column where signs are displayed +call s:HL('SignColumn', s:none, s:sign_column) + +" Line used for closed folds +call s:HL('Folded', s:gray, s:bg1, s:italic) +" Column where folds are displayed +call s:HL('FoldColumn', s:gray, s:bg1) + +" }}} +" Cursor: {{{ + +" Character under cursor +call s:HL('Cursor', s:none, s:none, s:inverse) +" Visual mode cursor, selection +hi! link vCursor Cursor +" Input moder cursor +hi! link iCursor Cursor +" Language mapping cursor +hi! link lCursor Cursor + +" }}} +" Syntax Highlighting: {{{ + +if g:gruvbox_improved_strings == 0 + hi! link Special GruvboxOrange +else + call s:HL('Special', s:bg1, s:orange, s:italic) +endif + +call s:HL('Comment', s:gray, s:none, s:italicize_comments) +call s:HL('Todo', s:vim_fg, s:vim_bg, s:bold . s:italic) +call s:HL('Error', s:red, s:vim_bg, s:bold . s:inverse) + +" Generic statement +hi! link Statement GruvboxRed +" if, then, else, endif, swicth, etc. +hi! link Conditional GruvboxRed +" for, do, while, etc. +hi! link Repeat GruvboxRed +" case, default, etc. +hi! link Label GruvboxRed +" try, catch, throw +hi! link Exception GruvboxRed +" sizeof, "+", "*", etc. +hi! link Operator Normal +" Any other keyword +hi! link Keyword GruvboxRed + +" Variable name +hi! link Identifier GruvboxBlue +" Function name +hi! link Function GruvboxGreenBold + +" Generic preprocessor +hi! link PreProc GruvboxAqua +" Preprocessor #include +hi! link Include GruvboxAqua +" Preprocessor #define +hi! link Define GruvboxAqua +" Same as Define +hi! link Macro GruvboxAqua +" Preprocessor #if, #else, #endif, etc. +hi! link PreCondit GruvboxAqua + +" Generic constant +hi! link Constant GruvboxPurple +" Character constant: 'c', '/n' +hi! link Character GruvboxPurple +" String constant: "this is a string" +if g:gruvbox_improved_strings == 0 + call s:HL('String', s:green, s:none, s:italicize_strings) +else + call s:HL('String', s:bg1, s:fg1, s:italicize_strings) +endif +" Boolean constant: TRUE, false +hi! link Boolean GruvboxPurple +" Number constant: 234, 0xff +hi! link Number GruvboxPurple +" Floating point constant: 2.3e10 +hi! link Float GruvboxPurple + +" Generic type +hi! link Type GruvboxYellow +" static, register, volatile, etc +hi! link StorageClass GruvboxOrange +" struct, union, enum, etc. +hi! link Structure GruvboxAqua +" typedef +hi! link Typedef GruvboxYellow + +" }}} +" Completion Menu: {{{ + +if version >= 700 + " Popup menu: normal item + call s:HL('Pmenu', s:fg1, s:bg2) + " Popup menu: selected item + call s:HL('PmenuSel', s:bg2, s:blue, s:bold) + " Popup menu: scrollbar + call s:HL('PmenuSbar', s:none, s:bg2) + " Popup menu: scrollbar thumb + call s:HL('PmenuThumb', s:none, s:bg4) +endif + +" }}} +" Diffs: {{{ + +call s:HL('DiffDelete', s:red, s:bg0, s:inverse) +call s:HL('DiffAdd', s:green, s:bg0, s:inverse) +"call s:HL('DiffChange', s:bg0, s:blue) +"call s:HL('DiffText', s:bg0, s:yellow) + +" Alternative setting +call s:HL('DiffChange', s:aqua, s:bg0, s:inverse) +call s:HL('DiffText', s:yellow, s:bg0, s:inverse) + +" }}} +" Spelling: {{{ + +if has("spell") + " Not capitalised word, or compile warnings + if g:gruvbox_improved_warnings == 0 + call s:HL('SpellCap', s:none, s:none, s:undercurl, s:red) + else + call s:HL('SpellCap', s:green, s:none, s:bold . s:italic) + endif + " Not recognized word + call s:HL('SpellBad', s:none, s:none, s:undercurl, s:blue) + " Wrong spelling for selected region + call s:HL('SpellLocal', s:none, s:none, s:undercurl, s:aqua) + " Rare word + call s:HL('SpellRare', s:none, s:none, s:undercurl, s:purple) +endif + +" }}} + +" Plugin specific ------------------------------------------------------------- +" EasyMotion: {{{ + +hi! link EasyMotionTarget Search +hi! link EasyMotionShade Comment + +" }}} +" Sneak: {{{ + +hi! link SneakPluginTarget Search +hi! link SneakStreakTarget Search +call s:HL('SneakStreakMask', s:yellow, s:yellow) +hi! link SneakStreakStatusLine Search + +" }}} +" Indent Guides: {{{ + +if !exists('g:indent_guides_auto_colors') + let g:indent_guides_auto_colors = 0 +endif + +if g:indent_guides_auto_colors == 0 + if g:gruvbox_invert_indent_guides == 0 + call s:HL('IndentGuidesOdd', s:vim_bg, s:bg2) + call s:HL('IndentGuidesEven', s:vim_bg, s:bg1) + else + call s:HL('IndentGuidesOdd', s:vim_bg, s:bg2, s:inverse) + call s:HL('IndentGuidesEven', s:vim_bg, s:bg3, s:inverse) + endif +endif + +" }}} +" IndentLine: {{{ + +if !exists('g:indentLine_color_term') + let g:indentLine_color_term = s:bg2[1] +endif +if !exists('g:indentLine_color_gui') + let g:indentLine_color_gui = s:bg2[0] +endif + +" }}} +" Rainbow Parentheses: {{{ + +if !exists('g:rbpt_colorpairs') + let g:rbpt_colorpairs = + \ [ + \ ['blue', '#458588'], ['magenta', '#b16286'], + \ ['red', '#cc241d'], ['166', '#d65d0e'] + \ ] +endif + +let g:rainbow_guifgs = [ '#d65d0e', '#cc241d', '#b16286', '#458588' ] +let g:rainbow_ctermfgs = [ '166', 'red', 'magenta', 'blue' ] + +if !exists('g:rainbow_conf') + let g:rainbow_conf = {} +endif +if !has_key(g:rainbow_conf, 'guifgs') + let g:rainbow_conf['guifgs'] = g:rainbow_guifgs +endif +if !has_key(g:rainbow_conf, 'ctermfgs') + let g:rainbow_conf['ctermfgs'] = g:rainbow_ctermfgs +endif + +let g:niji_dark_colours = g:rbpt_colorpairs +let g:niji_light_colours = g:rbpt_colorpairs + +"}}} +" GitGutter: {{{ + +hi! link GitGutterAdd GruvboxGreenSign +hi! link GitGutterChange GruvboxAquaSign +hi! link GitGutterDelete GruvboxRedSign +hi! link GitGutterChangeDelete GruvboxAquaSign + +" }}} +" GitCommit: "{{{ + +hi! link gitcommitSelectedFile GruvboxGreen +hi! link gitcommitDiscardedFile GruvboxRed + +" }}} +" Signify: {{{ + +hi! link SignifySignAdd GruvboxGreenSign +hi! link SignifySignChange GruvboxAquaSign +hi! link SignifySignDelete GruvboxRedSign + +" }}} +" Syntastic: {{{ + +call s:HL('SyntasticError', s:none, s:none, s:undercurl, s:red) +call s:HL('SyntasticWarning', s:none, s:none, s:undercurl, s:yellow) + +hi! link SyntasticErrorSign GruvboxRedSign +hi! link SyntasticWarningSign GruvboxYellowSign + +" }}} +" Signature: {{{ +hi! link SignatureMarkText GruvboxBlueSign +hi! link SignatureMarkerText GruvboxPurpleSign + +" }}} +" ShowMarks: {{{ + +hi! link ShowMarksHLl GruvboxBlueSign +hi! link ShowMarksHLu GruvboxBlueSign +hi! link ShowMarksHLo GruvboxBlueSign +hi! link ShowMarksHLm GruvboxBlueSign + +" }}} +" CtrlP: {{{ + +hi! link CtrlPMatch GruvboxYellow +hi! link CtrlPNoEntries GruvboxRed +hi! link CtrlPPrtBase GruvboxBg2 +hi! link CtrlPPrtCursor GruvboxBlue +hi! link CtrlPLinePre GruvboxBg2 + +call s:HL('CtrlPMode1', s:blue, s:bg2, s:bold) +call s:HL('CtrlPMode2', s:bg0, s:blue, s:bold) +call s:HL('CtrlPStats', s:fg4, s:bg2, s:bold) + +" }}} +" Startify: {{{ + +hi! link StartifyBracket GruvboxFg3 +hi! link StartifyFile GruvboxFg0 +hi! link StartifyNumber GruvboxBlue +hi! link StartifyPath GruvboxGray +hi! link StartifySlash GruvboxGray +hi! link StartifySection GruvboxYellow +hi! link StartifySpecial GruvboxBg2 +hi! link StartifyHeader GruvboxOrange +hi! link StartifyFooter GruvboxBg2 + +" }}} +" Vimshell: {{{ + +let g:vimshell_escape_colors = [ + \ s:bg4[0], s:red[0], s:green[0], s:yellow[0], + \ s:blue[0], s:purple[0], s:aqua[0], s:fg4[0], + \ s:bg0[0], s:red[0], s:green[0], s:orange[0], + \ s:blue[0], s:purple[0], s:aqua[0], s:fg0[0] + \ ] + +" }}} +" BufTabLine: {{{ + +call s:HL('BufTabLineCurrent', s:bg0, s:fg4) +call s:HL('BufTabLineActive', s:fg4, s:bg2) +call s:HL('BufTabLineHidden', s:bg4, s:bg1) +call s:HL('BufTabLineFill', s:bg0, s:bg0) + +" }}} + +" Filetype specific ----------------------------------------------------------- +" Diff: {{{ + +hi! link diffAdded GruvboxGreen +hi! link diffRemoved GruvboxRed +hi! link diffChanged GruvboxAqua + +hi! link diffFile GruvboxOrange +hi! link diffNewFile GruvboxYellow + +hi! link diffLine GruvboxBlue + +" }}} +" Html: {{{ + +hi! link htmlTag GruvboxBlue +hi! link htmlEndTag GruvboxBlue + +hi! link htmlTagName GruvboxAquaBold +hi! link htmlArg GruvboxAqua + +hi! link htmlScriptTag GruvboxPurple +hi! link htmlTagN GruvboxFg1 +hi! link htmlSpecialTagName GruvboxAquaBold + +call s:HL('htmlLink', s:fg4, s:none, s:underline) + +hi! link htmlSpecialChar GruvboxOrange + +call s:HL('htmlBold', s:vim_fg, s:vim_bg, s:bold) +call s:HL('htmlBoldUnderline', s:vim_fg, s:vim_bg, s:bold . s:underline) +call s:HL('htmlBoldItalic', s:vim_fg, s:vim_bg, s:bold . s:italic) +call s:HL('htmlBoldUnderlineItalic', s:vim_fg, s:vim_bg, s:bold . s:underline . s:italic) + +call s:HL('htmlUnderline', s:vim_fg, s:vim_bg, s:underline) +call s:HL('htmlUnderlineItalic', s:vim_fg, s:vim_bg, s:underline . s:italic) +call s:HL('htmlItalic', s:vim_fg, s:vim_bg, s:italic) + +" }}} +" Xml: {{{ + +hi! link xmlTag GruvboxBlue +hi! link xmlEndTag GruvboxBlue +hi! link xmlTagName GruvboxBlue +hi! link xmlEqual GruvboxBlue +hi! link docbkKeyword GruvboxAquaBold + +hi! link xmlDocTypeDecl GruvboxGray +hi! link xmlDocTypeKeyword GruvboxPurple +hi! link xmlCdataStart GruvboxGray +hi! link xmlCdataCdata GruvboxPurple +hi! link dtdFunction GruvboxGray +hi! link dtdTagName GruvboxPurple + +hi! link xmlAttrib GruvboxAqua +hi! link xmlProcessingDelim GruvboxGray +hi! link dtdParamEntityPunct GruvboxGray +hi! link dtdParamEntityDPunct GruvboxGray +hi! link xmlAttribPunct GruvboxGray + +hi! link xmlEntity GruvboxOrange +hi! link xmlEntityPunct GruvboxOrange +" }}} +" Vim: {{{ + +call s:HL('vimCommentTitle', s:fg4_256, s:none, s:bold . s:italicize_comments) + +hi! link vimNotation GruvboxOrange +hi! link vimBracket GruvboxOrange +hi! link vimMapModKey GruvboxOrange +hi! link vimFuncSID GruvboxFg3 +hi! link vimSetSep GruvboxFg3 +hi! link vimSep GruvboxFg3 +hi! link vimContinue GruvboxFg3 + +" }}} +" Clojure: {{{ + +hi! link clojureKeyword GruvboxBlue +hi! link clojureCond GruvboxOrange +hi! link clojureSpecial GruvboxOrange +hi! link clojureDefine GruvboxOrange + +hi! link clojureFunc GruvboxYellow +hi! link clojureRepeat GruvboxYellow +hi! link clojureCharacter GruvboxAqua +hi! link clojureStringEscape GruvboxAqua +hi! link clojureException GruvboxRed + +hi! link clojureRegexp GruvboxAqua +hi! link clojureRegexpEscape GruvboxAqua +call s:HL('clojureRegexpCharClass', s:fg3, s:none, s:bold) +hi! link clojureRegexpMod clojureRegexpCharClass +hi! link clojureRegexpQuantifier clojureRegexpCharClass + +hi! link clojureParen GruvboxFg3 +hi! link clojureAnonArg GruvboxYellow +hi! link clojureVariable GruvboxBlue +hi! link clojureMacro GruvboxOrange + +hi! link clojureMeta GruvboxYellow +hi! link clojureDeref GruvboxYellow +hi! link clojureQuote GruvboxYellow +hi! link clojureUnquote GruvboxYellow + +" }}} +" C: {{{ + +hi! link cOperator GruvboxPurple +hi! link cStructure GruvboxOrange + +" }}} +" Python: {{{ + +hi! link pythonBuiltin GruvboxOrange +hi! link pythonBuiltinObj GruvboxOrange +hi! link pythonBuiltinFunc GruvboxOrange +hi! link pythonFunction GruvboxAqua +hi! link pythonDecorator GruvboxRed +hi! link pythonInclude GruvboxBlue +hi! link pythonImport GruvboxBlue +hi! link pythonRun GruvboxBlue +hi! link pythonCoding GruvboxBlue +hi! link pythonOperator GruvboxRed +hi! link pythonExceptions GruvboxPurple +hi! link pythonBoolean GruvboxPurple +hi! link pythonDot GruvboxFg3 + +" }}} +" CSS: {{{ + +hi! link cssBraces GruvboxBlue +hi! link cssFunctionName GruvboxYellow +hi! link cssIdentifier GruvboxOrange +hi! link cssClassName GruvboxGreen +hi! link cssColor GruvboxBlue +hi! link cssSelectorOp GruvboxBlue +hi! link cssSelectorOp2 GruvboxBlue +hi! link cssImportant GruvboxGreen +hi! link cssVendor GruvboxFg1 + +hi! link cssTextProp GruvboxAqua +hi! link cssAnimationProp GruvboxAqua +hi! link cssUIProp GruvboxYellow +hi! link cssTransformProp GruvboxAqua +hi! link cssTransitionProp GruvboxAqua +hi! link cssPrintProp GruvboxAqua +hi! link cssPositioningProp GruvboxYellow +hi! link cssBoxProp GruvboxAqua +hi! link cssFontDescriptorProp GruvboxAqua +hi! link cssFlexibleBoxProp GruvboxAqua +hi! link cssBorderOutlineProp GruvboxAqua +hi! link cssBackgroundProp GruvboxAqua +hi! link cssMarginProp GruvboxAqua +hi! link cssListProp GruvboxAqua +hi! link cssTableProp GruvboxAqua +hi! link cssFontProp GruvboxAqua +hi! link cssPaddingProp GruvboxAqua +hi! link cssDimensionProp GruvboxAqua +hi! link cssRenderProp GruvboxAqua +hi! link cssColorProp GruvboxAqua +hi! link cssGeneratedContentProp GruvboxAqua + +" }}} +" JavaScript: {{{ + +hi! link javaScriptBraces GruvboxFg1 +hi! link javaScriptFunction GruvboxAqua +hi! link javaScriptIdentifier GruvboxRed +hi! link javaScriptMember GruvboxBlue +hi! link javaScriptNumber GruvboxPurple +hi! link javaScriptNull GruvboxPurple +hi! link javaScriptParens GruvboxFg3 + +" }}} +" YAJS: {{{ + +hi! link javascriptImport GruvboxAqua +hi! link javascriptExport GruvboxAqua +hi! link javascriptClassKeyword GruvboxAqua +hi! link javascriptClassExtends GruvboxAqua +hi! link javascriptDefault GruvboxAqua + +hi! link javascriptClassName GruvboxYellow +hi! link javascriptClassSuperName GruvboxYellow +hi! link javascriptGlobal GruvboxYellow + +hi! link javascriptEndColons GruvboxFg1 +hi! link javascriptFuncArg GruvboxFg1 +hi! link javascriptGlobalMethod GruvboxFg1 +hi! link javascriptNodeGlobal GruvboxFg1 + +" hi! link javascriptVariable GruvboxOrange +hi! link javascriptVariable GruvboxRed +" hi! link javascriptIdentifier GruvboxOrange +" hi! link javascriptClassSuper GruvboxOrange +hi! link javascriptIdentifier GruvboxOrange +hi! link javascriptClassSuper GruvboxOrange + +" hi! link javascriptFuncKeyword GruvboxOrange +" hi! link javascriptAsyncFunc GruvboxOrange +hi! link javascriptFuncKeyword GruvboxAqua +hi! link javascriptAsyncFunc GruvboxAqua +hi! link javascriptClassStatic GruvboxOrange + +hi! link javascriptOperator GruvboxRed +hi! link javascriptForOperator GruvboxRed +hi! link javascriptYield GruvboxRed +hi! link javascriptExceptions GruvboxRed +hi! link javascriptMessage GruvboxRed + +hi! link javascriptTemplateSB GruvboxAqua +hi! link javascriptTemplateSubstitution GruvboxFg1 + +" hi! link javascriptLabel GruvboxBlue +" hi! link javascriptObjectLabel GruvboxBlue +" hi! link javascriptPropertyName GruvboxBlue +hi! link javascriptLabel GruvboxFg1 +hi! link javascriptObjectLabel GruvboxFg1 +hi! link javascriptPropertyName GruvboxFg1 + +hi! link javascriptLogicSymbols GruvboxFg1 +hi! link javascriptArrowFunc GruvboxFg1 + +hi! link javascriptDocParamName GruvboxFg4 +hi! link javascriptDocTags GruvboxFg4 +hi! link javascriptDocNotation GruvboxFg4 +hi! link javascriptDocParamType GruvboxFg4 +hi! link javascriptDocNamedParamType GruvboxFg4 + +" }}} +" TypeScript: {{{ + +hi! link typeScriptReserved GruvboxAqua +hi! link typeScriptLabel GruvboxAqua +hi! link typeScriptIdentifier GruvboxOrange +hi! link typeScriptBraces GruvboxFg1 +hi! link typeScriptEndColons GruvboxFg1 +hi! link typeScriptDOMObjects GruvboxFg1 +hi! link typeScriptAjaxMethods GruvboxFg1 +hi! link typeScriptLogicSymbols GruvboxFg1 +hi! link typeScriptDocSeeTag Comment +hi! link typeScriptDocParam Comment +hi! link typeScriptDocTags vimCommentTitle + +" }}} +" CoffeeScript: {{{ + +hi! link coffeeExtendedOp GruvboxFg3 +hi! link coffeeSpecialOp GruvboxFg3 +hi! link coffeeCurly GruvboxOrange +hi! link coffeeParen GruvboxFg3 +hi! link coffeeBracket GruvboxOrange + +" }}} +" Ruby: {{{ + +hi! link rubyStringDelimiter GruvboxGreen +hi! link rubyInterpolationDelimiter GruvboxAqua + +" }}} +" ObjectiveC: {{{ + +hi! link objcTypeModifier GruvboxRed +hi! link objcDirective GruvboxBlue + +" }}} +" Go: {{{ + +hi! link goDirective GruvboxAqua +hi! link goConstants GruvboxPurple +hi! link goDeclaration GruvboxRed +hi! link goDeclType GruvboxBlue +hi! link goBuiltins GruvboxOrange + +" }}} +" Lua: {{{ + +hi! link luaIn GruvboxRed +hi! link luaFunction GruvboxAqua +hi! link luaTable GruvboxOrange + +" }}} +" MoonScript: {{{ + +hi! link moonSpecialOp GruvboxFg3 +hi! link moonExtendedOp GruvboxFg3 +hi! link moonFunction GruvboxFg3 +hi! link moonObject GruvboxYellow + +" }}} +" Java: {{{ + +hi! link javaAnnotation GruvboxBlue +hi! link javaDocTags GruvboxAqua +hi! link javaCommentTitle vimCommentTitle +hi! link javaParen GruvboxFg3 +hi! link javaParen1 GruvboxFg3 +hi! link javaParen2 GruvboxFg3 +hi! link javaParen3 GruvboxFg3 +hi! link javaParen4 GruvboxFg3 +hi! link javaParen5 GruvboxFg3 +hi! link javaOperator GruvboxOrange + +hi! link javaVarArg GruvboxGreen + +" }}} +" Elixir: {{{ + +hi! link elixirDocString Comment + +hi! link elixirStringDelimiter GruvboxGreen +hi! link elixirInterpolationDelimiter GruvboxAqua + +hi! link elixirModuleDeclaration GruvboxYellow + +" }}} +" Scala: {{{ + +" NB: scala vim syntax file is kinda horrible +hi! link scalaNameDefinition GruvboxFg1 +hi! link scalaCaseFollowing GruvboxFg1 +hi! link scalaCapitalWord GruvboxFg1 +hi! link scalaTypeExtension GruvboxFg1 + +hi! link scalaKeyword GruvboxRed +hi! link scalaKeywordModifier GruvboxRed + +hi! link scalaSpecial GruvboxAqua +hi! link scalaOperator GruvboxFg1 + +hi! link scalaTypeDeclaration GruvboxYellow +hi! link scalaTypeTypePostDeclaration GruvboxYellow + +hi! link scalaInstanceDeclaration GruvboxFg1 +hi! link scalaInterpolation GruvboxAqua + +" }}} +" Markdown: {{{ + +call s:HL('markdownItalic', s:fg3, s:none, s:italic) + +hi! link markdownH1 GruvboxGreenBold +hi! link markdownH2 GruvboxGreenBold +hi! link markdownH3 GruvboxYellowBold +hi! link markdownH4 GruvboxYellowBold +hi! link markdownH5 GruvboxYellow +hi! link markdownH6 GruvboxYellow + +hi! link markdownCode GruvboxAqua +hi! link markdownCodeBlock GruvboxAqua +hi! link markdownCodeDelimiter GruvboxAqua + +hi! link markdownBlockquote GruvboxGray +hi! link markdownListMarker GruvboxGray +hi! link markdownOrderedListMarker GruvboxGray +hi! link markdownRule GruvboxGray +hi! link markdownHeadingRule GruvboxGray + +hi! link markdownUrlDelimiter GruvboxFg3 +hi! link markdownLinkDelimiter GruvboxFg3 +hi! link markdownLinkTextDelimiter GruvboxFg3 + +hi! link markdownHeadingDelimiter GruvboxOrange +hi! link markdownUrl GruvboxPurple +hi! link markdownUrlTitleDelimiter GruvboxGreen + +call s:HL('markdownLinkText', s:gray, s:none, s:underline) +hi! link markdownIdDeclaration markdownLinkText + +" }}} +" Haskell: {{{ + +" hi! link haskellType GruvboxYellow +" hi! link haskellOperators GruvboxOrange +" hi! link haskellConditional GruvboxAqua +" hi! link haskellLet GruvboxOrange +" +hi! link haskellType GruvboxFg1 +hi! link haskellIdentifier GruvboxFg1 +hi! link haskellSeparator GruvboxFg1 +hi! link haskellDelimiter GruvboxFg4 +hi! link haskellOperators GruvboxBlue +" +hi! link haskellBacktick GruvboxOrange +hi! link haskellStatement GruvboxOrange +hi! link haskellConditional GruvboxOrange + +hi! link haskellLet GruvboxAqua +hi! link haskellDefault GruvboxAqua +hi! link haskellWhere GruvboxAqua +hi! link haskellBottom GruvboxAqua +hi! link haskellBlockKeywords GruvboxAqua +hi! link haskellImportKeywords GruvboxAqua +hi! link haskellDeclKeyword GruvboxAqua +hi! link haskellDeriving GruvboxAqua +hi! link haskellAssocType GruvboxAqua + +hi! link haskellNumber GruvboxPurple +hi! link haskellPragma GruvboxPurple + +hi! link haskellString GruvboxGreen +hi! link haskellChar GruvboxGreen + +" }}} +" Json: {{{ + +hi! link jsonKeyword GruvboxGreen +hi! link jsonQuote GruvboxGreen +hi! link jsonBraces GruvboxFg1 +hi! link jsonString GruvboxFg1 + +" }}} + + +" Functions ------------------------------------------------------------------- +" Search Highlighting Cursor {{{ + +function! GruvboxHlsShowCursor() + call s:HL('Cursor', s:bg0, s:hls_cursor) +endfunction + +function! GruvboxHlsHideCursor() + call s:HL('Cursor', s:none, s:none, s:inverse) +endfunction + +" }}} + +" vim: set sw=2 ts=2 sts=2 et tw=80 ft=vim fdm=marker: diff --git a/sources_non_forked/gruvbox/gruvbox_256palette.sh b/sources_non_forked/gruvbox/gruvbox_256palette.sh new file mode 100644 index 00000000..c7fd190e --- /dev/null +++ b/sources_non_forked/gruvbox/gruvbox_256palette.sh @@ -0,0 +1,118 @@ +#!/bin/sh + +if [ "${TERM%%-*}" = "screen" ]; then + if [ -n "$TMUX" ]; then + printf "\033Ptmux;\033\033]4;236;rgb:32/30/2f\007\033\\" + printf "\033Ptmux;\033\033]4;234;rgb:1d/20/21\007\033\\" + + printf "\033Ptmux;\033\033]4;235;rgb:28/28/28\007\033\\" + printf "\033Ptmux;\033\033]4;237;rgb:3c/38/36\007\033\\" + printf "\033Ptmux;\033\033]4;239;rgb:50/49/45\007\033\\" + printf "\033Ptmux;\033\033]4;241;rgb:66/5c/54\007\033\\" + printf "\033Ptmux;\033\033]4;243;rgb:7c/6f/64\007\033\\" + + printf "\033Ptmux;\033\033]4;244;rgb:92/83/74\007\033\\" + printf "\033Ptmux;\033\033]4;245;rgb:92/83/74\007\033\\" + + printf "\033Ptmux;\033\033]4;228;rgb:f2/e5/bc\007\033\\" + printf "\033Ptmux;\033\033]4;230;rgb:f9/f5/d7\007\033\\" + + printf "\033Ptmux;\033\033]4;229;rgb:fb/f1/c7\007\033\\" + printf "\033Ptmux;\033\033]4;223;rgb:eb/db/b2\007\033\\" + printf "\033Ptmux;\033\033]4;250;rgb:d5/c4/a1\007\033\\" + printf "\033Ptmux;\033\033]4;248;rgb:bd/ae/93\007\033\\" + printf "\033Ptmux;\033\033]4;246;rgb:a8/99/84\007\033\\" + + printf "\033Ptmux;\033\033]4;167;rgb:fb/49/34\007\033\\" + printf "\033Ptmux;\033\033]4;142;rgb:b8/bb/26\007\033\\" + printf "\033Ptmux;\033\033]4;214;rgb:fa/bd/2f\007\033\\" + printf "\033Ptmux;\033\033]4;109;rgb:83/a5/98\007\033\\" + printf "\033Ptmux;\033\033]4;175;rgb:d3/86/9b\007\033\\" + printf "\033Ptmux;\033\033]4;108;rgb:8e/c0/7c\007\033\\" + printf "\033Ptmux;\033\033]4;208;rgb:fe/80/19\007\033\\" + + printf "\033Ptmux;\033\033]4;88;rgb:9d/00/06\007\033\\" + printf "\033Ptmux;\033\033]4;100;rgb:79/74/0e\007\033\\" + printf "\033Ptmux;\033\033]4;136;rgb:b5/76/14\007\033\\" + printf "\033Ptmux;\033\033]4;24;rgb:07/66/78\007\033\\" + printf "\033Ptmux;\033\033]4;96;rgb:8f/3f/71\007\033\\" + printf "\033Ptmux;\033\033]4;66;rgb:42/7b/58\007\033\\" + printf "\033Ptmux;\033\033]4;130;rgb:af/3a/03\007\033\\" + else + printf "\033P\033]4;236;rgb:32/30/2f\007\033\\" + printf "\033P\033]4;234;rgb:1d/20/21\007\033\\" + + printf "\033P\033]4;235;rgb:28/28/28\007\033\\" + printf "\033P\033]4;237;rgb:3c/38/36\007\033\\" + printf "\033P\033]4;239;rgb:50/49/45\007\033\\" + printf "\033P\033]4;241;rgb:66/5c/54\007\033\\" + printf "\033P\033]4;243;rgb:7c/6f/64\007\033\\" + + printf "\033P\033]4;244;rgb:92/83/74\007\033\\" + printf "\033P\033]4;245;rgb:92/83/74\007\033\\" + + printf "\033P\033]4;228;rgb:f2/e5/bc\007\033\\" + printf "\033P\033]4;230;rgb:f9/f5/d7\007\033\\" + + printf "\033P\033]4;229;rgb:fb/f1/c7\007\033\\" + printf "\033P\033]4;223;rgb:eb/db/b2\007\033\\" + printf "\033P\033]4;250;rgb:d5/c4/a1\007\033\\" + printf "\033P\033]4;248;rgb:bd/ae/93\007\033\\" + printf "\033P\033]4;246;rgb:a8/99/84\007\033\\" + + printf "\033P\033]4;167;rgb:fb/49/34\007\033\\" + printf "\033P\033]4;142;rgb:b8/bb/26\007\033\\" + printf "\033P\033]4;214;rgb:fa/bd/2f\007\033\\" + printf "\033P\033]4;109;rgb:83/a5/98\007\033\\" + printf "\033P\033]4;175;rgb:d3/86/9b\007\033\\" + printf "\033P\033]4;108;rgb:8e/c0/7c\007\033\\" + printf "\033P\033]4;208;rgb:fe/80/19\007\033\\" + + printf "\033P\033]4;88;rgb:9d/00/06\007\033\\" + printf "\033P\033]4;100;rgb:79/74/0e\007\033\\" + printf "\033P\033]4;136;rgb:b5/76/14\007\033\\" + printf "\033P\033]4;24;rgb:07/66/78\007\033\\" + printf "\033P\033]4;96;rgb:8f/3f/71\007\033\\" + printf "\033P\033]4;66;rgb:42/7b/58\007\033\\" + printf "\033P\033]4;130;rgb:af/3a/03\007\033\\" + fi + +elif [ "$TERM" != "linux" ] && [ "$TERM" != "vt100" ] && [ "$TERM" != "vt220" ]; then + + printf "\033]4;236;rgb:32/30/2f\033\\" + printf "\033]4;234;rgb:1d/20/21\033\\" + + printf "\033]4;235;rgb:28/28/28\033\\" + printf "\033]4;237;rgb:3c/38/36\033\\" + printf "\033]4;239;rgb:50/49/45\033\\" + printf "\033]4;241;rgb:66/5c/54\033\\" + printf "\033]4;243;rgb:7c/6f/64\033\\" + + printf "\033]4;244;rgb:92/83/74\033\\" + printf "\033]4;245;rgb:92/83/74\033\\" + + printf "\033]4;228;rgb:f2/e5/bc\033\\" + printf "\033]4;230;rgb:f9/f5/d7\033\\" + + printf "\033]4;229;rgb:fb/f1/c7\033\\" + printf "\033]4;223;rgb:eb/db/b2\033\\" + printf "\033]4;250;rgb:d5/c4/a1\033\\" + printf "\033]4;248;rgb:bd/ae/93\033\\" + printf "\033]4;246;rgb:a8/99/84\033\\" + + printf "\033]4;167;rgb:fb/49/34\033\\" + printf "\033]4;142;rgb:b8/bb/26\033\\" + printf "\033]4;214;rgb:fa/bd/2f\033\\" + printf "\033]4;109;rgb:83/a5/98\033\\" + printf "\033]4;175;rgb:d3/86/9b\033\\" + printf "\033]4;108;rgb:8e/c0/7c\033\\" + printf "\033]4;208;rgb:fe/80/19\033\\" + + printf "\033]4;88;rgb:9d/00/06\033\\" + printf "\033]4;100;rgb:79/74/0e\033\\" + printf "\033]4;136;rgb:b5/76/14\033\\" + printf "\033]4;24;rgb:07/66/78\033\\" + printf "\033]4;96;rgb:8f/3f/71\033\\" + printf "\033]4;66;rgb:42/7b/58\033\\" + printf "\033]4;130;rgb:af/3a/03\033\\" +fi diff --git a/sources_non_forked/gruvbox/gruvbox_256palette_osx.sh b/sources_non_forked/gruvbox/gruvbox_256palette_osx.sh new file mode 100644 index 00000000..ad5111a1 --- /dev/null +++ b/sources_non_forked/gruvbox/gruvbox_256palette_osx.sh @@ -0,0 +1,116 @@ +#!/bin/sh + +if [ "${TERM%%-*}" = "screen" ]; then + if [ -n "$TMUX" ]; then + printf "\033Ptmux;\033\033]4;236;rgb:26/24/23\007\033\\" + printf "\033Ptmux;\033\033]4;234;rgb:16/18/19\007\033\\" + + printf "\033Ptmux;\033\033]4;235;rgb:1e/1e/1e\007\033\\" + printf "\033Ptmux;\033\033]4;237;rgb:2e/2a/29\007\033\\" + printf "\033Ptmux;\033\033]4;239;rgb:3f/39/35\007\033\\" + printf "\033Ptmux;\033\033]4;241;rgb:53/4a/42\007\033\\" + printf "\033Ptmux;\033\033]4;243;rgb:68/5c/51\007\033\\" + + printf "\033Ptmux;\033\033]4;244;rgb:7f/70/61\007\033\\" + printf "\033Ptmux;\033\033]4;245;rgb:7f/70/61\007\033\\" + + printf "\033Ptmux;\033\033]4;228;rgb:ef/df/ae\007\033\\" + printf "\033Ptmux;\033\033]4;230;rgb:f8/f4/cd\007\033\\" + + printf "\033Ptmux;\033\033]4;229;rgb:fa/ee/bb\007\033\\" + printf "\033Ptmux;\033\033]4;223;rgb:e6/d4/a3\007\033\\" + printf "\033Ptmux;\033\033]4;250;rgb:cb/b8/90\007\033\\" + printf "\033Ptmux;\033\033]4;248;rgb:af/9f/81\007\033\\" + printf "\033Ptmux;\033\033]4;246;rgb:97/87/71\007\033\\" + + printf "\033Ptmux;\033\033]4;167;rgb:f7/30/28\007\033\\" + printf "\033Ptmux;\033\033]4;142;rgb:aa/b0/1e\007\033\\" + printf "\033Ptmux;\033\033]4;214;rgb:f7/b1/25\007\033\\" + printf "\033Ptmux;\033\033]4;109;rgb:71/95/86\007\033\\" + printf "\033Ptmux;\033\033]4;175;rgb:c7/70/89\007\033\\" + printf "\033Ptmux;\033\033]4;108;rgb:7d/b6/69\007\033\\" + printf "\033Ptmux;\033\033]4;208;rgb:fb/6a/16\007\033\\" + + printf "\033Ptmux;\033\033]4;88;rgb:89/00/09\007\033\\" + printf "\033Ptmux;\033\033]4;100;rgb:66/62/0d\007\033\\" + printf "\033Ptmux;\033\033]4;136;rgb:a5/63/11\007\033\\" + printf "\033Ptmux;\033\033]4;24;rgb:0e/53/65\007\033\\" + printf "\033Ptmux;\033\033]4;96;rgb:7b/2b/5e\007\033\\" + printf "\033Ptmux;\033\033]4;66;rgb:35/6a/46\007\033\\" + printf "\033Ptmux;\033\033]4;130;rgb:9d/28/07\007\033\\" + else + printf "\033P\033]4;236;rgb:26/24/23\007\033\\" + printf "\033P\033]4;234;rgb:16/18/19\007\033\\" + + printf "\033P\033]4;235;rgb:1e/1e/1e\007\033\\" + printf "\033P\033]4;237;rgb:2e/2a/29\007\033\\" + printf "\033P\033]4;239;rgb:3f/39/35\007\033\\" + printf "\033P\033]4;241;rgb:53/4a/42\007\033\\" + printf "\033P\033]4;243;rgb:68/5c/51\007\033\\" + + printf "\033P\033]4;244;rgb:7f/70/61\007\033\\" + printf "\033P\033]4;245;rgb:7f/70/61\007\033\\" + + printf "\033P\033]4;228;rgb:ef/df/ae\007\033\\" + printf "\033P\033]4;230;rgb:f8/f4/cd\007\033\\" + + printf "\033P\033]4;229;rgb:fa/ee/bb\007\033\\" + printf "\033P\033]4;223;rgb:e6/d4/a3\007\033\\" + printf "\033P\033]4;250;rgb:cb/b8/90\007\033\\" + printf "\033P\033]4;248;rgb:af/9f/81\007\033\\" + printf "\033P\033]4;246;rgb:97/87/71\007\033\\" + + printf "\033P\033]4;167;rgb:f7/30/28\007\033\\" + printf "\033P\033]4;142;rgb:aa/b0/1e\007\033\\" + printf "\033P\033]4;214;rgb:f7/b1/25\007\033\\" + printf "\033P\033]4;109;rgb:71/95/86\007\033\\" + printf "\033P\033]4;175;rgb:c7/70/89\007\033\\" + printf "\033P\033]4;108;rgb:7d/b6/69\007\033\\" + printf "\033P\033]4;208;rgb:fb/6a/16\007\033\\" + + printf "\033P\033]4;88;rgb:89/00/09\007\033\\" + printf "\033P\033]4;100;rgb:66/62/0d\007\033\\" + printf "\033P\033]4;136;rgb:a5/63/11\007\033\\" + printf "\033P\033]4;24;rgb:0e/53/65\007\033\\" + printf "\033P\033]4;96;rgb:7b/2b/5e\007\033\\" + printf "\033P\033]4;66;rgb:35/6a/46\007\033\\" + printf "\033P\033]4;130;rgb:9d/28/07\007\033\\" + fi +else + printf "\033]4;236;rgb:26/24/23\033\\" + printf "\033]4;234;rgb:16/18/19\033\\" + + printf "\033]4;235;rgb:1e/1e/1e\033\\" + printf "\033]4;237;rgb:2e/2a/29\033\\" + printf "\033]4;239;rgb:3f/39/35\033\\" + printf "\033]4;241;rgb:53/4a/42\033\\" + printf "\033]4;243;rgb:68/5c/51\033\\" + + printf "\033]4;244;rgb:7f/70/61\033\\" + printf "\033]4;245;rgb:7f/70/61\033\\" + + printf "\033]4;228;rgb:ef/df/ae\033\\" + printf "\033]4;230;rgb:f8/f4/cd\033\\" + + printf "\033]4;229;rgb:fa/ee/bb\033\\" + printf "\033]4;223;rgb:e6/d4/a3\033\\" + printf "\033]4;250;rgb:cb/b8/90\033\\" + printf "\033]4;248;rgb:af/9f/81\033\\" + printf "\033]4;246;rgb:97/87/71\033\\" + + printf "\033]4;167;rgb:f7/30/28\033\\" + printf "\033]4;142;rgb:aa/b0/1e\033\\" + printf "\033]4;214;rgb:f7/b1/25\033\\" + printf "\033]4;109;rgb:71/95/86\033\\" + printf "\033]4;175;rgb:c7/70/89\033\\" + printf "\033]4;108;rgb:7d/b6/69\033\\" + printf "\033]4;208;rgb:fb/6a/16\033\\" + + printf "\033]4;88;rgb:89/00/09\033\\" + printf "\033]4;100;rgb:66/62/0d\033\\" + printf "\033]4;136;rgb:a5/63/11\033\\" + printf "\033]4;24;rgb:0e/53/65\033\\" + printf "\033]4;96;rgb:7b/2b/5e\033\\" + printf "\033]4;66;rgb:35/6a/46\033\\" + printf "\033]4;130;rgb:9d/28/07\033\\" +fi diff --git a/sources_non_forked/vim-colorschemes b/sources_non_forked/vim-colorschemes deleted file mode 160000 index 28a989b2..00000000 --- a/sources_non_forked/vim-colorschemes +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 28a989b28457e38df620e4c7ab23e224aff70efe diff --git a/sources_non_forked/vim-gitgutter b/sources_non_forked/vim-gitgutter deleted file mode 160000 index 339f8ba0..00000000 --- a/sources_non_forked/vim-gitgutter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 339f8ba079ed7d465ca442c9032b36bc56c21f61 diff --git a/sources_non_forked/vim-gitgutter/.gitignore b/sources_non_forked/vim-gitgutter/.gitignore new file mode 100644 index 00000000..82fb2537 --- /dev/null +++ b/sources_non_forked/vim-gitgutter/.gitignore @@ -0,0 +1,5 @@ +/doc/tags +/misc +/test/*.actual +*.log + diff --git a/sources_non_forked/vim-gitgutter/README.mkd b/sources_non_forked/vim-gitgutter/README.mkd new file mode 100644 index 00000000..19ed3876 --- /dev/null +++ b/sources_non_forked/vim-gitgutter/README.mkd @@ -0,0 +1,499 @@ +## vim-gitgutter + +A Vim plugin which shows a git diff in the 'gutter' (sign column). It shows whether each line has been added, modified, and where lines have been removed. You can also stage and undo individual hunks. + +Features: + +* Shows signs for added, modified, and removed lines. +* Runs the diffs asynchronously in terminal Vim/MacVim (7.4.1826+), gVim (7.4.1850+), MacVim GUI (7.4.1832+), and NeoVim. +* Ensures signs are always as up to date as possible (but without running more than necessary). +* Quick jumping between blocks of changed lines ("hunks"). +* Stage/undo/preview individual hunks. +* Provides a hunk text object. +* Diffs against index (default) or any commit. +* Handles line endings correctly, even with repos that do CRLF conversion. +* Optional line highlighting. +* Fully customisable (signs, sign column, line highlights, mappings, extra git-diff arguments, etc). +* Can be toggled on/off. +* Preserves signs from other plugins. +* Easy to integrate diff stats into status line; built-in integration with [vim-airline](https://github.com/bling/vim-airline/). +* Works with fish shell (in addition to the usual shells). + +Constraints: + +* Supports git only. + +If you work with other version control systems, I recommend [vim-signify](https://github.com/mhinz/vim-signify). + + +### Screenshot + +![screenshot](https://raw.github.com/airblade/vim-gitgutter/master/screenshot.png) + +In the screenshot above you can see: + +* Line 15 has been modified. +* Lines 21-24 are new. +* A line or lines were removed between lines 25 and 26. + + +### Installation + +Before installation, please check your Vim supports signs by running `:echo has('signs')`. `1` means you're all set; `0` means you need to install a Vim with signs support. If you're compiling Vim yourself you need the 'big' or 'huge' feature set. [MacVim][] supports signs. + +You install vim-gitgutter like any other vim plugin. + +##### Pathogen + +``` +cd ~/.vim/bundle +git clone git://github.com/airblade/vim-gitgutter.git +``` + +##### Voom + +Edit your plugin manifest (`voom edit`) and add: + +``` +airblade/vim-gitgutter +``` + +##### VimPlug + +Place this in your .vimrc: + +```viml +Plug 'airblade/vim-gitgutter' +``` + +Then run the following in Vim: + +``` +:source % +:PlugInstall +``` + +##### NeoBundle + +Place this in your .vimrc: + +```viml +NeoBundle 'airblade/vim-gitgutter' +``` + +Then run the following in Vim: + +``` +:source % +:NeoBundleInstall +``` + +##### No plugin manager + +Copy vim-gitgutter's subdirectories into your vim configuration directory: + +``` +cd /tmp && git clone git://github.com/airblade/vim-gitgutter.git +cp -r vim-gitgutter/* ~/.vim/ +``` + +See `:help add-global-plugin`. + + +If you are on Windows you may find the command prompt pops up briefly every time vim-gitgutter runs. You can avoid this by installing both [vim-misc](https://github.com/xolox/vim-misc) and [vim-shell](https://github.com/xolox/vim-shell). If you have those two plugins but don't want vim-gitgutter to use them, you can opt out with `let g:gitgutter_avoid_cmd_prompt_on_windows = 0` in your `~/.vimrc`. + + +### Getting started + +When you make a change to a file tracked by git, the diff markers should appear automatically. The delay is governed by vim's `updatetime` option; the default value is 4 seconds but I suggest reducing it to around 250ms (add `set updatetime=250` to your vimrc). + +You can jump between hunks with `[c` and `]c`. You can preview, stage, and undo hunks with `hp`, `hs`, and `hu` respectively. + +You cannot currently unstage a staged hunk. + + +#### Activation + +You can explicitly turn vim-gitgutter off and on (defaults to on): + +* turn off with `:GitGutterDisable` +* turn on with `:GitGutterEnable` +* toggle with `:GitGutterToggle`. + +You can turn the signs on and off (defaults to on): + +* turn on with `:GitGutterSignsEnable` +* turn off with `:GitGutterSignsDisable` +* toggle with `:GitGutterSignsToggle`. + +And you can turn line highlighting on and off (defaults to off): + +* turn on with `:GitGutterLineHighlightsEnable` +* turn off with `:GitGutterLineHighlightsDisable` +* toggle with `:GitGutterLineHighlightsToggle`. + +Note that if you have line highlighting on and signs off, you will have an empty sign column – more accurately, a sign column with invisible signs. This is because line highlighting requires signs and Vim always shows the sign column even if the signs are invisible. + +If you switch off both line highlighting and signs, you won't see the sign column. That is unless you have set `let g:gitgutter_sign_column_always = 1` so it's always there. + +To keep your Vim snappy, vim-gitgutter will suppress itself when a file has more than 500 changes. As soon as the number of changes falls below the limit vim-gitgutter will show the signs again. You can configure the threshold with: + +```viml +let g:gitgutter_max_signs = 500 " default value +``` + +#### Hunks + +You can jump between hunks: + +* jump to next hunk (change): `]c` +* jump to previous hunk (change): `[c`. + +Both of those take a preceding count. + +To set your own mappings for these, for example `]h` and `[h`: + +```viml +nmap ]h GitGutterNextHunk +nmap [h GitGutterPrevHunk +``` + +You can stage or undo an individual hunk when your cursor is in it: + +* stage the hunk with `hs` or +* undo it with `hu`. + +See the FAQ if you want to unstage staged changes. + +The `.` command will work with both these if you install [repeat.vim](https://github.com/tpope/vim-repeat). + +To set your own mappings for these, for example if you prefer the mnemonics hunk-add and hunk-revert: + +```viml +nmap ha GitGutterStageHunk +nmap hr GitGutterUndoHunk +``` + +And you can preview a hunk's changes with `hp`. You can of course change this mapping, e.g: + +```viml +nmap hv GitGutterPreviewHunk +``` + +A hunk text object is provided which works in visual and operator-pending modes. + +- `ic` operates on all lines in the current hunk. +- `ac` operates on all lines in the current hunk and any trailing empty lines. + +To re-map these, for example to `ih` and `ah`: + +```viml +omap ih GitGutterTextObjectInnerPending +omap ah GitGutterTextObjectOuterPending +xmap ih GitGutterTextObjectInnerVisual +xmap ah GitGutterTextObjectOuterVisual +``` + +If you don't want vim-gitgutter to set up any mappings at all, use this: + +```viml +let g:gitgutter_map_keys = 0 +``` + +Finally, you can force vim-gitgutter to update its signs across all visible buffers with `:GitGutterAll`. + +See the customisation section below for how to change the defaults. + + +### When are the signs updated? + +By default the signs are updated as follows: + +| Event | Reason for update | Configuration | +|---------------------------|--------------------------------------|------------------------| +| Stop typing | So the signs are real time | `g:gitgutter_realtime` | +| Switch buffer | To notice change to git index | `g:gitgutter_eager` | +| Switch tab | To notice change to git index | `g:gitgutter_eager` | +| Focus the GUI | To notice change to git index | `g:gitgutter_eager` (not gVim on Windows) | +| Read a file into a buffer | To display initial signs | [always] | +| Save a buffer | So non-realtime signs are up to date | [always] | +| Change a file outside Vim | To notice `git stash` | [always] | + +The length of time Vim waits after you stop typing before it triggers the plugin is governed by the setting `updatetime`. This defaults to `4000` milliseconds which is rather too long. I recommend around `250` milliseconds but it depends on your system and your preferences. Note that in terminal Vim pre-7.4.427 an `updatetime` of less than approximately `1000` milliseconds can lead to random highlighting glitches; the lower the `updatetime`, the more glitches. + +If you experience a lag, you can trade speed for accuracy: + +```viml +let g:gitgutter_realtime = 0 +let g:gitgutter_eager = 0 +``` + +Note the realtime updating requires Vim 7.3.105 or higher. + + +### Customisation + +You can customise: + +* The sign column's colours +* Whether or not the sign column is shown when there aren't any signs (defaults to no) +* The signs' colours and symbols +* Line highlights +* The base of the diff +* Extra arguments for `git diff` +* Key mappings +* Whether or not vim-gitgutter is on initially (defaults to on) +* Whether or not signs are shown (defaults to yes) +* Whether or not line highlighting is on initially (defaults to off) +* Whether or not vim-gitgutter runs in "realtime" (defaults to yes) +* Whether or not vim-gitgutter runs eagerly (defaults to yes) +* Whether or not vim-gitgutter runs asynchronously (defaults to yes) + +Please note that vim-gitgutter won't override any colours or highlights you've set in your colorscheme. + + +#### Sign column + +By default vim-gitgutter will make the sign column look like the line number column. + +To customise your sign column's background color, first tell vim-gitgutter to leave it alone: + +```viml +let g:gitgutter_override_sign_column_highlight = 0 +``` + +And then either update your colorscheme's `SignColumn` highlight group or set it in your vimrc: + +```viml +highlight SignColumn ctermbg=whatever " terminal Vim +highlight SignColumn guibg=whatever " gVim/MacVim +``` + +By default the sign column will appear when there are signs to show and disappear when there aren't. If you would always like the sign column to be there, add `let g:gitgutter_sign_column_always = 1` to your `~/.vimrc`. + + +#### Signs' colours and symbols + +To customise the colours, set up the following highlight groups in your colorscheme or `~/.vimrc`: + +```viml +GitGutterAdd " an added line +GitGutterChange " a changed line +GitGutterDelete " at least one removed line +GitGutterChangeDelete " a changed line followed by at least one removed line +``` + +You can either set these with `highlight GitGutterAdd {key}={arg}...` or link them to existing highlight groups with, say, `highlight link GitGutterAdd DiffAdd`. + +To customise the symbols, add the following to your `~/.vimrc`: + +```viml +let g:gitgutter_sign_added = 'xx' +let g:gitgutter_sign_modified = 'yy' +let g:gitgutter_sign_removed = 'zz' +let g:gitgutter_sign_removed_first_line = '^^' +let g:gitgutter_sign_modified_removed = 'ww' +``` + + +#### Line highlights + +Similarly to the signs' colours, set up the following highlight groups in your colorscheme or `~/.vimrc`: + +```viml +GitGutterAddLine " default: links to DiffAdd +GitGutterChangeLine " default: links to DiffChange +GitGutterDeleteLine " default: links to DiffDelete +GitGutterChangeDeleteLine " default: links to GitGutterChangeLineDefault, i.e. DiffChange +``` + + +#### The base of the diff + +By default buffers are diffed against the index. However you can diff against any commit by setting: + +```viml +let g:gitgutter_diff_base = '' +``` + + +#### Extra arguments for `git diff` + +If you want to pass extra arguments to `git diff`, for example to ignore whitespace, do so like this: + +```viml +let g:gitgutter_diff_args = '-w' +``` + +#### Key mappings + +To disable all key mappings: + +```viml +let g:gitgutter_map_keys = 0 +``` + +See above for configuring maps for hunk-jumping and staging/undoing. + + +#### Use a custom `grep` command + +If you use an alternative to grep, or your grep does not support the `color` flag, you can tell vim-gitgutter to use it here. It only needs to support extended POSIX regex. + +```viml +" Default: +let g:gitgutter_grep_command = 'grep --color=never -e' +``` + +#### To turn off vim-gitgutter by default + +Add `let g:gitgutter_enabled = 0` to your `~/.vimrc`. + + +#### To turn off signs by default + +Add `let g:gitgutter_signs = 0` to your `~/.vimrc`. + + +#### To turn on line highlighting by default + +Add `let g:gitgutter_highlight_lines = 1` to your `~/.vimrc`. + + +#### To turn off asynchronous updates + +By default diffs are run asynchronously. To run diffs synchronously instead: + +```viml +let g:gitgutter_async = 0 +``` + + +### Extensions + +#### Operate on every line in a hunk + +You can map an operator to do whatever you want to every line in a hunk. + +Let's say, for example, you want to remove trailing whitespace. + +```viml +function! CleanUp(...) + if a:0 " opfunc + let [first, last] = [line("'["), line("']")] + else + let [first, last] = [line("'<"), line("'>")] + endif + for lnum in range(first, last) + let line = getline(lnum) + + " clean up the text, e.g.: + let line = substitute(line, '\s\+$', '', '') + + call setline(lnum, line) + endfor +endfunction + +nmap x :set opfunc=CleanUpg@ +``` + +Then place your cursor in a hunk and type `\xic` (assuming a leader of `\`). + +Alternatively you could place your cursor in a hunk, type `vic` to select it, then `:call CleanUp()`. + + +#### Operate on every changed line in a file + +You can write a command to do whatever you want to every changed line in a file. + +```viml +function! GlobalChangedLines(ex_cmd) + for hunk in GitGutterGetHunks() + for lnum in range(hunk[2], hunk[2]+hunk[3]-1) + let cursor = getcurpos() + silent! execute lnum.a:ex_cmd + call setpos('.', cursor) + endfor + endfor +endfunction + +command -nargs=1 Glines call GlobalChangedLines() +``` + +Let's say, for example, you want to remove trailing whitespace from all changed lines: + +```viml +:Glines s/\s\+$// +``` + + +### FAQ + +> Why can't I unstage staged changes? + +Unstaging staged hunks is feasible but not quite as easy as it sounds. There are three relevant versions of a file at any one time: + +1. The version at HEAD in the repo. +2. The version staged in the index. +3. The version in the working tree, in your vim buffer. + +`git-diff` without arguments shows you how 3 and 2 differ; this is what vim-gitgutter shows too. + +`git-diff --staged` shows you how 2 and 1 differ. + +Let's say you are looking at a file in vim which has some unstaged changes. Now you stage a hunk, either via vim-gitgutter or another means. The hunk is no longer marked in vim-gitgutter because it is the same in 3 and 2. + +Now you want to unstage that hunk. To see it, you need the difference between 2 and 1. For vim-gitgutter to show those differences, it would need to show you 2 instead of 3 in your vim buffer. But 2 is virtual so vim-gitgutter would need to handle it without touching 3. + +I intend to implement this but I can't commit to any deadline. + +> Why are the colours in the sign column weird? + +Your colorscheme is configuring the `SignColumn` highlight group weirdly. Please see the section above on customising the sign column. + +> There's a noticeable lag when vim-gitter runs; how can I avoid it? + +By default vim-gitgutter runs often so the signs are as accurate as possible. The delay is governed by `updatetime`; see [above](#when-are-the-signs-updated) for more information. + +If you don't want realtime updates and would like to trade a little accuracy for speed, add this to your `~/.vimrc`: + +```viml +let g:gitgutter_realtime = 0 +let g:gitgutter_eager = 0 +``` + +> What happens if I also use another plugin which uses signs (e.g. Syntastic)? + +Vim only allows one sign per line. Before adding a sign to a line, vim-gitgutter checks whether a sign has already been added by somebody else. If so it doesn't do anything. In other words vim-gitgutter won't overwrite another plugin's signs. It also won't remove another plugin's signs. + +> Why aren't any signs showing at all? + +Here are some things you can check: + +* `:echo system("git --version")` succeeds. +* Your git config is compatible with the version of git returned by the command above. +* Your Vim supports signs (`:echo has('signs')` should give `1`). +* Your file is being tracked by git and has unstaged changes. +* If your grep does not support the `color` flag, add `let g:gitgutter_grep_command = 'grep -e'` to your `~/.vimrc`. + + +### Shameless Plug + +If this plugin has helped you, or you'd like to learn more about Vim, why not check out this screencast I wrote for PeepCode: + +* [Smash Into Vim][siv] + +This was one of PeepCode's all-time top three bestsellers and is now available at Pluralsight. + +You can read reviews on my [website][airblade]. + + +### Intellectual Property + +Copyright Andrew Stewart, AirBlade Software Ltd. Released under the MIT licence. + + + [pathogen]: https://github.com/tpope/vim-pathogen + [siv]: http://pluralsight.com/training/Courses/TableOfContents/smash-into-vim + [airblade]: http://airbladesoftware.com/peepcode-vim + [macvim]: http://code.google.com/p/macvim/ diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim new file mode 100644 index 00000000..e5431597 --- /dev/null +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim @@ -0,0 +1,253 @@ +let s:nomodeline = (v:version > 703 || (v:version == 703 && has('patch442'))) ? '' : '' + +" Primary functions {{{ + +function! gitgutter#all() abort + for buffer_id in gitgutter#utility#dedup(tabpagebuflist()) + let file = expand('#' . buffer_id . ':p') + if !empty(file) + call gitgutter#process_buffer(buffer_id, 0) + endif + endfor +endfunction + +" bufnr: (integer) the buffer to process. +" realtime: (boolean) when truthy, do a realtime diff; otherwise do a disk-based diff. +function! gitgutter#process_buffer(bufnr, realtime) abort + call gitgutter#utility#use_known_shell() + + call gitgutter#utility#set_buffer(a:bufnr) + if gitgutter#utility#is_active() + if g:gitgutter_sign_column_always + call gitgutter#sign#add_dummy_sign() + endif + try + if !a:realtime || gitgutter#utility#has_fresh_changes() + let diff = gitgutter#diff#run_diff(a:realtime || gitgutter#utility#has_unsaved_changes(), 0) + if diff != 'async' + call gitgutter#handle_diff(diff) + endif + endif + catch /diff failed/ + call gitgutter#debug#log('diff failed') + call gitgutter#hunk#reset() + endtry + execute "silent doautocmd" s:nomodeline "User GitGutter" + else + call gitgutter#hunk#reset() + endif + + call gitgutter#utility#restore_shell() +endfunction + + +function! gitgutter#handle_diff(diff) abort + call gitgutter#debug#log(a:diff) + + call setbufvar(gitgutter#utility#bufnr(), 'gitgutter_tracked', 1) + + call gitgutter#hunk#set_hunks(gitgutter#diff#parse_diff(a:diff)) + let modified_lines = gitgutter#diff#process_hunks(gitgutter#hunk#hunks()) + + if len(modified_lines) > g:gitgutter_max_signs + call gitgutter#utility#warn_once('exceeded maximum number of signs (configured by g:gitgutter_max_signs).', 'max_signs') + call gitgutter#sign#clear_signs() + return + endif + + if g:gitgutter_signs || g:gitgutter_highlight_lines + call gitgutter#sign#update_signs(modified_lines) + endif + + call gitgutter#utility#save_last_seen_change() +endfunction + +function! gitgutter#disable() abort + " get list of all buffers (across all tabs) + let buflist = [] + for i in range(tabpagenr('$')) + call extend(buflist, tabpagebuflist(i + 1)) + endfor + + for buffer_id in gitgutter#utility#dedup(buflist) + let file = expand('#' . buffer_id . ':p') + if !empty(file) + call gitgutter#utility#set_buffer(buffer_id) + call gitgutter#sign#clear_signs() + call gitgutter#sign#remove_dummy_sign(1) + call gitgutter#hunk#reset() + endif + endfor + + let g:gitgutter_enabled = 0 +endfunction + +function! gitgutter#enable() abort + let g:gitgutter_enabled = 1 + call gitgutter#all() +endfunction + +function! gitgutter#toggle() abort + if g:gitgutter_enabled + call gitgutter#disable() + else + call gitgutter#enable() + endif +endfunction + +" }}} + +" Line highlights {{{ + +function! gitgutter#line_highlights_disable() abort + let g:gitgutter_highlight_lines = 0 + call gitgutter#highlight#define_sign_line_highlights() + + if !g:gitgutter_signs + call gitgutter#sign#clear_signs() + call gitgutter#sign#remove_dummy_sign(0) + endif + + redraw! +endfunction + +function! gitgutter#line_highlights_enable() abort + let old_highlight_lines = g:gitgutter_highlight_lines + + let g:gitgutter_highlight_lines = 1 + call gitgutter#highlight#define_sign_line_highlights() + + if !old_highlight_lines && !g:gitgutter_signs + call gitgutter#all() + endif + + redraw! +endfunction + +function! gitgutter#line_highlights_toggle() abort + if g:gitgutter_highlight_lines + call gitgutter#line_highlights_disable() + else + call gitgutter#line_highlights_enable() + endif +endfunction + +" }}} + +" Signs {{{ + +function! gitgutter#signs_enable() abort + let old_signs = g:gitgutter_signs + + let g:gitgutter_signs = 1 + call gitgutter#highlight#define_sign_text_highlights() + + if !old_signs && !g:gitgutter_highlight_lines + call gitgutter#all() + endif +endfunction + +function! gitgutter#signs_disable() abort + let g:gitgutter_signs = 0 + call gitgutter#highlight#define_sign_text_highlights() + + if !g:gitgutter_highlight_lines + call gitgutter#sign#clear_signs() + call gitgutter#sign#remove_dummy_sign(0) + endif +endfunction + +function! gitgutter#signs_toggle() abort + if g:gitgutter_signs + call gitgutter#signs_disable() + else + call gitgutter#signs_enable() + endif +endfunction + +" }}} + +" Hunks {{{ + +function! gitgutter#stage_hunk() abort + call gitgutter#utility#use_known_shell() + if gitgutter#utility#is_active() + " Ensure the working copy of the file is up to date. + " It doesn't make sense to stage a hunk otherwise. + noautocmd silent write + let diff = gitgutter#diff#run_diff(0, 1) + call gitgutter#handle_diff(diff) + + if empty(gitgutter#hunk#current_hunk()) + call gitgutter#utility#warn('cursor is not in a hunk') + else + let diff_for_hunk = gitgutter#diff#generate_diff_for_hunk(diff, 'stage') + call gitgutter#utility#system(gitgutter#utility#command_in_directory_of_file(g:gitgutter_git_executable.' apply --cached --unidiff-zero - '), diff_for_hunk) + + " refresh gitgutter's view of buffer + silent execute "GitGutter" + endif + + silent! call repeat#set("\GitGutterStageHunk", -1) + endif + call gitgutter#utility#restore_shell() +endfunction + +function! gitgutter#undo_hunk() abort + call gitgutter#utility#use_known_shell() + if gitgutter#utility#is_active() + " Ensure the working copy of the file is up to date. + " It doesn't make sense to stage a hunk otherwise. + noautocmd silent write + let diff = gitgutter#diff#run_diff(0, 1) + call gitgutter#handle_diff(diff) + + if empty(gitgutter#hunk#current_hunk()) + call gitgutter#utility#warn('cursor is not in a hunk') + else + let diff_for_hunk = gitgutter#diff#generate_diff_for_hunk(diff, 'undo') + call gitgutter#utility#system(gitgutter#utility#command_in_directory_of_file(g:gitgutter_git_executable.' apply --reverse --unidiff-zero - '), diff_for_hunk) + + " reload file preserving screen line position + let wl = winline() + silent edit + let offset = wl - winline() + execute "normal! ".offset."\" + endif + + silent! call repeat#set("\GitGutterUndoHunk", -1) + endif + call gitgutter#utility#restore_shell() +endfunction + +function! gitgutter#preview_hunk() abort + call gitgutter#utility#use_known_shell() + if gitgutter#utility#is_active() + " Ensure the working copy of the file is up to date. + " It doesn't make sense to stage a hunk otherwise. + noautocmd silent write + let diff = gitgutter#diff#run_diff(0, 1) + call gitgutter#handle_diff(diff) + + if empty(gitgutter#hunk#current_hunk()) + call gitgutter#utility#warn('cursor is not in a hunk') + else + let diff_for_hunk = gitgutter#diff#generate_diff_for_hunk(diff, 'preview') + + silent! wincmd P + if !&previewwindow + noautocmd execute 'bo' &previewheight 'new' + set previewwindow + endif + + setlocal noro modifiable filetype=diff buftype=nofile bufhidden=delete noswapfile + execute "%delete_" + call append(0, split(diff_for_hunk, "\n")) + + noautocmd wincmd p + endif + endif + call gitgutter#utility#restore_shell() +endfunction + +" }}} diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/async.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/async.vim new file mode 100644 index 00000000..0ce70b82 --- /dev/null +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/async.vim @@ -0,0 +1,211 @@ +let s:jobs = {} + +" Nvim has always supported async commands. +" +" Vim introduced async in 7.4.1826. +" +" gVim didn't support aync until 7.4.1850 (though I haven't been able to +" verify this myself). +" +" MacVim-GUI didn't support async until 7.4.1832 (actually commit +" 88f4fe0 but 7.4.1832 was the first subsequent patch release). +let s:available = has('nvim') || ( + \ has('job') && ( + \ (has('patch-7-4-1826') && !has('gui_running')) || + \ (has('patch-7-4-1850') && has('gui_running')) || + \ (has('patch-7-4-1832') && has('gui_macvim')) + \ ) + \ ) + +function! gitgutter#async#available() + return s:available +endfunction + +function! gitgutter#async#execute(cmd) abort + let bufnr = gitgutter#utility#bufnr() + + if has('nvim') + if has('unix') + let command = ["sh", "-c", a:cmd] + elseif has('win32') + let command = ["cmd.exe", "/c", a:cmd] + else + throw 'unknown os' + endif + " Make the job use a shell while avoiding (un)quoting problems. + let job_id = jobstart(command, { + \ 'buffer': bufnr, + \ 'on_stdout': function('gitgutter#async#handle_diff_job_nvim'), + \ 'on_stderr': function('gitgutter#async#handle_diff_job_nvim'), + \ 'on_exit': function('gitgutter#async#handle_diff_job_nvim') + \ }) + call gitgutter#debug#log('[nvim job: '.job_id.', buffer: '.bufnr.'] '.a:cmd) + if job_id < 1 + throw 'diff failed' + endif + + " Note that when `cmd` doesn't produce any output, i.e. the diff is empty, + " the `stdout` event is not fired on the job handler. Therefore we keep + " track of the jobs ourselves so we can spot empty diffs. + call s:job_started(job_id) + + else + " Make the job use a shell. + " + " Pass a handler for stdout but not for stderr so that errors are + " ignored (and thus signs are not updated; this assumes that an error + " only occurs when a file is not tracked by git). + + if has('unix') + let command = ["sh", "-c", a:cmd] + elseif has('win32') + " Help docs recommend {command} be a string on Windows. But I think + " they also say that will run the command directly, which I believe would + " mean the redirection and pipe stuff wouldn't work. + " let command = "cmd.exe /c ".a:cmd + let command = ["cmd.exe", "/c", a:cmd] + else + throw 'unknown os' + endif + + let job = job_start(command, { + \ 'out_cb': 'gitgutter#async#handle_diff_job_vim', + \ 'close_cb': 'gitgutter#async#handle_diff_job_vim_close' + \ }) + call gitgutter#debug#log('[vim job: '.string(job_info(job)).', buffer: '.bufnr.'] '.a:cmd) + + call s:job_started(s:channel_id(job_getchannel(job)), bufnr) + endif +endfunction + + +function! gitgutter#async#handle_diff_job_nvim(job_id, data, event) abort + call gitgutter#debug#log('job_id: '.a:job_id.', event: '.a:event.', buffer: '.self.buffer) + + let job_bufnr = self.buffer + if bufexists(job_bufnr) + let current_buffer = gitgutter#utility#bufnr() + call gitgutter#utility#set_buffer(job_bufnr) + + if a:event == 'stdout' + " a:data is a list + call s:job_finished(a:job_id) + if gitgutter#utility#is_active() + call gitgutter#handle_diff(gitgutter#utility#stringify(a:data)) + endif + + elseif a:event == 'exit' + " If the exit event is triggered without a preceding stdout event, + " the diff was empty. + if s:is_job_started(a:job_id) + if gitgutter#utility#is_active() + call gitgutter#handle_diff("") + endif + call s:job_finished(a:job_id) + endif + + else " a:event is stderr + call gitgutter#hunk#reset() + call s:job_finished(a:job_id) + + endif + + call gitgutter#utility#set_buffer(current_buffer) + else + call s:job_finished(a:job_id) + endif +endfunction + + +" Channel is in NL mode. +function! gitgutter#async#handle_diff_job_vim(channel, line) abort + call gitgutter#debug#log('channel: '.a:channel.', line: '.a:line) + + call s:accumulate_job_output(s:channel_id(a:channel), a:line) +endfunction + +function! gitgutter#async#handle_diff_job_vim_close(channel) abort + call gitgutter#debug#log('channel: '.a:channel) + + let channel_id = s:channel_id(a:channel) + let job_bufnr = s:job_buffer(channel_id) + + if bufexists(job_bufnr) + let current_buffer = gitgutter#utility#bufnr() + call gitgutter#utility#set_buffer(job_bufnr) + + if gitgutter#utility#is_active() + call gitgutter#handle_diff(s:job_output(channel_id)) + endif + + call gitgutter#utility#set_buffer(current_buffer) + endif + call s:job_finished(channel_id) +endfunction + + +function! s:channel_id(channel) abort + return ch_info(a:channel)['id'] +endfunction + + +" +" Keep track of jobs. +" +" nvim: receives all the job's output at once so we don't need to accumulate +" it ourselves. We can pass the buffer number into the job so we don't need +" to track that either. +" +" s:jobs {} -> key: job's id, value: anything truthy +" +" vim: receives the job's output line by line so we need to accumulate it. +" We also need to keep track of the buffer the job is running for. +" Vim job's don't have an id. Instead we could use the external process's id +" or the channel's id (there seems to be 1 channel per job). Arbitrarily +" choose the channel's id. +" +" s:jobs {} -> key: channel's id, value: {} key: output, value: [] job's output +" key: buffer: value: buffer number + + +" nvim: +" id: job's id +" +" vim: +" id: channel's id +" arg: buffer number +function! s:job_started(id, ...) abort + if a:0 " vim + let s:jobs[a:id] = {'output': [], 'buffer': a:1} + else " nvim + let s:jobs[a:id] = 1 + endif +endfunction + +function! s:is_job_started(id) abort + return has_key(s:jobs, a:id) +endfunction + +function! s:accumulate_job_output(id, line) abort + call add(s:jobs[a:id].output, a:line) +endfunction + +" Returns a string +function! s:job_output(id) abort + if has_key(s:jobs, a:id) + return gitgutter#utility#stringify(s:jobs[a:id].output) + else + return "" + endif +endfunction + +function! s:job_buffer(id) abort + return s:jobs[a:id].buffer +endfunction + +function! s:job_finished(id) abort + if has_key(s:jobs, a:id) + unlet s:jobs[a:id] + endif +endfunction + diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/debug.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/debug.vim new file mode 100644 index 00000000..594f044b --- /dev/null +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/debug.vim @@ -0,0 +1,119 @@ +let s:plugin_dir = expand(':p:h:h:h').'/' +let s:log_file = s:plugin_dir.'gitgutter.log' +let s:channel_log = s:plugin_dir.'channel.log' +let s:new_log_session = 1 + + +function! gitgutter#debug#debug() + " Open a scratch buffer + vsplit __GitGutter_Debug__ + normal! ggdG + setlocal buftype=nofile + setlocal bufhidden=delete + setlocal noswapfile + + call gitgutter#debug#vim_version() + call gitgutter#debug#separator() + + call gitgutter#debug#git_version() + call gitgutter#debug#separator() + + call gitgutter#debug#grep_version() + call gitgutter#debug#separator() + + call gitgutter#debug#option('updatetime') + call gitgutter#debug#option('shell') + call gitgutter#debug#option('shellcmdflag') + call gitgutter#debug#option('shellpipe') + call gitgutter#debug#option('shellquote') + call gitgutter#debug#option('shellredir') + call gitgutter#debug#option('shellslash') + call gitgutter#debug#option('shelltemp') + call gitgutter#debug#option('shelltype') + call gitgutter#debug#option('shellxescape') + call gitgutter#debug#option('shellxquote') +endfunction + + +function! gitgutter#debug#separator() + call gitgutter#debug#output('') +endfunction + +function! gitgutter#debug#vim_version() + redir => version_info + silent execute 'version' + redir END + call gitgutter#debug#output(split(version_info, '\n')[0:2]) +endfunction + +function! gitgutter#debug#git_version() + let v = system(g:gitgutter_git_executable.' --version') + call gitgutter#debug#output( substitute(v, '\n$', '', '') ) +endfunction + +function! gitgutter#debug#grep_version() + let v = system('grep --version') + call gitgutter#debug#output( substitute(v, '\n$', '', '') ) + + let v = system('grep --help') + call gitgutter#debug#output( substitute(v, '\%x00', '', 'g') ) +endfunction + +function! gitgutter#debug#option(name) + if exists('+' . a:name) + let v = eval('&' . a:name) + call gitgutter#debug#output(a:name . '=' . v) + " redir => output + " silent execute "verbose set " . a:name . "?" + " redir END + " call gitgutter#debug#output(a:name . '=' . output) + else + call gitgutter#debug#output(a:name . ' [n/a]') + end +endfunction + +function! gitgutter#debug#output(text) + call append(line('$'), a:text) +endfunction + +" assumes optional args are calling function's optional args +function! gitgutter#debug#log(message, ...) abort + if g:gitgutter_log + if s:new_log_session && gitgutter#async#available() + if exists('*ch_logfile') + call ch_logfile(s:channel_log, 'w') + endif + endif + + execute 'redir >> '.s:log_file + if s:new_log_session + let s:start = reltime() + silent echo "\n==== start log session ====" + endif + + let elapsed = reltimestr(reltime(s:start)).' ' + silent echo '' + " callers excluding this function + silent echo elapsed.expand('')[:-22].':' + silent echo elapsed.s:format_for_log(a:message) + if a:0 && !empty(a:1) + for msg in a:000 + silent echo elapsed.s:format_for_log(msg) + endfor + endif + redir END + + let s:new_log_session = 0 + endif +endfunction + +function! s:format_for_log(data) abort + if type(a:data) == 1 + return join(split(a:data,'\n'),"\n") + elseif type(a:data) == 3 + return '['.join(a:data,"\n").']' + else + return a:data + endif +endfunction + diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim new file mode 100644 index 00000000..170193bf --- /dev/null +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim @@ -0,0 +1,342 @@ +if exists('g:gitgutter_grep_command') + let s:grep_available = 1 + let s:grep_command = g:gitgutter_grep_command +else + let s:grep_available = executable('grep') + if s:grep_available + let s:grep_command = 'grep --color=never -e' + endif +endif +let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@' + +let s:c_flag = gitgutter#utility#git_supports_command_line_config_override() + +let s:temp_index = tempname() +let s:temp_buffer = tempname() + +" Returns a diff of the buffer. +" +" The way to get the diff depends on whether the buffer is saved or unsaved. +" +" * Saved: the buffer contents is the same as the file on disk in the working +" tree so we simply do: +" +" git diff myfile +" +" * Unsaved: the buffer contents is not the same as the file on disk so we +" need to pass two instances of the file to git-diff: +" +" git diff myfileA myfileB +" +" The first instance is the file in the index which we obtain with: +" +" git show :myfile > myfileA +" +" The second instance is the buffer contents. Ideally we would pass this to +" git-diff on stdin via the second argument to vim's system() function. +" Unfortunately git-diff does not do CRLF conversion for input received on +" stdin, and git-show never performs CRLF conversion, so repos with CRLF +" conversion report that every line is modified due to mismatching EOLs. +" +" Instead, we write the buffer contents to a temporary file - myfileB in this +" example. Note the file extension must be preserved for the CRLF +" conversion to work. +" +" Before diffing a buffer for the first time, we check whether git knows about +" the file: +" +" git ls-files --error-unmatch myfile +" +" After running the diff we pass it through grep where available to reduce +" subsequent processing by the plugin. If grep is not available the plugin +" does the filtering instead. +function! gitgutter#diff#run_diff(realtime, preserve_full_diff) abort + " Wrap compound commands in parentheses to make Windows happy. + " bash doesn't mind the parentheses. + let cmd = '(' + + let bufnr = gitgutter#utility#bufnr() + let tracked = getbufvar(bufnr, 'gitgutter_tracked') " i.e. tracked by git + if !tracked + " Don't bother trying to realtime-diff an untracked file. + " NOTE: perhaps we should pull this guard up to the caller? + if a:realtime + throw 'diff failed' + else + let cmd .= g:gitgutter_git_executable.' ls-files --error-unmatch '.gitgutter#utility#shellescape(gitgutter#utility#filename()).' && (' + endif + endif + + if a:realtime + let blob_name = g:gitgutter_diff_base.':'.gitgutter#utility#shellescape(gitgutter#utility#file_relative_to_repo_root()) + let blob_file = s:temp_index + let buff_file = s:temp_buffer + let extension = gitgutter#utility#extension() + if !empty(extension) + let blob_file .= '.'.extension + let buff_file .= '.'.extension + endif + let cmd .= g:gitgutter_git_executable.' show '.blob_name.' > '.blob_file.' && ' + + " Writing the whole buffer resets the '[ and '] marks and also the + " 'modified' flag (if &cpoptions includes '+'). These are unwanted + " side-effects so we save and restore the values ourselves. + let modified = getbufvar(bufnr, "&mod") + let op_mark_start = getpos("'[") + let op_mark_end = getpos("']") + + execute 'keepalt noautocmd silent write!' buff_file + + call setbufvar(bufnr, "&mod", modified) + call setpos("'[", op_mark_start) + call setpos("']", op_mark_end) + endif + + let cmd .= g:gitgutter_git_executable + if s:c_flag + let cmd .= ' -c "diff.autorefreshindex=0"' + endif + let cmd .= ' diff --no-ext-diff --no-color -U0 '.g:gitgutter_diff_args.' ' + + if a:realtime + let cmd .= ' -- '.blob_file.' '.buff_file + else + let cmd .= g:gitgutter_diff_base.' -- '.gitgutter#utility#shellescape(gitgutter#utility#filename()) + endif + + if !a:preserve_full_diff && s:grep_available + let cmd .= ' | '.s:grep_command.' '.gitgutter#utility#shellescape('^@@ ') + endif + + if (!a:preserve_full_diff && s:grep_available) || a:realtime + " grep exits with 1 when no matches are found; diff exits with 1 when + " differences are found. However we want to treat non-matches and + " differences as non-erroneous behaviour; so we OR the command with one + " which always exits with success (0). + let cmd .= ' || exit 0' + endif + + let cmd .= ')' + + if !tracked + let cmd .= ')' + endif + + let cmd = gitgutter#utility#command_in_directory_of_file(cmd) + + if g:gitgutter_async && gitgutter#async#available() && !a:preserve_full_diff + call gitgutter#async#execute(cmd) + return 'async' + + else + let diff = gitgutter#utility#system(cmd) + + if gitgutter#utility#shell_error() + " A shell error indicates the file is not tracked by git (unless something bizarre is going on). + throw 'diff failed' + endif + + return diff + endif +endfunction + +function! gitgutter#diff#parse_diff(diff) abort + let hunks = [] + for line in split(a:diff, '\n') + let hunk_info = gitgutter#diff#parse_hunk(line) + if len(hunk_info) == 4 + call add(hunks, hunk_info) + endif + endfor + return hunks +endfunction + +function! gitgutter#diff#parse_hunk(line) abort + let matches = matchlist(a:line, s:hunk_re) + if len(matches) > 0 + let from_line = str2nr(matches[1]) + let from_count = (matches[2] == '') ? 1 : str2nr(matches[2]) + let to_line = str2nr(matches[3]) + let to_count = (matches[4] == '') ? 1 : str2nr(matches[4]) + return [from_line, from_count, to_line, to_count] + else + return [] + end +endfunction + +function! gitgutter#diff#process_hunks(hunks) abort + call gitgutter#hunk#reset() + let modified_lines = [] + for hunk in a:hunks + call extend(modified_lines, gitgutter#diff#process_hunk(hunk)) + endfor + return modified_lines +endfunction + +" Returns [ [, ], ...] +function! gitgutter#diff#process_hunk(hunk) abort + let modifications = [] + let from_line = a:hunk[0] + let from_count = a:hunk[1] + let to_line = a:hunk[2] + let to_count = a:hunk[3] + + if gitgutter#diff#is_added(from_count, to_count) + call gitgutter#diff#process_added(modifications, from_count, to_count, to_line) + call gitgutter#hunk#increment_lines_added(to_count) + + elseif gitgutter#diff#is_removed(from_count, to_count) + call gitgutter#diff#process_removed(modifications, from_count, to_count, to_line) + call gitgutter#hunk#increment_lines_removed(from_count) + + elseif gitgutter#diff#is_modified(from_count, to_count) + call gitgutter#diff#process_modified(modifications, from_count, to_count, to_line) + call gitgutter#hunk#increment_lines_modified(to_count) + + elseif gitgutter#diff#is_modified_and_added(from_count, to_count) + call gitgutter#diff#process_modified_and_added(modifications, from_count, to_count, to_line) + call gitgutter#hunk#increment_lines_added(to_count - from_count) + call gitgutter#hunk#increment_lines_modified(from_count) + + elseif gitgutter#diff#is_modified_and_removed(from_count, to_count) + call gitgutter#diff#process_modified_and_removed(modifications, from_count, to_count, to_line) + call gitgutter#hunk#increment_lines_modified(to_count) + call gitgutter#hunk#increment_lines_removed(from_count - to_count) + + endif + return modifications +endfunction + +function! gitgutter#diff#is_added(from_count, to_count) abort + return a:from_count == 0 && a:to_count > 0 +endfunction + +function! gitgutter#diff#is_removed(from_count, to_count) abort + return a:from_count > 0 && a:to_count == 0 +endfunction + +function! gitgutter#diff#is_modified(from_count, to_count) abort + return a:from_count > 0 && a:to_count > 0 && a:from_count == a:to_count +endfunction + +function! gitgutter#diff#is_modified_and_added(from_count, to_count) abort + return a:from_count > 0 && a:to_count > 0 && a:from_count < a:to_count +endfunction + +function! gitgutter#diff#is_modified_and_removed(from_count, to_count) abort + return a:from_count > 0 && a:to_count > 0 && a:from_count > a:to_count +endfunction + +function! gitgutter#diff#process_added(modifications, from_count, to_count, to_line) abort + let offset = 0 + while offset < a:to_count + let line_number = a:to_line + offset + call add(a:modifications, [line_number, 'added']) + let offset += 1 + endwhile +endfunction + +function! gitgutter#diff#process_removed(modifications, from_count, to_count, to_line) abort + if a:to_line == 0 + call add(a:modifications, [1, 'removed_first_line']) + else + call add(a:modifications, [a:to_line, 'removed']) + endif +endfunction + +function! gitgutter#diff#process_modified(modifications, from_count, to_count, to_line) abort + let offset = 0 + while offset < a:to_count + let line_number = a:to_line + offset + call add(a:modifications, [line_number, 'modified']) + let offset += 1 + endwhile +endfunction + +function! gitgutter#diff#process_modified_and_added(modifications, from_count, to_count, to_line) abort + let offset = 0 + while offset < a:from_count + let line_number = a:to_line + offset + call add(a:modifications, [line_number, 'modified']) + let offset += 1 + endwhile + while offset < a:to_count + let line_number = a:to_line + offset + call add(a:modifications, [line_number, 'added']) + let offset += 1 + endwhile +endfunction + +function! gitgutter#diff#process_modified_and_removed(modifications, from_count, to_count, to_line) abort + let offset = 0 + while offset < a:to_count + let line_number = a:to_line + offset + call add(a:modifications, [line_number, 'modified']) + let offset += 1 + endwhile + let a:modifications[-1] = [a:to_line + offset - 1, 'modified_removed'] +endfunction + +" Generates a zero-context diff for the current hunk. +" +" diff - the full diff for the buffer +" type - stage | undo | preview +function! gitgutter#diff#generate_diff_for_hunk(diff, type) abort + let diff_for_hunk = gitgutter#diff#discard_hunks(a:diff, a:type == 'stage' || a:type == 'undo') + + if a:type == 'stage' || a:type == 'undo' + let diff_for_hunk = gitgutter#diff#adjust_hunk_summary(diff_for_hunk, a:type == 'stage') + endif + + return diff_for_hunk +endfunction + +" Returns the diff with all hunks discarded except the current. +" +" diff - the diff to process +" keep_header - truthy to keep the diff header and hunk summary, falsy to discard it +function! gitgutter#diff#discard_hunks(diff, keep_header) abort + let modified_diff = [] + let keep_line = a:keep_header + for line in split(a:diff, '\n') + let hunk_info = gitgutter#diff#parse_hunk(line) + if len(hunk_info) == 4 " start of new hunk + let keep_line = gitgutter#hunk#cursor_in_hunk(hunk_info) + endif + if keep_line + call add(modified_diff, line) + endif + endfor + + if a:keep_header + return gitgutter#utility#stringify(modified_diff) + else + " Discard hunk summary too. + return gitgutter#utility#stringify(modified_diff[1:]) + endif +endfunction + +" Adjust hunk summary (from's / to's line number) to ignore changes above/before this one. +" +" diff_for_hunk - a diff containing only the hunk of interest +" staging - truthy if the hunk is to be staged, falsy if it is to be undone +" +" TODO: push this down to #discard_hunks? +function! gitgutter#diff#adjust_hunk_summary(diff_for_hunk, staging) abort + let line_adjustment = gitgutter#hunk#line_adjustment_for_current_hunk() + let adj_diff = [] + for line in split(a:diff_for_hunk, '\n') + if match(line, s:hunk_re) != -1 + if a:staging + " increment 'to' line number + let line = substitute(line, '+\@<=\(\d\+\)', '\=submatch(1)+line_adjustment', '') + else + " decrement 'from' line number + let line = substitute(line, '-\@<=\(\d\+\)', '\=submatch(1)-line_adjustment', '') + endif + endif + call add(adj_diff, line) + endfor + return gitgutter#utility#stringify(adj_diff) +endfunction + diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/highlight.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/highlight.vim new file mode 100644 index 00000000..e3b774bc --- /dev/null +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/highlight.vim @@ -0,0 +1,115 @@ +function! gitgutter#highlight#define_sign_column_highlight() abort + if g:gitgutter_override_sign_column_highlight + highlight! link SignColumn LineNr + else + highlight default link SignColumn LineNr + endif +endfunction + +function! gitgutter#highlight#define_highlights() abort + let [guibg, ctermbg] = gitgutter#highlight#get_background_colors('SignColumn') + + " Highlights used by the signs. + + execute "highlight GitGutterAddDefault guifg=#009900 guibg=" . guibg . " ctermfg=2 ctermbg=" . ctermbg + execute "highlight GitGutterChangeDefault guifg=#bbbb00 guibg=" . guibg . " ctermfg=3 ctermbg=" . ctermbg + execute "highlight GitGutterDeleteDefault guifg=#ff2222 guibg=" . guibg . " ctermfg=1 ctermbg=" . ctermbg + highlight default link GitGutterChangeDeleteDefault GitGutterChangeDefault + + execute "highlight GitGutterAddInvisible guifg=bg guibg=" . guibg . " ctermfg=" . ctermbg . " ctermbg=" . ctermbg + execute "highlight GitGutterChangeInvisible guifg=bg guibg=" . guibg . " ctermfg=" . ctermbg . " ctermbg=" . ctermbg + execute "highlight GitGutterDeleteInvisible guifg=bg guibg=" . guibg . " ctermfg=" . ctermbg . " ctermbg=" . ctermbg + highlight default link GitGutterChangeDeleteInvisible GitGutterChangeInvisble + + highlight default link GitGutterAdd GitGutterAddDefault + highlight default link GitGutterChange GitGutterChangeDefault + highlight default link GitGutterDelete GitGutterDeleteDefault + highlight default link GitGutterChangeDelete GitGutterChangeDeleteDefault + + " Highlights used for the whole line. + + highlight default link GitGutterAddLine DiffAdd + highlight default link GitGutterChangeLine DiffChange + highlight default link GitGutterDeleteLine DiffDelete + highlight default link GitGutterChangeDeleteLine GitGutterChangeLine +endfunction + +function! gitgutter#highlight#define_signs() abort + sign define GitGutterLineAdded + sign define GitGutterLineModified + sign define GitGutterLineRemoved + sign define GitGutterLineRemovedFirstLine + sign define GitGutterLineModifiedRemoved + sign define GitGutterDummy + + call gitgutter#highlight#define_sign_text() + call gitgutter#highlight#define_sign_text_highlights() + call gitgutter#highlight#define_sign_line_highlights() +endfunction + +function! gitgutter#highlight#define_sign_text() abort + execute "sign define GitGutterLineAdded text=" . g:gitgutter_sign_added + execute "sign define GitGutterLineModified text=" . g:gitgutter_sign_modified + execute "sign define GitGutterLineRemoved text=" . g:gitgutter_sign_removed + execute "sign define GitGutterLineRemovedFirstLine text=" . g:gitgutter_sign_removed_first_line + execute "sign define GitGutterLineModifiedRemoved text=" . g:gitgutter_sign_modified_removed +endfunction + +function! gitgutter#highlight#define_sign_text_highlights() abort + " Once a sign's text attribute has been defined, it cannot be undefined or + " set to an empty value. So to make signs' text disappear (when toggling + " off or disabling) we make them invisible by setting their foreground colours + " to the background's. + if g:gitgutter_signs + sign define GitGutterLineAdded texthl=GitGutterAdd + sign define GitGutterLineModified texthl=GitGutterChange + sign define GitGutterLineRemoved texthl=GitGutterDelete + sign define GitGutterLineRemovedFirstLine texthl=GitGutterDelete + sign define GitGutterLineModifiedRemoved texthl=GitGutterChangeDelete + else + sign define GitGutterLineAdded texthl=GitGutterAddInvisible + sign define GitGutterLineModified texthl=GitGutterChangeInvisible + sign define GitGutterLineRemoved texthl=GitGutterDeleteInvisible + sign define GitGutterLineRemovedFirstLine texthl=GitGutterDeleteInvisible + sign define GitGutterLineModifiedRemoved texthl=GitGutterChangeDeleteInvisible + endif +endfunction + +function! gitgutter#highlight#define_sign_line_highlights() abort + if g:gitgutter_highlight_lines + sign define GitGutterLineAdded linehl=GitGutterAddLine + sign define GitGutterLineModified linehl=GitGutterChangeLine + sign define GitGutterLineRemoved linehl=GitGutterDeleteLine + sign define GitGutterLineRemovedFirstLine linehl=GitGutterDeleteLine + sign define GitGutterLineModifiedRemoved linehl=GitGutterChangeDeleteLine + else + sign define GitGutterLineAdded linehl= + sign define GitGutterLineModified linehl= + sign define GitGutterLineRemoved linehl= + sign define GitGutterLineRemovedFirstLine linehl= + sign define GitGutterLineModifiedRemoved linehl= + endif +endfunction + +function! gitgutter#highlight#get_background_colors(group) abort + redir => highlight + silent execute 'silent highlight ' . a:group + redir END + + let link_matches = matchlist(highlight, 'links to \(\S\+\)') + if len(link_matches) > 0 " follow the link + return gitgutter#highlight#get_background_colors(link_matches[1]) + endif + + let ctermbg = gitgutter#highlight#match_highlight(highlight, 'ctermbg=\([0-9A-Za-z]\+\)') + let guibg = gitgutter#highlight#match_highlight(highlight, 'guibg=\([#0-9A-Za-z]\+\)') + return [guibg, ctermbg] +endfunction + +function! gitgutter#highlight#match_highlight(highlight, pattern) abort + let matches = matchlist(a:highlight, a:pattern) + if len(matches) == 0 + return 'NONE' + endif + return matches[1] +endfunction diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim new file mode 100644 index 00000000..0fd02468 --- /dev/null +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim @@ -0,0 +1,137 @@ +let s:hunks = [] + +function! gitgutter#hunk#set_hunks(hunks) abort + let s:hunks = a:hunks +endfunction + +function! gitgutter#hunk#hunks() abort + return s:hunks +endfunction + +function! gitgutter#hunk#summary(bufnr) abort + return get(getbufvar(a:bufnr,''), 'gitgutter_summary', [0,0,0]) +endfunction + +function! gitgutter#hunk#reset() abort + call setbufvar(gitgutter#utility#bufnr(), 'gitgutter_summary', [0,0,0]) +endfunction + +function! gitgutter#hunk#increment_lines_added(count) abort + let bufnr = gitgutter#utility#bufnr() + let summary = gitgutter#hunk#summary(bufnr) + let summary[0] += a:count + call setbufvar(bufnr, 'gitgutter_summary', summary) +endfunction + +function! gitgutter#hunk#increment_lines_modified(count) abort + let bufnr = gitgutter#utility#bufnr() + let summary = gitgutter#hunk#summary(bufnr) + let summary[1] += a:count + call setbufvar(bufnr, 'gitgutter_summary', summary) +endfunction + +function! gitgutter#hunk#increment_lines_removed(count) abort + let bufnr = gitgutter#utility#bufnr() + let summary = gitgutter#hunk#summary(bufnr) + let summary[2] += a:count + call setbufvar(bufnr, 'gitgutter_summary', summary) +endfunction + +function! gitgutter#hunk#next_hunk(count) abort + if gitgutter#utility#is_active() + let current_line = line('.') + let hunk_count = 0 + for hunk in s:hunks + if hunk[2] > current_line + let hunk_count += 1 + if hunk_count == a:count + execute 'normal!' hunk[2] . 'G' + return + endif + endif + endfor + call gitgutter#utility#warn('No more hunks') + endif +endfunction + +function! gitgutter#hunk#prev_hunk(count) abort + if gitgutter#utility#is_active() + let current_line = line('.') + let hunk_count = 0 + for hunk in reverse(copy(s:hunks)) + if hunk[2] < current_line + let hunk_count += 1 + if hunk_count == a:count + let target = hunk[2] == 0 ? 1 : hunk[2] + execute 'normal!' target . 'G' + return + endif + endif + endfor + call gitgutter#utility#warn('No previous hunks') + endif +endfunction + +" Returns the hunk the cursor is currently in or an empty list if the cursor +" isn't in a hunk. +function! gitgutter#hunk#current_hunk() abort + let current_hunk = [] + + for hunk in s:hunks + if gitgutter#hunk#cursor_in_hunk(hunk) + let current_hunk = hunk + break + endif + endfor + + return current_hunk +endfunction + +function! gitgutter#hunk#cursor_in_hunk(hunk) abort + let current_line = line('.') + + if current_line == 1 && a:hunk[2] == 0 + return 1 + endif + + if current_line >= a:hunk[2] && current_line < a:hunk[2] + (a:hunk[3] == 0 ? 1 : a:hunk[3]) + return 1 + endif + + return 0 +endfunction + +" Returns the number of lines the current hunk is offset from where it would +" be if any changes above it in the file didn't exist. +function! gitgutter#hunk#line_adjustment_for_current_hunk() abort + let adj = 0 + for hunk in s:hunks + if gitgutter#hunk#cursor_in_hunk(hunk) + break + else + let adj += hunk[1] - hunk[3] + endif + endfor + return adj +endfunction + +function! gitgutter#hunk#text_object(inner) abort + let hunk = gitgutter#hunk#current_hunk() + + if empty(hunk) + return + endif + + let [first_line, last_line] = [hunk[2], hunk[2] + hunk[3] - 1] + + if ! a:inner + let lnum = last_line + let eof = line('$') + while lnum < eof && empty(getline(lnum + 1)) + let lnum +=1 + endwhile + let last_line = lnum + endif + + execute 'normal! 'first_line.'GV'.last_line.'G' +endfunction diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/sign.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/sign.vim new file mode 100644 index 00000000..7e1218d4 --- /dev/null +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/sign.vim @@ -0,0 +1,179 @@ +" Vim doesn't namespace sign ids so every plugin shares the same +" namespace. Sign ids are simply integers so to avoid clashes with other +" signs we guess at a clear run. +" +" Note also we currently never reset s:next_sign_id. +let s:first_sign_id = 3000 +let s:next_sign_id = s:first_sign_id +let s:dummy_sign_id = s:first_sign_id - 1 +" Remove-all-signs optimisation requires Vim 7.3.596+. +let s:supports_star = v:version > 703 || (v:version == 703 && has("patch596")) + + +" Removes gitgutter's signs (excluding dummy sign) from the buffer being processed. +function! gitgutter#sign#clear_signs() abort + let bufnr = gitgutter#utility#bufnr() + call gitgutter#sign#find_current_signs() + + let sign_ids = map(values(getbufvar(bufnr, 'gitgutter_gitgutter_signs')), 'v:val.id') + call gitgutter#sign#remove_signs(sign_ids, 1) + call setbufvar(bufnr, 'gitgutter_gitgutter_signs', {}) +endfunction + + +" Updates gitgutter's signs in the buffer being processed. +" +" modified_lines: list of [, ] +" where name = 'added|removed|modified|modified_removed' +function! gitgutter#sign#update_signs(modified_lines) abort + call gitgutter#sign#find_current_signs() + + let new_gitgutter_signs_line_numbers = map(copy(a:modified_lines), 'v:val[0]') + let obsolete_signs = gitgutter#sign#obsolete_gitgutter_signs_to_remove(new_gitgutter_signs_line_numbers) + + let flicker_possible = s:remove_all_old_signs && !empty(a:modified_lines) + if flicker_possible + call gitgutter#sign#add_dummy_sign() + endif + + call gitgutter#sign#remove_signs(obsolete_signs, s:remove_all_old_signs) + call gitgutter#sign#upsert_new_gitgutter_signs(a:modified_lines) + + if flicker_possible + call gitgutter#sign#remove_dummy_sign(0) + endif +endfunction + + +function! gitgutter#sign#add_dummy_sign() abort + let bufnr = gitgutter#utility#bufnr() + if !getbufvar(bufnr, 'gitgutter_dummy_sign') + execute "sign place" s:dummy_sign_id "line=" . 9999 "name=GitGutterDummy buffer=" . bufnr + call setbufvar(bufnr, 'gitgutter_dummy_sign', 1) + endif +endfunction + +function! gitgutter#sign#remove_dummy_sign(force) abort + let bufnr = gitgutter#utility#bufnr() + if getbufvar(bufnr, 'gitgutter_dummy_sign') && (a:force || !g:gitgutter_sign_column_always) + execute "sign unplace" s:dummy_sign_id "buffer=" . bufnr + call setbufvar(bufnr, 'gitgutter_dummy_sign', 0) + endif +endfunction + + +" +" Internal functions +" + + +function! gitgutter#sign#find_current_signs() abort + let bufnr = gitgutter#utility#bufnr() + let gitgutter_signs = {} " : {'id': , 'name': } + let other_signs = [] " [ signs + silent execute "sign place buffer=" . bufnr + redir END + + for sign_line in filter(split(signs, '\n')[2:], 'v:val =~# "="') + " Typical sign line: line=88 id=1234 name=GitGutterLineAdded + " We assume splitting is faster than a regexp. + let components = split(sign_line) + let name = split(components[2], '=')[1] + if name =~# 'GitGutterDummy' + let dummy_sign_placed = 1 + else + let line_number = str2nr(split(components[0], '=')[1]) + if name =~# 'GitGutter' + let id = str2nr(split(components[1], '=')[1]) + " Remove orphaned signs (signs placed on lines which have been deleted). + " (When a line is deleted its sign lingers. Subsequent lines' signs' + " line numbers are decremented appropriately.) + if has_key(gitgutter_signs, line_number) + execute "sign unplace" gitgutter_signs[line_number].id + endif + let gitgutter_signs[line_number] = {'id': id, 'name': name} + else + call add(other_signs, line_number) + endif + end + endfor + + call setbufvar(bufnr, 'gitgutter_dummy_sign', dummy_sign_placed) + call setbufvar(bufnr, 'gitgutter_gitgutter_signs', gitgutter_signs) + call setbufvar(bufnr, 'gitgutter_other_signs', other_signs) +endfunction + + +" Returns a list of [, ...] +" Sets `s:remove_all_old_signs` as a side-effect. +function! gitgutter#sign#obsolete_gitgutter_signs_to_remove(new_gitgutter_signs_line_numbers) abort + let bufnr = gitgutter#utility#bufnr() + let signs_to_remove = [] " list of [, ...] + let remove_all_signs = 1 + let old_gitgutter_signs = getbufvar(bufnr, 'gitgutter_gitgutter_signs') + for line_number in keys(old_gitgutter_signs) + if index(a:new_gitgutter_signs_line_numbers, str2nr(line_number)) == -1 + call add(signs_to_remove, old_gitgutter_signs[line_number].id) + else + let remove_all_signs = 0 + endif + endfor + let s:remove_all_old_signs = remove_all_signs + return signs_to_remove +endfunction + + +function! gitgutter#sign#remove_signs(sign_ids, all_signs) abort + let bufnr = gitgutter#utility#bufnr() + if a:all_signs && s:supports_star && empty(getbufvar(bufnr, 'gitgutter_other_signs')) + let dummy_sign_present = getbufvar(bufnr, 'gitgutter_dummy_sign') + execute "sign unplace * buffer=" . bufnr + if dummy_sign_present + execute "sign place" s:dummy_sign_id "line=" . 9999 "name=GitGutterDummy buffer=" . bufnr + endif + else + for id in a:sign_ids + execute "sign unplace" id + endfor + endif +endfunction + + +function! gitgutter#sign#upsert_new_gitgutter_signs(modified_lines) abort + let bufnr = gitgutter#utility#bufnr() + let other_signs = getbufvar(bufnr, 'gitgutter_other_signs') + let old_gitgutter_signs = getbufvar(bufnr, 'gitgutter_gitgutter_signs') + + for line in a:modified_lines + let line_number = line[0] " + if index(other_signs, line_number) == -1 " don't clobber others' signs + let name = gitgutter#utility#highlight_name_for_change(line[1]) + if !has_key(old_gitgutter_signs, line_number) " insert + let id = gitgutter#sign#next_sign_id() + execute "sign place" id "line=" . line_number "name=" . name "buffer=" . bufnr + else " update if sign has changed + let old_sign = old_gitgutter_signs[line_number] + if old_sign.name !=# name + execute "sign place" old_sign.id "name=" . name "buffer=" . bufnr + end + endif + endif + endfor + " At this point b:gitgutter_gitgutter_signs is out of date. +endfunction + + +function! gitgutter#sign#next_sign_id() abort + let next_id = s:next_sign_id + let s:next_sign_id += 1 + return next_id +endfunction + + +" Only for testing. +function! gitgutter#sign#reset() + let s:next_sign_id = s:first_sign_id +endfunction diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim new file mode 100644 index 00000000..77ad2dc2 --- /dev/null +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim @@ -0,0 +1,212 @@ +let s:file = '' +let s:using_xolox_shell = -1 +let s:exit_code = 0 + +function! gitgutter#utility#warn(message) abort + echohl WarningMsg + echo 'vim-gitgutter: ' . a:message + echohl None + let v:warningmsg = a:message +endfunction + +function! gitgutter#utility#warn_once(message, key) abort + if empty(getbufvar(s:bufnr, a:key)) + call setbufvar(s:bufnr, a:key, '1') + echohl WarningMsg + redraw | echo 'vim-gitgutter: ' . a:message + echohl None + let v:warningmsg = a:message + endif +endfunction + +" Returns truthy when the buffer's file should be processed; and falsey when it shouldn't. +" This function does not and should not make any system calls. +function! gitgutter#utility#is_active() abort + return g:gitgutter_enabled && + \ !pumvisible() && + \ gitgutter#utility#is_file_buffer() && + \ gitgutter#utility#exists_file() && + \ gitgutter#utility#not_git_dir() +endfunction + +function! gitgutter#utility#not_git_dir() abort + return gitgutter#utility#full_path_to_directory_of_file() !~ '[/\\]\.git\($\|[/\\]\)' +endfunction + +function! gitgutter#utility#is_file_buffer() abort + return empty(getbufvar(s:bufnr, '&buftype')) +endfunction + +" A replacement for the built-in `shellescape(arg)`. +" +" Recent versions of Vim handle shell escaping pretty well. However older +" versions aren't as good. This attempts to do the right thing. +" +" See: +" https://github.com/tpope/vim-fugitive/blob/8f0b8edfbd246c0026b7a2388e1d883d579ac7f6/plugin/fugitive.vim#L29-L37 +function! gitgutter#utility#shellescape(arg) abort + if a:arg =~ '^[A-Za-z0-9_/.-]\+$' + return a:arg + elseif &shell =~# 'cmd' || gitgutter#utility#using_xolox_shell() + return '"' . substitute(substitute(a:arg, '"', '""', 'g'), '%', '"%"', 'g') . '"' + else + return shellescape(a:arg) + endif +endfunction + +function! gitgutter#utility#set_buffer(bufnr) abort + let s:bufnr = a:bufnr + let s:file = resolve(bufname(a:bufnr)) +endfunction + +function! gitgutter#utility#bufnr() + return s:bufnr +endfunction + +function! gitgutter#utility#file() + return s:file +endfunction + +function! gitgutter#utility#filename() abort + return fnamemodify(s:file, ':t') +endfunction + +function! gitgutter#utility#extension() abort + return fnamemodify(s:file, ':e') +endfunction + +function! gitgutter#utility#full_path_to_directory_of_file() abort + return fnamemodify(s:file, ':p:h') +endfunction + +function! gitgutter#utility#directory_of_file() abort + return fnamemodify(s:file, ':h') +endfunction + +function! gitgutter#utility#exists_file() abort + return filereadable(s:file) +endfunction + +function! gitgutter#utility#has_unsaved_changes() abort + return getbufvar(s:bufnr, "&mod") +endfunction + +function! gitgutter#utility#has_fresh_changes() abort + return getbufvar(s:bufnr, 'changedtick') != getbufvar(s:bufnr, 'gitgutter_last_tick') +endfunction + +function! gitgutter#utility#save_last_seen_change() abort + call setbufvar(s:bufnr, 'gitgutter_last_tick', getbufvar(s:bufnr, 'changedtick')) +endfunction + +function! gitgutter#utility#shell_error() abort + return gitgutter#utility#using_xolox_shell() ? s:exit_code : v:shell_error +endfunction + +function! gitgutter#utility#using_xolox_shell() abort + if s:using_xolox_shell == -1 + if !g:gitgutter_avoid_cmd_prompt_on_windows + let s:using_xolox_shell = 0 + " Although xolox/vim-shell works on both windows and unix we only want to use + " it on windows. + elseif has('win32') || has('win64') || has('win32unix') + let s:using_xolox_shell = exists('g:xolox#misc#version') && exists('g:xolox#shell#version') + else + let s:using_xolox_shell = 0 + endif + endif + return s:using_xolox_shell +endfunction + +function! gitgutter#utility#system(cmd, ...) abort + call gitgutter#debug#log(a:cmd, a:000) + + if gitgutter#utility#using_xolox_shell() + let options = {'command': a:cmd, 'check': 0} + if a:0 > 0 + let options['stdin'] = a:1 + endif + let ret = xolox#misc#os#exec(options) + let output = join(ret.stdout, "\n") + let s:exit_code = ret.exit_code + else + silent let output = (a:0 == 0) ? system(a:cmd) : system(a:cmd, a:1) + endif + return output +endfunction + +function! gitgutter#utility#file_relative_to_repo_root() abort + let file_path_relative_to_repo_root = getbufvar(s:bufnr, 'gitgutter_repo_relative_path') + if empty(file_path_relative_to_repo_root) + let dir_path_relative_to_repo_root = gitgutter#utility#system(gitgutter#utility#command_in_directory_of_file(g:gitgutter_git_executable.' rev-parse --show-prefix')) + let dir_path_relative_to_repo_root = gitgutter#utility#strip_trailing_new_line(dir_path_relative_to_repo_root) + let file_path_relative_to_repo_root = dir_path_relative_to_repo_root . gitgutter#utility#filename() + call setbufvar(s:bufnr, 'gitgutter_repo_relative_path', file_path_relative_to_repo_root) + endif + return file_path_relative_to_repo_root +endfunction + +function! gitgutter#utility#command_in_directory_of_file(cmd) abort + return 'cd '.gitgutter#utility#shellescape(gitgutter#utility#directory_of_file()).' && '.a:cmd +endfunction + +function! gitgutter#utility#highlight_name_for_change(text) abort + if a:text ==# 'added' + return 'GitGutterLineAdded' + elseif a:text ==# 'removed' + return 'GitGutterLineRemoved' + elseif a:text ==# 'removed_first_line' + return 'GitGutterLineRemovedFirstLine' + elseif a:text ==# 'modified' + return 'GitGutterLineModified' + elseif a:text ==# 'modified_removed' + return 'GitGutterLineModifiedRemoved' + endif +endfunction + +" Dedups list in-place. +" Assumes list has no empty entries. +function! gitgutter#utility#dedup(list) + return filter(sort(a:list), 'index(a:list, v:val, v:key + 1) == -1') +endfunction + +function! gitgutter#utility#strip_trailing_new_line(line) abort + return substitute(a:line, '\n$', '', '') +endfunction + +function! gitgutter#utility#git_version() abort + return matchstr(system(g:gitgutter_git_executable.' --version'), '[0-9.]\+') +endfunction + +" True for git v1.7.2+. +function! gitgutter#utility#git_supports_command_line_config_override() abort + let [major, minor, patch; _] = split(gitgutter#utility#git_version(), '\.') + return major > 1 || (major == 1 && minor > 7) || (minor == 7 && patch > 1) +endfunction + +function! gitgutter#utility#stringify(list) abort + return join(a:list, "\n")."\n" +endfunction + +function! gitgutter#utility#use_known_shell() abort + if has('unix') + if &shell !=# 'sh' + let s:shell = &shell + let s:shellcmdflag = &shellcmdflag + let s:shellredir = &shellredir + let &shell = 'sh' + set shellcmdflag=-c + set shellredir=>%s\ 2>&1 + endif + endif +endfunction + +function! gitgutter#utility#restore_shell() abort + if has('unix') + if exists('s:shell') + let &shell = s:shell + let &shellcmdflag = s:shellcmdflag + let &shellredir = s:shellredir + endif + endif +endfunction diff --git a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt new file mode 100644 index 00000000..d4bb7747 --- /dev/null +++ b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt @@ -0,0 +1,340 @@ +*gitgutter.txt* A Vim plugin which shows a git diff in the gutter. + + + Vim Git Gutter + + +Author: Andy Stewart +Plugin Homepage: + +=============================================================================== +CONTENTS *GitGutterContents* + + 1. Introduction ................. |GitGutterIntroduction| + 2. Installation ................. |GitGutterInstallation| + 3. Usage ........................ |GitGutterUsage| + 4. Commands ..................... |GitGutterCommands| + 5. Autocommand .................. |GitGutterAutocmd| + 6. CUSTOMISATION................. |GitGutterCustomisation| + 7. FAQ .......................... |GitGutterFAQ| + +=============================================================================== +1. INTRODUCTION *GitGutterIntroduction* + *GitGutter* + +Vim Git Gutter is a Vim plugin which shows a git diff in the 'gutter' (sign +column). It shows whether each line has been added, modified, and where lines +have been removed. + +This is a port of the Git Gutter plugin for Sublime Text 2. + +=============================================================================== +2. INSTALLATION *GitGutterInstallation* + +* Pathogen: +> + cd ~/.vim/bundle + git clone git://github.com/airblade/vim-gitgutter.git +< +* Voom: + +Edit your plugin manifest (`voom edit`) and add: +> + airblade/vim-gitgutter +< +* VimPlug: + +Place this in your .vimrc: +> + Plug 'airblade/vim-gitgutter' +< +Then run the following in Vim: +> + :source % + :PlugInstall +< +* NeoBundle: + +Place this in your .vimrc: +> + NeoBundle 'airblade/vim-gitgutter' +< +Then run the following in Vim: +> + :source % + :NeoBundleInstall +< +* No plugin manager: + +Copy vim-gitgutter's subdirectories into your vim configuration directory: +> + cd tmp && git clone git://github.com/airblade/vim-gitgutter.git + cp vim-gitgutter/* ~/.vim/ +< +See |add-global-plugin|. + +=============================================================================== +3. USAGE *GitGutterUsage* + +You don't have to do anything: it just works. + +=============================================================================== +4. COMMANDS *GitGutterCommands* + +Commands for turning Git Gutter on and off: + + :GitGutterDisable *:GitGutterDisable* + Explicitly turn Git Gutter off. + + :GitGutterEnable *:GitGutterEnable* + Explicitly turn Git Gutter on. + + :GitGutterToggle *:GitGutterToggle* + Explicitly turn Git Gutter on if it was off and vice versa. + + :GitGutter *:GitGutter* + Update signs for the current buffer. + + :GitGutterAll *:GitGutterAll* + Update signs across all buffers. + +Commands for turning signs on and off (defaults to on): + + :GitGutterSignsEnable *:GitGutterSignsEnable* + Explicitly turn line signs on. + + :GitGutterSignsDisable *:GitGutterSignsDisable* + Explicitly turn line signs off. + + :GitGutterSignsToggle *:GitGutterSignsToggle* + Explicitly turn line signs on if it was off and vice versa. + +Commands for turning line highlighting on and off (defaults to off): + + :GitGutterLineHighlightsEnable *:GitGutterLineHighlightsEnable* + Explicitly turn line highlighting on. + + :GitGutterLineHighlightsDisable *:GitGutterLineHighlightsDisable* + Explicitly turn line highlighting off. + + :GitGutterLineHighlightsToggle *:GitGutterLineHighlightsToggle* + Explicitly turn line highlighting on if it was off and vice versa. + +Commands for jumping between marked hunks: + + :GitGutterNextHunk *:GitGutterNextHunk* + Jump to the next marked hunk. Takes a count. + + :GitGutterPrevHunk *:GitGutterPrevHunk* + Jump to the previous marked hunk. Takes a count. + +Commands for staging or undoing individual hunks: + + :GitGutterStageHunk *:GitGutterStageHunk* + Stage the hunk the cursor is in. + + :GitGutterUndoHunk *:GitGutterUndoHunk* + Undo the hunk the cursor is in. + + :GitGutterPreviewHunk *:GitGutterPreviewHunk* + Preview the hunk the cursor is in. + +=============================================================================== +5. AUTOCOMMAND *GitGutterAutocmd* + +After updating a buffer's signs vim-gitgutter fires a |User| |autocmd| with the +event GitGutter. You can listen for this event, for example: +> + autocmd User GitGutter call updateMyStatusLine() +< + +=============================================================================== +6. CUSTOMISATION *GitGutterCustomisation* + +You can customise: + +- The sign column's colours +- The signs' colours and symbols +- Line highlights +- The base of the diff +- Extra arguments for git-diff +- Key mappings +- The grep executable used +- Whether or not vim-gitgutter is on initially (defaults to on) +- Whether or not signs are shown (defaults to yes) +- Whether or not line highlighting is on initially (defaults to off) +- Whether or not vim-gitgutter runs in realtime (defaults to yes) +- Whether or not vim-gitgutter runs eagerly (defaults to yes) +- Whether or not vim-gitgutter runs asynchronously (defaults to yes) + +Please note that vim-gitgutter won't override any colours or highlights you've +set in your colorscheme. + +SIGN COLUMN + +By default vim-gitgutter will make the sign column look like the line number +column (i.e. the |hl-LineNr| highlight group). + +To customise your sign column's background color, first tell vim-gitgutter to +leave it alone: +> + let g:gitgutter_override_sign_column_highlight = 0 +< + +And then either update your colorscheme's |hlSignColumn| highlight group or set +it in your |vimrc|: + + Desired appearance Command ~ + Same as line number column highlight clear SignColumn + User-defined (terminal Vim) highlight SignColumn ctermbg={whatever} + User-defined (graphical Vim) highlight SignColumn guibg={whatever} + +SIGNS' COLOURS AND SYMBOLS + +To customise the colours, set up the following highlight groups in your +colorscheme or |vimrc|: + +> + GitGutterAdd " an added line + GitGutterChange " a changed line + GitGutterDelete " at least one removed line + GitGutterChangeDelete " a changed line followed by at least one removed line +< + +You can either set these with `highlight GitGutterAdd {key}={arg}...` or link +them to existing highlight groups with, say: +> + highlight link GitGutterAdd DiffAdd +< + +To customise the symbols, add the following to your |vimrc|: +> + let g:gitgutter_sign_added = 'xx' + let g:gitgutter_sign_modified = 'yy' + let g:gitgutter_sign_removed = 'zz' + let g:gitgutter_sign_modified_removed = 'ww' +< + +LINE HIGHLIGHTS + +Similarly to the signs' colours, set up the following highlight groups in your +colorscheme or |vimrc|: +> + GitGutterAddLine " default: links to DiffAdd + GitGutterChangeLine " default: links to DiffChange + GitGutterDeleteLine " default: links to DiffDelete + GitGutterChangeDeleteLine " default: links to GitGutterChangeLineDefault +< + +THE BASE OF THE DIFF + +By default buffers are diffed against the index. To diff against a commit +instead: +> + let g:gitgutter_diff_base = '' +< + +EXTRA ARGUMENTS FOR GIT-DIFF + +To pass extra arguments to git-diff, add this to your |vimrc|: +> + let g:gitgutter_diff_args = '-w' +< + +KEY MAPPINGS + +To disable all key maps: +> + let g:gitgutter_map_keys = 0 +< + +To change the hunk-jumping maps (defaults shown): +> + nmap [c GitGutterPrevHunk + nmap ]c GitGutterNextHunk +< + +To change the hunk-staging/undoing/previewing maps (defaults shown): +> + nmap hs GitGutterStageHunk + nmap hu GitGutterUndoHunk + nmap hp GitGutterPreviewHunk +< + +To change the hunk text object maps (defaults shown): +> + omap ic GitGutterTextObjectInnerPending + omap ac GitGutterTextObjectOuterPending + xmap ic GitGutterTextObjectInnerVisual + xmap ac GitGutterTextObjectOuterVisual +< + +TO USE A CUSTOM GREP COMMAND + +To use a custom invocation for grep, use this: +> + let g:gitgutter_grep_command = 'grep --color=never -e' +< + +TO TURN OFF VIM-GITGUTTER BY DEFAULT + +Add to your |vimrc| +> + let g:gitgutter_enabled = 0 +< + +TO TURN OFF SIGNS BY DEFAULT + +Add to your |vimrc| +> + let g:gitgutter_signs = 0 +< + +Note that the sign column will still be present if you have line highlighting +switched on. + +TO TURN ON LINE HIGHLIGHTING BY DEFAULT + +Add to your |vimrc| +> + let g:gitgutter_highlight_lines = 1 +< + +TO STOP VIM-GITGUTTER RUNNING IN REALTIME + +Add to your |vimrc| +> + let g:gitgutter_realtime = 0 +< + +TO STOP VIM-GITGUTTER RUNNING EAGERLY + +Add to your |vimrc| +> + let g:gitgutter_eager = 0 +< + +TO TURN OFF ASYNCHRONOUS UPDATES + +By default diffs are run asynchronously. To run diffs synchronously +instead: + +Add to your |vimrc| +> +let g:gitgutter_async = 0 +< + +=============================================================================== +7. FAQ *GitGutterFAQ* + +a. Why are the colours in the sign column weird? + + Your colorscheme is configuring the |hl-SignColumn| highlight group weirdly. + Please see |GitGutterCustomisation| on customising the sign column. + +b. What happens if I also use another plugin which uses signs (e.g. Syntastic)? + + Vim only allows one sign per line. Before adding a sign to a line, + vim-gitgutter checks whether a sign has already been added by somebody else. + If so it doesn't do anything. In other words vim-gitgutter won't overwrite + another plugin's signs. It also won't remove another plugin's signs. diff --git a/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim b/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim new file mode 100644 index 00000000..eeaffb15 --- /dev/null +++ b/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim @@ -0,0 +1,241 @@ +scriptencoding utf-8 + +if exists('g:loaded_gitgutter') || !has('signs') || &cp + finish +endif +let g:loaded_gitgutter = 1 + +" Initialisation {{{ + +" Realtime sign updates require Vim 7.3.105+. +if v:version < 703 || (v:version == 703 && !has("patch105")) + let g:gitgutter_realtime = 0 +endif + +" Eager updates require gettabvar()/settabvar(). +if !exists("*gettabvar") + let g:gitgutter_eager = 0 +endif + +function! s:set(var, default) abort + if !exists(a:var) + if type(a:default) + execute 'let' a:var '=' string(a:default) + else + execute 'let' a:var '=' a:default + endif + endif +endfunction + +call s:set('g:gitgutter_enabled', 1) +call s:set('g:gitgutter_max_signs', 500) +call s:set('g:gitgutter_signs', 1) +call s:set('g:gitgutter_highlight_lines', 0) +call s:set('g:gitgutter_sign_column_always', 0) +call s:set('g:gitgutter_override_sign_column_highlight', 1) +call s:set('g:gitgutter_realtime', 1) +call s:set('g:gitgutter_eager', 1) +call s:set('g:gitgutter_sign_added', '+') +call s:set('g:gitgutter_sign_modified', '~') +call s:set('g:gitgutter_sign_removed', '_') +try + call s:set('g:gitgutter_sign_removed_first_line', '‾') +catch /E239/ + let g:gitgutter_sign_removed_first_line = '_^' +endtry + +call s:set('g:gitgutter_sign_modified_removed', '~_') +call s:set('g:gitgutter_diff_args', '') +call s:set('g:gitgutter_diff_base', '') +call s:set('g:gitgutter_map_keys', 1) +call s:set('g:gitgutter_avoid_cmd_prompt_on_windows', 1) +call s:set('g:gitgutter_async', 1) +call s:set('g:gitgutter_log', 0) +call s:set('g:gitgutter_git_executable', 'git') + +if !executable(g:gitgutter_git_executable) + call gitgutter#utility#warn('cannot find git. Please set g:gitgutter_git_executable.') +endif + +call gitgutter#highlight#define_sign_column_highlight() +call gitgutter#highlight#define_highlights() +call gitgutter#highlight#define_signs() + +" }}} + +" Primary functions {{{ + +command -bar GitGutterAll call gitgutter#all() +command -bar GitGutter call gitgutter#process_buffer(bufnr(''), 0) + +command -bar GitGutterDisable call gitgutter#disable() +command -bar GitGutterEnable call gitgutter#enable() +command -bar GitGutterToggle call gitgutter#toggle() + +" }}} + +" Line highlights {{{ + +command -bar GitGutterLineHighlightsDisable call gitgutter#line_highlights_disable() +command -bar GitGutterLineHighlightsEnable call gitgutter#line_highlights_enable() +command -bar GitGutterLineHighlightsToggle call gitgutter#line_highlights_toggle() + +" }}} + +" Signs {{{ + +command -bar GitGutterSignsEnable call gitgutter#signs_enable() +command -bar GitGutterSignsDisable call gitgutter#signs_disable() +command -bar GitGutterSignsToggle call gitgutter#signs_toggle() + +" }}} + +" Hunks {{{ + +command -bar -count=1 GitGutterNextHunk call gitgutter#hunk#next_hunk() +command -bar -count=1 GitGutterPrevHunk call gitgutter#hunk#prev_hunk() + +command -bar GitGutterStageHunk call gitgutter#stage_hunk() +command -bar GitGutterUndoHunk call gitgutter#undo_hunk() +command -bar GitGutterRevertHunk echomsg 'GitGutterRevertHunk is deprecated. Use GitGutterUndoHunk'call gitgutter#undo_hunk() +command -bar GitGutterPreviewHunk call gitgutter#preview_hunk() + +" Hunk text object +onoremap GitGutterTextObjectInnerPending :call gitgutter#hunk#text_object(1) +onoremap GitGutterTextObjectOuterPending :call gitgutter#hunk#text_object(0) +xnoremap GitGutterTextObjectInnerVisual :call gitgutter#hunk#text_object(1) +xnoremap GitGutterTextObjectOuterVisual :call gitgutter#hunk#text_object(0) + + +" Returns the git-diff hunks for the file or an empty list if there +" aren't any hunks. +" +" The return value is a list of lists. There is one inner list per hunk. +" +" [ +" [from_line, from_count, to_line, to_count], +" [from_line, from_count, to_line, to_count], +" ... +" ] +" +" where: +" +" `from` - refers to the staged file +" `to` - refers to the working tree's file +" `line` - refers to the line number where the change starts +" `count` - refers to the number of lines the change covers +function! GitGutterGetHunks() + return gitgutter#utility#is_active() ? gitgutter#hunk#hunks() : [] +endfunction + +" Returns an array that contains a summary of the hunk status for the current +" window. The format is [ added, modified, removed ], where each value +" represents the number of lines added/modified/removed respectively. +function! GitGutterGetHunkSummary() + return gitgutter#hunk#summary(winbufnr(0)) +endfunction + +" }}} + +command -bar GitGutterDebug call gitgutter#debug#debug() + +" Maps {{{ + +nnoremap GitGutterNextHunk &diff ? ']c' : ":\execute v:count1 . 'GitGutterNextHunk'\" +nnoremap GitGutterPrevHunk &diff ? '[c' : ":\execute v:count1 . 'GitGutterPrevHunk'\" + +if g:gitgutter_map_keys + if !hasmapto('GitGutterPrevHunk') && maparg('[c', 'n') ==# '' + nmap [c GitGutterPrevHunk + endif + if !hasmapto('GitGutterNextHunk') && maparg(']c', 'n') ==# '' + nmap ]c GitGutterNextHunk + endif +endif + + +nnoremap GitGutterStageHunk :GitGutterStageHunk +nnoremap GitGutterUndoHunk :GitGutterUndoHunk +nnoremap GitGutterPreviewHunk :GitGutterPreviewHunk + +if g:gitgutter_map_keys + if !hasmapto('GitGutterStageHunk') && maparg('hs', 'n') ==# '' + nmap hs GitGutterStageHunk + endif + if !hasmapto('GitGutterUndoHunk') && maparg('hu', 'n') ==# '' + nmap hu GitGutterUndoHunk + nmap hr GitGutterUndoHunk:echomsg 'hr is deprecated. Use hu' + endif + if !hasmapto('GitGutterPreviewHunk') && maparg('hp', 'n') ==# '' + nmap hp GitGutterPreviewHunk + endif + + if !hasmapto('GitGutterTextObjectInnerPending') && maparg('ic', 'o') ==# '' + omap ic GitGutterTextObjectInnerPending + endif + if !hasmapto('GitGutterTextObjectOuterPending') && maparg('ac', 'o') ==# '' + omap ac GitGutterTextObjectOuterPending + endif + if !hasmapto('GitGutterTextObjectInnerVisual') && maparg('ic', 'x') ==# '' + xmap ic GitGutterTextObjectInnerVisual + endif + if !hasmapto('GitGutterTextObjectOuterVisual') && maparg('ac', 'x') ==# '' + xmap ac GitGutterTextObjectOuterVisual + endif +endif + +" }}} + +" Autocommands {{{ + +augroup gitgutter + autocmd! + + if g:gitgutter_realtime + autocmd CursorHold,CursorHoldI * call gitgutter#process_buffer(bufnr(''), 1) + endif + + if g:gitgutter_eager + autocmd BufWritePost,FileChangedShellPost * call gitgutter#process_buffer(bufnr(''), 0) + + " When you enter a new tab, BufEnter is only fired if the buffer you enter + " is not the one you came from. + " + " For example: + " + " `:tab split` fires TabEnter but not BufEnter. + " `:tab new` fires TabEnter and BufEnter. + " + " As and when both TabEnter and BufEnter are fired, we do not want to + " process the entered buffer twice. We avoid this by setting and clearing + " a flag. + + autocmd BufEnter * + \ if gettabvar(tabpagenr(), 'gitgutter_didtabenter') | + \ call settabvar(tabpagenr(), 'gitgutter_didtabenter', 0) | + \ else | + \ call gitgutter#process_buffer(bufnr(''), 0) | + \ endif + + autocmd TabEnter * + \ call settabvar(tabpagenr(), 'gitgutter_didtabenter', 1) | + \ call gitgutter#all() + + if !has('gui_win32') + autocmd FocusGained * call gitgutter#all() + endif + + else + autocmd BufRead,BufWritePost,FileChangedShellPost * call gitgutter#process_buffer(bufnr(''), 0) + endif + + autocmd ColorScheme * call gitgutter#highlight#define_sign_column_highlight() | call gitgutter#highlight#define_highlights() + + " Disable during :vimgrep + autocmd QuickFixCmdPre *vimgrep* let g:gitgutter_enabled = 0 + autocmd QuickFixCmdPost *vimgrep* let g:gitgutter_enabled = 1 +augroup END + +" }}} + +" vim:set et sw=2 fdm=marker: diff --git a/sources_non_forked/vim-gitgutter/screenshot.png b/sources_non_forked/vim-gitgutter/screenshot.png new file mode 100644 index 0000000000000000000000000000000000000000..6b50f839ec91fd623e1191f8ada8c823740be041 GIT binary patch literal 16191 zcmZX*Wmwx?vpr0Uw79z#cb5VIikIS6+}(>iv`BF+E}=lN;>F#iSfIEU0t5&a+TSb`0LTvDDd?t8#fXG z0nO4*T3Ss(TAD`9&BfZz(Fy_KeN;pGD>VW=vLO?1RjjZ~GbDNpVF*St7~w-a<5$vN zoI%&uXy$T;J%q9{NHc_n^vumD@8&*#HrGcY#|i|Ap~v*NgATO$NG$GP$KIY&pG}$tQZYK33{co%?q>Ev^ z(qV#;ZW|aw<8HGU@}Se3YKss=BlV+~pWkhKl5s^yyqf~B<&sCty$P0D)a?eNBYfX2 zJm`*toTvf!j3k78XEBHiD<~h*MO>e>`20EtHT@c4&9b{T@)DcDY5=TPVEpAuhU1HofH^9*O6 z8Y>Ve{ipT^h;9lI3GWcgp5)PbCni?*F~^{jIQ8h2DTqfRRZK!>lQr*#>NDG4#21k- zet$;P?M82Ykw{i2=xM!CRUSr48)O*3I!Y?$%5%%!_}QTp#48}kbC-8~^`yz??Uc5* z^5hpm!?8k=_w6e8sw-ffS?raBJ6n%;5&U`+xc4=zX-I$&4RG?UZH{Cktk3IzoX?K zl)R&Ri_IBY{+Dt0rPyCwoX|HXFJnU$xRE7ss0yS!-eYNe<);xFCiwN0g2sE87%hzU zJ2NvD-a9)rqI$xSP_*xOyRWq{ACPiGIi=_Gop)dGBg9En=O=K#)HFq@cUdLrC6 zA0X;@Lt(iO9FmB|(g(97M+t*)acTA!zDl{()ON14T)6htnE? zFa9Q^$eggoPuGB*oIF0Ruc~LqG^QqXp>Ba~f$9Lq3ooLN$5sC=TMjYj%k<9%5zA4c zk>x`Te_LHcn^6H&ToLnq%ixC-iU3yeSHTFu6v3#$uOz~PRcY{3P>YeUrRXK!El4rb z&fsw39pQXM)s$f=K$%M0mEXeUi@fPC?6=-@+Qe~|G zSmI|;$~4N{H3Bv8|9IHp+ez$M?&baw_%mN5Z|jrAIG#ILXf@4h>r^i(BBfK<_NV2% z^1Sez?feZ&eExtbA0CNsEPkxYU^9mDpdq7{b){0-7&0jjzL`Dm;uyWP_!&W6`i<+C z&6f~l9&|7EQiD%6J)(=@zf^wl{A&4i@k{I%^|r3tkz16T{}$Oc)u_dm=QiTj{4jNL z7p+8NV(p~!8*j6tUQKjr)^4;`v@d8-0#*WN7A0m@7C%-rLTu(nmUtGP)SMK&6tq-M z);QMbRLYc_k?@i9l)O4i-H8hNk38kM0#yayH;a;s-DHY1tv+Zg3dnfI*mvw(2qb4U z=vV0H>z6MzxBj{{zhJ-6zlb1{!E}i8iF+WUBs=DB;P2yaauBqSxBYEj+rZmk-*DSd zwiLfq-Z0v5y!Y3m!V}LEYu{t9x0R?B)>_osbYUu{DAu_q+2I^m(HYnIuFJ3s^x6Ec zW1_Q~1Gnig|GB`5`GW2BpZBZGe{2)fBc_Ng(82WJ!odV3TgEj;1Enlwc8YeUcAh}r(z;*C zg#dX)T+Fy!_L(5HBZrfwlj`E5nT=_>t&WAzulEk>V+DmVD2LjI!k6*~16b@4%n{TS z{qd~v6hm%9B`WqRfRYa-W;T=%BnWtd%P7`JhSSDqt!1gT%G=3RdIhlRwkon}cl73n z;YbyrCAJB$7aJ7g0L=R~`j~YDv|svM)DkWldI|WiERXnic(-8>Fb$XVL&~bFs)w6= zdD<8JVQT{qiu`G>)A(;+NHne+cMU!2KbAiPV|626ze+&?p!1`Sp&h&~cvXq<6EzFN z3v~iJh@gNnndlE0D`_ixy~w#yhJmhR#@iLJOF!Q-WhQhpwyc@gB>Os>AwFkMSPx5*SpN!Wm|n z@RJLZL8!JNGLm;N|dipisqu7(yWYE_rXv1dhGD5Yo(^4rYPb;4?-L&d_w{gt94(o!h zm^FgCf{-`A%&-{CKdt8yM&uP<}OoeIR~PM&J3PWTvRTQz_q3ez7gI zJ=7aZnDVD+h0ojLlOgJBi4}=W-yivgb?v1ub&`x>2e!LY@zj;U6;&zKW99b&N}rSr z33X?UowSXN3e~=upwAc2##5PiwL`;}ql!gBTj?&wZri{8wOslQk&u0u@gIR`LG7T^ zo;LgwDY->?<4&K+c*zFI!Q=zVxXP=Lc2I-hvOwO$;t9k8qCJsroY;~WoaDiCw|QPP zrijncn^rsOn*Pc_r%~J<-KA}wYI4nY05Z~0PNlOfk|WA#RM+M8*m`*3E>z*dzgFMA z_-S-=ZqbB2NO;+9aq-jgzL#dYvX1*z!BLDi#j#;0)az_l)^Wn_|2w!ksb*$X|#Ga!T5&s%U0n|T3eJZ=In}F=jClCX{9tpu?rZ1V^y5mGgvhMML?MoL}uj^hr4MD5^yD<``3;&4V zi|=1hC1tde;yy(0jn1EXJt;z(FzsJ{jl}B#oWh)i68_VWdnisIlxE5D8W0N z&uPE)u*K;pZf!Kazm(oca?;d$+RS@=QE9)&o$+nc00DtNO+iLd%V+5@7gI?K(t4bo z1M+vjTwRgov^mOsCrp!0no^BBm}F*&1E^JFsVho})0(37DA3BFp>*XW91x7BPT|0{ z6&nD{)ygkBU)nXSZpw2s^4pdc7u7Bo^Eb3rDm#s+@Run(T^SwgpS`FM7#l_i6=&?? zZf`%UY8V{Ig9NT!1m{Kc_V(g9Zcg(iR;jmj&Hu15H4EU!!(?PvG5TB|J23e(G}thN zCNgs~KNAP!TZWRM#AvxsTysp9FJ$$uumC%c<~5!wDNL)S3p+u@eA7ggZG~W zz6D7V$6Xabr==GDYLZIne7Sb}`jw9ipYJ+@XUSy1DN2_AZDM&z_7|E+JwvCwYJ+~A z+3C&Mpn6rrMfpjQw-|kv4<9c#yZ?d~uE)G|*RNm1f9+j-0C89JUOWmi<)Gx0Unr%sBPpa~ z4?u2i=kH19)67jD8u0ImNzUBod}_Z# zkD+HksiH}3A}-k3a`J8~Z23sA*dRaYk=Agv-t9gVq2A)PM-OHyfDXU-YmW_?5XA!g z9;hdwlU^mE+)WGeLQvs!^UD!-Us!$GuL`is2{1f5PFiYn^-Y&0Sc}72Y1y} zWs8%>=|?mJp1g(>xhDL3GTg56U%~Sq#6J&=13z0*q>t2Ham72lFn?t> zeH57__Cwr)iM*5E-^VpjRUwkT>$rOElqDLa<+gjWt_@SBqxO%S-%1Gj&$vYfw^>Au z@e2kx0|JZT!w0qL0ik=QaQUZ;G0E6V>i+SdIhzyTEB;k;@0ZdOJkwqSuDgQ_k+1re z#r6EvXh9OWy?woCx9)vMc6W4LckxXz4;nR=MKGoejHn~*R#G(1qnRnmO5uvLvLP(^nauIze|Rdi~n2N!UCK! zwA{Ev4u?hy@Ga}r)gIIzc3O4F=YC&*xGQq|Vy<8H$@2yfF)u&qevXzk7b}GJ!xTKB z`6-1xxAqCU4$Qq4c(Ir%47|~655A$_|7N`pz^|=qd&T9%A14;Ep-9pifEBT?Bq;$} z{Ly*GFaC5u7w|a1MB-OCWwVY1MOnBK6Xb&w2V)qhE+jF%#Tt(zF^3F++^_k`#^3BY zCG_@U;45Wj-rJxzB-P#L8AM(-1@+uPI{QS4gL-ZX<#9kub&Zdt#~o_|e2_#>BnTH4 zIEl2GbKnscURog*B4K=wEM_n|_z=KiEdGFQysjrYAc5ER>Hbi{!eVJF5M2a?TVzFq zFYhVZYvtBK;=}Pq$CVe5vHfnmsd?`3LY{*KJFaaRc4N{tpf&`4j>Gb48#mxag>9cQ zt~7XLtFGGFfNyD?JulOJwCde*5hMG~IwZd{GuLF*`7)S0M4C-%YPsr9x9NMyxBiuL z#UMY-!sJ{!pC^v_vplP}K`_CrUl~4g*oDWouM%4S5YqOZSM;KW5afLYi=zYVd@+tavu4kvt zR7IJDv>a#A0Qv+6ML`J5xvI<;VRdVa%h7gop~usQ7M_BXc3M?f^B15EO~LJBf)c=h z`sxl4c+~Ot*ceUx$}$nk1wf?@q`az2$%%TnGI`8-kQ_dP@=Xfx=U;?1 zbEGU7YLJC`qCFJmPs@+SCUy7MVQ>(WGr&BOB6^M`@~mLzLw!|$Xs1(9F4&_>z!Jey z^IxR^8tW1B{=waM#K9rb@KaAM7xb8Gc-gO*;5(mkx@8$X4-4VN(TD0$$ z9sAu8mmS)8IN?*kHY^gv2nbxn{ur~}#<h{H(6wAnr;LdT$m}QJG-tL{d3k`$}fC7_MmsV z9)~vp#_JGK2926K3g%j9}io^V1u|F+sWIbJ=y$Hnl0R01gd!X=oZh=c5X#|G)TE8ypbfmEq z?}C@#_|t_=z{2a*40k_(N5AIcS5j2Um=DCS?%v!W?6sUA0y!*kaq-jR4(^Hz>1_2m zWq?WmkkMvHTIa^gyYMGTg5UL6oG$~pV%oS<9Tym))-)>gOh)OZ&IJN1p7L6lqiF9D z?K3|OR1**4mO#i&9#N0GIQ>qj7yZIxNP^&=2b;FGM47wTh#< zGB}I^nWL^4faY5wogJ3M_@(aDk@LHrMjz&(A5_n8NX>}rdDU+p`H9io-MR4N9SYuO zdDoReo0@%92#W0mXIT>q8vW!6pOnTtnRK6CP~}H$dSUu6a7q7?CXvs%JOT_Mxn0vx z7uJI*h#9D+Ds8uEXW6zW$F<*{kJMdx0HtL7pwaxfHWq95Q~s?F&9U!CVoElBS+|?X zksXfDRw~ne1)(>cN2i&EcMuRULLZXj8Dpi+*6;qa&5xY6sM&&iUmS2{HB1JJ7jkXI=+{C=1ql@j z(mw;Byi`$)6?L_ba`FF|)0Yt@J(i_mbY;cX& zmnHsIHo3Hg>tsCUdB^n?R|Z04cw8wu;=s%FJkc()>&WZEs&Dp!oO}?dO>kQT6*LU? zTIcSML~|roer7PG5`&@+K~$aNg^LoGK@m-Btvw_=ElNdDOm|c$J#HgY`fe6hjL`XH z0^QqlgLI#G)2C|(lc~raP*pAS8ClG!+)Bux?3h4&X4Jw}L1c%AFA{YZ?SmAPKmu;l zpfgeB>3cV%&{fddv~ToKs<@5Ugv9_K$OU%p2|V3wAujA7JklE2?%|{uht;Ns^a3$H zJRrmFXR0F31VHof6FIqZTyH`w1Z;}Mmfzjus4nJ|I4p6>6)RIW=F_e-0G*i0yVQNX zaLH5~YMASg{U;h*o>S4(GB}l9cu~L%+-6#uY?;>^U?*uzSA4WgsL~Q~67gT0p{|i_6+q!6{1&O=xxGEcfo4!L< zxPa}f_@tv4hUtmMK948ZKtt$q`nBuO4*jC%`G<#TeOQ{#-DpF&v9K!7F`J=F9+U;S z2%37@K2!uc3!F3Fj9Yr^@$&!WDuS(JItZ_*NLk&(}jxeAd)Sx?$lf z4;1Pcm~Qx+T#qWf9t{1h!>eA2b1QW9ml4Df4L0$d1zOQ{|-O;eCv)v%^xx`7z> z0RUh9WV!wOy##A61PQiMOYD7JFUHf|L9nHBfVj_9xsYJuw0^b*DY)i)JT*RB5Mv(G zzd{iM>wrATBofLMKC9@8VgCh$6W-N=CZmIAt#l`7KuEC>wetFE3^r&Mj3n?5CZ2TVB+iO2_MS)g2XL^9Cl+S0~$$X z{g&E3)4k&Luop0GrN&NDL;Va~%a)L_)Rz zOJDN36n5@qnMQ|ta8#9F;#mTEM~uNpdeyZRuk=jf8?mzo#atl%Ij;hbUv9q0XuLaZ z9O8zJDNT=^hO_w;5Vrre$Qx?=;@|>+2I=~pXD6H#oht#$#n>GMR4@~o^VZ2dBwm$n zO{HClqfIHv#$QB|Lpf!YUy2SoLa;(Ly}`eB}rK}7f+gCP%<_leVo$j<)L zjAC3RTLN=EUO&fIyIdi>O(nV$p$C2{pxMXXpm{IL58#zNe`0ug9~b%bw6dHDsDY}{ zz(X-HLcmmK`){@-F>Hf`MH;C9arVpvy36WdFg~M4N3ws>5OzXi@|AE>p2g{4s3E|p zSN~yOzWL!n0hZIzzHC8t9XPXYBgNzwhcCF8>C^Ff=sHCN9ptfGGZr!LvnbA3PkdM~ z+Bd3Mu_fu{ggGbT>`lJydIUc?IIr*|gkq-o3)wFNBdX4SLtJd?bj^}81?=c%(LZ;9 zyPRGX`&a+UzWT6=5oUXLDxRGUBYqQcGh(0MZ($l{@KWOG0KXIZXJIuh4gBCDKB$ABX%~k*-kW`_rUA;VnX(>WzaU~#GzBEL+sz4=HKb3a&R;aqxmA-scQ)*_H z(pROPl+`aU+^(}mb}8FJ=;z<0Lt?R`-TKY4cAoM>e`C8L>#hO!g88>*(;r#w7{=j4DCIu19I z^x4yvl!`Iv2TQH5aOsd$>kEYRM!p5H`)0b-?fEyPoTXf;>1;f3IXAl}OIIahe%LJg z8|bCC;@lQElNU*Db&>6KBQ__gh#U@WvVWb6v!4Z@mN(x+6vk8C!6lcuog zyQB^!i47a{50`~AzGy{phwoKrumvP>>b9M{W9$L3#Y(o?`JZ5Z1dYa0d(-8EV#`g~ zskzj&)x*)-<2LGAY06agAvD&b%bcN=%bckwPeobb{>Qz~q?UR%Tp?7_o1dp4wIvd*P{9!H@8Urd%o4Y1DfI;G;N9 zjct}8{puPWd05T}RQ$J3}8N4L%||ar(>iF?sbn z27>f$|D}RDv-*yxlAOay4uc3})U3Nc=}O&n!!73Qse zGLQ@O-$xDU=i6PoeCs;9=hM-0NEOp@SI$Px#dUVxz+GQDx5o_y)@&T;iP7A~8{2rv z7A*;+hgtbCj@y&ne0JI=N0*Pa0&1$^AD?ZY75!5BAgt4FR8ieXGjxB1m&Baun0mpr zG27wu2b%6``u!E%-D!zJh0ccGQ_Lr_ z;0CrJ)It(T>*Nx$o18fKZ{JjI;)F^TDWmLhrAawX4P zMCpvP)!oFwI( z5GJQ&AMvDYBBwhX=nU7ded5jW9fCIBv0p_Et%s#g1a4jKtdogvSaGG68)rpya>+Fx zuWMf}p0z_|5`ue%3sH5LHEHrLUF#pxrT`D1|eWa$=#%(y_Gr;G5)I`kyveY zykAOIYRNzgbietpEndvmqp5>WH*+S6ic~SPG6qixU;+H^~hSE zzej%RoNJ7ZF*^)mGz}GP{-h`9Y#~Lb0?L(d{p@Y;yUyhOw#CPf7R1mjG83vwp1yK+ zE!;?Xa1rDv6e)FeS&lVhFJ>1qg+Oc6@`!nu+ubb~ge44ZsZ%mpJ5(k5N6+JZs0%bxr&{Xf2ruXJ5|B0L1X{Gw^v(m+MHV@WVO(^GJ< zDwKDzs+Rcm9@7g}K08sUtyzW{e=A`4&Rn_3P|JNbWMQsP-H2Xp7CF_>5`e4E%SujB zv*Rz@X3vq9uH9#>iSq5sxZse?7yLVNplOJW$veBh%TInjD@k*Tr*2>x7~4#8^k z!v^1SDo`|RlTe;c`0f+-Pd~xPvAi}X9JWtm1ieahen5w46O^8+ny@S^*LguVSX6^k zgzoELlcyb~W`W6y6L$t!&cbsVib}bTy;P@Ng4U0%ya^TcRIQer%Sv}}Z8|FDVgXQA zv*-&B;M}(U)R4|k^GmO7Qap9R#Ay8#`#g^xv zyCBi^XQFUBi;UdyfXq>l&CP;I^hid@N^pUV>0<=ud27l9(~tH;vwfc*#r^IQ{yrXf zO2r;BU&qB@2P34*6Lj@w1}o*e+5?+fIr6{?qhaEYhYO-AIp@t4G{DFBJPUv0oF(#p zSWaAdA~-Ahtn^$~3w6jiPr`0Oqbj(sC-hyHG(}xAkvCHm01`XYb;G~TVP8_;u{JR$ z*J+TVNDs$DYe+DPJap~TYj@Z=r|d(aJYb;I8-eh^Q`Tr!j8m7S=8N(ox)O5DV&!}E zY`|#>zN#i^_QZVZo3tk$R;f_$Fl)B$o8J1D(B{25BElEZkn2YPuO+z6t=7&?pQYn3 zwAn4m1{uGDOksDya~pE%fcj6^_3ej0-|q4$A6?epOu2tr5?5d8&-sy2($1#T=3g#b z`$zv|?|TMUyD0q@;L6PvjV}efqpiy6(OuQm1Y6`fh?>XpbNl%KiUBL$%t56!M6=`P zPs6Fj*o7@%?C+EhxaeoO@{YX{p7tI$?|Q*pTYv;CLw5+POR#5F%;G}MR#WrEBC5L9 z`1tjo@(1`7Coc9F;l-v>FN z9Klpm^tSWF%o~0yMQ$%OO#2ynRuJiDYM*{iV2dq`%RTjE$;B3qeH}tG3{-elc>Y<0 zGnMw9&xETOO?Ep%p%_%5$0~mDH2I*TPfEM7Plfc!F}|wt)|S zuE^MjN2vImh~0s}#?toOVKxJnR)Uduo}PQe1n$5DX*k}6XmuQ#ZA7XHG%tH*El&8O zwTxijXtjsbHrg?P%;d!8;!E21TO_s}Bt5zYV??2M4>q*nML^C z_#KUahpC0s3NA$GZ7qX}72bu2`{nqg6(07%O?G4wFQ(9@emdV@zo>aS#WenPwW=eC zeBPOXN12>9D*N^6W#B}Y(m@`6RDX(TtZJeU%5OL{RkSosf`kkUUrHkD>a4;kg{eox zW`f(@)_K2?`IM3jwWhO-^e+&d4Ot8-DQ+o$Tt|c zzG~Zk`_--fk!RpR{^%+2f!+mwAyA7s6&76UUylTJ@2%;#lM%zgu{6GA(vvqa0<=`3Zf4Kd%FxGEem;szb77i2W*H7x}`osOT z1lvSJ0?r_dY7X7rrL!m9SPO5e?dpr8%itbs#?s|RhuXNPLq#UM79ZzjDurIjv3egl zns8+ZA+#l;-RIUsXZ24rv9}-Fk1Ks15$5Q84KeQ`*OYj2?nPN!z-(_pH_?IcC~bd? zLCfTJ!?EOYEuJrWIZXhy;E2+)Cw_n3J+_liPv-W`&48fRRviyn)}&X#ST2ff$F2bY z+NKI#IzbTcq;+$GYm`NXHm5G+up=9#x54dSH7T=?$~>w&`$E=(?Ni()7%5ueboy<% z)JzN7p-KARqU-?-^pOQ>@zLc3@VW#?w<0^4Sntx3F1>w2qAd>Jp3~K36XumR{C32TQW?M;8Gt^7rTD##bBb15LMk%34h)uAcb%W0Ag;~K zPPA8?sGDi~&hFdX%bfK*W>61#V6VsHo(0E|p%rAY(vaQA_m4G;&f@Rl<58b;-CoU? zRgahB8f%($aEZ97Z8`fgN?1b@V9+t3DTv7}T;vHV;J4dpN~ z@Lh<6=gF!XhF?iaU7GLmyI(!=Ffz$`5dvx615iW$YuSc2M$qxHlBv6|&U4OqxriVc z@vj2l?M`@n&1-`c)Gr%SVq_SlnoTX>Ey2I40+0<~gX{0^a_xt#n6Zpvw2RQlYyJ!( zCU{%nG;UdImGiQ>X3hmh*&xoiFWjc4}cgR|uf47cjQ>ek43Q0`Q9kUH?bx{mw;lotl*oZVv#QLT#RIbhV z&(7R#O=ZkKy_13!PWS_SZF{sISbyZk7YJE6iEhL5((jG}4@$X}3G`d+$nK3^Q*MmS znV_ASZMFfu@7C{I^pLLa_ejdis393|o_R7NYoFpnJ9KORD<^m?AwE?XM5^<>YUd&Z zO;I-!Xm6-TWISK|n@dfZ(w(4HuU0!aoPe`D|3m6L(>uP)t816GJM>-Irh#Xyn_%W4t>utr5$iv&0Fu}*P2tzAZ3 zDCVce(P$?ARLz{M8aE#4uS4{|t$yxvxPEJ14UCk7^**q>6CX=U6u9mwHIvgGhZx%R ziDKN`cYUT6d(!O^qoE?=udRDCwKycaG?$Yag!oKLyU!7{?d%gh*O}hHw zpzizOPq!!VYYFoxe0EoCuQyF?-+ zrZq1(;*n(hEOMZ@uabYWg~@+){zgYa8DhaaxV=VcJNai^4vrvS_%EmKx2PgM&Y77k z#vq1DSb+JK%>u!%-jbn}Kmy!;xR2>TEK~2m05j z|Lo(`0X=Mp4FkxWDdY6H2Z{Ki|OjyoGhsf!zF#n&H?y^F-=A znn*P~&@Yo$HlMg$+RB{*#IFA4Yeg7!0^7U}artwt4j+V0R$yjYRYv>n0gB+W<_rCB z0)>x%t)H+s-QZk9_pCFcpV)x|wj5Tf;_>gH*%!5Od|N3pJk;rTMu)4-?W45O2Xe1s zRKyP9OwOOT|CrsxCT5LpJf`tvn4=)oj!%(Yc6Xxp$`EOv(nA+mlhe~@lf4j#llL2) z{|9-1A=qm z5!l)7g9ClX&JC)uT^tFakP|48P-;d^Al4+|TwD1B^^jK9(PnEp52NMhF${ zhie6cw|6`bOs~y}XhAz&eG(t<6TbT|mlyz2_iNx7lK3``MG=5%2=Hfs@oV`+L5yQB zKj5<94~~W!z0Jb^TD8{K-02X-U&Q5og*~blUT%YBUjIZBW2`45eBJJ!J%kIQL(v}aYqf)GZKsWFa0E{j?YXcGZE5ST8&HK|Oz(jAzh@-0vu#lqMNXLq z10l4>t!}_7!=kwm)mQ!i35z6~R2}EDiS7*^aP#Sp`6AbDxRLEB$EN8mmPLJ2Rt)QE zGm<3s?^nJJMvtzA@1QNC_=uxu4`Gq#Sb2?1z2=cgdQS7BRbvKW+CJeHTf?z*6%(Uz zs?TFjPXGU^fB&{<_)UYmQCp6kt~Px02xlhkXJ2a$(Ry*tYeowc_O@a%{zR3qtOlf_t=VPb=Bg+sl1k1&nF6kB0(5Nzi5#FN}z`)hRX9%FUZeWfdIvwdJZ6 z@iX?Oxx(I@*n%t(UB<=Q_oD?`5rtTzdJ+x3nEo6p-!N6Vd+Mse)eT2p0zlK3je|K~ z1(Y0}WKlSQ4grzwjz=PwYxWryvOVmT%-{kC)`lMSuCM486=f-T(wq(;BOPpcPuyS^ zH%SI!)$OzV>>Qe%#-`N>NZ?=|sN%ortX%2_gCfc}b96NqVp*1FrfTk)sd8k`9*8BpO{$J_u%Fo1Ax~eVLf~mZxdY0%&W&N_5g7x9YHm2F{#&GUy z9U?6xA~~k#(&hrX8?)#}5wzmsChQ&z;~q~KV7MwsZtUjx2;i+xZLQ|vP|nFJSGEdR zGBm2EaM-6j8deiNtuTFXpwFMC6_OyXHPnJ;)TG1a&Fo}tPvQZKuHiHC`d?CWFx zE0gb#f$-6QQ8-VR;6MCJ!T0h--zBn@!#Sogje5I~SJbmZk!f>$r!p?;qbmBi^E zgM)61?~wAtUX@ch_Q?3xx!67HBFFG{$9Lp}t@*~7t~I*g8wPjrfa>VL@T?87Lei>& zaoO`;nPJ~$iwqy@V!M!lH>Veino#j~ql@GVd^C+hhwg-$nm^A}aFB5A*WiYW_d?Og zf0GMB+e%6_0xxG;;ch)_<_T*!m~7L?^=^g7@>Nb%=k;t(JoXNn| zSi3xV&q1Upu&n%#Y+3vUB3vtem$7sZ^6XF`fVRV7LD_8-T2{w@C^=YH(zEfTa->*GC z#y`^++`sZjG0}0QHNF4YvAj%`A1{+q^OE|1WU}H}J2>WXHSt*%3)IrJ9s38E{l~5V zfB63^XYKx%oVC|him+e9RVEs~^G#@SWjey}fgr)*Kh3{&$^7q16S9#i~(9`kfH<^JK8&q+^$4X8887jfG{_EWI4^_$gOyy_D`dOcNt& zcuK_)^xJI8N(I>&Q>3F`lSQgwb7In1cXx;GU;X+23OaUgff|(0P-f}>?`?;=?u?l| zd)xOpb@($A$`QqmyfB0r)MvmQXHrkj?Kac?GG2wDvL#iIt0Z<@#o3AQY9HvcOt+cT zQ+&8rRyIk#ST7bBq?S+u#~o!r|BPasfkQf5vBe1a4^5`O={*zduc#4FyiZF1{BkA7 z7kBkL0{lU4r$amaCYoai5KDsK8B*@|l*B1ADjmx|M5&>M_;mNXC%3{`H5dRb4s~;f z=7Z+~9AKe845lyu!{X<|n17+0dS_nr7ve#KpNoZPQ&5I^i+_d)RT&EmKukuJi}a0!GN~sXVD%3uz}5ngFFm`<{|_B67T!^{RO_9? zyzi3&A{o3WZe*hp56HG$3a35o#3WGWf3HmU$n|)`$p;OjCI|fIF zF5c|fINlm73cZmWGlEe>#=kH(|D^Mh=P8;G_le>>RJK$rGGnmg8O*%W2N}WJHFnG! zIqL=^>c6@?!%3tOG_U_bvv4-iGv#qAnERR7eExw0BGzR2BKXN0a%tJ;Cxa#XAa%O9i~)yhrnUu zVhZ|vjbS_8$??r+13orL4KG(k8w{5mklymM^ZqKklTuboxVk7K1Ej2m8-&CfOY|an z5C`Y#dxuAX;l&QCug`eRi-8NU3Ljd+Ql6!K>74@PKOg~a>*BcbpTYv1O=#*6i_)?( z87nJH3u5sO#HkQp!zC}3^?z$%`^i7mO@Hlj7@7SvMG!ISLkNqznc9H+k0v~9?aNl) zyk=i_t(->xyLmm!eLRK#eA!sE59_=WwtT?PoOGj^gwaAH-xn`JnPV& z828`t<(Z`?WUA`5`E{w(Nk+XQp9(LfN185e5zXOpB%ZF%@8T)Bd0NRym+)8R;)MS( P9zj7?MW#y1H01vSr(8@| literal 0 HcmV?d00001 diff --git a/sources_non_forked/vim-gitgutter/test/fixture.txt b/sources_non_forked/vim-gitgutter/test/fixture.txt new file mode 100644 index 00000000..f5c6affe --- /dev/null +++ b/sources_non_forked/vim-gitgutter/test/fixture.txt @@ -0,0 +1,11 @@ +a +b +c +d +e +f +g +h +i +j + diff --git a/sources_non_forked/vim-gitgutter/test/runner.vim b/sources_non_forked/vim-gitgutter/test/runner.vim new file mode 100644 index 00000000..630693c4 --- /dev/null +++ b/sources_non_forked/vim-gitgutter/test/runner.vim @@ -0,0 +1,162 @@ +" +" Adapted from https://github.com/vim/vim/blob/master/src/testdir/runtest.vim +" +" When debugging tests it can help to write debug output: +" call Log('oh noes') +" + +function RunTest(test) + if exists("*SetUp") + call SetUp() + endif + + try + execute 'call '.a:test + catch + call Exception() + let s:errored = 1 + endtry + + if exists("*TearDown") + call TearDown() + endif +endfunction + +function Log(msg) + if type(a:msg) == type('') + call add(s:messages, a:msg) + elseif type(a:msg) == type([]) + call extend(s:messages, a:msg) + else + call add(v:errors, 'Exception: unsupported type: '.type(a:msg)) + endif +endfunction + +function Exception() + call add(v:errors, v:throwpoint.'..'.'Exception: '.v:exception) +endfunction + +" Shuffles list in place. +function Shuffle(list) + " Fisher-Yates-Durstenfeld-Knuth + let n = len(a:list) + if n < 2 + return a:list + endif + for i in range(0, n-2) + let j = Random(0, n-i-1) + let e = a:list[i] + let a:list[i] = a:list[i+j] + let a:list[i+j] = e + endfor + return a:list +endfunction + +" Returns a pseudorandom integer i such that 0 <= i <= max +function Random(min, max) + if has('unix') + let i = system('echo $RANDOM') " 0 <= i <= 32767 + else + let i = system('echo %RANDOM%') " 0 <= i <= 32767 + endif + return i * (a:max - a:min + 1) / 32768 + a:min +endfunction + +function FriendlyName(test_name) + return substitute(a:test_name[5:-3], '_', ' ', 'g') +endfunction + +function Align(left, right) + if type(a:right) == type([]) + let result = [] + for s in a:right + if empty(result) + call add(result, printf('%-'.s:indent.'S', a:left).s) + else + call add(result, printf('%-'.s:indent.'S', '').s) + endif + endfor + return result + endif + + return printf('%-'.s:indent.'S', a:left).a:right +endfunction + +let g:testname = expand('%') +let s:errored = 0 +let s:done = 0 +let s:fail = 0 +let s:errors = 0 +let s:messages = [] +let s:indent = '' + +call Log(g:testname.':') + +" Source the test script. +try + source % +catch + let s:errors += 1 + call Exception() +endtry + +" Locate the test functions. +set nomore +redir @q +silent function /^Test_ +redir END +let s:tests = split(substitute(@q, 'function \(\k*()\)', '\1', 'g')) + +" If there is another argument, filter test-functions' names against it. +if argc() > 1 + let s:tests = filter(s:tests, 'v:val =~ argv(1)') +endif + +let s:indent = max(map(copy(s:tests), {_, val -> len(FriendlyName(val))})) + +" Run the tests in random order. +for test in Shuffle(s:tests) + call RunTest(test) + let s:done += 1 + + let friendly_name = FriendlyName(test) + if len(v:errors) == 0 + call Log(Align(friendly_name, ' - ok')) + else + if s:errored + let s:errors += 1 + let s:errored = 0 + else + let s:fail += 1 + endif + call Log(Align(friendly_name, ' - not ok')) + + let i = 0 + for error in v:errors + if i != 0 + call Log(Align('',' ! ----')) + endif + for trace in reverse(split(error, '\.\.')) + call Log(Align('', ' ! '.trace)) + endfor + let i += 1 + endfor + + let v:errors = [] + endif +endfor + +let summary = [ + \ s:done.( s:done == 1 ? ' test' : ' tests'), + \ s:errors.(s:errors == 1 ? ' error' : ' errors'), + \ s:fail.( s:fail == 1 ? ' failure' : ' failures'), + \ ] +call Log('') +call Log(join(summary, ', ')) + +split messages.log +call append(line('$'), s:messages) +write + +qall! + diff --git a/sources_non_forked/vim-gitgutter/test/test b/sources_non_forked/vim-gitgutter/test/test new file mode 100644 index 00000000..6247a058 --- /dev/null +++ b/sources_non_forked/vim-gitgutter/test/test @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +VIM="/Applications/MacVim.app/Contents/MacOS/Vim -v" + +$VIM -u NONE -U NONE -N \ + --cmd 'set rtp+=../' \ + --cmd 'let g:gitgutter_async=0' \ + --cmd 'source ../plugin/gitgutter.vim' \ + -S runner.vim \ + test_*.vim \ + $* + +cat messages.log + +grep -q "0 errors, 0 failures" messages.log +status=$? +rm messages.log +exit $status + diff --git a/sources_non_forked/vim-gitgutter/test/test_gitgutter.vim b/sources_non_forked/vim-gitgutter/test/test_gitgutter.vim new file mode 100644 index 00000000..1a65ed8a --- /dev/null +++ b/sources_non_forked/vim-gitgutter/test/test_gitgutter.vim @@ -0,0 +1,400 @@ +let s:current_dir = expand('%:p:h') +let s:test_repo = s:current_dir.'/test-repo' +let s:bufnr = bufnr('') + +" +" Helpers +" + +function s:signs(filename) + redir => signs + silent execute 'sign place' + redir END + + let signs = split(signs, '\n') + + " filter out signs for this test file + " assumes a:filename's signs are last set listed + let i = index(signs, 'Signs for '.a:filename.':') + let signs = (i > -1 ? signs[i+1:] : []) + + call map(signs, {_, v -> substitute(v, ' ', '', '')}) + + return signs +endfunction + +function s:git_diff() + return split(system('git diff -U0 fixture.txt'), '\n') +endfunction + +function s:git_diff_staged() + return split(system('git diff -U0 --staged fixture.txt'), '\n') +endfunction + + +" +" SetUp / TearDown +" + +function SetUp() + call system("git init ".s:test_repo. + \ " && cd ".s:test_repo. + \ " && cp ../fixture.txt .". + \ " && git add . && git commit -m 'initial'") + execute ':cd' s:test_repo + edit! fixture.txt + call gitgutter#sign#reset() +endfunction + +function TearDown() + " delete all buffers except this one + " TODO: move to runner.vim, accounting for multiple test files + if s:bufnr > 1 + silent! execute '1,'.s:bufnr-1.'bdelete!' + endif + silent! execute s:bufnr+1.',$bdelete!' + + execute ':cd' s:current_dir + call system("rm -rf ".s:test_repo) +endfunction + +" +" The tests +" + +function Test_add_lines() + normal ggo* + write + + let expected = ["line=2 id=3000 name=GitGutterLineAdded"] + call assert_equal(expected, s:signs('fixture.txt')) +endfunction + + +function Test_add_lines_fish() + let _shell = &shell + set shell=/usr/local/bin/fish + + normal ggo* + write + + let expected = ["line=2 id=3000 name=GitGutterLineAdded"] + call assert_equal(expected, s:signs('fixture.txt')) + + let &shell = _shell +endfunction + + +function Test_modify_lines() + normal ggi* + write + + let expected = ["line=1 id=3000 name=GitGutterLineModified"] + call assert_equal(expected, s:signs('fixture.txt')) +endfunction + + +function Test_remove_lines() + execute '5d' + write + + let expected = ["line=4 id=3000 name=GitGutterLineRemoved"] + call assert_equal(expected, s:signs('fixture.txt')) +endfunction + + +function Test_remove_first_lines() + execute '1d' + write + + let expected = ["line=1 id=3000 name=GitGutterLineRemovedFirstLine"] + call assert_equal(expected, s:signs('fixture.txt')) +endfunction + + +function Test_edit_file_with_same_name_as_a_branch() + normal 5Gi* + call system('git checkout -b fixture.txt') + write + + let expected = ["line=5 id=3000 name=GitGutterLineModified"] + call assert_equal(expected, s:signs('fixture.txt')) +endfunction + + +function Test_file_added_to_git() + let tmpfile = 'fileAddedToGit.tmp' + call system('touch '.tmpfile.' && git add '.tmpfile) + execute 'edit '.tmpfile + normal ihello + write + + let expected = ["line=1 id=3000 name=GitGutterLineAdded"] + call assert_equal(expected, s:signs('fileAddedToGit.tmp')) +endfunction + + +function Test_filename_with_equals() + call system('touch =fixture=.txt && git add =fixture=.txt') + edit =fixture=.txt + normal ggo* + write + + let expected = [ + \ 'line=1 id=3000 name=GitGutterLineAdded', + \ 'line=2 id=3001 name=GitGutterLineAdded' + \ ] + call assert_equal(expected, s:signs('=fixture=.txt')) +endfunction + + +function Test_filename_with_square_brackets() + call system('touch fix[tu]re.txt && git add fix[tu]re.txt') + edit fix[tu]re.txt + normal ggo* + write + + let expected = [ + \ 'line=1 id=3000 name=GitGutterLineAdded', + \ 'line=2 id=3001 name=GitGutterLineAdded' + \ ] + call assert_equal(expected, s:signs('fix[tu]re.txt')) +endfunction + + +" FIXME: this test fails when it is the first (or only) test to be run +function Test_follow_symlink() + let tmp = 'symlink' + call system('ln -nfs fixture.txt '.tmp) + execute 'edit '.tmp + 6d + write + + let expected = ['line=5 id=3000 name=GitGutterLineRemoved'] + call assert_equal(expected, s:signs('symlink')) +endfunction + + +function Test_keep_alt() + enew + execute "normal! \" + + call assert_equal('fixture.txt', bufname('')) + call assert_equal('', bufname('#')) + + normal ggx + doautocmd CursorHold + + call assert_equal('', bufname('#')) +endfunction + + +function Test_keep_modified() + normal 5Go* + call assert_equal(1, getbufvar('', '&modified')) + + doautocmd CursorHold + + call assert_equal(1, getbufvar('', '&modified')) +endfunction + + +function Test_keep_op_marks() + normal 5Go* + call assert_equal([0,6,1,0], getpos("'[")) + call assert_equal([0,6,2,0], getpos("']")) + + doautocmd CursorHold + + call assert_equal([0,6,1,0], getpos("'[")) + call assert_equal([0,6,2,0], getpos("']")) +endfunction + + +function Test_no_modifications() + call assert_equal([], s:signs('fixture.txt')) +endfunction + + +function Test_orphaned_signs() + execute "normal 5GoX\Y" + write + 6d + write + + let expected = ['line=6 id=3001 name=GitGutterLineAdded'] + call assert_equal(expected, s:signs('fixture.txt')) +endfunction + + +function Test_sign_column_always() + let g:gitgutter_sign_column_always=1 + write + + let expected = ['line=9999 id=2999 name=GitGutterDummy'] + call assert_equal(expected, s:signs('fixture.txt')) + + let g:gitgutter_sign_column_always=0 +endfunction + + +function Test_untracked_file_outside_repo() + let tmp = tempname() + call system('touch '.tmp) + execute 'edit '.tmp + + call assert_equal([], s:signs(tmp)) +endfunction + + +function Test_untracked_file_within_repo() + let tmp = 'untrackedFileWithinRepo.tmp' + call system('touch '.tmp) + execute 'edit '.tmp + normal ggo* + doautocmd CursorHold + + call assert_equal([], s:signs(tmp)) + + call system('rm '.tmp) +endfunction + + +function Test_untracked_file_square_brackets_within_repo() + let tmp = '[un]trackedFileWithinRepo.tmp' + call system('touch '.tmp) + execute 'edit '.tmp + normal ggo* + doautocmd CursorHold + + call assert_equal([], s:signs(tmp)) + + call system('rm '.tmp) +endfunction + + +function Test_hunk_outside_noop() + normal 5G + GitGutterStageHunk + + call assert_equal([], s:signs('fixture.txt')) + call assert_equal([], s:git_diff()) + call assert_equal([], s:git_diff_staged()) + + GitGutterUndoHunk + + call assert_equal([], s:signs('fixture.txt')) + call assert_equal([], s:git_diff()) + call assert_equal([], s:git_diff_staged()) +endfunction + + +function Test_hunk_stage() + let _shell = &shell + set shell=foo + + normal 5Gi* + GitGutterStageHunk + + call assert_equal('foo', &shell) + let &shell = _shell + + call assert_equal([], s:signs('fixture.txt')) + + call assert_equal([], s:git_diff()) + + let expected = [ + \ 'diff --git a/fixture.txt b/fixture.txt', + \ 'index f5c6aff..ae8e546 100644', + \ '--- a/fixture.txt', + \ '+++ b/fixture.txt', + \ '@@ -5 +5 @@ d', + \ '-e', + \ '+*e' + \ ] + call assert_equal(expected, s:git_diff_staged()) +endfunction + + +function Test_hunk_stage_nearby_hunk() + execute "normal! 2Gox\y\z" + normal 2jdd + normal k + GitGutterStageHunk + + let expected = [ + \ 'line=3 id=3000 name=GitGutterLineAdded', + \ 'line=4 id=3001 name=GitGutterLineAdded', + \ 'line=5 id=3002 name=GitGutterLineAdded' + \ ] + call assert_equal(expected, s:signs('fixture.txt')) + + let expected = [ + \ 'diff --git a/fixture.txt b/fixture.txt', + \ 'index 53b13df..8fdfda7 100644', + \ '--- a/fixture.txt', + \ '+++ b/fixture.txt', + \ '@@ -2,0 +3,3 @@ b', + \ '+x', + \ '+y', + \ '+z', + \ ] + call assert_equal(expected, s:git_diff()) + + let expected = [ + \ 'diff --git a/fixture.txt b/fixture.txt', + \ 'index f5c6aff..53b13df 100644', + \ '--- a/fixture.txt', + \ '+++ b/fixture.txt', + \ '@@ -4 +3,0 @@ c', + \ '-d', + \ ] + call assert_equal(expected, s:git_diff_staged()) +endfunction + + +function Test_hunk_undo() + let _shell = &shell + set shell=foo + + normal 5Gi* + GitGutterUndoHunk + write " write file so we can verify git diff (--staged) + + call assert_equal('foo', &shell) + let &shell = _shell + + call assert_equal([], s:signs('fixture.txt')) + call assert_equal([], s:git_diff()) + call assert_equal([], s:git_diff_staged()) +endfunction + + +function Test_undo_nearby_hunk() + execute "normal! 2Gox\y\z" + normal 2jdd + normal k + GitGutterUndoHunk + write " write file so we can verify git diff (--staged) + + let expected = [ + \ 'line=3 id=3000 name=GitGutterLineAdded', + \ 'line=4 id=3001 name=GitGutterLineAdded', + \ 'line=5 id=3002 name=GitGutterLineAdded' + \ ] + call assert_equal(expected, s:signs('fixture.txt')) + + let expected = [ + \ 'diff --git a/fixture.txt b/fixture.txt', + \ 'index f5c6aff..3fbde56 100644', + \ '--- a/fixture.txt', + \ '+++ b/fixture.txt', + \ '@@ -2,0 +3,3 @@ b', + \ '+x', + \ '+y', + \ '+z', + \ ] + call assert_equal(expected, s:git_diff()) + + call assert_equal([], s:git_diff_staged()) +endfunction From 9cd8652c4656515be5e7306373ac465ab2f78a34 Mon Sep 17 00:00:00 2001 From: Curtis G Date: Fri, 16 Dec 2016 20:20:55 -0500 Subject: [PATCH 04/74] Add training space to nb map of NERDTreeFromBookmark --- vimrcs/plugins_config.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vimrcs/plugins_config.vim b/vimrcs/plugins_config.vim index 44d761cb..53d0539e 100644 --- a/vimrcs/plugins_config.vim +++ b/vimrcs/plugins_config.vim @@ -78,7 +78,7 @@ let NERDTreeShowHidden=0 let NERDTreeIgnore = ['\.pyc$', '__pycache__'] let g:NERDTreeWinSize=35 map nn :NERDTreeToggle -map nb :NERDTreeFromBookmark +map nb :NERDTreeFromBookmark map nf :NERDTreeFind From fe46dfbbe6464506edd92e1eaf841183e7ba4ae4 Mon Sep 17 00:00:00 2001 From: amix Date: Sat, 11 Feb 2017 14:01:38 +0100 Subject: [PATCH 05/74] Updated plugins --- .../ctrlp.vim/autoload/ctrlp.vim | 12 +- .../ctrlp.vim/autoload/ctrlp/tag.vim | 4 +- sources_non_forked/ctrlp.vim/doc/ctrlp.txt | 4 + sources_non_forked/goyo.vim/autoload/goyo.vim | 4 +- .../nerdtree/lib/nerdtree/path.vim | 4 +- .../syntastic/doc/syntastic-checkers.txt | 2 +- .../syntastic/plugin/syntastic.vim | 18 +- .../erlang/erlang_check_file.erl | 213 +++- .../syntastic/syntax_checkers/haxe/haxe.vim | 7 +- .../syntax_checkers/javascript/flow.vim | 6 +- .../syntastic/syntax_checkers/vala/valac.vim | 54 +- .../vim-coffee-script/after/indent/html.vim | 2 +- .../vim-coffee-script/after/syntax/html.vim | 2 +- .../vim-coffee-script/test/test.html | 10 + .../vim-fugitive/plugin/fugitive.vim | 12 +- sources_non_forked/vim-go/.gitignore | 4 + sources_non_forked/vim-go/.travis.yml | 22 + sources_non_forked/vim-go/CHANGELOG.md | 46 +- sources_non_forked/vim-go/Makefile | 7 + sources_non_forked/vim-go/README.md | 49 +- sources_non_forked/vim-go/Rakefile | 13 - .../vim-go/autoload/go/asmfmt.vim | 2 +- sources_non_forked/vim-go/autoload/go/cmd.vim | 7 +- .../vim-go/autoload/go/complete.vim | 12 +- .../vim-go/autoload/go/coverage.vim | 2 +- sources_non_forked/vim-go/autoload/go/def.vim | 13 +- .../vim-go/autoload/go/def_test.vim | 32 + sources_non_forked/vim-go/autoload/go/doc.vim | 14 +- sources_non_forked/vim-go/autoload/go/fmt.vim | 283 ++--- .../vim-go/autoload/go/fmt_test.vim | 31 + .../vim-go/autoload/go/guru.vim | 16 +- .../vim-go/autoload/go/jobcontrol.vim | 44 +- .../vim-go/autoload/go/lint.vim | 31 +- .../vim-go/autoload/go/path.vim | 3 + .../vim-go/autoload/go/rename.vim | 4 +- .../autoload/go/test-fixtures/def/jump.go | 7 + .../autoload/go/test-fixtures/fmt/hello.go | 7 + .../go/test-fixtures/fmt/hello_golden.go | 7 + .../vim-go/autoload/go/textobj.vim | 4 +- .../vim-go/autoload/go/util.vim | 13 + sources_non_forked/vim-go/doc/vim-go.txt | 3 +- .../vim-go/gosnippets/UltiSnips/go.snippets | 8 + .../vim-go/gosnippets/snippets/go.snip | 7 + sources_non_forked/vim-go/plugin/go.vim | 2 +- sources_non_forked/vim-go/scripts/runtest.vim | 81 ++ sources_non_forked/vim-go/scripts/test.sh | 86 +- sources_non_forked/vim-go/syntax/go.vim | 14 +- sources_non_forked/vim-go/t/coverlay.vim | 191 ---- .../vim-go/t/fixtures/src/buildfail/sample.go | 13 - .../t/fixtures/src/buildfail/sample_test.go | 7 - .../t/fixtures/src/buildtestfail/sample.go | 7 - .../fixtures/src/buildtestfail/sample_test.go | 15 - .../vim-go/t/fixtures/src/failtest/sample.go | 12 - .../t/fixtures/src/failtest/sample_test.go | 8 - .../vim-go/t/fixtures/src/parsefail/sample.go | 14 - .../t/fixtures/src/parsefail/sample_test.go | 7 - .../vim-go/t/fixtures/src/pkg1/sample.go | 12 - .../vim-go/t/fixtures/src/pkg1/sample.out | 6 - .../vim-go/t/fixtures/src/pkg1/sample_test.go | 7 - sources_non_forked/vim-pug/README.markdown | 2 + sources_non_forked/vim-pug/syntax/pug.vim | 5 +- sources_non_forked/vim-snippets/README.md | 6 +- .../vim-snippets/UltiSnips/all.snippets | 10 +- .../vim-snippets/UltiSnips/c.snippets | 20 +- .../UltiSnips/coffee-react.snippets | 24 +- .../vim-snippets/UltiSnips/cpp.snippets | 4 +- .../vim-snippets/UltiSnips/crystal.snippets | 13 + .../vim-snippets/UltiSnips/cs.snippets | 2 +- .../vim-snippets/UltiSnips/css.snippets | 6 - .../vim-snippets/UltiSnips/d.snippets | 110 +- .../vim-snippets/UltiSnips/django.snippets | 36 +- .../vim-snippets/UltiSnips/eruby.snippets | 14 +- .../vim-snippets/UltiSnips/go.snippets | 2 +- .../vim-snippets/UltiSnips/html.snippets | 98 +- .../UltiSnips/html_minimal.snippets | 12 +- .../UltiSnips/htmldjango.snippets | 112 +- .../vim-snippets/UltiSnips/java.snippets | 6 +- .../UltiSnips/javascript-angular.snippets | 14 +- .../UltiSnips/javascript-node.snippets | 24 +- .../UltiSnips/javascript-openui5.snippets | 272 ++--- .../UltiSnips/javascript.snippets | 88 +- .../UltiSnips/php-laravel.snippets | 18 +- .../UltiSnips/php-phpspec.snippets | 28 +- .../UltiSnips/php-symfony2.snippets | 48 +- .../vim-snippets/UltiSnips/php.snippets | 2 +- .../vim-snippets/UltiSnips/proto.snippets | 6 +- .../vim-snippets/UltiSnips/puppet.snippets | 50 +- .../vim-snippets/UltiSnips/python.snippets | 2 +- .../vim-snippets/UltiSnips/r.snippets | 32 +- .../vim-snippets/UltiSnips/rails.snippets | 36 +- .../vim-snippets/UltiSnips/rst.snippets | 20 +- .../vim-snippets/UltiSnips/rust.snippets | 40 +- .../UltiSnips/supercollider.snippets | 2 +- .../vim-snippets/UltiSnips/tcl.snippets | 14 +- .../vim-snippets/UltiSnips/tex.snippets | 18 +- .../vim-snippets/UltiSnips/vim.snippets | 4 +- .../snippets/actionscript.snippets | 6 +- .../vim-snippets/snippets/ada.snippets | 10 +- .../vim-snippets/snippets/apache.snippets | 8 +- .../vim-snippets/snippets/arduino.snippets | 2 +- .../vim-snippets/snippets/awk.snippets | 4 +- .../vim-snippets/snippets/c.snippets | 14 +- .../snippets/coffee/coffee.snippets | 8 +- .../vim-snippets/snippets/crystal.snippets | 82 ++ .../vim-snippets/snippets/cs.snippets | 14 +- .../vim-snippets/snippets/css.snippets | 10 +- .../vim-snippets/snippets/d.snippets | 6 +- .../vim-snippets/snippets/dart.snippets | 4 +- .../vim-snippets/snippets/eelixir.snippets | 4 +- .../vim-snippets/snippets/elixir.snippets | 14 +- .../vim-snippets/snippets/elm.snippets | 2 +- .../vim-snippets/snippets/erlang.snippets | 2 +- .../vim-snippets/snippets/eruby.snippets | 2 +- .../vim-snippets/snippets/go.snippets | 27 +- .../vim-snippets/snippets/haml.snippets | 4 +- .../vim-snippets/snippets/handlebars.snippets | 6 +- .../vim-snippets/snippets/html.snippets | 4 +- .../snippets/htmltornado.snippets | 2 +- .../vim-snippets/snippets/java.snippets | 4 +- .../snippets/javascript-mocha.snippets | 34 +- .../snippets/javascript.es6.react.snippets | 2 +- .../javascript/javascript.es6.snippets | 16 +- .../snippets/javascript/javascript.snippets | 127 +-- .../vim-snippets/snippets/julia.snippets | 2 +- .../vim-snippets/snippets/ls.snippets | 2 +- .../vim-snippets/snippets/make.snippets | 8 +- .../vim-snippets/snippets/mako.snippets | 2 +- .../vim-snippets/snippets/mustache.snippets | 6 +- .../vim-snippets/snippets/php.snippets | 123 ++- .../vim-snippets/snippets/processing.snippets | 4 +- .../vim-snippets/snippets/python.snippets | 26 +- .../vim-snippets/snippets/rst.snippets | 4 +- .../vim-snippets/snippets/ruby.snippets | 14 +- .../vim-snippets/snippets/rust.snippets | 14 +- .../vim-snippets/snippets/sass.snippets | 993 +++++++++++++++++- .../vim-snippets/snippets/scala.snippets | 16 +- .../vim-snippets/snippets/sh.snippets | 12 +- .../vim-snippets/snippets/tex.snippets | 11 +- .../vim-snippets/snippets/twig.snippets | 8 +- .../vim-snippets/snippets/vim.snippets | 10 +- .../vim-snippets/snippets/zsh.snippets | 20 +- 141 files changed, 2790 insertions(+), 1630 deletions(-) create mode 100644 sources_non_forked/vim-go/.travis.yml create mode 100644 sources_non_forked/vim-go/Makefile delete mode 100644 sources_non_forked/vim-go/Rakefile create mode 100644 sources_non_forked/vim-go/autoload/go/def_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/fmt_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/def/jump.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/hello.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/hello_golden.go create mode 100644 sources_non_forked/vim-go/scripts/runtest.vim delete mode 100644 sources_non_forked/vim-go/t/coverlay.vim delete mode 100644 sources_non_forked/vim-go/t/fixtures/src/buildfail/sample.go delete mode 100644 sources_non_forked/vim-go/t/fixtures/src/buildfail/sample_test.go delete mode 100644 sources_non_forked/vim-go/t/fixtures/src/buildtestfail/sample.go delete mode 100644 sources_non_forked/vim-go/t/fixtures/src/buildtestfail/sample_test.go delete mode 100644 sources_non_forked/vim-go/t/fixtures/src/failtest/sample.go delete mode 100644 sources_non_forked/vim-go/t/fixtures/src/failtest/sample_test.go delete mode 100644 sources_non_forked/vim-go/t/fixtures/src/parsefail/sample.go delete mode 100644 sources_non_forked/vim-go/t/fixtures/src/parsefail/sample_test.go delete mode 100644 sources_non_forked/vim-go/t/fixtures/src/pkg1/sample.go delete mode 100644 sources_non_forked/vim-go/t/fixtures/src/pkg1/sample.out delete mode 100644 sources_non_forked/vim-go/t/fixtures/src/pkg1/sample_test.go create mode 100644 sources_non_forked/vim-snippets/UltiSnips/crystal.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/crystal.snippets diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim index fc8b8830..65589393 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim @@ -303,7 +303,6 @@ fu! s:match_window_opts() let s:mw_res = \ s:mw =~ 'results:[^,]\+' ? str2nr(matchstr(s:mw, 'results:\zs\d\+')) \ : min([s:mw_max, &lines]) - let s:mw_res = max([s:mw_res, 1]) endf "}}}1 " * Open & Close {{{1 @@ -1995,9 +1994,14 @@ fu! s:bufnrfilpath(line) en let filpath = fnamemodify(filpath, ':p') let bufnr = bufnr('^'.filpath.'$') - if (a:line =~ '[\/]\?\[\d\+\*No Name\]$' && !filereadable(filpath) && bufnr < 1) - let bufnr = str2nr(matchstr(a:line, '[\/]\?\[\zs\d\+\ze\*No Name\]$')) - let filpath = bufnr + if (!filereadable(filpath) && bufnr < 1) + if (a:line =~ '[\/]\?\[\d\+\*No Name\]$') + let bufnr = str2nr(matchstr(a:line, '[\/]\?\[\zs\d\+\ze\*No Name\]$')) + let filpath = bufnr + else + let bufnr = bufnr(a:line) + retu [bufnr, a:line] + en en retu [bufnr, filpath] endf diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/tag.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/tag.vim index 31504dcc..c2294805 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/tag.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/tag.vim @@ -137,8 +137,8 @@ fu! ctrlp#tag#id() endf fu! ctrlp#tag#enter() - let tfs = tagfiles() - let s:tagfiles = tfs != [] ? filter(map(tfs, 'fnamemodify(v:val, ":p")'), + let tfs = get(g:, 'ctrlp_custom_tag_files', tagfiles()) + let s:tagfiles = type(tfs) == 3 && tfs != [] ? filter(map(tfs, 'fnamemodify(v:val, ":p")'), \ 'filereadable(v:val)') : [] endf "}}} diff --git a/sources_non_forked/ctrlp.vim/doc/ctrlp.txt b/sources_non_forked/ctrlp.vim/doc/ctrlp.txt index 1107497b..f703ba4f 100644 --- a/sources_non_forked/ctrlp.vim/doc/ctrlp.txt +++ b/sources_non_forked/ctrlp.vim/doc/ctrlp.txt @@ -148,6 +148,7 @@ The minimum and maximum heights: The maximum number of results: results:{n} - list maximum {n} results (default: sync with max height). + 0 mean no-limit. Note: When a setting isn't set, its default value will be used. @@ -1497,6 +1498,9 @@ Special thanks:~ =============================================================================== CHANGELOG *ctrlp-changelog* + * New option |g:ctrlp_custom_tag_files| to specify custom tag files. + * Accept 0 for g:ctrlp_match_window no-limited window size. + Before 2016/11/28~ + New command: |YankLine()| to yank current line. diff --git a/sources_non_forked/goyo.vim/autoload/goyo.vim b/sources_non_forked/goyo.vim/autoload/goyo.vim index 3e014667..735c950a 100644 --- a/sources_non_forked/goyo.vim/autoload/goyo.vim +++ b/sources_non_forked/goyo.vim/autoload/goyo.vim @@ -122,7 +122,7 @@ function! s:tranquilize() endfunction function! s:hide_statusline() - let &l:statusline = repeat(' ', winwidth(0)) + setlocal statusline=\ endfunction function! s:hide_linenr() @@ -239,7 +239,7 @@ function! s:goyo_on(dim) set showtabline=0 set noruler set fillchars+=vert:\ - set fillchars+=stl:. + set fillchars+=stl:\ set fillchars+=stlnc:\ set sidescroll=1 set sidescrolloff=0 diff --git a/sources_non_forked/nerdtree/lib/nerdtree/path.vim b/sources_non_forked/nerdtree/lib/nerdtree/path.vim index 5f3b16ad..26db4a31 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/path.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/path.vim @@ -301,10 +301,10 @@ endfunction "FUNCTION: Path._escChars() {{{1 function! s:Path._escChars() if nerdtree#runningWindows() - return " `\|\"#%&,?()\*^<>" + return " `\|\"#%&,?()\*^<>$" endif - return " \\`\|\"#%&,?()\*^<>[]" + return " \\`\|\"#%&,?()\*^<>[]$" endfunction "FUNCTION: Path.getDir() {{{1 diff --git a/sources_non_forked/syntastic/doc/syntastic-checkers.txt b/sources_non_forked/syntastic/doc/syntastic-checkers.txt index d8fb584d..48536491 100644 --- a/sources_non_forked/syntastic/doc/syntastic-checkers.txt +++ b/sources_non_forked/syntastic/doc/syntastic-checkers.txt @@ -3226,7 +3226,7 @@ accepts the standard options described at |syntastic-config-makeprg|. Notes~ -Syntastic requires "Flow" version 0.18.1 or later. +Syntastic requires "Flow" version 0.34.0 or later. To use "Flow" with your projects, you must: diff --git a/sources_non_forked/syntastic/plugin/syntastic.vim b/sources_non_forked/syntastic/plugin/syntastic.vim index 2c8bdbad..4e65ea07 100644 --- a/sources_non_forked/syntastic/plugin/syntastic.vim +++ b/sources_non_forked/syntastic/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:_SYNTASTIC_START endif -let g:_SYNTASTIC_VERSION = '3.8.0-10' +let g:_SYNTASTIC_VERSION = '3.8.0-21' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1 @@ -67,6 +67,15 @@ else endif lockvar g:_SYNTASTIC_UNAME +" XXX Ugly hack to make g:_SYNTASTIC_UNAME available to :SyntasticInfo without +" polluting session namespaces +let g:syntastic_version = + \ g:_SYNTASTIC_VERSION . + \ ' (Vim ' . v:version . (has('nvim') ? ', Neovim' : '') . ', ' . + \ g:_SYNTASTIC_UNAME . + \ (has('gui') ? ', GUI' : '') . ')' +lockvar g:syntastic_version + " }}}1 " Defaults {{{1 @@ -344,13 +353,6 @@ function! s:BufWinEnterHook(fname) abort " {{{2 endfunction " }}}2 function! s:VimEnterHook() abort " {{{2 - let g:syntastic_version = - \ g:_SYNTASTIC_VERSION . - \ ' (Vim ' . v:version . (has('nvim') ? ', Neovim' : '') . ', ' . - \ g:_SYNTASTIC_UNAME . - \ (has('gui') ? ', GUI' : '') . ')' - lockvar g:syntastic_version - let buf = bufnr('') call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS, \ 'autocmd: VimEnter, buffer ' . buf . ' = ' . string(bufname(buf)) . ', &buftype = ' . string(&buftype)) diff --git a/sources_non_forked/syntastic/syntax_checkers/erlang/erlang_check_file.erl b/sources_non_forked/syntastic/syntax_checkers/erlang/erlang_check_file.erl index 730e6005..89884345 100644 --- a/sources_non_forked/syntastic/syntax_checkers/erlang/erlang_check_file.erl +++ b/sources_non_forked/syntastic/syntax_checkers/erlang/erlang_check_file.erl @@ -13,28 +13,58 @@ main([File]) -> %% `rebar.config` is looked for, %% but it is not necessarily the one in the project root. %% I.e. it may be one deeper in the project file hierarchy. - RebarFile = rebar_file(Dir), - %% `rebar.config` might contain relative paths. - %% They are relative to the file! Not to the project root. - RebarOpts = rebar_opts(Dir ++ "/" ++ RebarFile), + Profile = which_compile_opts_profile(filename:absname(File)), + CompileOpts = case which_build_tool(Dir, Profile) of + {rebar, RebarFile} -> + %% `rebar.config` might contain relative paths. + %% They are relative to the file! Not to the project root. + %% rebar specific begin + rebar_opts(RebarFile); + %% rebar specific end + {erlangmk, ErlangMkDir} -> + %% Erlang.mk specific begin + erlangmk_opts(ErlangMkDir, Profile); + %% Erlang.mk specific end + undefined -> + fallback_opts() + end, code:add_patha(filename:absname("ebin")), %% `compile:file/2` requires the `{i, Path}` to be relative %% to CWD - no surprise here. - compile:file(File, Defs ++ translate_paths(Dir, RebarOpts)); + compile:file(File, Defs ++ translate_paths(Dir, CompileOpts)); main(_) -> io:format("Usage: ~s ~n", [escript:script_name()]), halt(1). -rebar_file(Dir) -> - DirList = filename:split(Dir), - case lists:last(DirList) of - "test" -> - "rebar.test.config"; - _ -> - "rebar.config" +which_compile_opts_profile(File) -> + case filename:basename(filename:dirname(File)) of + "test" -> test; + _ -> normal end. +which_build_tool(Dir, Profile) -> + %% rebar specific begin + RebarFile = rebar_file(Dir, Profile), + %% rebar specific end + case filelib:is_file(RebarFile) of + true -> + {rebar, RebarFile}; + false -> + %% Erlang.mk specific begin + ErlangMk = erlangmk_file(Dir), + %% Erlang.mk specific end + case filelib:is_file(ErlangMk) of + true -> {erlangmk, Dir}; + false -> undefined + end + end. + +rebar_file(Dir, normal) -> filename:join(Dir, "rebar.config"); +rebar_file(Dir, test) -> filename:join(Dir, "rebar.test.config"). + +erlangmk_file(Dir) -> filename:join(Dir, "erlang.mk"). + rebar_opts(RebarFile) -> Dir = get_root(filename:dirname(RebarFile)), case file:consult(RebarFile) of @@ -54,6 +84,165 @@ rebar_opts(RebarFile) -> rebar_opts("rebar.config") end. +erlangmk_opts(BaseDir, Profile) -> + Make = + case os:getenv("MAKE") of + false -> + case os:find_executable("gmake") of + false -> "make"; + Path -> Path + end; + Cmd -> + case (lists:member($/, Cmd) orelse lists:member($\\, Cmd)) of + true -> Cmd; + false -> os:find_executable(Cmd) + end + end, + ERLC_OPTS_Target = + case Profile of + normal -> "show-ERLC_OPTS"; + test -> "show-TEST_ERLC_OPTS" + end, + Args = [ + "--no-print-directory", + "-C", BaseDir, + "show-ERL_LIBS", + ERLC_OPTS_Target + ], + try + Port = erlang:open_port({spawn_executable, Make}, [ + {args, Args}, + exit_status, use_stdio, stderr_to_stdout]), + case erlangmk_port_receive_loop(Port, "", BaseDir) of + {error, _} -> + fallback_opts(); + {ok, {ErlLibs, ErlcOpts}} -> + [code:add_pathsa(filelib:wildcard( + filename:join([ErlLib, "*", "ebin"]))) + || ErlLib <- ErlLibs], + ErlcOpts + end + catch + error:_ -> + fallback_opts() + end. + +erlangmk_port_receive_loop(Port, Stdout, BaseDir) -> + receive + {Port, {exit_status, 0}} -> + erlangmk_format_opts(Stdout, BaseDir); + {Port, {exit_status, _}} -> + {error, {erlangmk, make_target_failure}}; + {Port, {data, Out}} -> + erlangmk_port_receive_loop(Port, Stdout ++ Out, BaseDir) + end. + +erlangmk_format_opts(Stdout, BaseDir) -> + case string:tokens(Stdout, "\n") of + [ErlLibsLine | ErlcOptsLines] -> + ErlLibs = erlangmk_format_erl_libs(ErlLibsLine), + ErlcOpts = erlangmk_format_erlc_opts(ErlcOptsLines, BaseDir), + {ok, {ErlLibs, ErlcOpts}}; + _ -> + {error, {erlangmk, incorrect_output}} + end. + +erlangmk_format_erl_libs(ErlLibsLine) -> + case os:type() of + {win32, _} -> string:tokens(ErlLibsLine, ";"); + _ -> string:tokens(ErlLibsLine, ":") + end. + +erlangmk_format_erlc_opts(ErlcOptsLines, BaseDir) -> + erlangmk_format_erlc_opts(ErlcOptsLines, [], BaseDir). + +erlangmk_format_erlc_opts(["+" ++ Option | Rest], Opts, BaseDir) -> + case make_term(Option) of + {error, _} -> erlangmk_format_erlc_opts(Rest, Opts, BaseDir); + Opt -> erlangmk_format_erlc_opts(Rest, [Opt | Opts], BaseDir) + end; +erlangmk_format_erlc_opts(["-I" ++ Opt | Rest], Opts, BaseDir) + when Opt =/= "" -> + erlangmk_format_erlc_opts(["-I", Opt | Rest], Opts, BaseDir); +erlangmk_format_erlc_opts(["-I", [C | _] = Dir | Rest], Opts, BaseDir) + when C =/= $- andalso C =/= $+ -> + AbsDir = filename:absname(Dir, BaseDir), + erlangmk_format_erlc_opts(Rest, [{i, AbsDir} | Opts], BaseDir); +erlangmk_format_erlc_opts(["-W" ++ Warn | Rest], Opts, BaseDir) + when Warn =/= "" -> + erlangmk_format_erlc_opts(["-W", Warn | Rest], Opts, BaseDir); +erlangmk_format_erlc_opts(["-W", Warn | Rest], Opts, BaseDir) -> + case Warn of + "all" -> + erlangmk_format_erlc_opts(Rest, [{warn_format, 999} | Opts], + BaseDir); + "error" -> + erlangmk_format_erlc_opts(Rest, [warnings_as_errors | Opts], + BaseDir); + "" -> + erlangmk_format_erlc_opts(Rest, [{warn_format, 1} | Opts], + BaseDir); + _ -> + try list_to_integer(Warn) of + Level -> + erlangmk_format_erlc_opts(Rest, + [{warn_format, Level} | Opts], BaseDir) + catch + error:badarg -> + erlangmk_format_erlc_opts(Rest, Opts, BaseDir) + end + end; +erlangmk_format_erlc_opts(["-D" ++ Opt | Rest], Opts, BaseDir) + when Opt =/= "" -> + erlangmk_format_erlc_opts(["-D", Opt | Rest], Opts, BaseDir); +erlangmk_format_erlc_opts(["-D", [C | _] = Val0 | Rest], Opts, BaseDir) + when C =/= $- andalso C =/= $+ -> + {Key0, Val1} = split_at_equals(Val0, []), + Key = list_to_atom(Key0), + case Val1 of + [] -> + erlangmk_format_erlc_opts(Rest, [{d, Key} | Opts], BaseDir); + Val2 -> + case make_term(Val2) of + {error, _} -> + erlangmk_format_erlc_opts(Rest, Opts, BaseDir); + Val -> + erlangmk_format_erlc_opts(Rest, [{d, Key, Val} | Opts], BaseDir) + end + end; +erlangmk_format_erlc_opts([PathFlag, [_ | _] = Dir | Rest], Opts, BaseDir) + when PathFlag =:= "-pa" orelse PathFlag =:= "-pz" -> + AbsDir = filename:absname(Dir, BaseDir), + case PathFlag of + "-pa" -> code:add_patha(AbsDir); + "-pz" -> code:add_pathz(AbsDir) + end, + erlangmk_format_erlc_opts(Rest, Opts, BaseDir); +erlangmk_format_erlc_opts([_ | Rest], Opts, BaseDir) -> + erlangmk_format_erlc_opts(Rest, Opts, BaseDir); +erlangmk_format_erlc_opts([], Opts, _) -> + lists:reverse(Opts). + +%% Function imported from erl_compile.erl from Erlang 19.1. +make_term(Str) -> + case erl_scan:string(Str) of + {ok, Tokens, _} -> + case erl_parse:parse_term(Tokens ++ [{dot, 1}]) of + {ok, Term} -> Term; + {error, Reason} -> {error, Reason} + end; + {error, Reason, _} -> + {error, Reason} + end. + +%% Function imported from erl_compile.erl from Erlang 19.1. +split_at_equals([$=|T], Acc) -> + {lists:reverse(Acc),T}; +split_at_equals([H|T], Acc) -> + split_at_equals(T, [H|Acc]); +split_at_equals([], Acc) -> + {lists:reverse(Acc),[]}. + fallback_opts() -> code:add_pathsa(filelib:wildcard("deps/*/ebin")), code:add_pathsa(nested_app_ebins()), diff --git a/sources_non_forked/syntastic/syntax_checkers/haxe/haxe.vim b/sources_non_forked/syntastic/syntax_checkers/haxe/haxe.vim index 789e9f3a..99ab4a17 100644 --- a/sources_non_forked/syntastic/syntax_checkers/haxe/haxe.vim +++ b/sources_non_forked/syntastic/syntax_checkers/haxe/haxe.vim @@ -32,9 +32,12 @@ function! SyntaxCheckers_haxe_haxe_GetLocList() dict if hxml !=# '' let makeprg = self.makeprgBuild({ - \ 'fname': syntastic#util#shescape(fnamemodify(hxml, ':t')) }) + \ 'fname': syntastic#util#shescape(fnamemodify(hxml, ':t')), + \ 'args_after' : ['--no-output'] }) - let errorformat = '%E%f:%l: characters %c-%n : %m' + let errorformat = + \ '%W%f:%l: characters %c-%n : Warning : %m,' . + \ '%E%f:%l: characters %c-%n : %m' let loclist = SyntasticMake({ \ 'makeprg': makeprg, diff --git a/sources_non_forked/syntastic/syntax_checkers/javascript/flow.vim b/sources_non_forked/syntastic/syntax_checkers/javascript/flow.vim index 02826548..456db2b2 100644 --- a/sources_non_forked/syntastic/syntax_checkers/javascript/flow.vim +++ b/sources_non_forked/syntastic/syntax_checkers/javascript/flow.vim @@ -25,7 +25,7 @@ function! SyntaxCheckers_javascript_flow_IsAvailable() dict if !executable(self.getExec()) return 0 endif - return syntastic#util#versionIsAtLeast(self.getVersion(self.getExecEscaped() . ' version'), [0, 18, 1]) + return syntastic#util#versionIsAtLeast(self.getVersion(self.getExecEscaped() . ' version'), [0, 34]) endfunction function! SyntaxCheckers_javascript_flow_GetLocList() dict @@ -34,8 +34,8 @@ function! SyntaxCheckers_javascript_flow_GetLocList() dict endif let makeprg = self.makeprgBuild({ - \ 'exe': self.getExecEscaped() . ' check', - \ 'args_after': '--show-all-errors --json' }) + \ 'exe': self.getExecEscaped() . ' status', + \ 'args_after': '--quiet --show-all-errors --json' }) let errorformat = \ '%f:%l:%c:%n: %m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/vala/valac.vim b/sources_non_forked/syntastic/syntax_checkers/vala/valac.vim index a60c2497..8b11d456 100644 --- a/sources_non_forked/syntastic/syntax_checkers/vala/valac.vim +++ b/sources_non_forked/syntastic/syntax_checkers/vala/valac.vim @@ -24,9 +24,12 @@ function! SyntaxCheckers_vala_valac_GetHighlightRegex(pos) " {{{1 endfunction " }}}1 function! SyntaxCheckers_vala_valac_GetLocList() dict " {{{1 - let vala_pkg_args = join(map(s:GetValaModules(), '"--pkg ".v:val'), ' ') - let vala_vapi_args = join(map(s:GetValaVapiDirs(), '"--vapidir ".v:val'), ' ') - let makeprg = self.makeprgBuild({ 'args': '-C ' . vala_pkg_args . ' ' . vala_vapi_args }) + let buf = bufnr('') + let makeprg = self.makeprgBuild({ + \ 'args': '-C ' . + \ s:GetValaOpts(buf, 'modules', 'modules', '--pkg') . ' ' . + \ s:GetValaOpts(buf, 'vapi_dirs', 'vapidirs', '--vapidir'), + \ }) let errorformat = \ '%A%f:%l.%c-%\d%\+.%\d%\+: %t%[a-z]%\+: %m,'. @@ -40,38 +43,27 @@ endfunction " }}}1 " Utilities {{{1 -function! s:GetValaModules() " {{{2 - if exists('g:syntastic_vala_modules') || exists('b:syntastic_vala_modules') - let modules = syntastic#util#var('vala_modules') - if type(modules) == type('') - return split(modules, '\m\s\+') - elseif type(modules) == type([]) - return copy(modules) +function! s:GetValaOpts(buf, name, comment, cmd) " {{{2 + let var = syntastic#util#var('vala_' . a:name) + if type(var) == type([]) + let opts = map(copy(var), 'syntastic#util#shescape(v:val)') + elseif type(var) == type('') + if var !=# '' + let opts = split(var, '\s\+') else - echoerr 'syntastic_vala_modules must be either list or string: fallback to in file modules string' + let opts = [] + for line in filter(getbufline(a:buf, 1, 100), 'v:val =~# ' . string('\m^//\s\+' . a:comment . ':\s*')) + call extend(opts, split( matchstr(line, '\m^//\s\+' . a:comment . ':\s*\zs.*'), '\s\+' )) + endfor + + call map( filter(opts, 'v:val !=# ""'), 'syntastic#util#shescape(v:val)' ) endif + else + call syntastic#log#error('syntastic_vala_' . a:name . ' must be either a list, or a string') + return '' endif - let modules_line = search('^// modules: ', 'n') - let modules_str = getline(modules_line) - return split(strpart(modules_str, 12), '\m\s\+') -endfunction " }}}2 - -function! s:GetValaVapiDirs() " {{{2 - if exists('g:syntastic_vala_vapi_dirs') || exists('b:syntastic_vala_vapi_dirs') - let vapi_dirs = syntastic#util#var('vala_vapi_dirs') - if type(vapi_dirs) == type('') - return split(vapi_dirs, '\m\s\+') - elseif type(vapi_dirs) == type([]) - return copy(vapi_dirs) - else - echoerr 'syntastic_vala_vapi_dirs must be either a list, or a string: fallback to in-file modules string' - endif - endif - - let vapi_line = search('^//\s*vapidirs:\s*','n') - let vapi_str = getline(vapi_line) - return split( substitute( vapi_str, '\m^//\s*vapidirs:\s*', '', 'g' ), '\m\s\+' ) + return join(map(opts, string(a:cmd . ' ') . ' . v:val')) endfunction " }}}2 " }}}1 diff --git a/sources_non_forked/vim-coffee-script/after/indent/html.vim b/sources_non_forked/vim-coffee-script/after/indent/html.vim index 2fa86371..0823e689 100644 --- a/sources_non_forked/vim-coffee-script/after/indent/html.vim +++ b/sources_non_forked/vim-coffee-script/after/indent/html.vim @@ -18,7 +18,7 @@ setlocal indentexpr=GetCoffeeHtmlIndent(v:lnum) function! GetCoffeeHtmlIndent(curlinenum) " See if we're inside a coffeescript block. - let scriptlnum = searchpair('', 'bWn') let prevlnum = prevnonblank(a:curlinenum) diff --git a/sources_non_forked/vim-coffee-script/after/syntax/html.vim b/sources_non_forked/vim-coffee-script/after/syntax/html.vim index aa01e7e9..a78ba88d 100644 --- a/sources_non_forked/vim-coffee-script/after/syntax/html.vim +++ b/sources_non_forked/vim-coffee-script/after/syntax/html.vim @@ -9,7 +9,7 @@ endif " Syntax highlighting for text/coffeescript script tags syn include @htmlCoffeeScript syntax/coffee.vim -syn region coffeeScript start=##me=s-1 keepend \ contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc \ containedin=htmlHead diff --git a/sources_non_forked/vim-coffee-script/test/test.html b/sources_non_forked/vim-coffee-script/test/test.html index 34791453..0da7b62d 100644 --- a/sources_non_forked/vim-coffee-script/test/test.html +++ b/sources_non_forked/vim-coffee-script/test/test.html @@ -4,4 +4,14 @@ def: 42 } + + diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index 576dda19..1185ff15 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -195,7 +195,7 @@ function! fugitive#detect(path) abort nnoremap y :call setreg(v:register, recall()) endif let buffer = fugitive#buffer() - if expand('%:p') =~# '//' + if expand('%:p') =~# '://' call buffer.setvar('&path', s:sub(buffer.getvar('&path'), '^\.%(,|$)', '')) endif if stridx(buffer.getvar('&tags'), escape(b:git_dir, ', ')) == -1 @@ -700,7 +700,11 @@ function! s:Git(bang, args) abort let args = matchstr(a:args,'\v\C.{-}%($|\\@` in mappings examples for consisten documentation across the README [gh-1192] +* All of files should be written in utf-8 if the file will be passed to external command. [gh-1184] + +BUG FIXES: + +* Honor `g:go_echo_command_info` when dispatching builds in neovim [gh-1176] +* Fix `:GoBuild` error in neovim due to invalid jobcontrol handler function signatures (`s:on_stdout`, `s:on_stderr`)[gh-1176] +* Update statusline before and after `go#jobcontrol#Spawn` command is executed [gh-1176] +* Correctly report the value of the 'g:go_guru_tags' variable [gh-1177] +* Ensure no trailing `:` exist in GOPATH detection if initial GOPATH is not set [gh-1194] + +## 1.11 - (January 9, 2017) + +FEATURES: + +* Travis test integration has been added. Now any file that is added as `_test.vim` will be automatically tested in for every Pull Request (just like how we add tests to Go with `_test.go`). Going forward this will tremendously increase the stability and decrease the maintaince burden of vim-go. [gh-1157] * Add new `g:go_updatetime` setting to change the default updatetime (which was hardcoded previously) [gh-1055] * Add new `g:go_template_use_pkg` setting to enable to use cwd as package name instead of basic template file [gh-1124] @@ -9,6 +35,8 @@ IMPROVEMENTS: * Add `statusline` support for `:GoMetaLinter` [gh-1120] * Quickfix and Location lists contain now a descriptive title (requires at least Vim `7.4.2200`)[gh-1004] +* Check `go env GOPATH` as well for `:GoInstallBinaries` as Go has now a default path for GOPATH ("~/go")starting with 1.8 [gh-1152] +* `:GoDocBrowser` now also works on import paths [gh-1174] BUG FIXES: @@ -24,6 +52,22 @@ BUG FIXES: * Fix referencing a non defined variable for async commands when bang (!) was used * Fix `:GoDef` failing for a modified buffer if `hidden` was not set [gh-1132] * Fix `:GoDefStack` to allow popping from jump list when buffer is modified [gh-1133] +* Improve internal defining of functions and referencing them for async operations [gh-1155] +* Fix `:GoMetaLinter` failing if `go_metalinter_command` is set. [gh-1160] +* Fix `:GoMetaLinter`'s `go_metalinter_deadline` setting for async mode [gh-1146] + +BACKWARDS INCOMPATIBILITIES: + +* The following syntax options are now disabled by default. If you're using them be sure to set them in your .vimrc [gh-1167] + +```viml +g:go_highlight_array_whitespace_error +g:go_highlight_chan_whitespace_error +g:go_highlight_extra_types +g:go_highlight_space_tab_error +g:go_highlight_trailing_whitespace_error +``` + ## 1.10 (November 24, 2016) diff --git a/sources_non_forked/vim-go/Makefile b/sources_non_forked/vim-go/Makefile new file mode 100644 index 00000000..20b296d7 --- /dev/null +++ b/sources_non_forked/vim-go/Makefile @@ -0,0 +1,7 @@ +all: test + +test: + @echo "==> Running tests" + @./scripts/test.sh + +.PHONY: all test diff --git a/sources_non_forked/vim-go/README.md b/sources_non_forked/vim-go/README.md index 504149b2..b5542fb5 100644 --- a/sources_non_forked/vim-go/README.md +++ b/sources_non_forked/vim-go/README.md @@ -1,4 +1,4 @@ -# vim-go +# vim-go [![Build Status](http://img.shields.io/travis/fatih/vim-go.svg?style=flat-square)](https://travis-ci.org/fatih/vim-go)

Vim-go logo @@ -137,43 +137,43 @@ current buffer. You can also open the definition/declaration, in a new vertical, horizontal, or tab, for the word under your cursor: ```vim -au FileType go nmap ds (go-def-split) -au FileType go nmap dv (go-def-vertical) -au FileType go nmap dt (go-def-tab) +au FileType go nmap ds (go-def-split) +au FileType go nmap dv (go-def-vertical) +au FileType go nmap dt (go-def-tab) ``` Open the relevant Godoc for the word under the cursor with `gd` or open it vertically with `gv` ```vim -au FileType go nmap gd (go-doc) -au FileType go nmap gv (go-doc-vertical) +au FileType go nmap gd (go-doc) +au FileType go nmap gv (go-doc-vertical) ``` Or open the Godoc in browser ```vim -au FileType go nmap gb (go-doc-browser) +au FileType go nmap gb (go-doc-browser) ``` Show a list of interfaces which is implemented by the type under your cursor with `s` ```vim -au FileType go nmap s (go-implements) +au FileType go nmap s (go-implements) ``` Show type info for the word under your cursor with `i` (useful if you have disabled auto showing type info via `g:go_auto_type_info`) ```vim -au FileType go nmap i (go-info) +au FileType go nmap i (go-info) ``` Rename the identifier under the cursor to a new name ```vim -au FileType go nmap e (go-rename) +au FileType go nmap e (go-rename) ``` More `` mappings can be seen with `:he go-mappings`. Also these are just @@ -245,8 +245,8 @@ Run `:GoRun` in a new tab, horizontal split or vertical split terminal ```vim au FileType go nmap rt (go-run-tab) -au FileType go nmap rs (go-run-split) -au FileType go nmap rv (go-run-vertical) +au FileType go nmap rs (go-run-split) +au FileType go nmap rv (go-run-vertical) ``` By default new terminals are opened in a vertical split. To change it @@ -288,6 +288,31 @@ information. It includes section](https://github.com/fatih/vim-go/wiki/FAQ-Troubleshooting), and many other [various pieces](https://github.com/fatih/vim-go/wiki) of information. +## Development & Testing + +vim-go supports now test files. Please check `autoload` folder for examples. If +you add a new feature be sure you also include the `_test.vim` file next to the +script. Test functions should be starting with `Test_`, example: + + +```viml +function Test_run_fmt() + call assert_equal(expected, actual) + ... +endfunction +``` + +You can locally test it by running: + +``` +make +``` + +This will run all tests and print either `PASS` or `FAIL` to indicate the final +status of all tests. + +Additionally, each new pull request will trigger a new Travis-ci job. + ## Donation People have asked for this for a long time, now you can be a fully supporter by diff --git a/sources_non_forked/vim-go/Rakefile b/sources_non_forked/vim-go/Rakefile deleted file mode 100644 index 64346ff0..00000000 --- a/sources_non_forked/vim-go/Rakefile +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env rake - -task :ci => [:dump, :test] - -task :dump do - sh 'vim --version' -end - -# Firstly, `bundle install; bundle install --deployment` -# Then, `rake test` -task :test do - sh 'bundle exec vim-flavor test' -end diff --git a/sources_non_forked/vim-go/autoload/go/asmfmt.vim b/sources_non_forked/vim-go/autoload/go/asmfmt.vim index 07779b57..cc8acd3b 100644 --- a/sources_non_forked/vim-go/autoload/go/asmfmt.vim +++ b/sources_non_forked/vim-go/autoload/go/asmfmt.vim @@ -25,7 +25,7 @@ function! go#asmfmt#Format() abort " Write the current buffer to a tempfile. let l:tmpname = tempname() - call writefile(getline(1, '$'), l:tmpname) + call writefile(go#util#GetLines(), l:tmpname) " Run asmfmt. let path = go#path#CheckBinPath("asmfmt") diff --git a/sources_non_forked/vim-go/autoload/go/cmd.vim b/sources_non_forked/vim-go/autoload/go/cmd.vim index e7a5daf7..fbc62823 100644 --- a/sources_non_forked/vim-go/autoload/go/cmd.vim +++ b/sources_non_forked/vim-go/autoload/go/cmd.vim @@ -32,8 +32,11 @@ function! go#cmd#Build(bang, ...) abort \}) return elseif has('nvim') + if get(g:, 'go_echo_command_info', 1) + call go#util#EchoProgress("building dispatched ...") + endif + " if we have nvim, call it asynchronously and return early ;) - call go#util#EchoProgress("building dispatched ...") call go#jobcontrol#Spawn(a:bang, "build", args) return endif @@ -419,7 +422,7 @@ function s:cmd_job(args) abort call go#statusline#Update(status_dir, status) endfunction - let a:args.error_info_cb = function('s:error_info_cb') + let a:args.error_info_cb = funcref('s:error_info_cb') let callbacks = go#job#Spawn(a:args) let start_options = { diff --git a/sources_non_forked/vim-go/autoload/go/complete.vim b/sources_non_forked/vim-go/autoload/go/complete.vim index 2663afbd..2bd4eae7 100644 --- a/sources_non_forked/vim-go/autoload/go/complete.vim +++ b/sources_non_forked/vim-go/autoload/go/complete.vim @@ -1,18 +1,8 @@ let s:sock_type = (has('win32') || has('win64')) ? 'tcp' : 'unix' function! s:gocodeCurrentBuffer() abort - let buf = getline(1, '$') - if &encoding != 'utf-8' - let buf = map(buf, 'iconv(v:val, &encoding, "utf-8")') - endif - if &l:fileformat == 'dos' - " XXX: line2byte() depend on 'fileformat' option. - " so if fileformat is 'dos', 'buf' must include '\r'. - let buf = map(buf, 'v:val."\r"') - endif let file = tempname() - call writefile(buf, file) - + call writefile(go#util#GetLines(), file) return file endfunction diff --git a/sources_non_forked/vim-go/autoload/go/coverage.vim b/sources_non_forked/vim-go/autoload/go/coverage.vim index 9b027861..56113b93 100644 --- a/sources_non_forked/vim-go/autoload/go/coverage.vim +++ b/sources_non_forked/vim-go/autoload/go/coverage.vim @@ -283,7 +283,7 @@ function s:coverage_job(args) call go#statusline#Update(status_dir, status) endfunction - let a:args.error_info_cb = function('s:error_info_cb') + let a:args.error_info_cb = funcref('s:error_info_cb') let callbacks = go#job#Spawn(a:args) let start_options = { diff --git a/sources_non_forked/vim-go/autoload/go/def.vim b/sources_non_forked/vim-go/autoload/go/def.vim index d3b51c26..cf7c5c4a 100644 --- a/sources_non_forked/vim-go/autoload/go/def.vim +++ b/sources_non_forked/vim-go/autoload/go/def.vim @@ -16,7 +16,7 @@ function! go#def#Jump(mode) abort if &modified " Write current unsaved buffer to a temp file and use the modified content let l:tmpname = tempname() - call writefile(getline(1, '$'), l:tmpname) + call writefile(go#util#GetLines(), l:tmpname) let fname = l:tmpname endif @@ -41,8 +41,7 @@ function! go#def#Jump(mode) abort let stdin_content = "" if &modified - let sep = go#util#LineEnding() - let content = join(getline(1, '$'), sep) + let content = join(go#util#GetLines(), "\n") let stdin_content = fname . "\n" . strlen(content) . "\n" . content call add(cmd, "-modified") endif @@ -87,7 +86,7 @@ function! go#def#Jump(mode) abort return endif - call s:jump_to_declaration(out, a:mode, bin_name) + call go#def#jump_to_declaration(out, a:mode, bin_name) let $GOPATH = old_gopath endfunction @@ -96,10 +95,10 @@ function! s:jump_to_declaration_cb(mode, bin_name, job, exit_status, data) abort return endif - call s:jump_to_declaration(a:data[0], a:mode, a:bin_name) + call go#def#jump_to_declaration(a:data[0], a:mode, a:bin_name) endfunction -function! s:jump_to_declaration(out, mode, bin_name) abort +function! go#def#jump_to_declaration(out, mode, bin_name) abort let final_out = a:out if a:bin_name == "godef" " append the type information to the same line so our we can parse it. @@ -299,7 +298,7 @@ function s:def_job(args) abort " do not print anything during async definition search&jump endfunction - let a:args.error_info_cb = function('s:error_info_cb') + let a:args.error_info_cb = funcref('s:error_info_cb') let callbacks = go#job#Spawn(a:args) let start_options = { diff --git a/sources_non_forked/vim-go/autoload/go/def_test.vim b/sources_non_forked/vim-go/autoload/go/def_test.vim new file mode 100644 index 00000000..a5ed24fe --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/def_test.vim @@ -0,0 +1,32 @@ +func Test_jump_to_declaration_guru() + let file_name = "test-fixtures/def/jump.go" + let lnum = 5 + let col = 6 + + let out = printf("%s:%d:%d: defined here as func main", file_name, lnum, col) + let bin_name = "guru" + + call go#def#jump_to_declaration(out, "", bin_name) + + call assert_equal(file_name, bufname("%")) + call assert_equal(lnum, getcurpos()[1]) + call assert_equal(col, getcurpos()[2]) +endfunc + +func Test_jump_to_declaration_godef() + let file_name = "test-fixtures/def/jump.go" + let lnum = 5 + let col = 6 + + " note that the output of godef has two lines + let out = printf("%s:%d:%d\ndefined here as func main", file_name, lnum, col) + let bin_name = "godef" + + call go#def#jump_to_declaration(out, "", bin_name) + + call assert_equal(file_name, bufname("%")) + call assert_equal(lnum, getcurpos()[1]) + call assert_equal(col, getcurpos()[2]) +endfunc + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/doc.vim b/sources_non_forked/vim-go/autoload/go/doc.vim index 3756167d..22ea8cc7 100644 --- a/sources_non_forked/vim-go/autoload/go/doc.vim +++ b/sources_non_forked/vim-go/autoload/go/doc.vim @@ -31,12 +31,11 @@ function! go#doc#OpenBrowser(...) abort let import = out["import"] let name = out["name"] - - " if import is empty, it means we selected a package name - if import ==# "" - let godoc_url = "https://godoc.org/" . name - else - let godoc_url = "https://godoc.org/" . import . "#" . name + let decl = out["decl"] + + let godoc_url = "https://godoc.org/" . import + if decl !~ "^package" + let godoc_url .= "#" . name endif echo godoc_url @@ -153,8 +152,7 @@ function! s:gogetdoc(json) abort " file size followed by newline " file contents let in = "" - let sep = go#util#LineEnding() - let content = join(getline(1, '$'), sep) + let content = join(go#util#GetLines(), "\n") let in = fname . "\n" . strlen(content) . "\n" . content let command .= " -modified" let out = go#util#System(command, in) diff --git a/sources_non_forked/vim-go/autoload/go/fmt.vim b/sources_non_forked/vim-go/autoload/go/fmt.vim index 391fca93..8a327d3b 100644 --- a/sources_non_forked/vim-go/autoload/go/fmt.vim +++ b/sources_non_forked/vim-go/autoload/go/fmt.vim @@ -2,26 +2,8 @@ " Use of this source code is governed by a BSD-style " license that can be found in the LICENSE file. " -" fmt.vim: Vim command to format Go files with gofmt. -" -" This filetype plugin add a new commands for go buffers: -" -" :Fmt -" -" Filter the current Go buffer through gofmt. -" It tries to preserve cursor position and avoids -" replacing the buffer with stderr output. -" -" Options: -" -" g:go_fmt_command [default="gofmt"] -" -" Flag naming the gofmt executable to use. -" -" g:go_fmt_autosave [default=1] -" -" Flag to auto call :Fmt when saved file -" +" fmt.vim: Vim command to format Go files with gofmt (and gofmt compatible +" toorls, such as goimports). if !exists("g:go_fmt_command") let g:go_fmt_command = "gofmt" @@ -67,6 +49,13 @@ function! go#fmt#Format(withGoimport) abort catch let l:curw = winsaveview() endtry + + " save our undo file to be restored after we are done. This is needed to + " prevent an additional undo jump due to BufWritePre auto command and also + " restore 'redo' history because it's getting being destroyed every + " BufWritePre + let tmpundofile = tempname() + exe 'wundo! ' . tmpundofile else " Save cursor position and many other things. let l:curw = winsaveview() @@ -74,135 +63,32 @@ function! go#fmt#Format(withGoimport) abort " Write current unsaved buffer to a temp file let l:tmpname = tempname() - call writefile(getline(1, '$'), l:tmpname) - - if g:go_fmt_experimental == 1 - " save our undo file to be restored after we are done. This is needed to - " prevent an additional undo jump due to BufWritePre auto command and also - " restore 'redo' history because it's getting being destroyed every - " BufWritePre - let tmpundofile = tempname() - exe 'wundo! ' . tmpundofile - endif - - " get the command first so we can test it - let bin_name = g:go_fmt_command - if a:withGoimport == 1 - let bin_name = g:go_goimports_bin - endif - - " check if the user has installed command binary. - " For example if it's goimports, let us check if it's installed, - " if not the user get's a warning via go#path#CheckBinPath() - let bin_path = go#path#CheckBinPath(bin_name) - if empty(bin_path) - return - endif - - if bin_name != "gofmt" - " change GOPATH too, so goimports can pick up the correct library - let old_gopath = $GOPATH - let $GOPATH = go#path#Detect() - endif - - " populate the final command with user based fmt options - let command = bin_path . ' -w ' - if a:withGoimport != 1 - let command = command . g:go_fmt_options - endif - - if bin_name == "goimports" - if !exists('b:goimports_vendor_compatible') - let out = go#util#System(bin_path . " --help") - if out !~ "-srcdir" - call go#util#EchoWarning(printf("vim-go: goimports (%s) does not support srcdir. Update with: :GoUpdateBinaries", bin_path)) - else - let b:goimports_vendor_compatible = 1 - endif - endif - - if exists('b:goimports_vendor_compatible') && b:goimports_vendor_compatible - let ssl_save = &shellslash - set noshellslash - let command = command . '-srcdir ' . shellescape(expand("%:p")) - let &shellslash = ssl_save - endif - endif - - " execute our command... + call writefile(go#util#GetLines(), l:tmpname) if go#util#IsWin() let l:tmpname = tr(l:tmpname, '\', '/') endif - let out = go#util#System(command . " " . l:tmpname) - if bin_name != "gofmt" - let $GOPATH = old_gopath + let bin_name = g:go_fmt_command + if a:withGoimport == 1 + let bin_name = g:go_goimports_bin endif - let l:listtype = "locationlist" - "if there is no error on the temp file replace the output with the current - "file (if this fails, we can always check the outputs first line with: - "splitted =~ 'package \w\+') + let out = go#fmt#run(bin_name, l:tmpname, expand('%')) if go#util#ShellError() == 0 - " remove undo point caused via BufWritePre - try | silent undojoin | catch | endtry - - " Replace current file with temp file, then reload buffer - let old_fileformat = &fileformat - if exists("*getfperm") - " save old file permissions - let original_fperm = getfperm(expand('%')) - endif - call rename(l:tmpname, expand('%')) - " restore old file permissions - if exists("*setfperm") && original_fperm != '' - call setfperm(expand('%'), original_fperm) - endif - silent edit! - let &fileformat = old_fileformat - let &syntax = &syntax - - " clean up previous location list, but only if it's due to fmt - if exists('b:got_fmt_error') && b:got_fmt_error - let b:got_fmt_error = 0 - call go#list#Clean(l:listtype) - call go#list#Window(l:listtype) - endif + call go#fmt#update_file(l:tmpname, expand('%')) elseif g:go_fmt_fail_silently == 0 - let splitted = split(out, '\n') - "otherwise get the errors and put them to location list - let errors = [] - for line in splitted - let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)') - if !empty(tokens) - call add(errors, {"filename": @%, - \"lnum": tokens[2], - \"col": tokens[3], - \"text": tokens[4]}) - endif - endfor - if empty(errors) - % | " Couldn't detect gofmt error format, output errors - endif - if !empty(errors) - call go#list#Populate(l:listtype, errors, 'Format') - echohl Error | echomsg "Gofmt returned error" | echohl None - endif - - let b:got_fmt_error = 1 - call go#list#Window(l:listtype, len(errors)) - - " We didn't use the temp file, so clean up - call delete(l:tmpname) + let errors = s:parse_errors(out) + call s:show_errors(errors) endif + " We didn't use the temp file, so clean up + call delete(l:tmpname) + if g:go_fmt_experimental == 1 " restore our undo history silent! exe 'rundo ' . tmpundofile call delete(tmpundofile) - endif - if g:go_fmt_experimental == 1 " Restore our cursor/windows positions, folds, etc. if empty(l:curw) silent! loadview @@ -215,6 +101,134 @@ function! go#fmt#Format(withGoimport) abort endif endfunction +" update_file updates the target file with the given formatted source +function! go#fmt#update_file(source, target) + " remove undo point caused via BufWritePre + try | silent undojoin | catch | endtry + + let old_fileformat = &fileformat + if exists("*getfperm") + " save file permissions + let original_fperm = getfperm(a:target) + endif + + call rename(a:source, a:target) + + " restore file permissions + if exists("*setfperm") && original_fperm != '' + call setfperm(a:target , original_fperm) + endif + + " reload buffer to reflect latest changes + silent! edit! + + let &fileformat = old_fileformat + let &syntax = &syntax + + " clean up previous location list + let l:listtype = "locationlist" + call go#list#Clean(l:listtype) + call go#list#Window(l:listtype) +endfunction + +" run runs the gofmt/goimport command for the given source file and returns +" the the output of the executed command. Target is the real file to be +" formated. +function! go#fmt#run(bin_name, source, target) + let cmd = s:fmt_cmd(a:bin_name, a:source, a:target) + if cmd[0] == "goimports" + " change GOPATH too, so goimports can pick up the correct library + let old_gopath = $GOPATH + let $GOPATH = go#path#Detect() + endif + + let command = join(cmd, " ") + + " execute our command... + let out = go#util#System(command) + + if cmd[0] == "goimports" + let $GOPATH = old_gopath + endif + + return out +endfunction + +" fmt_cmd returns a dict that contains the command to execute gofmt (or +" goimports). args is dict with +function! s:fmt_cmd(bin_name, source, target) + " check if the user has installed command binary. + " For example if it's goimports, let us check if it's installed, + " if not the user get's a warning via go#path#CheckBinPath() + let bin_path = go#path#CheckBinPath(a:bin_name) + if empty(bin_path) + return + endif + + " start constructing the command + let cmd = [bin_path] + call add(cmd, "-w") + + if a:bin_name != "goimports" + call extend(cmd, split(g:go_fmt_options, " ")) + else + " lazy check if goimports support `-srcdir`. We should eventually remove + " this in the future + if !exists('b:goimports_vendor_compatible') + let out = go#util#System(bin_path . " --help") + if out !~ "-srcdir" + call go#util#EchoWarning(printf("vim-go: goimports (%s) does not support srcdir. Update with: :GoUpdateBinaries", bin_path)) + else + let b:goimports_vendor_compatible = 1 + endif + endif + + if exists('b:goimports_vendor_compatible') && b:goimports_vendor_compatible + let ssl_save = &shellslash + set noshellslash + call extend(cmd, ["-srcdir", shellescape(fnamemodify(a:target, ":p"))]) + let &shellslash = ssl_save + endif + endif + + call add(cmd, a:source) + return cmd +endfunction + +" parse_errors parses the given errors and returns a list of parsed errors +function! s:parse_errors(content) abort + let splitted = split(a:content, '\n') + + " list of errors to be put into location list + let errors = [] + for line in splitted + let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)') + if !empty(tokens) + call add(errors,{ + \"lnum": tokens[2], + \"col": tokens[3], + \"text": tokens[4], + \ }) + endif + endfor + + return errors +endfunction + +" show_errors opens a location list and shows the given errors. If the given +" errors is empty, it closes the the location list +function! s:show_errors(errors) abort + let l:listtype = "locationlist" + if !empty(a:errors) + call go#list#Populate(l:listtype, a:errors, 'Format') + echohl Error | echomsg "Gofmt returned error" | echohl None + endif + + " this closes the window if there are no errors or it opens + " it if there is any + call go#list#Window(l:listtype, len(a:errors)) +endfunction + function! go#fmt#ToggleFmtAutoSave() abort if get(g:, "go_fmt_autosave", 1) let g:go_fmt_autosave = 0 @@ -225,4 +239,5 @@ function! go#fmt#ToggleFmtAutoSave() abort let g:go_fmt_autosave = 1 call go#util#EchoProgress("auto fmt enabled") endfunction + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/fmt_test.vim b/sources_non_forked/vim-go/autoload/go/fmt_test.vim new file mode 100644 index 00000000..0de2933c --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/fmt_test.vim @@ -0,0 +1,31 @@ +func Test_run_fmt() + let actual_file = tempname() + call writefile(readfile("test-fixtures/fmt/hello.go"), actual_file) + + let expected = join(readfile("test-fixtures/fmt/hello_golden.go"), "\n") + + " run our code + call go#fmt#run("gofmt", actual_file, "test-fixtures/fmt/hello.go") + + " this should now contain the formatted code + let actual = join(readfile(actual_file), "\n") + + call assert_equal(expected, actual) +endfunc + +func Test_update_file() + let expected = join(readfile("test-fixtures/fmt/hello_golden.go"), "\n") + let source_file = tempname() + call writefile(readfile("test-fixtures/fmt/hello_golden.go"), source_file) + + let target_file = tempname() + call writefile([""], target_file) + + " update_file now + call go#fmt#update_file(source_file, target_file) + + " this should now contain the formatted code + let actual = join(readfile(target_file), "\n") + + call assert_equal(expected, actual) +endfunc diff --git a/sources_non_forked/vim-go/autoload/go/guru.vim b/sources_non_forked/vim-go/autoload/go/guru.vim index 78cacc0b..206ca87b 100644 --- a/sources_non_forked/vim-go/autoload/go/guru.vim +++ b/sources_non_forked/vim-go/autoload/go/guru.vim @@ -1,6 +1,6 @@ " guru.vim -- Vim integration for the Go guru. -" guru_cmd returns a dict that contains the command to execute guru. option +" guru_cmd returns a dict that contains the command to execute guru. args " is dict with following options: " mode : guru mode, such as 'implements' " format : output format, either 'plain' or 'json' @@ -34,10 +34,8 @@ function! s:guru_cmd(args) range abort let cmd = [bin_path] let filename = fnamemodify(expand("%"), ':p:gs?\\?/?') - let stdin_content = "" if &modified - let sep = go#util#LineEnding() - let content = join(getline(1, '$'), sep ) + let content = join(go#util#GetLines(), "\n") let result.stdin_content = filename . "\n" . strlen(content) . "\n" . content call add(cmd, "-modified") endif @@ -127,7 +125,7 @@ function! s:sync_guru(args) abort " run, forrest run!!! let command = join(result.cmd, " ") - if &modified + if has_key(result, 'stdin_content') let out = go#util#System(command, result.stdin_content) else let out = go#util#System(command) @@ -198,10 +196,10 @@ function! s:async_guru(args) abort endfunction let start_options = { - \ 'close_cb': function("s:close_cb"), + \ 'close_cb': funcref("s:close_cb"), \ } - if &modified + if has_key(result, 'stdin_content') let l:tmpname = tempname() call writefile(split(result.stdin_content, "\n"), l:tmpname, "b") let l:start_options.in_io = "file" @@ -543,7 +541,7 @@ function! go#guru#ClearSameIds() abort endfor " remove the autocmds we defined - if exists("#BufWinEnter") + if exists("#BufWinEnter#") autocmd! BufWinEnter endif endfunction @@ -635,7 +633,7 @@ function! go#guru#Tags(...) abort if !exists('g:go_guru_tags') call go#util#EchoSuccess("guru tags is not set") else - call go#util#EchoSuccess("current guru tags: ". a:1) + call go#util#EchoSuccess("current guru tags: ". g:go_guru_tags) endif endfunction diff --git a/sources_non_forked/vim-go/autoload/go/jobcontrol.vim b/sources_non_forked/vim-go/autoload/go/jobcontrol.vim index 189ed5f4..d914cb8c 100644 --- a/sources_non_forked/vim-go/autoload/go/jobcontrol.vim +++ b/sources_non_forked/vim-go/autoload/go/jobcontrol.vim @@ -38,6 +38,16 @@ endfunction " GOPATH when g:go_autodetect_gopath is enabled. The job is started inside the " current files folder. function! s:spawn(bang, desc, args) abort + let status_type = a:args[0] + let status_dir = expand('%:p:h') + let started_at = reltime() + + call go#statusline#Update(status_dir, { + \ 'desc': "current status", + \ 'type': status_type, + \ 'state': "started", + \}) + let job = { \ 'desc': a:desc, \ 'bang': a:bang, @@ -49,6 +59,9 @@ function! s:spawn(bang, desc, args) abort \ 'on_stdout': function('s:on_stdout'), \ 'on_stderr': function('s:on_stderr'), \ 'on_exit' : function('s:on_exit'), + \ 'status_type' : status_type, + \ 'status_dir' : status_dir, + \ 'started_at' : started_at, \ } " modify GOPATH if needed @@ -91,6 +104,23 @@ endfunction " on_stderr handler. If there are no errors and a quickfix window is open, " it'll be closed. function! s:on_exit(job_id, exit_status, event) dict abort + let status = { + \ 'desc': 'last status', + \ 'type': self.status_type, + \ 'state': "success", + \ } + + if a:exit_status + let status.state = "failed" + endif + + let elapsed_time = reltimestr(reltime(self.started_at)) + " strip whitespace + let elapsed_time = substitute(elapsed_time, '^\s*\(.\{-}\)\s*$', '\1', '') + let status.state .= printf(" (%ss)", elapsed_time) + + call go#statusline#Update(self.status_dir, status) + let std_combined = self.stderr + self.stdout let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' @@ -105,14 +135,20 @@ function! s:on_exit(job_id, exit_status, event) dict abort call go#list#Window(l:listtype) let self.state = "SUCCESS" - call go#util#EchoSuccess("SUCCESS") + + if get(g:, 'go_echo_command_info', 1) + call go#util#EchoSuccess("[" . self.status_type . "] SUCCESS") + endif execute cd . fnameescape(dir) return endif let self.state = "FAILED" - call go#util#EchoError("FAILED") + + if get(g:, 'go_echo_command_info', 1) + call go#util#EchoError("[" . self.status_type . "] FAILED") + endif let errors = go#tool#ParseErrors(std_combined) let errors = go#tool#FilterValids(errors) @@ -148,13 +184,13 @@ endfunction " on_stdout is the stdout handler for jobstart(). It collects the output of " stderr and stores them to the jobs internal stdout list. -function! s:on_stdout(job_id, data) dict abort +function! s:on_stdout(job_id, data, event) dict abort call extend(self.stdout, a:data) endfunction " on_stderr is the stderr handler for jobstart(). It collects the output of " stderr and stores them to the jobs internal stderr list. -function! s:on_stderr(job_id, data) dict abort +function! s:on_stderr(job_id, data, event) dict abort call extend(self.stderr, a:data) endfunction diff --git a/sources_non_forked/vim-go/autoload/go/lint.vim b/sources_non_forked/vim-go/autoload/go/lint.vim index d81072a1..c62f2520 100644 --- a/sources_non_forked/vim-go/autoload/go/lint.vim +++ b/sources_non_forked/vim-go/autoload/go/lint.vim @@ -10,10 +10,6 @@ if !exists("g:go_metalinter_enabled") let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck'] endif -if !exists("g:go_metalinter_deadline") - let g:go_metalinter_deadline = "5s" -endif - if !exists("g:go_golint_bin") let g:go_golint_bin = "golint" endif @@ -48,16 +44,33 @@ function! go#lint#Gometa(autosave, ...) abort let cmd += [expand('%:p:h')] else " the user wants something else, let us use it. - let cmd += [split(g:go_metalinter_command, " ")] + let cmd += split(g:go_metalinter_command, " ") endif + " gometalinter has a default deadline of 5 seconds. + " + " For async mode (s:lint_job), we want to override the default deadline only + " if we have a deadline configured. + " + " For sync mode (go#tool#ExecuteInDir), always explicitly pass the 5 seconds + " deadline if there is no other deadline configured. If a deadline is + " configured, then use it. + + " Call gometalinter asynchronously. if go#util#has_job() && has('lambda') + let deadline = get(g:, 'go_metalinter_deadline', 0) + if deadline != 0 + let cmd += ["--deadline=" . deadline] + endif + call s:lint_job({'cmd': cmd}) return endif - " we add deadline only for sync mode - let cmd += ["--deadline=" . g:go_metalinter_deadline] + " We're calling gometalinter synchronously. + + let cmd += ["--deadline=" . get(g:, 'go_metalinter_deadline', "5s")] + if a:autosave " include only messages for the active buffer let cmd += ["--include='^" . expand('%:p') . ".*$'"] @@ -283,8 +296,8 @@ function s:lint_job(args) endfunction let start_options = { - \ 'callback': function("s:callback"), - \ 'close_cb': function("s:close_cb"), + \ 'callback': funcref("s:callback"), + \ 'close_cb': funcref("s:close_cb"), \ } call job_start(a:args.cmd, start_options) diff --git a/sources_non_forked/vim-go/autoload/go/path.vim b/sources_non_forked/vim-go/autoload/go/path.vim index a9b74e97..740a2681 100644 --- a/sources_non_forked/vim-go/autoload/go/path.vim +++ b/sources_non_forked/vim-go/autoload/go/path.vim @@ -110,6 +110,9 @@ function! go#path#Detect() abort endif endif + " Fix up the case where initial $GOPATH is empty, + " and we end up with a trailing : + let gopath = substitute(gopath, ":$", "", "") return gopath endfunction diff --git a/sources_non_forked/vim-go/autoload/go/rename.vim b/sources_non_forked/vim-go/autoload/go/rename.vim index df8047e1..7d5579d2 100644 --- a/sources_non_forked/vim-go/autoload/go/rename.vim +++ b/sources_non_forked/vim-go/autoload/go/rename.vim @@ -85,8 +85,8 @@ function s:rename_job(args) endfunction let start_options = { - \ 'callback': function("s:callback"), - \ 'close_cb': function("s:close_cb"), + \ 'callback': funcref("s:callback"), + \ 'close_cb': funcref("s:close_cb"), \ } " modify GOPATH if needed diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/def/jump.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/def/jump.go new file mode 100644 index 00000000..50e8d8d3 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/test-fixtures/def/jump.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("vim-go") +} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/hello.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/hello.go new file mode 100644 index 00000000..3be42f6a --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/hello.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + + func main() { +fmt.Println("vim-go") +} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/hello_golden.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/hello_golden.go new file mode 100644 index 00000000..50e8d8d3 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/hello_golden.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("vim-go") +} diff --git a/sources_non_forked/vim-go/autoload/go/textobj.vim b/sources_non_forked/vim-go/autoload/go/textobj.vim index be0c7718..da0bb7e2 100644 --- a/sources_non_forked/vim-go/autoload/go/textobj.vim +++ b/sources_non_forked/vim-go/autoload/go/textobj.vim @@ -20,7 +20,7 @@ function! go#textobj#Function(mode) abort if &modified " Write current unsaved buffer to a temp file and use the modified content let l:tmpname = tempname() - call writefile(getline(1, '$'), l:tmpname) + call writefile(go#util#GetLines(), l:tmpname) let fname = l:tmpname endif @@ -107,7 +107,7 @@ function! go#textobj#FunctionJump(mode, direction) abort if &modified " Write current unsaved buffer to a temp file and use the modified content let l:tmpname = tempname() - call writefile(getline(1, '$'), l:tmpname) + call writefile(go#util#GetLines(), l:tmpname) let fname = l:tmpname endif diff --git a/sources_non_forked/vim-go/autoload/go/util.vim b/sources_non_forked/vim-go/autoload/go/util.vim index aaf7273d..65cf2750 100644 --- a/sources_non_forked/vim-go/autoload/go/util.vim +++ b/sources_non_forked/vim-go/autoload/go/util.vim @@ -305,4 +305,17 @@ function! go#util#EchoInfo(msg) redraw | echohl Debug | echom "vim-go: " . a:msg | echohl None endfunction +function! go#util#GetLines() + let buf = getline(1, '$') + if &encoding != 'utf-8' + let buf = map(buf, 'iconv(v:val, &encoding, "utf-8")') + endif + if &l:fileformat == 'dos' + " XXX: line2byte() depend on 'fileformat' option. + " so if fileformat is 'dos', 'buf' must include '\r'. + let buf = map(buf, 'v:val."\r"') + endif + return buf +endfunction + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/doc/vim-go.txt b/sources_non_forked/vim-go/doc/vim-go.txt index 87c59118..2d7a03b2 100644 --- a/sources_non_forked/vim-go/doc/vim-go.txt +++ b/sources_non_forked/vim-go/doc/vim-go.txt @@ -1382,8 +1382,7 @@ For example here is how to set each to 30. This option is Neovim only. Use it to change the behavior of the test commands. If set to 1 it opens the test commands inside a new terminal according to |'g:go_term_mode'|, otherwise it will run them in the background -just like `:GoBuild` and then display the status with -|go#jobcontrol#Statusline()|. By default it is disabled. +just like `:GoBuild`. By default it is disabled. > let g:go_term_enabled = 0 < diff --git a/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets b/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets index fcb82985..4a5b87f8 100644 --- a/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets +++ b/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets @@ -151,6 +151,14 @@ if err != nil { ${0} endsnippet +# error log snippet +snippet errl "Error with log.Fatal(err)" !b +if err != nil { + log.Fatal(err) +} +${0} +endsnippet + # error multiple return snippet errn, "Error return with two return values" !b if err != nil { diff --git a/sources_non_forked/vim-go/gosnippets/snippets/go.snip b/sources_non_forked/vim-go/gosnippets/snippets/go.snip index 942a82e0..2db20f57 100644 --- a/sources_non_forked/vim-go/gosnippets/snippets/go.snip +++ b/sources_non_forked/vim-go/gosnippets/snippets/go.snip @@ -132,6 +132,13 @@ abbr if err != nil { ... } t.Fatal(err) } +# error snippet in log.Fatal +snippet errl +abbr if err != nil { ... } + if err != nil { + log.Fatal(err) + } + # error snippet with two return values snippet errn, abbr if err != nil { return [...], err } diff --git a/sources_non_forked/vim-go/plugin/go.vim b/sources_non_forked/vim-go/plugin/go.vim index 3e2f6a1e..26547310 100644 --- a/sources_non_forked/vim-go/plugin/go.vim +++ b/sources_non_forked/vim-go/plugin/go.vim @@ -32,7 +32,7 @@ command! -nargs=? -complete=dir GoPath call go#path#GoPath() " target install directory. GoInstallBinaries doesn't install binaries if they " exist, to update current binaries pass 1 to the argument. function! s:GoInstallBinaries(updateBinaries) - if $GOPATH == "" + if $GOPATH == "" && go#util#gopath() == "" echohl Error echomsg "vim.go: $GOPATH is not set" echohl None diff --git a/sources_non_forked/vim-go/scripts/runtest.vim b/sources_non_forked/vim-go/scripts/runtest.vim new file mode 100644 index 00000000..a096036d --- /dev/null +++ b/sources_non_forked/vim-go/scripts/runtest.vim @@ -0,0 +1,81 @@ +let total_started = reltime() + +" add vim-go the only plugin inside the runtimepath +let git_root_path = system("git rev-parse --show-toplevel | tr -d '\\n'") +exe 'set rtp=' . git_root_path + +" source the passed test file +source % + +" cd into the folder of the test file +let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' +let dir = getcwd() +execute cd . expand('%:p:h') + +" initialize variables +let g:testname = expand('%') +let s:fail = 0 +let s:done = 0 +let s:logs = [] + +" get a list of all Test_ functions for the given file +set nomore +redir @q +silent function /^Test_ +redir END +let s:tests = split(substitute(@q, 'function \(\k*()\)', '\1', 'g')) + +" Iterate over all tests and execute them +for s:test in sort(s:tests) + let started = reltime() + + call add(s:logs, printf("=== RUN %s", s:test[:-3])) + exe 'call ' . s:test + + let elapsed_time = reltimestr(reltime(started)) + let elapsed_time = substitute(elapsed_time, '^\s*\(.\{-}\)\s*$', '\1', '') + + let s:done += 1 + + if len(v:errors) > 0 + let s:fail += 1 + call add(s:logs, printf("--- FAIL: %s (%ss)", s:test[:-3], elapsed_time)) + call extend(s:logs, map(v:errors, '" ". v:val')) + + " reset so we can capture failures of next test + let v:errors = [] + else + call add(s:logs, printf("--- PASS: %s (%ss)", s:test[:-3], elapsed_time)) + endif +endfor + +" pop out into the scripts folder +execute cd . fnameescape(dir) + +" create an empty fail to indicate that the test failed +if s:fail > 0 + split FAILED + write +endif + +let total_elapsed_time = reltimestr(reltime(total_started)) +let total_elapsed_time = substitute(total_elapsed_time, '^\s*\(.\{-}\)\s*$', '\1', '') + +let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test') . '. Total test time: '. total_elapsed_time .'s' +call add(s:logs, "") +call add(s:logs, message) + +" store all error messages from within vim into test.log +redir > test.log +silent messages +redir END + +" also store all internal messages from s:logs: as well +split test.log +call append(line('$'), '') +call append(line('$'), 'From ' . g:testname . ':') +call append(line('$'), s:logs) +write + +" bye, bye! +qall! diff --git a/sources_non_forked/vim-go/scripts/test.sh b/sources_non_forked/vim-go/scripts/test.sh index d8a5b895..cda33504 100644 --- a/sources_non_forked/vim-go/scripts/test.sh +++ b/sources_non_forked/vim-go/scripts/test.sh @@ -1,77 +1,29 @@ -#!/bin/bash -e -# -# Copyright 2012 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. -# -# Tests for import.vim. +#!/bin/bash + +set -e cd $(dirname $0) -cat > base.go <&1 -n "$1: " - vim -e -s -u /dev/null -U /dev/null --noplugin -c "source import.vim" \ - -c "$1" -c 'wq! test.go' base.go - # ensure blank lines are treated correctly - if ! gofmt test.go | cmp test.go -; then - echo 2>&1 "gofmt conflict" - gofmt test.go | diff -u test.go - | sed "s/^/ /" 2>&1 - fail=1 - return - fi - if ! [[ $(cat test.go) =~ $2 ]]; then - echo 2>&1 "$2 did not match" - cat test.go | sed "s/^/ /" 2>&1 - fail=1 - return - fi - echo 2>&1 "ok" -} - -# Tests for Import - -test_one "Import baz" '"baz".*"bytes"' -test_one "Import io/ioutil" '"io".*"io/ioutil".*"net"' -test_one "Import myc" '"io".*"myc".*"net"' # prefix of a site prefix -test_one "Import nat" '"io".*"nat".*"net"' -test_one "Import net/http" '"net".*"net/http".*"mycorp/foo"' -test_one "Import zoo" '"net".*"zoo".*"mycorp/foo"' -test_one "Import mycorp/bar" '"net".*"mycorp/bar".*"mycorp/foo"' -test_one "Import mycorp/goo" '"net".*"mycorp/foo".*"mycorp/goo"' - -# Tests for Drop - -cat > base.go <&1 "FAIL" exit 1 fi diff --git a/sources_non_forked/vim-go/syntax/go.vim b/sources_non_forked/vim-go/syntax/go.vim index 9b23eb6c..8d7560f9 100644 --- a/sources_non_forked/vim-go/syntax/go.vim +++ b/sources_non_forked/vim-go/syntax/go.vim @@ -10,9 +10,7 @@ " let OPTION_NAME = 0 " in your ~/.vimrc file to disable particular options. You can also write: " let OPTION_NAME = 1 -" to enable particular options. -" At present, all options default to on, except highlight of: -" functions, methods, structs, operators, build constraints and interfaces. +" to enable particular options. At present, all options default to off: " " - go_highlight_array_whitespace_error " Highlights white space after "[]". @@ -36,23 +34,23 @@ if exists("b:current_syntax") endif if !exists("g:go_highlight_array_whitespace_error") - let g:go_highlight_array_whitespace_error = 1 + let g:go_highlight_array_whitespace_error = 0 endif if !exists("g:go_highlight_chan_whitespace_error") - let g:go_highlight_chan_whitespace_error = 1 + let g:go_highlight_chan_whitespace_error = 0 endif if !exists("g:go_highlight_extra_types") - let g:go_highlight_extra_types = 1 + let g:go_highlight_extra_types = 0 endif if !exists("g:go_highlight_space_tab_error") - let g:go_highlight_space_tab_error = 1 + let g:go_highlight_space_tab_error = 0 endif if !exists("g:go_highlight_trailing_whitespace_error") - let g:go_highlight_trailing_whitespace_error = 1 + let g:go_highlight_trailing_whitespace_error = 0 endif if !exists("g:go_highlight_operators") diff --git a/sources_non_forked/vim-go/t/coverlay.vim b/sources_non_forked/vim-go/t/coverlay.vim deleted file mode 100644 index 9d60c21d..00000000 --- a/sources_non_forked/vim-go/t/coverlay.vim +++ /dev/null @@ -1,191 +0,0 @@ -" to execute, `rake test` on parent dir - -describe 'go#coverage#Buffer' - before - new - let g:curdir = expand(':p:h') . '/' - let g:srcpath = 't/fixtures/src/' - let g:sample = 'pkg1/sample.go' - let g:sampleabs = g:curdir . g:srcpath . 'pkg1/sample.go' - let g:samplecover = g:curdir . g:srcpath . 'pkg1/sample.out' - let g:go_gopath = g:curdir . 't/fixtures' - execute "badd " . g:srcpath . g:sample - execute "buffer " . bufnr("$") - end - after - execute "bprev" - execute "bdelete " . g:srcpath . g:sample - close! - end - - it 'puts match to the list' - call go#coverage#Buffer(0) - Expect len(go#coverlay#matches()) == 5 - call go#coverlay#Clearlay() - Expect len(go#coverlay#matches()) == 0 - - call go#coverage#Buffer(0) - Expect len(go#coverlay#matches()) == 5 - call go#coverlay#Clearlay() - Expect len(go#coverlay#matches()) == 0 - - call go#coverage#Buffer(0) - Expect len(go#coverlay#matches()) == 5 - call go#coverage#Buffer(0) - Expect len(go#coverlay#matches()) == 5 - call go#coverlay#Clearlay() - Expect len(go#coverlay#matches()) == 0 - end -end - -describe 'go#coverage#Buffer fail' - before - new - let g:curdir = expand(':p:h') . '/' - let g:srcpath = 't/fixtures/src/' - let g:sample = 'failtest/sample.go' - let g:sampletest = 'failtest/sample_test.go' - let g:sampleabs = g:curdir . g:srcpath . 'failtest/sample.go' - let g:go_gopath = g:curdir . 't/fixtures' - execute "badd " . g:srcpath . g:sample - execute "buffer " . bufnr("$") - end - after - execute "bprev" - execute "bdelete " . g:srcpath . g:sampletest - execute "bdelete " . g:srcpath . g:sample - end - - it 'does nothing if test fail' - call go#coverage#Buffer(0) - Expect len(go#coverlay#matches()) == 0 - Expect len(getqflist()) == 1 - end -end - -describe 'go#coverage#Buffer build fail' - before - new - let g:curdir = expand(':p:h') . '/' - let g:srcpath = 't/fixtures/src/' - let g:sample = 'buildfail/sample.go' - let g:sampleabs = g:curdir . g:srcpath . 'buildfail/sample.go' - let g:go_gopath = g:curdir . 't/fixtures' - execute "badd " . g:srcpath . g:sample - execute "buffer " . bufnr("$") - end - after - execute "bprev" - execute "bdelete " . g:srcpath . g:sample - end - - it 'does nothing if test fail' - call go#coverage#Buffer(0) - Expect len(go#coverlay#matches()) == 0 - end -end - -describe 'go#coverage#Buffer build test fail' - before - new - let g:curdir = expand(':p:h') . '/' - let g:srcpath = 't/fixtures/src/' - let g:sample = 'buildtestfail/sample.go' - let g:sampleabs = g:curdir . g:srcpath . 'buildtestfail/sample.go' - let g:go_gopath = g:curdir . 't/fixtures' - execute "badd " . g:srcpath . g:sample - execute "buffer " . bufnr("$") - end - after - execute "bprev" - execute "bdelete " . g:srcpath . g:sample - end - - it 'does nothing if test fail' - call go#coverage#Buffer(0) - Expect len(go#coverlay#matches()) == 0 - end -end - -describe 'go#coverlay#findbufnr' - before - new - let g:curdir = expand(':p:h') . '/' - let g:srcpath = 't/fixtures/src/' - let g:sample = 'pkg1/sample.go' - let g:sample2 = 'pkg2/sample.go' - let g:sampleabs = g:curdir . g:srcpath . 'pkg1/sample.go' - let g:sampleabs2 = g:curdir . g:srcpath . 'pkg2/sample.go' - let g:go_gopath = g:curdir . 't/fixtures' - execute "badd " . g:srcpath . g:sample - execute "badd " . g:srcpath . g:sample2 - end - after - execute "bdelete " . g:srcpath . g:sample2 - execute "bdelete " . g:srcpath . g:sample - close! - end - - it 'returns BUFNR if FILE is opened at BUFNR' - Expect go#coverlay#findbufnr('_' . g:sampleabs) == bufnr(g:sampleabs) - Expect go#coverlay#findbufnr(g:sample) == bufnr(g:sampleabs) - - Expect go#coverlay#findbufnr('_' . g:sampleabs2) == bufnr(g:sampleabs2) - Expect go#coverlay#findbufnr(g:sample2) == bufnr(g:sampleabs2) - end - - it 'returns -1 if FILE is not exists' - Expect go#coverlay#findbufnr('pkg1/NOTEXISTS.go') == -1 - Expect go#coverlay#findbufnr('_' . g:curdir . g:srcpath . 'pkg1/NOTEXISTS.go') == -1 - end -end - -describe 'go#coverlay#isopenedon' - before - new - let g:curdir = expand(':p:h') . '/' - let g:srcpath = 't/fixtures/src/' - let g:sample = 'pkg1/sample.go' - let g:sampleabs = g:curdir . g:srcpath . 'pkg1/sample.go' - let g:go_gopath = g:curdir . 't/fixtures' - execute "badd " . g:srcpath . g:sample - end - after - execute "bdelete " . g:srcpath . g:sample - close! - end - - it 'returns 1 if FILE is opened at BUFNR' - Expect go#coverlay#isopenedon('_' . g:sampleabs, bufnr(g:sampleabs)) == 1 - Expect go#coverlay#isopenedon(g:sample, bufnr(g:sampleabs)) == 1 - end - - it 'returns 0 if FILE is not opened at BUFNR' - Expect go#coverlay#isopenedon('_' . g:sampleabs, 42) == 0 - Expect go#coverlay#isopenedon(g:sample, 42) == 0 - end - - it 'returns 0 if FILE is not exists' - Expect go#coverlay#isopenedon('_' . g:curdir . g:srcpath . 'pkg1/NOTEXISTS', bufnr(g:sampleabs)) == 0 - Expect go#coverlay#isopenedon('pkg1/NOTEXISTS.go', bufnr(g:sampleabs)) == 0 - end -end - - - -describe 'go#coverlay#parsegocoverline' - it 'parses a go cover output line and returns as dict' - let d = {'file': 'f',"startline": "1", "startcol": "2", "endline": "3", "endcol": "4", "numstmt": "5", "cnt": "6"} - " file:startline.col,endline.col numstmt count - Expect go#coverlay#parsegocoverline("f:1.2,3.4 5 6") == d - end -end - -describe 'go#coverlay#genmatch' - it 'generate mark pattern from cover data' - let d = {'file': 'f',"startline": "1", "startcol": "2", "endline": "3", "endcol": "4", "numstmt": "5", "cnt": "6"} - Expect go#coverlay#genmatch(d) == {'group': 'covered', "pattern": '\%>1l\_^\s\+\%<3l\|\%1l\_^\s\+\|\%3l\_^\s\+\(\}$\)\@!', "priority": 6} - let d = {'file': 'f',"startline": "1", "startcol": "2", "endline": "3", "endcol": "4", "numstmt": "5", "cnt": "0"} - Expect go#coverlay#genmatch(d) == {'group': 'uncover', "pattern": '\%>1l\_^\s\+\%<3l\|\%1l\_^\s\+\|\%3l\_^\s\+\(\}$\)\@!', "priority": 5} - end -end diff --git a/sources_non_forked/vim-go/t/fixtures/src/buildfail/sample.go b/sources_non_forked/vim-go/t/fixtures/src/buildfail/sample.go deleted file mode 100644 index 45fc006a..00000000 --- a/sources_non_forked/vim-go/t/fixtures/src/buildfail/sample.go +++ /dev/null @@ -1,13 +0,0 @@ -// set gopath before -//go:generate go test --coverprofile=sample.out -// go1.5.3 example output: -// GOPATH=`pwd`/fixtures go test --coverprofile=log.out buildfail -// # buildfail -// /tmp/go-build264733986/buildfail/_test/_obj_test/sample.go:7: undefined: IT_SHOULD_BE_BUILD_FAILED -// /tmp/go-build264733986/buildfail/_test/_obj_test/sample.go:8: missing return at end of function -// FAIL buildfail [build failed] -package pkg - -func Sample() int { - IT_SHOULD_BE_BUILD_FAILED -} diff --git a/sources_non_forked/vim-go/t/fixtures/src/buildfail/sample_test.go b/sources_non_forked/vim-go/t/fixtures/src/buildfail/sample_test.go deleted file mode 100644 index 2356d3ed..00000000 --- a/sources_non_forked/vim-go/t/fixtures/src/buildfail/sample_test.go +++ /dev/null @@ -1,7 +0,0 @@ -package pkg - -import "testing" - -func TestSample(t *testing.T) { - Sample() -} diff --git a/sources_non_forked/vim-go/t/fixtures/src/buildtestfail/sample.go b/sources_non_forked/vim-go/t/fixtures/src/buildtestfail/sample.go deleted file mode 100644 index 792f1234..00000000 --- a/sources_non_forked/vim-go/t/fixtures/src/buildtestfail/sample.go +++ /dev/null @@ -1,7 +0,0 @@ -// set gopath before -//go:generate go test --coverprofile=sample.out -package pkg - -func Sample() int { - return 1 -} diff --git a/sources_non_forked/vim-go/t/fixtures/src/buildtestfail/sample_test.go b/sources_non_forked/vim-go/t/fixtures/src/buildtestfail/sample_test.go deleted file mode 100644 index 17c4d463..00000000 --- a/sources_non_forked/vim-go/t/fixtures/src/buildtestfail/sample_test.go +++ /dev/null @@ -1,15 +0,0 @@ -// go1.5.3 example output: -// GOPATH=`pwd`/fixtures go test --coverprofile=log.out buildtestfail -// # buildtestfail -// fixtures/src/buildtestfail/sample_test.go:14: undefined: IT_SHOULD_BE_BUILD_FAILED -// FAIL buildtestfail [build failed] -// echo $? -// 2 - -package pkg - -import "testing" - -func TestSample(t *testing.T) { - IT_SHOULD_BE_BUILD_FAILED -} diff --git a/sources_non_forked/vim-go/t/fixtures/src/failtest/sample.go b/sources_non_forked/vim-go/t/fixtures/src/failtest/sample.go deleted file mode 100644 index 5859e926..00000000 --- a/sources_non_forked/vim-go/t/fixtures/src/failtest/sample.go +++ /dev/null @@ -1,12 +0,0 @@ -// set gopath before -//go:generate go test --coverprofile=sample.out -package pkg - -func Sample() int { - if false { - return 0 - } else if false { - return 0 - } - return 1 -} diff --git a/sources_non_forked/vim-go/t/fixtures/src/failtest/sample_test.go b/sources_non_forked/vim-go/t/fixtures/src/failtest/sample_test.go deleted file mode 100644 index 7f1ade0d..00000000 --- a/sources_non_forked/vim-go/t/fixtures/src/failtest/sample_test.go +++ /dev/null @@ -1,8 +0,0 @@ -package pkg - -import "testing" - -func TestSample(t *testing.T) { - Sample() - t.Fatal("itwillfail") -} diff --git a/sources_non_forked/vim-go/t/fixtures/src/parsefail/sample.go b/sources_non_forked/vim-go/t/fixtures/src/parsefail/sample.go deleted file mode 100644 index e9f3faa9..00000000 --- a/sources_non_forked/vim-go/t/fixtures/src/parsefail/sample.go +++ /dev/null @@ -1,14 +0,0 @@ -// set gopath before -//go:generate go test --coverprofile=sample.out -// go1.5.3 example output: -// GOPATH=`pwd`/fixtures go test --coverprofile=log.out parsefail -// # cover parsefail -// 2016/01/17 23:59:08 cover: /home/sey/vimfiles/_vim/bundle/vim-go-coverlay/t/fixtures/src/parsefail/sample.go: /home/sey/vimfiles/_vim/bundle/vim-go-coverlay/t/fixtures/src/parsefail/sample.go:10:1: expected declaration, found 'IDENT' PARSEFAIL -// FAIL parsefail [build failed] -// echo $? -// 2 -package pkg - -PARSEFAIL Sample() int { - return 0 -} diff --git a/sources_non_forked/vim-go/t/fixtures/src/parsefail/sample_test.go b/sources_non_forked/vim-go/t/fixtures/src/parsefail/sample_test.go deleted file mode 100644 index 2356d3ed..00000000 --- a/sources_non_forked/vim-go/t/fixtures/src/parsefail/sample_test.go +++ /dev/null @@ -1,7 +0,0 @@ -package pkg - -import "testing" - -func TestSample(t *testing.T) { - Sample() -} diff --git a/sources_non_forked/vim-go/t/fixtures/src/pkg1/sample.go b/sources_non_forked/vim-go/t/fixtures/src/pkg1/sample.go deleted file mode 100644 index 6ce94b39..00000000 --- a/sources_non_forked/vim-go/t/fixtures/src/pkg1/sample.go +++ /dev/null @@ -1,12 +0,0 @@ -// set gopath before -//go:generate go test --coverprofile=sample.out -package pkg1 - -func Sample() int { - if false { - return 0 - } else if false { - return 0 - } - return 1 -} diff --git a/sources_non_forked/vim-go/t/fixtures/src/pkg1/sample.out b/sources_non_forked/vim-go/t/fixtures/src/pkg1/sample.out deleted file mode 100644 index 909a63f1..00000000 --- a/sources_non_forked/vim-go/t/fixtures/src/pkg1/sample.out +++ /dev/null @@ -1,6 +0,0 @@ -mode: set -pkg1/sample.go:5.19,6.11 1 1 -pkg1/sample.go:11.2,11.10 1 1 -pkg1/sample.go:6.11,8.3 1 0 -pkg1/sample.go:8.3,8.18 1 1 -pkg1/sample.go:8.18,10.3 1 0 diff --git a/sources_non_forked/vim-go/t/fixtures/src/pkg1/sample_test.go b/sources_non_forked/vim-go/t/fixtures/src/pkg1/sample_test.go deleted file mode 100644 index e39d7ba8..00000000 --- a/sources_non_forked/vim-go/t/fixtures/src/pkg1/sample_test.go +++ /dev/null @@ -1,7 +0,0 @@ -package pkg1 - -import "testing" - -func TestSample(t *testing.T) { - Sample() -} diff --git a/sources_non_forked/vim-pug/README.markdown b/sources_non_forked/vim-pug/README.markdown index c41f9ddd..7665388f 100644 --- a/sources_non_forked/vim-pug/README.markdown +++ b/sources_non_forked/vim-pug/README.markdown @@ -2,6 +2,8 @@ Vim syntax highlighting for Pug (formerly Jade) templates. +For best results consider using this with an (improved) HTML5 syntax plugin. + Installation ------------ diff --git a/sources_non_forked/vim-pug/syntax/pug.vim b/sources_non_forked/vim-pug/syntax/pug.vim index 09e6b9b9..2d80f471 100644 --- a/sources_non_forked/vim-pug/syntax/pug.vim +++ b/sources_non_forked/vim-pug/syntax/pug.vim @@ -36,8 +36,9 @@ syntax keyword pugCommentTodo contained TODO FIXME XXX TBD syn match pugComment '\(\s\+\|^\)\/\/.*$' contains=pugCommentTodo syn region pugCommentBlock start="\z(\s\+\|^\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" contains=pugCommentTodo keepend syn region pugHtmlConditionalComment start="" contains=pugCommentTodo -syn region pugAttributes matchgroup=pugAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,pugHtmlArg,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@pugComponent -syn match pugClassChar "\." contained nextgroup=pugClass +syn region pugAngular2 start="(" end=")" contains=htmlEvent +syn region pugAttributes matchgroup=pugAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,pugHtmlArg,pugAngular2,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@pugComponent +syn match pugClassChar "\." containedin=htmlTagName nextgroup=pugClass syn match pugBlockExpansionChar ":\s\+" contained nextgroup=pugTag,pugClassChar,pugIdChar syn match pugIdChar "#[[{]\@!" contained nextgroup=pugId syn match pugClass "\%(\w\|-\)\+" contained nextgroup=@pugComponent diff --git a/sources_non_forked/vim-snippets/README.md b/sources_non_forked/vim-snippets/README.md index d4e83c33..5567c5d9 100644 --- a/sources_non_forked/vim-snippets/README.md +++ b/sources_non_forked/vim-snippets/README.md @@ -131,14 +131,14 @@ Don't add useless placeholder default texts like: ``` if (${1:condition}){ - ${2:some code here} + ${0:some code here} } ``` instead use: ``` if (${1}){ - ${2} + ${0:${VISUAL}} } ``` @@ -148,6 +148,8 @@ get vim-dev plugin which has function completion Thus for conditions (while, if ..) and block bodies just use ${N} - Thanks +When the snippet can be used to wrap existing code leverage `${VISUAL}` + Open questions: What about one line if ee then .. else .. vs if \n .. then \n ... \n else \n .. ? Which additional policies to add? diff --git a/sources_non_forked/vim-snippets/UltiSnips/all.snippets b/sources_non_forked/vim-snippets/UltiSnips/all.snippets index 215487ec..49a9c80e 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/all.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/all.snippets @@ -77,23 +77,23 @@ endsnippet # DATES # ######### snippet date "YYYY-MM-DD" w -`date +%Y-%m-%d` +`!v strftime("%F")` endsnippet snippet ddate "Month DD, YYYY" w -`date +%B\ %d,\ %Y` +`!v strftime("%b %d, %Y")` endsnippet snippet diso "ISO format datetime" w -`date +%Y-%m-%dT%H:%M:%S%:z` +`!v strftime("%F %H:%M:%S%z")` endsnippet snippet time "hh:mm" w -`date +%H:%M` +`!v strftime("%H:%M")` endsnippet snippet datetime "YYYY-MM-DD hh:mm" w -`date +%Y-%m-%d\ %H:%M` +`!v strftime("%Y-%m-%d %H:%M")` endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/c.snippets b/sources_non_forked/vim-snippets/UltiSnips/c.snippets index c9894649..6851a272 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/c.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/c.snippets @@ -5,7 +5,7 @@ priority -50 snippet def "#define ..." -#define ${1} +#define $1 endsnippet snippet #ifndef "#ifndef ... #define ... #endif" @@ -16,7 +16,7 @@ endsnippet snippet #if "#if #endif" b #if ${1:0} -${VISUAL}${0} +${VISUAL}$0 #endif endsnippet @@ -32,20 +32,20 @@ endsnippet snippet main "main() (main)" int main(int argc, char *argv[]) { - ${VISUAL}${0} + ${VISUAL}$0 return 0; } endsnippet snippet for "for loop (for)" for (${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { - ${VISUAL}${0} + ${VISUAL}$0 } endsnippet snippet fori "for int loop (fori)" for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { - ${VISUAL}${0} + ${VISUAL}$0 } endsnippet @@ -60,7 +60,7 @@ else: snip.rv = snip.c`} #define $1 -${VISUAL}${0} +${VISUAL}$0 #endif /* end of include guard: $1 */ endsnippet @@ -71,7 +71,7 @@ endsnippet snippet eli "else if .. (eli)" else if (${1:/* condition */}) { - ${VISUAL}${0} + ${VISUAL}$0 } endsnippet @@ -86,14 +86,14 @@ struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`} { endsnippet snippet fun "function" b -${1:void} ${2:function_name}(${3}) +${1:void} ${2:function_name}($3) { - ${VISUAL}${0} + ${VISUAL}$0 } endsnippet snippet fund "function declaration" b -${1:void} ${2:function_name}(${3}); +${1:void} ${2:function_name}($3); endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/coffee-react.snippets b/sources_non_forked/vim-snippets/UltiSnips/coffee-react.snippets index 4cdb40f8..3090c571 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/coffee-react.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/coffee-react.snippets @@ -12,7 +12,7 @@ snippet createClass "React define Class" b ${1:classname}Class = React.createClass displayName: "$1" render: -> - ${2} + $2 $1 = React.createFactory($1) endsnippet @@ -23,58 +23,58 @@ endsnippet snippet propType "React propType (key/value)" b ${1:myVar}: React.PropTypes.${2:type}${3:.isRequired} -${4} +$4 endsnippet snippet setState "React setState" b @setState ${1:myvar}: ${2:myvalue} - ${3} + $3 endsnippet snippet getInitialState "React define getInitialState" b getInitialState: -> ${1:myvar}: ${2:myvalue} - ${3} + $3 endsnippet snippet getDefaultProps "React define getDefaultProps" b getDefaultProps: -> ${1:myvar}: ${2:myvalue} - ${3} + $3 endsnippet snippet componentWillMount "React define componentWillMount" b componentWillMount: -> - ${1} + $1 endsnippet snippet componentDidMount "React define componentDidMount" b componentDidMount: -> - ${1} + $1 endsnippet snippet componentWillReceiveProps "React define componentWillReceiveProps" b componentWillReceiveProps: (nextProps) -> - ${1} + $1 endsnippet snippet shouldComponentUpdate "React define shouldComponentUpdate" b shouldComponentUpdate: (nextProps, nextState) -> - ${1} + $1 endsnippet snippet componentWillUpdate "React define componentWillUpdate" b componentWillUpdate: (nextProps, nextState) -> - ${1} + $1 endsnippet snippet componentDidUpdate "React define componentDidUpdate" b componentDidUpdate: (prevProps, prevState) -> - ${1} + $1 endsnippet snippet componentWillUnmount "React define componentWillUnmount" b componentWillUnmount: -> - ${1} + $1 endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets b/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets index f7c2bd83..c83ec605 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets @@ -27,7 +27,7 @@ endsnippet snippet ns "namespace .. (namespace)" namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`} { - ${VISUAL}${0} + ${VISUAL}$0 }${1/.+/ \/* /m}$1${1/.+/ *\/ /m} endsnippet @@ -61,7 +61,7 @@ snippet cla "An entire .h generator" b class ${1:`!v substitute(substitute(vim_snippets#Filename('$1','ClassName'),'^.','\u&',''), '_\(\w\)', '\u\1', 'g')`} { private: - ${3} + $3 public: $1(); diff --git a/sources_non_forked/vim-snippets/UltiSnips/crystal.snippets b/sources_non_forked/vim-snippets/UltiSnips/crystal.snippets new file mode 100644 index 00000000..cab946f4 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/crystal.snippets @@ -0,0 +1,13 @@ +priority -50 + +snippet "\b(de)?f" "def ..." r +def ${1:method_name}${2:(${3:*args})} + $0 +end +endsnippet + +snippet "\b(pde)?f" "private def ..." r +private def ${1:method_name}${2:(${3:*args})} + $0 +end +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/cs.snippets b/sources_non_forked/vim-snippets/UltiSnips/cs.snippets index aca245e5..89b61ca0 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/cs.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/cs.snippets @@ -259,7 +259,7 @@ finally endsnippet snippet throw "throw" -throw new ${1}Exception("${2}"); +throw new $1Exception("$2"); endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/css.snippets b/sources_non_forked/vim-snippets/UltiSnips/css.snippets index ff265093..f5ccd2ff 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/css.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/css.snippets @@ -1,11 +1,5 @@ priority -50 -snippet . "selector { }" -$1 { - $0 -} -endsnippet - snippet p "padding" padding: ${1:0};$0 endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/d.snippets b/sources_non_forked/vim-snippets/UltiSnips/d.snippets index 9ce27513..a9d89b84 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/d.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/d.snippets @@ -23,7 +23,7 @@ mixin ${1:/*mixed_in*/} ${2:/*name*/}; endsnippet snippet new "new (new)" -new ${1}(${2}); +new $1($2); endsnippet snippet scpn "@safe const pure nothrow (scpn)" @@ -98,7 +98,7 @@ endsnippet snippet enf "enforce (enf)" b enforce(${1:/*condition*/}, - new ${2}Exception(${3:/*args*/})); + new $2Exception(${3:/*args*/})); endsnippet # Branches @@ -106,14 +106,14 @@ endsnippet snippet if "if .. (if)" if(${1:/*condition*/}) { - ${VISUAL}${0} + ${VISUAL}$0 } endsnippet snippet ife "if .. else (ife)" b if(${1:/*condition*/}) { - ${2} + $2 } else { @@ -124,14 +124,14 @@ endsnippet snippet el "else (el)" b else { - ${VISUAL}${1} + ${VISUAL}$1 } endsnippet snippet elif "else if (elif)" b else if(${1:/*condition*/}) { - ${VISUAL}${0} + ${VISUAL}$0 } endsnippet @@ -139,10 +139,10 @@ snippet sw "switch (sw)" switch(${1:/*var*/}) { case ${2:/*value*/}: - ${3} + $3 break; case ${4:/*value*/}: - ${5} + $5 break; ${7:/*more cases*/} default: @@ -154,10 +154,10 @@ snippet fsw "final switch (fsw)" final switch(${1:/*var*/}) { case ${2:/*value*/}: - ${3} + $3 break; case ${4:/*value*/}: - ${5} + $5 break; ${7:/*more cases*/} } @@ -165,7 +165,7 @@ endsnippet snippet case "case (case)" b case ${1:/*value*/}: - ${2} + $2 break; endsnippet @@ -178,42 +178,42 @@ endsnippet snippet do "do while (do)" b do { - ${VISUAL}${2} + ${VISUAL}$2 } while(${1:/*condition*/}); endsnippet snippet wh "while (wh)" b while(${1:/*condition*/}) { - ${VISUAL}${2} + ${VISUAL}$2 } endsnippet snippet for "for (for)" b for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { - ${VISUAL}${0} + ${VISUAL}$0 } endsnippet snippet forever "forever (forever)" b for(;;) { - ${VISUAL}${0} + ${VISUAL}$0 } endsnippet snippet fore "foreach (fore)" foreach(${1:/*elem*/}; ${2:/*range*/}) { - ${VISUAL}${3} + ${VISUAL}$3 } endsnippet snippet forif "foreach if (forif)" b foreach(${1:/*elem*/}; ${2:/*range*/}) if(${3:/*condition*/}) { - ${VISUAL}${4} + ${VISUAL}$4 } endsnippet @@ -222,7 +222,7 @@ snippet in "in contract (in)" b in { assert(${1:/*condition*/}, "${2:error message}"); - ${3} + $3 } body endsnippet @@ -231,7 +231,7 @@ snippet out "out contract (out)" b out${1:(result)} { assert(${2:/*condition*/}, "${3:error message}"); - ${4} + $4 } body endsnippet @@ -240,7 +240,7 @@ snippet inv "invariant (inv)" b invariant() { assert(${1:/*condition*/}, "${2:error message}"); - ${3} + $3 } endsnippet @@ -249,21 +249,21 @@ endsnippet snippet fun "function definition (fun)" ${1:void} ${2:/*function name*/}(${3:/*args*/}) ${4:@safe pure nothrow} { - ${VISUAL}${5} + ${VISUAL}$5 } endsnippet snippet void "void function definition (void)" void ${1:/*function name*/}(${2:/*args*/}) ${3:@safe pure nothrow} { - ${VISUAL}${4} + ${VISUAL}$4 } endsnippet snippet this "ctor (this)" w this(${1:/*args*/}) { - ${VISUAL}${2} + ${VISUAL}$2 } endsnippet @@ -295,16 +295,16 @@ endsnippet snippet scope "scope (scope)" b scope(${1:exit}) { - ${VISUAL}${2} + ${VISUAL}$2 } endsnippet # With snippet with "with (with)" -with(${1}) +with($1) { - ${VISUAL}${2} + ${VISUAL}$2 } endsnippet @@ -315,7 +315,7 @@ try { ${VISUAL}${1:/*code to try*/} } -catch(${2}Exception e) +catch($2Exception e) { ${3:/*handle exception*/} } @@ -326,7 +326,7 @@ try { ${VISUAL}${1:/*code to try*/} } -catch(${2}Exception e) +catch($2Exception e) { ${3:/*handle exception*/} } @@ -337,14 +337,14 @@ finally endsnippet snippet catch "catch (catch)" b -catch(${1}Exception e) +catch($1Exception e) { ${2:/*handle exception*/} } endsnippet snippet thr "throw (thr)" -throw new ${1}Exception("${2}"); +throw new $1Exception("$2"); endsnippet @@ -353,35 +353,35 @@ endsnippet snippet struct "struct (struct)" struct ${1:`!p snip.rv = (snip.basename or "name")`} { - ${2} + $2 } endsnippet snippet union "union (union)" union ${1:`!p snip.rv = (snip.basename or "name")`} { - ${2} + $2 } endsnippet snippet class "class (class)" class ${1:`!p snip.rv = (snip.basename or "name")`} { - ${2} + $2 } endsnippet snippet inter "interface (inter)" interface ${1:`!p snip.rv = (snip.basename or "name")`} { - ${2} + $2 } endsnippet snippet enum "enum (enum)" enum ${1:`!p snip.rv = (snip.basename or "name")`} { - ${2} + $2 } endsnippet @@ -390,7 +390,7 @@ endsnippet snippet exc "exception declaration (exc)" b /// ${3:/*documentation*/} -class ${1}Exception : ${2}Exception +class $1Exception : $2Exception { public this(string msg, string file = __FILE__, int line = __LINE__) { @@ -405,14 +405,14 @@ endsnippet snippet version "version (version)" b version(${1:/*version name*/}) { - ${VISUAL}${2} + ${VISUAL}$2 } endsnippet snippet debug "debug" b debug { - ${VISUAL}${1} + ${VISUAL}$1 } endsnippet @@ -422,7 +422,7 @@ endsnippet snippet temp "template (temp)" b template ${2:/*name*/}(${1:/*args*/}) { - ${3} + $3 } endsnippet @@ -440,7 +440,7 @@ endsnippet snippet unittest "unittest (unittest)" b unittest { - ${1} + $1 } endsnippet @@ -450,21 +450,21 @@ endsnippet snippet opDis "opDispatch (opDis)" b ${1:/*return type*/} opDispatch(string s)() { - ${2}; + $2; } endsnippet snippet op= "opAssign (op=)" b -void opAssign(${1} rhs) ${2:@safe pure nothrow} +void opAssign($1 rhs) ${2:@safe pure nothrow} { - ${2} + $2 } endsnippet snippet opCmp "opCmp (opCmp)" b -int opCmp(${1} rhs) @safe const pure nothrow +int opCmp($1 rhs) @safe const pure nothrow { - ${2} + $2 } endsnippet @@ -484,7 +484,7 @@ endsnippet snippet toString "toString (toString)" b string toString() @safe const pure nothrow { - ${1} + $1 } endsnippet @@ -493,7 +493,7 @@ endsnippet snippet todo "TODO (todo)" -// TODO: ${1} +// TODO: $1 endsnippet @@ -509,16 +509,16 @@ snippet fdoc "function ddoc block (fdoc)" b /// ${1:description} /// /// ${2:Params: ${3:param} = ${4:param description} -/// ${5}} +/// $5} /// /// ${6:Returns: ${7:return value}} /// -/// ${8:Throws: ${9}Exception ${10}} +/// ${8:Throws: $9Exception $10} endsnippet snippet Par "Params (Par)" Params: ${1:param} = ${2:param description} -/// ${3} +/// $3 endsnippet snippet Ret "Returns (Ret)" @@ -526,7 +526,7 @@ Returns: ${1:return value/s} endsnippet snippet Thr "Throws (Thr)" -Throws: ${1}Exception ${2} +Throws: $1Exception $2 endsnippet snippet Example "Examples (Example)" @@ -556,7 +556,7 @@ snippet gpl "GPL (gpl)" b // // Copyright (C) ${1:Author}, `!v strftime("%Y")` -${2} +$2 endsnippet snippet boost "Boost (boost)" b @@ -565,7 +565,7 @@ snippet boost "Boost (boost)" b // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -${2} +$2 endsnippet @@ -577,8 +577,8 @@ snippet module "New module (module)" b // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -module ${2}.`!v vim_snippets#Filename('$1', 'name')`; +module $2.`!v vim_snippets#Filename('$1', 'name')`; -${3} +$3 endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/django.snippets b/sources_non_forked/vim-snippets/UltiSnips/django.snippets index 0ba6c9d5..8f836288 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/django.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/django.snippets @@ -124,7 +124,7 @@ endsnippet snippet model "Model" b class ${1:MODELNAME}(models.Model): - ${0} + $0 class Meta: verbose_name = "$1" verbose_name_plural = "$1s" @@ -275,19 +275,19 @@ endsnippet # VIEWS SNIPPETS snippet adminview "Model Admin View" b -class ${1}Admin(admin.ModelAdmin): +class $1Admin(admin.ModelAdmin): ''' - Admin View for ${1} + Admin View for $1 ''' - list_display = ('${2}',) - list_filter = ('${3}',) + list_display = ('$2',) + list_filter = ('$3',) inlines = [ - ${4}Inline, + $4Inline, ] - raw_id_fields = ('${5}',) - readonly_fields = ('${6}',) - search_fields = ['${7}'] -admin.site.register(${1}, ${1}Admin) + raw_id_fields = ('$5',) + readonly_fields = ('$6',) + search_fields = ['$7'] +admin.site.register($1, $1Admin) endsnippet snippet createview "Generic Create View" b @@ -315,27 +315,27 @@ class ${1:MODEL_NAME}ListView(ListView): endsnippet snippet stackedinline "Stacked Inline" b -class ${1}Inline(admin.StackedInline): +class $1Inline(admin.StackedInline): ''' - Stacked Inline View for ${1} + Stacked Inline View for $1 ''' - model = ${2:${1}} + model = ${2:$1} min_num = ${3:3} max_num = ${4:20} extra = ${5:1} - raw_id_fields = (${6},) + raw_id_fields = ($6,) endsnippet snippet tabularinline "Tabular Inline" b -class ${1}Inline(admin.TabularInline): +class $1Inline(admin.TabularInline): ''' - Tabular Inline View for ${1} + Tabular Inline View for $1 ''' - model = ${2:${1}} + model = ${2:$1} min_num = ${3:3} max_num = ${4:20} extra = ${5:1} - raw_id_fields = (${6},) + raw_id_fields = ($6,) endsnippet snippet templateview "Generic Template View" b diff --git a/sources_non_forked/vim-snippets/UltiSnips/eruby.snippets b/sources_non_forked/vim-snippets/UltiSnips/eruby.snippets index fe38c2fc..ef93be44 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/eruby.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/eruby.snippets @@ -27,12 +27,12 @@ def textmate_var(var, snip): endglobal -snippet % "<% ${0} %>" i -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`${0}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)` +snippet % "<% $0 %>" i +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`$0`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)` endsnippet -snippet = "<%= ${0} %>" i -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`${0}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +snippet = "<%= $0 %>" i +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`$0`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet ########################################################################### @@ -150,11 +150,11 @@ snippet licai "link_to (controller, action, id)" w endsnippet snippet linpp "link_to (nested path plural)" w -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${10:parent}_${11:child}_path(${12:@}${13:${10}})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${10:parent}_${11:child}_path(${12:@}${13:$10})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet snippet linp "link_to (nested path)" w -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${12:parent}_${13:child}_path(${14:@}${15:${12}}, ${16:@}${17:${13}})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${12:parent}_${13:child}_path(${14:@}${15:$12}, ${16:@}${17:$13})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet snippet lipp "link_to (path plural)" w @@ -162,7 +162,7 @@ snippet lipp "link_to (path plural)" w endsnippet snippet lip "link_to (path)" w -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${12:model}_path(${13:@}${14:${12}})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${12:model}_path(${13:@}${14:$12})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet snippet lim "link_to model" w diff --git a/sources_non_forked/vim-snippets/UltiSnips/go.snippets b/sources_non_forked/vim-snippets/UltiSnips/go.snippets index b6891ff0..35cf9091 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/go.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/go.snippets @@ -53,7 +53,7 @@ endsnippet snippet switch "Switch statement" b switch ${1:expression}${1/(.+)/ /}{ -case${0} +case$0 } endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/html.snippets b/sources_non_forked/vim-snippets/UltiSnips/html.snippets index 026985cb..6d98cb1c 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/html.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/html.snippets @@ -12,33 +12,6 @@ def x(snip): snip.rv = "" endglobal -############ -# Doctypes # -############ -snippet doctype "DocType XHTML 1.0 Strict" b - - -endsnippet - -snippet doctype "DocType XHTML 1.0 Transitional" b - - -endsnippet - -snippet doctype "DocType XHTML 1.1" b - - -endsnippet - -snippet doctype "HTML - 4.0 Transitional (doctype)" b - - -endsnippet - snippet doctype "HTML - 5.0 (doctype)" b @@ -83,45 +56,6 @@ snippet left "Left (left)" ← endsnippet -snippet option "Option (option)" -⌥ -endsnippet - -####################### -# Conditional inserts # -####################### -snippet ! "IE Conditional Comment: Internet Explorer 5_0 only" -$0 -endsnippet - -snippet ! "IE Conditional Comment: Internet Explorer 5_5 only" -$0 -endsnippet - -snippet ! "IE Conditional Comment: Internet Explorer 5_x" -$0 -endsnippet - -snippet ! "IE Conditional Comment: Internet Explorer 6 and below" -$0 -endsnippet - -snippet ! "IE Conditional Comment: Internet Explorer 6 only" -$0 -endsnippet - -snippet ! "IE Conditional Comment: Internet Explorer 7+" -$0 -endsnippet - -snippet ! "IE Conditional Comment: Internet Explorer" -$0 -endsnippet - -snippet ! "IE Conditional Comment: NOT Internet Explorer" -${1: IE Conditional Comment: NOT Internet Explorer }$0 -endsnippet - ############# # HTML TAGS # ############# @@ -129,12 +63,12 @@ snippet input "Input with Label" w endsnippet -snippet input "XHTML " w +snippet input "HTML " w endsnippet -snippet opt "Option" w +snippet option "Option" w ${3:$2} endsnippet @@ -145,15 +79,15 @@ snippet select "Select Box" w endsnippet -snippet textarea "XHTML endsnippet -snippet mailto "XHTML " w +snippet mailto "HTML " w ${3:email me} endsnippet -snippet base "XHTML " w +snippet base "HTML " w endsnippet @@ -229,12 +163,12 @@ snippet meta "XHTML " w endsnippet -snippet scriptsrc "XHTML +snippet scriptsrc "HTML endsnippet -snippet script "XHTML endsnippet @@ -304,20 +238,6 @@ snippet fieldset "Fieldset" w endsnippet -snippet movie "Embed QT movie (movie)" b - - - - - - -endsnippet - snippet viewport "Responsive viewport meta" w endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/html_minimal.snippets b/sources_non_forked/vim-snippets/UltiSnips/html_minimal.snippets index e7ca5e06..5fb75223 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/html_minimal.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/html_minimal.snippets @@ -4,24 +4,24 @@ priority -50 snippet id -id="${1}"${2} +id="$1"$2 endsnippet snippet idn -id="${1}" name="${2:$1}" +id="$1" name="${2:$1}" endsnippet snippet label_and_input - -${8} + +$8 endsnippet snippet input -${7} +$7 endsnippet snippet submit -${7} +$7 endsnippet snippet textarea diff --git a/sources_non_forked/vim-snippets/UltiSnips/htmldjango.snippets b/sources_non_forked/vim-snippets/UltiSnips/htmldjango.snippets index 37fa85fd..2ef004e2 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/htmldjango.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/htmldjango.snippets @@ -4,30 +4,30 @@ extends html # Generic Tags snippet % "" bi -{% ${1} %}${2} +{% $1 %}$2 endsnippet snippet %% "" bi {% ${1:tag_name} %} - ${2} + $2 {% end$1 %} endsnippet snippet { "" bi -{{ ${1} }}${2} +{{ $1 }}$2 endsnippet # Template Tags snippet autoescape "" bi {% autoescape ${1:off} %} - ${2} + $2 {% endautoescape %} endsnippet snippet block "" bi -{% block ${1} %} - ${2} +{% block $1 %} + $2 {% endblock $1 %} endsnippet @@ -37,12 +37,12 @@ endsnippet snippet comment "" bi {% comment %} - ${1} + $1 {% endcomment %} endsnippet snippet cycle "" bi -{% cycle ${1:val1} ${2:val2} ${3:as ${4}} %} +{% cycle ${1:val1} ${2:val2} ${3:as $4} %} endsnippet snippet debug "" bi @@ -54,76 +54,76 @@ snippet extends "" bi endsnippet snippet filter "" bi -{% filter ${1} %} - ${2} +{% filter $1 %} + $2 {% endfilter %} endsnippet snippet firstof "" bi -{% firstof ${1} %} +{% firstof $1 %} endsnippet snippet for "" bi -{% for ${1} in ${2} %} - ${3} +{% for $1 in $2 %} + $3 {% endfor %} endsnippet snippet empty "" bi {% empty %} - ${1} + $1 endsnippet snippet if "" bi -{% if ${1} %} - ${2} +{% if $1 %} + $2 {% endif %} endsnippet snippet iif "" bi -{% if ${1} %}${2}{% endif %} +{% if $1 %}$2{% endif %} endsnippet snippet ielse "" bi -{% else %}${1} +{% else %}$1 endsnippet snippet else "" bi {% else %} - ${1} + $1 endsnippet snippet ielif "" bi -{% elif %}${1} +{% elif %}$1 endsnippet snippet elif "" bi {% elif %} - ${1} + $1 endsnippet snippet ifchanged "" bi -{% ifchanged %}${1}{% endifchanged %} +{% ifchanged %}$1{% endifchanged %} endsnippet snippet ifequal "" bi -{% ifequal ${1} ${2} %} - ${3} +{% ifequal $1 $2 %} + $3 {% endifequal %} endsnippet snippet ifnotequal "" bi -{% ifnotequal ${1} ${2} %} - ${3} +{% ifnotequal $1 $2 %} + $3 {% endifnotequal %} endsnippet snippet include "" bi -{% include "${1}" %} +{% include "$1" %} endsnippet snippet load "" bi -{% load ${1} %} +{% load $1 %} endsnippet snippet now "" bi @@ -131,15 +131,15 @@ snippet now "" bi endsnippet snippet regroup "" bi -{% regroup ${1} by ${2} as ${3} %} +{% regroup $1 by $2 as $3 %} endsnippet snippet spaceless "" bi -{% spaceless %}${1}{% endspaceless %} +{% spaceless %}$1{% endspaceless %} endsnippet snippet ssi "" bi -{% ssi ${1} %} +{% ssi $1 %} endsnippet snippet trans "" bi @@ -147,7 +147,7 @@ snippet trans "" bi endsnippet snippet url "" bi -{% url ${1} as ${2} %} +{% url $1 as $2 %} endsnippet snippet widthratio "" bi @@ -155,7 +155,7 @@ snippet widthratio "" bi endsnippet snippet with "" bi -{% with ${1} as ${2} %} +{% with $1 as $2 %} ${VISUAL} {% endwith %} endsnippet @@ -197,7 +197,7 @@ snippet blocktrans "" bi endsnippet snippet lorem "" bi -{% lorem ${1} %} +{% lorem $1 %} endsnippet # Template Filters @@ -209,91 +209,91 @@ endsnippet # Note: Template tags that take no arguments are not implemented. snippet add "" bi -add:"${1}" +add:"$1" endsnippet snippet center "" bi -center:"${1}" +center:"$1" endsnippet snippet cut "" bi -cut:"${1}" +cut:"$1" endsnippet snippet date "" bi -date:"${1}" +date:"$1" endsnippet snippet default "" bi -default:"${1}" +default:"$1" endsnippet snippet defaultifnone "" bi -default_if_none:"${1}" +default_if_none:"$1" endsnippet snippet dictsort "" bi -dictsort:"${1}" +dictsort:"$1" endsnippet snippet dictsortrev "" bi -dictsortreversed:"${1}" +dictsortreversed:"$1" endsnippet snippet divisibleby "" bi -divisibleby:"${1}" +divisibleby:"$1" endsnippet snippet floatformat "" bi -floatformat:"${1}" +floatformat:"$1" endsnippet snippet getdigit "" bi -get_digit:"${1}" +get_digit:"$1" endsnippet snippet join "" bi -join:"${1}" +join:"$1" endsnippet snippet lengthis "" bi -length_is:"${1}" +length_is:"$1" endsnippet snippet pluralize "" bi -pluralize:"${1}" +pluralize:"$1" endsnippet snippet removetags "" bi -removetags:"${1}" +removetags:"$1" endsnippet snippet slice "" bi -slice:"${1}" +slice:"$1" endsnippet snippet stringformat "" bi -stringformat:"${1}" +stringformat:"$1" endsnippet snippet time "" bi -time:"${1}" +time:"$1" endsnippet snippet truncatewords "" bi -truncatewords:${1} +truncatewords:$1 endsnippet snippet truncatewordshtml "" bi -truncatewords_html:${1} +truncatewords_html:$1 endsnippet snippet urlizetrunc "" bi -urlizetrunc:${1} +urlizetrunc:$1 endsnippet snippet wordwrap "" bi -wordwrap:${1} +wordwrap:$1 endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/java.snippets b/sources_non_forked/vim-snippets/UltiSnips/java.snippets index 54d026df..55883a36 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/java.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/java.snippets @@ -48,7 +48,7 @@ $0 endsnippet snippet /o|v/ "new Object or variable" br -${1:Object} ${2:var} = new $1(${3}); +${1:Object} ${2:var} = new $1($3); endsnippet snippet f "field" b @@ -310,13 +310,13 @@ try { endsnippet snippet mt "method throws" b -${1:private} ${2:void} ${3:method}(${4}) ${5:throws $6 }{ +${1:private} ${2:void} ${3:method}($4) ${5:throws $6 }{ $0 } endsnippet snippet m "method" b -${1:private} ${2:void} ${3:method}(${4}) { +${1:private} ${2:void} ${3:method}($4) { $0 } endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript-angular.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript-angular.snippets index 91b59316..c231ece1 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript-angular.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript-angular.snippets @@ -19,7 +19,7 @@ config(function($1) { endsnippet snippet acont "angular controller" i -controller('${1:name}', [${2}function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) { +controller('${1:name}', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) { $0 }]); endsnippet @@ -31,29 +31,29 @@ controller('${1:name}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$) endsnippet snippet adir "angular directive" i -directive('${1}', [${2}function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) { +directive('$1', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) { return { restrict: '${3:EA}', link: function(scope, element, attrs) { - ${0} + $0 } }; }]); endsnippet snippet adirs "angular directive with scope" i -directive('${1}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) { +directive('$1', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) { return { restrict: '${3:EA}', link: function(scope, element, attrs) { - ${0} + $0 } }; }]); endsnippet snippet afact "angular factory" i -factory('${1:name}', [${2}function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) { +factory('${1:name}', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) { $0 }]); endsnippet @@ -65,7 +65,7 @@ factory('${1:name}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$ endsnippet snippet aserv "angular service" i -service('${1:name}', [${2}function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) { +service('${1:name}', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) { $0 }]); endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript-node.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript-node.snippets index 7a14deeb..e4a64e95 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript-node.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript-node.snippets @@ -5,48 +5,48 @@ snippet #! "shebang" endsnippet snippet vreq "assign a CommonJS-style module to a var" -var ${0:${1/(.+\/)*(\w+)(-|\b|$)(\..+$)?/\u$2/g}} = require('${1}'); +var ${0:${1/(.+\/)*(\w+)(-|\b|$)(\..+$)?/\u$2/g}} = require('$1'); endsnippet snippet ex "module.exports" -module.exports = ${1}; +module.exports = $1; endsnippet snippet hcs "http.createServer" -http.createServer(${1}).listen(${2}); +http.createServer($1).listen($2); endsnippet snippet ncs "net.createServer" net.createServer(function(${1:socket}){ - ${1}.on('data', function(${3:data}){ - ${4} + $1.on('data', function(${3:data}){ + $4 }); - ${1}.on('end', function(){ - ${5} + $1.on('end', function(){ + $5 }); }).listen(${6:8124}); endsnippet snippet pipe "pipe" -pipe(${1:stream})${2} +pipe(${1:stream})$2 endsnippet # Express snippets snippet eget "express GET" -${1:app}.get('${2}', ${3}); +${1:app}.get('$2', $3); endsnippet snippet epost "express POST" -${1:app}.post('${2}', ${3}); +${1:app}.post('$2', $3); endsnippet snippet eput "express PUT" -${1:app}.put('${2}', ${3}); +${1:app}.put('$2', $3); endsnippet snippet edelete "express DELETE" -${1:app}.delete('${2}', ${3}); +${1:app}.delete('$2', $3); endsnippet # process snippets diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript-openui5.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript-openui5.snippets index 5553c79a..db4481cd 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript-openui5.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript-openui5.snippets @@ -1,80 +1,80 @@ snippet sapmlabel - var ${1} = new sap.m.Label({ - design : ${2}, - text : ${3}, - visible : ${4}, - textAlign : ${5}, - textDirection : ${6}, - width : ${7}, - required : ${7} + var $1 = new sap.m.Label({ + design : $2, + text : $3, + visible : $4, + textAlign : $5, + textDirection : $6, + width : $7, + required : $7 }); snippet sapmtext - var ${1} = new sap.m.Text({ - text :${2}, - textDirection :${3}, - visible :${4}, - wrapping : ${5}, - textAlign : ${6}, - width :${7}, - maxLines :${8} + var $1 = new sap.m.Text({ + text :$2, + textDirection :$3, + visible :$4, + wrapping : $5, + textAlign : $6, + width :$7, + maxLines :$8 }); snippet sapmbutton - var ${1} = new sap.m.Button({ - text : ${2}, - type : ${3}, - width : ${4}, - enabled :${5}, - visible :${6}, - icon : ${7}, - iconFirst : ${8}, - activeIcon :${9}, - iconDensityAware : ${10}, + var $1 = new sap.m.Button({ + text : $2, + type : $3, + width : $4, + enabled :$5, + visible :$6, + icon : $7, + iconFirst : $8, + activeIcon :$9, + iconDensityAware : $10, }); snippet sapmflexbox - var ${1} = new sap.m.FlexBox({ - visible : ${2}, - height : ${3}, - width : ${4}, - displayInline :${5}, - direction :${6}, - fitContainer : ${7}, - renderType : ${8}, - justifyContent :${9}, - alignItems : ${10}, + var $1 = new sap.m.FlexBox({ + visible : $2, + height : $3, + width : $4, + displayInline :$5, + direction :$6, + fitContainer : $7, + renderType : $8, + justifyContent :$9, + alignItems : $10, items:[] }); snippet sapmhbox - var ${1} = new sap.m.HBox({ - visible : ${2}, - height : ${3}, - width : ${4}, - displayInline :${5}, - direction :${6}, - fitContainer : ${7}, - renderType : ${8}, - justifyContent :${9}, - alignItems : ${10}, + var $1 = new sap.m.HBox({ + visible : $2, + height : $3, + width : $4, + displayInline :$5, + direction :$6, + fitContainer : $7, + renderType : $8, + justifyContent :$9, + alignItems : $10, items:[] }); snippet sapmvbox - var ${1} = new sap.m.VBox({ - visible : ${2}, - height : ${3}, - width : ${4}, - displayInline :${5}, - direction :${6}, - fitContainer : ${7}, - renderType : ${8}, - justifyContent :${9}, - alignItems : ${10}, + var $1 = new sap.m.VBox({ + visible : $2, + height : $3, + width : $4, + displayInline :$5, + direction :$6, + fitContainer : $7, + renderType : $8, + justifyContent :$9, + alignItems : $10, items:[] }); snippet sapcomponent - sap.ui.controller("${1}", { + sap.ui.controller("$1", { onInit: function(){ }, onAfterRendering: function() { @@ -86,120 +86,120 @@ snippet sapcomponent }); snippet sapminput - var ${1} = new sap.m.Input({ - value :${2}, - width : ${3}, - enabled :${4}, - visible :${5}, - valueState :${6}, - name : ${7}, - placeholder : ${8}, - editable : ${9}, - type : ${10}, - maxLength :${11}, - valueStateText :${12}, - showValueStateMessage :${13}, - dateFormat :${14}, - showValueHelp :${15}, - showSuggestion :${16}, - valueHelpOnly :${17}, - filterSuggests :${18}, - maxSuggestionWidth :${19}, - startSuggestion : ${20}, - showTableSuggestionValueHelp : ${21}, - description : ${22}, - fieldWidth : ${23}, - valueLiveUpdate :${24}, - suggestionItems :[${25}], - suggestionColumns : [${26}], - suggestionRows : [${27}], - liveChange : ${28}, - valueHelpRequest :${29}, - suggest : ${30}, - suggestionItemSelected : ${31} + var $1 = new sap.m.Input({ + value :$2, + width : $3, + enabled :$4, + visible :$5, + valueState :$6, + name : $7, + placeholder : $8, + editable : $9, + type : $10, + maxLength :$11, + valueStateText :$12, + showValueStateMessage :$13, + dateFormat :$14, + showValueHelp :$15, + showSuggestion :$16, + valueHelpOnly :$17, + filterSuggests :$18, + maxSuggestionWidth :$19, + startSuggestion : $20, + showTableSuggestionValueHelp : $21, + description : $22, + fieldWidth : $23, + valueLiveUpdate :$24, + suggestionItems :[$25], + suggestionColumns : [$26], + suggestionRows : [$27], + liveChange : $28, + valueHelpRequest :$29, + suggest : $30, + suggestionItemSelected : $31 }); snippet _sthis var _self = this; snippet sapmresponsivepopup - var ${1} = new sap.m.ResponsivePopover({ - placement :${2} ,//sap.m.PlacementType (default: sap.m.PlacementType.Right) - showHeader :${3} ,//boolean (default: true) - title : ${4},//string - icon :${5} ,//sap.ui.core.URI - modal :${6} ,// boolean - offsetX :${7}, //int - offsetY :${8}, //int - contentWidth : ${9},//sap.ui.core.CSSSize - contentHeight :${10}, //sap.ui.core.CSSSize - horizontalScrolling :${11}, //boolean - verticalScrolling :${12}, //boolean - showCloseButton :${13}, //boolean (default: true) + var $1 = new sap.m.ResponsivePopover({ + placement :$2 ,//sap.m.PlacementType (default: sap.m.PlacementType.Right) + showHeader :$3 ,//boolean (default: true) + title : $4,//string + icon :$5 ,//sap.ui.core.URI + modal :$6 ,// boolean + offsetX :$7, //int + offsetY :$8, //int + contentWidth : $9,//sap.ui.core.CSSSize + contentHeight :$10, //sap.ui.core.CSSSize + horizontalScrolling :$11, //boolean + verticalScrolling :$12, //boolean + showCloseButton :$13, //boolean (default: true) //Aggregations - content :${14}, //sap.ui.core.Control[] - customHeader :${15}, //sap.m.IBar - subHeader : ${16}, //sap.m.IBar - beginButton :${17}, //sap.m.Button - endButton : ${18}, //sap.m.Button + content :$14, //sap.ui.core.Control[] + customHeader :$15, //sap.m.IBar + subHeader : $16, //sap.m.IBar + beginButton :$17, //sap.m.Button + endButton : $18, //sap.m.Button //Associations - initialFocus : ${19}, //string | sap.ui.core.Control + initialFocus : $19, //string | sap.ui.core.Control //Events - beforeOpen :${20}, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject] - afterOpen : ${21}, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject] - beforeClose : ${22}, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject] - afterClose : ${23} //fnList + beforeOpen :$20, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject] + afterOpen : $21, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject] + beforeClose : $22, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject] + afterClose : $23 //fnList }); snippet sapicon - var ${1} = new sap.ui.core.Icon({ - src :${2} , //sap.ui.core.URI - size :${3} , //sap.ui.core.CSSSize - color :${4} , //sap.ui.core.CSSColor - hoverColor : ${5} , // sap.ui.core.CSSColor - activeColor :${6} , //sap.ui.core.CSSColor - width :${7} , //sap.ui.core.CSSSize - height : ${8} ,//sap.ui.core.CSSSize - backgroundColor :${8} , //sap.ui.core.CSSColor - hoverBackgroundColor :${9} , //sap.ui.core.CSSColor - activeBackgroundColor :${10} , //sap.ui.core.CSSColor - visible :${11} , //boolean (default: true) - decorative : ${12} ,//boolean (default: true) + var $1 = new sap.ui.core.Icon({ + src :$2 , //sap.ui.core.URI + size :$3 , //sap.ui.core.CSSSize + color :$4 , //sap.ui.core.CSSColor + hoverColor : $5 , // sap.ui.core.CSSColor + activeColor :$6 , //sap.ui.core.CSSColor + width :$7 , //sap.ui.core.CSSSize + height : $8 ,//sap.ui.core.CSSSize + backgroundColor :$8 , //sap.ui.core.CSSColor + hoverBackgroundColor :$9 , //sap.ui.core.CSSColor + activeBackgroundColor :$10 , //sap.ui.core.CSSColor + visible :$11 , //boolean (default: true) + decorative : $12 ,//boolean (default: true) }); snippet extendVerticalL - sap.ui.layout.VerticalLayout.extend("${1}", { + sap.ui.layout.VerticalLayout.extend("$1", { metadata: { properties: { - ${2} + $2 }, aggregations: { - ${3} + $3 }, events: { - ${4} + $4 } }, init: function(){ - ${5} + $5 }, - renderer: "${6}" + renderer: "$6" }); snippet extendHorizontalL - sap.ui.layout.HorizontalLayout.extend("${1}", { + sap.ui.layout.HorizontalLayout.extend("$1", { metadata: { properties: { - ${2} + $2 }, aggregations: { - ${3} + $3 }, events: { - ${4} + $4 } }, init: function(){ - ${5} + $5 }, - renderer: "${6}" + renderer: "$6" }); diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets index 8821c5ca..29bf9ed1 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets @@ -34,18 +34,6 @@ ${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) { endsnippet -snippet for "for (...) {...} (counting up)" b -for (var ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) { - ${VISUAL}$0 -} -endsnippet - -snippet ford "for (...) {...} (counting down, faster)" b -for (var ${2:i} = ${1:Things.length} - 1; $2 >= 0; $2--) { - ${VISUAL}$0 -} -endsnippet - snippet fun "function (fun)" w function ${1:function_name}(${2:argument}) { ${VISUAL}$0 @@ -53,7 +41,7 @@ function ${1:function_name}(${2:argument}) { endsnippet snippet vf "Function assigned to var" -${1:var }${2:function_name} = function $2(${3}) { +${1:var }${2:function_name} = function $2($3) { ${VISUAL}$0 }; endsnippet @@ -84,78 +72,4 @@ for (${1:prop} in ${2:obj}){ } endsnippet -# Snippets for Console Debug Output - -snippet ca "console.assert" b -console.assert(${1:assertion}, ${2:"${3:message}"}); -endsnippet - -snippet cclear "console.clear" b -console.clear(); -endsnippet - -snippet cdir "console.dir" b -console.dir(${1:object}); -endsnippet - -snippet cdirx "console.dirxml" b -console.dirxml(${1:object}); -endsnippet - -snippet ce "console.error" b -console.error(${1:"${2:value}"}); -endsnippet - -snippet cgroup "console.group" b -console.group("${1:label}"); -${VISUAL}$0 -console.groupEnd(); -endsnippet - -snippet cgroupc "console.groupCollapsed" b -console.groupCollapsed("${1:label}"); -${VISUAL}$0 -console.groupEnd(); -endsnippet - -snippet ci "console.info" b -console.info(${1:"${2:value}"}); -endsnippet - -snippet cl "console.log" b -console.log(${1:"${2:value}"}); -endsnippet - -snippet cd "console.debug" b -console.debug(${1:"${2:value}"}); -endsnippet - -snippet cprof "console.profile" b -console.profile("${1:label}"); -${VISUAL}$0 -console.profileEnd(); -endsnippet - -snippet ctable "console.table" b -console.table(${1:"${2:value}"}); -endsnippet - -snippet ctime "console.time" b -console.time("${1:label}"); -${VISUAL}$0 -console.timeEnd("$1"); -endsnippet - -snippet ctimestamp "console.timeStamp" b -console.timeStamp("${1:label}"); -endsnippet - -snippet ctrace "console.trace" b -console.trace(); -endsnippet - -snippet cw "console.warn" b -console.warn(${1:"${2:value}"}); -endsnippet - # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/php-laravel.snippets b/sources_non_forked/vim-snippets/UltiSnips/php-laravel.snippets index de244736..903d8586 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/php-laravel.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/php-laravel.snippets @@ -53,9 +53,9 @@ use Illuminate\Support\ServiceProvider; class ${2:`!v expand('%:t:r')`} extends ServiceProvider { public function register() { - $this->app->bind('${4}Service', function ($app) { - return new ${5}( - $app->make('Repositories\\${6}Interface') + $this->app->bind('$4Service', function ($app) { + return new $5( + $app->make('Repositories\\$6Interface') ); }); } @@ -121,7 +121,7 @@ class ${2:`!v expand('%:t:r')`} extends \Eloquent { public $timestamps = ${5:false}; - protected $hidden = [${6}]; + protected $hidden = [$6]; protected $guarded = [${7:'id'}]; } @@ -208,10 +208,10 @@ snippet l_r "Laravel Repository" b * \date `!v strftime('%d-%m-%y')` */ -namespace ${1:Repositories\\${2}}; +namespace ${1:Repositories\\$2}; -class ${3:`!v expand('%:t:r')`} extends \\${6} implements ${4:$3RepositoryInterface} { - ${7} +class ${3:`!v expand('%:t:r')`} extends \\$6 implements ${4:$3RepositoryInterface} { + $7 } endsnippet @@ -227,7 +227,7 @@ snippet l_s "Laravel Service" b * \date `!v strftime('%d-%m-%y')` */ -namespace Services\\${1}; +namespace Services\\$1; use ${3:Repositories\\${4:Interface}}; @@ -265,6 +265,6 @@ class ${2:`!v expand('%:t:r')`} extends Facade { * * \return string */ - protected static function getFacadeAccessor() { return '${4:${3}Service}'; } + protected static function getFacadeAccessor() { return '${4:$3Service}'; } } endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/php-phpspec.snippets b/sources_non_forked/vim-snippets/UltiSnips/php-phpspec.snippets index 08d84a05..a0acfc3a 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/php-phpspec.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/php-phpspec.snippets @@ -23,15 +23,15 @@ class `!p snip.rv = re.match(r'.*(?=\.)', fn).group() ` extends ObjectBehavior { - function it_${1}() + function it_$1() { - $0 + ${0:${VISUAL}} } } endsnippet snippet it "function it_does_something() { ... }" -function it_${1}() +function it_$1() { ${0:${VISUAL}} } @@ -53,7 +53,7 @@ endsnippet # Object construction snippet cw "$this->beConstructedWith($arg)" -$this->beConstructedWith(${1}); +$this->beConstructedWith($1); endsnippet snippet ct "$this->beConstructedThrough($methodName, [$arg])" @@ -112,44 +112,44 @@ endsnippet # Type matchers snippet stype "$this->shouldHaveType('Type')" -$this->shouldHaveType(${1}); +$this->shouldHaveType($1); endsnippet snippet sntype "$this->shouldNotHaveType('Type')" -$this->shouldNotHaveType(${1}); +$this->shouldNotHaveType($1); endsnippet snippet srinstance "$this->shouldReturnAnInstanceOf('Type')" -$this->shouldReturnAnInstanceOf(${1}); +$this->shouldReturnAnInstanceOf($1); endsnippet snippet snrinstance "$this->shouldNotReturnAnInstanceOf('Type')" -$this->shouldNotReturnAnInstanceOf(${1}); +$this->shouldNotReturnAnInstanceOf($1); endsnippet snippet sbinstance "$this->shouldBeAnInstanceOf('Type')" -$this->shouldBeAnInstanceOf(${1}); +$this->shouldBeAnInstanceOf($1); endsnippet snippet snbinstance "$this->shouldNotBeAnInstanceOf('Type')" -$this->shouldNotBeAnInstanceOf(${1}); +$this->shouldNotBeAnInstanceOf($1); endsnippet snippet simplement "$this->shouldImplement('Type')" -$this->shouldImplement(${1}); +$this->shouldImplement($1); endsnippet snippet snimplement "$this->shouldNotImplement('Type')" -$this->shouldNotImplement(${1}); +$this->shouldNotImplement($1); endsnippet # Object state matchers snippet sbstate "$this->shouldBeXYZ()" -$this->shouldBe${1}(); +$this->shouldBe$1(); endsnippet snippet snbstate "$this->shouldNotBeXYZ()" -$this->shouldNotBe${1}(); +$this->shouldNotBe$1(); endsnippet # Count matchers diff --git a/sources_non_forked/vim-snippets/UltiSnips/php-symfony2.snippets b/sources_non_forked/vim-snippets/UltiSnips/php-symfony2.snippets index 9bca168c..7e3d5804 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/php-symfony2.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/php-symfony2.snippets @@ -67,25 +67,25 @@ endsnippet snippet act "Symfony2 action" b /** - * @Route("${3}", name="${4}") + * @Route("$3", name="$4") * @Method({${5:"POST"}}) * @Template() */ -public function ${1}Action(${2}) +public function $1Action($2) { - ${6} + $6 } endsnippet snippet actt "Symfony2 action and template" b /** - * @Route("${3}", name="${4}") + * @Route("$3", name="$4") * @Method({${5:"GET"}}) * @Template() */ -public function ${1}Action(${2}) +public function $1Action($2) { - ${6} + $6 return []; }`!p relpath = os.path.relpath(path)` @@ -116,8 +116,8 @@ snip.rv = re.match(r'.*(?=\.)', fn).group() { protected function configure() { - $this->setName('${1}') - ->setDescription('${2}') + $this->setName('$1') + ->setDescription('$2') ->setDefinition([ new InputArgument('', InputArgument::REQUIRED, ''), new InputOption('', null, InputOption::VALUE_NONE, ''), @@ -186,14 +186,14 @@ snip.rv = re.match(r'.*(?=\.)', fn).group() /** * {@inheritDoc} */ - public function transform(${1}) + public function transform($1) { } /** * {@inheritDoc} */ - public function reverseTransform(${2}) + public function reverseTransform($2) { } } @@ -279,7 +279,7 @@ snip.rv = re.match(r'.*(?=\.)', fn).group() */ public function getName() { - return '${1}'; + return '$1'; } } endsnippet @@ -307,54 +307,54 @@ snip.rv = re.match(r'.*(?=\.)', fn).group() endsnippet snippet redir "Symfony2 redirect" b -$this->redirect($this->generateUrl('${1}', ${2})); +$this->redirect($this->generateUrl('$1', $2)); endsnippet snippet usecontroller "Symfony2 use Symfony\..\Controller" b -use Symfony\Bundle\FrameworkBundle\Controller\Controller;${1} +use Symfony\Bundle\FrameworkBundle\Controller\Controller;$1 endsnippet snippet usereauest "Symfony2 use Symfony\..\Request" b -use Symfony\Component\HttpFoundation\Request;${1} +use Symfony\Component\HttpFoundation\Request;$1 endsnippet snippet useroute "Symfony2 use Sensio\..\Route" b -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;${1} +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;$1 endsnippet snippet useresponse "Symfony2 use Symfony\..\Response" b -use Symfony\Component\HttpFoundation\Response;${1} +use Symfony\Component\HttpFoundation\Response;$1 endsnippet snippet usefile "Symfony2 use Symfony\..\File" b -use Symfony\Component\HttpFoundation\File\UploadedFile;${1} +use Symfony\Component\HttpFoundation\File\UploadedFile;$1 endsnippet snippet useassert "Symfony2 use Symfony\..\Constraints as Assert" b -use Symfony\Component\Validator\Constraints as Assert;${1} +use Symfony\Component\Validator\Constraints as Assert;$1 endsnippet snippet usetemplate "Symfony2 use Sensio\..\Template" b -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;${1} +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;$1 endsnippet snippet usecache "Symfony2 use Sensio\..\Cache" b -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;${1} +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;$1 endsnippet snippet usemethod "Symfony2 use Sensio\..\Method" b -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;${1} +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;$1 endsnippet snippet usearray "Symfony2 use Doctrine\..\ArrayCollection" b -use Doctrine\Common\Collections\ArrayCollection;${1} +use Doctrine\Common\Collections\ArrayCollection;$1 endsnippet snippet useorm "Symfony2 use Doctrine\..\Mapping as ORM" b -use Doctrine\ORM\Mapping as ORM;${1} +use Doctrine\ORM\Mapping as ORM;$1 endsnippet snippet usesecure "Symfony2 use JMS\..\Secure" b -use JMS\SecurityExtraBundle\Annotation\Secure;${1} +use JMS\SecurityExtraBundle\Annotation\Secure;$1 endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/php.snippets b/sources_non_forked/vim-snippets/UltiSnips/php.snippets index c7344a59..dde0def9 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/php.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/php.snippets @@ -250,7 +250,7 @@ class `!p snip.rv = re.match(r'.*(?=\.)', fn).group() ` extends \PHPUnit_Framework_TestCase { - public function test${1}() + public function test$1() { ${0:${VISUAL}} } diff --git a/sources_non_forked/vim-snippets/UltiSnips/proto.snippets b/sources_non_forked/vim-snippets/UltiSnips/proto.snippets index 923be578..11e90107 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/proto.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/proto.snippets @@ -32,17 +32,17 @@ endsnippet snippet reqf "Required field" b // ${4:TODO(`whoami`): Describe this field.} -optional ${1}`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1}; // Required +optional $1`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1}; // Required endsnippet snippet optf "Optional field" b // ${4:TODO(`whoami`): Describe this field.} -optional ${1}`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1}; +optional $1`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1}; endsnippet snippet repf "Repeated field" b // ${4:TODO(`whoami`): Describe this field.} -repeated ${1}`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1}; +repeated $1`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1}; endsnippet snippet enum "Enumeration" b diff --git a/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets b/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets index 1b2cfc57..7b39094c 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets @@ -133,103 +133,103 @@ endsnippet ######################################################################## snippet alert "Alert Function" b -alert("${1:message}")${0} +alert("${1:message}")$0 endsnippet snippet crit "Crit Function" b -crit("${1:message}")${0} +crit("${1:message}")$0 endsnippet snippet debug "Debug Function" b -debug("${1:message}")${0} +debug("${1:message}")$0 endsnippet snippet defined "Defined Function" b -defined(${1:Resource}["${2:name}"])${0} +defined(${1:Resource}["${2:name}"])$0 endsnippet snippet emerg "Emerg Function" b -emerg("${1:message}")${0} +emerg("${1:message}")$0 endsnippet snippet extlookup "Simple Extlookup" b -$${1:Variable} = extlookup("${2:Lookup}")${0} +$${1:Variable} = extlookup("${2:Lookup}")$0 endsnippet snippet extlookup "Extlookup with defaults" b -$${1:Variable} = extlookup("${2:Lookup}", ${3:Default})${0} +$${1:Variable} = extlookup("${2:Lookup}", ${3:Default})$0 endsnippet snippet extlookup "Extlookup with defaults and custom data file" b -$${1:Variable} = extlookup("${2:Lookup}", ${3:Default}, ${4:Data Source})${0} +$${1:Variable} = extlookup("${2:Lookup}", ${3:Default}, ${4:Data Source})$0 endsnippet snippet fail "Fail Function" b -fail("${1:message}")${0} +fail("${1:message}")$0 endsnippet snippet hiera "Hiera Function" b -$${1:Variable} = hiera("${2:Lookup}")${0} +$${1:Variable} = hiera("${2:Lookup}")$0 endsnippet snippet hiera "Hiera with defaults" b -$${1:Variable} = hiera("${2:Lookup}", ${3:Default})${0} +$${1:Variable} = hiera("${2:Lookup}", ${3:Default})$0 endsnippet snippet hiera "Hiera with defaults and override" b -$${1:Variable} = hiera("${2:Lookup}", ${3:Default}, ${4:Override})${0} +$${1:Variable} = hiera("${2:Lookup}", ${3:Default}, ${4:Override})$0 endsnippet snippet hiera_hash "Hiera Hash Function" b -$${1:Variable} = hiera_hash("${2:Lookup}")${0} +$${1:Variable} = hiera_hash("${2:Lookup}")$0 endsnippet snippet hiera_hash "Hiera Hash with defaults" b -$${1:Variable} = hiera_hash("${2:Lookup}", ${3:Default})${0} +$${1:Variable} = hiera_hash("${2:Lookup}", ${3:Default})$0 endsnippet snippet hiera_hash "Hiera Hash with defaults and override" b -$${1:Variable} = hiera_hash("${2:Lookup}", ${3:Default}, ${4:Override})${0} +$${1:Variable} = hiera_hash("${2:Lookup}", ${3:Default}, ${4:Override})$0 endsnippet snippet hiera_include "Hiera Include Function" b -hiera_include("${1:Lookup}")${0} +hiera_include("${1:Lookup}")$0 endsnippet snippet include "Include Function" b -include ${1:classname}${0} +include ${1:classname}$0 endsnippet snippet info "Info Function" b -info("${1:message}")${0} +info("${1:message}")$0 endsnippet snippet inline_template "Inline Template Function" b -inline_template("<%= ${1:template} %>")${0} +inline_template("<%= ${1:template} %>")$0 endsnippet snippet notice "Notice Function" b -notice("${1:message}")${0} +notice("${1:message}")$0 endsnippet snippet realize "Realize Function" b -realize(${1:Resource}["${2:name}"])${0} +realize(${1:Resource}["${2:name}"])$0 endsnippet snippet regsubst "Regsubst Function" b -regsubst($${1:Target}, '${2:regexp}', '${3:replacement}')${0} +regsubst($${1:Target}, '${2:regexp}', '${3:replacement}')$0 endsnippet snippet split "Split Function" b -$${1:Variable} = split($${1:Target}, '${2:regexp}')${0} +$${1:Variable} = split($${1:Target}, '${2:regexp}')$0 endsnippet snippet versioncmp "Version Compare Function" b -$${1:Variable} = versioncmp('${1:version}', '${2:version}')${0} +$${1:Variable} = versioncmp('${1:version}', '${2:version}')$0 endsnippet snippet warning "Warning Function" b -warning("${1:message}")${0} +warning("${1:message}")$0 endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/python.snippets b/sources_non_forked/vim-snippets/UltiSnips/python.snippets index 5d8e2641..686226e7 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/python.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/python.snippets @@ -19,7 +19,7 @@ endsnippet snippet with "with" b with ${1:expr}`!p snip.rv = " as " if t[2] else ""`${2:var}: ${3:${VISUAL:pass}} -${0} +$0 endsnippet snippet for "for loop" b diff --git a/sources_non_forked/vim-snippets/UltiSnips/r.snippets b/sources_non_forked/vim-snippets/UltiSnips/r.snippets index 02c4c259..44624b3b 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/r.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/r.snippets @@ -24,11 +24,11 @@ setwd("${1:`!p snip.rv = os.getcwd()`}") endsnippet snippet as "Apply type on variable" w -as.$1`!p snip.rv = complete(t[1], FIELD_TYPES)`(${2}${VISUAL}) +as.$1`!p snip.rv = complete(t[1], FIELD_TYPES)`($2${VISUAL}) endsnippet snippet is "Test type on variable" w -is.$1`!p snip.rv = complete(t[1], FIELD_TYPES)`(${2}${VISUAL}) +is.$1`!p snip.rv = complete(t[1], FIELD_TYPES)`($2${VISUAL}) endsnippet snippet dl "Download and install a package" b @@ -50,51 +50,51 @@ source('${0:file}') endsnippet snippet if "If statement" -if (${1}) { - ${0} +if ($1) { + $0 } endsnippet snippet eif "Else-If statement" -else if (${1}) { - ${0} +else if ($1) { + $0 } endsnippet snippet el "Else statement" else { - ${0} + $0 } endsnippet snippet ife "if .. else" -if (${1}) { - ${2} +if ($1) { + $2 } else { - ${3} + $3 } endsnippet snippet wh "while loop" -while(${1}) { - ${2} +while($1) { + $2 } endsnippet snippet for "for loop" for (${1:item} in ${2:list}) { - ${3} + $3 } endsnippet snippet fun "Function definition" -${1:name} <- function (${2}) { - ${0} +${1:name} <- function ($2) { + $0 } endsnippet snippet ret "Return call" -return(${0}) +return($0) endsnippet snippet df "Data frame" diff --git a/sources_non_forked/vim-snippets/UltiSnips/rails.snippets b/sources_non_forked/vim-snippets/UltiSnips/rails.snippets index e7b2757b..9aefe667 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/rails.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/rails.snippets @@ -22,7 +22,7 @@ class ${1:Model}Controller < ApplicationController $0 private - def find_${2} + def find_$2 @$2 = ${3:$1}.find(params[:id]) if params[:id] end end @@ -253,7 +253,7 @@ after_validation_on_update $0 endsnippet snippet asg "assert(var = assigns(:var))" -assert(${1:var} = assigns(:${1}), "Cannot find @${1}") +assert(${1:var} = assigns(:$1), "Cannot find @$1") $0 endsnippet @@ -270,11 +270,11 @@ end endsnippet snippet artnpp "assert_redirected_to (nested path plural)" -assert_redirected_to ${10:${2:parent}_${3:child}_path(${4:@}${5:${2}})} +assert_redirected_to ${10:${2:parent}_${3:child}_path(${4:@}${5:$2})} endsnippet snippet artnp "assert_redirected_to (nested path)" -assert_redirected_to ${2:${12:parent}_${13:child}_path(${14:@}${15:${12}}, ${16:@}${17:${13}})} +assert_redirected_to ${2:${12:parent}_${13:child}_path(${14:@}${15:$12}, ${16:@}${17:$13})} endsnippet snippet artpp "assert_redirected_to (path plural)" @@ -282,7 +282,7 @@ assert_redirected_to ${10:${2:model}s_path} endsnippet snippet artp "assert_redirected_to (path)" -assert_redirected_to ${2:${12:model}_path(${13:@}${14:${12}})} +assert_redirected_to ${2:${12:model}_path(${13:@}${14:$12})} endsnippet snippet asrj "assert_rjs" @@ -324,7 +324,7 @@ before_validation_on_update endsnippet snippet bt "belongs_to (bt)" -belongs_to :${1:object}${2:, :class_name => "${3:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}", :foreign_key => "${4:${1}_id}"} +belongs_to :${1:object}${2:, :class_name => "${3:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}", :foreign_key => "${4:$1_id}"} endsnippet snippet crw "cattr_accessor" @@ -358,7 +358,7 @@ endsnippet snippet deftg "def get request" def test_should_get_${1:action} ${2:@${3:model} = ${4:$3s}(:${5:fixture_name}) - }get :${1}${6:, :id => @$3.to_param} + }get :$1${6:, :id => @$3.to_param} assert_response :success $0 end @@ -367,7 +367,7 @@ endsnippet snippet deftp "def post request" def test_should_post_${1:action} ${3:@$2 = ${4:$2s}(:${5:fixture_name}) - }post :${1}${6:, :id => @$2.to_param}, :${2:model} => { $0 } + }post :$1${6:, :id => @$2.to_param}, :${2:model} => { $0 } assert_response :redirect end @@ -400,23 +400,23 @@ end endsnippet snippet habtm "has_and_belongs_to_many (habtm)" -has_and_belongs_to_many :${1:object}${2:, :join_table => "${3:table_name}", :foreign_key => "${4:${1}_id}"} +has_and_belongs_to_many :${1:object}${2:, :join_table => "${3:table_name}", :foreign_key => "${4:$1_id}"} endsnippet snippet hm "has_many (hm)" -has_many :${1:object}s${2:, :class_name => "${1}", :foreign_key => "${4:reference}_id"} +has_many :${1:object}s${2:, :class_name => "$1", :foreign_key => "${4:reference}_id"} endsnippet snippet hmt "has_many (through)" -has_many :${1:objects}, :through => :${2:join_association}${3:, :source => :${4:${2}_table_foreign_key_to_${1}_table}} +has_many :${1:objects}, :through => :${2:join_association}${3:, :source => :${4:$2_table_foreign_key_to_$1_table}} endsnippet snippet hmd "has_many :dependent => :destroy" -has_many :${1:object}s${2:, :class_name => "${1}", :foreign_key => "${4:reference}_id"}, :dependent => :destroy$0 +has_many :${1:object}s${2:, :class_name => "$1", :foreign_key => "${4:reference}_id"}, :dependent => :destroy$0 endsnippet snippet ho "has_one (ho)" -has_one :${1:object}${2:, :class_name => "${3:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}", :foreign_key => "${4:${1}_id}"} +has_one :${1:object}${2:, :class_name => "${3:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}", :foreign_key => "${4:$1_id}"} endsnippet snippet logd "logger.debug" @@ -514,11 +514,11 @@ redirect_to :controller => "${1:items}", :action => "${2:show}", :id => ${0:@ite endsnippet snippet renpp "redirect_to (nested path plural)" -redirect_to(${2:${10:parent}_${11:child}_path(${12:@}${13:${10}})}) +redirect_to(${2:${10:parent}_${11:child}_path(${12:@}${13:$10})}) endsnippet snippet renp "redirect_to (nested path)" -redirect_to(${2:${12:parent}_${13:child}_path(${14:@}${15:${12}}, ${16:@}${17:${13}})}) +redirect_to(${2:${12:parent}_${13:child}_path(${14:@}${15:$12}, ${16:@}${17:$13})}) endsnippet snippet repp "redirect_to (path plural)" @@ -526,7 +526,7 @@ redirect_to(${2:${10:model}s_path}) endsnippet snippet rep "redirect_to (path)" -redirect_to(${2:${12:model}_path(${13:@}${14:${12}})}) +redirect_to(${2:${12:model}_path(${13:@}${14:$12})}) endsnippet snippet reb "redirect_to :back" @@ -882,12 +882,12 @@ end endsnippet snippet trans "Translation snippet" -I18n.t('`!v substitute(substitute(substitute(@%, substitute(getcwd() . "/", "\/", "\\\\/", "g"), "", ""), "\\(\\.\\(html\\|js\\)\\.\\(haml\\|erb\\)\\|\\(_controller\\)\\?\\.rb\\)$", "", ""), "/", ".", "g")`.${2:${1/[^\w]/_/g}}${3}', :default => "${1:some_text}"${4})${5:$0} +I18n.t('`!v substitute(substitute(substitute(@%, substitute(getcwd() . "/", "\/", "\\\\/", "g"), "", ""), "\\(\\.\\(html\\|js\\)\\.\\(haml\\|erb\\)\\|\\(_controller\\)\\?\\.rb\\)$", "", ""), "/", ".", "g")`.${2:${1/[^\w]/_/g}}$3', :default => "${1:some_text}"$4)${5:$0} endsnippet snippet route_spec it 'routes to #${1:action}' do - ${2:get}('/${3:url}').should route_to('`!v substitute(expand('%:t:r'), '_routing_spec$', '', '')`#$1'${4:, ${5:params}})${6} + ${2:get}('/${3:url}').should route_to('`!v substitute(expand('%:t:r'), '_routing_spec$', '', '')`#$1'${4:, ${5:params}})$6 end endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/rst.snippets b/sources_non_forked/vim-snippets/UltiSnips/rst.snippets index 0596eee1..9a2b4c0c 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/rst.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/rst.snippets @@ -28,7 +28,7 @@ SPECIFIC_ADMONITIONS = ["attention", "caution", "danger", #http://docutils.sourceforge.net/docs/ref/rst/directives.html DIRECTIVES = ['topic','sidebar','math','epigraph', 'parsed-literal','code','highlights', - 'pull-quote','compound','container', + 'pull-quote','compound','container','table','csv-table', 'list-table','class','sectnum', 'role','default-role','unicode', 'raw'] @@ -238,6 +238,7 @@ if di == 'im': if di == 'fi': content=""" :alt: {0} + {0}""".format(real_name) ` ..`!p snip.rv = " %s" % link if link else ""` $1`!p @@ -281,6 +282,23 @@ snippet ro "Text Roles" w path))`:\`$2\`\ endsnippet +snippet eu "Embedded URI" i +`!p +if has_cjk(vim.current.line): + snip.rv = "\ "`\`${1:${VISUAL:Text}} <${2:URI}>\`_`!p +if has_cjk(vim.current.line): + snip.rv ="\ " +else: + snip.rv = "" +`$0 +endsnippet + +snippet fnt "Footnote or Citation" i +[${1:Label}]_ $0 + +.. [$1] ${2:Reference} +endsnippet + ############ # Sphinx # ############ diff --git a/sources_non_forked/vim-snippets/UltiSnips/rust.snippets b/sources_non_forked/vim-snippets/UltiSnips/rust.snippets index 40e76055..482f78e4 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/rust.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/rust.snippets @@ -5,22 +5,22 @@ priority -50 snippet let "let variable declaration" b -let ${1:name}${2:: ${3:type}} = ${4}; +let ${1:name}${2:: ${3:type}} = $4; endsnippet snippet letm "let mut variable declaration" b -let mut ${1:name}${2:: ${3:type}} = ${4}; +let mut ${1:name}${2:: ${3:type}} = $4; endsnippet snippet fn "A function, optionally with arguments and return type." -fn ${1:function_name}(${2})${3/..*/ -> /}${3} { - ${VISUAL}${0} +fn ${1:function_name}($2)${3/..*/ -> /}$3 { + ${VISUAL}$0 } endsnippet snippet pfn "A public function, optionally with arguments and return type." -pub fn ${1:function_name}(${2})${3/..*/ -> /}${3} { - ${VISUAL}${0} +pub fn ${1:function_name}($2)${3/..*/ -> /}$3 { + ${VISUAL}$0 } endsnippet @@ -29,44 +29,44 @@ ${1:a}: ${2:T}${3:, arg} endsnippet snippet || "Closure, anonymous function (inline)" i -${1:move }|${2}| { $3 } +${1:move }|$2| { $3 } endsnippet snippet |} "Closure, anonymous function (block)" i -${1:move }|${2}| { +${1:move }|$2| { $3 } endsnippet snippet pri "print!(..)" b -print!("${1}"${2/..*/, /}${2}); +print!("$1"${2/..*/, /}$2); endsnippet snippet pln "println!(..)" b -println!("${1}"${2/..*/, /}${2}); +println!("$1"${2/..*/, /}$2); endsnippet snippet fmt "format!(..)" -format!("${1}"${2/..*/, /}${2}); +format!("$1"${2/..*/, /}$2); endsnippet snippet macro "macro_rules!" b macro_rules! ${1:name} { (${2:matcher}) => ( - ${3} + $3 ) } endsnippet snippet mod "A module" b mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} { - ${VISUAL}${0} + ${VISUAL}$0 } endsnippet snippet for "for .. in .." b -for ${1:i} in ${2} { - ${VISUAL}${0} +for ${1:i} in $2 { + ${VISUAL}$0 } endsnippet @@ -76,19 +76,19 @@ endsnippet snippet st "Struct" b struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} { - ${VISUAL}${0} + ${VISUAL}$0 } endsnippet # TODO: fancy dynamic field mirroring like Python slotclass snippet stn "Struct with new constructor." b pub struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} { - fd${0} + fd$0 } impl $1 { - pub fn new(${2}) -> $1 { - $1 { ${3} } + pub fn new($2) -> $1 { + $1 { $3 } } } endsnippet @@ -99,7 +99,7 @@ endsnippet snippet impl "Struct/Trait implementation" b impl ${1:Type/Trait}${2: for ${3:Type}} { - ${0} + $0 } endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/supercollider.snippets b/sources_non_forked/vim-snippets/UltiSnips/supercollider.snippets index b8538aa9..3fe8e53f 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/supercollider.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/supercollider.snippets @@ -5,6 +5,6 @@ for (${1:1}, ${2:10}) {${3: |i}|} endsnippet snippet sdef SynthDef(\\${1:synthName}, {${2: |${3:x}|} - ${0} + $0 }).add; endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/tcl.snippets b/sources_non_forked/vim-snippets/UltiSnips/tcl.snippets index 65849157..739098be 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/tcl.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/tcl.snippets @@ -5,21 +5,21 @@ priority -50 ########################################################################### snippet for "for... (for)" b for {${1:set i 0}} {${2:\$i < \$n}} {${3:incr i}} { - ${4} + $4 } endsnippet snippet foreach "foreach... (foreach)" foreach ${1:var} ${2:\$list} { - ${3} + $3 } endsnippet snippet if "if... (if)" b if {${1:condition}} { - ${2} + $2 } endsnippet @@ -27,7 +27,7 @@ endsnippet snippet proc "proc... (proc)" b proc ${1:name} {${2:args}} \ { - ${3} + $3 } endsnippet @@ -35,16 +35,16 @@ endsnippet snippet switch "switch... (switch)" b switch ${1:-exact} -- ${2:\$var} { ${3:match} { - ${4} + $4 } - default {${5}} + default {$5} } endsnippet snippet while "while... (while)" b while {${1:condition}} { - ${2} + $2 } endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/tex.snippets b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets index f43de5ee..9957b3f7 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/tex.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets @@ -53,7 +53,7 @@ snippet desc "Description" b endsnippet snippet it "Individual item" b -\item ${1} +\item $1 $0 endsnippet @@ -61,54 +61,54 @@ snippet part "Part" b \part{${1:part name}} \label{prt:${2:${1/(\w+)|\W+/(?1:\L$0\E:_)/ga}}} -${0} +$0 endsnippet snippet cha "Chapter" b \chapter{${1:chapter name}} \label{cha:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} -${0} +$0 endsnippet snippet sec "Section" b \section{${1:section name}} \label{sec:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} -${0} +$0 endsnippet snippet sub "Subsection" b \subsection{${1:subsection name}} \label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} -${0} +$0 endsnippet snippet ssub "Subsubsection" b \subsubsection{${1:subsubsection name}} \label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} -${0} +$0 endsnippet snippet par "Paragraph" b \paragraph{${1:paragraph name}} \label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} -${0} +$0 endsnippet snippet subp "Subparagraph" b \subparagraph{${1:subparagraph name}} \label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} -${0} +$0 endsnippet snippet ni "Non-indented paragraph" b \noindent -${0} +$0 endsnippet snippet pac "Package" b diff --git a/sources_non_forked/vim-snippets/UltiSnips/vim.snippets b/sources_non_forked/vim-snippets/UltiSnips/vim.snippets index dbb2396d..65a18973 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/vim.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/vim.snippets @@ -13,11 +13,11 @@ snippet guard "script reload guard" b if exists('${1:did_`!p snip.rv = snip.fn.replace('.','_')`}') || &cp${2: || version < 700} finish endif -let $1 = 1${3} +let $1 = 1$3 endsnippet snippet f "function" b -fun ${1:function_name}(${2}) +fun ${1:function_name}($2) ${3:" code} endf endsnippet diff --git a/sources_non_forked/vim-snippets/snippets/actionscript.snippets b/sources_non_forked/vim-snippets/snippets/actionscript.snippets index b7aa7cb3..5d744390 100644 --- a/sources_non_forked/vim-snippets/snippets/actionscript.snippets +++ b/sources_non_forked/vim-snippets/snippets/actionscript.snippets @@ -96,7 +96,7 @@ snippet interface } snippet try try { - ${1} + ${1:${VISUAL}} } catch (error:ErrorType) { ${2} } finally { @@ -115,11 +115,11 @@ snippet forr # If Condition snippet if if (${1:/* condition */}) { - ${0} + ${0:${VISUAL}} } snippet el else { - ${0} + ${0:${VISUAL}} } # Ternary conditional snippet t diff --git a/sources_non_forked/vim-snippets/snippets/ada.snippets b/sources_non_forked/vim-snippets/snippets/ada.snippets index 1039946f..c0ed2801 100644 --- a/sources_non_forked/vim-snippets/snippets/ada.snippets +++ b/sources_non_forked/vim-snippets/snippets/ada.snippets @@ -90,19 +90,19 @@ snippet fors for some snippet if if if ${1} then - ${0} + ${0:${VISUAL}} end if; snippet ife if ... else if ${1} then - ${2} + ${2:${VISUAL}} else ${0} end if; snippet el else else - ${0} + ${0:${VISUAL}} snippet eif elsif elsif ${1} then @@ -110,13 +110,13 @@ snippet eif elsif snippet wh while while ${1} loop - ${0} + ${0:${VISUAL}} end loop; snippet nwh named while ${1}: while ${2} loop - ${0} + ${0:${VISUAL}} end loop $1; snippet for for diff --git a/sources_non_forked/vim-snippets/snippets/apache.snippets b/sources_non_forked/vim-snippets/snippets/apache.snippets index db3256e9..de5672c2 100644 --- a/sources_non_forked/vim-snippets/snippets/apache.snippets +++ b/sources_non_forked/vim-snippets/snippets/apache.snippets @@ -9,22 +9,22 @@ snippet dir # snippet filesmatch - ${0} + ${0:${VISUAL}} # snippet ifmodule - ${0} + ${0:${VISUAL}} # snippet limitexcept - ${0} + ${0:${VISUAL}} # snippet proxy - ${0} + ${0:${VISUAL}} # snippet virtualhost diff --git a/sources_non_forked/vim-snippets/snippets/arduino.snippets b/sources_non_forked/vim-snippets/snippets/arduino.snippets index 6f7f4137..a2732a5e 100644 --- a/sources_non_forked/vim-snippets/snippets/arduino.snippets +++ b/sources_non_forked/vim-snippets/snippets/arduino.snippets @@ -20,7 +20,7 @@ snippet def # if snippet if if (${1:/* condition */}) { - ${2} + ${0:${VISUAL}} } # else snippet el diff --git a/sources_non_forked/vim-snippets/snippets/awk.snippets b/sources_non_forked/vim-snippets/snippets/awk.snippets index 32e56f2f..5c94734a 100644 --- a/sources_non_forked/vim-snippets/snippets/awk.snippets +++ b/sources_non_forked/vim-snippets/snippets/awk.snippets @@ -43,12 +43,12 @@ snippet ign IGNORECASE snippet if if {...} if (${1}) { - ${0} + ${0:${VISUAL}} } snippet ife if ... else ... if (${1}) { - ${2} + ${2:${VISUAL}} } else { ${0} } diff --git a/sources_non_forked/vim-snippets/snippets/c.snippets b/sources_non_forked/vim-snippets/snippets/c.snippets index 524b5b86..ea744d54 100644 --- a/sources_non_forked/vim-snippets/snippets/c.snippets +++ b/sources_non_forked/vim-snippets/snippets/c.snippets @@ -37,7 +37,7 @@ snippet ifdef # if snippet #if #if ${1:FOO} - ${0} + ${0:${VISUAL}} #endif # header include guard snippet once @@ -53,23 +53,23 @@ snippet once # if snippet if if (${1:true}) { - ${0} + ${0:${VISUAL}} } snippet ife if (${1:true}) { - ${2} + ${2:${VISUAL}} } else { ${0} } # else snippet el else { - ${0} + ${0:${VISUAL}} } # else if snippet elif else if (${1:true}) { - ${0} + ${0:${VISUAL}} } # ifi snippet ifi @@ -115,12 +115,12 @@ snippet forr # while snippet wh while (${1:/* condition */}) { - ${2} + ${0:${VISUAL}} } # do... while snippet do do { - ${2} + ${0:${VISUAL}} } while (${1:/* condition */}); ## ## Functions diff --git a/sources_non_forked/vim-snippets/snippets/coffee/coffee.snippets b/sources_non_forked/vim-snippets/snippets/coffee/coffee.snippets index bb964346..f23156cc 100644 --- a/sources_non_forked/vim-snippets/snippets/coffee/coffee.snippets +++ b/sources_non_forked/vim-snippets/snippets/coffee/coffee.snippets @@ -55,17 +55,17 @@ snippet cla class .. extends .. constructor: .. # If snippet if if ${1:condition} - ${0:# body...} + ${0:${VISUAL}} # If __ Else snippet ife if ${1:condition} - ${2:# body...} + ${2:${VISUAL}} else ${0:# body...} # Else if snippet eif else if ${1:condition} - ${0:# body...} + ${0:${VISUAL}} # Ternary If snippet ifte if ${1:condition} then ${2:value} else ${0:other} @@ -84,7 +84,7 @@ snippet log # Try __ Catch snippet try try - ${1} + ${1:${VISUAL}} catch ${2:error} ${0} # Require diff --git a/sources_non_forked/vim-snippets/snippets/crystal.snippets b/sources_non_forked/vim-snippets/snippets/crystal.snippets new file mode 100644 index 00000000..34d25406 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/crystal.snippets @@ -0,0 +1,82 @@ +snippet req require + require "${1}" +snippet case + case ${1:object} + when ${2:condition} + ${0} + end +snippet when + when ${1:condition} + ${0} +snippet def + def ${1:method_name} + ${0} + end +snippet pdef + private def ${1:method_name} + ${0} + end +snippet if + if ${1:condition} + ${0:${VISUAL}} + end +snippet ife + if ${1:condition} + ${2:${VISUAL}} + else + ${0} + end +snippet wh + while ${1:condition} + ${0:${VISUAL}} + end +snippet cla class .. end + class ${1:`substitute(vim_snippets#Filename(), "\(_\|^\)\(.\)", "\u\2", "g")`} + ${0} + end +snippet mod class .. end + module ${1:`substitute(vim_snippets#Filename(), "\(_\|^\)\(.\)", "\u\2", "g")`} + ${0} + end +snippet r + getter ${0:name} +snippet r! + getter! ${0:name} +snippet r? + getter? ${0:name} +snippet w + setter ${0:name} +snippet w! + setter! ${0:name} +snippet w? + setter? ${0:name} +snippet rw + property ${0:name} +snippet rw! + property! ${0:name} +snippet rw? + property? ${0:name} +snippet defs + def self.${1:class_method_name} + ${0} + end +snippet defi + def initialize(${1}) + ${0} + end +snippet do + do + ${0:${VISUAL}} + end +snippet dov + do |${1:v}| + ${2} + end +snippet desc + describe ${1:`substitute(substitute(vim_snippets#Filename(), "_spec$", "", ""), "\(_\|^\)\(.\)", "\u\2", "g")`} do + ${0} + end +snippet it + it "${1}" do + ${0} + end diff --git a/sources_non_forked/vim-snippets/snippets/cs.snippets b/sources_non_forked/vim-snippets/snippets/cs.snippets index 40e9c8f9..391984bb 100644 --- a/sources_non_forked/vim-snippets/snippets/cs.snippets +++ b/sources_non_forked/vim-snippets/snippets/cs.snippets @@ -76,15 +76,15 @@ snippet svm # if condition snippet if if (${1:true}) { - ${0} + ${0:${VISUAL}} } snippet el else { - ${0} + ${0:${VISUAL}} } snippet ifs if (${1}) - ${0} + ${0:${VISUAL}} # ternary conditional snippet t ${1} ? ${2} : ${0} @@ -93,12 +93,12 @@ snippet ? # do while loop snippet do do { - ${0} + ${0:${VISUAL}} } while (${1:true}); # while loop snippet wh while (${1:true}) { - ${0} + ${0:${VISUAL}} } # for loop snippet for @@ -451,14 +451,14 @@ snippet switch # try snippet try try { - ${0} + ${0:${VISUAL}} } catch (${1:System.Exception}) { throw; } snippet tryf try { - ${0} + ${0:${VISUAL}} } finally { ${1} diff --git a/sources_non_forked/vim-snippets/snippets/css.snippets b/sources_non_forked/vim-snippets/snippets/css.snippets index c4a74dec..08b6cdf3 100644 --- a/sources_non_forked/vim-snippets/snippets/css.snippets +++ b/sources_non_forked/vim-snippets/snippets/css.snippets @@ -1,8 +1,8 @@ -snippet . +snippet . "selector { }" ${1} { - ${0} + ${0:${VISUAL}} } -snippet ! +snippet ! "!important" !important snippet bdi:m+ -moz-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch}; @@ -31,9 +31,9 @@ snippet @f } snippet @i @import url(${0}); -snippet @m +snippet @m "@media mediatype { }" @media ${1:print} { - ${0} + ${0:${VISUAL}} } snippet bg+ background: #${1:FFF} url(${2}) ${3:0} ${4:0} ${0:no-repeat}; diff --git a/sources_non_forked/vim-snippets/snippets/d.snippets b/sources_non_forked/vim-snippets/snippets/d.snippets index 216a4d89..e32a2998 100644 --- a/sources_non_forked/vim-snippets/snippets/d.snippets +++ b/sources_non_forked/vim-snippets/snippets/d.snippets @@ -88,13 +88,13 @@ snippet fsw } snippet try try { - ${1} + ${1:${VISUAL}} } catch(${2:Exception} ${3:e}) { ${4} } snippet tcf try { - ${0} + ${0:${VISUAL}} } catch(${1:Exception} ${2:e}) { ${3} } finally { @@ -102,7 +102,7 @@ snippet tcf } snippet wh while(${1:cond}) { - ${0} + ${0:${VISUAL}} } snippet dowh do { diff --git a/sources_non_forked/vim-snippets/snippets/dart.snippets b/sources_non_forked/vim-snippets/snippets/dart.snippets index 0093f2bf..78625c6c 100644 --- a/sources_non_forked/vim-snippets/snippets/dart.snippets +++ b/sources_non_forked/vim-snippets/snippets/dart.snippets @@ -71,12 +71,12 @@ snippet as assert(${0:/* condition */}); snippet try try { - ${0} + ${0:${VISUAL}} } catch (${1:Exception e}) { } snippet tryf try { - ${0} + ${0:${VISUAL}} } catch (${1:Exception e}) { } finally { } diff --git a/sources_non_forked/vim-snippets/snippets/eelixir.snippets b/sources_non_forked/vim-snippets/snippets/eelixir.snippets index 3d6e33d4..6286cee4 100644 --- a/sources_non_forked/vim-snippets/snippets/eelixir.snippets +++ b/sources_non_forked/vim-snippets/snippets/eelixir.snippets @@ -12,11 +12,11 @@ snippet for <% end %> snippet if <%= if ${1} do %> - ${0} + ${0:${VISUAL}} <% end %> snippet ife <%= if ${1} do %> - ${2} + ${2:${VISUAL}} <%= else %> ${0} <% end %> diff --git a/sources_non_forked/vim-snippets/snippets/elixir.snippets b/sources_non_forked/vim-snippets/snippets/elixir.snippets index 058f986c..ccc5fb73 100644 --- a/sources_non_forked/vim-snippets/snippets/elixir.snippets +++ b/sources_non_forked/vim-snippets/snippets/elixir.snippets @@ -1,16 +1,16 @@ snippet do do - ${0} + ${0:${VISUAL}} end snippet if if .. do .. end if ${1} do - ${0} + ${0:${VISUAL}} end snippet if: if .. do: .. if ${1:condition}, do: ${0} snippet ife if .. do .. else .. end if ${1:condition} do - ${2} + ${2:${VISUAL}} else ${0} end @@ -18,13 +18,13 @@ snippet ife: if .. do: .. else: if ${1:condition}, do: ${2}, else: ${0} snippet unless unless .. do .. end unless ${1} do - ${0} + ${0:${VISUAL}} end snippet unless: unless .. do: .. unless ${1:condition}, do: ${0} snippet unlesse unless .. do .. else .. end unless ${1:condition} do - ${2} + ${2:${VISUAL}} else ${0} end @@ -33,7 +33,7 @@ snippet unlesse: unless .. do: .. else: snippet cond cond do ${1} -> - ${0} + ${0:${VISUAL}} end snippet case case ${1} do @@ -143,7 +143,7 @@ snippet exunit end snippet try try .. rescue .. end try do - ${1} + ${1:${VISUAL}} rescue ${2} -> ${0} end diff --git a/sources_non_forked/vim-snippets/snippets/elm.snippets b/sources_non_forked/vim-snippets/snippets/elm.snippets index 6a15c83a..7898d5f3 100644 --- a/sources_non_forked/vim-snippets/snippets/elm.snippets +++ b/sources_non_forked/vim-snippets/snippets/elm.snippets @@ -39,7 +39,7 @@ snippet let ${0} snippet if if ${1} then - ${2} + ${2:${VISUAL}} else ${0} snippet ty diff --git a/sources_non_forked/vim-snippets/snippets/erlang.snippets b/sources_non_forked/vim-snippets/snippets/erlang.snippets index 5440d7c4..bd379f3d 100644 --- a/sources_non_forked/vim-snippets/snippets/erlang.snippets +++ b/sources_non_forked/vim-snippets/snippets/erlang.snippets @@ -46,7 +46,7 @@ snippet fun # try...catch snippet try try - ${1} + ${1:${VISUAL}} catch ${2:_:_} -> ${0:got_some_exception} end diff --git a/sources_non_forked/vim-snippets/snippets/eruby.snippets b/sources_non_forked/vim-snippets/snippets/eruby.snippets index 64f79ef3..b8879c5c 100644 --- a/sources_non_forked/vim-snippets/snippets/eruby.snippets +++ b/sources_non_forked/vim-snippets/snippets/eruby.snippets @@ -120,7 +120,7 @@ snippet sslt <%= stylesheet_link_tag "${0}" %> snippet if <% if ${1} %> - ${0} + ${0:${VISUAL}} <% end %> snippet ife <% if ${1} %> diff --git a/sources_non_forked/vim-snippets/snippets/go.snippets b/sources_non_forked/vim-snippets/snippets/go.snippets index b2bdc9e0..05d80c9b 100644 --- a/sources_non_forked/vim-snippets/snippets/go.snippets +++ b/sources_non_forked/vim-snippets/snippets/go.snippets @@ -30,7 +30,7 @@ snippet ch # case snippet cs case ${1:value}: - ${0} + ${0:${VISUAL}} # const snippet c const ${1:NAME} = ${0:0} @@ -50,7 +50,7 @@ snippet df snippet dfr defer func() { if err := recover(); err != nil { - ${0} + ${0:${VISUAL}} } }() # int @@ -72,18 +72,18 @@ snippet inf # if condition snippet if if ${1:/* condition */} { - ${2} + ${2:${VISUAL}} } snippet ife if ${1:/* condition */} { - ${2} + ${2:${VISUAL}} } else { ${0} } # else snippet snippet el else { - ${1} + ${0:${VISUAL}} } # error snippet snippet ir @@ -106,28 +106,20 @@ snippet f3 # float64 snippet f6 float64 -# if else -snippet ie - if ${1:/* condition */} { - ${2} - } else { - ${3} - } - ${0} # for int loop snippet for for ${1}{ - ${0} + ${0:${VISUAL}} } # for int loop snippet fori for ${2:i} := 0; $2 < ${1:count}; $2${3:++} { - ${0} + ${0:${VISUAL}} } # for range loop snippet forr for ${1:e} := range ${2:collection} { - ${0} + ${0:${VISUAL}} } # function simple snippet fun @@ -225,9 +217,8 @@ snippet ga }(${0}) snippet test test function func Test${1:name}(t *testing.T) { - ${2} + ${0:${VISUAL}} } - ${0} snippet bench benchmark function func Benchmark${1:name}(b *testing.B) { for i := 0; i < b.N; i++ { diff --git a/sources_non_forked/vim-snippets/snippets/haml.snippets b/sources_non_forked/vim-snippets/snippets/haml.snippets index 09217c6c..b8a74e27 100644 --- a/sources_non_forked/vim-snippets/snippets/haml.snippets +++ b/sources_non_forked/vim-snippets/snippets/haml.snippets @@ -27,11 +27,11 @@ snippet mts = mail_to ${1:email_address}, ${2:name}, :subject => ${3}, :body => ${4} snippet ife - if ${1:condition} - ${2} + ${2:${VISUAL}} - else ${0} snippet ifp - if ${1:condition}.presence? - ${0} + ${0:${VISUAL}} snippet ntc = number_to_currency(${1}) diff --git a/sources_non_forked/vim-snippets/snippets/handlebars.snippets b/sources_non_forked/vim-snippets/snippets/handlebars.snippets index d1ab0f03..401dfbdd 100644 --- a/sources_non_forked/vim-snippets/snippets/handlebars.snippets +++ b/sources_non_forked/vim-snippets/snippets/handlebars.snippets @@ -1,14 +1,14 @@ snippet if # {{#if value}} ... {{/if}} {{#if ${1:value}}} - ${0} + ${0:${VISUAL}} {{/if}} snippet ifn # {{#unless value}} ... {{/unless}} {{#unless ${1:value}}} - ${0} + ${0:${VISUAL}} {{/unless}} snippet ife # {{#if value}} ... {{else}} .. {{/if}} {{#if ${1:value}}} - ${2} + ${2:${VISUAL}} {{else}} ${3} {{/if}} diff --git a/sources_non_forked/vim-snippets/snippets/html.snippets b/sources_non_forked/vim-snippets/snippets/html.snippets index 85d0e526..e91b0716 100644 --- a/sources_non_forked/vim-snippets/snippets/html.snippets +++ b/sources_non_forked/vim-snippets/snippets/html.snippets @@ -733,7 +733,7 @@ snippet samp ${0} snippet script - snippet scripts @@ -743,7 +743,7 @@ snippet scriptt ${0} snippet scriptsrc - + snippet section

${0} diff --git a/sources_non_forked/vim-snippets/snippets/htmltornado.snippets b/sources_non_forked/vim-snippets/snippets/htmltornado.snippets index 46f5dab4..1620e11d 100644 --- a/sources_non_forked/vim-snippets/snippets/htmltornado.snippets +++ b/sources_non_forked/vim-snippets/snippets/htmltornado.snippets @@ -43,7 +43,7 @@ snippet set {% set ${1:x} = ${0:y} %} snippet try {% try %} - ${1} + ${1:${VISUAL}} {% except %} ${2} {% finallly %} diff --git a/sources_non_forked/vim-snippets/snippets/java.snippets b/sources_non_forked/vim-snippets/snippets/java.snippets index 39cc850a..66821c16 100644 --- a/sources_non_forked/vim-snippets/snippets/java.snippets +++ b/sources_non_forked/vim-snippets/snippets/java.snippets @@ -163,12 +163,12 @@ snippet ths throws ${0} snippet try try { - ${0} + ${0:${VISUAL}} } catch(${1:Exception} ${2:e}) { } snippet tryf try { - ${0} + ${0:${VISUAL}} } catch(${1:Exception} ${2:e}) { } finally { } diff --git a/sources_non_forked/vim-snippets/snippets/javascript-mocha.snippets b/sources_non_forked/vim-snippets/snippets/javascript-mocha.snippets index cabfd401..eb5c381d 100644 --- a/sources_non_forked/vim-snippets/snippets/javascript-mocha.snippets +++ b/sources_non_forked/vim-snippets/snippets/javascript-mocha.snippets @@ -1,18 +1,34 @@ -snippet des "Describe" b +snippet des "describe('thing', () => { ... })" b describe('${1:}', () => { - ${0} + ${0:${VISUAL}} }); -snippet it "it" b +snippet it "it('should do', () => { ... })" b it('${1:}', () => { - ${0} + ${0:${VISUAL}} }); -snippet xit "xit" b +snippet xit "xit('should do', () => { ... })" b xit('${1:}', () => { - ${0} + ${0:${VISUAL}} }); -snippet exp "expect" b +snippet bef "before(() => { ... })" b + before(() => { + ${0:${VISUAL}} + }); +snippet befe "beforeEach(() => { ... })" b + beforeEach(() => { + ${0:${VISUAL}} + }); +snippet aft "after(() => { ... })" b + after(() => { + ${0:${VISUAL}} + }); +snippet afte "afterEach(() => { ... })" b + afterEach(() => { + ${0:${VISUAL}} + }); +snippet exp "expect(...)" b expect(${1:})${0}; -snippet expe "expect" b +snippet expe "expect(...).to.equal(...)" b expect(${1:}).to.equal(${0}); -snippet expd "expect" b +snippet expd "expect(...).to.deep.equal(...)" b expect(${1:}).to.deep.equal(${0}); diff --git a/sources_non_forked/vim-snippets/snippets/javascript.es6.react.snippets b/sources_non_forked/vim-snippets/snippets/javascript.es6.react.snippets index 0762eb6b..2894ac5d 100644 --- a/sources_non_forked/vim-snippets/snippets/javascript.es6.react.snippets +++ b/sources_non_forked/vim-snippets/snippets/javascript.es6.react.snippets @@ -61,7 +61,7 @@ snippet rdp # Lifecycle Methods snippet rcdm componentDidMount() { - ${0} + ${0:${VISUAL}} } # State diff --git a/sources_non_forked/vim-snippets/snippets/javascript/javascript.es6.snippets b/sources_non_forked/vim-snippets/snippets/javascript/javascript.es6.snippets index a1adedef..7e885e6e 100644 --- a/sources_non_forked/vim-snippets/snippets/javascript/javascript.es6.snippets +++ b/sources_non_forked/vim-snippets/snippets/javascript/javascript.es6.snippets @@ -10,16 +10,16 @@ snippet imm "import { member } from 'xyz'" import { ${1} } from '${2}'; snippet cla class ${1} { - ${0} + ${0:${VISUAL}} } snippet clax class ${1} extends ${2} { - ${0} + ${0:${VISUAL}} } snippet clac class ${1} { constructor(${2}) { - ${0} + ${0:${VISUAL}} } } snippet foro "for (const prop of object}) { ... }" @@ -29,23 +29,23 @@ snippet foro "for (const prop of object}) { ... }" # Generator snippet fun* function* ${1:function_name}(${2}) { - ${0} + ${0:${VISUAL}} } snippet c=> const ${1:function_name} = (${2}) => { - ${0} + ${0:${VISUAL}} } snippet caf const ${1:function_name} = (${2}) => { - ${0} + ${0:${VISUAL}} } snippet => (${1}) => { - ${0} + ${0:${VISUAL}} } snippet af (${1}) => { - ${0} + ${0:${VISUAL}} } snippet sym const ${1} = Symbol('${0}'); diff --git a/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets b/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets index 0ac0bfb4..df0669bd 100644 --- a/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets +++ b/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets @@ -2,37 +2,37 @@ # prototype snippet proto ${1:class_name}.prototype.${2:method_name} = function(${3}) { - ${0} + ${0:${VISUAL}} }; # Function snippet fun function ${1:function_name}(${2}) { - ${0} + ${0:${VISUAL}} } # Anonymous Function snippet f "" w function(${1}) { - ${0} + ${0:${VISUAL}} } # Anonymous Function assigned to variable snippet vaf var ${1:function_name} = function(${2}) { - ${0} + ${0:${VISUAL}} }; # Function assigned to variable snippet vf var ${1:function_name} = function $1(${2}) { - ${0} + ${0:${VISUAL}} }; # Immediate function snippet (f (function(${1}) { - ${0} + ${0:${VISUAL}} }(${2})); # Minify safe iife snippet ;fe ;(function(${1}) { - ${0} + ${0:${VISUAL}} }(${2})) # self-defining function snippet sdf @@ -40,21 +40,21 @@ snippet sdf ${3} $1 = function ($2) { - ${0} + ${0:${VISUAL}} }; }; # Flow control # if -snippet if +snippet if "if (condition) { ... }" if (${1:true}) { - ${0} + ${0:${VISUAL}} } # if ... else -snippet ife +snippet ife "if (condition) { ... } else { ... }" if (${1:true}) { - ${2} + ${0:${VISUAL}} } else { - ${0} + ${2} } # tertiary conditional snippet ter @@ -69,25 +69,21 @@ snippet switch default: ${2} } -# case -snippet case +snippet case "case 'xyz': ... break" case '${1:case}': - ${2} + ${0:${VISUAL}} break; - ${0} -# try -snippet try +snippet try "try { ... } catch(e) { ... }" try { - ${1} - } catch (${2:e}) { - ${0:/* handle error */} + ${0:${VISUAL}} + } catch (${1:e}) { + ${2:/* handle error */} } -# try finally -snippet tryf +snippet tryf "try { ... } catch(e) { ... } finally { ... }" try { - ${1} - } catch (${2:e}) { - ${0:/* handle error */} + ${0:${VISUAL}} + } catch (${1:e}) { + ${2:/* handle error */} } finally { ${3:/* be executed regardless of the try / catch result*/} } @@ -97,25 +93,21 @@ snippet terr # return snippet ret return ${0:result}; -# for loop -snippet for - for (var ${2:i} = 0, l = ${1:arr}.length; $2 < l; $2++) { - var ${3:v} = $1[$2];${0:} +snippet for "for (...) {...}" + for (var ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) { + ${0:${VISUAL}} } -# Reversed for loop -snippet forr - for (var ${2:i} = ${1:arr}.length - 1; $2 >= 0; $2--) { - var ${3:v} = $1[$2];${0:} +snippet forr "reversed for (...) {...}" + for (var ${2:i} = ${1:Things.length} - 1; $2 >= 0; $2--) { + ${0:${VISUAL}} } -# While loop -snippet wh +snippet wh "(condition) { ... }" while (${1:/* condition */}) { - ${0} + ${0:${VISUAL}} } -# Do while loop -snippet do +snippet do "do { ... } while (condition)" do { - ${0} + ${0:${VISUAL}} } while (${1:/* condition */}); # For in loop snippet fori @@ -126,7 +118,7 @@ snippet fori # Object Method snippet :f ${1:method_name}: function (${2:attribute}) { - ${3} + ${0:${VISUAL}} }, # hasOwnProperty snippet has @@ -240,33 +232,46 @@ snippet qsa # Debugging snippet de debugger; -# console.log -snippet cl +snippet cl "console.log" console.log(${0}); -# console.debug -snippet cd +snippet cd "console.debug" console.debug(${0}); -# console.error -snippet ce +snippet ce "console.error" console.error(${0}); -# console.warn -snippet cw +snippet cw "console.warn" console.warn(${0}); -# console.info -snippet ci +snippet ci "console.info" console.info(${0}); -# console.trace -snippet ct +snippet ct "console.trace" console.trace(${0:label}); -# console.time -snippet ctime - console.time(${0:label}); -# console.assert -snippet ca +snippet ctime "console.time ... console.timeEnd" + console.time("${1:label}"); + ${0:${VISUAL}} + console.timeEnd("$1"); +snippet ctimestamp "console.timeStamp" + console.timeStamp("${1:label}"); +snippet ca "console.assert" console.assert(${1:expression}, ${0:obj}); -# console.dir -snippet cdir +snippet cclear "console.clear" + console.clear(); +snippet cdir "console.dir" console.dir(${0:obj}); +snippet cdirx "console.dirxml" + console.dirxml(${1:object}); +snippet cgroup "console.group" + console.group("${1:label}"); + ${0:${VISUAL}} + console.groupEnd(); +snippet cgroupc "console.groupCollapsed" + console.groupCollapsed("${1:label}"); + ${0:${VISUAL}} + console.groupEnd(); +snippet cprof "console.profile" + console.profile("${1:label}"); + ${0:${VISUAL}} + console.profileEnd(); +snippet ctable "console.table" + console.table(${1:"${2:value}"}); # Misc # 'use strict'; snippet us diff --git a/sources_non_forked/vim-snippets/snippets/julia.snippets b/sources_non_forked/vim-snippets/snippets/julia.snippets index 1876ed84..490d050d 100644 --- a/sources_non_forked/vim-snippets/snippets/julia.snippets +++ b/sources_non_forked/vim-snippets/snippets/julia.snippets @@ -75,7 +75,7 @@ snippet tern ternary operator # Exceptions snippet try try catch try - ${1} + ${1:${VISUAL}} catch ${2} ${0} end diff --git a/sources_non_forked/vim-snippets/snippets/ls.snippets b/sources_non_forked/vim-snippets/snippets/ls.snippets index 909b35ee..7c924e64 100644 --- a/sources_non_forked/vim-snippets/snippets/ls.snippets +++ b/sources_non_forked/vim-snippets/snippets/ls.snippets @@ -93,7 +93,7 @@ snippet str # Try __ Catch snippet try try - ${1} + ${1:${VISUAL}} catch ${2:error} ${3} # Require diff --git a/sources_non_forked/vim-snippets/snippets/make.snippets b/sources_non_forked/vim-snippets/snippets/make.snippets index 332d6fc9..9104804d 100644 --- a/sources_non_forked/vim-snippets/snippets/make.snippets +++ b/sources_non_forked/vim-snippets/snippets/make.snippets @@ -27,24 +27,24 @@ snippet print # ifeq snippet if ifeq (${1:cond0}, ${2:cond1}) - ${0} + ${0:${VISUAL}} endif # ifeq ... else ... endif snippet ife ifeq (${1:cond0}, ${2:cond1}) - ${3} + ${3:${VISUAL}} else ${0} endif # else ... snippet el else - ${0} + ${0:${VISUAL}} # .DEFAULT_GOAL := target snippet default .DEFAULT_GOAL := ${1} # help target for self-documented Makefile snippet help help: ## Prints help for targets with comments - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $\$1, $\$2}' + @cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $\$1, $\$2}' ${0} diff --git a/sources_non_forked/vim-snippets/snippets/mako.snippets b/sources_non_forked/vim-snippets/snippets/mako.snippets index 2264eac6..659caf77 100644 --- a/sources_non_forked/vim-snippets/snippets/mako.snippets +++ b/sources_non_forked/vim-snippets/snippets/mako.snippets @@ -30,7 +30,7 @@ snippet ife if/else % endif snippet try % try: - ${1:} + ${1:${VISUAL}} % except${2:}: ${0:pass} % endtry diff --git a/sources_non_forked/vim-snippets/snippets/mustache.snippets b/sources_non_forked/vim-snippets/snippets/mustache.snippets index ad8723ed..cf589406 100644 --- a/sources_non_forked/vim-snippets/snippets/mustache.snippets +++ b/sources_non_forked/vim-snippets/snippets/mustache.snippets @@ -1,14 +1,14 @@ snippet if # {{#value}} ... {{/value}} {{#${1:value}}} - ${0} + ${0:${VISUAL}} {{/$1}} snippet ifn # {{^value}} ... {{/value}} {{^${1:value}}} - ${0} + ${0:${VISUAL}} {{/$1}} snippet ife # {{#value}} ... {{/value}} {{^value}} ... {{/value}} {{#${1:value}}} - ${2} + ${2:${VISUAL}} {{/$1}} {{^$1}} ${3} diff --git a/sources_non_forked/vim-snippets/snippets/php.snippets b/sources_non_forked/vim-snippets/snippets/php.snippets index 2d9f5152..52572da9 100644 --- a/sources_non_forked/vim-snippets/snippets/php.snippets +++ b/sources_non_forked/vim-snippets/snippets/php.snippets @@ -1,7 +1,7 @@ snippet snippet ?f - ${0} + ${0:${VISUAL}} snippet ?i - ${0} + ${0:${VISUAL}} snippet ns namespace ${1:Foo\Bar\Baz}; - ${0} + + ${0:${VISUAL}} snippet c class ${1:`vim_snippets#Filename()`} { - ${0} + ${0:${VISUAL}} } snippet i interface ${1:`vim_snippets#Filename()`} { - ${0} + ${0:${VISUAL}} } snippet t. $this-> snippet f function ${1}(${3}) { - ${0} + ${0:${VISUAL}} } # method snippet m ${1:protected} function ${2:foo}() { - ${0} + ${0:${VISUAL}} } snippet sm "PHP Class Setter" /** @@ -158,7 +159,7 @@ snippet doc_c */ ${1:}class ${2:} { - ${0} + ${0:${VISUAL}} } // END $1class $2 # Constant Definition - post doc snippet doc_dp @@ -232,7 +233,7 @@ snippet interface */ interface ${1:`vim_snippets#Filename()`} { - ${0} + ${0:${VISUAL}} } # Trait snippet trait @@ -244,7 +245,7 @@ snippet trait */ trait ${1:`vim_snippets#Filename()`} { - ${0} + ${0:${VISUAL}} } # class ... snippet class @@ -267,7 +268,7 @@ snippet nc ${2:abstract }class ${3:`vim_snippets#Filename()`} { - ${0} + ${0:${VISUAL}} } # define(...) snippet def "define('VARIABLE_NAME', 'definition')" @@ -277,45 +278,43 @@ snippet def? ${1}defined('${2}') snippet wh "while (condition) { ... }" while (${1:/* condition */}) { - ${0} + ${0:${VISUAL}} } snippet do "do { ... } while (condition)" do { - ${0} + ${0:${VISUAL}} } while (${1}); snippet if "if (condition) { ... }" if (${1}) { - ${0} + ${0:${VISUAL}} } snippet ifn "if (!condition) { ... }" if (!${1}) { - ${2} + ${0:${VISUAL}} } snippet ifil " ... " - ${0} + ${0:${VISUAL}} snippet ife "if (cond) { ... } else { ... }" if (${1}) { - ${2} + ${0:${VISUAL}} } else { - ${3} + ${2} } - ${0} snippet ifeil " ... ... " - ${2} + ${0:${VISUAL}} - ${3} + ${2} - ${0} snippet el "else { ... }" else { - ${0} + ${0:${VISUAL}} } snippet eif "elseif(condition) { ... }" elseif (${1}) { - ${0} + ${0:${VISUAL}} } snippet switch "switch($var) { case 'xyz': ... default: .... }" switch ($${1:variable}) { @@ -329,23 +328,23 @@ snippet switch "switch($var) { case 'xyz': ... default: .... }" } snippet case "case 'value': ... break" case '${1:value}': - ${2} + ${0:${VISUAL}} break; snippet for "for ($i = 0; $i < $count; $i++) { ... }" for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { - ${0} + ${0:${VISUAL}} } snippet foreach "foreach ($var as $value) { .. }" foreach ($${1:variable} as $${2:value}) { - ${0} + ${0:${VISUAL}} } snippet foreachil " ... " - ${0} + ${0:${VISUAL}} snippet foreachk "foreach ($var as $key => $value) { .. }" foreach ($${1:variable} as $${2:key} => $${3:value}) { - ${0} + ${0:${VISUAL}} } snippet foreachkil " $value): ?> ... " $${3:value}): ?> @@ -355,7 +354,7 @@ snippet array "$... = ['' => ]" $${1:arrayName} = ['${2}' => ${3}]; snippet try "try { ... } catch (Exception $e) { ... }" try { - ${0} + ${0:${VISUAL}} } catch (${1:Exception} $e) { } # lambda with closure @@ -590,48 +589,70 @@ snippet CSVIterator } // end class # phpunit -snippet ase "$this->assertEquals()" - $this->assertEquals(${1:expected}, ${2:actual}); -snippet asne "$this->assertNotEquals()" - $this->assertNotEquals(${1:expected}, ${2:actual}); -snippet asf "$this->assertFalse()" +snippet ase "$this->assertEquals($a, $b)" + $this->assertEquals(${1:$expected}, ${2:$actual}); +snippet asne "$this->assertNotEquals($a, $b)" + $this->assertNotEquals(${1:$expected}, ${2:$actual}); +snippet asf "$this->assertFalse($a)" $this->assertFalse(${1}); -snippet ast "$this->assertTrue()" +snippet ast "$this->assertTrue($a)" $this->assertTrue(${1}); -snippet asfex "$this->assertFileExists()" +snippet asfex "$this->assertFileExists('path/to/file')" $this->assertFileExists(${1:'path/to/file'}); -snippet asfnex "$this->assertFileNotExists()" +snippet asfnex "$this->assertFileNotExists('path/to/file')" $this->assertFileNotExists(${1:'path/to/file'}); -snippet ascon "$this->assertContains()" +snippet ascon "$this->assertContains($needle, $haystack)" $this->assertContains(${1:$needle}, ${2:$haystack}); -snippet ashk "$this->assertArrayHasKey()" +snippet asncon "$this->assertNotContains($needle, $haystack)" + $this->assertNotContains(${1:$needle}, ${2:$haystack}); +snippet ascono "$this->assertContainsOnly($needle, $haystack)" + $this->assertContainsOnly(${1:$needle}, ${2:$haystack}); +snippet asconoi "$this->assertContainsOnlyInstancesOf(Example::class, $haystack)" + $this->assertContainsOnlyInstancesOf(${1:Example}::class, ${2:$haystack}); +snippet ashk "$this->assertArrayHasKey($key, $array)" $this->assertArrayHasKey(${1:$key}, ${2:$array}); -snippet asnhk "$this->assertArrayNotHasKey()" +snippet asnhk "$this->assertArrayNotHasKey($key, $array)" this->assertArrayNotHasKey(${1:$key}, ${2:$array}); -snippet ascha "$this->assertClassHasAttribute()" - $this->assertClassHasAttribute(${1:$attributeName}, '${2:$className}'); -snippet asi "$this->assertInstanceOf(...)" - $this->assertInstanceOf(${1:expected}, ${2:actual}); +snippet ascha "$this->assertClassHasAttribute($name, Example::class)" + $this->assertClassHasAttribute(${1:$attributeName}, ${2:Example}::class); +snippet asi "$this->assertInstanceOf(Example::class, $actual)" + $this->assertInstanceOf(${1:Example}::class, ${2:$actual}); +snippet ast "$this->assertInternalType('string', $actual)" + $this->assertInternalType(${1:'string'}, ${2:actual}); +snippet asco "$this->assertCount($count, $haystack)" + $this->assertCount(${1:$expectedCount}, ${2:$haystack}); +snippet asnco "$this->assertNotCount($count, $haystack)" + $this->assertNotCount(${1:$count}, ${2:$haystack}); +snippet assub "$this->assertArraySubset($subset, $array)" + $this->assertArraySubset(${1:$subset}, ${2:$array}); +snippet asnu "$this->assertNull($a)" + $this->assertNull(${1}); +snippet asnnu "$this->assertNotNull($a)" + $this->assertNotNull(${1}); snippet test "public function testXYZ() { ... }" public function test${1}() { - ${0} + ${0:${VISUAL}} } snippet setup "protected function setUp() { ... }" protected function setUp() { - ${0} + ${0:${VISUAL}} } snippet teardown "protected function tearDown() { ... }" protected function tearDown() { - ${0} + ${0:${VISUAL}} } +snippet proph "$observer = $this->prophesize(SomeClass::class);" + $${1:observer} = $this->prophesize(${2:SomeClass}::class); +snippet mock "$mock = $this->createMock(SomeClass::class);" + $${1:mock} = $this->createMock(${2:SomeClass}::class); snippet exp "phpunit expects" expects($this->${1:once}()) ->method('${2}') - ->with($this->equalTo(${3})${4}) - ->will($this->returnValue(${5})); + ->with(${3}) + ->willReturn(${4}); snippet testcmt "phpunit comment with group" /** * @group ${1} diff --git a/sources_non_forked/vim-snippets/snippets/processing.snippets b/sources_non_forked/vim-snippets/snippets/processing.snippets index 015af4a5..798e5458 100644 --- a/sources_non_forked/vim-snippets/snippets/processing.snippets +++ b/sources_non_forked/vim-snippets/snippets/processing.snippets @@ -93,13 +93,13 @@ snippet switch #try snippet try try { - ${0} + ${0:${VISUAL}} } catch(${1:Exception} ${2:e}) { } #try catch finally snippet tryf try { - ${0} + ${0:${VISUAL}} } catch(${1:Exception} ${2:e}) { } finally { } diff --git a/sources_non_forked/vim-snippets/snippets/python.snippets b/sources_non_forked/vim-snippets/snippets/python.snippets index 0f68acbd..b32ef0a8 100644 --- a/sources_non_forked/vim-snippets/snippets/python.snippets +++ b/sources_non_forked/vim-snippets/snippets/python.snippets @@ -23,7 +23,7 @@ snippet docs snippet wh while ${1:condition}: - ${0} + ${0:${VISUAL}} # dowh - does the same as do...while in other languages snippet dowh while True: @@ -32,7 +32,7 @@ snippet dowh break snippet with with ${1:expr} as ${2:var}: - ${0} + ${0:${VISUAL}} # New Class snippet cl class ${1:ClassName}(${2:object}): @@ -68,13 +68,13 @@ snippet property # Ifs snippet if if ${1:condition}: - ${0} + ${0:${VISUAL}} snippet el else: - ${0} + ${0:${VISUAL}} snippet ei elif ${1:condition}: - ${0} + ${0:${VISUAL}} # For snippet for for ${1:item} in ${2:items}: @@ -93,27 +93,27 @@ snippet . self. snippet try Try/Except try: - ${1} - except ${2:Exception}, ${3:e}: + ${1:${VISUAL}} + except ${2:Exception} as ${3:e}: ${0:raise $3} snippet try Try/Except/Else try: - ${1} - except ${2:Exception}, ${3:e}: + ${1:${VISUAL}} + except ${2:Exception} as ${3:e}: ${4:raise $3} else: ${0} snippet try Try/Except/Finally try: - ${1} - except ${2:Exception}, ${3:e}: + ${1:${VISUAL}} + except ${2:Exception} as ${3:e}: ${4:raise $3} finally: ${0} snippet try Try/Except/Else/Finally try: - ${1} - except ${2:Exception}, ${3:e}: + ${1:${VISUAL}} + except ${2:Exception} as ${3:e}: ${4:raise $3} else: ${5} diff --git a/sources_non_forked/vim-snippets/snippets/rst.snippets b/sources_non_forked/vim-snippets/snippets/rst.snippets index b1852458..dd47863e 100644 --- a/sources_non_forked/vim-snippets/snippets/rst.snippets +++ b/sources_non_forked/vim-snippets/snippets/rst.snippets @@ -85,9 +85,9 @@ snippet toc: ${0} snippet dow: - :download:`${0:text} <${1:path}>` + :download:\`${0:text} <${1:path}>\` snippet ref: - :ref:`${0:text} <${1:path}>` + :ref:\`${0:text} <${1:path}>\` snippet doc: :doc:`${0:text} <${1:path}>` # CJK optimize, CJK has no space between charaters diff --git a/sources_non_forked/vim-snippets/snippets/ruby.snippets b/sources_non_forked/vim-snippets/snippets/ruby.snippets index 772f4644..9dc984fd 100644 --- a/sources_non_forked/vim-snippets/snippets/ruby.snippets +++ b/sources_non_forked/vim-snippets/snippets/ruby.snippets @@ -39,7 +39,7 @@ snippet case end snippet when when ${1:condition} - ${0} + ${0:${VISUAL}} snippet def def ${1:method_name} ${0} @@ -56,17 +56,17 @@ snippet descendants end snippet if if ${1:condition} - ${0} + ${0:${VISUAL}} end snippet ife if ${1:condition} - ${2} + ${2:${VISUAL}} else ${0} end snippet eif elsif ${1:condition} - ${0} + ${0:${VISUAL}} snippet ifee if ${1:condition} $2 @@ -77,7 +77,7 @@ snippet ifee end snippet unless unless ${1:condition} - ${0} + ${0:${VISUAL}} end snippet unlesse unless ${1:condition} @@ -95,7 +95,7 @@ snippet unlesee end snippet wh while ${1:condition} - ${0} + ${0:${VISUAL}} end snippet for for ${1:e} in ${2:c} @@ -103,7 +103,7 @@ snippet for end snippet until until ${1:condition} - ${0} + ${0:${VISUAL}} end snippet cla class .. end class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} diff --git a/sources_non_forked/vim-snippets/snippets/rust.snippets b/sources_non_forked/vim-snippets/snippets/rust.snippets index 20532f73..2a353e49 100644 --- a/sources_non_forked/vim-snippets/snippets/rust.snippets +++ b/sources_non_forked/vim-snippets/snippets/rust.snippets @@ -32,7 +32,7 @@ snippet main "Main function" ${0} } snippet let "let variable declaration with type inference" - let ${1} = ${2}; + let ${1} = ${2}; snippet lett "let variable declaration with explicit type annotation" let ${1}: ${2} = ${3}; snippet letm "let mut variable declaration with type inference" @@ -88,21 +88,21 @@ snippet res "Result" # Control structures snippet if if ${1} { - ${0} + ${0:${VISUAL}} } snippet ife "if / else" if ${1} { - ${2} + ${2:${VISUAL}} } else { ${0} } snippet el "else" else { - ${0} + ${0:${VISUAL}} } snippet eli "else if" else if ${1} { - ${0} + ${0:${VISUAL}} } snippet mat "match pattern" match ${1} { @@ -112,11 +112,11 @@ snippet case "Case clause of pattern match" ${1:_} => ${2:expression} snippet loop "loop {}" b loop { - ${0} + ${0:${VISUAL}} } snippet wh "while loop" while ${1:condition} { - ${0} + ${0:${VISUAL}} } snippet for "for ... in ... loop" for ${1:i} in ${2} { diff --git a/sources_non_forked/vim-snippets/snippets/sass.snippets b/sources_non_forked/vim-snippets/snippets/sass.snippets index 7207360c..3e84c20e 100644 --- a/sources_non_forked/vim-snippets/snippets/sass.snippets +++ b/sources_non_forked/vim-snippets/snippets/sass.snippets @@ -1,14 +1,12 @@ -extends css - snippet $ $${1:variable}: ${0:value} snippet imp @import '${0}' snippet mix - @mixin ${1:name}(${2}) + =${1:name}(${2}) ${0} snippet inc - @include ${1:mixin}(${2}) + +${1:mixin}(${2}) snippet ext @extend ${0} snippet fun @@ -16,15 +14,15 @@ snippet fun ${0} snippet if @if ${1:condition} - ${0} + ${0:${VISUAL}} snippet ife @if ${1:condition} - ${2} + ${2:${VISUAL}} @else ${0} snippet eif @else if ${1:condition} - ${0} + ${0:${VISUAL}} snippet for @for ${1:$i} from ${2:1} through ${3:3} ${0} @@ -33,4 +31,985 @@ snippet each ${0} snippet while @while ${1:$i} ${2:>} ${3:0} + ${0:${VISUAL}} +snippet ! + !important +snippet bdi:m+ + -moz-border-image: url('${1}') ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch} +snippet bdi:m + -moz-border-image: ${0} +snippet bdrz:m + -moz-border-radius: ${0} +snippet bxsh:m+ + -moz-box-shadow: ${1:0} ${2:0} ${3:0} #${0:000} +snippet bxsh:m + -moz-box-shadow: ${0} +snippet bdi:w+ + -webkit-border-image: url('${1}') ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch} +snippet bdi:w + -webkit-border-image: ${0} +snippet bdrz:w + -webkit-border-radius: ${0} +snippet bxsh:w+ + -webkit-box-shadow: ${1:0} ${2:0} ${3:0} #${0:000} +snippet bxsh:w + -webkit-box-shadow: ${0} +snippet @f + @font-face + font-family: ${1} + src: url('${0}') +snippet @i + @import url('${0}') +snippet @m + @media ${1:print} ${0} +snippet bg+ + background: #${1:fff} url('${2}') ${3:0} ${4:0} ${0:no-repeat} +snippet bga + background-attachment: ${0} +snippet bga:f + background-attachment: fixed +snippet bga:s + background-attachment: scroll +snippet bgbk + background-break: ${0} +snippet bgbk:bb + background-break: bounding-box +snippet bgbk:c + background-break: continuous +snippet bgbk:eb + background-break: each-box +snippet bgcp + background-clip: ${0} +snippet bgcp:bb + background-clip: border-box +snippet bgcp:cb + background-clip: content-box +snippet bgcp:nc + background-clip: no-clip +snippet bgcp:pb + background-clip: padding-box +snippet bgc + background-color: #${0:fff} +snippet bgc:t + background-color: transparent +snippet bgi + background-image: url('${0}') +snippet bgi:n + background-image: none +snippet bgo + background-origin: ${0} +snippet bgo:bb + background-origin: border-box +snippet bgo:cb + background-origin: content-box +snippet bgo:pb + background-origin: padding-box +snippet bgpx + background-position-x: ${0} +snippet bgpy + background-position-y: ${0} +snippet bgp + background-position: ${1:0} ${0:0} +snippet bgr + background-repeat: ${0} +snippet bgr:n + background-repeat: no-repeat +snippet bgr:x + background-repeat: repeat-x +snippet bgr:y + background-repeat: repeat-y +snippet bgr:r + background-repeat: repeat +snippet bgz + background-size: ${0} +snippet bgz:a + background-size: auto +snippet bgz:ct + background-size: contain +snippet bgz:cv + background-size: cover +snippet bg + background: ${0} +snippet bg:ie + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${1}',sizingMethod='${0:crop}') +snippet bg:n + background: none +snippet bd+ + border: ${1:1px} ${2:solid} #${0:000} +snippet bdb+ + border-bottom: ${1:1px} ${2:solid} #${0:000} +snippet bdbc + border-bottom-color: #${0:000} +snippet bdbi + border-bottom-image: url('${0}') +snippet bdbi:n + border-bottom-image: none +snippet bdbli + border-bottom-left-image: url('${0}') +snippet bdbli:c + border-bottom-left-image: continue +snippet bdbli:n + border-bottom-left-image: none +snippet bdblrz + border-bottom-left-radius: ${0} +snippet bdbri + border-bottom-right-image: url('${0}') +snippet bdbri:c + border-bottom-right-image: continue +snippet bdbri:n + border-bottom-right-image: none +snippet bdbrrz + border-bottom-right-radius: ${0} +snippet bdbs + border-bottom-style: ${0} +snippet bdbs:n + border-bottom-style: none +snippet bdbw + border-bottom-width: ${0} +snippet bdb + border-bottom: ${0} +snippet bdb:n + border-bottom: none +snippet bdbk + border-break: ${0} +snippet bdbk:c + border-break: close +snippet bdcl + border-collapse: ${0} +snippet bdcl:c + border-collapse: collapse +snippet bdcl:s + border-collapse: separate +snippet bdc + border-color: #${0:000} +snippet bdci + border-corner-image: url('${0}') +snippet bdci:c + border-corner-image: continue +snippet bdci:n + border-corner-image: none +snippet bdf + border-fit: ${0} +snippet bdf:c + border-fit: clip +snippet bdf:of + border-fit: overwrite +snippet bdf:ow + border-fit: overwrite +snippet bdf:r + border-fit: repeat +snippet bdf:sc + border-fit: scale +snippet bdf:sp + border-fit: space +snippet bdf:st + border-fit: stretch +snippet bdi + border-image: url('${1}') ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch} +snippet bdi:n + border-image: none +snippet bdl+ + border-left: ${1:1px} ${2:solid} #${0:000} +snippet bdlc + border-left-color: #${0:000} +snippet bdli + border-left-image: url('${0}') +snippet bdli:n + border-left-image: none +snippet bdls + border-left-style: ${0} +snippet bdls:n + border-left-style: none +snippet bdlw + border-left-width: ${0} +snippet bdl + border-left: ${0} +snippet bdl:n + border-left: none +snippet bdlt + border-length: ${0} +snippet bdlt:a + border-length: auto +snippet bdrz + border-radius: ${0} +snippet bdr+ + border-right: ${1:1px} ${2:solid} #${0:000} +snippet bdrc + border-right-color: #${0:000} +snippet bdri + border-right-image: url('${0}') +snippet bdri:n + border-right-image: none +snippet bdrs + border-right-style: ${0} +snippet bdrs:n + border-right-style: none +snippet bdrw + border-right-width: ${0} +snippet bdr + border-right: ${0} +snippet bdr:n + border-right: none +snippet bdsp + border-spacing: ${0} +snippet bds + border-style: ${0} +snippet bds:ds + border-style: dashed +snippet bds:dtds + border-style: dot-dash +snippet bds:dtdtds + border-style: dot-dot-dash +snippet bds:dt + border-style: dotted +snippet bds:db + border-style: double +snippet bds:g + border-style: groove +snippet bds:h + border-style: hidden +snippet bds:i + border-style: inset +snippet bds:n + border-style: none +snippet bds:o + border-style: outset +snippet bds:r + border-style: ridge +snippet bds:s + border-style: solid +snippet bds:w + border-style: wave +snippet bdt+ + border-top: ${1:1px} ${2:solid} #${0:000} +snippet bdtc + border-top-color: #${0:000} +snippet bdti + border-top-image: url('${0}') +snippet bdti:n + border-top-image: none +snippet bdtli + border-top-left-image: url('${0}') +snippet bdtli:c + border-corner-image: continue +snippet bdtli:n + border-corner-image: none +snippet bdtlrz + border-top-left-radius: ${0} +snippet bdtri + border-top-right-image: url('${0}') +snippet bdtri:c + border-top-right-image: continue +snippet bdtri:n + border-top-right-image: none +snippet bdtrrz + border-top-right-radius: ${0} +snippet bdts + border-top-style: ${0} +snippet bdts:n + border-top-style: none +snippet bdtw + border-top-width: ${0} +snippet bdt + border-top: ${0} +snippet bdt:n + border-top: none +snippet bdw + border-width: ${0} +snippet bd + border: ${0} +snippet bd:n + border: none +snippet b + bottom: ${0} +snippet b:a + bottom: auto +snippet bxsh+ + box-shadow: ${1:0} ${2:0} ${3:0} #${0:000} +snippet bxsh + box-shadow: ${0} +snippet bxsh:n + box-shadow: none +snippet bxz + box-sizing: ${0} +snippet bxz:bb + box-sizing: border-box +snippet bxz:cb + box-sizing: content-box +snippet cps + caption-side: ${0} +snippet cps:b + caption-side: bottom +snippet cps:t + caption-side: top +snippet cl + clear: ${0} +snippet cl:b + clear: both +snippet cl:l + clear: left +snippet cl:n + clear: none +snippet cl:r + clear: right +snippet cp + clip: ${0} +snippet cp:a + clip: auto +snippet cp:r + clip: rect(${1:0} ${2:0} ${3:0} ${0:0}) +snippet c + color: #${0:000} +snippet ct + content: ${0} +snippet ct:a + content: attr(${0}) +snippet ct:cq + content: close-quote +snippet ct:c + content: counter(${0}) +snippet ct:cs + content: counters(${0}) +snippet ct:ncq + content: no-close-quote +snippet ct:noq + content: no-open-quote +snippet ct:n + content: normal +snippet ct:oq + content: open-quote +snippet coi + counter-increment: ${0} +snippet cor + counter-reset: ${0} +snippet cur + cursor: ${0} +snippet cur:a + cursor: auto +snippet cur:c + cursor: crosshair +snippet cur:d + cursor: default +snippet cur:ha + cursor: hand +snippet cur:he + cursor: help +snippet cur:m + cursor: move +snippet cur:p + cursor: pointer +snippet cur:t + cursor: text +snippet d + display: ${0} +snippet d:mib + display: -moz-inline-box +snippet d:mis + display: -moz-inline-stack +snippet d:b + display: block +snippet d:cp + display: compact +snippet d:ib + display: inline-block +snippet d:itb + display: inline-table +snippet d:i + display: inline +snippet d:li + display: list-item +snippet d:n + display: none +snippet d:ri + display: run-in +snippet d:tbcp + display: table-caption +snippet d:tbc + display: table-cell +snippet d:tbclg + display: table-column-group +snippet d:tbcl + display: table-column +snippet d:tbfg + display: table-footer-group +snippet d:tbhg + display: table-header-group +snippet d:tbrg + display: table-row-group +snippet d:tbr + display: table-row +snippet d:tb + display: table +snippet ec + empty-cells: ${0} +snippet ec:h + empty-cells: hide +snippet ec:s + empty-cells: show +snippet exp + expression() +snippet fl + float: ${0} +snippet fl:l + float: left +snippet fl:n + float: none +snippet fl:r + float: right +snippet f+ + font: ${1:1em} ${2:Arial},${0:sans-serif} +snippet fef + font-effect: ${0} +snippet fef:eb + font-effect: emboss +snippet fef:eg + font-effect: engrave +snippet fef:n + font-effect: none +snippet fef:o + font-effect: outline +snippet femp + font-emphasize-position: ${0} +snippet femp:a + font-emphasize-position: after +snippet femp:b + font-emphasize-position: before +snippet fems + font-emphasize-style: ${0} +snippet fems:ac + font-emphasize-style: accent +snippet fems:c + font-emphasize-style: circle +snippet fems:ds + font-emphasize-style: disc +snippet fems:dt + font-emphasize-style: dot +snippet fems:n + font-emphasize-style: none +snippet fem + font-emphasize: ${0} +snippet ff + font-family: ${0} +snippet ff:c + font-family: ${0:'Monotype Corsiva','Comic Sans MS'},cursive +snippet ff:f + font-family: ${0:Capitals,Impact},fantasy +snippet ff:m + font-family: ${0:Monaco,'Courier New'},monospace +snippet ff:ss + font-family: ${0:Helvetica,Arial},sans-serif +snippet ff:s + font-family: ${0:Georgia,'Times New Roman'},serif +snippet fza + font-size-adjust: ${0} +snippet fza:n + font-size-adjust: none +snippet fz + font-size: ${0} +snippet fsm + font-smooth: ${0} +snippet fsm:aw + font-smooth: always +snippet fsm:a + font-smooth: auto +snippet fsm:n + font-smooth: never +snippet fst + font-stretch: ${0} +snippet fst:c + font-stretch: condensed +snippet fst:e + font-stretch: expanded +snippet fst:ec + font-stretch: extra-condensed +snippet fst:ee + font-stretch: extra-expanded +snippet fst:n + font-stretch: normal +snippet fst:sc + font-stretch: semi-condensed +snippet fst:se + font-stretch: semi-expanded +snippet fst:uc + font-stretch: ultra-condensed +snippet fst:ue + font-stretch: ultra-expanded +snippet fs + font-style: ${0} +snippet fs:i + font-style: italic +snippet fs:n + font-style: normal +snippet fs:o + font-style: oblique +snippet fv + font-variant: ${0} +snippet fv:n + font-variant: normal +snippet fv:sc + font-variant: small-caps +snippet fw + font-weight: ${0} +snippet fw:b + font-weight: bold +snippet fw:br + font-weight: bolder +snippet fw:lr + font-weight: lighter +snippet fw:n + font-weight: normal +snippet f + font: ${0} +snippet h + height: ${0} +snippet h:a + height: auto +snippet l + left: ${0} +snippet l:a + left: auto +snippet lts + letter-spacing: ${0} +snippet lh + line-height: ${0} +snippet lisi + list-style-image: url('${0}') +snippet lisi:n + list-style-image: none +snippet lisp + list-style-position: ${0} +snippet lisp:i + list-style-position: inside +snippet lisp:o + list-style-position: outside +snippet list + list-style-type: ${0} +snippet list:c + list-style-type: circle +snippet list:dclz + list-style-type: decimal-leading-zero +snippet list:dc + list-style-type: decimal +snippet list:d + list-style-type: disc +snippet list:lr + list-style-type: lower-roman +snippet list:n + list-style-type: none +snippet list:s + list-style-type: square +snippet list:ur + list-style-type: upper-roman +snippet lis + list-style: ${0} +snippet lis:n + list-style: none +snippet mb + margin-bottom: ${0} +snippet mb:a + margin-bottom: auto +snippet ml + margin-left: ${0} +snippet ml:a + margin-left: auto +snippet mr + margin-right: ${0} +snippet mr:a + margin-right: auto +snippet mt + margin-top: ${0} +snippet mt:a + margin-top: auto +snippet m + margin: ${0} +snippet m:4 + margin: ${1:0} ${2:0} ${3:0} ${0:0} +snippet m:3 + margin: ${1:0} ${2:0} ${0:0} +snippet m:2 + margin: ${1:0} ${0:0} +snippet m:0 + margin: 0 +snippet m:a + margin: auto +snippet mah + max-height: ${0} +snippet mah:n + max-height: none +snippet maw + max-width: ${0} +snippet maw:n + max-width: none +snippet mih + min-height: ${0} +snippet miw + min-width: ${0} +snippet op + opacity: ${0} +snippet op:ie + filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=${0:100}) +snippet op:ms + -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=${0:100})' +snippet orp + orphans: ${0} +snippet o+ + outline: ${1:1px} ${2:solid} #${0:000} +snippet oc + outline-color: ${0:#000} +snippet oc:i + outline-color: invert +snippet oo + outline-offset: ${0} +snippet os + outline-style: ${0} +snippet ow + outline-width: ${0} +snippet o + outline: ${0} +snippet o:n + outline: none +snippet ovs + overflow-style: ${0} +snippet ovs:a + overflow-style: auto +snippet ovs:mq + overflow-style: marquee +snippet ovs:mv + overflow-style: move +snippet ovs:p + overflow-style: panner +snippet ovs:s + overflow-style: scrollbar +snippet ovx + overflow-x: ${0} +snippet ovx:a + overflow-x: auto +snippet ovx:h + overflow-x: hidden +snippet ovx:s + overflow-x: scroll +snippet ovx:v + overflow-x: visible +snippet ovy + overflow-y: ${0} +snippet ovy:a + overflow-y: auto +snippet ovy:h + overflow-y: hidden +snippet ovy:s + overflow-y: scroll +snippet ovy:v + overflow-y: visible +snippet ov + overflow: ${0} +snippet ov:a + overflow: auto +snippet ov:h + overflow: hidden +snippet ov:s + overflow: scroll +snippet ov:v + overflow: visible +snippet pb + padding-bottom: ${0} +snippet pl + padding-left: ${0} +snippet pr + padding-right: ${0} +snippet pt + padding-top: ${0} +snippet p + padding: ${0} +snippet p:4 + padding: ${1:0} ${2:0} ${3:0} ${0:0} +snippet p:3 + padding: ${1:0} ${2:0} ${0:0} +snippet p:2 + padding: ${1:0} ${0:0} +snippet p:0 + padding: 0 +snippet pgba + page-break-after: ${0} +snippet pgba:aw + page-break-after: always +snippet pgba:a + page-break-after: auto +snippet pgba:l + page-break-after: left +snippet pgba:r + page-break-after: right +snippet pgbb + page-break-before: ${0} +snippet pgbb:aw + page-break-before: always +snippet pgbb:a + page-break-before: auto +snippet pgbb:l + page-break-before: left +snippet pgbb:r + page-break-before: right +snippet pgbi + page-break-inside: ${0} +snippet pgbi:a + page-break-inside: auto +snippet pgbi:av + page-break-inside: avoid +snippet pos + position: ${0} +snippet pos:a + position: absolute +snippet pos:f + position: fixed +snippet pos:r + position: relative +snippet pos:s + position: static +snippet q + quotes: ${0} +snippet q:en + quotes: '\201C' '\201D' '\2018' '\2019' +snippet q:n + quotes: none +snippet q:ru + quotes: '\00AB' '\00BB' '\201E' '\201C' +snippet rz + resize: ${0} +snippet rz:b + resize: both +snippet rz:h + resize: horizontal +snippet rz:n + resize: none +snippet rz:v + resize: vertical +snippet r + right: ${0} +snippet r:a + right: auto +snippet tbl + table-layout: ${0} +snippet tbl:a + table-layout: auto +snippet tbl:f + table-layout: fixed +snippet tal + text-align-last: ${0} +snippet tal:a + text-align-last: auto +snippet tal:c + text-align-last: center +snippet tal:l + text-align-last: left +snippet tal:r + text-align-last: right +snippet ta + text-align: ${0} +snippet ta:c + text-align: center +snippet ta:l + text-align: left +snippet ta:r + text-align: right +snippet td + text-decoration: ${0} +snippet td:l + text-decoration: line-through +snippet td:n + text-decoration: none +snippet td:o + text-decoration: overline +snippet td:u + text-decoration: underline +snippet te + text-emphasis: ${0} +snippet te:ac + text-emphasis: accent +snippet te:a + text-emphasis: after +snippet te:b + text-emphasis: before +snippet te:c + text-emphasis: circle +snippet te:ds + text-emphasis: disc +snippet te:dt + text-emphasis: dot +snippet te:n + text-emphasis: none +snippet th + text-height: ${0} +snippet th:a + text-height: auto +snippet th:f + text-height: font-size +snippet th:m + text-height: max-size +snippet th:t + text-height: text-size +snippet ti + text-indent: ${0} +snippet ti:- + text-indent: -9999px +snippet tj + text-justify: ${0} +snippet tj:a + text-justify: auto +snippet tj:d + text-justify: distribute +snippet tj:ic + text-justify: inter-cluster +snippet tj:ii + text-justify: inter-ideograph +snippet tj:iw + text-justify: inter-word +snippet tj:k + text-justify: kashida +snippet tj:t + text-justify: tibetan +snippet to+ + text-outline: ${1:0} ${2:0} #${0:000} +snippet to + text-outline: ${0} +snippet to:n + text-outline: none +snippet tr + text-replace: ${0} +snippet tr:n + text-replace: none +snippet tsh+ + text-shadow: ${1:0} ${2:0} ${3:0} #${0:000} +snippet tsh + text-shadow: ${0} +snippet tsh:n + text-shadow: none +snippet tt + text-transform: ${0} +snippet tt:c + text-transform: capitalize +snippet tt:l + text-transform: lowercase +snippet tt:n + text-transform: none +snippet tt:u + text-transform: uppercase +snippet tw + text-wrap: ${0} +snippet tw:no + text-wrap: none +snippet tw:n + text-wrap: normal +snippet tw:s + text-wrap: suppress +snippet tw:u + text-wrap: unrestricted +snippet t + top: ${0} +snippet t:a + top: auto +snippet va + vertical-align: ${0} +snippet va:bl + vertical-align: baseline +snippet va:b + vertical-align: bottom +snippet va:m + vertical-align: middle +snippet va:sub + vertical-align: sub +snippet va:sup + vertical-align: super +snippet va:tb + vertical-align: text-bottom +snippet va:tt + vertical-align: text-top +snippet va:t + vertical-align: top +snippet v + visibility: ${0} +snippet v:c + visibility: collapse +snippet v:h + visibility: hidden +snippet v:v + visibility: visible +snippet whsc + white-space-collapse: ${0} +snippet whsc:ba + white-space-collapse: break-all +snippet whsc:bs + white-space-collapse: break-strict +snippet whsc:k + white-space-collapse: keep-all +snippet whsc:l + white-space-collapse: loose +snippet whsc:n + white-space-collapse: normal +snippet whs + white-space: ${0} +snippet whs:n + white-space: normal +snippet whs:nw + white-space: nowrap +snippet whs:pl + white-space: pre-line +snippet whs:pw + white-space: pre-wrap +snippet whs:p + white-space: pre +snippet wid + widows: ${0} +snippet w + width: ${0} +snippet w:a + width: auto +snippet wob + word-break: ${0} +snippet wob:ba + word-break: break-all +snippet wob:bs + word-break: break-strict +snippet wob:k + word-break: keep-all +snippet wob:l + word-break: loose +snippet wob:n + word-break: normal +snippet wos + word-spacing: ${0} +snippet wow + word-wrap: ${0} +snippet wow:no + word-wrap: none +snippet wow:n + word-wrap: normal +snippet wow:s + word-wrap: suppress +snippet wow:u + word-wrap: unrestricted +snippet z + z-index: ${0} +snippet z:a + z-index: auto +snippet zoo + zoom: 1 +snippet :h + :hover +snippet :fc + :first-child +snippet :lc + :last-child +snippet :nc + :nth-child(${0}) +snippet :nlc + :nth-last-child(${0}) +snippet :oc + :only-child +snippet :a + :after +snippet :b + :before +snippet ::a + ::after +snippet ::b + ::before diff --git a/sources_non_forked/vim-snippets/snippets/scala.snippets b/sources_non_forked/vim-snippets/snippets/scala.snippets index 003081ef..a6c3f3c7 100644 --- a/sources_non_forked/vim-snippets/snippets/scala.snippets +++ b/sources_non_forked/vim-snippets/snippets/scala.snippets @@ -7,30 +7,30 @@ #if snippet if if (${1}) - ${0} + ${0:${VISUAL}} #if not snippet ifn if (!${1}) - ${0} + ${0:${VISUAL}} #if-else snippet ife if (${1}) - ${2} + ${2:${VISUAL}} else ${0} #if-else-if snippet ifelif if (${1}) - ${2} + ${2:${VISUAL}} else if (${3}) - ${0} + ${0:${VISUAL}} snippet eif else if (${3}) - ${0} + ${0:${VISUAL}} #while loop snippet wh while (${1:obj}) { - ${0} + ${0:${VISUAL}} } #for loop(classic) snippet for @@ -50,7 +50,7 @@ snippet fory #exceptions snippet try try { - ${1} + ${1:${VISUAL}} } catch { case e: FileNotFoundException => ${2} case e: IOException => ${3} diff --git a/sources_non_forked/vim-snippets/snippets/sh.snippets b/sources_non_forked/vim-snippets/snippets/sh.snippets index e470a2ab..12f8115a 100644 --- a/sources_non_forked/vim-snippets/snippets/sh.snippets +++ b/sources_non_forked/vim-snippets/snippets/sh.snippets @@ -12,26 +12,26 @@ snippet sbash snippet if if [[ ${1:condition} ]]; then - ${0:#statements} + ${0:${VISUAL}} fi snippet elif elif [[ ${1:condition} ]]; then - ${0:#statements} + ${0:${VISUAL}} snippet for for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do - ${0:#statements} + ${0:${VISUAL}} done snippet fori for ${1:needle} in ${2:haystack} ; do - ${0:#statements} + ${0:${VISUAL}} done snippet wh while [[ ${1:condition} ]]; do - ${0:#statements} + ${0:${VISUAL}} done snippet until until [[ ${1:condition} ]]; do - ${0:#statements} + ${0:${VISUAL}} done snippet case case ${1:word} in diff --git a/sources_non_forked/vim-snippets/snippets/tex.snippets b/sources_non_forked/vim-snippets/snippets/tex.snippets index 05ec852c..c095b5a4 100644 --- a/sources_non_forked/vim-snippets/snippets/tex.snippets +++ b/sources_non_forked/vim-snippets/snippets/tex.snippets @@ -86,11 +86,11 @@ snippet enumi enumerate environment \\item ${0} \\end{enumerate} # Itemize -snippet itemize itemize environment +snippet item itemize environment \\begin{itemize} \\item ${0} \\end{itemize} -snippet item \item +snippet it \item \\item ${1:${VISUAL}} # Description snippet desc description environment @@ -259,6 +259,13 @@ snippet subfig subfigure environment \\label{fig:${5}} \\end{subfigure} ${0} +snippet tikzcd tikzcd environment + \begin{equation} + \begin{tikzcd} + ${1} + \end{tikzcd} + \end{equation} + ${0} #math snippet stackrel \stackrel{}{} \\stackrel{${1:above}}{${2:below}} ${0} diff --git a/sources_non_forked/vim-snippets/snippets/twig.snippets b/sources_non_forked/vim-snippets/snippets/twig.snippets index 47997c3b..d0d7e1c9 100644 --- a/sources_non_forked/vim-snippets/snippets/twig.snippets +++ b/sources_non_forked/vim-snippets/snippets/twig.snippets @@ -1,6 +1,6 @@ snippet bl "{% block xyz %} .. {% endblock xyz %}" {% block ${1} %} - ${2} + ${2:${VISUAL}} {% endblock $1 %} snippet js "{% javascripts 'xyz' %} .. {% endjavascripts %}" {% javascripts '${1}' %} @@ -12,17 +12,17 @@ snippet css "{% stylesheets 'xyz' %} .. {% endstylesheets %}" {% endstylesheets %} snippet if "{% if %} .. {% endif %}" {% if ${1} %} - ${2} + ${2:${VISUAL}} {% endif %} snippet ife "{% if %} .. {% else %} .. {% endif %}" {% if ${1} %} - ${2} + ${2:${VISUAL}} {% else %} ${0} {% endif %} snippet el "{% else %}" {% else %} - ${0} + ${0:${VISUAL}} snippet eif "{% elseif %}" {% elseif ${1} %} ${0} diff --git a/sources_non_forked/vim-snippets/snippets/vim.snippets b/sources_non_forked/vim-snippets/snippets/vim.snippets index b299f512..c604d9a6 100644 --- a/sources_non_forked/vim-snippets/snippets/vim.snippets +++ b/sources_non_forked/vim-snippets/snippets/vim.snippets @@ -14,13 +14,13 @@ snippet f function endf snippet t try ... catch statement try - ${1} + ${1:${VISUAL}} catch ${2} ${0} endtry snippet for for ... in loop for ${1} in ${2} - ${0} + ${0:${VISUAL}} endfor snippet forkv for [key, value] in loop for [${1},${2}] in items(${3}) @@ -29,15 +29,15 @@ snippet forkv for [key, value] in loop endfor snippet wh while loop while ${1} - ${0} + ${0:${VISUAL}} endw snippet if if statement if ${1} - ${0} + ${0:${VISUAL}} endif snippet ife if ... else statement if ${1} - ${2} + ${2:${VISUAL}} else ${0} endif diff --git a/sources_non_forked/vim-snippets/snippets/zsh.snippets b/sources_non_forked/vim-snippets/snippets/zsh.snippets index fc1c8374..a8173c26 100644 --- a/sources_non_forked/vim-snippets/snippets/zsh.snippets +++ b/sources_non_forked/vim-snippets/snippets/zsh.snippets @@ -4,40 +4,40 @@ snippet #! snippet if if ${1:condition}; then - ${0:# statements} + ${0:${VISUAL}} fi snippet ife if ${1:condition}; then - ${2:# statements} + ${2:${VISUAL}} else ${0:# statements} fi snippet eif elif ${1:condition}; then - ${0:# statements} + ${0:${VISUAL}} snippet for for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do - ${0:# statements} + ${0:${VISUAL}} done snippet fori for ${1:needle} in ${2:haystack}; do - ${0:#statements} + ${0:${VISUAL}} done snippet fore for ${1:item} in ${2:list}; do - ${0:# statements} + ${0:${VISUAL}} done snippet wh while ${1:condition}; do - ${0:# statements} + ${0:${VISUAL}} done snippet until until ${1:condition}; do - ${0:# statements} + ${0:${VISUAL}} done snippet repeat repeat ${1:integer}; do - ${0:# statements} + ${0:${VISUAL}} done snippet case case ${1:word} in @@ -46,7 +46,7 @@ snippet case esac snippet select select ${1:answer} in ${2:choices}; do - ${0:# statements} + ${0:${VISUAL}} done snippet ( ( ${0:#statements} ) From 68213dfb210f275a976f2e2db3897f89e675a149 Mon Sep 17 00:00:00 2001 From: Elliot Schep Date: Thu, 16 Feb 2017 23:24:21 +0100 Subject: [PATCH 06/74] [major(?)] Added vim logo On the Opera browser's (http://www.opera.com/) speed dial, you can set images as "logo's" for a website. This image is a nice logo. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 489ec5f9..a1b2ba91 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![VIM](https://camo.githubusercontent.com/bec48ea0e886e5489a8819486bf74075fe626067/68747470733a2f2f7261772e6769746875622e636f6d2f656c6d636173742f656c6d2d76696d2f6d61737465722f73637265656e73686f74732f6c6f676f2e706e67) + # The Ultimate vimrc Over the last 8 years I have used and tweaked Vim. This is my Ultimate vimrc. From 1b18f20cf1ba6a94a29ce85281d379bc43adac6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Del=C3=A9pine?= Date: Mon, 6 Mar 2017 09:53:46 +0100 Subject: [PATCH 07/74] Wording: Fix typo in the readme file --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 489ec5f9..b0acbb3d 100644 --- a/README.md +++ b/README.md @@ -310,5 +310,5 @@ Vimscript mappings: ## How to uninstall Do following: * Remove `~/.vim_runtime` -* Remove any lines that refernce `.vim_runtime` in your `~/.vimrc` +* Remove any lines that reference `.vim_runtime` in your `~/.vimrc` From ccb7854aa265a90ece0c869ab6e7f491af89f392 Mon Sep 17 00:00:00 2001 From: amix Date: Tue, 7 Mar 2017 18:04:28 +0100 Subject: [PATCH 08/74] Updated plugins --- .../lightline/colorscheme/darcula.vim | 37 +++ .../lightline.vim/doc/lightline.txt | 3 +- .../nerdtree/lib/nerdtree/ui.vim | 166 ++++++------- sources_non_forked/syntastic/README.markdown | 8 +- .../syntastic/autoload/syntastic/util.vim | 4 +- .../syntastic/doc/syntastic.txt | 2 +- .../syntastic/plugin/syntastic.vim | 5 +- .../syntastic/syntax_checkers/asm/gcc.vim | 7 +- .../syntastic/syntax_checkers/c/pc_lint.vim | 3 +- .../syntastic/syntax_checkers/cabal/cabal.vim | 5 +- .../syntastic/syntax_checkers/cuda/nvcc.vim | 22 +- .../syntastic/syntax_checkers/d/dmd.vim | 3 +- .../syntax_checkers/elixir/elixir.vim | 3 +- .../syntax_checkers/erlang/escript.vim | 8 +- .../syntastic/syntax_checkers/eruby/ruby.vim | 5 +- .../syntastic/syntax_checkers/glsl/cgc.vim | 29 +-- .../syntastic/syntax_checkers/go/go.vim | 17 +- .../syntax_checkers/go/gometalinter.vim | 3 +- .../syntastic/syntax_checkers/go/gotype.vim | 5 +- .../syntastic/syntax_checkers/go/govet.vim | 3 +- .../syntax_checkers/haskell/hdevtools.vim | 3 +- .../syntax_checkers/haskell/hlint.vim | 3 +- .../syntastic/syntax_checkers/haxe/haxe.vim | 10 +- .../syntax_checkers/html/validator.vim | 3 +- .../syntastic/syntax_checkers/html/w3.vim | 3 +- .../syntax_checkers/java/checkstyle.vim | 4 +- .../syntastic/syntax_checkers/java/javac.vim | 4 +- .../javascript/closurecompiler.vim | 5 +- .../syntax_checkers/javascript/flow.vim | 3 +- .../syntastic/syntax_checkers/limbo/limbo.vim | 3 +- .../syntastic/syntax_checkers/nasm/nasm.vim | 3 +- .../syntax_checkers/ocaml/camlp4o.vim | 30 +-- .../syntastic/syntax_checkers/perl/perl.vim | 5 +- .../syntastic/syntax_checkers/r/lint.vim | 4 +- .../syntastic/syntax_checkers/r/lintr.vim | 6 +- .../syntastic/syntax_checkers/r/svtools.vim | 4 +- .../syntastic/syntax_checkers/rst/sphinx.vim | 13 +- .../syntastic/syntax_checkers/sass/sass.vim | 11 +- .../syntastic/syntax_checkers/scala/fsc.vim | 3 +- .../syntastic/syntax_checkers/sh/sh.vim | 36 +-- .../syntax_checkers/sh/shellcheck.vim | 13 +- .../syntastic/syntax_checkers/vala/valac.vim | 8 +- .../syntastic/syntax_checkers/vim/vimlint.vim | 14 +- .../syntax_checkers/xquery/basex.vim | 3 +- .../syntastic/syntax_checkers/yaml/yamlxs.vim | 16 +- .../vim-coffee-script/Copying.md | 39 +++ .../vim-coffee-script/Readme.md | 24 +- .../ftdetect/vim-literate-coffeescript.vim | 8 + .../vim-coffee-script/ftplugin/litcoffee.vim | 1 + .../vim-coffee-script/indent/litcoffee.vim | 22 ++ .../vim-coffee-script/syntax/coffee.vim | 2 +- .../vim-coffee-script/syntax/litcoffee.vim | 23 ++ .../vim-coffee-script/test/test.coffee.md | 117 +++++++++ .../vim-coffee-script/test/test.litcoffee | 117 +++++++++ .../vim-fugitive/plugin/fugitive.vim | 3 +- .../vim-go/.github/ISSUE_TEMPLATE.md | 9 +- sources_non_forked/vim-go/.travis.yml | 1 - sources_non_forked/vim-go/CHANGELOG.md | 23 +- sources_non_forked/vim-go/LICENSE | 2 +- sources_non_forked/vim-go/README.md | 8 +- .../vim-go/autoload/ctrlp/decls.vim | 6 +- sources_non_forked/vim-go/autoload/go/cmd.vim | 2 +- .../vim-go/autoload/go/complete.vim | 12 +- .../vim-go/autoload/go/coverage.vim | 22 +- sources_non_forked/vim-go/autoload/go/def.vim | 2 +- sources_non_forked/vim-go/autoload/go/doc.vim | 23 +- sources_non_forked/vim-go/autoload/go/fmt.vim | 20 +- .../vim-go/autoload/go/guru.vim | 24 +- .../vim-go/autoload/go/impl.vim | 4 +- .../vim-go/autoload/go/lint.vim | 8 +- .../vim-go/autoload/go/list.vim | 2 +- .../vim-go/autoload/go/play.vim | 2 +- .../vim-go/autoload/go/statusline.vim | 2 +- .../vim-go/autoload/go/tags.vim | 206 +++++++++++++++ .../vim-go/autoload/go/tags_test.vim | 28 +++ .../vim-go/autoload/go/textobj.vim | 2 +- .../vim-go/autoload/go/tool.vim | 2 +- .../vim-go/autoload/go/util.vim | 2 +- sources_non_forked/vim-go/doc/vim-go.txt | 42 +++- .../vim-go/ftplugin/go/commands.vim | 7 +- .../vim-go/ftplugin/go/tagbar.vim | 6 +- .../vim-go/gosnippets/UltiSnips/go.snippets | 2 +- sources_non_forked/vim-go/plugin/go.vim | 1 + sources_non_forked/vim-go/scripts/test.sh | 3 + sources_non_forked/vim-pug/syntax/pug.vim | 2 +- .../vim-snippets/UltiSnips/all.snippets | 4 + .../vim-snippets/UltiSnips/cpp.snippets | 37 +++ .../javascript-jasmine-arrow.snippets | 234 ++++++++++++++++++ .../UltiSnips/javascript-jasmine.snippets | 18 +- .../UltiSnips/javascript.snippets | 93 +++++-- .../vim-snippets/UltiSnips/matlab.snippets | 24 ++ .../vim-snippets/UltiSnips/ruby.snippets | 68 ++--- .../vim-snippets/UltiSnips/snippets.snippets | 6 +- .../pythonx/javascript_snippets.py | 48 ++++ .../vim-snippets/snippets/c.snippets | 109 +++++++- .../vim-snippets/snippets/cpp.snippets | 57 ++++- .../vim-snippets/snippets/fortran.snippets | 3 + .../vim-snippets/snippets/jinja.snippets | 2 +- .../vim-snippets/snippets/matlab.snippets | 64 +++++ .../vim-snippets/snippets/php.snippets | 4 +- .../vim-snippets/snippets/ruby.snippets | 15 -- .../vim-snippets/snippets/rust.snippets | 2 +- .../vim-snippets/snippets/snippets.snippets | 7 +- 103 files changed, 1729 insertions(+), 445 deletions(-) create mode 100644 sources_non_forked/lightline.vim/autoload/lightline/colorscheme/darcula.vim create mode 100644 sources_non_forked/vim-coffee-script/ftdetect/vim-literate-coffeescript.vim create mode 100644 sources_non_forked/vim-coffee-script/ftplugin/litcoffee.vim create mode 100644 sources_non_forked/vim-coffee-script/indent/litcoffee.vim create mode 100644 sources_non_forked/vim-coffee-script/syntax/litcoffee.vim create mode 100644 sources_non_forked/vim-coffee-script/test/test.coffee.md create mode 100644 sources_non_forked/vim-coffee-script/test/test.litcoffee create mode 100644 sources_non_forked/vim-go/autoload/go/tags.vim create mode 100644 sources_non_forked/vim-go/autoload/go/tags_test.vim create mode 100644 sources_non_forked/vim-snippets/UltiSnips/javascript-jasmine-arrow.snippets create mode 100644 sources_non_forked/vim-snippets/UltiSnips/matlab.snippets create mode 100644 sources_non_forked/vim-snippets/pythonx/javascript_snippets.py create mode 100644 sources_non_forked/vim-snippets/snippets/matlab.snippets diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/darcula.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/darcula.vim new file mode 100644 index 00000000..928e8b76 --- /dev/null +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/darcula.vim @@ -0,0 +1,37 @@ +" ============================================================================= +" Filename: autoload/lightline/colorscheme/darcula.vim +" Author: kkopec +" License: MIT License +" Last Change: 2017/02/11 21:18:54. +" ============================================================================= + +let s:black = [ '#2b2b2b', 235 ] +let s:gray = [ '#323232', 236 ] +let s:white = [ '#a9b7c6', 250 ] +let s:blue = [ '#6897bb' , 67 ] +let s:green = [ '#629755', 71 ] +let s:purple = [ '#9876aa', 104 ] +let s:red = [ '#ff6b68', 204 ] +let s:yellow = [ '#ffc66d', 222 ] + +let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} +let s:p.normal.left = [ [ s:black, s:purple ], [ s:purple, s:gray ] ] +let s:p.normal.right = [ [ s:black, s:purple ], [ s:purple, s:gray ] ] +let s:p.inactive.left = [ [ s:black, s:blue ], [ s:blue, s:gray ] ] +let s:p.inactive.right = [ [ s:black, s:blue ], [ s:blue, s:gray ] ] +let s:p.insert.left = [ [ s:black, s:green ], [ s:green, s:gray ] ] +let s:p.insert.right = [ [ s:black, s:green ], [ s:green, s:gray ] ] +let s:p.replace.left = [ [ s:black, s:red ], [ s:red, s:gray ] ] +let s:p.replace.right = [ [ s:black, s:red ], [ s:red, s:gray ] ] +let s:p.visual.left = [ [ s:black, s:yellow ], [ s:yellow, s:gray ] ] +let s:p.visual.right = [ [ s:black, s:yellow ], [ s:yellow, s:gray ] ] +let s:p.normal.middle = [ [ s:white, s:gray ] ] +let s:p.inactive.middle = [ [ s:white, s:gray ] ] +let s:p.tabline.left = [ [ s:blue, s:gray ] ] +let s:p.tabline.tabsel = [ [ s:black, s:blue ] ] +let s:p.tabline.middle = [ [ s:blue, s:gray ] ] +let s:p.tabline.right = [ [ s:black, s:blue ] ] +let s:p.normal.error = [ [ s:red, s:black ] ] +let s:p.normal.warning = [ [ s:yellow, s:black ] ] + +let g:lightline#colorscheme#darcula#palette = lightline#colorscheme#flatten(s:p) diff --git a/sources_non_forked/lightline.vim/doc/lightline.txt b/sources_non_forked/lightline.vim/doc/lightline.txt index 8b0a580d..1c08d82b 100644 --- a/sources_non_forked/lightline.vim/doc/lightline.txt +++ b/sources_non_forked/lightline.vim/doc/lightline.txt @@ -223,7 +223,8 @@ OPTIONS *lightline-option* The colorscheme for lightline.vim. Currently, wombat, solarized, powerline, jellybeans, Tomorrow, Tomorrow_Night, Tomorrow_Night_Blue, Tomorrow_Night_Eighties, - PaperColor, seoul256, landscape, one, Dracula, Molokai and 16color are available. + PaperColor, seoul256, landscape, one, Dracula, darcula, + Molokai and 16color are available. The default value is: > let g:lightline.colorscheme = 'default' diff --git a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim index d107814c..65ebfd91 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim @@ -20,108 +20,105 @@ endfunction "FUNCTION: s:UI._dumpHelp {{{1 "prints out the quick help function! s:UI._dumpHelp() - let old_h = @h if self.getShowHelp() - let @h= "\" NERD tree (" . nerdtree#version() . ") quickhelp~\n" - let @h=@h."\" ============================\n" - let @h=@h."\" File node mappings~\n" - let @h=@h."\" ". (g:NERDTreeMouseMode ==# 3 ? "single" : "double") ."-click,\n" - let @h=@h."\" ,\n" + let help = "\" NERD tree (" . nerdtree#version() . ") quickhelp~\n" + let help .= "\" ============================\n" + let help .= "\" File node mappings~\n" + let help .= "\" ". (g:NERDTreeMouseMode ==# 3 ? "single" : "double") ."-click,\n" + let help .= "\" ,\n" if self.nerdtree.isTabTree() - let @h=@h."\" ". g:NERDTreeMapActivateNode .": open in prev window\n" + let help .= "\" ". g:NERDTreeMapActivateNode .": open in prev window\n" else - let @h=@h."\" ". g:NERDTreeMapActivateNode .": open in current window\n" + let help .= "\" ". g:NERDTreeMapActivateNode .": open in current window\n" endif if self.nerdtree.isTabTree() - let @h=@h."\" ". g:NERDTreeMapPreview .": preview\n" + let help .= "\" ". g:NERDTreeMapPreview .": preview\n" endif - let @h=@h."\" ". g:NERDTreeMapOpenInTab.": open in new tab\n" - let @h=@h."\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" - let @h=@h."\" middle-click,\n" - let @h=@h."\" ". g:NERDTreeMapOpenSplit .": open split\n" - let @h=@h."\" ". g:NERDTreeMapPreviewSplit .": preview split\n" - let @h=@h."\" ". g:NERDTreeMapOpenVSplit .": open vsplit\n" - let @h=@h."\" ". g:NERDTreeMapPreviewVSplit .": preview vsplit\n" + let help .= "\" ". g:NERDTreeMapOpenInTab.": open in new tab\n" + let help .= "\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" + let help .= "\" middle-click,\n" + let help .= "\" ". g:NERDTreeMapOpenSplit .": open split\n" + let help .= "\" ". g:NERDTreeMapPreviewSplit .": preview split\n" + let help .= "\" ". g:NERDTreeMapOpenVSplit .": open vsplit\n" + let help .= "\" ". g:NERDTreeMapPreviewVSplit .": preview vsplit\n" - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Directory node mappings~\n" - let @h=@h."\" ". (g:NERDTreeMouseMode ==# 1 ? "double" : "single") ."-click,\n" - let @h=@h."\" ". g:NERDTreeMapActivateNode .": open & close node\n" - let @h=@h."\" ". g:NERDTreeMapOpenRecursively .": recursively open node\n" - let @h=@h."\" ". g:NERDTreeMapCloseDir .": close parent of node\n" - let @h=@h."\" ". g:NERDTreeMapCloseChildren .": close all child nodes of\n" - let @h=@h."\" current node recursively\n" - let @h=@h."\" middle-click,\n" - let @h=@h."\" ". g:NERDTreeMapOpenExpl.": explore selected dir\n" + let help .= "\"\n\" ----------------------------\n" + let help .= "\" Directory node mappings~\n" + let help .= "\" ". (g:NERDTreeMouseMode ==# 1 ? "double" : "single") ."-click,\n" + let help .= "\" ". g:NERDTreeMapActivateNode .": open & close node\n" + let help .= "\" ". g:NERDTreeMapOpenRecursively .": recursively open node\n" + let help .= "\" ". g:NERDTreeMapCloseDir .": close parent of node\n" + let help .= "\" ". g:NERDTreeMapCloseChildren .": close all child nodes of\n" + let help .= "\" current node recursively\n" + let help .= "\" middle-click,\n" + let help .= "\" ". g:NERDTreeMapOpenExpl.": explore selected dir\n" - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Bookmark table mappings~\n" - let @h=@h."\" double-click,\n" - let @h=@h."\" ". g:NERDTreeMapActivateNode .": open bookmark\n" - let @h=@h."\" ". g:NERDTreeMapOpenInTab.": open in new tab\n" - let @h=@h."\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" - let @h=@h."\" ". g:NERDTreeMapDeleteBookmark .": delete bookmark\n" + let help .= "\"\n\" ----------------------------\n" + let help .= "\" Bookmark table mappings~\n" + let help .= "\" double-click,\n" + let help .= "\" ". g:NERDTreeMapActivateNode .": open bookmark\n" + let help .= "\" ". g:NERDTreeMapOpenInTab.": open in new tab\n" + let help .= "\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" + let help .= "\" ". g:NERDTreeMapDeleteBookmark .": delete bookmark\n" - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Tree navigation mappings~\n" - let @h=@h."\" ". g:NERDTreeMapJumpRoot .": go to root\n" - let @h=@h."\" ". g:NERDTreeMapJumpParent .": go to parent\n" - let @h=@h."\" ". g:NERDTreeMapJumpFirstChild .": go to first child\n" - let @h=@h."\" ". g:NERDTreeMapJumpLastChild .": go to last child\n" - let @h=@h."\" ". g:NERDTreeMapJumpNextSibling .": go to next sibling\n" - let @h=@h."\" ". g:NERDTreeMapJumpPrevSibling .": go to prev sibling\n" + let help .= "\"\n\" ----------------------------\n" + let help .= "\" Tree navigation mappings~\n" + let help .= "\" ". g:NERDTreeMapJumpRoot .": go to root\n" + let help .= "\" ". g:NERDTreeMapJumpParent .": go to parent\n" + let help .= "\" ". g:NERDTreeMapJumpFirstChild .": go to first child\n" + let help .= "\" ". g:NERDTreeMapJumpLastChild .": go to last child\n" + let help .= "\" ". g:NERDTreeMapJumpNextSibling .": go to next sibling\n" + let help .= "\" ". g:NERDTreeMapJumpPrevSibling .": go to prev sibling\n" - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Filesystem mappings~\n" - let @h=@h."\" ". g:NERDTreeMapChangeRoot .": change tree root to the\n" - let @h=@h."\" selected dir\n" - let @h=@h."\" ". g:NERDTreeMapUpdir .": move tree root up a dir\n" - let @h=@h."\" ". g:NERDTreeMapUpdirKeepOpen .": move tree root up a dir\n" - let @h=@h."\" but leave old root open\n" - let @h=@h."\" ". g:NERDTreeMapRefresh .": refresh cursor dir\n" - let @h=@h."\" ". g:NERDTreeMapRefreshRoot .": refresh current root\n" - let @h=@h."\" ". g:NERDTreeMapMenu .": Show menu\n" - let @h=@h."\" ". g:NERDTreeMapChdir .":change the CWD to the\n" - let @h=@h."\" selected dir\n" - let @h=@h."\" ". g:NERDTreeMapCWD .":change tree root to CWD\n" + let help .= "\"\n\" ----------------------------\n" + let help .= "\" Filesystem mappings~\n" + let help .= "\" ". g:NERDTreeMapChangeRoot .": change tree root to the\n" + let help .= "\" selected dir\n" + let help .= "\" ". g:NERDTreeMapUpdir .": move tree root up a dir\n" + let help .= "\" ". g:NERDTreeMapUpdirKeepOpen .": move tree root up a dir\n" + let help .= "\" but leave old root open\n" + let help .= "\" ". g:NERDTreeMapRefresh .": refresh cursor dir\n" + let help .= "\" ". g:NERDTreeMapRefreshRoot .": refresh current root\n" + let help .= "\" ". g:NERDTreeMapMenu .": Show menu\n" + let help .= "\" ". g:NERDTreeMapChdir .":change the CWD to the\n" + let help .= "\" selected dir\n" + let help .= "\" ". g:NERDTreeMapCWD .":change tree root to CWD\n" - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Tree filtering mappings~\n" - let @h=@h."\" ". g:NERDTreeMapToggleHidden .": hidden files (" . (self.getShowHidden() ? "on" : "off") . ")\n" - let @h=@h."\" ". g:NERDTreeMapToggleFilters .": file filters (" . (self.isIgnoreFilterEnabled() ? "on" : "off") . ")\n" - let @h=@h."\" ". g:NERDTreeMapToggleFiles .": files (" . (self.getShowFiles() ? "on" : "off") . ")\n" - let @h=@h."\" ". g:NERDTreeMapToggleBookmarks .": bookmarks (" . (self.getShowBookmarks() ? "on" : "off") . ")\n" + let help .= "\"\n\" ----------------------------\n" + let help .= "\" Tree filtering mappings~\n" + let help .= "\" ". g:NERDTreeMapToggleHidden .": hidden files (" . (self.getShowHidden() ? "on" : "off") . ")\n" + let help .= "\" ". g:NERDTreeMapToggleFilters .": file filters (" . (self.isIgnoreFilterEnabled() ? "on" : "off") . ")\n" + let help .= "\" ". g:NERDTreeMapToggleFiles .": files (" . (self.getShowFiles() ? "on" : "off") . ")\n" + let help .= "\" ". g:NERDTreeMapToggleBookmarks .": bookmarks (" . (self.getShowBookmarks() ? "on" : "off") . ")\n" "add quickhelp entries for each custom key map - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Custom mappings~\n" + let help .= "\"\n\" ----------------------------\n" + let help .= "\" Custom mappings~\n" for i in g:NERDTreeKeyMap.All() if !empty(i.quickhelpText) - let @h=@h."\" ". i.key .": ". i.quickhelpText ."\n" + let help .= "\" ". i.key .": ". i.quickhelpText ."\n" endif endfor - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Other mappings~\n" - let @h=@h."\" ". g:NERDTreeMapQuit .": Close the NERDTree window\n" - let @h=@h."\" ". g:NERDTreeMapToggleZoom .": Zoom (maximize-minimize)\n" - let @h=@h."\" the NERDTree window\n" - let @h=@h."\" ". g:NERDTreeMapHelp .": toggle help\n" - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Bookmark commands~\n" - let @h=@h."\" :Bookmark []\n" - let @h=@h."\" :BookmarkToRoot \n" - let @h=@h."\" :RevealBookmark \n" - let @h=@h."\" :OpenBookmark \n" - let @h=@h."\" :ClearBookmarks []\n" - let @h=@h."\" :ClearAllBookmarks\n" - silent! put h + let help .= "\"\n\" ----------------------------\n" + let help .= "\" Other mappings~\n" + let help .= "\" ". g:NERDTreeMapQuit .": Close the NERDTree window\n" + let help .= "\" ". g:NERDTreeMapToggleZoom .": Zoom (maximize-minimize)\n" + let help .= "\" the NERDTree window\n" + let help .= "\" ". g:NERDTreeMapHelp .": toggle help\n" + let help .= "\"\n\" ----------------------------\n" + let help .= "\" Bookmark commands~\n" + let help .= "\" :Bookmark []\n" + let help .= "\" :BookmarkToRoot \n" + let help .= "\" :RevealBookmark \n" + let help .= "\" :OpenBookmark \n" + let help .= "\" :ClearBookmarks []\n" + let help .= "\" :ClearAllBookmarks\n" + silent! put =help elseif !self.isMinimal() - let @h="\" Press ". g:NERDTreeMapHelp ." for help\n" - silent! put h + let help ="\" Press ". g:NERDTreeMapHelp ." for help\n" + silent! put =help endif - - let @h = old_h endfunction @@ -440,10 +437,7 @@ function! s:UI.render() call cursor(line(".")+1, col(".")) "draw the tree - let old_o = @o - let @o = self.nerdtree.root.renderToString() - silent put o - let @o = old_o + silent put =self.nerdtree.root.renderToString() "delete the blank line at the top of the buffer silent 1,1delete _ diff --git a/sources_non_forked/syntastic/README.markdown b/sources_non_forked/syntastic/README.markdown index 7ed8cc87..4212c95a 100644 --- a/sources_non_forked/syntastic/README.markdown +++ b/sources_non_forked/syntastic/README.markdown @@ -101,10 +101,10 @@ enabled. Syntastic itself has rather relaxed requirements: it doesn't have any external dependencies, and it needs a version of [Vim][vim] compiled with a few common features: `autocmd`, `eval`, `file_in_path`, `modify_fname`, `quickfix`, -`reltime`, and `user_commands`. Not all possible combinations of features that -include the ones above make equal sense on all operating systems, but Vim -version 7 or later with the "normal", "big", or "huge" feature sets should be -fine. +`reltime`, `statusline`, and `user_commands`. Not all possible combinations of +features that include the ones above make equal sense on all operating systems, +but Vim version 7 or later with the "normal", "big", or "huge" feature sets +should be fine. Syntastic should work with any modern plugin managers for Vim, such as [NeoBundle][neobundle], [Pathogen][pathogen], [Vim-Addon-Manager][vam], diff --git a/sources_non_forked/syntastic/autoload/syntastic/util.vim b/sources_non_forked/syntastic/autoload/syntastic/util.vim index deeb0f1f..6ead9ea2 100644 --- a/sources_non_forked/syntastic/autoload/syntastic/util.vim +++ b/sources_non_forked/syntastic/autoload/syntastic/util.vim @@ -132,9 +132,9 @@ endfunction " }}}2 " returns " " {'exe': '/usr/bin/perl', 'args': ['-f', '-bar']} -function! syntastic#util#parseShebang() abort " {{{2 +function! syntastic#util#parseShebang(buf) abort " {{{2 for lnum in range(1, 5) - let line = getline(lnum) + let line = get(getbufline(a:buf, lnum), 0, '') if line =~# '^#!' let line = substitute(line, '\v^#!\s*(\S+/env(\s+-\S+)*\s+)?', '', '') let exe = matchstr(line, '\m^\S*\ze') diff --git a/sources_non_forked/syntastic/doc/syntastic.txt b/sources_non_forked/syntastic/doc/syntastic.txt index db3e99e4..8bc455d3 100644 --- a/sources_non_forked/syntastic/doc/syntastic.txt +++ b/sources_non_forked/syntastic/doc/syntastic.txt @@ -164,7 +164,7 @@ When syntax errors are detected a flag will be shown. The content of the flag is derived from the |'syntastic_stl_format'| option. Please note that these settings might conflict with other Vim plugins that -change the way statusline works. Refer to the |syntastic-compatibility| notes +change the way 'statusline' works. Refer to the |syntastic-compatibility| notes below and to the respective plugins' documentation for possible solutions. In particular see |syntastic-airline| below if you're using the "airline" Vim diff --git a/sources_non_forked/syntastic/plugin/syntastic.vim b/sources_non_forked/syntastic/plugin/syntastic.vim index 4e65ea07..47f16cf0 100644 --- a/sources_non_forked/syntastic/plugin/syntastic.vim +++ b/sources_non_forked/syntastic/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:_SYNTASTIC_START endif -let g:_SYNTASTIC_VERSION = '3.8.0-21' +let g:_SYNTASTIC_VERSION = '3.8.0-26' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1 @@ -36,7 +36,8 @@ for s:feature in [ \ 'modify_fname', \ 'quickfix', \ 'reltime', - \ 'user_commands' + \ 'statusline', + \ 'user_commands', \ ] if !has(s:feature) call syntastic#log#error('need Vim compiled with feature ' . s:feature) diff --git a/sources_non_forked/syntastic/syntax_checkers/asm/gcc.vim b/sources_non_forked/syntastic/syntax_checkers/asm/gcc.vim index d352eeeb..f6a8b410 100644 --- a/sources_non_forked/syntastic/syntax_checkers/asm/gcc.vim +++ b/sources_non_forked/syntastic/syntax_checkers/asm/gcc.vim @@ -34,19 +34,20 @@ function! SyntaxCheckers_asm_gcc_IsAvailable() dict " {{{1 endfunction " }}}1 function! SyntaxCheckers_asm_gcc_GetLocList() dict " {{{1 + let buf = bufnr('') return syntastic#c#GetLocList('asm', 'gcc', { \ 'errorformat': \ '%-G%f:%s:,' . \ '%f:%l:%c: %trror: %m,' . \ '%f:%l:%c: %tarning: %m,' . \ '%f:%l: %m', - \ 'main_flags': '-x assembler -fsyntax-only' . (g:syntastic_asm_generic ? '' : ' -masm=' . s:GetDialect()) }) + \ 'main_flags': '-x assembler -fsyntax-only' . (g:syntastic_asm_generic ? '' : ' -masm=' . s:GetDialect(buf)) }) endfunction " }}}1 " Utilities {{{1 -function! s:GetDialect() " {{{2 - return syntastic#util#var('asm_dialect', expand('%:e', 1) ==? 'asm' ? 'intel' : 'att') +function! s:GetDialect(buf) " {{{2 + return syntastic#util#bufVar(a:buf, 'asm_dialect', fnamemodify(bufname(a:buf), ':e') ==? 'asm' ? 'intel' : 'att') endfunction " }}}2 " }}}1 diff --git a/sources_non_forked/syntastic/syntax_checkers/c/pc_lint.vim b/sources_non_forked/syntastic/syntax_checkers/c/pc_lint.vim index 6efd17a1..0f7f9da7 100644 --- a/sources_non_forked/syntastic/syntax_checkers/c/pc_lint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/c/pc_lint.vim @@ -23,7 +23,8 @@ if !exists('g:syntastic_pc_lint_config_file') endif function! SyntaxCheckers_c_pc_lint_GetLocList() dict - let config = syntastic#util#findFileInParent(g:syntastic_pc_lint_config_file, expand('%:p:h', 1)) + let buf = bufnr('') + let config = syntastic#util#findFileInParent(g:syntastic_pc_lint_config_file, fnamemodify(bufname(buf), ':p:h')) call self.log('config =', config) " -hFs1 - show filename, add space after messages, try to make message 1 line diff --git a/sources_non_forked/syntastic/syntax_checkers/cabal/cabal.vim b/sources_non_forked/syntastic/syntax_checkers/cabal/cabal.vim index e43aefaa..6aa58aff 100644 --- a/sources_non_forked/syntastic/syntax_checkers/cabal/cabal.vim +++ b/sources_non_forked/syntastic/syntax_checkers/cabal/cabal.vim @@ -31,6 +31,7 @@ function! SyntaxCheckers_cabal_cabal_GetHighlightRegex(item) endfunction function! SyntaxCheckers_cabal_cabal_GetLocList() dict + let buf = bufnr('') let makeprg = self.getExecEscaped() . ' check' let errorformat = @@ -40,9 +41,9 @@ function! SyntaxCheckers_cabal_cabal_GetLocList() dict return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'cwd': expand('%:p:h', 1), + \ 'cwd': fnamemodify(bufname(buf), ':p:h'), \ 'preprocess': 'cabal', - \ 'defaults': {'bufnr': bufnr('')} }) + \ 'defaults': {'bufnr': buf} }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/sources_non_forked/syntastic/syntax_checkers/cuda/nvcc.vim b/sources_non_forked/syntastic/syntax_checkers/cuda/nvcc.vim index 34760390..9601e73a 100644 --- a/sources_non_forked/syntastic/syntax_checkers/cuda/nvcc.vim +++ b/sources_non_forked/syntastic/syntax_checkers/cuda/nvcc.vim @@ -18,7 +18,8 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_cuda_nvcc_GetLocList() dict - let arch_flag = syntastic#util#var('cuda_arch') + let buf = bufnr('') + let arch_flag = syntastic#util#bufVar(buf, 'cuda_arch') if arch_flag !=# '' let arch_flag = '-arch=' . arch_flag call syntastic#log#oneTimeWarn('variable g:syntastic_cuda_arch is deprecated, ' . @@ -27,9 +28,9 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() dict let build_opts = {} let dummy = '' - if index(['h', 'hpp', 'cuh'], expand('%:e', 1), 0, 1) >= 0 - if syntastic#util#var('cuda_check_header', 0) - let dummy = expand('%:p:h', 1) . syntastic#util#Slash() . '.syntastic_dummy.cu' + if index(['h', 'hpp', 'cuh'], fnamemodify(bufname(buf), ':e'), 0, 1) >= 0 + if syntastic#util#bufVar(buf, 'cuda_check_header', 0) + let dummy = fnamemodify(bufname(buf), ':p:h') . syntastic#util#Slash() . '.syntastic_dummy.cu' let build_opts = { \ 'exe_before': 'echo > ' . syntastic#util#shescape(dummy) . ' ;', \ 'fname_before': '.syntastic_dummy.cu -include' } @@ -62,7 +63,18 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() dict \ '%DMaking %*\a in %f,'. \ '%f|%l| %m' - let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'type': 'E'} }) + + for e in loclist + let pat = matchstr(e['text'], '\m\c^\s*warning:\s*\zs.*') + if pat !=# '' + let e['text'] = pat + let e['type'] = 'W' + endif + endfor if dummy !=# '' call delete(dummy) diff --git a/sources_non_forked/syntastic/syntax_checkers/d/dmd.vim b/sources_non_forked/syntastic/syntax_checkers/d/dmd.vim index 88979956..de00b8eb 100644 --- a/sources_non_forked/syntastic/syntax_checkers/d/dmd.vim +++ b/sources_non_forked/syntastic/syntax_checkers/d/dmd.vim @@ -44,8 +44,9 @@ function! SyntaxCheckers_d_dmd_IsAvailable() dict " {{{1 endfunction " }}}1 function! SyntaxCheckers_d_dmd_GetLocList() dict " {{{1 + let buf = bufnr('') if !exists('g:syntastic_d_include_dirs') - let g:syntastic_d_include_dirs = s:GetIncludes(self, expand('%:p:h')) + let g:syntastic_d_include_dirs = s:GetIncludes(self, fnamemodify(bufname(buf), ':p:h')) endif return syntastic#c#GetLocList('d', 'dmd', { diff --git a/sources_non_forked/syntastic/syntax_checkers/elixir/elixir.vim b/sources_non_forked/syntastic/syntax_checkers/elixir/elixir.vim index f2ffe67e..939520ed 100644 --- a/sources_non_forked/syntastic/syntax_checkers/elixir/elixir.vim +++ b/sources_non_forked/syntastic/syntax_checkers/elixir/elixir.vim @@ -27,9 +27,10 @@ function! SyntaxCheckers_elixir_elixir_IsAvailable() dict endfunction function! SyntaxCheckers_elixir_elixir_GetLocList() dict + let buf = bufnr('') let make_options = {} let compile_command = 'elixir' - let mix_file = syntastic#util#findFileInParent('mix.exs', expand('%:p:h', 1)) + let mix_file = syntastic#util#findFileInParent('mix.exs', fnamemodify(bufname(buf), ':p:h')) if filereadable(mix_file) let compile_command = 'mix compile' diff --git a/sources_non_forked/syntastic/syntax_checkers/erlang/escript.vim b/sources_non_forked/syntastic/syntax_checkers/erlang/escript.vim index 9fd869fc..f931e6b1 100644 --- a/sources_non_forked/syntastic/syntax_checkers/erlang/escript.vim +++ b/sources_non_forked/syntastic/syntax_checkers/erlang/escript.vim @@ -25,11 +25,13 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_erlang_escript_GetLocList() dict - if expand('%:e', 1) ==# 'hrl' + let buf = bufnr('') + + if fnamemodify(bufname(buf), ':e') ==# 'hrl' return [] endif - let shebang = syntastic#util#parseShebang() + let shebang = syntastic#util#parseShebang(buf) if shebang['exe'] ==# 'escript' let args = '-s' let post_args = '' @@ -39,7 +41,7 @@ function! SyntaxCheckers_erlang_escript_GetLocList() dict endif let makeprg = self.makeprgBuild({ \ 'args_after': args, - \ 'fname': syntastic#util#shexpand('%:p'), + \ 'fname': syntastic#util#shexpand(fnamemodify(bufname(buf), ':p')), \ 'post_args_after': post_args }) let errorformat = diff --git a/sources_non_forked/syntastic/syntax_checkers/eruby/ruby.vim b/sources_non_forked/syntastic/syntax_checkers/eruby/ruby.vim index 16eed623..4850eeef 100644 --- a/sources_non_forked/syntastic/syntax_checkers/eruby/ruby.vim +++ b/sources_non_forked/syntastic/syntax_checkers/eruby/ruby.vim @@ -31,7 +31,8 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict let s:ruby_new = syntastic#util#versionIsAtLeast(self.getVersion(), [1, 9]) endif - let fname = "'" . escape(expand('%', 1), "\\'") . "'" + let buf = bufnr('') + let fname = "'" . escape(bufname(buf), "\\'") . "'" " TODO: encodings became useful in ruby 1.9 :) if s:ruby_new @@ -69,7 +70,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'env': env, - \ 'defaults': { 'bufnr': bufnr(''), 'vcol': 1 } }) + \ 'defaults': { 'bufnr': buf, 'vcol': 1 } }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/sources_non_forked/syntastic/syntax_checkers/glsl/cgc.vim b/sources_non_forked/syntastic/syntax_checkers/glsl/cgc.vim index 602399d7..e51f8335 100644 --- a/sources_non_forked/syntastic/syntax_checkers/glsl/cgc.vim +++ b/sources_non_forked/syntastic/syntax_checkers/glsl/cgc.vim @@ -28,8 +28,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_glsl_cgc_GetLocList() dict " {{{1 + let buf = bufnr('') let makeprg = self.makeprgBuild({ - \ 'args_before': '-oglsl -profile ' . s:GetProfile(), + \ 'args_before': '-oglsl -profile ' . s:GetProfile(buf), \ 'args': (exists('g:syntastic_glsl_options') ? ' ' . g:syntastic_glsl_options : '') }) let errorformat = @@ -43,27 +44,11 @@ endfunction " }}}1 " Utilities {{{1 -function! s:GetProfile() " {{{2 - let save_view = winsaveview() - let old_foldenable = &foldenable - let old_lazyredraw = &lazyredraw - - let &lazyredraw = 1 - let &foldenable = 0 - call cursor(1, 1) - - let magic = '\m\C^// profile:\s*' - let line = search(magic, 'c') - - call winrestview(save_view) - let &foldenable = old_foldenable - let &lazyredraw = old_lazyredraw - - if line - let profile = matchstr(getline(line), magic . '\zs.*') - else - let extensions = exists('g:syntastic_glsl_extensions') ? g:syntastic_glsl_extensions : s:glsl_extensions - let profile = get(extensions, tolower(expand('%:e', 1)), 'gpu_vert') +function! s:GetProfile(buf) " {{{2 + let profile = matchstr(get(filter(getbufline(a:buf, 1, 100), 'v:val =~# "\\m\\C^//\\s*profile:"'), 0, ''), '\m\C^//\s*profile:\s*\zs.*') + if profile ==# '' + let extensions = syntastic#util#bufVar(a:buf, 'glsl_extensions', s:glsl_extensions) + let profile = get(extensions, tolower(fnamemodify(bufname(a:buf), ':e')), 'gpu_vert') endif return profile diff --git a/sources_non_forked/syntastic/syntax_checkers/go/go.vim b/sources_non_forked/syntastic/syntax_checkers/go/go.vim index f32f505b..c45de08f 100644 --- a/sources_non_forked/syntastic/syntax_checkers/go/go.vim +++ b/sources_non_forked/syntastic/syntax_checkers/go/go.vim @@ -30,6 +30,7 @@ function! SyntaxCheckers_go_go_GetLocList() dict if !exists('s:go_new') let s:go_new = syntastic#util#versionIsAtLeast(self.getVersion(self.getExecEscaped() . ' version'), [1, 5]) endif + let buf = bufnr('') " Check with gofmt first, since `go build` and `go test` might not report " syntax errors in the current file if another file with syntax error is @@ -53,14 +54,14 @@ function! SyntaxCheckers_go_go_GetLocList() dict " Test files, i.e. files with a name ending in `_test.go`, are not " compiled by `go build`, therefore `go test` must be called for those. - if match(expand('%', 1), '\m_test\.go$') == -1 - let cmd = 'build' - let opts = syntastic#util#var('go_go_build_args', s:go_new ? '-buildmode=archive' : '') - let cleanup = 0 - else + if bufname(buf) =~# '\m_test\.go$' let cmd = 'test -c' - let opts = syntastic#util#var('go_go_test_args', s:go_new ? '-buildmode=archive' : '') + let opts = syntastic#util#bufVar(buf, 'go_go_test_args', s:go_new ? '-buildmode=archive' : '') let cleanup = 1 + else + let cmd = 'build' + let opts = syntastic#util#bufVar(buf, 'go_go_build_args', s:go_new ? '-buildmode=archive' : '') + let cleanup = 0 endif let opt_str = (type(opts) != type('') || opts !=# '') ? join(syntastic#util#argsescape(opts)) : opts let makeprg = self.getExecEscaped() . ' ' . cmd . ' ' . opt_str @@ -82,12 +83,12 @@ function! SyntaxCheckers_go_go_GetLocList() dict let errors = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'cwd': expand('%:p:h', 1), + \ 'cwd': fnamemodify(bufname(buf), ':p:h'), \ 'env': {'GOGC': 'off'}, \ 'defaults': {'type': 'e'} }) if cleanup - call delete(expand('%:p:h', 1) . syntastic#util#Slash() . expand('%:p:h:t', 1) . '.test') + call delete(fnamemodify(bufname(buf), ':p:h') . syntastic#util#Slash() . fnamemodify(bufname(buf), ':p:h') . '.test') endif return errors diff --git a/sources_non_forked/syntastic/syntax_checkers/go/gometalinter.vim b/sources_non_forked/syntastic/syntax_checkers/go/gometalinter.vim index 780f49b4..1e084fcf 100644 --- a/sources_non_forked/syntastic/syntax_checkers/go/gometalinter.vim +++ b/sources_non_forked/syntastic/syntax_checkers/go/gometalinter.vim @@ -19,9 +19,10 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_go_gometalinter_GetLocList() dict + let buf = bufnr('') let makeprg = self.makeprgBuild({ \ 'args': '-t', - \ 'fname': syntastic#util#shexpand('%:p:h') }) + \ 'fname': syntastic#util#shescape(fnamemodify(bufname(buf), ':p:h')) }) let errorformat = \ '%f:%l:%c:%trror: %m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/go/gotype.vim b/sources_non_forked/syntastic/syntax_checkers/go/gotype.vim index 37472eeb..ca276eb7 100644 --- a/sources_non_forked/syntastic/syntax_checkers/go/gotype.vim +++ b/sources_non_forked/syntastic/syntax_checkers/go/gotype.vim @@ -19,8 +19,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_go_gotype_GetLocList() dict + let buf = bufnr('') let makeprg = self.makeprgBuild({ - \ 'args': (expand('%', 1) =~# '\m_test\.go$' ? '-a' : ''), + \ 'args': (bufname(buf) =~# '\m_test\.go$' ? '-a' : ''), \ 'fname': '.' }) let errorformat = @@ -34,7 +35,7 @@ function! SyntaxCheckers_go_gotype_GetLocList() dict return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'cwd': expand('%:p:h', 1), + \ 'cwd': fnamemodify(bufname(buf), ':p:h'), \ 'defaults': {'type': 'e'} }) endfunction diff --git a/sources_non_forked/syntastic/syntax_checkers/go/govet.vim b/sources_non_forked/syntastic/syntax_checkers/go/govet.vim index 6c306311..1d8015c5 100644 --- a/sources_non_forked/syntastic/syntax_checkers/go/govet.vim +++ b/sources_non_forked/syntastic/syntax_checkers/go/govet.vim @@ -19,6 +19,7 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_go_govet_GetLocList() dict + let buf = bufnr('') let makeprg = self.getExecEscaped() . ' vet' let errorformat = @@ -33,7 +34,7 @@ function! SyntaxCheckers_go_govet_GetLocList() dict return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'cwd': expand('%:p:h', 1), + \ 'cwd': fnamemodify(bufname(buf), ':p:h'), \ 'defaults': {'type': 'w'} }) endfunction diff --git a/sources_non_forked/syntastic/syntax_checkers/haskell/hdevtools.vim b/sources_non_forked/syntastic/syntax_checkers/haskell/hdevtools.vim index f2313b3f..18346f76 100644 --- a/sources_non_forked/syntastic/syntax_checkers/haskell/hdevtools.vim +++ b/sources_non_forked/syntastic/syntax_checkers/haskell/hdevtools.vim @@ -25,9 +25,10 @@ function! SyntaxCheckers_haskell_hdevtools_GetLocList() dict let g:syntastic_haskell_hdevtools_args = g:hdevtools_options endif + let buf = bufnr('') let makeprg = self.makeprgBuild({ \ 'exe_after': 'check', - \ 'fname': syntastic#util#shexpand('%:p') }) + \ 'fname': syntastic#util#shescape(fnamemodify(bufname(buf), ':p')) }) let errorformat = \ '%-Z %#,'. diff --git a/sources_non_forked/syntastic/syntax_checkers/haskell/hlint.vim b/sources_non_forked/syntastic/syntax_checkers/haskell/hlint.vim index c75ea8b4..949a21b1 100644 --- a/sources_non_forked/syntastic/syntax_checkers/haskell/hlint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/haskell/hlint.vim @@ -14,8 +14,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_haskell_hlint_GetLocList() dict + let buf = bufnr('') let makeprg = self.makeprgBuild({ - \ 'fname': syntastic#util#shexpand('%:p')}) + \ 'fname': syntastic#util#shescape(fnamemodify(bufname(buf), ':p')) }) let errorformat = \ '%E%f:%l:%v: Error while reading hint file\, %m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/haxe/haxe.vim b/sources_non_forked/syntastic/syntax_checkers/haxe/haxe.vim index 99ab4a17..c799624d 100644 --- a/sources_non_forked/syntastic/syntax_checkers/haxe/haxe.vim +++ b/sources_non_forked/syntastic/syntax_checkers/haxe/haxe.vim @@ -19,12 +19,10 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_haxe_haxe_GetLocList() dict - if exists('b:vaxe_hxml') - let hxml = b:vaxe_hxml - elseif exists('g:vaxe_hxml') - let hxml = g:vaxe_hxml - else - let hxml = syntastic#util#findGlobInParent('*.hxml', expand('%:p:h', 1)) + let buf = bufnr('') + let hxml = syntastic#util#bufRawVar(buf, 'vaxe_hxml') + if hxml ==# '' + let hxml = syntastic#util#findGlobInParent('*.hxml', fnamemodify(bufname(buf), ':p:h')) endif let hxml = fnamemodify(hxml, ':p') diff --git a/sources_non_forked/syntastic/syntax_checkers/html/validator.vim b/sources_non_forked/syntastic/syntax_checkers/html/validator.vim index 14a4c64d..2fbb158e 100644 --- a/sources_non_forked/syntastic/syntax_checkers/html/validator.vim +++ b/sources_non_forked/syntastic/syntax_checkers/html/validator.vim @@ -31,7 +31,8 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_html_validator_GetLocList() dict - let fname = syntastic#util#shexpand('%') + let buf = bufnr('') + let fname = syntastic#util#shescape(fnamemodify(bufname(buf), ':p')) let makeprg = self.getExecEscaped() . ' -q -L -s --compressed -F out=gnu -F asciiquotes=yes' . \ (g:syntastic_html_validator_parser !=# '' ? ' -F parser=' . g:syntastic_html_validator_parser : '') . \ (g:syntastic_html_validator_nsfilter !=# '' ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') . diff --git a/sources_non_forked/syntastic/syntax_checkers/html/w3.vim b/sources_non_forked/syntastic/syntax_checkers/html/w3.vim index 37ff11a3..8701f99a 100644 --- a/sources_non_forked/syntastic/syntax_checkers/html/w3.vim +++ b/sources_non_forked/syntastic/syntax_checkers/html/w3.vim @@ -23,8 +23,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_html_w3_GetLocList() dict + let buf = bufnr('') let makeprg = self.getExecEscaped() . ' -q -L -s -F output=json ' . - \ '-F uploaded_file=@' . syntastic#util#shexpand('%:p') . '\;type=text/html ' . + \ '-F uploaded_file=@' . syntastic#util#shescape(fnamemodify(bufname(buf), ':p')) . '\;type=text/html ' . \ g:syntastic_html_w3_api let errorformat = diff --git a/sources_non_forked/syntastic/syntax_checkers/java/checkstyle.vim b/sources_non_forked/syntastic/syntax_checkers/java/checkstyle.vim index f4eee5e8..53018320 100644 --- a/sources_non_forked/syntastic/syntax_checkers/java/checkstyle.vim +++ b/sources_non_forked/syntastic/syntax_checkers/java/checkstyle.vim @@ -40,6 +40,8 @@ endfunction function! SyntaxCheckers_java_checkstyle_GetLocList() dict + let buf = bufnr('') + " classpath if !exists('s:sep') let s:sep = syntastic#util#isRunningWindows() || has('win32unix') ? ';' : ':' @@ -58,7 +60,7 @@ function! SyntaxCheckers_java_checkstyle_GetLocList() dict \ '-f', 'xml' ]) " filename - let fname = syntastic#util#shescape( expand('%:p:h', 1) . syntastic#util#Slash() . expand('%:t', 1) ) + let fname = syntastic#util#shescape( fnamemodify(bufname(buf), ':p:h') . syntastic#util#Slash() . fnamemodify(bufname(buf), ':t') ) if has('win32unix') let fname = substitute(syntastic#util#system('cygpath -m ' . fname), '\m\%x00', '', 'g') endif diff --git a/sources_non_forked/syntastic/syntax_checkers/java/javac.vim b/sources_non_forked/syntastic/syntax_checkers/java/javac.vim index 948c2441..3b5b234c 100644 --- a/sources_non_forked/syntastic/syntax_checkers/java/javac.vim +++ b/sources_non_forked/syntastic/syntax_checkers/java/javac.vim @@ -223,7 +223,7 @@ endfunction " }}}2 function! s:SaveClasspath() " {{{2 " build classpath from lines let path = '' - let lines = getline(1, line('$')) + let lines = getline(1, '$') for l in lines let path = s:AddToClasspath(path, l) endfor @@ -281,7 +281,7 @@ endfunction " }}}2 function! s:SaveConfig() " {{{2 " get lines - let lines = getline(1, line('$')) + let lines = getline(1, '$') if g:syntastic_java_javac_config_file_enabled " save config file lines call writefile(lines, expand(g:syntastic_java_javac_config_file, 1)) diff --git a/sources_non_forked/syntastic/syntax_checkers/javascript/closurecompiler.vim b/sources_non_forked/syntastic/syntax_checkers/javascript/closurecompiler.vim index 8c4190ad..41c1346d 100644 --- a/sources_non_forked/syntastic/syntax_checkers/javascript/closurecompiler.vim +++ b/sources_non_forked/syntastic/syntax_checkers/javascript/closurecompiler.vim @@ -42,11 +42,12 @@ function! SyntaxCheckers_javascript_closurecompiler_GetLocList() dict call syntastic#log#deprecationWarn('javascript_closure_compiler_options', 'javascript_closurecompiler_args') call syntastic#log#deprecationWarn('javascript_closure_compiler_file_list', 'javascript_closurecompiler_file_list') - let flist = expand(get(g:, 'syntastic_javascript_closurecompiler_file_list', ''), 1) + let buf = bufnr('') + let flist = expand(syntastic#util#bufVar(buf, 'javascript_closurecompiler_file_list'), 1) if filereadable(flist) let file_list = map( readfile(flist), 'expand(v:var, 1)' ) else - let file_list = [expand('%', 1)] + let file_list = [bufname(buf)] endif let makeprg = self.makeprgBuild({ diff --git a/sources_non_forked/syntastic/syntax_checkers/javascript/flow.vim b/sources_non_forked/syntastic/syntax_checkers/javascript/flow.vim index 456db2b2..5bed76f2 100644 --- a/sources_non_forked/syntastic/syntax_checkers/javascript/flow.vim +++ b/sources_non_forked/syntastic/syntax_checkers/javascript/flow.vim @@ -29,7 +29,8 @@ function! SyntaxCheckers_javascript_flow_IsAvailable() dict endfunction function! SyntaxCheckers_javascript_flow_GetLocList() dict - if syntastic#util#findFileInParent('.flowconfig', expand('%:p:h', 1)) ==# '' + let buf = bufnr('') + if syntastic#util#findFileInParent('.flowconfig', fnamemodify(bufname(buf), ':p:h')) ==# '' return [] endif diff --git a/sources_non_forked/syntastic/syntax_checkers/limbo/limbo.vim b/sources_non_forked/syntastic/syntax_checkers/limbo/limbo.vim index 0dfe03cd..0c639f95 100644 --- a/sources_non_forked/syntastic/syntax_checkers/limbo/limbo.vim +++ b/sources_non_forked/syntastic/syntax_checkers/limbo/limbo.vim @@ -19,6 +19,7 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_limbo_limbo_GetLocList() dict + let buf = bufnr('') let include = $INFERNO_HOME !=# '' ? '-I$INFERNO_HOME ' : '' " don't generate .dis in current dir while checking syntax, " .dis should be generated by `mk` @@ -27,7 +28,7 @@ function! SyntaxCheckers_limbo_limbo_GetLocList() dict let makeprg = self.makeprgBuild({ 'args_before': include . '-w' . output }) let errorformat = '%E%f:%l:%m' - if expand('%', 1) =~# '\m\.m$' + if bufname(buf) =~# '\m\.m$' let errorformat = '%-G%f:%l: near ` EOF ` : no implementation module,' . errorformat endif diff --git a/sources_non_forked/syntastic/syntax_checkers/nasm/nasm.vim b/sources_non_forked/syntastic/syntax_checkers/nasm/nasm.vim index 7ea86d1a..9797d847 100644 --- a/sources_non_forked/syntastic/syntax_checkers/nasm/nasm.vim +++ b/sources_non_forked/syntastic/syntax_checkers/nasm/nasm.vim @@ -19,9 +19,10 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_nasm_nasm_GetLocList() dict + let buf = bufnr('') let makeprg = self.makeprgBuild({ \ 'args_after': '-X gnu' . - \ ' -I ' . syntastic#util#shescape(expand('%:p:h', 1) . syntastic#util#Slash()) . + \ ' -I ' . syntastic#util#shescape(fnamemodify(bufname(buf), ':p:h') . syntastic#util#Slash()) . \ ' ' . syntastic#c#NullOutput() }) let errorformat = '%f:%l: %t%*[^:]: %m' diff --git a/sources_non_forked/syntastic/syntax_checkers/ocaml/camlp4o.vim b/sources_non_forked/syntastic/syntax_checkers/ocaml/camlp4o.vim index f7f34e71..0a1c4213 100644 --- a/sources_non_forked/syntastic/syntax_checkers/ocaml/camlp4o.vim +++ b/sources_non_forked/syntastic/syntax_checkers/ocaml/camlp4o.vim @@ -44,7 +44,8 @@ function! SyntaxCheckers_ocaml_camlp4o_IsAvailable() dict " {{{1 endfunction " }}}1 function! SyntaxCheckers_ocaml_camlp4o_GetLocList() dict " {{{1 - let makeprg = s:GetMakeprg() + let buf = bufnr('') + let makeprg = s:GetMakeprg(buf) if makeprg ==# '' return [] endif @@ -65,7 +66,7 @@ function! SyntaxCheckers_ocaml_camlp4o_GetLocList() dict " {{{1 let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr('')} }) + \ 'defaults': {'bufnr': buf} }) for e in loclist if get(e, 'col', 0) && get(e, 'nr', 0) @@ -79,40 +80,41 @@ endfunction " }}}1 " Utilities {{{1 -function! s:GetMakeprg() " {{{2 +function! s:GetMakeprg(buf) " {{{2 return \ g:syntastic_ocaml_use_ocamlc ? g:syntastic_ocaml_use_ocamlc : - \ (g:syntastic_ocaml_use_ocamlbuild && isdirectory('_build')) ? s:GetOcamlcMakeprg() : - \ s:GetOtherMakeprg() + \ (g:syntastic_ocaml_use_ocamlbuild && isdirectory('_build')) ? s:GetOcamlcMakeprg(a:buf) : + \ s:GetOtherMakeprg(a:buf) endfunction " }}}2 -function! s:GetOcamlcMakeprg() " {{{2 +function! s:GetOcamlcMakeprg(buf) " {{{2 let build_cmd = g:syntastic_ocaml_use_janestreet_core ? \ 'ocamlc -I ' . syntastic#util#shexpand(g:syntastic_ocaml_janestreet_core_dir) : 'ocamlc' - let build_cmd .= ' -c ' . syntastic#util#shexpand('%') + let build_cmd .= ' -c ' . syntastic#util#shescape(bufname(a:buf)) return build_cmd endfunction " }}}2 -function! s:GetOcamlBuildMakeprg() " {{{2 +function! s:GetOcamlBuildMakeprg(buf) " {{{2 return 'ocamlbuild -quiet -no-log -tag annot,' . s:ocamlpp . ' -no-links -no-hygiene -no-sanitize ' . - \ syntastic#util#shexpand('%:r') . '.cmi' + \ syntastic#util#shexpand(fnamemodify(bufname(a:buf), ':r')) . '.cmi' endfunction " }}}2 -function! s:GetOtherMakeprg() " {{{2 +function! s:GetOtherMakeprg(buf) " {{{2 "TODO: give this function a better name? " "TODO: should use throw/catch instead of returning an empty makeprg - let extension = expand('%:e', 1) + let fname = bufname(a:buf) + let extension = fnamemodify(fname, ':e') let makeprg = '' if stridx(extension, 'mly') >= 0 && executable('menhir') " ocamlyacc output can't be redirected, so use menhir - let makeprg = 'menhir --only-preprocess ' . syntastic#util#shexpand('%') . ' >' . syntastic#util#DevNull() + let makeprg = 'menhir --only-preprocess ' . syntastic#util#shescape(fname) . ' >' . syntastic#util#DevNull() elseif stridx(extension,'mll') >= 0 && executable('ocamllex') - let makeprg = 'ocamllex -q ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shexpand('%') + let makeprg = 'ocamllex -q ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shescape(fname) else - let makeprg = 'camlp4o ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shexpand('%') + let makeprg = 'camlp4o ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shescape(fname) endif return makeprg diff --git a/sources_non_forked/syntastic/syntax_checkers/perl/perl.vim b/sources_non_forked/syntastic/syntax_checkers/perl/perl.vim index ca3d0d76..c21de2c6 100644 --- a/sources_non_forked/syntastic/syntax_checkers/perl/perl.vim +++ b/sources_non_forked/syntastic/syntax_checkers/perl/perl.vim @@ -51,13 +51,14 @@ function! SyntaxCheckers_perl_perl_IsAvailable() dict " {{{1 endfunction " }}}1 function! SyntaxCheckers_perl_perl_GetLocList() dict " {{{1 + let buf = bufnr('') if type(g:syntastic_perl_lib_path) == type('') call syntastic#log#oneTimeWarn('variable g:syntastic_perl_lib_path should be a list') let includes = split(g:syntastic_perl_lib_path, ',') else - let includes = copy(syntastic#util#var('perl_lib_path', [])) + let includes = copy(syntastic#util#bufVar(buf, 'perl_lib_path', [])) endif - let shebang = syntastic#util#parseShebang() + let shebang = syntastic#util#parseShebang(buf) let extra = map(includes, '"-I" . v:val') + \ (index(shebang['args'], '-T') >= 0 ? ['-T'] : []) + \ (index(shebang['args'], '-t') >= 0 ? ['-t'] : []) diff --git a/sources_non_forked/syntastic/syntax_checkers/r/lint.vim b/sources_non_forked/syntastic/syntax_checkers/r/lint.vim index 854c1709..0e4f0441 100644 --- a/sources_non_forked/syntastic/syntax_checkers/r/lint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/r/lint.vim @@ -43,11 +43,13 @@ function! SyntaxCheckers_r_lint_IsAvailable() dict endfunction function! SyntaxCheckers_r_lint_GetLocList() dict + let buf = bufnr('') + let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : '' let makeprg = self.getExecEscaped() . ' --slave --restore --no-save' . \ ' -e ' . syntastic#util#shescape(setwd . 'library(lint); ' . \ 'try(lint(commandArgs(TRUE), ' . g:syntastic_r_lint_styles . '))') . - \ ' --args ' . syntastic#util#shexpand('%') + \ ' --args ' . syntastic#util#shescape(bufname(buf)) let errorformat = \ '%t:%f:%l:%v: %m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/r/lintr.vim b/sources_non_forked/syntastic/syntax_checkers/r/lintr.vim index 7c71ec07..19068c9c 100644 --- a/sources_non_forked/syntastic/syntax_checkers/r/lintr.vim +++ b/sources_non_forked/syntastic/syntax_checkers/r/lintr.vim @@ -38,7 +38,7 @@ set cpo&vim function! SyntaxCheckers_r_lintr_GetHighlightRegex(item) let term = matchstr(a:item['text'], "\\m'\\zs[^']\\+\\ze'") - return term != '' ? '\V' . escape(term, '\') : '' + return term !=# '' ? '\V' . escape(term, '\') : '' endfunction function! SyntaxCheckers_r_lintr_IsAvailable() dict @@ -50,11 +50,13 @@ function! SyntaxCheckers_r_lintr_IsAvailable() dict endfunction function! SyntaxCheckers_r_lintr_GetLocList() dict + let buf = bufnr('') + let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : '' let makeprg = self.getExecEscaped() . ' --slave --no-restore --no-save' . \ ' -e ' . syntastic#util#shescape(setwd . 'suppressPackageStartupMessages(library(lintr)); ' . \ 'lint(cache = ' . g:syntastic_r_lintr_cache . ', commandArgs(TRUE), ' . g:syntastic_r_lintr_linters . ')') . - \ ' --args ' . syntastic#util#shexpand('%') + \ ' --args ' . syntastic#util#shescape(bufname(buf)) let errorformat = \ '%W%f:%l:%c: style: %m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/r/svtools.vim b/sources_non_forked/syntastic/syntax_checkers/r/svtools.vim index d2a6a748..eb85f8aa 100644 --- a/sources_non_forked/syntastic/syntax_checkers/r/svtools.vim +++ b/sources_non_forked/syntastic/syntax_checkers/r/svtools.vim @@ -46,11 +46,13 @@ function! SyntaxCheckers_r_svtools_IsAvailable() dict endfunction function! SyntaxCheckers_r_svtools_GetLocList() dict + let buf = bufnr('') + let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : '' let makeprg = self.getExecEscaped() . ' --slave --restore --no-save' . \ ' -e ' . syntastic#util#shescape(setwd . 'library(svTools); ' . \ 'try(lint(commandArgs(TRUE), filename = commandArgs(TRUE), type = "flat", sep = ":"))') . - \ ' --args ' . syntastic#util#shexpand('%') + \ ' --args ' . syntastic#util#shescape(bufname(buf)) let errorformat = \ '%trror:%f:%\s%#%l:%\s%#%v:%m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/rst/sphinx.vim b/sources_non_forked/syntastic/syntax_checkers/rst/sphinx.vim index 3c211f4a..1ef058b3 100644 --- a/sources_non_forked/syntastic/syntax_checkers/rst/sphinx.vim +++ b/sources_non_forked/syntastic/syntax_checkers/rst/sphinx.vim @@ -26,11 +26,12 @@ augroup syntastic augroup END function! SyntaxCheckers_rst_sphinx_GetLocList() dict + let buf = bufnr('') - let srcdir = syntastic#util#var('rst_sphinx_source_dir') - call self.log('g:syntastic_rst_sphinx_source_dir =', srcdir) + let srcdir = syntastic#util#bufVar(buf, 'rst_sphinx_source_dir') + call self.log('syntastic_rst_sphinx_source_dir =', srcdir) if srcdir ==# '' - let config = syntastic#util#findFileInParent('conf.py', expand('%:p:h', 1)) + let config = syntastic#util#findFileInParent('conf.py', fnamemodify(bufname(buf), ':p:h')) if config ==# '' || !filereadable(config) call self.log('conf.py file not found') return [] @@ -38,10 +39,10 @@ function! SyntaxCheckers_rst_sphinx_GetLocList() dict let srcdir = fnamemodify(config, ':p:h') endif - let confdir = syntastic#util#var('rst_sphinx_config_dir') - call self.log('g:syntastic_rst_sphinx_config_dir =', confdir) + let confdir = syntastic#util#bufVar(buf, 'rst_sphinx_config_dir') + call self.log('syntastic_rst_sphinx_config_dir =', confdir) if confdir ==# '' - let config = syntastic#util#findFileInParent('conf.py', expand('%:p:h', 1)) + let config = syntastic#util#findFileInParent('conf.py', fnamemodify(bufname(buf), ':p:h')) let confdir = (config !=# '' && filereadable(config)) ? fnamemodify(config, ':p:h') : srcdir endif diff --git a/sources_non_forked/syntastic/syntax_checkers/sass/sass.vim b/sources_non_forked/syntastic/syntax_checkers/sass/sass.vim index 5f6194f2..f4dd2f6c 100644 --- a/sources_non_forked/syntastic/syntax_checkers/sass/sass.vim +++ b/sources_non_forked/syntastic/syntax_checkers/sass/sass.vim @@ -15,8 +15,8 @@ if exists('g:loaded_syntastic_sass_sass_checker') endif let g:loaded_syntastic_sass_sass_checker = 1 -"sass caching for large files drastically speeds up the checking, but store it -"in a temp location otherwise sass puts .sass_cache dirs in the users project +" sass caching for large files drastically speeds up the checking, but store it +" in a temp location otherwise sass puts .sass_cache dirs in the users project let s:sass_cache_location = syntastic#util#tmpdir() lockvar s:sass_cache_location @@ -24,12 +24,12 @@ augroup syntastic autocmd VimLeave * call syntastic#util#rmrf(s:sass_cache_location) augroup END -"By default do not check partials as unknown variables are a syntax error +" By default do not check partials as unknown variables are a syntax error if !exists('g:syntastic_sass_check_partials') let g:syntastic_sass_check_partials = 0 endif -"use compass imports if available +" use compass imports if available let s:imports = '' if executable('compass') let s:imports = '--compass' @@ -39,7 +39,8 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_sass_sass_GetLocList() dict - if !g:syntastic_sass_check_partials && expand('%:t', 1)[0] ==# '_' + let buf = bufnr('') + if !syntastic#util#bufVar(buf, 'sass_check_partials') && fnamemodify(bufname(buf), ':t')[0] ==# '_' return [] endif diff --git a/sources_non_forked/syntastic/syntax_checkers/scala/fsc.vim b/sources_non_forked/syntastic/syntax_checkers/scala/fsc.vim index 0398e7ac..811443dd 100644 --- a/sources_non_forked/syntastic/syntax_checkers/scala/fsc.vim +++ b/sources_non_forked/syntastic/syntax_checkers/scala/fsc.vim @@ -24,9 +24,10 @@ function! SyntaxCheckers_scala_fsc_GetLocList() dict " fsc has some serious problems with the " working directory changing after being started " that's why we better pass an absolute path + let buf = bufnr('') let makeprg = self.makeprgBuild({ \ 'args': '-Ystop-after:parser', - \ 'fname': syntastic#util#shexpand('%:p') }) + \ 'fname': syntastic#util#shescape(fnamemodify(bufname(buf), ':p')) }) let errorformat = \ '%E%f:%l: %trror: %m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/sh/sh.vim b/sources_non_forked/syntastic/syntax_checkers/sh/sh.vim index 395b81b3..007eec4c 100644 --- a/sources_non_forked/syntastic/syntax_checkers/sh/sh.vim +++ b/sources_non_forked/syntastic/syntax_checkers/sh/sh.vim @@ -19,21 +19,23 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_sh_sh_IsAvailable() dict " {{{1 - call self.log('shell =', s:GetShell()) - return s:IsShellValid() + let buf = bufnr('') + call self.log('shell =', s:GetShell(buf)) + return s:IsShellValid(buf) endfunction " }}}1 function! SyntaxCheckers_sh_sh_GetLocList() dict " {{{1 - if s:GetShell() ==# 'zsh' + let buf = bufnr('') + if s:GetShell(buf) ==# 'zsh' return s:ForwardToZshChecker() endif - if !s:IsShellValid() + if !s:IsShellValid(buf) return [] endif let makeprg = self.makeprgBuild({ - \ 'exe': s:GetShell(), + \ 'exe': s:GetShell(buf), \ 'args_after': '-n' }) let errorformat = '%f: line %l: %m' @@ -45,29 +47,29 @@ endfunction " }}}1 " Utilities {{{1 -function! s:GetShell() " {{{2 - if !exists('b:shell') || b:shell ==# '' - let b:shell = '' - let shebang = syntastic#util#parseShebang()['exe'] +function! s:GetShell(buf) " {{{2 + let shell = syntastic#util#getbufvar(a:buf, 'shell') + if shell ==# '' + let shebang = syntastic#util#parseShebang(a:buf)['exe'] if shebang !=# '' if shebang[-strlen('bash'):-1] ==# 'bash' - let b:shell = 'bash' + let shell = 'bash' elseif shebang[-strlen('zsh'):-1] ==# 'zsh' - let b:shell = 'zsh' + let shell = 'zsh' elseif shebang[-strlen('sh'):-1] ==# 'sh' - let b:shell = 'sh' + let shell = 'sh' endif endif " try to use env variable in case no shebang could be found - if b:shell ==# '' - let b:shell = fnamemodify($SHELL, ':t') + if shell ==# '' + let shell = fnamemodify($SHELL, ':t') endif endif - return b:shell + return shell endfunction " }}}2 -function! s:IsShellValid() " {{{2 - let shell = s:GetShell() +function! s:IsShellValid(buf) " {{{2 + let shell = s:GetShell(a:buf) return shell !=# '' && executable(shell) endfunction " }}}2 diff --git a/sources_non_forked/syntastic/syntax_checkers/sh/shellcheck.vim b/sources_non_forked/syntastic/syntax_checkers/sh/shellcheck.vim index 5189e199..cf86c7e3 100644 --- a/sources_non_forked/syntastic/syntax_checkers/sh/shellcheck.vim +++ b/sources_non_forked/syntastic/syntax_checkers/sh/shellcheck.vim @@ -12,8 +12,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_sh_shellcheck_GetLocList() dict " {{{1 + let buf = bufnr('') let makeprg = self.makeprgBuild({ - \ 'args': s:GetShell(), + \ 'args': s:GetShell(buf), \ 'args_after': '-f gcc' }) let errorformat = @@ -38,15 +39,15 @@ endfunction " }}}1 " Utilities {{{1 -function! s:GetShell() " {{{2 +function! s:GetShell(buf) " {{{2 let sh = '' - if syntastic#util#parseShebang()['exe'] ==# '' - if syntastic#util#rawVar('is_kornshell', 0) || syntastic#util#rawVar('is_posix', 0) + if syntastic#util#parseShebang(a:buf)['exe'] ==# '' + if syntastic#util#bufRawVar(a:buf, 'is_kornshell', 0) || syntastic#util#bufRawVar(a:buf, 'is_posix', 0) let sh = 'ksh' - elseif syntastic#util#rawVar('is_bash', 0) + elseif syntastic#util#bufRawVar(a:buf, 'is_bash', 0) let sh = 'bash' - elseif syntastic#util#rawVar('is_sh', 0) + elseif syntastic#util#bufRawVar(a:buf, 'is_sh', 0) let sh = 'sh' endif endif diff --git a/sources_non_forked/syntastic/syntax_checkers/vala/valac.vim b/sources_non_forked/syntastic/syntax_checkers/vala/valac.vim index 8b11d456..6c3fef70 100644 --- a/sources_non_forked/syntastic/syntax_checkers/vala/valac.vim +++ b/sources_non_forked/syntastic/syntax_checkers/vala/valac.vim @@ -44,19 +44,17 @@ endfunction " }}}1 " Utilities {{{1 function! s:GetValaOpts(buf, name, comment, cmd) " {{{2 - let var = syntastic#util#var('vala_' . a:name) + let var = syntastic#util#bufVar(a:buf, 'vala_' . a:name) if type(var) == type([]) let opts = map(copy(var), 'syntastic#util#shescape(v:val)') elseif type(var) == type('') if var !=# '' - let opts = split(var, '\s\+') + let opts = split(var, '\m\s\+') else let opts = [] for line in filter(getbufline(a:buf, 1, 100), 'v:val =~# ' . string('\m^//\s\+' . a:comment . ':\s*')) - call extend(opts, split( matchstr(line, '\m^//\s\+' . a:comment . ':\s*\zs.*'), '\s\+' )) + call extend(opts, split( matchstr(line, '\m^//\s\+' . a:comment . ':\s*\zs.*'), '\m\s\+' )) endfor - - call map( filter(opts, 'v:val !=# ""'), 'syntastic#util#shescape(v:val)' ) endif else call syntastic#log#error('syntastic_vala_' . a:name . ' must be either a list, or a string') diff --git a/sources_non_forked/syntastic/syntax_checkers/vim/vimlint.vim b/sources_non_forked/syntastic/syntax_checkers/vim/vimlint.vim index 19cab49e..210eeece 100644 --- a/sources_non_forked/syntastic/syntax_checkers/vim/vimlint.vim +++ b/sources_non_forked/syntastic/syntax_checkers/vim/vimlint.vim @@ -44,6 +44,8 @@ function! SyntaxCheckers_vim_vimlint_IsAvailable() dict " {{{1 endfunction " }}}1 function! SyntaxCheckers_vim_vimlint_GetLocList() dict " {{{1 + let buf = bufnr('') + " EVL102: unused variable v " EVL103: unused argument v " EVL104: variable may not be initialized on some execution path: v @@ -67,17 +69,15 @@ function! SyntaxCheckers_vim_vimlint_GetLocList() dict " {{{1 \ 'EVL204': 3, \ 'EVL205': 3 } - if exists('g:syntastic_vimlint_options') || exists('b:syntastic_vimlint_options') - let opts = syntastic#util#var('vimlint_options') - if type(opts) == type({}) - let options = filter(copy(opts), 'v:key =~# "\\m^EVL"') - call extend(param, options, 'force') - endif + let opts = syntastic#util#bufVar(buf, 'vimlint_options') + if type(opts) == type({}) + let options = filter(copy(opts), 'v:key =~# "\\m^EVL"') + call extend(param, options, 'force') endif call self.log('options =', param) - return vimlint#vimlint(expand('%', 1), param) + return vimlint#vimlint(bufname(buf), param) endfunction " }}}1 " Utilities {{{1 diff --git a/sources_non_forked/syntastic/syntax_checkers/xquery/basex.vim b/sources_non_forked/syntastic/syntax_checkers/xquery/basex.vim index 640a1910..0d867ad3 100644 --- a/sources_non_forked/syntastic/syntax_checkers/xquery/basex.vim +++ b/sources_non_forked/syntastic/syntax_checkers/xquery/basex.vim @@ -18,10 +18,11 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_xquery_basex_GetLocList() dict + let buf = bufnr('') let makeprg = self.makeprgBuild({ \ 'args_after': '-z', \ 'fname_before': '-q', - \ 'fname': syntastic#util#shescape('inspect:module("' . escape(expand('%:p', 1), '"') . '")') }) + \ 'fname': syntastic#util#shescape('inspect:module("' . escape(fnamemodify(bufname(buf), ':p'), '"') . '")') }) let errorformat = \ '%f:%l:%c:%t:%n:%m,' . diff --git a/sources_non_forked/syntastic/syntax_checkers/yaml/yamlxs.vim b/sources_non_forked/syntastic/syntax_checkers/yaml/yamlxs.vim index ace118a4..55f8c64e 100644 --- a/sources_non_forked/syntastic/syntax_checkers/yaml/yamlxs.vim +++ b/sources_non_forked/syntastic/syntax_checkers/yaml/yamlxs.vim @@ -29,13 +29,14 @@ function! SyntaxCheckers_yaml_yamlxs_IsAvailable() dict " don't call executable() here, to allow things like " let g:syntastic_perl_interpreter='/usr/bin/env perl' - silent! call syntastic#util#system(self.getExecEscaped() . ' ' . s:Modules() . ' -e ' . syntastic#util#shescape('exit(0)')) + silent! call syntastic#util#system(self.getExecEscaped() . ' ' . s:Modules(bufnr('')) . ' -e ' . syntastic#util#shescape('exit(0)')) return v:shell_error == 0 endfunction function! SyntaxCheckers_yaml_yamlxs_GetLocList() dict + let buf = bufnr('') let makeprg = self.makeprgBuild({ - \ 'args_before': s:Modules() . ' -e ' . syntastic#util#shescape('YAML::XS::LoadFile($ARGV[0])') }) + \ 'args_before': s:Modules(buf) . ' -e ' . syntastic#util#shescape('YAML::XS::LoadFile($ARGV[0])') }) let errorformat = \ '%EYAML::XS::Load Error: The problem:,' . @@ -51,12 +52,13 @@ function! SyntaxCheckers_yaml_yamlxs_GetLocList() dict \ 'defaults': {'bufnr': bufnr('')} }) endfunction -function s:Modules() - if type(g:syntastic_perl_lib_path) == type('') - call syntastic#log#oneTimeWarn('variable g:syntastic_perl_lib_path should be a list') - let includes = split(g:syntastic_perl_lib_path, ',') +function s:Modules(buf) + let lib_path = syntastic#util#bufVar(a:buf, 'perl_lib_path') + if type(lib_path) == type('') + call syntastic#log#oneTimeWarn('variable syntastic_perl_lib_path should be a list') + let includes = split(lib_path, ',') else - let includes = copy(syntastic#util#var('perl_lib_path')) + let includes = copy(lib_path) endif return join(map(includes, '"-I" . v:val') + ['-MYAML::XS']) endfunction diff --git a/sources_non_forked/vim-coffee-script/Copying.md b/sources_non_forked/vim-coffee-script/Copying.md index a31ad2ff..9520fb91 100644 --- a/sources_non_forked/vim-coffee-script/Copying.md +++ b/sources_non_forked/vim-coffee-script/Copying.md @@ -1,3 +1,14 @@ +All files except: + +ftdetect/vim-literate-coffeescript.vim +indent/litcoffee.vim +syntax/litcoffee.vim +test/test.coffee.md +test/test.litcoffee +test/test.png + +Issued under WTFPL: + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 @@ -13,3 +24,31 @@ 0. You just DO WHAT THE FUCK YOU WANT TO. +These files issed under this license: + +ftdetect/vim-literate-coffeescript.vim +indent/litcoffee.vim +syntax/litcoffee.vim +test/test.coffee.md +test/test.litcoffee +test/test.png + +Copyright (c) 2013 Michael Smith + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sources_non_forked/vim-coffee-script/Readme.md b/sources_non_forked/vim-coffee-script/Readme.md index 08d61f1d..053a71b8 100644 --- a/sources_non_forked/vim-coffee-script/Readme.md +++ b/sources_non_forked/vim-coffee-script/Readme.md @@ -337,23 +337,15 @@ It behaves very similar to `:make`, described [above](#compile-to-javascript). ## Literate CoffeeScript -Literate CoffeeScript syntax and indent support is provided by -[vim-literate-coffeescript]. The `Coffee` commands detect when they're running -on a litcoffee file and pass the `--literate` flag to their respective tools, -but at this time the commands are not automatically loaded when a litcoffee file -is opened. +Literate CoffeeScript syntax and indent support is now built in! The `Coffee` +commands detect when they're running on a litcoffee file and pass the +`--literate` flag to their respective tools. -[vim-literate-coffeescript]: https://github.com/mintplant/vim-literate-coffeescript - -To load them, run - - runtime ftplugin/coffee.vim - -while inside a litcoffee buffer. To do this automatically, add - - autocmd FileType litcoffee runtime ftplugin/coffee.vim - -to your vimrc. +Literate CoffeeScript syntax and indent support was written by @mintplant +(Michael Smith). A standalone repo +[exists](https://github.com/jwhitley/vim-literate-coffeescript), but you'll +need to copy the `ftplugin/litcoffee.vim` file or set up an autocmd to get the +`Coffee` commands to be automatically loaded for litcoffee files. ## CoffeeScript in HTML diff --git a/sources_non_forked/vim-coffee-script/ftdetect/vim-literate-coffeescript.vim b/sources_non_forked/vim-coffee-script/ftdetect/vim-literate-coffeescript.vim new file mode 100644 index 00000000..7f666246 --- /dev/null +++ b/sources_non_forked/vim-coffee-script/ftdetect/vim-literate-coffeescript.vim @@ -0,0 +1,8 @@ +" Language: Literate CoffeeScript +" Maintainer: Michael Smith +" URL: https://github.com/mintplant/vim-literate-coffeescript +" License: MIT + +autocmd BufNewFile,BufRead *.litcoffee set filetype=litcoffee +autocmd BufNewFile,BufRead *.coffee.md set filetype=litcoffee + diff --git a/sources_non_forked/vim-coffee-script/ftplugin/litcoffee.vim b/sources_non_forked/vim-coffee-script/ftplugin/litcoffee.vim new file mode 100644 index 00000000..febc730c --- /dev/null +++ b/sources_non_forked/vim-coffee-script/ftplugin/litcoffee.vim @@ -0,0 +1 @@ +runtime ftplugin/coffee.vim diff --git a/sources_non_forked/vim-coffee-script/indent/litcoffee.vim b/sources_non_forked/vim-coffee-script/indent/litcoffee.vim new file mode 100644 index 00000000..599cbea8 --- /dev/null +++ b/sources_non_forked/vim-coffee-script/indent/litcoffee.vim @@ -0,0 +1,22 @@ +if exists('b:did_indent') + finish +endif + +runtime! indent/coffee.vim + +let b:did_indent = 1 + +setlocal indentexpr=GetLitCoffeeIndent() + +if exists('*GetLitCoffeeIndent') + finish +endif + +function GetLitCoffeeIndent() + if searchpair('^ \|\t', '', '$', 'bWnm') > 0 + return GetCoffeeIndent(v:lnum) + else + return -1 + endif +endfunc + diff --git a/sources_non_forked/vim-coffee-script/syntax/coffee.vim b/sources_non_forked/vim-coffee-script/syntax/coffee.vim index 973bb547..88917fe7 100644 --- a/sources_non_forked/vim-coffee-script/syntax/coffee.vim +++ b/sources_non_forked/vim-coffee-script/syntax/coffee.vim @@ -32,7 +32,7 @@ hi def link coffeeConditional Conditional syn match coffeeException /\<\%(try\|catch\|finally\)\>/ display hi def link coffeeException Exception -syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\|debugger\|import\|export\)\>/ +syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\|debugger\|import\|export\|await\)\>/ \ display " The `own` keyword is only a keyword after `for`. syn match coffeeKeyword /\/ contained containedin=coffeeRepeat diff --git a/sources_non_forked/vim-coffee-script/syntax/litcoffee.vim b/sources_non_forked/vim-coffee-script/syntax/litcoffee.vim new file mode 100644 index 00000000..c6a4423c --- /dev/null +++ b/sources_non_forked/vim-coffee-script/syntax/litcoffee.vim @@ -0,0 +1,23 @@ +" Language: Literate CoffeeScript +" Maintainer: Michael Smith +" URL: https://github.com/mintplant/vim-literate-coffeescript +" License: MIT + +if exists('b:current_syntax') && b:current_syntax == 'litcoffee' + finish +endif + +syn include @markdown syntax/markdown.vim +syn include @coffee syntax/coffee.vim + +" Partition the file into notCoffee and inlineCoffee. Each line will match +" exactly one of these regions. notCoffee matches with a zero-width +" look-behind. +syn region notCoffee start='^\%( \|\t\)\@ + @variables = [{name: 'arguments', type: 'arguments'}] + @positions = {} + Scope.root = this unless @parent + +Adds a new variable or overrides an existing one. + + add: (name, type, immediate) -> + return @parent.add name, type, immediate if @shared and not immediate + if Object::hasOwnProperty.call @positions, name + @variables[@positions[name]].type = type + else + @positions[name] = @variables.push({name, type}) - 1 + +When `super` is called, we need to find the name of the current method we're +in, so that we know how to invoke the same method of the parent class. This +can get complicated if super is being called from an inner function. +`namedMethod` will walk up the scope tree until it either finds the first +function object that has a name filled in, or bottoms out. + + namedMethod: -> + return @method if @method.name or !@parent + @parent.namedMethod() + +Look up a variable name in lexical scope, and declare it if it does not +already exist. + + find: (name) -> + return yes if @check name + @add name, 'var' + no + +Reserve a variable name as originating from a function parameter for this +scope. No `var` required for internal references. + + parameter: (name) -> + return if @shared and @parent.check name, yes + @add name, 'param' + +Just check to see if a variable has already been declared, without reserving, +walks up to the root scope. + + check: (name) -> + !!(@type(name) or @parent?.check(name)) + +Generate a temporary variable name at the given index. + + temporary: (name, index) -> + if name.length > 1 + '_' + name + if index > 1 then index - 1 else '' + else + '_' + (index + parseInt name, 36).toString(36).replace /\d/g, 'a' + +Gets the type of a variable. + + type: (name) -> + return v.type for v in @variables when v.name is name + null + +If we need to store an intermediate result, find an available name for a +compiler-generated variable. `_var`, `_var2`, and so on... + + freeVariable: (name, reserve=true) -> + index = 0 + index++ while @check((temp = @temporary name, index)) + @add temp, 'var', yes if reserve + temp + +Ensure that an assignment is made at the top of this scope +(or at the top-level scope, if requested). + + assign: (name, value) -> + @add name, {value, assigned: yes}, yes + @hasAssignments = yes + +Does this scope have any declared variables? + + hasDeclarations: -> + !!@declaredVariables().length + +Return the list of variables first declared in this scope. + + declaredVariables: -> + realVars = [] + tempVars = [] + for v in @variables when v.type is 'var' + (if v.name.charAt(0) is '_' then tempVars else realVars).push v.name + realVars.sort().concat tempVars.sort() + +Return the list of assignments that are supposed to be made at the top +of this scope. + + assignedVariables: -> + "#{v.name} = #{v.type.value}" for v in @variables when v.type.assigned + diff --git a/sources_non_forked/vim-coffee-script/test/test.litcoffee b/sources_non_forked/vim-coffee-script/test/test.litcoffee new file mode 100644 index 00000000..62b99b7d --- /dev/null +++ b/sources_non_forked/vim-coffee-script/test/test.litcoffee @@ -0,0 +1,117 @@ +The **Scope** class regulates lexical scoping within CoffeeScript. As you +generate code, you create a tree of scopes in the same shape as the nested +function bodies. Each scope knows about the variables declared within it, +and has a reference to its parent enclosing scope. In this way, we know which +variables are new and need to be declared with `var`, and which are shared +with external scopes. + +Import the helpers we plan to use. + + {extend, last} = require './helpers' + + exports.Scope = class Scope + +The `root` is the top-level **Scope** object for a given file. + + @root: null + +Initialize a scope with its parent, for lookups up the chain, +as well as a reference to the **Block** node it belongs to, which is +where it should declare its variables, and a reference to the function that +it belongs to. + + constructor: (@parent, @expressions, @method) -> + @variables = [{name: 'arguments', type: 'arguments'}] + @positions = {} + Scope.root = this unless @parent + +Adds a new variable or overrides an existing one. + + add: (name, type, immediate) -> + return @parent.add name, type, immediate if @shared and not immediate + if Object::hasOwnProperty.call @positions, name + @variables[@positions[name]].type = type + else + @positions[name] = @variables.push({name, type}) - 1 + +When `super` is called, we need to find the name of the current method we're +in, so that we know how to invoke the same method of the parent class. This +can get complicated if super is being called from an inner function. +`namedMethod` will walk up the scope tree until it either finds the first +function object that has a name filled in, or bottoms out. + + namedMethod: -> + return @method if @method.name or !@parent + @parent.namedMethod() + +Look up a variable name in lexical scope, and declare it if it does not +already exist. + + find: (name) -> + return yes if @check name + @add name, 'var' + no + +Reserve a variable name as originating from a function parameter for this +scope. No `var` required for internal references. + + parameter: (name) -> + return if @shared and @parent.check name, yes + @add name, 'param' + +Just check to see if a variable has already been declared, without reserving, +walks up to the root scope. + + check: (name) -> + !!(@type(name) or @parent?.check(name)) + +Generate a temporary variable name at the given index. + + temporary: (name, index) -> + if name.length > 1 + '_' + name + if index > 1 then index - 1 else '' + else + '_' + (index + parseInt name, 36).toString(36).replace /\d/g, 'a' + +Gets the type of a variable. + + type: (name) -> + return v.type for v in @variables when v.name is name + null + +If we need to store an intermediate result, find an available name for a +compiler-generated variable. `_var`, `_var2`, and so on... + + freeVariable: (name, reserve=true) -> + index = 0 + index++ while @check((temp = @temporary name, index)) + @add temp, 'var', yes if reserve + temp + +Ensure that an assignment is made at the top of this scope +(or at the top-level scope, if requested). + + assign: (name, value) -> + @add name, {value, assigned: yes}, yes + @hasAssignments = yes + +Does this scope have any declared variables? + + hasDeclarations: -> + !!@declaredVariables().length + +Return the list of variables first declared in this scope. + + declaredVariables: -> + realVars = [] + tempVars = [] + for v in @variables when v.type is 'var' + (if v.name.charAt(0) is '_' then tempVars else realVars).push v.name + realVars.sort().concat tempVars.sort() + +Return the list of assignments that are supposed to be made at the top +of this scope. + + assignedVariables: -> + "#{v.name} = #{v.type.value}" for v in @variables when v.type.assigned + diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index 1185ff15..66948f70 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -1060,13 +1060,14 @@ function! s:Commit(args, ...) abort else noautocmd silent execute '!'.command.' > '.outfile.' 2> '.errorfile endif + let error = v:shell_error finally execute cd.'`=dir`' endtry if !has('gui_running') redraw! endif - if !v:shell_error + if !error if filereadable(outfile) for line in readfile(outfile) echo line diff --git a/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md b/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md index 467b1287..e6b5f203 100644 --- a/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md +++ b/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md @@ -4,10 +4,10 @@ Write here what's happening and what you're expecting instead of... ### Steps to reproduce: -Please create a reproducible case of your problem. If this step is +Please create a reproducible case of your problem. If this step is not provided, the issue will be **closed** -Re produce it with a minimal `vimrc` with all plugins disabled and +Re produce it with a minimal `vimrc` with all plugins disabled and only `vim-go` enabled: 1. @@ -20,7 +20,6 @@ Add here your current configuration and additional information that might be useful, such as: * `vimrc` you used to reproduce -* vim version: +* vim version: * vim-go version: -* go version: - +* go version: diff --git a/sources_non_forked/vim-go/.travis.yml b/sources_non_forked/vim-go/.travis.yml index a5ee1559..d05b23ea 100644 --- a/sources_non_forked/vim-go/.travis.yml +++ b/sources_non_forked/vim-go/.travis.yml @@ -19,4 +19,3 @@ install: | cd - script: ./scripts/test.sh - diff --git a/sources_non_forked/vim-go/CHANGELOG.md b/sources_non_forked/vim-go/CHANGELOG.md index b2f47f58..46662bc8 100644 --- a/sources_non_forked/vim-go/CHANGELOG.md +++ b/sources_non_forked/vim-go/CHANGELOG.md @@ -2,6 +2,7 @@ FEATURES: +* New `:GoAddTags` and `:GoRemoveTags` command based on the tool [gomodifytags](https://github.com/fatih/gomodifytags). This fixes many old bugs that were due prior regexp based implementation. For the usage please read the docs and checkout the demo at: https://github.com/fatih/vim-go/pull/1204 [gh-1204] * Add new `errl` snippet that expands to [gh-1185]: ``` @@ -14,6 +15,10 @@ IMPROVEMENTS: * Lowercase `` in mappings examples for consisten documentation across the README [gh-1192] * All of files should be written in utf-8 if the file will be passed to external command. [gh-1184] +* `:GoAddTags` is now able to add options to existing tags with the syntax `:GoAddTags key,option`, i.e: `:GoAddTags json,omitempty` [gh-985] +* Document 'noshowmode' requirement for echo_go_info [gh-1197] +* Improve godoc view for vertical splits [gh-1195] +* Set GOPATH for both possible go guru execution paths (sync and async) [gh-1193] BUG FIXES: @@ -22,6 +27,15 @@ BUG FIXES: * Update statusline before and after `go#jobcontrol#Spawn` command is executed [gh-1176] * Correctly report the value of the 'g:go_guru_tags' variable [gh-1177] * Ensure no trailing `:` exist in GOPATH detection if initial GOPATH is not set [gh-1194] +* Fix `:GoAddTags` to allow modifying existing comments [gh-984] +* Fix `:GoAddTags` to work with nested structs [gh-990] +* Fix `:GoAddTags` adding tags twice for existing tags [gh-1064] +* Fix `:GoAddTags` not working for fiels of types `interface{}` [gh-1091] +* Fix `:GoAddTags` not working for fields with one line comments [gh-1181] +* Fix `:GoAddTags` not working if any field comment would contain `{}` [gh-1189] +* Respect go_fmt_options when running goimports [gh-1211] +* Set the filename in the location-list when there is an error with :GoFmt [gh-1199] + ## 1.11 - (January 9, 2017) @@ -80,7 +94,7 @@ FEATURES: you have at least Vim 8.0.0087. Backwards compatible with Vim 7.4.x. If you see any problems, please open an issue. -* We have now a [logo for vim-go](https://github.com/fatih/vim-go/blob/master/assets/vim-go.png)! Thanks to @egonelbre for his work on this. +* We have now a [logo for vim-go](https://github.com/fatih/vim-go/blob/master/assets/vim-go.png)! Thanks to @egonelbre for his work on this. * `:GoBuild`, `:GoTest`, `:GoTestCompile`, `:GoInstall` commands are now fully async. Async means it doesn't block your UI anymore. If the command finished it echoes the status. For a better experience use the statusline information @@ -95,7 +109,7 @@ FEATURES: `:GoMetaLinterAutoSaveToggle` (temporary) or add `let g:go_metalinter_autosave = 1` (persistent) to your virmc). -* All `guru` commands run asynchronously if Vim 8.0 is being used. Current +* All `guru` commands run asynchronously if Vim 8.0 is being used. Current Commands: * GoImplements * GoWhicherrs @@ -111,7 +125,7 @@ FEATURES: auto sameids mode. In this mode it constantly evaluates the identifier under the cursor whenever it's in hold position and then calls :GoSameIds. As a reminder, to enable auto info either call `:GoSameIdsAutoToggle`(temporary) - or add `let g:go_auto_sameids = 1` (persistent) to your vimrc. + or add `let g:go_auto_sameids = 1` (persistent) to your vimrc. * `:GoInfo` is now non blocking and works in async mode if `guru` is used in `g:go_info_mode`. This makes it useful especially for autoinfo mode. In this @@ -221,7 +235,7 @@ FEATURES: * The snippet expansion `json` is now much more smarter. It pre populates the placeholder according to the first word and it also applies `snake_case` or `camelCase` conversion. Together with `:GoAddTags` it gives `vim-go` users flexible ways of populating a field tag. Checkout the demo to see it in action: https://twitter.com/fatih/status/754477622042689536 [gh-927] * New **`:GoSameIds`** command. When called highlights all same identifiers in the current file. Can be also enabled to highlight identifiers automatically (with `:GoSameIdsAutoToggle` or `g:go_auto_sameids`). Checkout the demo to see it in action: https://twitter.com/fatih/status/753673709278339072. [gh-936] * New **`:GoWhicherrs`** command. It shows all possible values of the selected error variable. [gh-948] -* Add new `errp` snippet to expand an `if err != nil { panic() }` clause [gh-926] +* Add new `errp` snippet to expand an `if err != nil { panic() }` clause [gh-926] * If you open a new buffer with a Go filename it get automatically populated based on the directory. If there are no Go files a simple main package is created, otherwise the file will include the package declaration line based on the package in the current directory. Checkout the demo to see it in action: https://twitter.com/fatih/status/748333086643994624. This is enabled by default. Can be disabled with `let g:go_template_autocreate = 0`. You can use your own template with `let g:go_template_file = "foo.go"` and putting the file under the `templates/` folder. [gh-918] * Added new toggle commands to enable/disable feature that run for your automatic. For example if you have `let g:go_auto_type_info = 1` enabled, you @@ -371,4 +385,3 @@ BACKWARDS INCOMPATIBILITIES: ## Previous releases Previous changelogs can be found here: https://github.com/fatih/vim-go/releases - diff --git a/sources_non_forked/vim-go/LICENSE b/sources_non_forked/vim-go/LICENSE index fd538bde..d9493d4f 100644 --- a/sources_non_forked/vim-go/LICENSE +++ b/sources_non_forked/vim-go/LICENSE @@ -25,7 +25,7 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + This software includes some portions from Go. Go is used under the terms of the BSD like license. diff --git a/sources_non_forked/vim-go/README.md b/sources_non_forked/vim-go/README.md index b5542fb5..9e881747 100644 --- a/sources_non_forked/vim-go/README.md +++ b/sources_non_forked/vim-go/README.md @@ -1,4 +1,4 @@ -# vim-go [![Build Status](http://img.shields.io/travis/fatih/vim-go.svg?style=flat-square)](https://travis-ci.org/fatih/vim-go) +# vim-go [![Build Status](http://img.shields.io/travis/fatih/vim-go.svg?style=flat-square)](https://travis-ci.org/fatih/vim-go)

Vim-go logo @@ -235,9 +235,9 @@ let g:go_get_update = 0 ### Using with Neovim (beta) Note: Neovim currently is not a first class citizen for vim-go. You are free -to open bug, however I'm not using Neovim so it's hard for me to test it. -vim-go might not work well as good as in Vim. I'm happy to accept pull requests -or very detailed bug reports. If you're interested to improve the state of +to open bug, however I'm not using Neovim so it's hard for me to test it. +vim-go might not work well as good as in Vim. I'm happy to accept pull requests +or very detailed bug reports. If you're interested to improve the state of Neovim in vim-go you're always welcome! diff --git a/sources_non_forked/vim-go/autoload/ctrlp/decls.vim b/sources_non_forked/vim-go/autoload/ctrlp/decls.vim index e1465adb..e7426762 100644 --- a/sources_non_forked/vim-go/autoload/ctrlp/decls.vim +++ b/sources_non_forked/vim-go/autoload/ctrlp/decls.vim @@ -39,7 +39,7 @@ function! ctrlp#decls#accept(mode, str) abort let vals = matchlist(a:str, '|\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)|') " i.e: main.go - let filename = vals[1] + let filename = vals[1] let line = vals[2] let col = vals[3] @@ -119,7 +119,7 @@ function! ctrlp#decls#enter() abort let space .= " " endfor - call add(s:decls, printf("%s\t%s |%s:%s:%s|\t%s", + call add(s:decls, printf("%s\t%s |%s:%s:%s|\t%s", \ decl.ident . space, \ decl.keyword, \ fnamemodify(decl.filename, ":t"), @@ -135,7 +135,7 @@ function! s:enable_syntax() abort return endif - syntax match CtrlPIdent '\zs\h\+\ze\s' + syntax match CtrlPIdent '\zs\h\+\ze\s' syntax match CtrlPKeyword '\zs[^\t|]\+\ze|[^|]\+:\d\+:\d\+|' syntax match CtrlPFilename '|\zs[^|]\+:\d\+:\d\+\ze|' syntax match CtrlPSignature '\zs\t.*\ze$' contains=CtrlPKeyWord,CtrlPFilename diff --git a/sources_non_forked/vim-go/autoload/go/cmd.vim b/sources_non_forked/vim-go/autoload/go/cmd.vim index fbc62823..badca313 100644 --- a/sources_non_forked/vim-go/autoload/go/cmd.vim +++ b/sources_non_forked/vim-go/autoload/go/cmd.vim @@ -373,7 +373,7 @@ function! go#cmd#Generate(bang, ...) abort let errors = go#list#Get(l:listtype) call go#list#Window(l:listtype, len(errors)) - if !empty(errors) + if !empty(errors) if !a:bang call go#list#JumpToFirst(l:listtype) endif diff --git a/sources_non_forked/vim-go/autoload/go/complete.vim b/sources_non_forked/vim-go/autoload/go/complete.vim index 2bd4eae7..a5d0ec10 100644 --- a/sources_non_forked/vim-go/autoload/go/complete.vim +++ b/sources_non_forked/vim-go/autoload/go/complete.vim @@ -27,11 +27,11 @@ function! s:gocodeCommand(cmd, preargs, args) abort let $GOROOT = go#util#env("goroot") let socket_type = get(g:, 'go_gocode_socket_type', s:sock_type) - let cmd = printf('%s -sock %s %s %s %s', - \ go#util#Shellescape(bin_path), - \ socket_type, - \ join(a:preargs), - \ go#util#Shellescape(a:cmd), + let cmd = printf('%s -sock %s %s %s %s', + \ go#util#Shellescape(bin_path), + \ socket_type, + \ join(a:preargs), + \ go#util#Shellescape(a:cmd), \ join(a:args) \ ) @@ -55,7 +55,7 @@ endfunction let s:optionsEnabled = 0 function! s:gocodeEnableOptions() abort - if s:optionsEnabled + if s:optionsEnabled return endif diff --git a/sources_non_forked/vim-go/autoload/go/coverage.vim b/sources_non_forked/vim-go/autoload/go/coverage.vim index 56113b93..493d4205 100644 --- a/sources_non_forked/vim-go/autoload/go/coverage.vim +++ b/sources_non_forked/vim-go/autoload/go/coverage.vim @@ -34,7 +34,7 @@ function! go#coverage#Buffer(bang, ...) abort try execute cd . fnameescape(expand("%:p:h")) if empty(glob("*_test.go")) - call go#util#EchoError("no tests files available") + call go#util#EchoError("no test files available") return endif finally @@ -89,8 +89,8 @@ function! go#coverage#Clear() abort if exists("s:toggle") | let s:toggle = 0 | endif - " remove the autocmd we defined - if exists("#BufWinLeave#") + " remove the autocmd we defined + if exists("#BufWinLeave#") autocmd! BufWinLeave endif endfunction @@ -160,8 +160,8 @@ function! go#coverage#genmatch(cov) abort " example: foo.go:92.2,92.65 1 0 if a:cov.startline == a:cov.endline call add(matches, { - \ 'group': color, - \ 'pos': [[a:cov.startline, a:cov.startcol, a:cov.endcol - a:cov.startcol]], + \ 'group': color, + \ 'pos': [[a:cov.startline, a:cov.startcol, a:cov.endcol - a:cov.startcol]], \ 'priority': 2, \ }) return matches @@ -171,8 +171,8 @@ function! go#coverage#genmatch(cov) abort " the line, we assume it is at maximum 200 bytes. I know this is hacky, " but that's only way of fixing the issue call add(matches, { - \ 'group': color, - \ 'pos': [[a:cov.startline, a:cov.startcol, 200]], + \ 'group': color, + \ 'pos': [[a:cov.startline, a:cov.startcol, 200]], \ 'priority': 2, \ }) @@ -181,16 +181,16 @@ function! go#coverage#genmatch(cov) abort while start_line < a:cov.endline let start_line += 1 call add(matches, { - \ 'group': color, - \ 'pos': [[start_line]], + \ 'group': color, + \ 'pos': [[start_line]], \ 'priority': 2, \ }) endwhile " finally end columns call add(matches, { - \ 'group': color, - \ 'pos': [[a:cov.endline, a:cov.endcol-1]], + \ 'group': color, + \ 'pos': [[a:cov.endline, a:cov.endcol-1]], \ 'priority': 2, \ }) diff --git a/sources_non_forked/vim-go/autoload/go/def.vim b/sources_non_forked/vim-go/autoload/go/def.vim index cf7c5c4a..a3d5f84a 100644 --- a/sources_non_forked/vim-go/autoload/go/def.vim +++ b/sources_non_forked/vim-go/autoload/go/def.vim @@ -209,7 +209,7 @@ function! go#def#StackUI() abort let prefix = " " endif - call add(stackOut, printf("%s %d %s|%d col %d|%s", + call add(stackOut, printf("%s %d %s|%d col %d|%s", \ prefix, i+1, entry["file"], entry["line"], entry["col"], entry["ident"])) let i += 1 endwhile diff --git a/sources_non_forked/vim-go/autoload/go/doc.vim b/sources_non_forked/vim-go/autoload/go/doc.vim index 22ea8cc7..4ad28d82 100644 --- a/sources_non_forked/vim-go/autoload/go/doc.vim +++ b/sources_non_forked/vim-go/autoload/go/doc.vim @@ -32,10 +32,10 @@ function! go#doc#OpenBrowser(...) abort let import = out["import"] let name = out["name"] let decl = out["decl"] - + let godoc_url = "https://godoc.org/" . import if decl !~ "^package" - let godoc_url .= "#" . name + let godoc_url .= "#" . name endif echo godoc_url @@ -92,13 +92,20 @@ function! s:GodocView(newposition, position, content) abort execute bufwinnr(s:buf_nr) . 'wincmd w' endif - " cap buffer height to 20, but resize it for smaller contents - let max_height = 20 - let content_height = len(split(a:content, "\n")) - if content_height > max_height - exe 'resize ' . max_height + if a:position == "split" + " cap buffer height to 20, but resize it for smaller contents + let max_height = 20 + let content_height = len(split(a:content, "\n")) + if content_height > max_height + exe 'resize ' . max_height + else + exe 'resize ' . content_height + endif else - exe 'resize ' . content_height + " set a sane maximum width for vertical splits. In this case the minimum + " that fits the godoc for package http without extra linebreaks and line + " numbers on + exe 'vertical resize 84' endif setlocal filetype=godoc diff --git a/sources_non_forked/vim-go/autoload/go/fmt.vim b/sources_non_forked/vim-go/autoload/go/fmt.vim index 8a327d3b..666421b2 100644 --- a/sources_non_forked/vim-go/autoload/go/fmt.vim +++ b/sources_non_forked/vim-go/autoload/go/fmt.vim @@ -77,7 +77,7 @@ function! go#fmt#Format(withGoimport) abort if go#util#ShellError() == 0 call go#fmt#update_file(l:tmpname, expand('%')) elseif g:go_fmt_fail_silently == 0 - let errors = s:parse_errors(out) + let errors = s:parse_errors(expand('%'), out) call s:show_errors(errors) endif @@ -102,7 +102,7 @@ function! go#fmt#Format(withGoimport) abort endfunction " update_file updates the target file with the given formatted source -function! go#fmt#update_file(source, target) +function! go#fmt#update_file(source, target) " remove undo point caused via BufWritePre try | silent undojoin | catch | endtry @@ -133,8 +133,8 @@ endfunction " run runs the gofmt/goimport command for the given source file and returns " the the output of the executed command. Target is the real file to be -" formated. -function! go#fmt#run(bin_name, source, target) +" formated. +function! go#fmt#run(bin_name, source, target) let cmd = s:fmt_cmd(a:bin_name, a:source, a:target) if cmd[0] == "goimports" " change GOPATH too, so goimports can pick up the correct library @@ -168,10 +168,9 @@ function! s:fmt_cmd(bin_name, source, target) " start constructing the command let cmd = [bin_path] call add(cmd, "-w") + call extend(cmd, split(g:go_fmt_options, " ")) - if a:bin_name != "goimports" - call extend(cmd, split(g:go_fmt_options, " ")) - else + if a:bin_name == "goimports" " lazy check if goimports support `-srcdir`. We should eventually remove " this in the future if !exists('b:goimports_vendor_compatible') @@ -196,7 +195,7 @@ function! s:fmt_cmd(bin_name, source, target) endfunction " parse_errors parses the given errors and returns a list of parsed errors -function! s:parse_errors(content) abort +function! s:parse_errors(filename, content) abort let splitted = split(a:content, '\n') " list of errors to be put into location list @@ -205,6 +204,7 @@ function! s:parse_errors(content) abort let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)') if !empty(tokens) call add(errors,{ + \"filename": a:filename, \"lnum": tokens[2], \"col": tokens[3], \"text": tokens[4], @@ -218,13 +218,13 @@ endfunction " show_errors opens a location list and shows the given errors. If the given " errors is empty, it closes the the location list function! s:show_errors(errors) abort - let l:listtype = "locationlist" + let l:listtype = "locationlist" if !empty(a:errors) call go#list#Populate(l:listtype, a:errors, 'Format') echohl Error | echomsg "Gofmt returned error" | echohl None endif - " this closes the window if there are no errors or it opens + " this closes the window if there are no errors or it opens " it if there is any call go#list#Window(l:listtype, len(a:errors)) endfunction diff --git a/sources_non_forked/vim-go/autoload/go/guru.vim b/sources_non_forked/vim-go/autoload/go/guru.vim index 206ca87b..df31d1b3 100644 --- a/sources_non_forked/vim-go/autoload/go/guru.vim +++ b/sources_non_forked/vim-go/autoload/go/guru.vim @@ -25,7 +25,7 @@ function! s:guru_cmd(args) range abort endif "return with a warning if the binary doesn't exist - let bin_path = go#path#CheckBinPath("guru") + let bin_path = go#path#CheckBinPath("guru") if empty(bin_path) return {'err': "bin path not found"} endif @@ -41,7 +41,7 @@ function! s:guru_cmd(args) range abort endif " enable outputting in json format - if format == "json" + if format == "json" call add(cmd, "-json") endif @@ -120,8 +120,6 @@ function! s:sync_guru(args) abort endif endif - let old_gopath = $GOPATH - let $GOPATH = go#path#Detect() " run, forrest run!!! let command = join(result.cmd, " ") @@ -131,8 +129,6 @@ function! s:sync_guru(args) abort let out = go#util#System(command) endif - let $GOPATH = old_gopath - if has_key(a:args, 'custom_parse') call a:args.custom_parse(go#util#ShellError(), out) else @@ -217,11 +213,17 @@ endfunc " run_guru runs the given guru argument function! s:run_guru(args) abort + let old_gopath = $GOPATH + let $GOPATH = go#path#Detect() if go#util#has_job() - return s:async_guru(a:args) + let res = s:async_guru(a:args) + else + let res = s:sync_guru(a:args) endif - return s:sync_guru(a:args) + let $GOPATH = old_gopath + + return res endfunction " Show 'implements' relation for selected package @@ -270,7 +272,7 @@ endfunction function! go#guru#DescribeInfo() abort " json_encode() and friends are introduced with this patch (7.4.1304) " vim: https://groups.google.com/d/msg/vim_dev/vLupTNhQhZ8/cDGIk0JEDgAJ - " nvim: https://github.com/neovim/neovim/pull/4131 + " nvim: https://github.com/neovim/neovim/pull/4131 if !exists("*json_decode") call go#util#EchoError("requires 'json_decode'. Update your Vim/Neovim version.") return @@ -465,7 +467,7 @@ function! go#guru#SameIds() abort " json_encode() and friends are introduced with this patch (7.4.1304) " vim: https://groups.google.com/d/msg/vim_dev/vLupTNhQhZ8/cDGIk0JEDgAJ - " nvim: https://github.com/neovim/neovim/pull/4131 + " nvim: https://github.com/neovim/neovim/pull/4131 if !exists("*json_decode") call go#util#EchoError("GoSameIds requires 'json_decode'. Update your Vim/Neovim version.") return @@ -547,7 +549,7 @@ function! go#guru#ClearSameIds() abort endfunction function! go#guru#ToggleSameIds() abort - if len(getmatches()) != 0 + if len(getmatches()) != 0 call go#guru#ClearSameIds() else call go#guru#SameIds() diff --git a/sources_non_forked/vim-go/autoload/go/impl.vim b/sources_non_forked/vim-go/autoload/go/impl.vim index 139dba75..a4b696de 100644 --- a/sources_non_forked/vim-go/autoload/go/impl.vim +++ b/sources_non_forked/vim-go/autoload/go/impl.vim @@ -18,7 +18,7 @@ function! go#impl#Impl(...) abort return endif elseif a:0 == 1 - " we assume the user only passed the interface type, + " we assume the user only passed the interface type, " i.e: ':GoImpl io.Writer' let receiveType = expand("") let recv = printf("%s *%s", tolower(receiveType)[0], receiveType) @@ -44,7 +44,7 @@ function! go#impl#Impl(...) abort end let pos = getpos('.') - put ='' + put ='' put =result call setpos('.', pos) endfunction diff --git a/sources_non_forked/vim-go/autoload/go/lint.vim b/sources_non_forked/vim-go/autoload/go/lint.vim index c62f2520..84d8ba45 100644 --- a/sources_non_forked/vim-go/autoload/go/lint.vim +++ b/sources_non_forked/vim-go/autoload/go/lint.vim @@ -109,9 +109,9 @@ endfunction " Golint calls 'golint' on the current directory. Any warnings are populated in " the location list function! go#lint#Golint(...) abort - let bin_path = go#path#CheckBinPath(g:go_golint_bin) - if empty(bin_path) - return + let bin_path = go#path#CheckBinPath(g:go_golint_bin) + if empty(bin_path) + return endif if a:0 == 0 @@ -280,7 +280,7 @@ function s:lint_job(args) call go#statusline#Update(status_dir, status) let errors = go#list#Get(l:listtype) - if empty(errors) + if empty(errors) call go#list#Window(l:listtype, len(errors)) elseif has("patch-7.4.2200") if l:listtype == 'quickfix' diff --git a/sources_non_forked/vim-go/autoload/go/list.vim b/sources_non_forked/vim-go/autoload/go/list.vim index 56d6115d..dbd1e254 100644 --- a/sources_non_forked/vim-go/autoload/go/list.vim +++ b/sources_non_forked/vim-go/autoload/go/list.vim @@ -124,7 +124,7 @@ function! go#list#Type(listtype) abort if g:go_list_type == "locationlist" return "locationlist" elseif g:go_list_type == "quickfix" - return "quickfix" + return "quickfix" else return a:listtype endif diff --git a/sources_non_forked/vim-go/autoload/go/play.vim b/sources_non_forked/vim-go/autoload/go/play.vim index ac5bba42..4674d5b6 100644 --- a/sources_non_forked/vim-go/autoload/go/play.vim +++ b/sources_non_forked/vim-go/autoload/go/play.vim @@ -70,7 +70,7 @@ function! s:get_visual_selection() abort return join(lines, "\n") endfunction -" following two functions are from: https://github.com/mattn/gist-vim +" following two functions are from: https://github.com/mattn/gist-vim " thanks @mattn function! s:get_browser_command() abort let go_play_browser_command = get(g:, 'go_play_browser_command', '') diff --git a/sources_non_forked/vim-go/autoload/go/statusline.vim b/sources_non_forked/vim-go/autoload/go/statusline.vim index c832797c..ba63c6da 100644 --- a/sources_non_forked/vim-go/autoload/go/statusline.vim +++ b/sources_non_forked/vim-go/autoload/go/statusline.vim @@ -4,7 +4,7 @@ " s:statuses is a global reference to all statuses. It stores the statuses per " import paths (map[string]status), where each status is unique per its " type. Current status dict is in form: -" { +" { " 'desc' : 'Job description', " 'state' : 'Job state, such as success, failure, etc..', " 'type' : 'Job type, such as build, test, etc..' diff --git a/sources_non_forked/vim-go/autoload/go/tags.vim b/sources_non_forked/vim-go/autoload/go/tags.vim new file mode 100644 index 00000000..4ef7d282 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/tags.vim @@ -0,0 +1,206 @@ +function! go#tags#Add(start, end, count, ...) abort + let fname = fnamemodify(expand("%"), ':p:gs?\\?/?') + if &modified + " Write current unsaved buffer to a temp file and use the modified content + let l:tmpname = tempname() + call writefile(getline(1, '$'), l:tmpname) + let fname = l:tmpname + endif + + let offset = 0 + if a:count == -1 + let offset = go#util#OffsetCursor() + endif + + let test_mode = 0 + call call("go#tags#run", [a:start, a:end, offset, "add", fname, test_mode] + a:000) + + " if exists, delete it as we don't need it anymore + if exists("l:tmpname") + call delete(l:tmpname) + endif +endfunction + +function! go#tags#Remove(start, end, count, ...) abort + let fname = fnamemodify(expand("%"), ':p:gs?\\?/?') + if &modified + " Write current unsaved buffer to a temp file and use the modified content + let l:tmpname = tempname() + call writefile(getline(1, '$'), l:tmpname) + let fname = l:tmpname + endif + + let offset = 0 + if a:count == -1 + let offset = go#util#OffsetCursor() + endif + + let test_mode = 0 + call call("go#tags#run", [a:start, a:end, offset, "remove", fname, test_mode] + a:000) + + " if exists, delete it as we don't need it anymore + if exists("l:tmpname") + call delete(l:tmpname) + endif +endfunction + +" run runs gomodifytag. This is an internal test so we can test it +function! go#tags#run(start, end, offset, mode, fname, test_mode, ...) abort + " do not split this into multiple lines, somehow tests fail in that case + let args = {'mode': a:mode,'start': a:start,'end': a:end,'offset': a:offset,'fname': a:fname,'cmd_args': a:000} + + let result = s:create_cmd(args) + if has_key(result, 'err') + call go#util#EchoError(result.err) + return -1 + endif + + let command = join(result.cmd, " ") + + call go#cmd#autowrite() + let out = go#util#System(command) + if go#util#ShellError() != 0 + call go#util#EchoError(out) + return + endif + + if a:test_mode + exe 'edit ' . a:fname + endif + + call s:write_out(out) + + if a:test_mode + exe 'write! ' . a:fname + endif +endfunc + + +" write_out writes back the given output to the current buffer +func s:write_out(out) abort + " not a json output + if a:out[0] !=# '{' + return + endif + + " nothing to do + if empty(a:out) || type(a:out) != type("") + return + endif + + let result = json_decode(a:out) + if type(result) != type({}) + call go#util#EchoError(printf("malformed output from gomodifytags: %s", a:out)) + return + endif + + let lines = result['lines'] + let start_line = result['start'] + let end_line = result['end'] + + let index = 0 + for line in range(start_line, end_line) + call setline(line, lines[index]) + let index += 1 + endfor +endfunc + + +" create_cmd returns a dict that contains the command to execute gomodifytags +func s:create_cmd(args) abort + if !exists("*json_decode") + return {'err': "requires 'json_decode'. Update your Vim/Neovim version."} + endif + + let bin_path = go#path#CheckBinPath('gomodifytags') + if empty(bin_path) + return {'err': "gomodifytags does not exist"} + endif + + let l:start = a:args.start + let l:end = a:args.end + let l:offset = a:args.offset + let l:mode = a:args.mode + let l:cmd_args = a:args.cmd_args + + " start constructing the command + let cmd = [bin_path] + call extend(cmd, ["-format", "json"]) + call extend(cmd, ["-file", a:args.fname]) + + if l:offset != 0 + call extend(cmd, ["-offset", l:offset]) + else + let range = printf("%d,%d", l:start, l:end) + call extend(cmd, ["-line", range]) + endif + + if l:mode == "add" + let l:tags = [] + let l:options = [] + + if !empty(l:cmd_args) + for item in l:cmd_args + let splitted = split(item, ",") + + " tag only + if len(splitted) == 1 + call add(l:tags, splitted[0]) + endif + + " options only + if len(splitted) == 2 + call add(l:tags, splitted[0]) + call add(l:options, printf("%s=%s", splitted[0], splitted[1])) + endif + endfor + endif + + " construct options + if !empty(l:options) + call extend(cmd, ["-add-options", join(l:options, ",")]) + else + " default value + if empty(l:tags) + let l:tags = ["json"] + endif + + " construct tags + call extend(cmd, ["-add-tags", join(l:tags, ",")]) + endif + elseif l:mode == "remove" + if empty(l:cmd_args) + call add(cmd, "-clear-tags") + else + let l:tags = [] + let l:options = [] + for item in l:cmd_args + let splitted = split(item, ",") + + " tag only + if len(splitted) == 1 + call add(l:tags, splitted[0]) + endif + + " options only + if len(splitted) == 2 + call add(l:options, printf("%s=%s", splitted[0], splitted[1])) + endif + endfor + + " construct tags + if !empty(l:tags) + call extend(cmd, ["-remove-tags", join(l:tags, ",")]) + endif + + " construct options + if !empty(l:options) + call extend(cmd, ["-remove-options", join(l:options, ",")]) + endif + endif + else + return {'err': printf("unknown mode: %s", l:mode)} + endif + + return {'cmd': cmd} +endfunc diff --git a/sources_non_forked/vim-go/autoload/go/tags_test.vim b/sources_non_forked/vim-go/autoload/go/tags_test.vim new file mode 100644 index 00000000..9d740c85 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/tags_test.vim @@ -0,0 +1,28 @@ +func Test_add_tags() + let input_file = tempname() + call writefile(readfile("test-fixtures/tags/add_all_input.go"), input_file) + + let expected = join(readfile("test-fixtures/tags/add_all_golden.go"), "\n") + + " run for offset 40, which is inside the struct + call go#tags#run(0, 0, 40, "add", input_file, 1) + + let actual = join(readfile(input_file), "\n") + + call assert_equal(expected, actual) +endfunc + + +func Test_remove_tags() + let input_file = tempname() + call writefile(readfile("test-fixtures/tags/remove_all_input.go"), input_file) + + let expected = join(readfile("test-fixtures/tags/remove_all_golden.go"), "\n") + + " run for offset 40, which is inside the struct + call go#tags#run(0, 0, 40, "remove", input_file, 1) + + let actual = join(readfile(input_file), "\n") + + call assert_equal(expected, actual) +endfunc diff --git a/sources_non_forked/vim-go/autoload/go/textobj.vim b/sources_non_forked/vim-go/autoload/go/textobj.vim index da0bb7e2..21789dc4 100644 --- a/sources_non_forked/vim-go/autoload/go/textobj.vim +++ b/sources_non_forked/vim-go/autoload/go/textobj.vim @@ -67,7 +67,7 @@ function! go#textobj#Function(mode) abort normal! v call cursor(info.rbrace.line, info.rbrace.col) return - endif + endif " rest is inner mode, a:mode == 'i' diff --git a/sources_non_forked/vim-go/autoload/go/tool.vim b/sources_non_forked/vim-go/autoload/go/tool.vim index 7b7e1af2..99577f4e 100644 --- a/sources_non_forked/vim-go/autoload/go/tool.vim +++ b/sources_non_forked/vim-go/autoload/go/tool.vim @@ -164,7 +164,7 @@ function! go#tool#Exists(importpath) abort endfunction -" following two functions are from: https://github.com/mattn/gist-vim +" following two functions are from: https://github.com/mattn/gist-vim " thanks @mattn function! s:get_browser_command() abort let go_play_browser_command = get(g:, 'go_play_browser_command', '') diff --git a/sources_non_forked/vim-go/autoload/go/util.vim b/sources_non_forked/vim-go/autoload/go/util.vim index 65cf2750..86d0726c 100644 --- a/sources_non_forked/vim-go/autoload/go/util.vim +++ b/sources_non_forked/vim-go/autoload/go/util.vim @@ -53,7 +53,7 @@ let s:env_cache = {} " env returns the go environment variable for the given key. Where key can be " GOARCH, GOOS, GOROOT, etc... It caches the result and returns the cached -" version. +" version. function! go#util#env(key) abort let l:key = tolower(a:key) if has_key(s:env_cache, l:key) diff --git a/sources_non_forked/vim-go/doc/vim-go.txt b/sources_non_forked/vim-go/doc/vim-go.txt index 2d7a03b2..d37df28f 100644 --- a/sources_non_forked/vim-go/doc/vim-go.txt +++ b/sources_non_forked/vim-go/doc/vim-go.txt @@ -576,7 +576,7 @@ CTRL-t *:GoSameIdsToggle* :GoSameIdsToggle - Toggle between |:GoSameIds| and |:GoSameIdsClear|. + Toggle between |:GoSameIds| and |:GoSameIdsClear|. *:GoSameIdsAutoToggle* :GoSameIdsAutoToggle @@ -669,12 +669,13 @@ CTRL-t :GoImpl T io.ReadWriteCloser < *:GoAddTags* -:[range]GoAddTags [key] [key1] ... +:[range]GoAddTags [key],[option] [key1],[option] ... Adds field tags for the fields of a struct. If called inside a struct it automatically add field tags with the `json` key and the value automatically generated based on the field name. An error message is given - if it's called outside a struct definition. + if it's called outside a struct definition or if the file is not correctly + formatted. If [range] is given, only the selected fields will be changed. @@ -682,6 +683,37 @@ CTRL-t arguments. An example of adding `xml` and `db` would be: > :GoAddTags xml db +< + If [option] is passed it'll either add a new tag with an option or will + modify exising tags. An example of adding `omitempty` to all `json` fields + would be: +> + :GoAddTags json,omitempty +< + You can define a constant value instead of the default field based value. + For example the following command will add ``valid:"1"`` to all fields. +> + :GoAddTags valid=1 +< + *:GoRemoveTags* +:[range]GoRemoveTags [key],[option] [key1],[option1] ... + + Rmove field tags for the fields of a struct. If called inside a struct it + automatically remove all field tags. An error message is given if it's + called outside a struct definition or if the file is not correctly + formatted + + If [range] is given, only the selected fields will be changed. + + If [key] is given, it will only remove those keys. Example: +> + :GoRemoveTags json +< + If [option] is passed with a [key], it will only remove the options. + Example, this will only remove `omitempty` options from fields containing + `json`: +> + :GoRemoveTags json,omitempty < *:GoAutoTypeInfoToggle* :GoAutoTypeInfoToggle @@ -958,7 +990,7 @@ Shows the status of a job running asynchronously. Can be used to plug into the statusline. It works to show the status per package instead of per file. Assume you have three files open, all belonging to the same package, if the package build (`:GoBuild`) is successful, all statusline's will show -`success`, if you it fails all file's statusline will show `failed`. +`success`, if you it fails all file's statusline will show `failed`. To avoid always showing old status information, the status information is cleaned for each package after `60` seconds. This can be changed with the @@ -1488,6 +1520,8 @@ default it's enabled > let g:go_echo_go_info = 1 < +Please note that 'noshowmode' must be set for this feature to work correctly. + *'g:go_statusline_duration'* Specifices the duration of statusline information being showed per package. By diff --git a/sources_non_forked/vim-go/ftplugin/go/commands.vim b/sources_non_forked/vim-go/ftplugin/go/commands.vim index d8bff665..6f108a67 100644 --- a/sources_non_forked/vim-go/ftplugin/go/commands.vim +++ b/sources_non_forked/vim-go/ftplugin/go/commands.vim @@ -14,14 +14,15 @@ command! -range=% GoChannelPeers call go#guru#ChannelPeers() command! -range=% GoReferrers call go#guru#Referrers() command! -nargs=? GoGuruTags call go#guru#Tags() - -command! -nargs=* -range GoAddTags call go#util#AddTags(, , ) - command! -range=0 GoSameIds call go#guru#SameIds() command! -range=0 GoSameIdsClear call go#guru#ClearSameIds() command! -range=0 GoSameIdsToggle call go#guru#ToggleSameIds() command! -range=0 GoSameIdsAutoToggle call go#guru#AutoToogleSameIds() +" -- tags +command! -nargs=* -range GoAddTags call go#tags#Add(, , , ) +command! -nargs=* -range GoRemoveTags call go#tags#Remove(, , , ) + " -- tool command! -nargs=0 GoFiles echo go#tool#Files() command! -nargs=0 GoDeps echo go#tool#Deps() diff --git a/sources_non_forked/vim-go/ftplugin/go/tagbar.vim b/sources_non_forked/vim-go/ftplugin/go/tagbar.vim index efdc397b..2d22fd7c 100644 --- a/sources_non_forked/vim-go/ftplugin/go/tagbar.vim +++ b/sources_non_forked/vim-go/ftplugin/go/tagbar.vim @@ -15,9 +15,9 @@ endif function! s:SetTagbar() - let bin_path = go#path#CheckBinPath(g:go_gotags_bin) - if empty(bin_path) - return + let bin_path = go#path#CheckBinPath(g:go_gotags_bin) + if empty(bin_path) + return endif if !exists("g:tagbar_type_go") diff --git a/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets b/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets index 4a5b87f8..9db78db1 100644 --- a/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets +++ b/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets @@ -175,7 +175,7 @@ if err != nil { ${0} endsnippet -# error test +# error test snippet errt "Error test fatal " !b if err != nil { t.Fatal(err) diff --git a/sources_non_forked/vim-go/plugin/go.vim b/sources_non_forked/vim-go/plugin/go.vim index 26547310..8a381453 100644 --- a/sources_non_forked/vim-go/plugin/go.vim +++ b/sources_non_forked/vim-go/plugin/go.vim @@ -18,6 +18,7 @@ let s:packages = [ \ "github.com/jstemmer/gotags", \ "github.com/klauspost/asmfmt/cmd/asmfmt", \ "github.com/fatih/motion", + \ "github.com/fatih/gomodifytags", \ "github.com/zmb3/gogetdoc", \ "github.com/josharian/impl", \ ] diff --git a/sources_non_forked/vim-go/scripts/test.sh b/sources_non_forked/vim-go/scripts/test.sh index cda33504..b22fd7d7 100644 --- a/sources_non_forked/vim-go/scripts/test.sh +++ b/sources_non_forked/vim-go/scripts/test.sh @@ -4,6 +4,9 @@ set -e cd $(dirname $0) +# install dependencies +go get github.com/fatih/gomodifytags + # cleanup test.log if [ -f "test.log" ]; then rm test.log diff --git a/sources_non_forked/vim-pug/syntax/pug.vim b/sources_non_forked/vim-pug/syntax/pug.vim index 2d80f471..9e5ea3da 100644 --- a/sources_non_forked/vim-pug/syntax/pug.vim +++ b/sources_non_forked/vim-pug/syntax/pug.vim @@ -30,7 +30,7 @@ syn region pugJavascript matchgroup=pugJavascriptOutputChar start="[!&]\==\|\~" syn region pugJavascript matchgroup=pugJavascriptChar start="-" skip=",\s*$" end="$" contained contains=@htmlJavascript keepend syn cluster pugTop contains=pugBegin,pugComment,pugHtmlComment,pugJavascript syn match pugBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=pugTag,pugClassChar,pugIdChar,pugPlainChar,pugJavascript,pugScriptConditional,pugScriptStatement,pugPipedText -syn match pugTag "+\?\w\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@pugComponent +syn match pugTag "+\?[[:alnum:]_-]\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@pugComponent syn cluster pugComponent contains=pugAttributes,pugIdChar,pugBlockExpansionChar,pugClassChar,pugPlainChar,pugJavascript,pugTagBlockChar,pugTagInlineText syntax keyword pugCommentTodo contained TODO FIXME XXX TBD syn match pugComment '\(\s\+\|^\)\/\/.*$' contains=pugCommentTodo diff --git a/sources_non_forked/vim-snippets/UltiSnips/all.snippets b/sources_non_forked/vim-snippets/UltiSnips/all.snippets index 49a9c80e..6d77cc59 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/all.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/all.snippets @@ -96,4 +96,8 @@ snippet datetime "YYYY-MM-DD hh:mm" w `!v strftime("%Y-%m-%d %H:%M")` endsnippet +snippet todo "TODO comment" bw +`!p snip.rv=get_comment_format()[0]` ${2:TODO}: $0${3: <${4:`!v strftime('%d-%m-%y')`}${5:, `!v g:snips_author`}>} `!p snip.rv=get_comment_format()[2]` +endsnippet + # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets b/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets index c83ec605..bb79a0e1 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets @@ -4,6 +4,28 @@ extends c # We want to overwrite everything in parent ft. priority -49 +########################################################################### +# Global functions # +########################################################################### + +global !p + +def write_docstring_args(arglist, snip): + args = str(arglist).split(',') + + if len(args) > 1: + c = 0 + for arg in args: + if c == 0: + snip.rv += arg + c = 1 + else: + snip += '* : %s' % arg.strip() + else: + snip.rv = args[0] + + +endglobal ########################################################################### # TextMate Snippets # @@ -70,4 +92,19 @@ public: #endif /* $2 */ endsnippet + + +snippet fnc "Basic c++ doxygen function template" b +/** +* @brief: ${4:brief} +* +* @param: `!p write_docstring_args(t[3],snip)` +* +* @return: `!p snip.rv = t[1]` +*/ +${1:ReturnType} ${2:FunctionName}(${3:param}) +{ + ${0:FunctionBody} +} +endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript-jasmine-arrow.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript-jasmine-arrow.snippets new file mode 100644 index 00000000..fa7f9364 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript-jasmine-arrow.snippets @@ -0,0 +1,234 @@ +priority -50 + +# JavaScript versions -- from the TextMate bundle + some additions +# for jasmine-jquery matchers +# + +snippet des "Describe (js)" b +describe('${1:description}', () => { + $0 +}); +endsnippet + +snippet it "it (js)" b +it('${1:description}', () => { + $0 +}); +endsnippet + +snippet bef "before each (js)" b +beforeEach(() => { + $0 +}); +endsnippet + +snippet aft "after each (js)" b +afterEach(() => { + $0 +}); +endsnippet + +snippet befa "before all (js)" b +beforeAll(() => { + $0 +}); +endsnippet + +snippet afta "after all (js)" b +afterAll(() => { + $0 +}); +endsnippet + +snippet any "any (js)" b +jasmine.any($1) +endsnippet + +snippet anyt "anything (js)" b +jasmine.anything() +endsnippet + +snippet objc "object containing (js)" b +jasmine.objectContaining({ + ${VISUAL}$0 +}); +endsnippet + +snippet arrc "array containing (js)" b +jasmine.arrayContaining([${1:value1}]); +endsnippet + +snippet strm "string matching (js)" b +jasmine.stringMatching("${1:matcher}") +endsnippet + +snippet ru "runs (js)" b +runs(() => { + $0 +}); +endsnippet + +snippet wa "waits (js)" b +waits($1); +endsnippet + +snippet ex "expect (js)" b +expect(${1:target})$0; +endsnippet + +snippet ee "expect to equal (js)" b +expect(${1:target}).toEqual(${2:value}); +endsnippet + +snippet el "expect to be less than (js)" b +expect(${1:target}).toBeLessThan(${2:value}); +endsnippet + +snippet eg "expect to be greater than (js)" b +expect(${1:target}).toBeGreaterThan(${2:value}); +endsnippet + +snippet eb "expect to be (js)" b +expect(${1:target}).toBe(${2:value}); +endsnippet + +snippet em "expect to match (js)" b +expect(${1:target}).toMatch(${2:pattern}); +endsnippet + +snippet eha "expect to have attribute (js)" b +expect(${1:target}).toHaveAttr('${2:attr}'${3:, '${4:value}'}); +endsnippet + +snippet et "expect to be truthy (js)" b +expect(${1:target}).toBeTruthy(); +endsnippet + +snippet ef "expect to be falsy (js)" b +expect(${1:target}).toBeFalsy(); +endsnippet + +snippet ed "expect to be defined (js)" b +expect(${1:target}).toBeDefined(); +endsnippet + +snippet eud "expect to be defined (js)" b +expect(${1:target}).toBeUndefined(); +endsnippet + +snippet en "expect to be null (js)" b +expect(${1:target}).toBeNull(); +endsnippet + +snippet ec "expect to contain (js)" b +expect(${1:target}).toContain(${2:value}); +endsnippet + +snippet ev "expect to be visible (js)" b +expect(${1:target}).toBeVisible(); +endsnippet + +snippet eh "expect to be hidden (js)" b +expect(${1:target}).toBeHidden(); +endsnippet + +snippet eth "expect to throw (js)" b +expect(${1:target}).toThrow(${2:value}); +endsnippet + +snippet ethe "expect to throw error (js)" b +expect(${1:target}).toThrowError(${2:value}); +endsnippet + +snippet notx "expect not (js)" b +expect(${1:target}).not$0; +endsnippet + +snippet note "expect not to equal (js)" b +expect(${1:target}).not.toEqual(${2:value}); +endsnippet + +snippet notl "expect to not be less than (js)" b +expect(${1:target}).not.toBeLessThan(${2:value}); +endsnippet + +snippet notg "expect to not be greater than (js)" b +expect(${1:target}).not.toBeGreaterThan(${2:value}); +endsnippet + +snippet notm "expect not to match (js)" b +expect(${1:target}).not.toMatch(${2:pattern}); +endsnippet + +snippet notha "expect to not have attribute (js)" b +expect(${1:target}).not.toHaveAttr('${2:attr}'${3:, '${4:value}'}); +endsnippet + +snippet nott "expect not to be truthy (js)" b +expect(${1:target}).not.toBeTruthy(); +endsnippet + +snippet notf "expect not to be falsy (js)" b +expect(${1:target}).not.toBeFalsy(); +endsnippet + +snippet notd "expect not to be defined (js)" b +expect(${1:target}).not.toBeDefined(); +endsnippet + +snippet notn "expect not to be null (js)" b +expect(${1:target}).not.toBeNull(); +endsnippet + +snippet notc "expect not to contain (js)" b +expect(${1:target}).not.toContain(${2:value}); +endsnippet + +snippet notv "expect not to be visible (js)" b +expect(${1:target}).not.toBeVisible(); +endsnippet + +snippet noth "expect not to be hidden (js)" b +expect(${1:target}).not.toBeHidden(); +endsnippet + +snippet notth "expect not to throw (js)" b +expect(${1:target}).not.toThrow(${2:value}); +endsnippet + +snippet notthe "expect not to throw error (js)" b +expect(${1:target}).not.toThrowError(${2:value}); +endsnippet + +snippet s "spy on (js)" b +spyOn(${1:object}, '${2:method}')$0; +endsnippet + +snippet sr "spy on and return (js)" b +spyOn(${1:object}, '${2:method}').and.returnValue(${3:arguments}); +endsnippet + +snippet st "spy on and throw (js)" b +spyOn(${1:object}, '${2:method}').and.throwError(${3:exception}); +endsnippet + +snippet sct "spy on and call through (js)" b +spyOn(${1:object}, '${2:method}').and.callThrough(); +endsnippet + +snippet scf "spy on and call fake (js)" b +spyOn(${1:object}, '${2:method}').and.callFake(${3:function}); +endsnippet + +snippet ethbc "expect to have been called (js)" b +expect(${1:target}).toHaveBeenCalled(); +endsnippet + +snippet nthbc "expect not to have been called (js)" b +expect(${1:target}).not.toHaveBeenCalled(); +endsnippet + +snippet ethbcw "expect to have been called with (js)" b +expect(${1:target}).toHaveBeenCalledWith(${2:arguments}); +endsnippet + diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript-jasmine.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript-jasmine.snippets index 77aec773..2efbf266 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript-jasmine.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript-jasmine.snippets @@ -132,6 +132,14 @@ snippet eh "expect to be hidden (js)" b expect(${1:target}).toBeHidden(); endsnippet +snippet eth "expect to throw (js)" b +expect(${1:target}).toThrow(${2:value}); +endsnippet + +snippet ethe "expect to throw error (js)" b +expect(${1:target}).toThrowError(${2:value}); +endsnippet + snippet notx "expect not (js)" b expect(${1:target}).not$0; endsnippet @@ -145,7 +153,7 @@ expect(${1:target}).not.toBeLessThan(${2:value}); endsnippet snippet notg "expect to not be greater than (js)" b -expect(${1:target})..not.toBeGreaterThan(${2:value}); +expect(${1:target}).not.toBeGreaterThan(${2:value}); endsnippet snippet notm "expect not to match (js)" b @@ -184,6 +192,14 @@ snippet noth "expect not to be hidden (js)" b expect(${1:target}).not.toBeHidden(); endsnippet +snippet notth "expect not to throw (js)" b +expect(${1:target}).not.toThrow(${2:value}); +endsnippet + +snippet notthe "expect not to throw error (js)" b +expect(${1:target}).not.toThrowError(${2:value}); +endsnippet + snippet s "spy on (js)" b spyOn(${1:object}, '${2:method}')$0; endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets index 29bf9ed1..652dd707 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets @@ -1,5 +1,19 @@ priority -50 +############ +# COMMON # +############ + +# The smart snippets use a global options called +# "g:ultisnips_javascript.{option}" which can control the format +# of trailing semicolon, space before function paren, etc. + +global !p +from javascript_snippets import ( + semi, space_before_function_paren, keyword_spacing +) +endglobal + ########################################################################### # TextMate Snippets # ########################################################################### @@ -8,13 +22,13 @@ getElement${1/(T)|.*/(?1:s)/}By${1:T}${1/(T)|(I)|.*/(?1:agName)(?2:d)/}('$2') endsnippet snippet '':f "object method string" -'${1:${2:#thing}:${3:click}}': function(element) { +'${1:${2:#thing}:${3:click}}': function`!p snip.rv = space_before_function_paren(snip)`(element) { ${VISUAL}$0 }${10:,} endsnippet snippet :f "Object Method" -${1:method_name}: function(${3:attribute}) { +${1:method_name}: function`!p snip.rv = space_before_function_paren(snip)`(${3:attribute}) { ${VISUAL}$0 }${10:,} endsnippet @@ -28,48 +42,99 @@ ${1:key}: ${2:"${3:value}"}${4:, } endsnippet snippet proto "Prototype (proto)" -${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) { +${1:class_name}.prototype.${2:method_name} = function`!p snip.rv = space_before_function_paren(snip)`(${3:first_argument}) { ${VISUAL}$0 -}; +}`!p snip.rv = semi(snip)` endsnippet snippet fun "function (fun)" w -function ${1:function_name}(${2:argument}) { +function ${1:function_name}`!p snip.rv = space_before_function_paren(snip)`(${2:argument}) { ${VISUAL}$0 } endsnippet snippet vf "Function assigned to var" -${1:var }${2:function_name} = function $2($3) { +${1:var }${2:function_name} = function $2`!p snip.rv = space_before_function_paren(snip)`($3) { ${VISUAL}$0 -}; +}`!p snip.rv = semi(snip)` endsnippet snippet af "Anonymous Function" i -function($1) { +function`!p snip.rv = space_before_function_paren(snip)`($1) { ${VISUAL}$0 } endsnippet snippet iife "Immediately-Invoked Function Expression (iife)" -(function(${1:window}) { +(function`!p snip.rv = space_before_function_paren(snip)`(${1:window}) { ${VISUAL}$0 -}(${2:$1})); +}(${2:$1}))`!p snip.rv = semi(snip)` +endsnippet + +snippet ;fe "Minify safe iife" +;(function`!p snip.rv = space_before_function_paren(snip)`(${1}) { + ${VISUAL}$0 +}(${2})) endsnippet snippet timeout "setTimeout function" -setTimeout(function() { +setTimeout(function`!p snip.rv = space_before_function_paren(snip)`() { ${VISUAL}$0 -}${2:.bind(${3:this})}, ${1:10}); +}${2:.bind(${3:this})}, ${1:10})`!p snip.rv = semi(snip)` endsnippet snippet fi "for prop in obj using hasOwnProperty" b -for (${1:prop} in ${2:obj}){ - if ($2.hasOwnProperty($1)) { +for`!p snip.rv = keyword_spacing(snip)`(${1:prop} in ${2:obj}){ + if`!p snip.rv = keyword_spacing(snip)`($2.hasOwnProperty($1)) { ${VISUAL}$0 } } endsnippet +snippet if "if (condition) { ... }" +if`!p snip.rv = keyword_spacing(snip)`(${1:true}) { + ${VISUAL}$0 +} +endsnippet + +snippet ife "if (condition) { ... } else { ... }" +if`!p snip.rv = keyword_spacing(snip)`(${1:true}) { + ${VISUAL}$0 +}`!p snip.rv = keyword_spacing(snip)`else`!p snip.rv = keyword_spacing(snip)`{ + ${2} +} +endsnippet + +snippet switch +switch`!p snip.rv = keyword_spacing(snip)`(${VISUAL}${1:expression}) { + case '${VISUAL}${3:case}': + ${4} + break`!p snip.rv = semi(snip)` + ${0} + default: + ${2} +} +endsnippet + +snippet case "case 'xyz': ... break" +case`!p snip.rv = keyword_spacing(snip)`'${VISUAL}${1:case}': + ${VISUAL}$0 + break`!p snip.rv = semi(snip)` +endsnippet + +snippet do "do { ... } while (condition)" +do`!p snip.rv = keyword_spacing(snip)`{ + ${VISUAL}$0 +}`!p snip.rv = keyword_spacing(snip)`while`!p snip.rv = keyword_spacing(snip)`(${1:/* condition */})`!p snip.rv = semi(snip)` +endsnippet + +snippet ret "Return statement" +return ${VISUAL}$0`!p snip.rv = semi(snip)` +endsnippet + +snippet us +'use strict'`!p snip.rv = semi(snip)` +endsnippet + # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/matlab.snippets b/sources_non_forked/vim-snippets/UltiSnips/matlab.snippets new file mode 100644 index 00000000..4dc332bd --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/matlab.snippets @@ -0,0 +1,24 @@ +priority -50 + +snippet switch "switch ... otherwise" +switch ${1:n} + case ${2:0} + ${3}${4: + otherwise + ${5}} +end +endsnippet + +snippet clc "class with constructor" b +classdef ${1:`!p +snip.rv = snip.basename or "class_name"`} + properties + ${2} + end + methods + function obj = $1(${3}) + ${4} + end${0} + end +end +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/ruby.snippets b/sources_non_forked/vim-snippets/UltiSnips/ruby.snippets index b7124f83..c61b2766 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/ruby.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/ruby.snippets @@ -1,5 +1,26 @@ priority -50 +# +# Global functions +# + +global !p + +def write_instance_vars(arglist, snip): + args = str(arglist).split(',') + for arg in args: + name = arg.strip().replace(':', ' ').split(' ', 1)[0] + if name: + snip += ' @{} = {}'.format(name, name) + else: + snip += '' + +endglobal + +# +# Snippets +# + snippet "^#!" "#!/usr/bin/env ruby" r #!/usr/bin/env ruby $0 @@ -17,8 +38,7 @@ end endsnippet snippet defi "def initialize ..." -def initialize${1:(${2:*args})} - $0 +def initialize($1)`!p write_instance_vars(t[1],snip)`$0 end endsnippet @@ -212,32 +232,6 @@ except: end endsnippet -snippet "(\S+)\.Each_?w(ith)?_?i(ndex)?" ".each_with_index { |,| }" r -`!p snip.rv=match.group(1)`.each_with_index { |${1:`!p -element_name = match.group(1).lstrip('$@') -ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name) -try: - wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1)) - snip.rv = wmatch.group(1).lower() -except: - snip.rv = 'element' -`},${2:i}| $0 } -endsnippet - -snippet "(\S+)\.each_?w(ith)?_?i(ndex)?" ".each_with_index do |,| end" r -`!p snip.rv=match.group(1)`.each_with_index do |${1:`!p -element_name = match.group(1).lstrip('$@') -ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name) -try: - wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1)) - snip.rv = wmatch.group(1).lower() -except: - snip.rv = 'element' -`},${2:i}| - $0 -end -endsnippet - snippet "(\S+)\.Each_?p(air)?" ".each_pair { |,| }" r `!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| $0 } endsnippet @@ -298,20 +292,6 @@ rescue end endsnippet -snippet begin "begin ... rescue ... else ... ensure ... end" -begin - ${1:# Raise exception} -rescue Exception => e - puts e.message - puts e.backtrace.inspect - ${2:# Rescue} -else - ${3:# other exception} -ensure - ${0:# always excute} -end -endsnippet - snippet rescue rescue Exception => e puts e.message @@ -326,10 +306,6 @@ $0 end endsnippet -snippet alias "alias : :" -alias :${1:new_name} :${2:old_name} -endsnippet - snippet class "class def initialize ... end end" class ${1:class_name} def initialize(${2:*args}) diff --git a/sources_non_forked/vim-snippets/UltiSnips/snippets.snippets b/sources_non_forked/vim-snippets/UltiSnips/snippets.snippets index ee0c8c76..6fc26688 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/snippets.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/snippets.snippets @@ -2,15 +2,15 @@ priority -50 # We use a little hack so that the snippet is expanded # and parsed correctly -snippet snip "Snippet definition" b +snippet usnip "Ultisnips snippet definition" b `!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:b} -$0 +${0:${VISUAL}} `!p snip.rv = "endsnippet"` endsnippet snippet global "Global snippet" b `!p snip.rv = "global"` !p -$0 +${0:${VISUAL}} `!p snip.rv = "endglobal"` endsnippet diff --git a/sources_non_forked/vim-snippets/pythonx/javascript_snippets.py b/sources_non_forked/vim-snippets/pythonx/javascript_snippets.py new file mode 100644 index 00000000..8757d49b --- /dev/null +++ b/sources_non_forked/vim-snippets/pythonx/javascript_snippets.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Helper utilities to format javascript snippets. +""" + +ALWAYS = 'always' +NEVER = 'never' + + +def get_option(snip, option, default=None): + return snip.opt('g:ultisnips_javascript["{}"]'.format(option), default) + + +def semi(snip): + option = get_option(snip, 'semi', ALWAYS) + + if option == NEVER: + ret = '' + elif option == ALWAYS: + ret = ';' + else: + ret = ';' + return ret + + +def space_before_function_paren(snip): + option = get_option(snip, 'space-before-function-paren', NEVER) + + if option == NEVER: + ret = '' + elif option == ALWAYS: + ret = ' ' + else: + ret = '' + return ret + + +def keyword_spacing(snip): + option = get_option(snip, 'keyword-spacing', ALWAYS) + + if option == NEVER: + ret = '' + elif option == ALWAYS: + ret = ' ' + else: + ret = '' + return ret diff --git a/sources_non_forked/vim-snippets/snippets/c.snippets b/sources_non_forked/vim-snippets/snippets/c.snippets index ea744d54..6e8fb0a5 100644 --- a/sources_non_forked/vim-snippets/snippets/c.snippets +++ b/sources_non_forked/vim-snippets/snippets/c.snippets @@ -130,6 +130,84 @@ snippet fun { ${4} } +# function definition with zero parameters +snippet fun0 + ${1:void} ${2:function_name}() + { + ${3} + } +# function definition with Doxygen documentation +snippet dfun0 + /*! \brief ${1:Brief function description here} + * + * ${2:Detailed description of the function} + * + * \return ${3:Return parameter description} + */ + ${4:void} ${5:function_name}() + { + ${6} + } +# function definition with one parameter +snippet fun1 + ${1:void} ${2:function_name}(${3:Type} ${4:Parameter}) + { + ${5} + } +# function definition with one parameter with Doxygen documentation +snippet dfun1 + /*! \brief ${1:Brief function description here} + * + * ${2:Detailed description of the function} + * + * \param $3 ${4:Parameter description} + * \return ${5:Return parameter description} + */ + ${6:void} ${7:function_name}(${8:Type} ${3:Parameter}) + { + ${9} + } +# function definition with two parameters +snippet fun2 + ${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}) + { + ${7} + } +# function definition with two parameters with Doxygen documentation +snippet dfun2 + /*! \brief ${1:Brief function description here} + * + * ${2:Detailed description of the function} + * + * \param $3 ${4:Parameter description} + * \param $5 ${6:Parameter description} + * \return ${7:Return parameter description} + */ + ${8:void} ${9:function_name}(${10:Type} ${3:Parameter}, ${11:Type} ${5:Parameter}) + { + ${12} + } +# function definition with two parameters +snippet fun3 + ${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}, ${7:Type} ${8:Parameter}) + { + ${9} + } +# function definition with two parameters with Doxygen documentation +snippet dfun3 + /*! \brief ${1:Brief function description here} + * + * ${2:Detailed description of the function} + * + * \param $3 ${4:Parameter description} + * \param $5 ${6:Parameter description} + * \param $7 ${8:Parameter description} + * \return ${9:Return parameter description} + */ + ${10:void} ${11:function_name}(${12:Type} ${3:Parameter}, ${13:Type} ${5:Parameter}, ${14:Type} ${7:Parameter}) + { + ${15} + } # function declaration snippet fund ${1:void} ${2:function_name}(${3}); @@ -140,21 +218,39 @@ snippet td typedef ${1:int} ${2:MyCustomType}; # struct snippet st + /*! \struct $1 + * \brief ${3:Brief struct description} + * + * ${4:Detailed description} + */ struct ${1:`vim_snippets#Filename('$1_t', 'name')`} { - ${2:/* data */} - }${3: /* optional variable list */}; + ${2:Data} /*!< ${4:Description} */ + }${5: /* optional variable list */}; # typedef struct snippet tds + /*! \struct $2 + * \brief ${5:Brief struct description} + * + * ${6:Detailed description} + */ typedef struct ${2:_$1 }{ - ${3:/* data */} + m_${3:Data} /*!< ${4:Description} */ } ${1:`vim_snippets#Filename('$1_t', 'name')`}; snippet enum + /*! \enum $1 + * + * ${2:Detailed description} + */ enum ${1:name} { ${0} }; # typedef enum snippet tde + /*! \enum $2 + * + * ${4:Detailed description} + */ typedef enum { - ${1:/* data */} + ${1:Data} /*!< ${3:Description} */ } ${2:foo}; ## ## Input/Output @@ -228,6 +324,11 @@ snippet getopt } } ## +# TODO section +snippet todo + /*! TODO: ${1:Todo description here} + * \todo $1 + */ ## Miscellaneous # This is kind of convenient snippet . diff --git a/sources_non_forked/vim-snippets/snippets/cpp.snippets b/sources_non_forked/vim-snippets/snippets/cpp.snippets index 42c37341..7a55b95e 100644 --- a/sources_non_forked/vim-snippets/snippets/cpp.snippets +++ b/sources_non_forked/vim-snippets/snippets/cpp.snippets @@ -78,20 +78,61 @@ snippet mu ## Class # class snippet cl + /*! \class $1 + * \brief ${3:Brief class description} + * + * ${4:Detailed description} + */ class ${1:`vim_snippets#Filename('$1', 'name')`} { public: $1(${2}); - ~$1(); + virtual ~$1(); - private: - ${0:/* data */} + protected: + m_${5}; /*!< ${6:Member description} */ }; # member function implementation snippet mfun ${4:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) { ${0} } +# member function implementation without parameters +snippet dmfun0 + /*! \brief ${4:Brief function description here} + * + * ${5:Detailed description} + * + * \return ${6:Return parameter description} + */ + ${3:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}() { + ${0} + } +# member function implementation with one parameter +snippet dmfun1 + /*! \brief ${6:Brief function description here} + * + * ${7:Detailed description} + * + * \param $4 ${8:Parameter description} + * \return ${9:Return parameter description} + */ + ${5:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3:Type} ${4:Parameter}) { + ${0} + } +# member function implementation with two parameter +snippet dmfun2 + /*! \brief ${8:Brief function description here} + * + * ${9:Detailed description} + * + * \param $4 ${10:Parameter description} + * \param $6 ${11:Parameter description} + * \return ${12:Return parameter description} + */ + ${7:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3:Type} ${4:Parameter},${5:Type} ${6:Parameter}) { + ${0} + } # namespace snippet ns namespace ${1:`vim_snippets#Filename('', 'my')`} { @@ -152,3 +193,13 @@ snippet lld [${1}](${2}){ ${3} }; +# snippets exception +snippet try + try { + + }catch(${1}) { + + } + + + diff --git a/sources_non_forked/vim-snippets/snippets/fortran.snippets b/sources_non_forked/vim-snippets/snippets/fortran.snippets index 8fecd330..e61d3fb5 100644 --- a/sources_non_forked/vim-snippets/snippets/fortran.snippets +++ b/sources_non_forked/vim-snippets/snippets/fortran.snippets @@ -28,9 +28,12 @@ snippet doc $0 snippet dox !> @brief ${1} + !! !> ${2} !> @author `g:snips_author` ${0} +snippet doxp + !> @param[${1}]${0} # Variables definitions # Boolean snippet bool diff --git a/sources_non_forked/vim-snippets/snippets/jinja.snippets b/sources_non_forked/vim-snippets/snippets/jinja.snippets index 7d14ca83..a6f274ab 100644 --- a/sources_non_forked/vim-snippets/snippets/jinja.snippets +++ b/sources_non_forked/vim-snippets/snippets/jinja.snippets @@ -78,7 +78,7 @@ snippet spaceless snippet ssi {% ssi ${0} %} snippet trans - {% trans "${0:string}" %} + {% trans %}${0}{% endtrans %} snippet url {% url ${1} as ${0} %} snippet widthratio diff --git a/sources_non_forked/vim-snippets/snippets/matlab.snippets b/sources_non_forked/vim-snippets/snippets/matlab.snippets new file mode 100644 index 00000000..19b6fe87 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/matlab.snippets @@ -0,0 +1,64 @@ +snippet if if + if ${1} + ${0} + end + +snippet ife if ... else + if ${1} + ${2} + else + ${0} + end + +snippet el else + else + ${0} + +snippet eif elsif + elseif ${1} + ${0} + +snippet wh while + while ${1} + ${0} + end + +snippet for for + for ${1:i} = ${2:1:n} + ${0} + end + +snippet parfor parfor + parfor ${1:i} = ${2:1:n} + ${0} + end + +snippet fun function + function [${3:out}] = ${1:`vim_snippets#Filename("$1", "fun_name")`}(${2}) + ${0} + +snippet try try ... catch + try + ${1} + catch ${2:err} + ${0} + end + +snippet switch switch + switch ${1:n} + case ${2:0} + ${0} + end + +snippet @ anonymous function + @(${1:x}) ${0:x*x} + +snippet cl class + classdef ${1:`vim_snippets#Filename("$1", "class_name")`} + properties + ${2} + end + methods + ${0} + end + end diff --git a/sources_non_forked/vim-snippets/snippets/php.snippets b/sources_non_forked/vim-snippets/snippets/php.snippets index 52572da9..fb313b84 100644 --- a/sources_non_forked/vim-snippets/snippets/php.snippets +++ b/sources_non_forked/vim-snippets/snippets/php.snippets @@ -94,9 +94,9 @@ snippet E $_ENV['${1:variable}'] snippet F $_FILES['${1:variable}'] -snippet G +snippet G "_GET array" $_GET['${1:variable}'] -snippet P +snippet P "_POST array" $_POST['${1:variable}'] snippet R $_REQUEST['${1:variable}'] diff --git a/sources_non_forked/vim-snippets/snippets/ruby.snippets b/sources_non_forked/vim-snippets/snippets/ruby.snippets index 9dc984fd..340391eb 100644 --- a/sources_non_forked/vim-snippets/snippets/ruby.snippets +++ b/sources_non_forked/vim-snippets/snippets/ruby.snippets @@ -142,21 +142,6 @@ snippet mod module .. end module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} ${0} end -snippet mod module .. ClassMethods .. end - module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} - module ClassMethods - ${0} - end - - module InstanceMethods - - end - - def self.included(receiver) - receiver.extend ClassMethods - receiver.send :include, InstanceMethods - end - end # attr_reader snippet r attr_reader :${0:attr_names} diff --git a/sources_non_forked/vim-snippets/snippets/rust.snippets b/sources_non_forked/vim-snippets/snippets/rust.snippets index 2a353e49..25effe6e 100644 --- a/sources_non_forked/vim-snippets/snippets/rust.snippets +++ b/sources_non_forked/vim-snippets/snippets/rust.snippets @@ -142,7 +142,7 @@ snippet stn "Struct with new constructor" } impl $1 { - pub fn new(${2}) -> $1 { + pub fn new(${2}) -> Self { $1 { ${3} } } } diff --git a/sources_non_forked/vim-snippets/snippets/snippets.snippets b/sources_non_forked/vim-snippets/snippets/snippets.snippets index dc8de42f..c2d932ae 100644 --- a/sources_non_forked/vim-snippets/snippets/snippets.snippets +++ b/sources_non_forked/vim-snippets/snippets/snippets.snippets @@ -1,10 +1,7 @@ # snippets for making snippets :) snippet snip - snippet ${1:trigger} - ${0} -snippet msnip - snippet ${1:trigger} ${2:description} - ${0} + snippet ${1:trigger} "${2:description}" + ${0:${VISUAL}} snippet v {VISUAL} snippet $ From a35351a21b1be5b5b791c30d3fae83497825b952 Mon Sep 17 00:00:00 2001 From: weiyang Date: Sat, 11 Mar 2017 18:41:34 +0800 Subject: [PATCH 09/74] [tmux] set 'termguicolors' when running nvim Signed-off-by: weiyang --- vimrcs/filetypes.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vimrcs/filetypes.vim b/vimrcs/filetypes.vim index 8c4eb9db..030cd497 100644 --- a/vimrcs/filetypes.vim +++ b/vimrcs/filetypes.vim @@ -63,5 +63,9 @@ au FileType gitcommit call setpos('.', [0, 1, 1, 0]) " => Shell section """""""""""""""""""""""""""""" if exists('$TMUX') - set term=screen-256color + if has('nvim') + set termguicolors + else + set term=screen-256color + endif endif From 6b606a73ac377b9936c80cccf56a89a002bafa7c Mon Sep 17 00:00:00 2001 From: Juil Yoon Date: Sat, 11 Mar 2017 22:18:41 -0500 Subject: [PATCH 10/74] Update link to Source Code Pro by Adobe. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 489ec5f9..41695972 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The awesome version includes a lot of great plugins, configurations and color sc git clone https://github.com/amix/vimrc.git ~/.vim_runtime sh ~/.vim_runtime/install_awesome_vimrc.sh -I also recommend using [Source Code Pro font from Adobe](http://store1.adobe.com/cfusion/store/html/index.cfm?event=displayFontPackage&code=1960) (it's free and awesome font for writing and programming). The Awesome vimrc is already setup to try to use it +I also recommend using [Source Code Pro font from Adobe](https://typekit.com/fonts/source-code-pro) (it's free and awesome font for writing and programming). The Awesome vimrc is already setup to try to use it ## How to install the Basic version? The basic version is basically just one file and no plugins. You can check out [basic.vim](https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim). From 395c077dcbe2b9e997a9e3de854ea2835e703489 Mon Sep 17 00:00:00 2001 From: amix Date: Tue, 14 Mar 2017 16:16:07 +0100 Subject: [PATCH 11/74] Updated plugins --- sources_non_forked/goyo.vim/autoload/goyo.vim | 2 +- .../vim-commentary/plugin/commentary.vim | 4 +- .../vim-go/.github/CONTRIBUTING.md | 2 +- sources_non_forked/vim-go/CHANGELOG.md | 27 +++++++-- sources_non_forked/vim-go/autoload/go/cmd.vim | 22 ++++++++ .../vim-go/autoload/go/guru.vim | 24 +------- .../vim-go/autoload/go/rename.vim | 6 ++ sources_non_forked/vim-go/doc/vim-go.txt | 27 ++++----- .../vim-go/ftplugin/go/commands.vim | 2 +- sources_non_forked/vim-pug/syntax/pug.vim | 10 ++-- .../vim-snipmate/autoload/snipMate.vim | 11 +++- .../vim-snipmate/autoload/snipmate/parse.vim | 20 ++++++- sources_non_forked/vim-snipmate/t/parser.vim | 10 ++++ .../vim-snippets/UltiSnips/cs.snippets | 56 +++++++++++++++++-- .../vim-snippets/snippets/cs.snippets | 14 ++--- 15 files changed, 170 insertions(+), 67 deletions(-) diff --git a/sources_non_forked/goyo.vim/autoload/goyo.vim b/sources_non_forked/goyo.vim/autoload/goyo.vim index 735c950a..94216d1a 100644 --- a/sources_non_forked/goyo.vim/autoload/goyo.vim +++ b/sources_non_forked/goyo.vim/autoload/goyo.vim @@ -33,7 +33,7 @@ function! s:get_color(group, attr) endfunction function! s:set_color(group, attr, color) - let gui = a:color =~ '^#' + let gui = has('gui_running') || has('termguicolors') && &termguicolors execute printf('hi %s %s%s=%s', a:group, gui ? 'gui' : 'cterm', a:attr, a:color) endfunction diff --git a/sources_non_forked/vim-commentary/plugin/commentary.vim b/sources_non_forked/vim-commentary/plugin/commentary.vim index 0bef7cc9..a7b0ced7 100644 --- a/sources_non_forked/vim-commentary/plugin/commentary.vim +++ b/sources_non_forked/vim-commentary/plugin/commentary.vim @@ -96,7 +96,9 @@ if !hasmapto('Commentary') || maparg('gc','n') ==# '' nmap gc Commentary omap gc Commentary nmap gcc CommentaryLine - nmap cgc ChangeCommentary + if maparg('c','n') ==# '' + nmap cgc ChangeCommentary + endif nmap gcu CommentaryCommentary endif diff --git a/sources_non_forked/vim-go/.github/CONTRIBUTING.md b/sources_non_forked/vim-go/.github/CONTRIBUTING.md index 7266ccea..450f9598 100644 --- a/sources_non_forked/vim-go/.github/CONTRIBUTING.md +++ b/sources_non_forked/vim-go/.github/CONTRIBUTING.md @@ -4,6 +4,6 @@ Thanks for improving vim-go! Before you dive in please read the following: [FAQ](https://github.com/fatih/vim-go/wiki/FAQ-Troubleshooting), it might have answers for your problem 2. If you add a new feature please don't forget to update the documentation: - [doc/vim-go.txt](doc/vim-go.txt) + [doc/vim-go.txt](https://github.com/fatih/vim-go/blob/master/doc/vim-go.txt) 3. If it's a breaking change or exceed +100 lines please open an issue first and describe the changes you want to make. diff --git a/sources_non_forked/vim-go/CHANGELOG.md b/sources_non_forked/vim-go/CHANGELOG.md index 46662bc8..9d245fc2 100644 --- a/sources_non_forked/vim-go/CHANGELOG.md +++ b/sources_non_forked/vim-go/CHANGELOG.md @@ -2,7 +2,11 @@ FEATURES: -* New `:GoAddTags` and `:GoRemoveTags` command based on the tool [gomodifytags](https://github.com/fatih/gomodifytags). This fixes many old bugs that were due prior regexp based implementation. For the usage please read the docs and checkout the demo at: https://github.com/fatih/vim-go/pull/1204 [gh-1204] +* New `:GoAddTags` and `:GoRemoveTags` command based on the tool + [gomodifytags](https://github.com/fatih/gomodifytags). This fixes many old + bugs that were due prior regexp based implementation. For the usage please + read the docs and checkout the demo at: + https://github.com/fatih/vim-go/pull/1204 [gh-1204] * Add new `errl` snippet that expands to [gh-1185]: ``` @@ -10,12 +14,16 @@ if err != nil { log.Fatal(err) } ``` +* New `:GoBuildTags` command to change build tags for tools such as `guru`, + `gorename`, etc ... There is also a new setting called `g:go_build_tags` + [gh-1232] IMPROVEMENTS: -* Lowercase `` in mappings examples for consisten documentation across the README [gh-1192] +* Lowercase `` in mappings examples for consistent documentation across the README [gh-1192] * All of files should be written in utf-8 if the file will be passed to external command. [gh-1184] -* `:GoAddTags` is now able to add options to existing tags with the syntax `:GoAddTags key,option`, i.e: `:GoAddTags json,omitempty` [gh-985] +* `:GoAddTags` is now able to add options to existing tags with the syntax + `:GoAddTags key,option`, i.e: `:GoAddTags json,omitempty` [gh-985] * Document 'noshowmode' requirement for echo_go_info [gh-1197] * Improve godoc view for vertical splits [gh-1195] * Set GOPATH for both possible go guru execution paths (sync and async) [gh-1193] @@ -23,7 +31,8 @@ IMPROVEMENTS: BUG FIXES: * Honor `g:go_echo_command_info` when dispatching builds in neovim [gh-1176] -* Fix `:GoBuild` error in neovim due to invalid jobcontrol handler function signatures (`s:on_stdout`, `s:on_stderr`)[gh-1176] +* Fix `:GoBuild` error in neovim due to invalid jobcontrol handler function + signatures (`s:on_stdout`, `s:on_stderr`)[gh-1176] * Update statusline before and after `go#jobcontrol#Spawn` command is executed [gh-1176] * Correctly report the value of the 'g:go_guru_tags' variable [gh-1177] * Ensure no trailing `:` exist in GOPATH detection if initial GOPATH is not set [gh-1194] @@ -36,12 +45,20 @@ BUG FIXES: * Respect go_fmt_options when running goimports [gh-1211] * Set the filename in the location-list when there is an error with :GoFmt [gh-1199] +BACKWARDS INCOMPATIBILITIES: + +* The command `:GoGuruTags` is removed in favour of the new command + `:GoBuildTags`. This command will be used now not just for `guru`, also for + all new commands such as `guru` [gh-1232] +* The setting `g:go_guru_tags` is removed in favour of the new setting + `g:go_build_tags` [gh-1232] + ## 1.11 - (January 9, 2017) FEATURES: -* Travis test integration has been added. Now any file that is added as `_test.vim` will be automatically tested in for every Pull Request (just like how we add tests to Go with `_test.go`). Going forward this will tremendously increase the stability and decrease the maintaince burden of vim-go. [gh-1157] +* Travis test integration has been added. Now any file that is added as `_test.vim` will be automatically tested in for every Pull Request (just like how we add tests to Go with `_test.go`). Going forward this will tremendously increase the stability and decrease the maintenance burden of vim-go. [gh-1157] * Add new `g:go_updatetime` setting to change the default updatetime (which was hardcoded previously) [gh-1055] * Add new `g:go_template_use_pkg` setting to enable to use cwd as package name instead of basic template file [gh-1124] diff --git a/sources_non_forked/vim-go/autoload/go/cmd.vim b/sources_non_forked/vim-go/autoload/go/cmd.vim index badca313..02e8e102 100644 --- a/sources_non_forked/vim-go/autoload/go/cmd.vim +++ b/sources_non_forked/vim-go/autoload/go/cmd.vim @@ -76,6 +76,28 @@ function! go#cmd#Build(bang, ...) abort endfunction +" BuildTags sets or shows the current build tags used for tools +function! go#cmd#BuildTags(bang, ...) abort + if a:0 + if a:0 == 1 && a:1 == '""' + unlet g:go_build_tags + call go#util#EchoSuccess("build tags are cleared") + else + let g:go_build_tags = a:1 + call go#util#EchoSuccess("build tags are changed to: ". a:1) + endif + + return + endif + + if !exists('g:go_build_tags') + call go#util#EchoSuccess("build tags are not set") + else + call go#util#EchoSuccess("current build tags: ". g:go_build_tags) + endif +endfunction + + " Run runs the current file (and their dependencies if any) in a new terminal. function! go#cmd#RunTerm(bang, mode, files) abort if empty(a:files) diff --git a/sources_non_forked/vim-go/autoload/go/guru.vim b/sources_non_forked/vim-go/autoload/go/guru.vim index df31d1b3..7edd6716 100644 --- a/sources_non_forked/vim-go/autoload/go/guru.vim +++ b/sources_non_forked/vim-go/autoload/go/guru.vim @@ -46,8 +46,8 @@ function! s:guru_cmd(args) range abort endif " check for any tags - if exists('g:go_guru_tags') - let tags = get(g:, 'go_guru_tags') + if exists('g:go_build_tags') + let tags = get(g:, 'go_build_tags') call extend(cmd, ["-tags", tags]) let result.tags = tags endif @@ -619,24 +619,4 @@ function! go#guru#Scope(...) abort endif endfunction -function! go#guru#Tags(...) abort - if a:0 - if a:0 == 1 && a:1 == '""' - unlet g:go_guru_tags - call go#util#EchoSuccess("guru tags is cleared") - else - let g:go_guru_tags = a:1 - call go#util#EchoSuccess("guru tags changed to: ". a:1) - endif - - return - endif - - if !exists('g:go_guru_tags') - call go#util#EchoSuccess("guru tags is not set") - else - call go#util#EchoSuccess("current guru tags: ". g:go_guru_tags) - endif -endfunction - " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/rename.vim b/sources_non_forked/vim-go/autoload/go/rename.vim index 7d5579d2..ac2f0181 100644 --- a/sources_non_forked/vim-go/autoload/go/rename.vim +++ b/sources_non_forked/vim-go/autoload/go/rename.vim @@ -41,6 +41,12 @@ function! go#rename#Rename(bang, ...) abort let cmd = [bin_path, "-offset", offset, "-to", to_identifier] + " check for any tags + if exists('g:go_build_tags') + let tags = get(g:, 'go_build_tags') + call extend(cmd, ["-tags", tags]) + endif + if go#util#has_job() call go#util#EchoProgress(printf("renaming to '%s' ...", to_identifier)) call s:rename_job({ diff --git a/sources_non_forked/vim-go/doc/vim-go.txt b/sources_non_forked/vim-go/doc/vim-go.txt index d37df28f..29be99f5 100644 --- a/sources_non_forked/vim-go/doc/vim-go.txt +++ b/sources_non_forked/vim-go/doc/vim-go.txt @@ -598,15 +598,16 @@ CTRL-t use the variable |'g:go_metalinter_command'|. To override the maximum linters execution time use |'g:go_metalinter_deadline'| variable. - *:GoGuruTags* -:GoGuruTags [tags] + *:GoBuildTags* +:GoBuildTags [tags] - Changes the custom |'g:go_guru_tags'| setting and overrides it with the - given build tags. This command cooperate with GoReferrers command when - there exist mulitiple build tags in your project, then you can set one of - the build tags for GoReferrers to find more accurate. - The custom build tags is cleared (unset) if `""` is given. If no arguments - is given it prints the current custom build tags. + Changes the build tags for various commands. If you have any file that + uses a custom build tag, such as `//+build integration` , this command can + be used to pass it to all tools that accepts tags, such as guru, gorenate, + etc.. + + The build tags is cleared (unset) if `""` is given. If no arguments is + given it prints the current custom build tags. *:AsmFmt* :AsmFmt @@ -1208,15 +1209,15 @@ set, so the relevant commands defaults are being used. > let g:go_guru_scope = [] < - *'g:go_guru_tags'* + *'g:go_build_tags'* These options that will be automatically passed to the `-tags` option of -`go guru` when it's invoked with |:GoDef|. You can use |:GoGuruTags| to set -this. By default it's not set. +various tools, such as `guru`, `gorename`, etc... This is a permanatent +setting. A more useful way is to use |:GoBuildTags| to dynamically change or +remove build tags. By default it's not set. > - let g:go_guru_tags = '' + let g:go_build_tags = '' < - *'g:go_highlight_array_whitespace_error'* Highlights white space after "[]". > diff --git a/sources_non_forked/vim-go/ftplugin/go/commands.vim b/sources_non_forked/vim-go/ftplugin/go/commands.vim index 6f108a67..f5357d2a 100644 --- a/sources_non_forked/vim-go/ftplugin/go/commands.vim +++ b/sources_non_forked/vim-go/ftplugin/go/commands.vim @@ -12,7 +12,6 @@ command! -range=% GoCallstack call go#guru#Callstack() command! -range=% GoFreevars call go#guru#Freevars() command! -range=% GoChannelPeers call go#guru#ChannelPeers() command! -range=% GoReferrers call go#guru#Referrers() -command! -nargs=? GoGuruTags call go#guru#Tags() command! -range=0 GoSameIds call go#guru#SameIds() command! -range=0 GoSameIdsClear call go#guru#ClearSameIds() @@ -31,6 +30,7 @@ command! -nargs=0 GoAutoTypeInfoToggle call go#complete#ToggleAutoTypeInfo() " -- cmd command! -nargs=* -bang GoBuild call go#cmd#Build(0,) +command! -nargs=? -bang GoBuildTags call go#cmd#BuildTags(0, ) command! -nargs=* -bang GoGenerate call go#cmd#Generate(0,) command! -nargs=* -bang -complete=file GoRun call go#cmd#Run(0,) command! -nargs=* -bang GoInstall call go#cmd#Install(0, ) diff --git a/sources_non_forked/vim-pug/syntax/pug.vim b/sources_non_forked/vim-pug/syntax/pug.vim index 9e5ea3da..0fb146d8 100644 --- a/sources_non_forked/vim-pug/syntax/pug.vim +++ b/sources_non_forked/vim-pug/syntax/pug.vim @@ -33,9 +33,9 @@ syn match pugBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=pugTag,pugClassChar,p syn match pugTag "+\?[[:alnum:]_-]\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@pugComponent syn cluster pugComponent contains=pugAttributes,pugIdChar,pugBlockExpansionChar,pugClassChar,pugPlainChar,pugJavascript,pugTagBlockChar,pugTagInlineText syntax keyword pugCommentTodo contained TODO FIXME XXX TBD -syn match pugComment '\(\s\+\|^\)\/\/.*$' contains=pugCommentTodo -syn region pugCommentBlock start="\z(\s\+\|^\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" contains=pugCommentTodo keepend -syn region pugHtmlConditionalComment start="" contains=pugCommentTodo +syn match pugComment '\(\s\+\|^\)\/\/.*$' contains=pugCommentTodo,@Spell +syn region pugCommentBlock start="\z(\s\+\|^\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" contains=pugCommentTodo,@Spell keepend +syn region pugHtmlConditionalComment start="" contains=pugCommentTodo,@Spell syn region pugAngular2 start="(" end=")" contains=htmlEvent syn region pugAttributes matchgroup=pugAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,pugHtmlArg,pugAngular2,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@pugComponent syn match pugClassChar "\." containedin=htmlTagName nextgroup=pugClass @@ -52,10 +52,10 @@ syn keyword pugHtmlArg contained href title syn match pugPlainChar "\\" contained syn region pugInterpolation matchgroup=pugInterpolationDelimiter start="[#!]{" end="}" contains=@htmlJavascript syn match pugInterpolationEscape "\\\@:h:h').'/README.md' + echoe "tlib is missing. See install instructions at ".expand(':h:h').'/README.md' endtry fun! Filename(...) abort @@ -117,7 +117,14 @@ function! snipMate#sniplist_str(snippet, stops) abort if type(item) == type('') let str .= item elseif type(item) == type([]) - let str .= snipMate#placeholder_str(item[0], a:stops) + let placeholder = snipMate#placeholder_str(item[0], a:stops) + if len(item) > 1 && type(item[1]) == type({}) + let placeholder = substitute(placeholder, + \ get(item[1], 'pat', ''), + \ get(item[1], 'sub', ''), + \ get(item[1], 'flags', '')) + endif + let str .= placeholder endif let pos += 1 diff --git a/sources_non_forked/vim-snipmate/autoload/snipmate/parse.vim b/sources_non_forked/vim-snipmate/autoload/snipmate/parse.vim index dd495e95..5f842609 100644 --- a/sources_non_forked/vim-snipmate/autoload/snipmate/parse.vim +++ b/sources_non_forked/vim-snipmate/autoload/snipmate/parse.vim @@ -171,6 +171,7 @@ endfunction function! s:parser_text(till) dict abort let ret = [] + let target = ret while self.pos < self.len let lines = [] @@ -180,8 +181,12 @@ function! s:parser_text(till) dict abort if !empty(var) if var[0] is# 'VISUAL' let lines = s:visual_placeholder(var, self.indent) + " Remove trailing newline. See #245 + if lines[-1] == '' && self.next == "\n" + call remove(lines, -1) + endif elseif var[0] >= 0 - call add(ret, var) + call add(target, var) call self.add_var(var) endif endif @@ -192,8 +197,12 @@ function! s:parser_text(till) dict abort endif if !empty(lines) - call add(ret, lines[0]) - call extend(self.stored_lines, lines[1:]) + call add(target, lines[0]) + call extend(self.stored_lines, lines[1:-2]) + " Don't change targets if there's only one line + if exists("lines[1]") + let target = [lines[-1]] + endif endif " Empty lines are ignored if this is tested at the start of an iteration @@ -203,6 +212,11 @@ function! s:parser_text(till) dict abort endwhile call s:join_consecutive_strings(ret) + if target isnot ret + call s:join_consecutive_strings(target) + call extend(self.stored_lines, target) + endif + return ret endfunction diff --git a/sources_non_forked/vim-snipmate/t/parser.vim b/sources_non_forked/vim-snipmate/t/parser.vim index c5cf8739..3c2aa6e5 100644 --- a/sources_non_forked/vim-snipmate/t/parser.vim +++ b/sources_non_forked/vim-snipmate/t/parser.vim @@ -118,6 +118,16 @@ describe 'snippet parser' \ ["\t baz"], ["x"]] end + it 'removes newlines from the end of VISUALs if before an end of line' + let b:snipmate_visual = "1\n2\n" + Expect Parse("x\n$VISUAL\nx") == [['x'], ['1'], ['2'], ['x']] + end + + it 'splits the before and after a $VISUAL if it is multiline' + let b:snipmate_visual = "1\n2\n3" + Expect Parse("foo $VISUAL bar") == [['foo 1'], ['2'], ['3 bar']] + end + it 'determines which var with an id is the stop' let [snip, stops] = Parse("$1$1$1", 0, 1) Expect snip == [[[1, "", stops[1]], [1, {}], [1, {}]]] diff --git a/sources_non_forked/vim-snippets/UltiSnips/cs.snippets b/sources_non_forked/vim-snippets/UltiSnips/cs.snippets index 89b61ca0..298eefd2 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/cs.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/cs.snippets @@ -16,7 +16,7 @@ namespace ${1:MyNamespace} endsnippet snippet class "class" w -class ${1:MyClass} +${1:public} class ${2:MyClass} { $0 } @@ -288,6 +288,10 @@ snippet cw "Console.WriteLine" b Console.WriteLine("$1"); endsnippet +snippet cr "Console.ReadLine" b +Console.ReadLine(); +endsnippet + # as you first type comma-separated parameters on the right, {n} values appear in the format string snippet cwp "Console.WriteLine with parameters" b Console.WriteLine("${2:`!p @@ -300,9 +304,9 @@ MessageBox.Show("${1:message}"); endsnippet -################## -# full methods # -################## +############# +# methods # +############# snippet equals "Equals method" b public override bool Equals(object obj) @@ -316,13 +320,53 @@ public override bool Equals(object obj) } endsnippet +snippet mth "Method" b +${1:public} ${2:void} ${3:MyMethod}(${4}) +{ + $0 +} +endsnippet + +snippet mths "Static method" b +${1:public} static ${2:void} ${3:MyMethod}(${4}) +{ + $0 +} +endsnippet + +############### +# constructor # +############### + +snippet ctor "Constructor" b +${1:public} ${2:`!p snip.rv = snip.basename or "untitled"`}(${3}) +{ + $0 +} +endsnippet ############## # comments # ############## -snippet /// "XML comment" b +snippet /// "XML summary comment" b ///

-/// $1 +/// $0 /// endsnippet + +snippet

${2} +endsnippet + +snippet ${2} +endsnippet + +snippet $0 +endsnippet + +snippet $0 +endsnippet diff --git a/sources_non_forked/vim-snippets/snippets/cs.snippets b/sources_non_forked/vim-snippets/snippets/cs.snippets index 391984bb..decf79af 100644 --- a/sources_non_forked/vim-snippets/snippets/cs.snippets +++ b/sources_non_forked/vim-snippets/snippets/cs.snippets @@ -56,7 +56,7 @@ # # Feedback is welcome! # -# Main +# Main snippet sim ${1:public }static int Main(string[] args) { ${0} @@ -358,7 +358,7 @@ snippet enum enum ${1} { ${0} } - + snippet enum+ public enum ${1} { ${0} @@ -378,7 +378,7 @@ snippet

${2} snippet ${1}{ + ${1} snippet snippet Date: Tue, 14 Mar 2017 16:18:11 +0100 Subject: [PATCH 12/74] . --- sources_non_forked/vim-gitgutter/LICENCE | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 sources_non_forked/vim-gitgutter/LICENCE diff --git a/sources_non_forked/vim-gitgutter/LICENCE b/sources_non_forked/vim-gitgutter/LICENCE new file mode 100644 index 00000000..38e2dc2d --- /dev/null +++ b/sources_non_forked/vim-gitgutter/LICENCE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) Andrew Stewart + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + From 1886475fd2c3c5814e242d3324b358804bcafa1b Mon Sep 17 00:00:00 2001 From: Martin Lavoie Date: Mon, 27 Mar 2017 15:27:30 -0400 Subject: [PATCH 13/74] Make plugins_config use relative path --- vimrcs/plugins_config.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vimrcs/plugins_config.vim b/vimrcs/plugins_config.vim index 53d0539e..e67e5a07 100644 --- a/vimrcs/plugins_config.vim +++ b/vimrcs/plugins_config.vim @@ -8,8 +8,9 @@ """""""""""""""""""""""""""""" " => Load pathogen paths """""""""""""""""""""""""""""" -call pathogen#infect('~/.vim_runtime/sources_forked/{}') -call pathogen#infect('~/.vim_runtime/sources_non_forked/{}') +let s:vim_runtime = expand(':p:h')."/.." +call pathogen#infect(s:vim_runtime.'/sources_forked/{}') +call pathogen#infect(s:vim_runtime.'/sources_non_forked/{}') call pathogen#helptags() """""""""""""""""""""""""""""" From 0ce60b6ed7cfb1533e55822e7e016f9ff59b5c02 Mon Sep 17 00:00:00 2001 From: Amir Salihefendic Date: Sat, 1 Apr 2017 12:52:19 +0200 Subject: [PATCH 14/74] Update README.md --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 541f0d07..0fb0b7c4 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # The Ultimate vimrc -Over the last 8 years I have used and tweaked Vim. This is my Ultimate vimrc. +Over the last 10 years I have used and tweaked Vim. This is the ultimate vimrc (or at least my version of it). There are two versions: @@ -73,8 +73,8 @@ I recommend reading the docs of these plugins to understand them better. Each of * [NERD Tree](https://github.com/scrooloose/nerdtree): A tree explorer plugin for vim * [ack.vim](https://github.com/mileszs/ack.vim): Vim plugin for the Perl module / CLI script 'ack' * [ag.vim](https://github.com/rking/ag.vim): A much faster Ack -* [ctrlp.vim](https://github.com/ctrlpvim/ctrlp.vim): Fuzzy file, buffer, mru and tag finder. In my config it's mapped to ``, because `` is used by YankRing -* [mru.vim](https://github.com/vim-scripts/mru.vim): Plugin to manage Most Recently Used (MRU) files. Includes my own fork which adds syntax highlighting to MRU. This plugin can be opened with `` +* [ctrlp.vim](https://github.com/ctrlpvim/ctrlp.vim): Fuzzy file, buffer, mru and tag finder. It's mapped to ``, because `` is used by YankRing +* [mru.vim](https://github.com/vim-scripts/mru.vim): Plugin to manage Most Recently Used (MRU) files. This plugin can be opened with `` * [open_file_under_cursor.vim](https://github.com/amix/open_file_under_cursor.vim): Open file under cursor when pressing `gf` * [vim-indent-object](https://github.com/michaeljsmith/vim-indent-object): Defines a new text object representing lines of code at the same indent level. Useful for python/vim scripts * [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors): Sublime Text style multiple selections for Vim, CTRL+N is remapped to CTRL+S (due to YankRing) @@ -90,7 +90,7 @@ Remove all clutter and focus only on the essential. Similar to iA Writer or Writ ## Included color schemes -* [peaksea](https://github.com/vim-scripts/peaksea): My favorite! +* [peaksea](https://github.com/vim-scripts/peaksea): The default * [vim-colors-solarized](https://github.com/altercation/vim-colors-solarized) * [vim-irblack](https://github.com/wgibbs/vim-irblack) * [mayansmoke](https://github.com/vim-scripts/mayansmoke) @@ -314,3 +314,4 @@ Do following: * Remove `~/.vim_runtime` * Remove any lines that reference `.vim_runtime` in your `~/.vimrc` + From 068316713be18cb9c8104c4b2fd9658f49ac96c9 Mon Sep 17 00:00:00 2001 From: amix Date: Sat, 1 Apr 2017 13:19:29 +0200 Subject: [PATCH 15/74] Updated to the readme file --- README.md | 59 +++++++++++++++++++++++-------------------------------- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 0fb0b7c4..76f53e91 100644 --- a/README.md +++ b/README.md @@ -6,21 +6,21 @@ Over the last 10 years I have used and tweaked Vim. This is the ultimate vimrc ( There are two versions: -* **Basic**: If you want something small just copy [basic.vim](https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim) into your ~/.vimrc and you will have a great basic setup -* **Awesome**: This includes a ton of useful plugins, color schemes and configurations +* **The Basic**: If you want something small just copy [basic.vim](https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim) into your ~/.vimrc and you will have a good basic setup +* **The Awesome**: Includes a ton of useful plugins, color schemes and configurations -I would of course recommend using the awesome version.c +I would of course recommend using the awesome version. ## How to install the Awesome version? -The awesome version includes a lot of great plugins, configurations and color schemes that make Vim a lot better. To install it simply do following: +The awesome version includes a lot of great plugins, configurations and color schemes that make Vim a lot better. To install it simply do following from your terminal: git clone https://github.com/amix/vimrc.git ~/.vim_runtime sh ~/.vim_runtime/install_awesome_vimrc.sh -I also recommend using [Source Code Pro font from Adobe](https://typekit.com/fonts/source-code-pro) (it's free and awesome font for writing and programming). The Awesome vimrc is already setup to try to use it +I also recommend using [the Hack font](http://sourcefoundry.org/hack/) (it's free and awesome font designed for source code). The Awesome vimrc is already setup to try to use it. ## How to install the Basic version? -The basic version is basically just one file and no plugins. You can check out [basic.vim](https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim). +The basic version is basically just one file and no plugins. Simply copy [basic.vim](https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim) and paste it into your vimrc. This is useful to install on remote servers where you don't need many plugins and you don't do many edits. @@ -67,25 +67,24 @@ Distraction free mode using [goyo.vim](https://github.com/junegunn/goyo.vim) and I recommend reading the docs of these plugins to understand them better. Each of them provide a much better Vim experience! -* [pathogen.vim](https://github.com/tpope/vim-pathogen): Manages the runtime path of the plugins -* [snipMate.vim](https://github.com/garbas/vim-snipmate): snipMate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim -* [bufexplorer.zip](https://github.com/vim-scripts/bufexplorer.zip): Buffer Explorer / Browser. This plugin can be opened with `` +* [ag.vim](https://github.com/rking/ag.vim): Vim plugin for `the_silver_searcher` (ag) -- a wicked fast grep +* [bufexplorer.zip](https://github.com/vim-scripts/bufexplorer.zip): Quickly and easily switch between buffers. This plugin can be opened with `` +* [ctrlp.vim](https://github.com/ctrlpvim/ctrlp.vim): Fuzzy file, buffer, mru and tag finder. It's mapped to `` +* [goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2): +* [lightline.vim](https://github.com/itchyny/lightline.vim): A light and configurable statusline/tabline for Vim * [NERD Tree](https://github.com/scrooloose/nerdtree): A tree explorer plugin for vim -* [ack.vim](https://github.com/mileszs/ack.vim): Vim plugin for the Perl module / CLI script 'ack' -* [ag.vim](https://github.com/rking/ag.vim): A much faster Ack -* [ctrlp.vim](https://github.com/ctrlpvim/ctrlp.vim): Fuzzy file, buffer, mru and tag finder. It's mapped to ``, because `` is used by YankRing * [mru.vim](https://github.com/vim-scripts/mru.vim): Plugin to manage Most Recently Used (MRU) files. This plugin can be opened with `` * [open_file_under_cursor.vim](https://github.com/amix/open_file_under_cursor.vim): Open file under cursor when pressing `gf` +* [pathogen.vim](https://github.com/tpope/vim-pathogen): Manage your vim runtimepath +* [snipmate.vim](https://github.com/garbas/vim-snipmate): snipmate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim +* [syntastic](https://github.com/scrooloose/syntastic): Syntax checking hacks for vim +* [vim-commentary](https://github.com/tpope/vim-commentary): Comment stuff out. Use `gcc` to comment out a line (takes a count), `gc` to comment out the target of a motion. `gcu` uncomments a set of adjacent commented lines. +* [vim-expand-region](https://github.com/terryma/vim-expand-region): Allows you to visually select increasingly larger regions of text using the same key combination +* [vim-fugitive](https://github.com/tpope/vim-fugitive): A Git wrapper so awesome, it should be illegal * [vim-indent-object](https://github.com/michaeljsmith/vim-indent-object): Defines a new text object representing lines of code at the same indent level. Useful for python/vim scripts * [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors): Sublime Text style multiple selections for Vim, CTRL+N is remapped to CTRL+S (due to YankRing) -* [vim-expand-region](https://github.com/terryma/vim-expand-region): Allows you to visually select increasingly larger regions of text using the same key combination. -* [vim-fugitive](https://github.com/tpope/vim-fugitive): A Git wrapper so awesome, it should be illegal -* [goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2): -Remove all clutter and focus only on the essential. Similar to iA Writer or Write Room [Read more here](http://amix.dk/blog/post/19744) -* [vim-commentary](https://github.com/tpope/vim-commentary): Comment stuff out. Use `gcc` to comment out a line (takes a count), `gc` to comment out the target of a motion. `gcu` uncomments a set of adjacent commented lines. -* [syntastic](https://github.com/scrooloose/syntastic): Syntax checking hacks for vim * [vim-yankstack](https://github.com/maxbrunsfeld/vim-yankstack): Maintains a history of previous yanks, changes and deletes -* [lightline.vim](https://github.com/itchyny/lightline.vim): A light and configurable statusline/tabline for Vim +Remove all clutter and focus only on the essential. Similar to iA Writer or Write Room [Read more here](http://amix.dk/blog/post/19744) ## Included color schemes @@ -115,13 +114,11 @@ After you have installed the setup you can create **~/.vim_runtime/my_configs.vi map ct :cd ~/Desktop/Todoist/todoist map cw :cd ~/Desktop/Wedoist/wedoist -You can also install your own plugins, for instance, via pathogen we can install [vim-rails](https://github.com/tpope/vim-rails): +You can also install your own plugins, for instance, via pathogen you can install [vim-rails](https://github.com/tpope/vim-rails): cd ~/.vim_runtime git clone git://github.com/tpope/vim-rails.git sources_non_forked/vim-rails -Now you have vim-rails installed ;-) - ## Key Mappings @@ -195,13 +192,9 @@ Switch CWD to the directory of the open buffer: map cd :cd %:p:h:pwd -Open vimgrep and put the cursor in the right position: +Open `ag.vim` and put the cursor in the right position: - map g :vimgrep // **/*. - -Vimgreps in the current file: - - map :vimgrep // % + map g :Ag Remove the Windows ^M - when the encodings gets messed up: @@ -240,9 +233,9 @@ Visual mode pressing `*` or `#` searches for the current selection: vnoremap * :call VisualSelection('f') vnoremap # :call VisualSelection('b') -When you press gv you vimgrep after the selected text: +When you press gv you `ag.vim` after the selected text: - vnoremap gv :call VisualSelection('gv') + vnoremap gv :call VisualSelection('gv', '') When you press `r` you can search and replace the selected text: @@ -273,7 +266,7 @@ Bash like keys for the command line: cnoremap cnoremap -Write the file as sudo (only on Unix). Super useful when you open a file and you don't have permissions to save your changes. [Vim tip](http://vim.wikia.com/wiki/Su-write): +Write the file as sudo (works only on Unix). Super useful when you open a file and you don't have permissions to save your changes. [Vim tip](http://vim.wikia.com/wiki/Su-write): :W @@ -293,7 +286,7 @@ Shortcuts using `` instead of special chars ### Cope Do :help cope if you are unsure what cope is. It's super useful! -When you search with vimgrep, display your results in cope by doing: +When you search with `ag.vim`, display your results in cope by doing: `cc` To go to the next search result do: @@ -313,5 +306,3 @@ Vimscript mappings: Do following: * Remove `~/.vim_runtime` * Remove any lines that reference `.vim_runtime` in your `~/.vimrc` - - From 50ae0a55f681bf46eeb3ec0da9cbf92f49bcc3dc Mon Sep 17 00:00:00 2001 From: amix Date: Sat, 1 Apr 2017 13:19:43 +0200 Subject: [PATCH 16/74] Removed ack.vim --- sources_non_forked/ack.vim/.gitignore | 1 - sources_non_forked/ack.vim/LICENSE | 89 ----- sources_non_forked/ack.vim/README.md | 161 --------- sources_non_forked/ack.vim/autoload/ack.vim | 246 -------------- sources_non_forked/ack.vim/doc/ack.txt | 315 ------------------ .../ack.vim/doc/ack_quick_help.txt | 15 - sources_non_forked/ack.vim/ftplugin/qf.vim | 9 - sources_non_forked/ack.vim/plugin/ack.vim | 83 ----- update_plugins.py | 1 - 9 files changed, 920 deletions(-) delete mode 100644 sources_non_forked/ack.vim/.gitignore delete mode 100644 sources_non_forked/ack.vim/LICENSE delete mode 100644 sources_non_forked/ack.vim/README.md delete mode 100644 sources_non_forked/ack.vim/autoload/ack.vim delete mode 100644 sources_non_forked/ack.vim/doc/ack.txt delete mode 100644 sources_non_forked/ack.vim/doc/ack_quick_help.txt delete mode 100644 sources_non_forked/ack.vim/ftplugin/qf.vim delete mode 100644 sources_non_forked/ack.vim/plugin/ack.vim diff --git a/sources_non_forked/ack.vim/.gitignore b/sources_non_forked/ack.vim/.gitignore deleted file mode 100644 index 6e92f57d..00000000 --- a/sources_non_forked/ack.vim/.gitignore +++ /dev/null @@ -1 +0,0 @@ -tags diff --git a/sources_non_forked/ack.vim/LICENSE b/sources_non_forked/ack.vim/LICENSE deleted file mode 100644 index 056ea36c..00000000 --- a/sources_non_forked/ack.vim/LICENSE +++ /dev/null @@ -1,89 +0,0 @@ -ack.vim is distributed under the same license terms as Vim itself, which you -can find in full with `:help license` within Vim, or copied in full herein. - -Copyright (c) 2007-2015 Antoine Imbert - and contributors. - -Maintainers may be contacted via GitHub Issues at: - - https://github.com/mileszs/ack.vim/issues - - -VIM LICENSE - -I) There are no restrictions on distributing unmodified copies of Vim except - that they must include this license text. You can also distribute - unmodified parts of Vim, likewise unrestricted except that they must - include this license text. You are also allowed to include executables - that you made from the unmodified Vim sources, plus your own usage - examples and Vim scripts. - -II) It is allowed to distribute a modified (or extended) version of Vim, - including executables and/or source code, when the following four - conditions are met: - 1) This license text must be included unmodified. - 2) The modified Vim must be distributed in one of the following five ways: - a) If you make changes to Vim yourself, you must clearly describe in - the distribution how to contact you. When the maintainer asks you - (in any way) for a copy of the modified Vim you distributed, you - must make your changes, including source code, available to the - maintainer without fee. The maintainer reserves the right to - include your changes in the official version of Vim. What the - maintainer will do with your changes and under what license they - will be distributed is negotiable. If there has been no negotiation - then this license, or a later version, also applies to your changes. - The current maintainer is Bram Moolenaar . If this - changes it will be announced in appropriate places (most likely - vim.sf.net, www.vim.org and/or comp.editors). When it is completely - impossible to contact the maintainer, the obligation to send him - your changes ceases. Once the maintainer has confirmed that he has - received your changes they will not have to be sent again. - b) If you have received a modified Vim that was distributed as - mentioned under a) you are allowed to further distribute it - unmodified, as mentioned at I). If you make additional changes the - text under a) applies to those changes. - c) Provide all the changes, including source code, with every copy of - the modified Vim you distribute. This may be done in the form of a - context diff. You can choose what license to use for new code you - add. The changes and their license must not restrict others from - making their own changes to the official version of Vim. - d) When you have a modified Vim which includes changes as mentioned - under c), you can distribute it without the source code for the - changes if the following three conditions are met: - - The license that applies to the changes permits you to distribute - the changes to the Vim maintainer without fee or restriction, and - permits the Vim maintainer to include the changes in the official - version of Vim without fee or restriction. - - You keep the changes for at least three years after last - distributing the corresponding modified Vim. When the maintainer - or someone who you distributed the modified Vim to asks you (in - any way) for the changes within this period, you must make them - available to him. - - You clearly describe in the distribution how to contact you. This - contact information must remain valid for at least three years - after last distributing the corresponding modified Vim, or as long - as possible. - e) When the GNU General Public License (GPL) applies to the changes, - you can distribute the modified Vim under the GNU GPL version 2 or - any later version. - 3) A message must be added, at least in the output of the ":version" - command and in the intro screen, such that the user of the modified Vim - is able to see that it was modified. When distributing as mentioned - under 2)e) adding the message is only required for as far as this does - not conflict with the license used for the changes. - 4) The contact information as required under 2)a) and 2)d) must not be - removed or changed, except that the person himself can make - corrections. - -III) If you distribute a modified version of Vim, you are encouraged to use - the Vim license for your changes and make them available to the - maintainer, including the source code. The preferred way to do this is - by e-mail or by uploading the files to a server and e-mailing the URL. - If the number of changes is small (e.g., a modified Makefile) e-mailing a - context diff will do. The e-mail address to be used is - - -IV) It is not allowed to remove this license from the distribution of the Vim - sources, parts of it or from a modified version. You may use this - license for previous Vim releases instead of the license that they came - with, at your option. diff --git a/sources_non_forked/ack.vim/README.md b/sources_non_forked/ack.vim/README.md deleted file mode 100644 index af8f522d..00000000 --- a/sources_non_forked/ack.vim/README.md +++ /dev/null @@ -1,161 +0,0 @@ -# ack.vim - -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 ack (>= 2.0), of course. To install it follow the -[manual](http://beyondgrep.com/install/). - -### The Plugin - -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: - -#### Pathogen - - $ git clone https://github.com/mileszs/ack.vim.git ~/.vim/bundle/ack.vim - -#### Vundle - -```vim -Plugin 'mileszs/ack.vim' -``` - -#### NeoBundle - -```vim -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 `{directories}` (which defaults to the current directory) -for the `{pattern}`. - -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 `:help Ack` -after installing, or [`doc/ack.txt`][doc] in the repo, for more information.) - -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 - -The quickfix results window is augmented with these convenience mappings: - - ? 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 without moving to it - h to open in horizontal split - H to open in horizontal split, keeping focus on the results - v to open in vertical split - gv to open in vertical split, keeping focus on the results - q to close the quickfix window - -### Gotchas - -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. - -#### I don't want to jump to the first result automatically. #### - -Use `:Ack!`, with bang. If you want this behavior most of the time, you might -like an abbreviation or mapping in your personal config, something like these: - -```vim -cnoreabbrev Ack Ack! -nnoremap a :Ack! -``` - -Most of the `:[L]Ack*` commands support this. Note that this behavior follows -the convention of Vim's built-in `:grep` and `:make` commands. - -[The Silver Searcher]: https://github.com/ggreer/the_silver_searcher -[sadface]: https://github.com/mileszs/ack.vim/commit/d97090fb502d40229e6976dfec0e06636ba227d5#commitcomment-5771145 - -## Changelog - -Please see [the Github releases page][releases]. - -## Credits - -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. - -And of course, where would we be without [Ack]. And, you know, Vim. - -[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/ - -[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 deleted file mode 100644 index dbf84572..00000000 --- a/sources_non_forked/ack.vim/autoload/ack.vim +++ /dev/null @@ -1,246 +0,0 @@ -if exists('g:autoloaded_ack') || &cp - finish -endif - -if exists('g:ack_use_dispatch') - if g:ack_use_dispatch && !exists(':Dispatch') - call s:Warn('Dispatch not loaded! Falling back to g:ack_use_dispatch = 0.') - let g:ack_use_dispatch = 0 - endif -else - let g:ack_use_dispatch = 0 -endif - -"----------------------------------------------------------------------------- -" Public API -"----------------------------------------------------------------------------- - -function! ack#Ack(cmd, args) "{{{ - call s:Init(a:cmd) - redraw - - " 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 - - " Check user policy for blank searches - if empty(a:args) - if !g:ack_use_cword_for_empty_search - echo "No regular expression found." - return - endif - endif - - " If no pattern is provided, search for the word under the cursor - let l:grepargs = empty(a:args) ? expand("") : a:args . join(a:000, ' ') - - "Bypass search if cursor is on blank string - if l:grepargs == "" - echo "No regular expression found." - return - endif - - " 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 - call s:SearchWithGrep(a:cmd, l:grepprg, l:escaped_args, l:grepformat) - endif - - " 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 "}}} - -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 "}}} - -function! ack#AckHelp(cmd, args) "{{{ - let args = a:args . ' ' . s:GetDocLocations() - call ack#Ack(a:cmd, args) -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 "}}} - -function! ack#ShowResults() "{{{ - let l:handler = s:UsingLocList() ? g:ack_lhandler : g:ack_qhandler - execute l:handler - call s:ApplyMappings() - redraw! -endfunction "}}} - -"----------------------------------------------------------------------------- -" Private API -"----------------------------------------------------------------------------- - -function! s:ApplyMappings() "{{{ - if !s:UsingListMappings() || &filetype != 'qf' - return - endif - - 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 - nmap j - nmap 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 bufhidden=hide nobuflisted - setlocal nomodifiable noswapfile - setlocal filetype=help - setlocal nonumber norelativenumber nowrap - setlocal foldmethod=diff foldlevel=20 - - 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 - - try - let &l:makeprg = l:grepprg . ' ' . a:grepargs - let &l:errorformat = a:grepformat - - Make - finally - let &l:makeprg = l:makeprg_bak - let &l:errorformat = l:errorformat_bak - endtry -endfunction "}}} - -function! s:SearchWithGrep(grepcmd, grepprg, grepargs, grepformat) "{{{ - let l:grepprg_bak = &l:grepprg - let l:grepformat_bak = &grepformat - - try - let &l:grepprg = a:grepprg - let &grepformat = a:grepformat - - silent execute a:grepcmd a:grepargs - finally - let &l:grepprg = l:grepprg_bak - let &grepformat = l:grepformat_bak - endtry -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 "}}} - -let g:autoloaded_ack = 1 -" vim:set et sw=2 ts=2 tw=78 fdm=marker diff --git a/sources_non_forked/ack.vim/doc/ack.txt b/sources_non_forked/ack.vim/doc/ack.txt deleted file mode 100644 index 22e884bc..00000000 --- a/sources_non_forked/ack.vim/doc/ack.txt +++ /dev/null @@ -1,315 +0,0 @@ -*ack.txt* Plugin that integrates ack with Vim - -============================================================================== -Author: Antoine Imbert *ack-author* -License: Same terms as Vim itself (see |license|) - -This plugin is only available if 'compatible' is not set. - -{Vi does not have any of this} - -============================================================================== -INTRODUCTION *ack* - -This plugin is a front for the Perl module App::Ack. Ack can be used as a -replacement for grep. This plugin will allow you to run ack from vim, and -shows the results in a split window. - -:Ack[!] [options] {pattern} [{directory}] *:Ack* - - Search recursively in {directory} (which defaults to the current - directory) for the {pattern}. Behaves just like the |:grep| command, but - will open the |Quickfix| window for you. If [!] is not given the first - occurrence is jumped to. - -:AckAdd [options] {pattern} [{directory}] *:AckAdd* - - Just like |:Ack|, but instead of making a new list, the matches are - appended to the current |quickfix| list. - -:AckFromSearch [{directory}] *:AckFromSearch* - - Just like |:Ack| but the pattern is from previous search. - -:LAck [options] {pattern} [{directory}] *:LAck* - - Just like |:Ack| but instead of the |quickfix| list, matches are placed in - the current |location-list|. - -:LAckAdd [options] {pattern} [{directory}] *:LAckAdd* - - Just like |:AckAdd| but instead of the |quickfix| list, matches are added - to the current |location-list| - -:AckFile [options] {pattern} [{directory}] *:AckFile* - - Search recursively in {directory} (which defaults to the current - directory) for filenames matching the {pattern}. Behaves just like the - |:grep| command, but will open the |Quickfix| window for you. - -:AckHelp[!] [options] {pattern} *:AckHelp* - - Search vim documentation files for the {pattern}. Behaves just like the - |:Ack| command, but searches only vim documentation .txt files - -:LAckHelp [options] {pattern} *:LAckHelp* - - Just like |:AckHelp| but instead of the |quickfix| list, matches are placed - in the current |location-list|. - -:AckWindow[!] [options] {pattern} *:AckWindow* - - Search all buffers visible in the screen (current tab page only) files for - the {pattern}. - -:LAckWindow [options] {pattern} *:LAckWindow* - - Just like |:AckWindow| but instead of the |quickfix| list, matches are - placed in the current |location-list|. - -Files containing the search term will be listed in the split 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. - -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. - - -============================================================================== -CONFIGURATION *ack-configuration* - - *g:ackprg* -g:ackprg -Default for ubuntu: "ack-grep" -Default for other systems: "ack" - -Use this option to specify the search command and its default arguments. - -Example: -> - let g:ackprg = "ag --vimgrep" -< - *g:ack_default_options* -g:ack_default_options -Default: " -s -H --nocolor --nogroup --column" - -Use this option to specify the default arguments given to `ack`. This is only -used if |g:ackprg| has not been customized from the default--if you are using -a custom search program instead of Ack, set your preferred options in -|g:ackprg|. - -NOTE: This option may be deprecated in the future. ~ - -Example: -> - let g:ack_default_options = - \ " -s -H --nocolor --nogroup --column --smart-case --follow" -< - *g:ack_apply_qmappings* -g:ack_apply_qmappings -Default: 1 - -This option enables mappings on the |quickfix| window. - - *g:ack_apply_lmappings* -g:ack_apply_lmappings -Default: 1 - -This option enables mappings on |location-list| windows. - - *g:ack_mappings* -g:ack_mappings -Default: { - \ "t": "T", - \ "T": "TgTj", - \ "o": "", - \ "O": ":ccl", - \ "go": "j", - \ "h": "K", - \ "H": "Kb", - \ "v": "HbJt", - \ "gv": "HbJ" } - -This option list all maps create on quickfix/Location list window. - -Example, if you want to open the result in the middle of the screen: -> - let g:ack_mappings = { "o": "zz" } -< - *g:ack_qhandler* -g:ack_qhandler -Default: "botright copen" - -Command to open the quickview window. - -If you want to open a quickview window with 30 lines you can do: -> - let g:ack_qhandler = "botright copen 30" -< - *g:ack_lhandler* -g:ack_lhandler -Default: "botright lopen" - -Command to open the Location list window. - -If you want to open a Location list window with 30 lines you can do: -> - let g:ack_lhandler = "botright lopen 30" -< - *g:ackhighlight* -g:ackhighlight -Default: 0 - -Use this option to highlight the searched term. - -Example: -> - let g:ackhighlight = 1 -< - *g:ack_autoclose* -g:ack_autoclose -Default: 0 - -Use this option to specify whether to close the quickfix window after -using any of the shortcuts. - -Example: -> - let g:ack_autoclose = 1 -< - *g:ack_autofold_results* -g:ack_autofold_results -Default: 0 - -Use this option to fold the results in quickfix by file name. Only the current -fold will be open by default and while you press 'j' and 'k' to move between the -results if you hit other fold the last one will be closed and the current will -be open. - -Example: -> - let g:ack_autofold_results = 1 -< - *g:ackpreview* -g:ackpreview -Default: 0 - -Use this option to automagically open the file with 'j' or 'k'. - -Example: -> - let g:ackpreview = 1 -< - *g:ack_use_dispatch* -g:ack_use_dispatch -Default: 0 - -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: -> - let g:ack_use_dispatch = 1 -< - *g:ack_use_cword_for_empty_search* -g:ack_use_cword_for_empty_search -Default: 1 - -Use this option to enable blank searches to run against the word under the -cursor. When this option is not set, blank searches will only output an error -message. - -Example: -> - let g:ack_use_cword_for_empty_search = 0 -< -============================================================================== -MAPPINGS *ack-mappings* - -The following keyboard shortcuts are available in the |quickfix| and -|location-list| windows: - -? display a quick summary of these mappings. - -o open file (same as Enter). - -O open file and close the quickfix window. - -go preview file (open but maintain focus on ack.vim results). - -t open in a new tab. - -T open in new tab without moving to it. - -h open in horizontal split. - -H open in horizontal split, keeping focus on the results. - -v open in vertical split. - -gv open in vertical split, keeping focus on the results. - -q close the quickfix window. - -To adjust these, see |g:ack_mappings|. - -============================================================================== -Ignoring files *ack-ignore* - -If you're using this plugin with ag, The Silver Searcher, bear in mind that: - - - It ignores file patterns from your .gitignore and .hgignore. - - - If there are other files in your source repository you don't wish to - search, you can add their patterns to an .agignore file. - -============================================================================== -ISSUES AND FAQ *ack-issues-and-faq* - -I don't want to jump to the first result automatically.~ - - Use `:Ack!`, with bang. If you want this behavior most of the time, you - might like an abbreviation or mapping in your personal config, something - like these: -> - cnoreabbrev Ack Ack! - nnoremap a :Ack! -< - Most of the `:[L]Ack*` commands support this. Note that this behavior - follows the convention of Vim's built-in |:grep| and |:make| commands. - -I use NERDTree and opening ack.vim results in a vertical split displacing it.~ - - You are probably using NERDTree with its default alignment at the left - side of the window. Set these custom mappings in your vimrc to work around - this: -> - let g:ack_mappings = { - \ 'v': 'LpJp', - \ 'gv': 'LpJ' } -< - This solution will be improved in the future. - -Results show a mix of relative and absolute paths, making them hard to read.~ - - This is a quirk of Vim that can happen with plain |:vimgrep| too. You can - try this in your vimrc to work around it: -> - autocmd BufAdd * exe "cd" fnameescape(getcwd()) -< - but for some users this may be disruptive to their Vim workflow. For more - details, see: - - http://vi.stackexchange.com/a/4816/7174 - https://github.com/mileszs/ack.vim/issues/143 - -vim:set et sw=4 ts=4 tw=78: diff --git a/sources_non_forked/ack.vim/doc/ack_quick_help.txt b/sources_non_forked/ack.vim/doc/ack_quick_help.txt deleted file mode 100644 index 94306a0e..00000000 --- a/sources_non_forked/ack.vim/doc/ack_quick_help.txt +++ /dev/null @@ -1,15 +0,0 @@ -==== ack.vim quick help =============== - - *?:* 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 without moving to it - *h:* to open in horizontal split - *H:* to open in horizontal split, keeping focus on the results - *v:* to open in vertical split - *gv:* to open in vertical split, keeping focus on the results - *q:* to close the quickfix window - -======================================== diff --git a/sources_non_forked/ack.vim/ftplugin/qf.vim b/sources_non_forked/ack.vim/ftplugin/qf.vim deleted file mode 100644 index 27564fa7..00000000 --- a/sources_non_forked/ack.vim/ftplugin/qf.vim +++ /dev/null @@ -1,9 +0,0 @@ -if exists("g:ack_autofold_results") && g:ack_autofold_results - setlocal foldlevel=0 - setlocal foldmethod=expr - setlocal foldexpr=matchstr(getline(v:lnum),'^[^\|]\\+')==#matchstr(getline(v:lnum+1),'^[^\|]\\+')?1:'<1' - setlocal foldenable - setlocal foldclose=all - setlocal foldopen=all - nnoremap j jzz -endif diff --git a/sources_non_forked/ack.vim/plugin/ack.vim b/sources_non_forked/ack.vim/plugin/ack.vim deleted file mode 100644 index 202ae2ea..00000000 --- a/sources_non_forked/ack.vim/plugin/ack.vim +++ /dev/null @@ -1,83 +0,0 @@ -if exists('g:loaded_ack') || &cp - finish -endif - -if !exists("g:ack_default_options") - let g:ack_default_options = " -s -H --nopager --nocolor --nogroup --column" -endif - -" Location of the ack utility -if !exists("g:ackprg") - if executable('ack-grep') - let g:ackprg = "ack-grep" - elseif executable('ack') - let g:ackprg = "ack" - else - finish - endif - let g:ackprg .= g:ack_default_options -endif - -if !exists("g:ack_apply_qmappings") - let g:ack_apply_qmappings = !exists("g:ack_qhandler") -endif - -if !exists("g:ack_apply_lmappings") - let g:ack_apply_lmappings = !exists("g:ack_lhandler") -endif - -let s:ack_mappings = { - \ "t": "T", - \ "T": "TgTj", - \ "o": "", - \ "O": "pc", - \ "go": "p", - \ "h": "K", - \ "H": "Kb", - \ "v": "HbJt", - \ "gv": "HbJ" } - -if exists("g:ack_mappings") - let g:ack_mappings = extend(s:ack_mappings, g:ack_mappings) -else - let g:ack_mappings = s:ack_mappings -endif - -if !exists("g:ack_qhandler") - let g:ack_qhandler = "botright copen" -endif - -if !exists("g:ack_lhandler") - let g:ack_lhandler = "botright lopen" -endif - -if !exists("g:ackhighlight") - let g:ackhighlight = 0 -endif - -if !exists("g:ack_autoclose") - let g:ack_autoclose = 0 -endif - -if !exists("g:ack_autofold_results") - let g:ack_autofold_results = 0 -endif - -if !exists("g:ack_use_cword_for_empty_search") - let g:ack_use_cword_for_empty_search = 1 -endif - -command! -bang -nargs=* -complete=file Ack call ack#Ack('grep', ) -command! -bang -nargs=* -complete=file AckAdd call ack#Ack('grepadd', ) -command! -bang -nargs=* -complete=file AckFromSearch call ack#AckFromSearch('grep', ) -command! -bang -nargs=* -complete=file LAck call ack#Ack('lgrep', ) -command! -bang -nargs=* -complete=file LAckAdd call ack#Ack('lgrepadd', ) -command! -bang -nargs=* -complete=file AckFile call ack#Ack('grep -g', ) -command! -bang -nargs=* -complete=help AckHelp call ack#AckHelp('grep', ) -command! -bang -nargs=* -complete=help LAckHelp call ack#AckHelp('lgrep', ) -command! -bang -nargs=* AckWindow call ack#AckWindow('grep', ) -command! -bang -nargs=* LAckWindow call ack#AckWindow('lgrep', ) - -let g:loaded_ack = 1 - -" vim:set et sw=2 ts=2 tw=78 fdm=marker diff --git a/update_plugins.py b/update_plugins.py index 07116c96..9b364de9 100644 --- a/update_plugins.py +++ b/update_plugins.py @@ -16,7 +16,6 @@ from os import path #--- Globals ---------------------------------------------- PLUGINS = """ -ack.vim https://github.com/mileszs/ack.vim ag.vim https://github.com/rking/ag.vim bufexplorer https://github.com/corntrace/bufexplorer ctrlp.vim https://github.com/ctrlpvim/ctrlp.vim From 75beb5f4ba85c08f1179c1eeb97fcc01b5abf3c2 Mon Sep 17 00:00:00 2001 From: amix Date: Sat, 1 Apr 2017 13:22:06 +0200 Subject: [PATCH 17/74] Updated vim plugins --- .../ctrlp.vim/autoload/ctrlp.vim | 3 +- sources_non_forked/ctrlp.vim/doc/ctrlp.txt | 2 +- sources_non_forked/goyo.vim/doc/goyo.txt | 170 ++++++++++++++++++ .../nerdtree/.github/ISSUE_TEMPLATE.md | 37 ++++ sources_non_forked/nerdtree/README.markdown | 4 +- .../autoload/syntastic/preprocess.vim | 29 +++ .../syntastic/doc/syntastic-checkers.txt | 112 ++++++------ .../syntastic/plugin/syntastic.vim | 2 +- .../syntastic/syntax_checkers/d/dscanner.vim | 48 +++++ .../syntax_checkers/dockerfile/hadolint.vim | 41 +++++ .../syntax_checkers/solidity/solium.vim | 43 +++++ sources_non_forked/vim-gitgutter/README.mkd | 52 ++++++ .../vim-gitgutter/autoload/gitgutter.vim | 14 +- .../autoload/gitgutter/async.vim | 8 +- .../vim-gitgutter/autoload/gitgutter/diff.vim | 4 +- .../vim-gitgutter/autoload/gitgutter/hunk.vim | 38 ++-- .../vim-gitgutter/autoload/gitgutter/sign.vim | 28 +-- .../autoload/gitgutter/utility.vim | 37 ++-- .../vim-gitgutter/doc/gitgutter.txt | 1 + sources_non_forked/vim-go/CHANGELOG.md | 8 +- sources_non_forked/vim-go/autoload/go/cmd.vim | 6 +- sources_non_forked/vim-go/autoload/go/fmt.vim | 8 +- .../vim-go/autoload/go/path.vim | 125 +++++++------ sources_non_forked/vim-go/doc/vim-go.txt | 9 +- sources_non_forked/vim-go/plugin/go.vim | 12 +- .../vim-go/syntax/gotexttmpl.vim | 4 +- .../vim-indent-object/doc/indent-object.txt | 16 +- .../vim-snippets/UltiSnips/cs.snippets | 8 +- .../vim-snippets/UltiSnips/vue.snippets | 1 + .../vim-snippets/snippets/c.snippets | 28 +-- .../vim-snippets/snippets/cpp.snippets | 14 +- .../vim-snippets/snippets/erlang.snippets | 30 ++-- 32 files changed, 704 insertions(+), 238 deletions(-) create mode 100644 sources_non_forked/goyo.vim/doc/goyo.txt create mode 100644 sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE.md create mode 100644 sources_non_forked/syntastic/syntax_checkers/d/dscanner.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/dockerfile/hadolint.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/solidity/solium.vim create mode 100644 sources_non_forked/vim-snippets/UltiSnips/vue.snippets diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim index 65589393..7b2d660a 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim @@ -1763,6 +1763,7 @@ fu! ctrlp#setpathmode(pmode, ...) let spath = a:0 ? a:1 : s:crfpath let markers = ['.git', '.hg', '.svn', '.bzr', '_darcs'] if type(s:rmarkers) == 3 && !empty(s:rmarkers) + if s:findroot(spath, s:rmarkers, 0, 0) != [] | retu 1 | en cal filter(markers, 'index(s:rmarkers, v:val) < 0') let markers = s:rmarkers + markers en @@ -2384,7 +2385,7 @@ endf fu! s:matchbuf(item, pat) let bufnr = s:bufnrfilpath(a:item)[0] let parts = s:bufparts(bufnr) - let item = bufnr.parts[0].parts[2].s:lash().parts[3] + let item = s:byfname ? parts[2] : bufnr.parts[0].parts[2].s:lash().parts[3] retu match(item, a:pat) endf diff --git a/sources_non_forked/ctrlp.vim/doc/ctrlp.txt b/sources_non_forked/ctrlp.vim/doc/ctrlp.txt index f703ba4f..455e368c 100644 --- a/sources_non_forked/ctrlp.vim/doc/ctrlp.txt +++ b/sources_non_forked/ctrlp.vim/doc/ctrlp.txt @@ -848,7 +848,7 @@ Example: > When this is set to 1, the on empty prompt exit CtrlP. *ctrlp-default-value* -Otherwize, you can use below to change default value. +Otherwise, you can use below to change default value. Example: > let g:ctrlp_path_nolim = 1 diff --git a/sources_non_forked/goyo.vim/doc/goyo.txt b/sources_non_forked/goyo.vim/doc/goyo.txt new file mode 100644 index 00000000..cdc129f8 --- /dev/null +++ b/sources_non_forked/goyo.vim/doc/goyo.txt @@ -0,0 +1,170 @@ +goyo.txt goyo Last change: April 1 2017 +GOYO - TABLE OF CONTENTS *goyo* *goyo-toc* +============================================================================== + + goyo.vim (고요) + Installation + Usage + Dimension expression + Configuration + Callbacks + Inspiration + Pros. + License + +GOYO.VIM (고요) *goyo* +============================================================================== + +Distraction-free writing in Vim. + +https://raw.github.com/junegunn/i/master/goyo.png + +(Color scheme: {seoul256}{1}) + +Best served with {limelight.vim}{2}. + + {1} https://github.com/junegunn/seoul256.vim + {2} https://github.com/junegunn/limelight.vim + + +INSTALLATION *goyo-installation* +============================================================================== + +Use your favorite plugin manager. + + *:PlugInstall* + + - {vim-plug}{3} + 1. Add `Plug 'junegunn/goyo.vim'` to .vimrc + 2. Run `:PlugInstall` + + {3} https://github.com/junegunn/vim-plug + + +USAGE *goyo-usage* +============================================================================== + + *:Goyo* + + - `:Goyo` + - Toggle Goyo + - `:Goyo [dimension]` + - Turn on or resize Goyo + - `:Goyo!` + - Turn Goyo off + +The window can be resized with the usual count]`, `<`, `+`, `-` +keys. + + +< Dimension expression >______________________________________________________~ + *goyo-dimension-expression* + +The expected format of a dimension expression is +`[WIDTH][XOFFSET][x[HEIGHT][YOFFSET]]`. `XOFFSET` and `YOFFSET` should be +prefixed by `+` or `-`. Each component can be given in percentage. +> + " Width + Goyo 120 + + " Height + Goyo x30 + + " Both + Goyo 120x30 + + " In percentage + Goyo 120x50% + + " With offsets + Goyo 50%+25%x50%-25% +< + +CONFIGURATION *goyo-configuration* +============================================================================== + + *g:goyo_width* *g:goyo_height* *g:goyo_linenr* + + - `g:goyo_width` (default: 80) + - `g:goyo_height` (default: 85%) + - `g:goyo_linenr` (default: 0) + + +< Callbacks >_________________________________________________________________~ + *goyo-callbacks* + +By default, {vim-airline}{4}, {vim-powerline}{5}, {powerline}{6}, +{lightline.vim}{7}, {vim-signify}{8}, and {vim-gitgutter}{9} are temporarily +disabled while in Goyo mode. + +If you have other plugins that you want to disable/enable, or if you want to +change the default settings of Goyo window, you can set up custom routines to +be triggered on `GoyoEnter` and `GoyoLeave` events. +> + function! s:goyo_enter() + silent !tmux set status off + silent !tmux list-panes -F '\#F' | grep -q Z || tmux resize-pane -Z + set noshowmode + set noshowcmd + set scrolloff=999 + Limelight + " ... + endfunction + + function! s:goyo_leave() + silent !tmux set status on + silent !tmux list-panes -F '\#F' | grep -q Z && tmux resize-pane -Z + set showmode + set showcmd + set scrolloff=5 + Limelight! + " ... + endfunction + + autocmd! User GoyoEnter nested call goyo_enter() + autocmd! User GoyoLeave nested call goyo_leave() +< +More examples can be found here: {Customization}{10} + + {4} https://github.com/bling/vim-airline + {5} https://github.com/Lokaltog/vim-powerline + {6} https://github.com/Lokaltog/powerline + {7} https://github.com/itchyny/lightline.vim + {8} https://github.com/mhinz/vim-signify + {9} https://github.com/airblade/vim-gitgutter + {10} https://github.com/junegunn/goyo.vim/wiki/Customization + + +INSPIRATION *goyo-inspiration* +============================================================================== + + - {LiteDFM}{11} + - {VimRoom}{12} + + {11} https://github.com/bilalq/lite-dfm + {12} http://projects.mikewest.org/vimroom/ + + +PROS. *goyo-pros* +============================================================================== + + 1. Works well with splits. Doesn't mess up with the current window arrangement + 2. Works well with popular statusline plugins + 3. Prevents accessing the empty windows around the central buffer + 4. Can be closed with any of `:q[uit]`, `:clo[se]`, `:tabc[lose]`, or `:Goyo` + 5. Can dynamically change the width of the window + 6. Adjusts its colors when color scheme is changed + 7. Realigns the window when the terminal (or window) is resized or when the size + of the font is changed + 8. Correctly hides colorcolumns and Emojis in statusline + 9. Highly customizable with callbacks + + +LICENSE *goyo-license* +============================================================================== + +MIT + + +============================================================================== +vim:tw=78:sw=2:ts=2:ft=help:norl:nowrap: diff --git a/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE.md b/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..69aa7d9b --- /dev/null +++ b/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,37 @@ +_To assist in resolving your issue, provide as much information as possible, in place of the ellipses (`…`) below._ + +--- +**Environment:** _Describe your Vim/NERDTree setup._ + +>* Operating System: … +>* Vim version `:version`: … +>* NERDTree version `git rev-parse --short HEAD`: … +>* NERDTree settings applied in your vimrc, if any: +> +> ``` +> … +> ``` + +**Process:** _List the steps that will recreate the issue._ + +>1. … + +**Current Result:** _Describe what you you currently experience from this process._ + +>… + +**Expected Result:** _Describe what you would expect to have resulted from this process._ + +>… + +--- +**Optional** + +**Screenshot(s):** + +>… + +**Possible Fix:** _(Have you poked around in the code?)_ + +>… + diff --git a/sources_non_forked/nerdtree/README.markdown b/sources_non_forked/nerdtree/README.markdown index 4f5133a2..19b841bc 100644 --- a/sources_non_forked/nerdtree/README.markdown +++ b/sources_non_forked/nerdtree/README.markdown @@ -55,14 +55,14 @@ The following features and functionality are provided by the NERD tree: Installation ------------ -####[pathogen.vim](https://github.com/tpope/vim-pathogen) +#### [pathogen.vim](https://github.com/tpope/vim-pathogen) git clone https://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree Then reload vim, run `:helptags ~/.vim/bundle/nerdtree/doc/`, and check out `:help NERD_tree.txt`. -####[apt-vim](https://github.com/egalpin/apt-vim) +#### [apt-vim](https://github.com/egalpin/apt-vim) apt-vim install -y https://github.com/scrooloose/nerdtree.git diff --git a/sources_non_forked/syntastic/autoload/syntastic/preprocess.vim b/sources_non_forked/syntastic/autoload/syntastic/preprocess.vim index 9d25b849..451d308c 100644 --- a/sources_non_forked/syntastic/autoload/syntastic/preprocess.vim +++ b/sources_non_forked/syntastic/autoload/syntastic/preprocess.vim @@ -98,6 +98,35 @@ function! syntastic#preprocess#dockerfile_lint(errors) abort " {{{2 return out endfunction " }}}2 +function! syntastic#preprocess#dscanner(errors) abort " {{{2 + let idx = 0 + while idx < len(a:errors) && a:errors[idx][0] !=# '{' + let idx += 1 + endwhile + let errs = s:_decode_JSON(join(a:errors[idx :], '')) + + let out = [] + if type(errs) == type({}) && has_key(errs, 'issues') && type(errs['issues']) == type([]) + for issue in errs['issues'] + try + call add(out, + \ issue['fileName'] . ':' . + \ issue['line'] . ':' . + \ issue['column'] . ':' . + \ issue['message'] . ' [' . issue['key'] . ']') + catch /\m^Vim\%((\a\+)\)\=:E716/ + call syntastic#log#warn('checker d/dscanner: unrecognized error item ' . string(issue)) + let out = [] + break + endtry + endfor + else + call syntastic#log#warn('checker d/dscanner: unrecognized error format (crashed checker?)') + endif + + return out +endfunction " }}}2 + function! syntastic#preprocess#flow(errors) abort " {{{2 let idx = 0 while idx < len(a:errors) && a:errors[idx][0] !=# '{' diff --git a/sources_non_forked/syntastic/doc/syntastic-checkers.txt b/sources_non_forked/syntastic/doc/syntastic-checkers.txt index 48536491..7c902f9a 100644 --- a/sources_non_forked/syntastic/doc/syntastic-checkers.txt +++ b/sources_non_forked/syntastic/doc/syntastic-checkers.txt @@ -1755,6 +1755,7 @@ SYNTAX CHECKERS FOR D *syntastic-checkers-d* The following checkers are available for D (filetype "d"): 1. DMD......................|syntastic-d-dmd| + 2. D-Scanner................|syntastic-d-dscanner| ------------------------------------------------------------------------------ 1. DMD *syntastic-d-dmd* @@ -1834,6 +1835,22 @@ the usual 'g:syntastic_d_dmd_

${2} endsnippet -snippet ${2} endsnippet -snippet $0 endsnippet -snippet $0 endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/vue.snippets b/sources_non_forked/vim-snippets/UltiSnips/vue.snippets new file mode 100644 index 00000000..4e09d0cc --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/vue.snippets @@ -0,0 +1 @@ +extends html, javascript, css diff --git a/sources_non_forked/vim-snippets/snippets/c.snippets b/sources_non_forked/vim-snippets/snippets/c.snippets index 6e8fb0a5..0336a147 100644 --- a/sources_non_forked/vim-snippets/snippets/c.snippets +++ b/sources_non_forked/vim-snippets/snippets/c.snippets @@ -141,7 +141,7 @@ snippet dfun0 /*! \brief ${1:Brief function description here} * * ${2:Detailed description of the function} - * + * * \return ${3:Return parameter description} */ ${4:void} ${5:function_name}() @@ -159,7 +159,7 @@ snippet dfun1 /*! \brief ${1:Brief function description here} * * ${2:Detailed description of the function} - * + * * \param $3 ${4:Parameter description} * \return ${5:Return parameter description} */ @@ -178,7 +178,7 @@ snippet dfun2 /*! \brief ${1:Brief function description here} * * ${2:Detailed description of the function} - * + * * \param $3 ${4:Parameter description} * \param $5 ${6:Parameter description} * \return ${7:Return parameter description} @@ -198,7 +198,7 @@ snippet dfun3 /*! \brief ${1:Brief function description here} * * ${2:Detailed description of the function} - * + * * \param $3 ${4:Parameter description} * \param $5 ${6:Parameter description} * \param $7 ${8:Parameter description} @@ -218,20 +218,20 @@ snippet td typedef ${1:int} ${2:MyCustomType}; # struct snippet st - /*! \struct $1 + /*! \struct $1 * \brief ${3:Brief struct description} - * - * ${4:Detailed description} + * + * ${4:Detailed description} */ struct ${1:`vim_snippets#Filename('$1_t', 'name')`} { ${2:Data} /*!< ${4:Description} */ }${5: /* optional variable list */}; # typedef struct snippet tds - /*! \struct $2 + /*! \struct $2 * \brief ${5:Brief struct description} - * - * ${6:Detailed description} + * + * ${6:Detailed description} */ typedef struct ${2:_$1 }{ m_${3:Data} /*!< ${4:Description} */ @@ -239,15 +239,15 @@ snippet tds snippet enum /*! \enum $1 - * - * ${2:Detailed description} + * + * ${2:Detailed description} */ enum ${1:name} { ${0} }; # typedef enum snippet tde /*! \enum $2 - * - * ${4:Detailed description} + * + * ${4:Detailed description} */ typedef enum { ${1:Data} /*!< ${3:Description} */ diff --git a/sources_non_forked/vim-snippets/snippets/cpp.snippets b/sources_non_forked/vim-snippets/snippets/cpp.snippets index 7a55b95e..4c02a47f 100644 --- a/sources_non_forked/vim-snippets/snippets/cpp.snippets +++ b/sources_non_forked/vim-snippets/snippets/cpp.snippets @@ -78,10 +78,10 @@ snippet mu ## Class # class snippet cl - /*! \class $1 + /*! \class $1 * \brief ${3:Brief class description} - * - * ${4:Detailed description} + * + * ${4:Detailed description} */ class ${1:`vim_snippets#Filename('$1', 'name')`} { @@ -102,7 +102,7 @@ snippet dmfun0 /*! \brief ${4:Brief function description here} * * ${5:Detailed description} - * + * * \return ${6:Return parameter description} */ ${3:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}() { @@ -113,7 +113,7 @@ snippet dmfun1 /*! \brief ${6:Brief function description here} * * ${7:Detailed description} - * + * * \param $4 ${8:Parameter description} * \return ${9:Return parameter description} */ @@ -125,7 +125,7 @@ snippet dmfun2 /*! \brief ${8:Brief function description here} * * ${9:Detailed description} - * + * * \param $4 ${10:Parameter description} * \param $6 ${11:Parameter description} * \return ${12:Return parameter description} @@ -193,7 +193,7 @@ snippet lld [${1}](${2}){ ${3} }; -# snippets exception +# snippets exception snippet try try { diff --git a/sources_non_forked/vim-snippets/snippets/erlang.snippets b/sources_non_forked/vim-snippets/snippets/erlang.snippets index bd379f3d..960c8e76 100644 --- a/sources_non_forked/vim-snippets/snippets/erlang.snippets +++ b/sources_non_forked/vim-snippets/snippets/erlang.snippets @@ -1,14 +1,16 @@ -# module and export all +# module snippet mod - -module(${1:`vim_snippets#Filename('', 'my')`}). - + -module(${1:`vim_snippets#Filename()`}). +# module and export all +snippet modall + -module(${1:`vim_snippets#Filename()`}). -compile([export_all]). - + start() -> - ${0} - + ${0} + stop() -> - ok. + ok. # define directive snippet def -define(${1:macro}, ${2:body}). @@ -73,7 +75,7 @@ snippet %p %% @private # OTP application snippet application - -module(${1:`vim_snippets#Filename('', 'my')`}). + -module(${1:`vim_snippets#Filename()`}). -behaviour(application). @@ -91,7 +93,7 @@ snippet application ok. # OTP supervisor snippet supervisor - -module(${1:`vim_snippets#Filename('', 'my')`}). + -module(${1:`vim_snippets#Filename()`}). -behaviour(supervisor). @@ -114,7 +116,7 @@ snippet supervisor {ok, {RestartStrategy, Children}}. # OTP gen_server snippet gen_server - -module(${0:`vim_snippets#Filename('', 'my')`}). + -module(${0:`vim_snippets#Filename()`}). -behaviour(gen_server). @@ -170,7 +172,7 @@ snippet gen_server %%%=================================================================== # OTP gen_fsm snippet gen_fsm - -module(${0:`vim_snippets#Filename('', 'my')`}). + -module(${0:`vim_snippets#Filename()`}). -behaviour(gen_fsm). @@ -348,7 +350,7 @@ snippet gen_fsm %%%=================================================================== # OTP gen_event snippet gen_event - -module(${0:`vim_snippets#Filename('', 'my')`}). + -module(${0:`vim_snippets#Filename()`}). -behaviour(gen_event). @@ -484,7 +486,7 @@ snippet gen_event %%%=================================================================== # EUnit snippets snippet eunit - -module(${1:`vim_snippets#Filename('', 'my')`}). + -module(${1:`vim_snippets#Filename()`}). -include_lib("eunit/include/eunit.hrl"). ${0} @@ -515,7 +517,7 @@ snippet asexc ?assertException(${1:Class}, ${2:Pattern}, ${0:Expression}) # common_test test_SUITE snippet testsuite - -module(${0:`vim_snippets#Filename('', 'my')`}). + -module(${0:`vim_snippets#Filename()`}). -include_lib("common_test/include/ct.hrl"). From 1a082031d905c7434d72774c5c1aa0d435f37714 Mon Sep 17 00:00:00 2001 From: amix Date: Sat, 1 Apr 2017 13:36:01 +0200 Subject: [PATCH 18/74] Fixed https://github.com/amix/vimrc/issues/279 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 76f53e91..58f09563 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,8 @@ You can also install your own plugins, for instance, via pathogen you can instal ## Key Mappings +The [leader](http://learnvimscriptthehardway.stevelosh.com/chapters/06.html#leader) is `,`, so whenever you see `` it means `,`. + ### Plugin related mappings Open [bufexplorer](https://github.com/vim-scripts/bufexplorer.zip) and see and manage the current buffers (`o`): From e4af7256247bc1c365c9e093492ab31f5f4eab19 Mon Sep 17 00:00:00 2001 From: amix Date: Sat, 1 Apr 2017 13:38:55 +0200 Subject: [PATCH 19/74] Fixed https://github.com/amix/vimrc/issues/278 --- install_awesome_vimrc.sh | 3 +++ install_basic_vimrc.sh | 3 +++ 2 files changed, 6 insertions(+) diff --git a/install_awesome_vimrc.sh b/install_awesome_vimrc.sh index e8330afc..6b94e519 100644 --- a/install_awesome_vimrc.sh +++ b/install_awesome_vimrc.sh @@ -1,3 +1,6 @@ +#!/bin/sh +set -e + cd ~/.vim_runtime echo 'set runtimepath+=~/.vim_runtime diff --git a/install_basic_vimrc.sh b/install_basic_vimrc.sh index 3478144d..6b3142d1 100644 --- a/install_basic_vimrc.sh +++ b/install_basic_vimrc.sh @@ -1,3 +1,6 @@ +#!/bin/sh +set -e + cd ~/.vim_runtime cat ~/.vim_runtime/vimrcs/basic.vim > ~/.vimrc echo "Installed the Basic Vim configuration successfully! Enjoy :-)" From c5165627483a5071539aa90eca2511cbca946521 Mon Sep 17 00:00:00 2001 From: Amir Salihefendic Date: Sat, 1 Apr 2017 13:48:28 +0200 Subject: [PATCH 20/74] Updated the logo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 58f09563..843ef6b9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![VIM](https://camo.githubusercontent.com/bec48ea0e886e5489a8819486bf74075fe626067/68747470733a2f2f7261772e6769746875622e636f6d2f656c6d636173742f656c6d2d76696d2f6d61737465722f73637265656e73686f74732f6c6f676f2e706e67) +![VIM](https://dnp4pehkvoo6n.cloudfront.net/43c5af597bd5c1a64eb1829f011c208f/as/Ultimate%20Vimrc.svg) # The Ultimate vimrc From 23ad247835c9fa0ba23f590a8babe2b79038a0b6 Mon Sep 17 00:00:00 2001 From: amix Date: Sat, 1 Apr 2017 13:58:59 +0200 Subject: [PATCH 21/74] Updated the readme (a cleanup) --- README.md | 98 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 58f09563..7c29072d 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,14 @@ # The Ultimate vimrc -Over the last 10 years I have used and tweaked Vim. This is the ultimate vimrc (or at least my version of it). +Over the last 10 years, I have used and tweaked Vim. This configuration is the ultimate vimrc (or at least my version of it). There are two versions: * **The Basic**: If you want something small just copy [basic.vim](https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim) into your ~/.vimrc and you will have a good basic setup -* **The Awesome**: Includes a ton of useful plugins, color schemes and configurations +* **The Awesome**: Includes a ton of useful plugins, color schemes, and configurations -I would of course recommend using the awesome version. +I would, of course, recommend using the awesome version. ## How to install the Awesome version? The awesome version includes a lot of great plugins, configurations and color schemes that make Vim a lot better. To install it simply do following from your terminal: @@ -17,12 +17,12 @@ The awesome version includes a lot of great plugins, configurations and color sc git clone https://github.com/amix/vimrc.git ~/.vim_runtime sh ~/.vim_runtime/install_awesome_vimrc.sh -I also recommend using [the Hack font](http://sourcefoundry.org/hack/) (it's free and awesome font designed for source code). The Awesome vimrc is already setup to try to use it. +I also recommend using [the Hack font](http://sourcefoundry.org/hack/) (it's a free and awesome font designed for source code). The Awesome vimrc is already setup to try to use it. ## How to install the Basic version? -The basic version is basically just one file and no plugins. Simply copy [basic.vim](https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim) and paste it into your vimrc. +The basic version is just one file and no plugins. Just copy [basic.vim](https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim) and paste it into your vimrc. -This is useful to install on remote servers where you don't need many plugins and you don't do many edits. +The basic version is useful to install on remote servers where you don't need many plugins, and you don't do many edits. git clone git://github.com/amix/vimrc.git ~/.vim_runtime sh ~/.vim_runtime/install_basic_vimrc.sh @@ -39,7 +39,7 @@ If you have vim aliased as `vi` instead of `vim`, make sure to either alias it: ## How to update to latest version? -Simply just do a git rebase! +Just do a git rebase! cd ~/.vim_runtime git pull --rebase @@ -48,9 +48,11 @@ Simply just do a git rebase! ## Some screenshots Colors when editing a Python file: + ![Screenshot 1](http://files1.wedoist.com/e952fdb343b1e617b90d256e474d0370/as/screenshot_1.png) -Opening recently opened files [mru.vim](https://github.com/vim-scripts/mru.vim): +Opening recently opened files with the [mru.vim](https://github.com/vim-scripts/mru.vim) plugin: + ![Screenshot 2](http://files1.wedoist.com/1967b0e48af40e513d1a464e08196990/as/screenshot_2.png) [NERD Tree](https://github.com/scrooloose/nerdtree) plugin in a terminal window: @@ -65,7 +67,7 @@ Distraction free mode using [goyo.vim](https://github.com/junegunn/goyo.vim) and ## Included Plugins -I recommend reading the docs of these plugins to understand them better. Each of them provide a much better Vim experience! +I recommend reading the docs of these plugins to understand them better. Each plugin provides a much better Vim experience! * [ag.vim](https://github.com/rking/ag.vim): Vim plugin for `the_silver_searcher` (ag) -- a wicked fast grep * [bufexplorer.zip](https://github.com/vim-scripts/bufexplorer.zip): Quickly and easily switch between buffers. This plugin can be opened with `` @@ -108,37 +110,38 @@ Remove all clutter and focus only on the essential. Similar to iA Writer or Writ ## How to include your own stuff? -After you have installed the setup you can create **~/.vim_runtime/my_configs.vim** to fill in any configurations that are important for you. For instance, my **my_configs.vim** looks like this: +After you have installed the setup, you can create **~/.vim_runtime/my_configs.vim** to fill in any configurations that are important for you. For instance, my **my_configs.vim** looks like this: ~/.vim_runtime (master)> cat my_configs.vim map ct :cd ~/Desktop/Todoist/todoist map cw :cd ~/Desktop/Wedoist/wedoist -You can also install your own plugins, for instance, via pathogen you can install [vim-rails](https://github.com/tpope/vim-rails): +You can also install your plugins, for instance, via pathogen you can install [vim-rails](https://github.com/tpope/vim-rails): cd ~/.vim_runtime git clone git://github.com/tpope/vim-rails.git sources_non_forked/vim-rails - + ## Key Mappings The [leader](http://learnvimscriptthehardway.stevelosh.com/chapters/06.html#leader) is `,`, so whenever you see `` it means `,`. + ### Plugin related mappings -Open [bufexplorer](https://github.com/vim-scripts/bufexplorer.zip) and see and manage the current buffers (`o`): +Open [bufexplorer](https://github.com/vim-scripts/bufexplorer.zip) to see and manage the current buffers (`o`): map o :BufExplorer -Open [MRU.vim](https://github.com/vim-scripts/mru.vim) and see the recently open files (`f`): +Open [MRU.vim](https://github.com/vim-scripts/mru.vim) to see the recently open files (`f`): map f :MRU -Open [ctrlp.vim](https://github.com/kien/ctrlp.vim) plugin (`j` or `f`): +Open [ctrlp.vim](https://github.com/kien/ctrlp.vim) plugin to quickly find a file or a buffer (`j` or `f`): let g:ctrlp_map = '' -Managing the [NERD Tree](https://github.com/scrooloose/nerdtree) plugin: +[NERD Tree](https://github.com/scrooloose/nerdtree) mappings: map nn :NERDTreeToggle map nb :NERDTreeFromBookmark @@ -148,6 +151,7 @@ Managing the [NERD Tree](https://github.com/scrooloose/nerdtree) plugin: map z :Goyo + ### Normal mode mappings Fast saving of a buffer (`w`): @@ -160,7 +164,7 @@ Map `` to `/` (search) and `+` to `?` (backwards search): map ? map :noh -Disable highlight when `` is pressed: +Disable highlights when you press ``: map :noh @@ -171,7 +175,7 @@ Smart way to move between windows (`j` etc.): map h map l -Closing of current buffer(s) (`bd` and (`ba`)): +Closing of the current buffer(s) (`bd` and (`ba`)): " Close current buffer map bd :Bclose @@ -190,18 +194,14 @@ Useful mappings for managing tabs: " Super useful when editing files in the same directory map te :tabedit =expand("%:p:h")/ -Switch CWD to the directory of the open buffer: +Switch [CWD](http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file) to the directory of the open buffer: map cd :cd %:p:h:pwd -Open `ag.vim` and put the cursor in the right position: +Open `ag.vim` for fast search: map g :Ag -Remove the Windows ^M - when the encodings gets messed up: - - noremap m mmHmt:%s///ge'tzt'm - Quickly open a buffer for scripbble: map q :e ~/buffer @@ -211,23 +211,6 @@ Toggle paste mode on and off: map pp :setlocal paste! -### Insert mode mappings - -Quickly insert parenthesis/brackets/etc.: - - inoremap $1 ()i - inoremap $2 []i - inoremap $3 {}i - inoremap $4 {o}O - inoremap $q ''i - inoremap $e ""i - inoremap $t <>i - -Insert the current date and time (useful for timestamps): - - iab xdate =strftime("%d/%m/%y %H:%M:%S") - - ### Visual mode mappings Visual mode pressing `*` or `#` searches for the current selection: @@ -251,7 +234,24 @@ Surround the visual selection in parenthesis/brackets/etc.: vnoremap $$ `>a"` vnoremap $q `>a'` vnoremap $e `>a"` - + + +### Insert mode mappings + +Quickly insert parenthesis/brackets/etc.: + + inoremap $1 ()i + inoremap $2 []i + inoremap $3 {}i + inoremap $4 {o}O + inoremap $q ''i + inoremap $e ""i + inoremap $t <>i + +Insert the current date and time (useful for timestamps): + + iab xdate =strftime("%d/%m/%y %H:%M:%S") + ### Command line mappings @@ -274,19 +274,20 @@ Write the file as sudo (works only on Unix). Super useful when you open a file a ### Spell checking -Pressing `ss` will toggle and untoggle spell checking +Pressing `ss` will toggle spell checking: map ss :setlocal spell! -Shortcuts using `` instead of special chars +Shortcuts using `` instead of special characters: map sn ]s map sp [s map sa zg map s? z= -### Cope -Do :help cope if you are unsure what cope is. It's super useful! + +### Cope +Query `:help cope` if you are unsure what cope is. It's super useful! When you search with `ag.vim`, display your results in cope by doing: `cc` @@ -297,14 +298,15 @@ To go to the next search result do: To go to the previous search results do: `p` -Vimscript mappings: +Cope mappings: map cc :botright cope map co ggVGy:tabnew:set syntax=qfpgg map n :cn map p :cp + ## How to uninstall -Do following: +Just do following: * Remove `~/.vim_runtime` * Remove any lines that reference `.vim_runtime` in your `~/.vimrc` From 89ed4f435b54ea25ca5d55294d02b5b2958b6e6f Mon Sep 17 00:00:00 2001 From: Amir Salihefendic Date: Sat, 1 Apr 2017 14:05:50 +0200 Subject: [PATCH 22/74] Updated screenshots --- README.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index bea55747..638a5f4e 100644 --- a/README.md +++ b/README.md @@ -49,20 +49,17 @@ Just do a git rebase! Colors when editing a Python file: -![Screenshot 1](http://files1.wedoist.com/e952fdb343b1e617b90d256e474d0370/as/screenshot_1.png) +![Screenshot 1](https://dnp4pehkvoo6n.cloudfront.net/07583008e4da885801657e8781777844/as/Python%20editing.png) Opening recently opened files with the [mru.vim](https://github.com/vim-scripts/mru.vim) plugin: -![Screenshot 2](http://files1.wedoist.com/1967b0e48af40e513d1a464e08196990/as/screenshot_2.png) +![Screenshot 2](https://dnp4pehkvoo6n.cloudfront.net/1d49a88f9bd5d013c025bb1e1272a7d8/as/MRU%20plugin.png) [NERD Tree](https://github.com/scrooloose/nerdtree) plugin in a terminal window: -![Screenshot 3](http://files1.wedoist.com/b1509d7ed9e9f357e8d04797f9fad67b/as/screenshot3.png) - -This vimrc even works on Windows! -![Screenshot 4](http://files1.wedoist.com/4e85163d97b81422240c822c82022f2f/as/screenshot_4.png) +![Screenshot 3](https://dnp4pehkvoo6n.cloudfront.net/ae719203166585d64728f28398f4b1b7/as/Terminal%20usage.png) Distraction free mode using [goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2): -![Screenshot 5](https://d2dq6e731uoz0t.cloudfront.net/a5182977c3d6c2a6cd3f9e97398ca8ca/as/zen_mode.jpg) +![Screenshot 4](https://dnp4pehkvoo6n.cloudfront.net/f0dcc4c9739148c56cbf8285a910ac41/as/Zen%20mode.png) ## Included Plugins From 04ce579f61fc60e8cba9fb92d05e4cb15aa7fbca Mon Sep 17 00:00:00 2001 From: amix Date: Sat, 1 Apr 2017 14:12:35 +0200 Subject: [PATCH 23/74] Fixed https://github.com/amix/vimrc/issues/263 --- vimrcs/basic.vim | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/vimrcs/basic.vim b/vimrcs/basic.vim index 6c1d423c..b783aef3 100644 --- a/vimrcs/basic.vim +++ b/vimrcs/basic.vim @@ -299,14 +299,18 @@ if has("mac") || has("macunix") vmap endif -" Delete trailing white space on save, useful for Python and CoffeeScript ;) -func! DeleteTrailingWS() - exe "normal mz" - %s/\s\+$//ge - exe "normal `z" -endfunc -autocmd BufWrite *.py :call DeleteTrailingWS() -autocmd BufWrite *.coffee :call DeleteTrailingWS() +" Delete trailing white space on save, useful for some filetypes ;) +fun! CleanExtraSpaces() + let save_cursor = getpos(".") + let old_query = getreg('/') + silent! %s/\s\+$//e + call setpos('.', save_cursor) + call setreg('/', old_query) +endfun + +if has("autocmd") + autocmd BufWritePre *.txt,*.js,*.py,*.wiki,*.sh,*.coffee :call CleanExtraSpaces() +endif """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" From c4fbfe8aa877c8b595bc515ec241217c3744a589 Mon Sep 17 00:00:00 2001 From: amix Date: Sat, 1 Apr 2017 14:29:02 +0200 Subject: [PATCH 24/74] Fixed https://github.com/amix/vimrc/issues/246 --- README.md | 10 +- sources_non_forked/ack.vim/.gitignore | 1 + sources_non_forked/ack.vim/LICENSE | 89 +++++ sources_non_forked/ack.vim/README.md | 161 +++++++++ sources_non_forked/ack.vim/autoload/ack.vim | 246 ++++++++++++++ sources_non_forked/ack.vim/doc/ack.txt | 315 ++++++++++++++++++ .../ack.vim/doc/ack_quick_help.txt | 15 + sources_non_forked/ack.vim/ftplugin/qf.vim | 9 + sources_non_forked/ack.vim/plugin/ack.vim | 83 +++++ sources_non_forked/ag.vim/.gitignore | 2 - sources_non_forked/ag.vim/README.md | 81 ----- sources_non_forked/ag.vim/Rakefile | 3 - sources_non_forked/ag.vim/autoload/ag.vim | 234 ------------- sources_non_forked/ag.vim/doc/ag.txt | 174 ---------- sources_non_forked/ag.vim/plugin/ag.vim | 11 - .../vim-snipmate/autoload/snipMate.vim | 8 +- .../vim-snipmate/plugin/snipMate.vim | 3 +- update_plugins.py | 2 +- vimrcs/basic.vim | 63 +--- vimrcs/extended.vim | 60 ++++ 20 files changed, 993 insertions(+), 577 deletions(-) create mode 100644 sources_non_forked/ack.vim/.gitignore create mode 100644 sources_non_forked/ack.vim/LICENSE create mode 100644 sources_non_forked/ack.vim/README.md create mode 100644 sources_non_forked/ack.vim/autoload/ack.vim create mode 100644 sources_non_forked/ack.vim/doc/ack.txt create mode 100644 sources_non_forked/ack.vim/doc/ack_quick_help.txt create mode 100644 sources_non_forked/ack.vim/ftplugin/qf.vim create mode 100644 sources_non_forked/ack.vim/plugin/ack.vim delete mode 100644 sources_non_forked/ag.vim/.gitignore delete mode 100644 sources_non_forked/ag.vim/README.md delete mode 100644 sources_non_forked/ag.vim/Rakefile delete mode 100644 sources_non_forked/ag.vim/autoload/ag.vim delete mode 100644 sources_non_forked/ag.vim/doc/ag.txt delete mode 100644 sources_non_forked/ag.vim/plugin/ag.vim diff --git a/README.md b/README.md index 638a5f4e..52efaaaa 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ Distraction free mode using [goyo.vim](https://github.com/junegunn/goyo.vim) and I recommend reading the docs of these plugins to understand them better. Each plugin provides a much better Vim experience! -* [ag.vim](https://github.com/rking/ag.vim): Vim plugin for `the_silver_searcher` (ag) -- a wicked fast grep +* [ack.vim](https://github.com/mileszs/ack.vim): Vim plugin for `the_silver_searcher` (ag) or ack -- a wicked fast grep * [bufexplorer.zip](https://github.com/vim-scripts/bufexplorer.zip): Quickly and easily switch between buffers. This plugin can be opened with `` * [ctrlp.vim](https://github.com/ctrlpvim/ctrlp.vim): Fuzzy file, buffer, mru and tag finder. It's mapped to `` * [goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2): @@ -195,9 +195,9 @@ Switch [CWD](http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file map cd :cd %:p:h:pwd -Open `ag.vim` for fast search: +Open `ack.vim` for fast search: - map g :Ag + map g :Ack Quickly open a buffer for scripbble: @@ -215,7 +215,7 @@ Visual mode pressing `*` or `#` searches for the current selection: vnoremap * :call VisualSelection('f') vnoremap # :call VisualSelection('b') -When you press gv you `ag.vim` after the selected text: +When you press gv you `Ack.vim` after the selected text: vnoremap gv :call VisualSelection('gv', '') @@ -286,7 +286,7 @@ Shortcuts using `` instead of special characters: ### Cope Query `:help cope` if you are unsure what cope is. It's super useful! -When you search with `ag.vim`, display your results in cope by doing: +When you search with `Ack.vim`, display your results in cope by doing: `cc` To go to the next search result do: diff --git a/sources_non_forked/ack.vim/.gitignore b/sources_non_forked/ack.vim/.gitignore new file mode 100644 index 00000000..6e92f57d --- /dev/null +++ b/sources_non_forked/ack.vim/.gitignore @@ -0,0 +1 @@ +tags diff --git a/sources_non_forked/ack.vim/LICENSE b/sources_non_forked/ack.vim/LICENSE new file mode 100644 index 00000000..056ea36c --- /dev/null +++ b/sources_non_forked/ack.vim/LICENSE @@ -0,0 +1,89 @@ +ack.vim is distributed under the same license terms as Vim itself, which you +can find in full with `:help license` within Vim, or copied in full herein. + +Copyright (c) 2007-2015 Antoine Imbert + and contributors. + +Maintainers may be contacted via GitHub Issues at: + + https://github.com/mileszs/ack.vim/issues + + +VIM LICENSE + +I) There are no restrictions on distributing unmodified copies of Vim except + that they must include this license text. You can also distribute + unmodified parts of Vim, likewise unrestricted except that they must + include this license text. You are also allowed to include executables + that you made from the unmodified Vim sources, plus your own usage + examples and Vim scripts. + +II) It is allowed to distribute a modified (or extended) version of Vim, + including executables and/or source code, when the following four + conditions are met: + 1) This license text must be included unmodified. + 2) The modified Vim must be distributed in one of the following five ways: + a) If you make changes to Vim yourself, you must clearly describe in + the distribution how to contact you. When the maintainer asks you + (in any way) for a copy of the modified Vim you distributed, you + must make your changes, including source code, available to the + maintainer without fee. The maintainer reserves the right to + include your changes in the official version of Vim. What the + maintainer will do with your changes and under what license they + will be distributed is negotiable. If there has been no negotiation + then this license, or a later version, also applies to your changes. + The current maintainer is Bram Moolenaar . If this + changes it will be announced in appropriate places (most likely + vim.sf.net, www.vim.org and/or comp.editors). When it is completely + impossible to contact the maintainer, the obligation to send him + your changes ceases. Once the maintainer has confirmed that he has + received your changes they will not have to be sent again. + b) If you have received a modified Vim that was distributed as + mentioned under a) you are allowed to further distribute it + unmodified, as mentioned at I). If you make additional changes the + text under a) applies to those changes. + c) Provide all the changes, including source code, with every copy of + the modified Vim you distribute. This may be done in the form of a + context diff. You can choose what license to use for new code you + add. The changes and their license must not restrict others from + making their own changes to the official version of Vim. + d) When you have a modified Vim which includes changes as mentioned + under c), you can distribute it without the source code for the + changes if the following three conditions are met: + - The license that applies to the changes permits you to distribute + the changes to the Vim maintainer without fee or restriction, and + permits the Vim maintainer to include the changes in the official + version of Vim without fee or restriction. + - You keep the changes for at least three years after last + distributing the corresponding modified Vim. When the maintainer + or someone who you distributed the modified Vim to asks you (in + any way) for the changes within this period, you must make them + available to him. + - You clearly describe in the distribution how to contact you. This + contact information must remain valid for at least three years + after last distributing the corresponding modified Vim, or as long + as possible. + e) When the GNU General Public License (GPL) applies to the changes, + you can distribute the modified Vim under the GNU GPL version 2 or + any later version. + 3) A message must be added, at least in the output of the ":version" + command and in the intro screen, such that the user of the modified Vim + is able to see that it was modified. When distributing as mentioned + under 2)e) adding the message is only required for as far as this does + not conflict with the license used for the changes. + 4) The contact information as required under 2)a) and 2)d) must not be + removed or changed, except that the person himself can make + corrections. + +III) If you distribute a modified version of Vim, you are encouraged to use + the Vim license for your changes and make them available to the + maintainer, including the source code. The preferred way to do this is + by e-mail or by uploading the files to a server and e-mailing the URL. + If the number of changes is small (e.g., a modified Makefile) e-mailing a + context diff will do. The e-mail address to be used is + + +IV) It is not allowed to remove this license from the distribution of the Vim + sources, parts of it or from a modified version. You may use this + license for previous Vim releases instead of the license that they came + with, at your option. diff --git a/sources_non_forked/ack.vim/README.md b/sources_non_forked/ack.vim/README.md new file mode 100644 index 00000000..af8f522d --- /dev/null +++ b/sources_non_forked/ack.vim/README.md @@ -0,0 +1,161 @@ +# ack.vim + +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 ack (>= 2.0), of course. To install it follow the +[manual](http://beyondgrep.com/install/). + +### The Plugin + +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: + +#### Pathogen + + $ git clone https://github.com/mileszs/ack.vim.git ~/.vim/bundle/ack.vim + +#### Vundle + +```vim +Plugin 'mileszs/ack.vim' +``` + +#### NeoBundle + +```vim +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 `{directories}` (which defaults to the current directory) +for the `{pattern}`. + +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 `:help Ack` +after installing, or [`doc/ack.txt`][doc] in the repo, for more information.) + +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 + +The quickfix results window is augmented with these convenience mappings: + + ? 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 without moving to it + h to open in horizontal split + H to open in horizontal split, keeping focus on the results + v to open in vertical split + gv to open in vertical split, keeping focus on the results + q to close the quickfix window + +### Gotchas + +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. + +#### I don't want to jump to the first result automatically. #### + +Use `:Ack!`, with bang. If you want this behavior most of the time, you might +like an abbreviation or mapping in your personal config, something like these: + +```vim +cnoreabbrev Ack Ack! +nnoremap a :Ack! +``` + +Most of the `:[L]Ack*` commands support this. Note that this behavior follows +the convention of Vim's built-in `:grep` and `:make` commands. + +[The Silver Searcher]: https://github.com/ggreer/the_silver_searcher +[sadface]: https://github.com/mileszs/ack.vim/commit/d97090fb502d40229e6976dfec0e06636ba227d5#commitcomment-5771145 + +## Changelog + +Please see [the Github releases page][releases]. + +## Credits + +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. + +And of course, where would we be without [Ack]. And, you know, Vim. + +[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/ + +[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 new file mode 100644 index 00000000..dbf84572 --- /dev/null +++ b/sources_non_forked/ack.vim/autoload/ack.vim @@ -0,0 +1,246 @@ +if exists('g:autoloaded_ack') || &cp + finish +endif + +if exists('g:ack_use_dispatch') + if g:ack_use_dispatch && !exists(':Dispatch') + call s:Warn('Dispatch not loaded! Falling back to g:ack_use_dispatch = 0.') + let g:ack_use_dispatch = 0 + endif +else + let g:ack_use_dispatch = 0 +endif + +"----------------------------------------------------------------------------- +" Public API +"----------------------------------------------------------------------------- + +function! ack#Ack(cmd, args) "{{{ + call s:Init(a:cmd) + redraw + + " 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 + + " Check user policy for blank searches + if empty(a:args) + if !g:ack_use_cword_for_empty_search + echo "No regular expression found." + return + endif + endif + + " If no pattern is provided, search for the word under the cursor + let l:grepargs = empty(a:args) ? expand("") : a:args . join(a:000, ' ') + + "Bypass search if cursor is on blank string + if l:grepargs == "" + echo "No regular expression found." + return + endif + + " 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 + call s:SearchWithGrep(a:cmd, l:grepprg, l:escaped_args, l:grepformat) + endif + + " 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 "}}} + +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 "}}} + +function! ack#AckHelp(cmd, args) "{{{ + let args = a:args . ' ' . s:GetDocLocations() + call ack#Ack(a:cmd, args) +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 "}}} + +function! ack#ShowResults() "{{{ + let l:handler = s:UsingLocList() ? g:ack_lhandler : g:ack_qhandler + execute l:handler + call s:ApplyMappings() + redraw! +endfunction "}}} + +"----------------------------------------------------------------------------- +" Private API +"----------------------------------------------------------------------------- + +function! s:ApplyMappings() "{{{ + if !s:UsingListMappings() || &filetype != 'qf' + return + endif + + 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 + nmap j + nmap 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 bufhidden=hide nobuflisted + setlocal nomodifiable noswapfile + setlocal filetype=help + setlocal nonumber norelativenumber nowrap + setlocal foldmethod=diff foldlevel=20 + + 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 + + try + let &l:makeprg = l:grepprg . ' ' . a:grepargs + let &l:errorformat = a:grepformat + + Make + finally + let &l:makeprg = l:makeprg_bak + let &l:errorformat = l:errorformat_bak + endtry +endfunction "}}} + +function! s:SearchWithGrep(grepcmd, grepprg, grepargs, grepformat) "{{{ + let l:grepprg_bak = &l:grepprg + let l:grepformat_bak = &grepformat + + try + let &l:grepprg = a:grepprg + let &grepformat = a:grepformat + + silent execute a:grepcmd a:grepargs + finally + let &l:grepprg = l:grepprg_bak + let &grepformat = l:grepformat_bak + endtry +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 "}}} + +let g:autoloaded_ack = 1 +" vim:set et sw=2 ts=2 tw=78 fdm=marker diff --git a/sources_non_forked/ack.vim/doc/ack.txt b/sources_non_forked/ack.vim/doc/ack.txt new file mode 100644 index 00000000..22e884bc --- /dev/null +++ b/sources_non_forked/ack.vim/doc/ack.txt @@ -0,0 +1,315 @@ +*ack.txt* Plugin that integrates ack with Vim + +============================================================================== +Author: Antoine Imbert *ack-author* +License: Same terms as Vim itself (see |license|) + +This plugin is only available if 'compatible' is not set. + +{Vi does not have any of this} + +============================================================================== +INTRODUCTION *ack* + +This plugin is a front for the Perl module App::Ack. Ack can be used as a +replacement for grep. This plugin will allow you to run ack from vim, and +shows the results in a split window. + +:Ack[!] [options] {pattern} [{directory}] *:Ack* + + Search recursively in {directory} (which defaults to the current + directory) for the {pattern}. Behaves just like the |:grep| command, but + will open the |Quickfix| window for you. If [!] is not given the first + occurrence is jumped to. + +:AckAdd [options] {pattern} [{directory}] *:AckAdd* + + Just like |:Ack|, but instead of making a new list, the matches are + appended to the current |quickfix| list. + +:AckFromSearch [{directory}] *:AckFromSearch* + + Just like |:Ack| but the pattern is from previous search. + +:LAck [options] {pattern} [{directory}] *:LAck* + + Just like |:Ack| but instead of the |quickfix| list, matches are placed in + the current |location-list|. + +:LAckAdd [options] {pattern} [{directory}] *:LAckAdd* + + Just like |:AckAdd| but instead of the |quickfix| list, matches are added + to the current |location-list| + +:AckFile [options] {pattern} [{directory}] *:AckFile* + + Search recursively in {directory} (which defaults to the current + directory) for filenames matching the {pattern}. Behaves just like the + |:grep| command, but will open the |Quickfix| window for you. + +:AckHelp[!] [options] {pattern} *:AckHelp* + + Search vim documentation files for the {pattern}. Behaves just like the + |:Ack| command, but searches only vim documentation .txt files + +:LAckHelp [options] {pattern} *:LAckHelp* + + Just like |:AckHelp| but instead of the |quickfix| list, matches are placed + in the current |location-list|. + +:AckWindow[!] [options] {pattern} *:AckWindow* + + Search all buffers visible in the screen (current tab page only) files for + the {pattern}. + +:LAckWindow [options] {pattern} *:LAckWindow* + + Just like |:AckWindow| but instead of the |quickfix| list, matches are + placed in the current |location-list|. + +Files containing the search term will be listed in the split 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. + +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. + + +============================================================================== +CONFIGURATION *ack-configuration* + + *g:ackprg* +g:ackprg +Default for ubuntu: "ack-grep" +Default for other systems: "ack" + +Use this option to specify the search command and its default arguments. + +Example: +> + let g:ackprg = "ag --vimgrep" +< + *g:ack_default_options* +g:ack_default_options +Default: " -s -H --nocolor --nogroup --column" + +Use this option to specify the default arguments given to `ack`. This is only +used if |g:ackprg| has not been customized from the default--if you are using +a custom search program instead of Ack, set your preferred options in +|g:ackprg|. + +NOTE: This option may be deprecated in the future. ~ + +Example: +> + let g:ack_default_options = + \ " -s -H --nocolor --nogroup --column --smart-case --follow" +< + *g:ack_apply_qmappings* +g:ack_apply_qmappings +Default: 1 + +This option enables mappings on the |quickfix| window. + + *g:ack_apply_lmappings* +g:ack_apply_lmappings +Default: 1 + +This option enables mappings on |location-list| windows. + + *g:ack_mappings* +g:ack_mappings +Default: { + \ "t": "T", + \ "T": "TgTj", + \ "o": "", + \ "O": ":ccl", + \ "go": "j", + \ "h": "K", + \ "H": "Kb", + \ "v": "HbJt", + \ "gv": "HbJ" } + +This option list all maps create on quickfix/Location list window. + +Example, if you want to open the result in the middle of the screen: +> + let g:ack_mappings = { "o": "zz" } +< + *g:ack_qhandler* +g:ack_qhandler +Default: "botright copen" + +Command to open the quickview window. + +If you want to open a quickview window with 30 lines you can do: +> + let g:ack_qhandler = "botright copen 30" +< + *g:ack_lhandler* +g:ack_lhandler +Default: "botright lopen" + +Command to open the Location list window. + +If you want to open a Location list window with 30 lines you can do: +> + let g:ack_lhandler = "botright lopen 30" +< + *g:ackhighlight* +g:ackhighlight +Default: 0 + +Use this option to highlight the searched term. + +Example: +> + let g:ackhighlight = 1 +< + *g:ack_autoclose* +g:ack_autoclose +Default: 0 + +Use this option to specify whether to close the quickfix window after +using any of the shortcuts. + +Example: +> + let g:ack_autoclose = 1 +< + *g:ack_autofold_results* +g:ack_autofold_results +Default: 0 + +Use this option to fold the results in quickfix by file name. Only the current +fold will be open by default and while you press 'j' and 'k' to move between the +results if you hit other fold the last one will be closed and the current will +be open. + +Example: +> + let g:ack_autofold_results = 1 +< + *g:ackpreview* +g:ackpreview +Default: 0 + +Use this option to automagically open the file with 'j' or 'k'. + +Example: +> + let g:ackpreview = 1 +< + *g:ack_use_dispatch* +g:ack_use_dispatch +Default: 0 + +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: +> + let g:ack_use_dispatch = 1 +< + *g:ack_use_cword_for_empty_search* +g:ack_use_cword_for_empty_search +Default: 1 + +Use this option to enable blank searches to run against the word under the +cursor. When this option is not set, blank searches will only output an error +message. + +Example: +> + let g:ack_use_cword_for_empty_search = 0 +< +============================================================================== +MAPPINGS *ack-mappings* + +The following keyboard shortcuts are available in the |quickfix| and +|location-list| windows: + +? display a quick summary of these mappings. + +o open file (same as Enter). + +O open file and close the quickfix window. + +go preview file (open but maintain focus on ack.vim results). + +t open in a new tab. + +T open in new tab without moving to it. + +h open in horizontal split. + +H open in horizontal split, keeping focus on the results. + +v open in vertical split. + +gv open in vertical split, keeping focus on the results. + +q close the quickfix window. + +To adjust these, see |g:ack_mappings|. + +============================================================================== +Ignoring files *ack-ignore* + +If you're using this plugin with ag, The Silver Searcher, bear in mind that: + + - It ignores file patterns from your .gitignore and .hgignore. + + - If there are other files in your source repository you don't wish to + search, you can add their patterns to an .agignore file. + +============================================================================== +ISSUES AND FAQ *ack-issues-and-faq* + +I don't want to jump to the first result automatically.~ + + Use `:Ack!`, with bang. If you want this behavior most of the time, you + might like an abbreviation or mapping in your personal config, something + like these: +> + cnoreabbrev Ack Ack! + nnoremap a :Ack! +< + Most of the `:[L]Ack*` commands support this. Note that this behavior + follows the convention of Vim's built-in |:grep| and |:make| commands. + +I use NERDTree and opening ack.vim results in a vertical split displacing it.~ + + You are probably using NERDTree with its default alignment at the left + side of the window. Set these custom mappings in your vimrc to work around + this: +> + let g:ack_mappings = { + \ 'v': 'LpJp', + \ 'gv': 'LpJ' } +< + This solution will be improved in the future. + +Results show a mix of relative and absolute paths, making them hard to read.~ + + This is a quirk of Vim that can happen with plain |:vimgrep| too. You can + try this in your vimrc to work around it: +> + autocmd BufAdd * exe "cd" fnameescape(getcwd()) +< + but for some users this may be disruptive to their Vim workflow. For more + details, see: + + http://vi.stackexchange.com/a/4816/7174 + https://github.com/mileszs/ack.vim/issues/143 + +vim:set et sw=4 ts=4 tw=78: diff --git a/sources_non_forked/ack.vim/doc/ack_quick_help.txt b/sources_non_forked/ack.vim/doc/ack_quick_help.txt new file mode 100644 index 00000000..94306a0e --- /dev/null +++ b/sources_non_forked/ack.vim/doc/ack_quick_help.txt @@ -0,0 +1,15 @@ +==== ack.vim quick help =============== + + *?:* 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 without moving to it + *h:* to open in horizontal split + *H:* to open in horizontal split, keeping focus on the results + *v:* to open in vertical split + *gv:* to open in vertical split, keeping focus on the results + *q:* to close the quickfix window + +======================================== diff --git a/sources_non_forked/ack.vim/ftplugin/qf.vim b/sources_non_forked/ack.vim/ftplugin/qf.vim new file mode 100644 index 00000000..27564fa7 --- /dev/null +++ b/sources_non_forked/ack.vim/ftplugin/qf.vim @@ -0,0 +1,9 @@ +if exists("g:ack_autofold_results") && g:ack_autofold_results + setlocal foldlevel=0 + setlocal foldmethod=expr + setlocal foldexpr=matchstr(getline(v:lnum),'^[^\|]\\+')==#matchstr(getline(v:lnum+1),'^[^\|]\\+')?1:'<1' + setlocal foldenable + setlocal foldclose=all + setlocal foldopen=all + nnoremap j jzz +endif diff --git a/sources_non_forked/ack.vim/plugin/ack.vim b/sources_non_forked/ack.vim/plugin/ack.vim new file mode 100644 index 00000000..202ae2ea --- /dev/null +++ b/sources_non_forked/ack.vim/plugin/ack.vim @@ -0,0 +1,83 @@ +if exists('g:loaded_ack') || &cp + finish +endif + +if !exists("g:ack_default_options") + let g:ack_default_options = " -s -H --nopager --nocolor --nogroup --column" +endif + +" Location of the ack utility +if !exists("g:ackprg") + if executable('ack-grep') + let g:ackprg = "ack-grep" + elseif executable('ack') + let g:ackprg = "ack" + else + finish + endif + let g:ackprg .= g:ack_default_options +endif + +if !exists("g:ack_apply_qmappings") + let g:ack_apply_qmappings = !exists("g:ack_qhandler") +endif + +if !exists("g:ack_apply_lmappings") + let g:ack_apply_lmappings = !exists("g:ack_lhandler") +endif + +let s:ack_mappings = { + \ "t": "T", + \ "T": "TgTj", + \ "o": "", + \ "O": "pc", + \ "go": "p", + \ "h": "K", + \ "H": "Kb", + \ "v": "HbJt", + \ "gv": "HbJ" } + +if exists("g:ack_mappings") + let g:ack_mappings = extend(s:ack_mappings, g:ack_mappings) +else + let g:ack_mappings = s:ack_mappings +endif + +if !exists("g:ack_qhandler") + let g:ack_qhandler = "botright copen" +endif + +if !exists("g:ack_lhandler") + let g:ack_lhandler = "botright lopen" +endif + +if !exists("g:ackhighlight") + let g:ackhighlight = 0 +endif + +if !exists("g:ack_autoclose") + let g:ack_autoclose = 0 +endif + +if !exists("g:ack_autofold_results") + let g:ack_autofold_results = 0 +endif + +if !exists("g:ack_use_cword_for_empty_search") + let g:ack_use_cword_for_empty_search = 1 +endif + +command! -bang -nargs=* -complete=file Ack call ack#Ack('grep', ) +command! -bang -nargs=* -complete=file AckAdd call ack#Ack('grepadd', ) +command! -bang -nargs=* -complete=file AckFromSearch call ack#AckFromSearch('grep', ) +command! -bang -nargs=* -complete=file LAck call ack#Ack('lgrep', ) +command! -bang -nargs=* -complete=file LAckAdd call ack#Ack('lgrepadd', ) +command! -bang -nargs=* -complete=file AckFile call ack#Ack('grep -g', ) +command! -bang -nargs=* -complete=help AckHelp call ack#AckHelp('grep', ) +command! -bang -nargs=* -complete=help LAckHelp call ack#AckHelp('lgrep', ) +command! -bang -nargs=* AckWindow call ack#AckWindow('grep', ) +command! -bang -nargs=* 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/ag.vim/.gitignore b/sources_non_forked/ag.vim/.gitignore deleted file mode 100644 index e350eccf..00000000 --- a/sources_non_forked/ag.vim/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -tags -ag-vim.tgz diff --git a/sources_non_forked/ag.vim/README.md b/sources_non_forked/ag.vim/README.md deleted file mode 100644 index e02a4d3e..00000000 --- a/sources_non_forked/ag.vim/README.md +++ /dev/null @@ -1,81 +0,0 @@ -# ag.vim # - -## Deprecated: See [this comment](https://github.com/rking/ag.vim/issues/124#issuecomment-227038003) for more info. Maybe try [ack.vim](https://github.com/mileszs/ack.vim#can-i-use-ag-the-silver-searcher-with-this) as an alternative. ## - -This plugin is a front for ag, A.K.A. -[the_silver_searcher](https://github.com/ggreer/the_silver_searcher). Ag can -be used as a replacement for 153% of the uses of `ack`. This plugin will allow -you to run ag from vim, and shows the results in a split window. - -## Installation ## - -See [the_silver_searcher's README](https://github.com/ggreer/the_silver_searcher#installing) for its installation instructions (if you haven't installed it already). - -You have to first install [ag](https://github.com/ggreer/the_silver_searcher), itself. On Mac+Homebrew, Gentoo Linux, several others, there's package named `the_silver_searcher`, but if your OS/distro don't have one, the GitHub repo installs fine: - -Vim has various ways of installing plugins, the standard way is in [the documentation](http://vimdoc.sourceforge.net/htmldoc/usr_05.html#plugin), but most people use a plugin to manage their plugins. If you don't already have a preferred plugin manager plugin, why not try one of the following? -- [vim-plug](https://github.com/junegunn/vim-plug#readme) -- [vim-pathogen](https://github.com/tpope/vim-pathogen#readme) -- [Vundle.vim](https://github.com/gmarik/Vundle.vim#readme) -- Or, if you don't use any sort of Vim plugin management: - - ```sh - cd ~/.vim/bundle && git clone https://github.com/rking/ag.vim ag && echo "set runtimepath^=~/.vim/bundle/ag" >> ~/.vimrc - ``` - - Then open vim and run `:helptags ~/.vim/bundle/ag/doc`. - -### Configuration ### - -You can specify a custom ag name and path in your .vimrc like so: - - let g:ag_prg=" --vimgrep" - -You can configure ag.vim to always start searching from your project root -instead of the cwd - - let g:ag_working_path_mode="r" - -## Usage ## - - :Ag [options] {pattern} [{directory}] - -Search recursively in {directory} (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. - -Just like where you use :grep, :grepadd, :lgrep, and :lgrepadd, you can use `:Ag`, `:AgAdd`, `:LAg`, and `:LAgAdd` respectively. (See `doc/ag.txt`, or install and `:h Ag` for more information.) - -### Gotchas ### - -Some characters have special meaning, and need to be escaped your search pattern. For instance, '#'. You have to escape it like this `:Ag '\\\#define foo'` to search for `#define foo`. (From [blueyed in issue #5](https://github.com/mileszs/ack.vim/issues/5).) - -Sometimes `git grep` is even faster, though in my experience it's not noticeably so. - -### Keyboard Shortcuts ### - -In the quickfix window, you can use: - - e to open file and close the quickfix window - o to open (same as enter) - go to preview file (open but maintain focus on ag.vim results) - t to open in new tab - T to open in new tab silently - h to open in horizontal split - H to open in horizontal split silently - v to open in vertical split - gv to open in vertical split silently - q to close the quickfix window - -### Related Plugin ### -[vim-ag-anything](https://github.com/Chun-Yang/vim-ag-anything) adds an 'ga' action to search any text object. - -### Acknowledgements ### - -This Vim plugin is derived (and by derived, I mean copied, almost entirely) -from [milesz's ack.vim](https://github.com/mileszs/ack.vim), which I also -recommend installing since you might be in a situation where you have ack but -not ag, and don't want to stop to install ag. Also, ack supports `--type`, and -a few other features. diff --git a/sources_non_forked/ag.vim/Rakefile b/sources_non_forked/ag.vim/Rakefile deleted file mode 100644 index e6bb6da7..00000000 --- a/sources_non_forked/ag.vim/Rakefile +++ /dev/null @@ -1,3 +0,0 @@ -task :tgz do - sh 'cd ..; tar czvf ag/ag-vim.tgz ag/{plugin,autoload,doc}' -end diff --git a/sources_non_forked/ag.vim/autoload/ag.vim b/sources_non_forked/ag.vim/autoload/ag.vim deleted file mode 100644 index 432ef444..00000000 --- a/sources_non_forked/ag.vim/autoload/ag.vim +++ /dev/null @@ -1,234 +0,0 @@ -" NOTE: You must, of course, install ag / the_silver_searcher - -" FIXME: Delete deprecated options below on or after 2016-4 (6 months from when the deprecation warning was added) {{{ - -if exists("g:agprg") - let g:ag_prg = g:agprg - echohl WarningMsg - call input('g:agprg is deprecated and will be removed. Please use g:ag_prg') - echohl None -endif - -if exists("g:aghighlight") - let g:ag_highlight = g:aghighlight - echohl WarningMsg - call input('g:aghighlight is deprecated and will be removed. Please use g:ag_highlight') - echohl None -endif - -if exists("g:agformat") - let g:ag_format = g:agformat - echohl WarningMsg - call input('g:agformat is deprecated and will be removed. Please use g:ag_format') - echohl None -endif - -" }}} FIXME: Delete the deprecated options above on or after 15-7 (6 months from when they were changed) - -" Location of the ag utility -if !exists("g:ag_prg") - " --vimgrep (consistent output we can parse) is available from version 0.25.0+ - if split(system("ag --version"), "[ \n\r\t]")[2] =~ '\d\+.\(\(2[5-9]\)\|\([3-9][0-9]\)\)\(.\d\+\)\?' - let g:ag_prg="ag --vimgrep" - else - " --noheading seems odd here, but see https://github.com/ggreer/the_silver_searcher/issues/361 - let g:ag_prg="ag --column --nogroup --noheading" - endif -endif - -if !exists("g:ag_apply_qmappings") - let g:ag_apply_qmappings=1 -endif - -if !exists("g:ag_apply_lmappings") - let g:ag_apply_lmappings=1 -endif - -if !exists("g:ag_qhandler") - let g:ag_qhandler="botright copen" -endif - -if !exists("g:ag_lhandler") - let g:ag_lhandler="botright lopen" -endif - -if !exists("g:ag_mapping_message") - let g:ag_mapping_message=1 -endif - -if !exists("g:ag_working_path_mode") - let g:ag_working_path_mode = 'c' -endif - -function! ag#AgBuffer(cmd, args) - let l:bufs = filter(range(1, bufnr('$')), 'buflisted(v:val)') - let l:files = [] - for buf in l:bufs - let l:file = fnamemodify(bufname(buf), ':p') - if !isdirectory(l:file) - call add(l:files, l:file) - endif - endfor - call ag#Ag(a:cmd, a:args . ' ' . join(l:files, ' ')) -endfunction - -function! ag#Ag(cmd, args) - let l:ag_executable = get(split(g:ag_prg, " "), 0) - - " Ensure that `ag` is installed - if !executable(l:ag_executable) - echoe "Ag command '" . l:ag_executable . "' was not found. Is the silver searcher installed and on your $PATH?" - return - endif - - " If no pattern is provided, search for the word under the cursor - if empty(a:args) - let l:grepargs = expand("") - else - let l:grepargs = a:args . join(a:000, ' ') - end - - if empty(l:grepargs) - echo "Usage: ':Ag {pattern}' (or just :Ag to search for the word under the cursor). See ':help :Ag' for more information." - return - endif - - " Format, used to manage column jump - if a:cmd =~# '-g$' - let s:ag_format_backup=g:ag_format - let g:ag_format="%f" - elseif exists("s:ag_format_backup") - let g:ag_format=s:ag_format_backup - elseif !exists("g:ag_format") - let g:ag_format="%f:%l:%c:%m" - endif - - let l:grepprg_bak=&grepprg - let l:grepformat_bak=&grepformat - let l:t_ti_bak=&t_ti - let l:t_te_bak=&t_te - try - let &grepprg=g:ag_prg - let &grepformat=g:ag_format - set t_ti= - set t_te= - if g:ag_working_path_mode ==? 'r' " Try to find the projectroot for current buffer - let l:cwd_back = getcwd() - let l:cwd = s:guessProjectRoot() - try - exe "lcd ".l:cwd - catch - echom 'Failed to change directory to:'.l:cwd - finally - silent! execute a:cmd . " " . escape(l:grepargs, '|') - exe "lcd ".l:cwd_back - endtry - else " Someone chose an undefined value or 'c' so we revert to the default - silent! execute a:cmd . " " . escape(l:grepargs, '|') - endif - finally - let &grepprg=l:grepprg_bak - let &grepformat=l:grepformat_bak - let &t_ti=l:t_ti_bak - let &t_te=l:t_te_bak - endtry - - if a:cmd =~# '^l' - let l:match_count = len(getloclist(winnr())) - else - let l:match_count = len(getqflist()) - endif - - if a:cmd =~# '^l' && l:match_count - exe g:ag_lhandler - let l:apply_mappings = g:ag_apply_lmappings - let l:matches_window_prefix = 'l' " we're using the location list - elseif l:match_count - exe g:ag_qhandler - let l:apply_mappings = g:ag_apply_qmappings - let l:matches_window_prefix = 'c' " we're using the quickfix window - endif - - " If highlighting is on, highlight the search keyword. - if exists('g:ag_highlight') - let @/ = matchstr(a:args, "\\v(-)\@", 'n') - end - - redraw! - - if l:match_count - if l:apply_mappings - nnoremap h K - nnoremap H Kb - nnoremap o - nnoremap t T - nnoremap T TgT - nnoremap v HbJt - - exe 'nnoremap e :' . l:matches_window_prefix .'close' - exe 'nnoremap go :' . l:matches_window_prefix . 'open' - exe 'nnoremap q :' . l:matches_window_prefix . 'close' - - exe 'nnoremap gv :let b:height=winheight(0)H:' . l:matches_window_prefix . 'openJ:exe printf(":normal %d\c-w>_", b:height)' - " Interpretation: - " :let b:height=winheight(0) Get the height of the quickfix/location list window - " Open the current item in a new split - " H Slam the newly opened window against the left edge - " :copen -or- :lopen Open either the quickfix window or the location list (whichever we were using) - " J Slam the quickfix/location list window against the bottom edge - " :exe printf(":normal %d\c-w>_", b:height) Restore the quickfix/location list window's height from before we opened the match - - if g:ag_mapping_message && l:apply_mappings - echom "ag.vim keys: q=quit /e/t/h/v=enter/edit/tab/split/vsplit go/T/H/gv=preview versions of same" - endif - endif - else " Close the split window automatically: - cclose - lclose - echohl WarningMsg - echom 'No matches for "'.a:args.'"' - echohl None - endif -endfunction - -function! ag#AgFromSearch(cmd, args) - let search = getreg('/') - " translate vim regular expression to perl regular expression. - let search = substitute(search,'\(\\<\|\\>\)','\\b','g') - call ag#Ag(a:cmd, '"' . search .'" '. a:args) -endfunction - -function! ag#GetDocLocations() - let dp = '' - for p in split(&runtimepath,',') - let p = p.'doc/' - if isdirectory(p) - let dp = p.'*.txt '.dp - endif - endfor - return dp -endfunction - -function! ag#AgHelp(cmd,args) - let args = a:args.' '.ag#GetDocLocations() - call ag#Ag(a:cmd,args) -endfunction - -function! s:guessProjectRoot() - let l:splitsearchdir = split(getcwd(), "/") - - while len(l:splitsearchdir) > 2 - let l:searchdir = '/'.join(l:splitsearchdir, '/').'/' - for l:marker in ['.rootdir', '.git', '.hg', '.svn', 'bzr', '_darcs', 'build.xml'] - " found it! Return the dir - if filereadable(l:searchdir.l:marker) || isdirectory(l:searchdir.l:marker) - return l:searchdir - endif - endfor - let l:splitsearchdir = l:splitsearchdir[0:-2] " Splice the list to get rid of the tail directory - endwhile - - " Nothing found, fallback to current working dir - return getcwd() -endfunction diff --git a/sources_non_forked/ag.vim/doc/ag.txt b/sources_non_forked/ag.vim/doc/ag.txt deleted file mode 100644 index e702c291..00000000 --- a/sources_non_forked/ag.vim/doc/ag.txt +++ /dev/null @@ -1,174 +0,0 @@ -*ag.txt* Plugin that integrates ag with Vim - -============================================================================== -INTRODUCTION *ag* - -This plugin is a front for the_silver_searcher: ag. Ag can be used as a -replacement for ack. This plugin will allow you to run ag from vim, and shows -the results in a split window. - -:Ag[!] [options] {pattern} [{directory}] *:Ag* - - Search recursively in {directory} (which defaults to the current - directory) for the {pattern}. Behaves just like the |:grep| command, but - will open the |Quickfix| window for you. If [!] is not given the first - error is jumped to. - -:AgBuffer[!] [options] {pattern} *:AgBuffer* - - Search for {pattern} in all open buffers. Behaves just like the |:grep| - command, but will open the |Quickfix| window for you. If [!] is not given - the first error is jumped to. - - Note: this will not find changes in modified buffers, since ag can only - find what is on disk! You can save buffers automatically when searching - with the 'autowrite' option. A buffer will be ignored if it is a directory - (an explorer, like netrw). - -:AgAdd [options] {pattern} [{directory}] *:AgAdd* - - Just like |:Ag|, but instead of making a new list, the matches are - appended to the current |quickfix| list. - -:AgFromSearch [{directory}] *:AgFromSearch* - - Just like |:Ag| but the pattern is from previous search. - -:LAg [options] {pattern} [{directory}] *:LAg* - - Just like |:Ag| but instead of the |quickfix| list, matches are placed in - the current |location-list|. - -:LAgBuffer [options] {pattern} *:LAgBuffer* - - Just like |:AgBuffer| but instead of the |quickfix| list, matches are - placed in the current |location-list|. - -:LAgAdd [options] {pattern} [{directory}] *:LAgAdd* - - Just like |:AgAdd| but instead of the |quickfix| list, matches are added - to the current |location-list| - -:AgFile [options] {pattern} [{directory}] *:AgFile* - - Search recursively in {directory} (which defaults to the current - directory) for filenames matching the {pattern}. Behaves just like the - |:grep| command, but will open the |Quickfix| window for you. - -:AgHelp[!] [options] {pattern} *:AgHelp* - - Search vim documentation files for the {pattern}. Behaves just like the - |:Ag| command, but searches only vim documentation .txt files - -:LAgHelp [options] {pattern} *:LAgHelp* - - Just like |:AgHelp| but instead of the |quickfix| list, matches are placed - in the current |location-list|. - -Files containing the search term will be listed in the split 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. - -See http://geoff.greer.fm/2011/12/27/the-silver-searcher-better-than-ack/ for -more information. - -============================================================================== -OPTIONS *ag-options* - - *g:ag_prg* -The location of the Ag program, and any options you want passed to it before -searching. Default: "ag --vimgrep" (for parsable output). Example: > - let g:ag_prg="ag --vimgrep --smart-case" -< -Note: the `--vimgrep` option was added in Ag 0.25.0. If ag.vim detects that -you're using a lower version, the following default will be used instead: > - let g:ag_prg="ag --column --nogroup --noheading" -< -This works around inconsistent behaviors in earlier Ag versions, but it is -recommended that you upgrade if possible for a better experience. `--vimgrep` -supports multiple matches on the same line of text, for example. - -For background, see: https://github.com/rking/ag.vim/pull/88 - - *g:ag_working_path_mode* -A mapping that describes where ag will be run. Default is the current working -directory. Specifying 'r' as the argument will tell it to run from the project -rootdirectory. For now any other mapping will result to the default. -Example: - let g:ag_working_path_mode='r' - - *g:ag_highlight* -If 1, highlight the search terms after searching. Default: 0. Example: > - let g:ag_highlight=1 -< - - *g:ag_format* -Format to recognize the matches. See 'errorformat' for more info. Default: -"%f" when searching for files, "%f:%l:%c:%m" if not otherwise set. For -example, if your `g:ag_prg` is set to just "ag" (no column numbers in the -output, so when you jump to a match your cursor will be on the start of the -line): > - let g:ag_format="%f:%l:%m" -< - - *g:ag_apply_lmappings* -Whether or not to add custom mappings to location list windows opened by this -plugin. Only applies if you're using the location list. Default 1. Example: > - let g:ag_apply_lmappings=0 -< - - *g:ag_apply_qmappings* -Whether or not to add custom mappings to quickfix windows opened by this -plugin. Only applies if you're using the error list. Default 1. Example: > - let g:ag_apply_qmappings=0 -< - - *g:ag_lhandler* -A custom command used to open the location list after it's populated. -Default: "botright lopen". You might want to set this to change where the -location list is opened, or what size it is. Example: > - let g:ag_lhandler="topleft lopen" -< - - *g:ag_qhandler* -A custom command used to open the error list after it's populated. Default: -"botright copen". You might want to set this to change where the quickfix -window is opened, or what size it is. Example: > - let g:ag_qhandler="copen 20" -< - - *g:ag_mapping_message* -Whether or not to show the message explaining the extra mappings that are -added to the results list this plugin populates. This message is not shown if -the mappings are not applied (see |g:ag_apply_qmappings| and -|g:ag_apply_lmappings| for more info. Default 1. Example: > - let g:ag_mapping_message=0 -< - -============================================================================== -MAPPINGS *ag-mappings* - -The following keyboard shortcuts are available in the quickfix window: - -e open file and close the quickfix window. - -o open file (same as enter). - -go preview file (open but maintain focus on ag.vim results). - -t open in a new tab. - -T open in new tab silently. - -h open in horizontal split. - -H open in horizontal split silently. - -v open in vertical split. - -gv open in vertical split silently. - -q close the quickfix window. - - vim:tw=78:fo=tcq2:ft=help:norl: diff --git a/sources_non_forked/ag.vim/plugin/ag.vim b/sources_non_forked/ag.vim/plugin/ag.vim deleted file mode 100644 index 053f213c..00000000 --- a/sources_non_forked/ag.vim/plugin/ag.vim +++ /dev/null @@ -1,11 +0,0 @@ -" NOTE: You must, of course, install ag / the_silver_searcher -command! -bang -nargs=* -complete=file Ag call ag#Ag('grep',) -command! -bang -nargs=* -complete=file AgBuffer call ag#AgBuffer('grep',) -command! -bang -nargs=* -complete=file AgAdd call ag#Ag('grepadd', ) -command! -bang -nargs=* -complete=file AgFromSearch call ag#AgFromSearch('grep', ) -command! -bang -nargs=* -complete=file LAg call ag#Ag('lgrep', ) -command! -bang -nargs=* -complete=file LAgBuffer call ag#AgBuffer('lgrep',) -command! -bang -nargs=* -complete=file LAgAdd call ag#Ag('lgrepadd', ) -command! -bang -nargs=* -complete=file AgFile call ag#Ag('grep -g', ) -command! -bang -nargs=* -complete=help AgHelp call ag#AgHelp('grep',) -command! -bang -nargs=* -complete=help LAgHelp call ag#AgHelp('lgrep',) diff --git a/sources_non_forked/vim-snipmate/autoload/snipMate.vim b/sources_non_forked/vim-snipmate/autoload/snipMate.vim index 407ee869..9d1786ab 100644 --- a/sources_non_forked/vim-snipmate/autoload/snipMate.vim +++ b/sources_non_forked/vim-snipmate/autoload/snipMate.vim @@ -384,7 +384,7 @@ function! snipMate#DefaultPool(scopes, trigger, result) abort let s:lookup_state.extends = [] for expr in s:snippet_filenames(scope, escape(a:trigger, "*[]?{}`'$|#%")) - for path in g:snipMate.snippet_dirs + for path in s:snippet_dirs() for file in s:Glob(path, expr) source `=file` endfor @@ -416,6 +416,10 @@ fun! snipMate#GetSnippets(scopes, trigger) abort return result endf +function! s:snippet_dirs() abort + return get(g:snipMate, 'snippet_dirs', split(&rtp, ',')) +endfunction + function! snipMate#OpenSnippetFiles() abort let files = [] let scopes_done = [] @@ -425,7 +429,7 @@ function! snipMate#OpenSnippetFiles() abort let files += s:snippet_filenames(scope, '') endfor call filter(files, "v:val !~# '\\*'") - for path in g:snipMate.snippet_dirs + for path in s:snippet_dirs() let fullpaths = map(copy(files), 'printf("%s/%s", path, v:val)') let exists += filter(copy(fullpaths), 'filereadable(v:val)') let notexists += map(filter(copy(fullpaths), diff --git a/sources_non_forked/vim-snipmate/plugin/snipMate.vim b/sources_non_forked/vim-snipmate/plugin/snipMate.vim index 837f0dcc..75e74aab 100644 --- a/sources_non_forked/vim-snipmate/plugin/snipMate.vim +++ b/sources_non_forked/vim-snipmate/plugin/snipMate.vim @@ -93,8 +93,7 @@ endif let g:snipMate['get_snippets'] = get(g:snipMate, 'get_snippets', funcref#Function("snipMate#GetSnippets")) " List of paths where snippets/ dirs are located -let g:snipMate['snippet_dirs'] = get(g:snipMate, 'snippet_dirs', split(&rtp, ',')) -if type(g:snipMate['snippet_dirs']) != type([]) +if exists('g:snipMate.snippet_dirs') && type(g:snipMate['snippet_dirs']) != type([]) echohl WarningMsg echom "g:snipMate['snippet_dirs'] must be a List" echohl None diff --git a/update_plugins.py b/update_plugins.py index 9b364de9..00c3ec03 100644 --- a/update_plugins.py +++ b/update_plugins.py @@ -16,7 +16,7 @@ from os import path #--- Globals ---------------------------------------------- PLUGINS = """ -ag.vim https://github.com/rking/ag.vim +ack.vim https://github.com/mileszs/ack.vim bufexplorer https://github.com/corntrace/bufexplorer ctrlp.vim https://github.com/ctrlpvim/ctrlp.vim mayansmoke https://github.com/vim-scripts/mayansmoke diff --git a/vimrcs/basic.vim b/vimrcs/basic.vim index b783aef3..c45c3bce 100644 --- a/vimrcs/basic.vim +++ b/vimrcs/basic.vim @@ -4,7 +4,7 @@ " http://amix.dk - amix@amix.dk " " Version: -" 5.0 - 29/05/12 15:43:36 +" 6.0 - 01/04/17 14:24:34 " " Blog_post: " http://amix.dk/blog/post/19691#The-ultimate-Vim-configuration-on-Github @@ -313,36 +313,6 @@ if has("autocmd") endif -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Ag searching and cope displaying -" requires ag.vim - it's much better than vimgrep/grep -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" When you press gv you Ag after the selected text -vnoremap gv :call VisualSelection('gv', '') - -" Open Ag and put the cursor in the right position -map g :Ag - -" When you press r you can search and replace the selected text -vnoremap r :call VisualSelection('replace', '') - -" Do :help cope if you are unsure what cope is. It's super useful! -" -" When you search with Ag, display your results in cope by doing: -" cc -" -" To go to the next search result do: -" n -" -" To go to the previous search results do: -" p -" -map cc :botright cope -map co ggVGy:tabnew:set syntax=qfpgg -map n :cn -map p :cp - - """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Spell checking """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -372,35 +342,9 @@ map x :e ~/buffer.md map pp :setlocal paste! - - """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Helper functions """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -function! CmdLine(str) - exe "menu Foo.Bar :" . a:str - emenu Foo.Bar - unmenu Foo -endfunction - -function! VisualSelection(direction, extra_filter) range - let l:saved_reg = @" - execute "normal! vgvy" - - let l:pattern = escape(@", "\\/.*'$^~[]") - let l:pattern = substitute(l:pattern, "\n$", "", "") - - if a:direction == 'gv' - call CmdLine("Ag '" . l:pattern . "' " ) - elseif a:direction == 'replace' - call CmdLine("%s" . '/'. l:pattern . '/') - endif - - let @/ = l:pattern - let @" = l:saved_reg -endfunction - - " Returns true if paste mode is enabled function! HasPaste() if &paste @@ -429,8 +373,3 @@ function! BufcloseCloseIt() execute("bdelete! ".l:currentBufNum) endif endfunction - -" Make VIM remember position in file after reopen -" if has("autocmd") -" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif -"endif diff --git a/vimrcs/extended.vim b/vimrcs/extended.vim index 7d5bf3f9..f6b5cfb0 100644 --- a/vimrcs/extended.vim +++ b/vimrcs/extended.vim @@ -108,6 +108,41 @@ iab xdate =strftime("%d/%m/%y %H:%M:%S") autocmd FileType css set omnifunc=csscomplete#CompleteCSS +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Ack searching and cope displaying +" requires ack.vim - it's much better than vimgrep/grep +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Use the the_silver_searcher if possible (much faster than Ack) +if executable('ag') + let g:ackprg = 'ag --vimgrep --smart-case' +endif + +" When you press gv you Ack after the selected text +vnoremap gv :call VisualSelection('gv', '') + +" Open Ack and put the cursor in the right position +map g :Ack + +" When you press r you can search and replace the selected text +vnoremap r :call VisualSelection('replace', '') + +" Do :help cope if you are unsure what cope is. It's super useful! +" +" When you search with Ack, display your results in cope by doing: +" cc +" +" To go to the next search result do: +" n +" +" To go to the previous search results do: +" p +" +map cc :botright cope +map co ggVGy:tabnew:set syntax=qfpgg +map n :cn +map p :cp + + """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Helper functions @@ -135,3 +170,28 @@ endfunc func! CurrentFileDir(cmd) return a:cmd . " " . expand("%:p:h") . "/" endfunc + +function! CmdLine(str) + exe "menu Foo.Bar :" . a:str + emenu Foo.Bar + unmenu Foo +endfunction + +function! VisualSelection(direction, extra_filter) range + let l:saved_reg = @" + execute "normal! vgvy" + + let l:pattern = escape(@", "\\/.*'$^~[]") + let l:pattern = substitute(l:pattern, "\n$", "", "") + + if a:direction == 'gv' + call CmdLine("Ack '" . l:pattern . "' " ) + elseif a:direction == 'replace' + call CmdLine("%s" . '/'. l:pattern . '/') + endif + + let @/ = l:pattern + let @" = l:saved_reg +endfunction + + From 85e105159e4e11a433d7c4bdcacfc202d7c62f94 Mon Sep 17 00:00:00 2001 From: amix Date: Tue, 2 May 2017 14:42:08 +0200 Subject: [PATCH 25/74] Updated plugins --- sources_non_forked/ack.vim/README.md | 4 +- .../ctrlp.vim/autoload/ctrlp.vim | 2 +- .../ctrlp.vim/autoload/ctrlp/line.vim | 2 +- sources_non_forked/ctrlp.vim/doc/ctrlp.cnx | 57 ++- sources_non_forked/goyo.vim/doc/goyo.txt | 4 +- sources_non_forked/lightline.vim/.travis.yml | 27 +- sources_non_forked/lightline.vim/README.md | 2 +- .../nerdtree/autoload/nerdtree.vim | 2 +- sources_non_forked/syntastic/README.markdown | 16 +- .../autoload/syntastic/preprocess.vim | 33 +- .../syntastic/doc/syntastic-checkers.txt | 320 +++++++++++++--- .../syntastic/plugin/syntastic.vim | 2 +- .../syntastic/plugin/syntastic/registry.vim | 2 + .../syntastic/syntax_checkers/c/cppclean.vim | 40 ++ .../syntax_checkers/c/flawfinder.vim | 61 ++++ .../syntax_checkers/cmake/cmakelint.vim | 40 ++ .../syntax_checkers/cpp/cppclean.vim | 22 ++ .../syntax_checkers/cpp/flawfinder.vim | 26 ++ .../syntax_checkers/dart/dartanalyzer.vim | 5 +- .../syntastic/syntax_checkers/julia/lint.vim | 51 +++ .../syntastic/syntax_checkers/php/php.vim | 4 +- .../syntastic/syntax_checkers/po/dennis.vim | 43 +++ .../syntax_checkers/python/bandit.vim | 54 +++ .../syntax_checkers/typescript/tslint.vim | 6 +- .../syntastic/syntax_checkers/vim/vimlint.vim | 10 +- .../vim-fugitive/README.markdown | 12 +- .../vim-fugitive/doc/fugitive.txt | 8 +- .../vim-fugitive/plugin/fugitive.vim | 151 ++++---- sources_non_forked/vim-gitgutter/README.mkd | 7 +- .../vim-gitgutter/autoload/gitgutter/diff.vim | 5 +- .../vim-gitgutter/doc/gitgutter.txt | 2 +- .../vim-gitgutter/plugin/gitgutter.vim | 19 +- sources_non_forked/vim-go/CHANGELOG.md | 8 + sources_non_forked/vim-go/README.md | 344 ++---------------- sources_non_forked/vim-go/autoload/go/cmd.vim | 2 +- .../vim-go/autoload/go/coverage.vim | 2 +- sources_non_forked/vim-go/autoload/go/def.vim | 2 +- .../vim-go/autoload/go/guru.vim | 28 +- sources_non_forked/vim-go/autoload/go/job.vim | 27 +- .../vim-go/autoload/go/lint.vim | 23 +- .../vim-go/autoload/go/rename.vim | 11 +- sources_non_forked/vim-go/doc/vim-go.txt | 91 ++++- .../vim-markdown/README.markdown | 8 + .../vim-markdown/ftplugin/markdown.vim | 27 +- .../vim-markdown/syntax/markdown.vim | 5 +- .../vim-multiple-cursors/README.md | 3 + .../autoload/multiple_cursors.vim | 14 +- sources_non_forked/vim-pug/syntax/pug.vim | 5 +- .../vim-repeat/autoload/repeat.vim | 2 +- sources_non_forked/vim-snipmate/README.md | 14 + .../vim-snipmate/doc/snipMate.txt | 63 +++- .../vim-snippets/UltiSnips/rust.snippets | 72 ---- .../vim-snippets/UltiSnips/tex.snippets | 24 +- .../vim-snippets/snippets/cs.snippets | 199 ++++++---- .../vim-snippets/snippets/elixir.snippets | 34 +- .../vim-snippets/snippets/elm.snippets | 3 +- .../vim-snippets/snippets/fortran.snippets | 2 + .../vim-snippets/snippets/idris.snippets | 46 +++ .../vim-snippets/snippets/purescript.snippets | 9 +- .../vim-snippets/snippets/python.snippets | 4 + .../vim-snippets/snippets/ruby.snippets | 4 +- .../vim-snippets/snippets/rust.snippets | 7 + .../vim-snippets/snippets/tex.snippets | 4 +- 63 files changed, 1389 insertions(+), 737 deletions(-) create mode 100644 sources_non_forked/syntastic/syntax_checkers/c/cppclean.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/c/flawfinder.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/cmake/cmakelint.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/cpp/cppclean.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/cpp/flawfinder.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/julia/lint.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/po/dennis.vim create mode 100644 sources_non_forked/syntastic/syntax_checkers/python/bandit.vim create mode 100644 sources_non_forked/vim-snippets/snippets/idris.snippets diff --git a/sources_non_forked/ack.vim/README.md b/sources_non_forked/ack.vim/README.md index af8f522d..643ce65a 100644 --- a/sources_non_forked/ack.vim/README.md +++ b/sources_non_forked/ack.vim/README.md @@ -78,9 +78,9 @@ The quickfix results window is augmented with these convenience mappings: ? 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 + go to preview file, keeping focus on the results t to open in new tab - T to open in new tab without moving to it + T to open in new tab, keeping focus on the results h to open in horizontal split H to open in horizontal split, keeping focus on the results v to open in vertical split diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim index 7b2d660a..b1fe859c 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim @@ -2305,7 +2305,7 @@ fu! s:lastvisual() let cview = winsaveview() let [ovreg, ovtype] = [getreg('v'), getregtype('v')] let [oureg, outype] = [getreg('"'), getregtype('"')] - sil! norm! gv"vy + sil! norm! gV"vy let selected = s:regisfilter('v') cal setreg('v', ovreg, ovtype) cal setreg('"', oureg, outype) diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/line.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/line.vim index 5bec47ee..17b6061b 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/line.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/line.vim @@ -31,7 +31,7 @@ endf " Public {{{1 fu! ctrlp#line#init(bufnr) let [lines, bufnr] = [[], exists('s:bufnr') ? s:bufnr : a:bufnr] - let bufs = exists('s:lnmode') && s:lnmode ? ctrlp#buffers('id') : [bufnr] + let bufs = exists('s:lnmode') && !empty(s:lnmode) ? ctrlp#buffers('id') : [bufnr] for bufnr in bufs let [lfb, bufn] = [getbufline(bufnr, 1, '$'), bufname(bufnr)] if lfb == [] && bufn != '' diff --git a/sources_non_forked/ctrlp.vim/doc/ctrlp.cnx b/sources_non_forked/ctrlp.vim/doc/ctrlp.cnx index c2d69729..1f8a2ee6 100644 --- a/sources_non_forked/ctrlp.vim/doc/ctrlp.cnx +++ b/sources_non_forked/ctrlp.vim/doc/ctrlp.cnx @@ -1,4 +1,4 @@ -*ctrlp.txt* 模糊的 文件, 缓冲区, 最近最多使用, 标签, ... 检索. v1.79 +*ctrlp.txt* 支持模糊匹配的 文件, 缓冲区, 最近最多使用, 标签, ... 检索. v1.79 *CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'* =============================================================================== # # @@ -68,7 +68,7 @@ OPTIONS *ctrlp-options* |ctrlp_arg_map|...............是否拦截 命令。 |ctrlp_follow_symlinks|.......是否跟随链接。 |ctrlp_lazy_update|...........停止输入时才更新。 - |ctrlp_default_input|.........为提示符面板提供一个种子。 + |ctrlp_default_input|.........为提示符面板提供一个初始字符串。 |ctrlp_abbrev|................输入缩写。 |ctrlp_key_loop|..............为多字节输入开启输入事件循环。 |ctrlp_prompt_mappings|.......改变提示符面板内部的按键绑定。 @@ -76,6 +76,7 @@ OPTIONS *ctrlp-options* |ctrlp_open_single_match|.....当只有一个候选时自动接受。 |ctrlp_brief_prompt|..........提示符为空的时候使用退出 CtrlP。 |ctrlp_match_current_file|....在匹配条目中包含当前文件。 + |ctrlp_types|.................內建类型的名称。 最近最多使用模式: |ctrlp_mruf_max|..............记录的最近最多使用的最大数据。 @@ -154,6 +155,7 @@ OPTIONS *ctrlp-options* 结果集的最大数目: results:{n} - 列出最多 {n} 条结果 (默认: 和最大高度同步). + 0代表没有限制。 注意: 当一个设置项没有被设置时,将会使用默认值。 @@ -254,7 +256,7 @@ OPTIONS *ctrlp-options* 考虑清楚。 *'g:ctrlp_custom_ignore'* -作为对 |'wildignore'| 的补充,用来设置你只是想在CtrlP中隐藏的文件和目录。使用正 +作为对 |'wildignore'| 和 |g:ctrlp_show_hidden| 的补充,用来设置你只是想在CtrlP中隐藏的文件和目录。使用正 则表达式来指定匹配模式: > let g:ctrlp_custom_ignore = '' < @@ -439,13 +441,19 @@ OPTIONS *ctrlp-options* *'g:ctrlp_match_current_file'* -在匹配条目中包含当前文件: +在匹配条目中包含当前文件: > let g:ctrlp_match_current_file = 1 默认情况下,当前文件不包含在列表中。 注意: 当使用 |g:ctrlp_match_func| 时不会应用这个选项。 + *'g:ctrlp_types'* +通过设置这个列表变量的值来定制核心类型: > + let g:ctrlp_types = ['mru', 'fil'] + +类型默认为: > + let g:ctrlp_types = ['fil', 'buf', 'mru']. *'g:ctrlp_abbrev'* 定义可以在提示面包内被扩展(内部的或者可见的)的输入缩写: > @@ -817,7 +825,8 @@ MRU mode options:~ :CtrlP [起始目录] 用文件搜索模式打开CtrlP。 - 如果没有给定参数,|g:ctrlp_working_path_mode| 会被用来决定起始目录。 + 如果没有给定参数,|g:ctrlp_working_path_mode| 会被用来决定起始目录。临时覆盖 + 这个参数 的方法见 |:CtrlPCurFile| 和 |:CtrlPCurWD| 。 在输入时你可以使用 自动补全[起始目录]。 @@ -825,6 +834,16 @@ MRU mode options:~ :CtrlPBuffer 用缓冲区搜索模式打开CtrlP。 + *:CtrlPCurFile* +:CtrlPCurFile + 行为类似变量 |g:ctrlp_working_path_mode| = '' 时执行 |:CtrlP| ,忽略这个变量 + 现在的值。 + + *:CtrlPCurWD* +:CtrlPCurWD + 行为类似变量 |g:ctrlp_working_path_mode| = '' 时执行 |:CtrlP| ,忽略这个变量 + 现在的值。 + *:CtrlPMRU* :CtrlPMRU 用最近最多使用模式打开CtrlP。 @@ -1259,7 +1278,8 @@ h) 使用?打开帮助文件。 缓冲标签模式选项:~ *'g:ctrlp_buftag_ctags_bin'* -如果ctags没有在环境变量中配置,使用该选项来指定它的位置: > +如果ctags没有在环境变量中配置,或者一个二进制ctags文件存在于 +/opt/local/bin 或 /usr/local/bin,使用该选项来指定它的位置: > let g:ctrlp_buftag_ctags_bin = '' < @@ -1411,6 +1431,31 @@ Git 仓库: https://github.com/ctrlpvim/ctrlp.vim =============================================================================== 更新日志 *ctrlp-changelog* + * 新选项 |g:ctrlp_custom_tag_files| 用来指定自定义的标签文件。 + * 设置 g:ctrlp_match_window 为0来不限制窗口大小 + +Before 2016/11/28~ + + + 新命令: |YankLine()| 来复制整个文件。 + + 新选项: |g:ctrlp_types| 来选择內建类型。 + + 新特性: 异步在新线程中调用 |g:ctrlp_user_command| 。 设置 + |g:user_command_async| 为1来启用。 + + 为 delphi, rust 和 golang提供buffertag支持。 + + 新选项: |g:ctrlp_brief_prompt|, + |g:match_current_file|, + |g:ctrlp_compare_lim|. + + 新功能: 自动忽略扩展。 + + 为 ant, tex, dosbatch, matlab 和 vhdl提供buffertag支持。 + + 新选项 |g:ctrlp_line_prefix| 来结合第三方插件。 + + 新选项 |g:open_single_match| 在 matches 中打开单个文件。 + + 添加启动方式 (ctrlp) 。 + + 接受 bang for CtrlPBookmarkDirAdd 来避免确认。 + + 处理像 "g:ctrlp_TYPE_MODE" 大小写混合的变量名。 + 例如: let g:ctrlp_path_sort + + 新选项: |g:ctrlp_custom_ancestors| + +在2014/08/08之前~ + + 新的支持高亮的缓冲区浏览模式 (建议 |+conceal|) + 新选项: |g:ctrlp_bufname_mod|, |g:ctrlp_bufpath_mod| diff --git a/sources_non_forked/goyo.vim/doc/goyo.txt b/sources_non_forked/goyo.vim/doc/goyo.txt index cdc129f8..0af9e6b3 100644 --- a/sources_non_forked/goyo.vim/doc/goyo.txt +++ b/sources_non_forked/goyo.vim/doc/goyo.txt @@ -1,4 +1,4 @@ -goyo.txt goyo Last change: April 1 2017 +goyo.txt goyo Last change: April 2 2017 GOYO - TABLE OF CONTENTS *goyo* *goyo-toc* ============================================================================== @@ -12,7 +12,7 @@ GOYO - TABLE OF CONTENTS *goyo* *goyo-to Pros. License -GOYO.VIM (고요) *goyo* +GOYO.VIM (고요) *goyo-vim* ============================================================================== Distraction-free writing in Vim. diff --git a/sources_non_forked/lightline.vim/.travis.yml b/sources_non_forked/lightline.vim/.travis.yml index ae4b73fb..3767d735 100644 --- a/sources_non_forked/lightline.vim/.travis.yml +++ b/sources_non_forked/lightline.vim/.travis.yml @@ -4,19 +4,26 @@ sudo: false install: - git clone --depth=1 https://github.com/thinca/vim-themis /tmp/themis - - git clone https://github.com/vim/vim $HOME/vim - - (if ! test -d $HOME/vim-7.4/bin; then cd $HOME/vim && git checkout . && git checkout v7.4 && ./configure --prefix=$HOME/vim-7.4 && make && make install; fi) - - (if ! test -d $HOME/vim-7.3/bin; then cd $HOME/vim && git checkout . && git checkout v7.3 && ./configure --prefix=$HOME/vim-7.3 && make && make install; fi) - - (if ! test -d $HOME/vim-7.2.051/bin; then cd $HOME/vim && git checkout . && git checkout v7.2.051 && ./configure --prefix=$HOME/vim-7.2.051 && make && make install; fi) + - (if ! test -d $HOME/vim-$VIM_VERSION/bin; then + git clone https://github.com/vim/vim $HOME/vim && + cd $HOME/vim && + git checkout v$VIM_VERSION && + ./configure --prefix=$HOME/vim-$VIM_VERSION && + make && + make install; + fi) cache: directories: - - $HOME/vim-7.4 - - $HOME/vim-7.3 - - $HOME/vim-7.2.051 + - $HOME/vim-$VIM_VERSION + +env: + - VIM_VERSION=8.0.0000 + - VIM_VERSION=7.4 + - VIM_VERSION=7.3 + - VIM_VERSION=7.2.051 script: + - export PATH=$HOME/vim-$VIM_VERSION/bin:$PATH + - vim --version - /tmp/themis/bin/themis --reporter spec - - PATH=$HOME/vim-7.4/bin/:$PATH /tmp/themis/bin/themis --reporter spec - - PATH=$HOME/vim-7.3/bin/:$PATH /tmp/themis/bin/themis --reporter spec - - PATH=$HOME/vim-7.2.051/bin/:$PATH /tmp/themis/bin/themis --reporter spec diff --git a/sources_non_forked/lightline.vim/README.md b/sources_non_forked/lightline.vim/README.md index 2b80f35b..e97b6b7a 100644 --- a/sources_non_forked/lightline.vim/README.md +++ b/sources_non_forked/lightline.vim/README.md @@ -65,7 +65,7 @@ This software is released under the MIT License, see LICENSE. git clone https://github.com/itchyny/lightline.vim ~/.vim/bundle/lightline.vim -### Vundle (https://github.com/gmarik/Vundle.vim) +### Vundle (https://github.com/VundleVim/Vundle.vim) 1. Add the following configuration to your `.vimrc`. Plugin 'itchyny/lightline.vim' diff --git a/sources_non_forked/nerdtree/autoload/nerdtree.vim b/sources_non_forked/nerdtree/autoload/nerdtree.vim index e0d86efa..4402b4f4 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree.vim @@ -92,7 +92,7 @@ endfunction " same as :exec cmd but eventignore=all is set for the duration function! nerdtree#exec(cmd) let old_ei = &ei - set ei=all + set ei=BufEnter,BufLeave,VimEnter exec a:cmd let &ei = old_ei endfunction diff --git a/sources_non_forked/syntastic/README.markdown b/sources_non_forked/syntastic/README.markdown index 4212c95a..8f0e4607 100644 --- a/sources_non_forked/syntastic/README.markdown +++ b/sources_non_forked/syntastic/README.markdown @@ -58,15 +58,15 @@ their script to find them. At the time of this writing, syntastic has checking plugins for ACPI Source Language, ActionScript, Ada, Ansible configurations, API Blueprint, -AppleScript, AsciiDoc, Assembly languages, BEMHTML, Bro, Bourne shell, C, -C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, +AppleScript, AsciiDoc, Assembly languages, BEMHTML, Bro, Bourne shell, C, C++, +C#, Cabal, Chef, CMake, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dockerfile, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, -GLSL, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, -JSX, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, Markdown, -MATLAB, Mercury, NASM, Nix, Objective-C, Objective-C++, OCaml, Perl, Perl -POD, PHP, gettext Portable Object, OS X and iOS property lists, Pug (formerly -Jade), Puppet, Python, QML, R, Racket, RDF TriG, RDF Turtle, Relax NG, -reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Solidity, +GLSL, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, +JSON, JSX, Julia, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, +Markdown, MATLAB, Mercury, NASM, Nix, Objective-C, Objective-C++, OCaml, Perl, +Perl POD, PHP, gettext Portable Object, OS X and iOS property lists, Pug +(formerly Jade), Puppet, Python, QML, R, Racket, RDF TriG, RDF Turtle, Relax +NG, reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Solidity, Sphinx, SQL, Stylus, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, Vim help, VimL, xHtml, XML, XSLT, XQuery, YACC, YAML, YANG data models, z80, Zope page templates, and Zsh. See the [manual][checkers] for details about the diff --git a/sources_non_forked/syntastic/autoload/syntastic/preprocess.vim b/sources_non_forked/syntastic/autoload/syntastic/preprocess.vim index 451d308c..52ec865a 100644 --- a/sources_non_forked/syntastic/autoload/syntastic/preprocess.vim +++ b/sources_non_forked/syntastic/autoload/syntastic/preprocess.vim @@ -8,6 +8,37 @@ set cpo&vim " Public functions {{{1 +function! syntastic#preprocess#bandit(errors) abort " {{{2 + let out = [] + let json = s:_decode_JSON(join(a:errors, '')) + + if type(json) == type({}) && has_key(json, 'results') && type(json['results']) == type([]) + for issue in json['results'] + if type(issue) == type({}) + try + call add(out, + \ issue['filename'] . ':' . + \ issue['line_number'] . ':' . + \ { 'LOW': 'I', 'MEDIUM': 'W', 'HIGH': 'E' }[issue['issue_severity']] . ':' . + \ issue['test_id'][1:] . ':' . + \ issue['issue_text'] . + \ ' [' . issue['test_name'] . '] (confidence: ' . issue['issue_confidence'] . ')') + catch /\m^Vim\%((\a\+)\)\=:E716/ + call syntastic#log#warn('checker python/bandit: unrecognized error item ' . string(issue)) + let out = [] + break + endtry + else + call syntastic#log#warn('checker python/bandit: unrecognized error item ' . string(issue)) + endif + endfor + else + call syntastic#log#warn('checker python/bandit: unrecognized error format (crashed checker?)') + endif + + return out +endfunction " }}}2 + function! syntastic#preprocess#cabal(errors) abort " {{{2 let out = [] let star = 0 @@ -435,7 +466,7 @@ echomsg string(out) endfunction " }}}2 function! syntastic#preprocess#tslint(errors) abort " {{{2 - return map(copy(a:errors), 'substitute(v:val, ''\m^\(([^)]\+)\)\s\(.\+\)$'', ''\2 \1'', "")') + return map(copy(a:errors), 'substitute(v:val, ''\v^((ERROR|WARNING): )?\zs(\([^)]+\))\s(.+)$'', ''\4 \3'', "")') endfunction " }}}2 function! syntastic#preprocess#validator(errors) abort " {{{2 diff --git a/sources_non_forked/syntastic/doc/syntastic-checkers.txt b/sources_non_forked/syntastic/doc/syntastic-checkers.txt index 7c902f9a..e70d61a0 100644 --- a/sources_non_forked/syntastic/doc/syntastic-checkers.txt +++ b/sources_non_forked/syntastic/doc/syntastic-checkers.txt @@ -23,6 +23,7 @@ SYNTAX CHECKERS BY LANGUAGE *syntastic-checkers-lang* C++......................................|syntastic-checkers-cpp| Cabal....................................|syntastic-checkers-cabal| Chef.....................................|syntastic-checkers-chef| + CMake....................................|syntastic-checkers-cmake| COBOL....................................|syntastic-checkers-cobol| Coco.....................................|syntastic-checkers-co| CoffeeScript.............................|syntastic-checkers-coffee| @@ -58,6 +59,7 @@ SYNTAX CHECKERS BY LANGUAGE *syntastic-checkers-lang* Java.....................................|syntastic-checkers-java| JavaScript...............................|syntastic-checkers-javascript| JSON.....................................|syntastic-checkers-json| + Julia....................................|syntastic-checkers-julia| LESS.....................................|syntastic-checkers-less| Lex......................................|syntastic-checkers-lex| @@ -530,12 +532,14 @@ The following checkers are available for C (filetype "c"): 3. ClangCheck...............|syntastic-c-clang_check| 4. Clang-Tidy...............|syntastic-c-clang_tidy| 5. Cppcheck.................|syntastic-c-cppcheck| - 6. GCC......................|syntastic-c-gcc| - 7. make.....................|syntastic-c-make| - 8. OClint...................|syntastic-c-oclint| - 9. PC-Lint..................|syntastic-c-pc_lint| - 10. Sparse..................|syntastic-c-sparse| - 11. Splint..................|syntastic-c-splint| + 6. cppclean.................|syntastic-c-cppclean| + 7. Flawfinder...............|syntastic-c-flawfinder| + 8. GCC......................|syntastic-c-gcc| + 9. make.....................|syntastic-c-make| + 10. OClint..................|syntastic-c-oclint| + 11. PC-Lint.................|syntastic-c-pc_lint| + 12. Sparse..................|syntastic-c-sparse| + 13. Splint..................|syntastic-c-splint| ------------------------------------------------------------------------------ 1. AVR-GCC *syntastic-c-avrgcc* @@ -693,7 +697,57 @@ one option per line (cf. |syntastic-config-files|). See also: |syntastic-cpp-cppcheck|. ------------------------------------------------------------------------------ -6. GCC *syntastic-c-gcc* +6. cppclean *syntastic-c-cppclean* + +Name: cppclean +Maintainer: LCD 47 + +"cppclean" attempts to find problems in C++ source that slow development in +large code bases, for example various forms of unused code. See the project's +page at GitHub for more information: + + https://github.com/myint/cppclean + +Installation~ + +Install it with "pip": > + pip install cppclean +< +Checker options~ + +This checker is initialised using the "makeprgBuild()" function and thus it +accepts the standard options described at |syntastic-config-makeprg|. + +See also: |syntastic-cpp-cppclean|. + +------------------------------------------------------------------------------ +7. Flawfinder *syntastic-c-flawfinder* + +Name: flawfinder +Maintainer: LCD 47 + +"Flawfinder" scans C/C++ source code for possible security weaknesses. See the +project's page for more information: + + https://www.dwheeler.com/flawfinder + +Checker options~ + +This checker is initialised using the "makeprgBuild()" function and thus it +accepts the standard options described at |syntastic-config-makeprg|. + +Additionally: + + *'g:syntastic_c_flawfinder_thres'* +Type: integer +Default: 3 +Error threshold. Policy violations with a severity above this value are +highlighted as errors, the others are considered warnings by syntastic. + +See also: |syntastic-cpp-flawfinder|. + +------------------------------------------------------------------------------ +8. GCC *syntastic-c-gcc* Name: gcc Maintainer: Gregor Uhlenheuer @@ -790,7 +844,7 @@ executable. See also: |syntastic-cpp-gcc|. ------------------------------------------------------------------------------ -7. make *syntastic-c-make* +9. make *syntastic-c-make* Name: make Maintainer: Gregor Uhlenheuer @@ -801,7 +855,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it accepts the standard options described at |syntastic-config-makeprg|. ------------------------------------------------------------------------------ -8. OClint *syntastic-c-oclint* +10. OClint *syntastic-c-oclint* Name: oclint Maintainer: "UnCO" Lin @@ -840,7 +894,7 @@ Config files pointed to by 'g:syntastic_oclint_config_file' are then ignored. See also: |syntastic-cpp-oclint|. ------------------------------------------------------------------------------ -9. PC-Lint *syntastic-c-pc_lint* +11. PC-Lint *syntastic-c-pc_lint* Name: pc_lint Maintainer: Steve Bragg @@ -867,7 +921,7 @@ current directory and in parent directories; first such file found is used. See also: |syntastic-cpp-pc_lint|. ------------------------------------------------------------------------------ -10. Sparse *syntastic-c-sparse* +12. Sparse *syntastic-c-sparse* Name: sparse Maintainer: Daniel Walker @@ -899,7 +953,7 @@ your vimrc: > This allows "Sparse" to read "GCC"'s private include files. ------------------------------------------------------------------------------ -11. Splint *syntastic-c-splint* +13. Splint *syntastic-c-splint* Name: splint Maintainer: LCD 47 @@ -955,11 +1009,13 @@ The following checkers are available for C++ (filetype "cpp"): 2. ClangCheck...............|syntastic-cpp-clang_check| 3. Clang-Tidy...............|syntastic-cpp-clang_tidy| 4. Cppcheck.................|syntastic-cpp-cppcheck| - 5. Cpplint..................|syntastic-cpp-cpplint| - 6. GCC......................|syntastic-cpp-gcc| - 7. OClint...................|syntastic-cpp-oclint| - 8. PC-Lint..................|syntastic-cpp-pc_lint| - 9. Vera++...................|syntastic-cpp-verapp| + 5. cppclean.................|syntastic-cpp-cppclean| + 6. Cpplint..................|syntastic-cpp-cpplint| + 7. Flawfinder...............|syntastic-cpp-flawfinder| + 8. GCC......................|syntastic-cpp-gcc| + 9. OClint...................|syntastic-cpp-oclint| + 10. PC-Lint.................|syntastic-cpp-pc_lint| + 11. Vera++..................|syntastic-cpp-verapp| ------------------------------------------------------------------------------ 1. AVR-GCC *syntastic-cpp-avrgcc* @@ -1103,7 +1159,31 @@ one option per line (cf. |syntastic-config-files|). See also: |syntastic-c-cppcheck|. ------------------------------------------------------------------------------ -5. Cpplint *syntastic-cpp-cpplint* +5. cppclean *syntastic-cpp-cppclean* + +Name: cppclean +Maintainer: LCD 47 + +"cppclean" attempts to find problems in C++ source that slow development in +large code bases, for example various forms of unused code. See the project's +page at GitHub for more information: + + https://github.com/myint/cppclean + +Installation~ + +Install it with "pip": > + pip install cppclean +< +Checker options~ + +This checker is initialised using the "makeprgBuild()" function and thus it +accepts the standard options described at |syntastic-config-makeprg|. + +See also: |syntastic-c-cppclean|. + +------------------------------------------------------------------------------ +6. Cpplint *syntastic-cpp-cpplint* Name: cpplint Maintainer: LCD 47 @@ -1139,7 +1219,33 @@ However, if your "cpplint" was installed with "pip", the script's name is let g:syntastic_cpp_cpplint_exec = "cpplint" < ------------------------------------------------------------------------------ -6. GCC *syntastic-cpp-gcc* +7. Flawfinder *syntastic-cpp-flawfinder* + +Name: flawfinder +Maintainer: LCD 47 + +"Flawfinder" scans C/C++ source code for possible security weaknesses. See the +project's page for more information: + + https://www.dwheeler.com/flawfinder + +Checker options~ + +This checker is initialised using the "makeprgBuild()" function and thus it +accepts the standard options described at |syntastic-config-makeprg|. + +Additionally: + + *'g:syntastic_cpp_flawfinder_thres'* +Type: integer +Default: 3 +Error threshold. Policy violations with a severity above this value are +highlighted as errors, the others are considered warnings by syntastic. + +See also: |syntastic-c-flawfinder|. + +------------------------------------------------------------------------------ +8. GCC *syntastic-cpp-gcc* Name: gcc Maintainer: Gregor Uhlenheuer @@ -1236,7 +1342,7 @@ executable. See also: |syntastic-c-gcc|. ------------------------------------------------------------------------------ -7. OClint *syntastic-cpp-oclint* +9. OClint *syntastic-cpp-oclint* Name: oclint Maintainer: "UnCO" Lin @@ -1276,7 +1382,7 @@ Config files pointed to by 'g:syntastic_oclint_config_file' are then ignored. See also: |syntastic-c-oclint|. ------------------------------------------------------------------------------ -8. PC-Lint *syntastic-cpp-pc_lint* +10. PC-Lint *syntastic-cpp-pc_lint* Name: pc_lint Maintainer: Steve Bragg @@ -1303,7 +1409,7 @@ current directory and in parent directories; first such file found is used. See also: |syntastic-c-pc_lint|. ------------------------------------------------------------------------------ -9. Vera++ *syntastic-cpp-verapp* +11. Vera++ *syntastic-cpp-verapp* Name: verapp Maintainer: Lucas Verney @@ -1381,6 +1487,34 @@ You probably also need a plugin to set |filetype| for Chef files, such as https://github.com/dougireton/vim-chef +============================================================================== +SYNTAX CHECKERS FOR CMAKE *syntastic-checkers-cmake* + +The following checkers are available for CMake (filetype "cmake"): + + 1. cmakelint................|syntastic-cmake-cmakelint| + +------------------------------------------------------------------------------ +1. cmakelint *syntastic-cmake-cmakelint* + +Name: cmakelint +Maintainer: LCD 47 + +"cmakelint" is a style checker for "CMake" files (https://cmake.org/). +See the project's page at GitHub more information: + + https://github.com/richq/cmake-lint + +Installation~ + +Install it with "pip": > + pip install cmakelint +< +Checker options~ + +This checker is initialised using the "makeprgBuild()" function and thus it +accepts the standard options described at |syntastic-config-makeprg|. + ============================================================================== SYNTAX CHECKERS FOR COBOL *syntastic-checkers-cobol* @@ -2244,10 +2378,37 @@ SYNTAX CHECKERS FOR GETTEXT PO *syntastic-checkers-po* The following checkers are available for gettext .po files (filetype "po"): - 1. msgfmt...................|syntastic-po-msgfmt| + 1. Dennis...................|syntastic-po-dennis| + 2. msgfmt...................|syntastic-po-msgfmt| ------------------------------------------------------------------------------ -1. msgfmt *syntastic-po-msgfmt* +1. Dennis *syntastic-po-dennis* + +Name: dennis +Maintainer: LCD 47 + +"Dennis" is a set of utilities for working with gettext Portable Object +(http://www.gnu.org/software/gettext/manual/html_node/PO-Files.html) +translation files: + + https://github.com/willkg/dennis/ + +See the program's manual for further details: + + http://dennis.readthedocs.io/en/latest/linting.html + +Installation~ + +Install it with "pip": > + pip install dennis +< +Checker options~ + +This checker is initialised using the "makeprgBuild()" function and thus it +accepts the standard options described at |syntastic-config-makeprg|. + +------------------------------------------------------------------------------ +2. msgfmt *syntastic-po-msgfmt* Name: msgfmt Maintainer: Ryo Okubo @@ -3591,6 +3752,44 @@ Checker options~ This checker is initialised using the "makeprgBuild()" function and thus it accepts the standard options described at |syntastic-config-makeprg|. +============================================================================== +SYNTAX CHECKERS FOR JULIA *syntastic-checkers-julia* + +The following checkers are available for Julia (filetype "julia"): + + 1. lint.....................|syntastic-julia-lint| + +------------------------------------------------------------------------------ +1. lint *syntastic-julia-lint* + +Name: lint +Maintainer: LCD 47 + +This is a checker for Julia files (https://julialang.org/), using the Julia +package "Lint". See the package's documentation for more information: + + http://lintjl.readthedocs.io/ + +Installation~ + +You need to install Julia itself, and the package "Lint". You can install +"Lint" from the Julia package manager, with the command: > + Pkg.add("Lint") +< +Checker Options~ + +This checker doesn't call the "makeprgBuild()" function, and thus it ignores +the usual 'g:syntastic_julia_lint_

-Go (golang) support for Vim, which comes with pre-defined sensible settings (like -auto gofmt on save), with autocomplete, snippet support, improved syntax -highlighting, go toolchain commands, and more. If needed vim-go installs all -necessary binaries for providing seamless Vim integration with current -commands. It's highly customizable and each individual feature can be -disabled/enabled easily. - ## Features -* Improved Syntax highlighting with items such as Functions, Operators, Methods. -* Auto completion support via `gocode` -* Better `gofmt` on save, which keeps cursor position and doesn't break your undo - history -* Go to symbol/declaration with `:GoDef` -* Look up documentation with `:GoDoc` inside Vim or open it in browser -* Automatically import packages via `:GoImport` or plug it into autosave -* Compile your package with `:GoBuild`, install it with `:GoInstall` or test - them with `:GoTest` (also supports running single tests via `:GoTestFunc`) +This plugin adds Go language support for Vim, with the following main features: + +* Build with `:GoBuild`, install with `:GoInstall` or test + with `:GoTest` (run single tests via `:GoTestFunc`) +* Show test coverage with `:GoCoverage` or in browser with `:GoCoverageBrowser` +* Goto definition with `:GoDef` +* Quick jump to declarations with `:GoDecls` or `:GoDeclsDir` +* Show documentation with `:GoDoc` inside or in browser with `:GoDocBrowser` * Quickly execute your current file/files with `:GoRun` -* Automatic `GOPATH` detection based on the directory structure (i.e. `gb` - projects, `godep` vendored projects) -* Change or display `GOPATH` with `:GoPath` -* Create a coverage profile and display annotated source code to see which - functions are covered with `:GoCoverage` -* Call `gometalinter` with `:GoMetaLinter`, which invokes all possible linters - (golint, vet, errcheck, deadcode, etc..) and shows the warnings/errors -* Lint your code with `:GoLint` -* Run your code through `:GoVet` to catch static errors * Advanced source analysis tools utilizing guru, such as `:GoImplements`, `:GoCallees`, and `:GoReferrers` -* Precise type-safe renaming of identifiers with `:GoRename` -* List all source files and dependencies -* Unchecked error checking with `:GoErrCheck` -* Integrated and improved snippets, supporting `ultisnips` or `neosnippet` -* Share your current code to [play.golang.org](http://play.golang.org) with `:GoPlay` -* On-the-fly type information about the word under the cursor. Plug it into - your custom vim function. -* Go asm formatting on save -* Tagbar support to show tags of the source code in a sidebar with `gotags` -* Custom vim text objects such as `a function` or `inner function` - list. -* Jump to function or type declarations with `:GoDecls` or `:GoDeclsDir` -* Vim 8.0 support. Async execution for most commands, various underlying improvements. -* NeoVim support (beta). Async execution for some commands. -* Alternate between implementation and test code with `:GoAlternate` +* Change or display `GOPATH` with `:GoPath` +* Multiple 3rd linter support with `:GoMetaLinter` +* Renaming identifiers with `:GoRename` +* Share your code to [play.golang.org](http://play.golang.org) with `:GoPlay` +* Switch between `*.go` and `*_test.go` code with `:GoAlternate` +* Add/Remove tags on struct fields with `:GoAddTags` +* Add import paths via `:GoImport` or remove them with `:GoDrop` +* Custom vim text objects such as `a function (af)` or `inner function (if)` +* ... and many more! Please see [doc/vim-go.txt](doc/vim-go.txt) for more information. -Checkout the official [tutorial](https://github.com/fatih/vim-go-tutorial) -that goes literally over all features and shows many tips and tricks. It shows -how to install vim-go and explains many unknown use cases. Recommended for -beginners as well as advanced users: https://github.com/fatih/vim-go-tutorial ## Install -Master branch is supposed to be a development branch. So stuff here can break -and change. Please try use always the [latest -release](https://github.com/fatih/vim-go/releases/latest) +Master branch is a **development** branch. Please use with caution. +I recommend to use the [**latest stable release**](https://github.com/fatih/vim-go/releases/latest) -Vim-go follows the standard runtime path structure, so I highly recommend to -use a common and well known plugin manager to install vim-go. Do not use vim-go -with other Go oriented vim plugins. For Pathogen just clone the repo. For other -plugin managers add the appropriate lines and execute the plugin's install -command. +Vim-go follows the standard runtime path structure. Below are some helper lines +for popular package managers: * [Pathogen](https://github.com/tpope/vim-pathogen) - * `git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go` + * `git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go` * [vim-plug](https://github.com/junegunn/vim-plug) - * `Plug 'fatih/vim-go'` -* [NeoBundle](https://github.com/Shougo/neobundle.vim) - * `NeoBundle 'fatih/vim-go'` -* [Vundle](https://github.com/gmarik/vundle) - * `Plugin 'fatih/vim-go'` -* [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages) (since Vim 7.4.1528) - * `git clone https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go` + * `Plug 'fatih/vim-go'` +* [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages) + * `git clone https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go` -Please be sure all necessary binaries are installed (such as `gocode`, `godef`, -`goimports`, etc.). You can easily install them with the included -`:GoInstallBinaries` command. If invoked, all necessary binaries will be -automatically downloaded and installed to your `$GOBIN` environment (if not set -it will use `$GOPATH/bin`). Note that this command requires `git` for fetching -the individual Go packages. Additionally, use `:GoUpdateBinaries` to update the -installed binaries. +After installing, please install all necessary binaries. We have a handy +command for it: -### Optional +``` +:GoInstallBinaries +``` -* Autocompletion is enabled by default via ``. To get real-time -completion (completion by type) install: -[neocomplete](https://github.com/Shougo/neocomplete.vim) for Vim or -[deoplete](https://github.com/Shougo/deoplete.nvim) and -[deoplete-go](https://github.com/zchee/deoplete-go) for NeoVim or -[SimpleAutoCmplPop](https://github.com/roxma/SimpleAutoComplPop) -* To display source code tag information on a sidebar install -[tagbar](https://github.com/majutsushi/tagbar). -* For snippet features install: -[neosnippet](https://github.com/Shougo/neosnippet.vim) or -[ultisnips](https://github.com/SirVer/ultisnips). -* Screenshot color scheme is a slightly modified molokai: - [fatih/molokai](https://github.com/fatih/molokai). -* For a better documentation viewer checkout: - [go-explorer](https://github.com/garyburd/go-explorer). +for more information please check out the [documentation](doc/vim-go.txt) ## Usage -Many of the plugin's [features](#features) are enabled by default. There are no -additional settings needed. All usages and commands are listed in -`doc/vim-go.txt`. Note that help tags needs to be populated. Check your plugin -manager settings to generate the documentation (some do it automatically). -After that just open the help page to see all commands: - - :help vim-go - -## Example Mappings - -vim-go has several `` mappings which can be used to create custom -mappings. Unless otherwise specified, none of these mappings are enabled -by default. Here some examples you might find useful: - -Run commands such as `go run` for the current file with `r` or `go -build` and `go test` for the current package with `b` and `t` -respectively. Display beautifully annotated source code to see which functions -are covered with `c`. - -```vim -au FileType go nmap r (go-run) -au FileType go nmap b (go-build) -au FileType go nmap t (go-test) -au FileType go nmap c (go-coverage) -``` - -By default the mapping `gd` is enabled, which opens the target identifier in -current buffer. You can also open the definition/declaration, in a new vertical, -horizontal, or tab, for the word under your cursor: - -```vim -au FileType go nmap ds (go-def-split) -au FileType go nmap dv (go-def-vertical) -au FileType go nmap dt (go-def-tab) -``` - -Open the relevant Godoc for the word under the cursor with `gd` or open -it vertically with `gv` - -```vim -au FileType go nmap gd (go-doc) -au FileType go nmap gv (go-doc-vertical) -``` - -Or open the Godoc in browser - -```vim -au FileType go nmap gb (go-doc-browser) -``` - -Show a list of interfaces which is implemented by the type under your cursor -with `s` - -```vim -au FileType go nmap s (go-implements) -``` - -Show type info for the word under your cursor with `i` (useful if you -have disabled auto showing type info via `g:go_auto_type_info`) - -```vim -au FileType go nmap i (go-info) -``` - -Rename the identifier under the cursor to a new name - -```vim -au FileType go nmap e (go-rename) -``` - -More `` mappings can be seen with `:he go-mappings`. Also these are just -recommendations, you are free to create more advanced mappings or functions -based on `:he go-commands`. - -## Settings -Below are some settings you might find useful. For the full list see `:he -go-settings`. - -By default syntax-highlighting for Functions, Methods and Structs is disabled. -To change it: -```vim -let g:go_highlight_functions = 1 -let g:go_highlight_methods = 1 -let g:go_highlight_fields = 1 -let g:go_highlight_types = 1 -let g:go_highlight_operators = 1 -let g:go_highlight_build_constraints = 1 -``` - -Enable goimports to automatically insert import paths instead of gofmt: - -```vim -let g:go_fmt_command = "goimports" -``` - -By default vim-go shows errors for the fmt command, to disable it: - -```vim -let g:go_fmt_fail_silently = 1 -``` - -Disable auto fmt on save: - -```vim -let g:go_fmt_autosave = 0 -``` - -Disable opening browser after posting your snippet to `play.golang.org`: - -```vim -let g:go_play_open_browser = 0 -``` - -By default when `:GoInstallBinaries` is called, the binaries are installed to -`$GOBIN` or `$GOPATH/bin`. To change it: - -```vim -let g:go_bin_path = expand("~/.gotools") -let g:go_bin_path = "/home/fatih/.mypath" "or give absolute path -``` - -Disable updating dependencies when installing/updating binaries: -```vim -let g:go_get_update = 0 -``` - -### Using with Neovim (beta) - -Note: Neovim currently is not a first class citizen for vim-go. You are free -to open bug, however I'm not using Neovim so it's hard for me to test it. -vim-go might not work well as good as in Vim. I'm happy to accept pull requests -or very detailed bug reports. If you're interested to improve the state of -Neovim in vim-go you're always welcome! - - -Run `:GoRun` in a new tab, horizontal split or vertical split terminal - -```vim -au FileType go nmap rt (go-run-tab) -au FileType go nmap rs (go-run-split) -au FileType go nmap rv (go-run-vertical) -``` - -By default new terminals are opened in a vertical split. To change it - -```vim -let g:go_term_mode = "split" -``` - -By default the testing commands run asynchronously in the background and -display results with `go#jobcontrol#Statusline()`. To make them run in a new -terminal - -```vim -let g:go_term_enabled = 1 -``` - -### Using with Syntastic -Sometimes when using both `vim-go` and `syntastic` Vim will start lagging while -saving and opening files. The following fixes this: - -```vim -let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck'] -let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] } -``` - -Another issue with `vim-go` and `syntastic` is that the location list window -that contains the output of commands such as `:GoBuild` and `:GoTest` might not appear. -To resolve this: - -```vim -let g:go_list_type = "quickfix" -``` - -## More info - -Check out the [Wiki](https://github.com/fatih/vim-go/wiki) page for more -information. It includes -[Screencasts](https://github.com/fatih/vim-go/wiki/Screencasts), an [FAQ -section](https://github.com/fatih/vim-go/wiki/FAQ-Troubleshooting), and many -other [various pieces](https://github.com/fatih/vim-go/wiki) of information. - -## Development & Testing - -vim-go supports now test files. Please check `autoload` folder for examples. If -you add a new feature be sure you also include the `_test.vim` file next to the -script. Test functions should be starting with `Test_`, example: - - -```viml -function Test_run_fmt() - call assert_equal(expected, actual) - ... -endfunction -``` - -You can locally test it by running: +Official documentation can be found under [doc/vim-go.txt](doc/vim-go.txt). You can display it from within Vim with: ``` -make +:help vim-go ``` - -This will run all tests and print either `PASS` or `FAIL` to indicate the final -status of all tests. - -Additionally, each new pull request will trigger a new Travis-ci job. - -## Donation - -People have asked for this for a long time, now you can be a fully supporter by -[being a patron](https://www.patreon.com/fatih)! - -By being a patron, you are enabling vim-go to grow and mature, helping me to -invest in bug fixes, new documentation, and improving both current and future -features. It's completely optional and is just a direct way to support Vim-go's -ongoing development. Thanks! - -[https://www.patreon.com/fatih](https://www.patreon.com/fatih) - -## Credits - -* Go Authors for official vim plugins -* Gocode, Godef, Golint, Guru, Goimports, Gotags, Errcheck projects and - authors of those projects. -* Other vim-plugins, thanks for inspiration (vim-golang, go.vim, vim-gocode, - vim-godef) -* [Contributors](https://github.com/fatih/vim-go/graphs/contributors) of vim-go +We also have an [official vim-go +tutorial](https://github.com/fatih/vim-go-tutorial). ## License -The BSD 3-Clause License - see `LICENSE` for more details +The BSD 3-Clause License - see [`LICENSE`](LICENSE) for more details diff --git a/sources_non_forked/vim-go/autoload/go/cmd.vim b/sources_non_forked/vim-go/autoload/go/cmd.vim index 3702d168..ec7d44cd 100644 --- a/sources_non_forked/vim-go/autoload/go/cmd.vim +++ b/sources_non_forked/vim-go/autoload/go/cmd.vim @@ -445,7 +445,7 @@ function s:cmd_job(args) abort let start_options = { \ 'callback': callbacks.callback, - \ 'close_cb': callbacks.close_cb, + \ 'exit_cb': callbacks.exit_cb, \ } " modify GOPATH if needed diff --git a/sources_non_forked/vim-go/autoload/go/coverage.vim b/sources_non_forked/vim-go/autoload/go/coverage.vim index 493d4205..fd2bb76e 100644 --- a/sources_non_forked/vim-go/autoload/go/coverage.vim +++ b/sources_non_forked/vim-go/autoload/go/coverage.vim @@ -288,7 +288,7 @@ function s:coverage_job(args) let start_options = { \ 'callback': callbacks.callback, - \ 'close_cb': callbacks.close_cb, + \ 'exit_cb': callbacks.exit_cb, \ } " modify GOPATH if needed diff --git a/sources_non_forked/vim-go/autoload/go/def.vim b/sources_non_forked/vim-go/autoload/go/def.vim index a3d5f84a..2f73ceee 100644 --- a/sources_non_forked/vim-go/autoload/go/def.vim +++ b/sources_non_forked/vim-go/autoload/go/def.vim @@ -303,7 +303,7 @@ function s:def_job(args) abort let start_options = { \ 'callback': callbacks.callback, - \ 'close_cb': callbacks.close_cb, + \ 'exit_cb': callbacks.exit_cb, \ } if &modified diff --git a/sources_non_forked/vim-go/autoload/go/guru.vim b/sources_non_forked/vim-go/autoload/go/guru.vim index 7edd6716..5cff49d8 100644 --- a/sources_non_forked/vim-go/autoload/go/guru.vim +++ b/sources_non_forked/vim-go/autoload/go/guru.vim @@ -155,21 +155,12 @@ function! s:async_guru(args) abort endif endif - function! s:close_cb(chan) closure - let messages = [] - while ch_status(a:chan, {'part': 'out'}) == 'buffered' - let msg = ch_read(a:chan, {'part': 'out'}) - call add(messages, msg) - endwhile - - while ch_status(a:chan, {'part': 'err'}) == 'buffered' - let msg = ch_read(a:chan, {'part': 'err'}) - call add(messages, msg) - endwhile - - let l:job = ch_getjob(a:chan) - let l:info = job_info(l:job) + let messages = [] + function! s:callback(chan, msg) closure + call add(messages, a:msg) + endfunction + function! s:exit_cb(job, exitval) closure let out = join(messages, "\n") let status = { @@ -178,21 +169,22 @@ function! s:async_guru(args) abort \ 'state': "finished", \ } - if l:info.exitval + if a:exitval let status.state = "failed" endif call go#statusline#Update(status_dir, status) if has_key(a:args, 'custom_parse') - call a:args.custom_parse(l:info.exitval, out) + call a:args.custom_parse(a:exitval, out) else - call s:parse_guru_output(l:info.exitval, out, a:args.mode) + call s:parse_guru_output(a:exitval, out, a:args.mode) endif endfunction let start_options = { - \ 'close_cb': funcref("s:close_cb"), + \ 'callback': funcref("s:callback"), + \ 'exit_cb': funcref("s:exit_cb"), \ } if has_key(result, 'stdin_content') diff --git a/sources_non_forked/vim-go/autoload/go/job.vim b/sources_non_forked/vim-go/autoload/go/job.vim index e60b2b45..6fb03af7 100644 --- a/sources_non_forked/vim-go/autoload/go/job.vim +++ b/sources_non_forked/vim-go/autoload/go/job.vim @@ -30,28 +30,17 @@ function go#job#Spawn(args) call add(self.messages, a:msg) endfunction - function cbs.close_cb(chan) dict - let l:job = ch_getjob(a:chan) - let l:status = job_status(l:job) - - " the job might be in fail status, we assume by default it's failed. - " However if it's dead, we can use the real exitval - let exitval = 1 - if l:status == "dead" - let l:info = job_info(l:job) - let exitval = l:info.exitval - endif - + function cbs.exit_cb(job, exitval) dict if has_key(self, 'custom_cb') - call self.custom_cb(l:job, exitval, self.messages) + call self.custom_cb(a:job, a:exitval, self.messages) endif if has_key(self, 'error_info_cb') - call self.error_info_cb(l:job, exitval, self.messages) + call self.error_info_cb(a:job, a:exitval, self.messages) endif if get(g:, 'go_echo_command_info', 1) - if exitval == 0 + if a:exitval == 0 call go#util#EchoSuccess("SUCCESS") else call go#util#EchoError("FAILED") @@ -59,7 +48,7 @@ function go#job#Spawn(args) endif let l:listtype = go#list#Type("quickfix") - if exitval == 0 + if a:exitval == 0 call go#list#Clean(l:listtype) call go#list#Window(l:listtype) return @@ -99,9 +88,9 @@ function go#job#Spawn(args) let cbs.callback = a:args.callback endif - " override close callback handler if user provided it - if has_key(a:args, 'close_cb') - let cbs.close_cb = a:args.close_cb + " override exit callback handler if user provided it + if has_key(a:args, 'exit_cb') + let cbs.exit_cb = a:args.exit_cb endif return cbs diff --git a/sources_non_forked/vim-go/autoload/go/lint.vim b/sources_non_forked/vim-go/autoload/go/lint.vim index 84d8ba45..cbc7b337 100644 --- a/sources_non_forked/vim-go/autoload/go/lint.vim +++ b/sources_non_forked/vim-go/autoload/go/lint.vim @@ -10,6 +10,10 @@ if !exists("g:go_metalinter_enabled") let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck'] endif +if !exists("g:go_metalinter_excludes") + let g:go_metalinter_excludes = [] +endif + if !exists("g:go_golint_bin") let g:go_golint_bin = "golint" endif @@ -40,6 +44,10 @@ function! go#lint#Gometa(autosave, ...) abort let cmd += ["--enable=".linter] endfor + for exclude in g:go_metalinter_excludes + let cmd += ["--exclude=".exclude] + endfor + " path let cmd += [expand('%:p:h')] else @@ -252,23 +260,14 @@ function s:lint_job(args) copen endfunction - function! s:close_cb(chan) closure - let l:job = ch_getjob(a:chan) - let l:status = job_status(l:job) - - let exitval = 1 - if l:status == "dead" - let l:info = job_info(l:job) - let exitval = l:info.exitval - endif - + function! s:exit_cb(job, exitval) closure let status = { \ 'desc': 'last status', \ 'type': "gometaliner", \ 'state': "finished", \ } - if exitval + if a:exitval let status.state = "failed" endif @@ -297,7 +296,7 @@ function s:lint_job(args) let start_options = { \ 'callback': funcref("s:callback"), - \ 'close_cb': funcref("s:close_cb"), + \ 'exit_cb': funcref("s:exit_cb"), \ } call job_start(a:args.cmd, start_options) diff --git a/sources_non_forked/vim-go/autoload/go/rename.vim b/sources_non_forked/vim-go/autoload/go/rename.vim index ac2f0181..3ca47d58 100644 --- a/sources_non_forked/vim-go/autoload/go/rename.vim +++ b/sources_non_forked/vim-go/autoload/go/rename.vim @@ -71,28 +71,25 @@ function s:rename_job(args) let status_dir = expand('%:p:h') - function! s:close_cb(chan) closure - let l:job = ch_getjob(a:chan) - let l:info = job_info(l:job) - + function! s:exit_cb(job, exitval) closure let status = { \ 'desc': 'last status', \ 'type': "gorename", \ 'state': "finished", \ } - if l:info.exitval + if a:exitval let status.state = "failed" endif call go#statusline#Update(status_dir, status) - call s:parse_errors(l:info.exitval, a:args.bang, messages) + call s:parse_errors(a:exitval, a:args.bang, messages) endfunction let start_options = { \ 'callback': funcref("s:callback"), - \ 'close_cb': funcref("s:close_cb"), + \ 'exit_cb': funcref("s:exit_cb"), \ } " modify GOPATH if needed diff --git a/sources_non_forked/vim-go/doc/vim-go.txt b/sources_non_forked/vim-go/doc/vim-go.txt index 2c3de9cc..857924d5 100644 --- a/sources_non_forked/vim-go/doc/vim-go.txt +++ b/sources_non_forked/vim-go/doc/vim-go.txt @@ -21,8 +21,10 @@ CONTENTS *go-contents* 5. Text Objects.................................|go-text-objects| 6. Functions....................................|go-functions| 7. Settings.....................................|go-settings| - 8. Troubleshooting..............................|go-troubleshooting| - 9. Credits......................................|go-credits| + 8. FAQ/Troubleshooting..........................|go-troubleshooting| + 9. Development..................................|go-development| + 10. Donation.....................................|go-donation| + 11. Credits......................................|go-credits| ============================================================================== INTRO *go-intro* @@ -100,7 +102,7 @@ command. Plugin 'fatih/vim-go' -* Vim |packages| (since Vim 7.4.1528) +* Vim |packages| > git clone https://github.com/fatih/vim-go.git \ ~/.vim/pack/plugins/start/vim-go @@ -1349,6 +1351,13 @@ Specifies the currently enabled linters for the |:GoMetaLinter| command. By default it's using `vet`, `golint` and `errcheck`. > let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck'] +< + *'g:go_metalinter_excludes'* + +Specifies the linters to be excluded from the |:GoMetaLinter| command. By +default it's empty +> + let g:go_metalinter_excludes = [] < *'g:go_metalinter_command'* @@ -1530,7 +1539,29 @@ default it's 60 seconds. Must be in milliseconds. let g:go_statusline_duration = 60000 < ============================================================================== -TROUBLESHOOTING *go-troubleshooting* +DEVELOPMENT *go-development* + +vim-go supports test files written in VimL. Please check `autoload` folder for +examples. If you add a new feature be sure you also include the `_test.vim` +file next to the script. Test functions should be starting with `Test_`, +example: +> + function Test_run_fmt() + call assert_equal(expected, actual) + ... + endfunction +< +You can locally test it by running: +> + make +< +This will run all tests and print either `PASS` or `FAIL` to indicate the final +status of all tests. Additionally, each new pull request will trigger a new +Travis-ci job. + + +============================================================================== +FAQ TROUBLESHOOTING *go-troubleshooting* I get "not an editor command" error when I invoke :GoXXX~ @@ -1568,15 +1599,63 @@ If you see errors like this: > Error installing golang.org/x/tools/cmd/goimports < -that means your local Go setup is broken or the remote website is down. For +that means your local Go setup is broken or the remote website is down. For example sometimes code.google.com times out. To test, just execute a simple `go get`: - +> go get golang.org/x/tools/cmd/goimports < You'll see a more detailed error. If this works, vim-go will work too. +How do I use vim-go with syntastic?~ + +Sometimes when using both `vim-go` and `syntastic` Vim will start lagging +while saving and opening files. The following fixes this: +> + let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck'] + let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] } +< +Another issue with `vim-go` and `syntastic` is that the location list window +that contains the output of commands such as `:GoBuild` and `:GoTest` might +not appear. To resolve this: +> + let g:go_list_type = "quickfix" +< + +Using with NeoVim~ + +Note: Neovim currently is not a first class citizen for vim-go. You are free +to open bug, however I'm not using Neovim so it's hard for me to test it. +vim-go might not work well as good as in Vim. I'm happy to accept pull requests +or very detailed bug reports. If you're interested to improve the state of +Neovim in vim-go you're always welcome! + +Run `:GoRun` in a new tab, horizontal split or vertical split terminal +> + au FileType go nmap rt (go-run-tab) + au FileType go nmap rs (go-run-split) + au FileType go nmap rv (go-run-vertical) +< +By default new terminals are opened in a vertical split. To change it +> + let g:go_term_mode = "split" +> + +============================================================================== +DONATION *go-donation* + +People have asked for this for a long time, now you can be a fully supporter +by being a patreon at: https://www.patreon.com/fatih + +By being a patron, you are enabling vim-go to grow and mature, helping me to +invest in bug fixes, new documentation, and improving both current and future +features. It's completely optional and is just a direct way to support Vim-go's +ongoing development. Thanks! + +Check it out: https://www.patreon.com/fatih + + ============================================================================== CREDITS *go-credits* diff --git a/sources_non_forked/vim-markdown/README.markdown b/sources_non_forked/vim-markdown/README.markdown index cd79315f..8c7c6d07 100644 --- a/sources_non_forked/vim-markdown/README.markdown +++ b/sources_non_forked/vim-markdown/README.markdown @@ -20,6 +20,14 @@ To disable markdown syntax concealing add the following to your vimrc: let g:markdown_syntax_conceal = 0 +Syntax highlight is synchronized in 50 lines. It may cause collapsed +highlighting at large fenced code block. +In the case, please set larger value in your vimrc: + + let g:markdown_minlines = 100 + +Note that setting too large value may cause bad performance on highlighting. + ## License Copyright © Tim Pope. Distributed under the same terms as Vim itself. diff --git a/sources_non_forked/vim-markdown/ftplugin/markdown.vim b/sources_non_forked/vim-markdown/ftplugin/markdown.vim index f406db58..2fbdf66d 100644 --- a/sources_non_forked/vim-markdown/ftplugin/markdown.vim +++ b/sources_non_forked/vim-markdown/ftplugin/markdown.vim @@ -41,10 +41,35 @@ function! MarkdownFold() return "=" endfunction +function! MarkdownFoldText() + let hash_indent = s:HashIndent(v:foldstart) + let title = substitute(getline(v:foldstart), '^#\+\s*', '', '') + let foldsize = (v:foldend - v:foldstart + 1) + let linecount = '['.foldsize.' lines]' + return hash_indent.' '.title.' '.linecount +endfunction + +function! s:HashIndent(lnum) + let hash_header = matchstr(getline(a:lnum), '^#\{1,6}') + if len(hash_header) > 0 + " hashtag header + return hash_header + else + " == or -- header + let nextline = getline(a:lnum + 1) + if nextline =~ '^=\+\s*$' + return repeat('#', 1) + elseif nextline =~ '^-\+\s*$' + return repeat('#', 2) + endif + endif +endfunction + if has("folding") && exists("g:markdown_folding") setlocal foldexpr=MarkdownFold() setlocal foldmethod=expr - let b:undo_ftplugin .= " foldexpr< foldmethod<" + setlocal foldtext=MarkdownFoldText() + let b:undo_ftplugin .= " foldexpr< foldmethod< foldtext<" endif " vim:set sw=2: diff --git a/sources_non_forked/vim-markdown/syntax/markdown.vim b/sources_non_forked/vim-markdown/syntax/markdown.vim index ad925cc2..35dd1a36 100644 --- a/sources_non_forked/vim-markdown/syntax/markdown.vim +++ b/sources_non_forked/vim-markdown/syntax/markdown.vim @@ -33,7 +33,10 @@ endfor unlet! s:type unlet! s:done_include -syn sync minlines=10 +if !exists('g:markdown_minlines') + let g:markdown_minlines = 50 +endif +execute 'syn sync minlines=' . g:markdown_minlines syn case ignore syn match markdownValid '[<>]\c[a-z/$!]\@!' diff --git a/sources_non_forked/vim-multiple-cursors/README.md b/sources_non_forked/vim-multiple-cursors/README.md index 26cb6d02..9b3877ca 100644 --- a/sources_non_forked/vim-multiple-cursors/README.md +++ b/sources_non_forked/vim-multiple-cursors/README.md @@ -188,6 +188,9 @@ endfunction With this locking and unlocking we prevent neocomplete to trigger it's function calls until we are finished with multiple cursors editing. +Plugins themselves can register `User` autocommands on `MultipleCursorsPre` and +`MultipleCursorsPost` for automatic integration. + ### Highlight The plugin uses the highlight group `multiple_cursors_cursor` and `multiple_cursors_visual` to highlight the virtual cursors and their visual selections respectively. You can customize them by putting something similar like the following in your vimrc: 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 0df3e8ae..1e7a5f50 100644 --- a/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim +++ b/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim @@ -111,8 +111,11 @@ endfunction " attempted to be created at the next occurrence of the visual selection function! multiple_cursors#new(mode, word_boundary) " Call before function if exists only once until it is canceled () - if exists('*Multiple_cursors_before') && !s:before_function_called - exe "call Multiple_cursors_before()" + if !s:before_function_called + doautocmd User MultipleCursorsPre + if exists('*Multiple_cursors_before') + exe "call Multiple_cursors_before()" + endif let s:before_function_called = 1 endif let s:use_word_boundary = a:word_boundary @@ -436,8 +439,11 @@ function! s:CursorManager.reset(restore_view, restore_setting, ...) dict call self.restore_user_settings() endif " Call after function if exists and only if action is canceled () - if exists('*Multiple_cursors_after') && a:0 && s:before_function_called - exe "call Multiple_cursors_after()" + if a:0 && s:before_function_called + if exists('*Multiple_cursors_after') + exe "call Multiple_cursors_after()" + endif + doautocmd User MultipleCursorsPost let s:before_function_called = 0 endif endfunction diff --git a/sources_non_forked/vim-pug/syntax/pug.vim b/sources_non_forked/vim-pug/syntax/pug.vim index 0fb146d8..7b0f1c37 100644 --- a/sources_non_forked/vim-pug/syntax/pug.vim +++ b/sources_non_forked/vim-pug/syntax/pug.vim @@ -37,7 +37,9 @@ syn match pugComment '\(\s\+\|^\)\/\/.*$' contains=pugCommentTodo,@Spell syn region pugCommentBlock start="\z(\s\+\|^\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" contains=pugCommentTodo,@Spell keepend syn region pugHtmlConditionalComment start="" contains=pugCommentTodo,@Spell syn region pugAngular2 start="(" end=")" contains=htmlEvent -syn region pugAttributes matchgroup=pugAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,pugHtmlArg,pugAngular2,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@pugComponent +syn region pugJavascriptString start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contained +syn region pugJavascriptString start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contained +syn region pugAttributes matchgroup=pugAttributesDelimiter start="(" end=")" contained contains=pugJavascriptString,pugHtmlArg,pugAngular2,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@pugComponent syn match pugClassChar "\." containedin=htmlTagName nextgroup=pugClass syn match pugBlockExpansionChar ":\s\+" contained nextgroup=pugTag,pugClassChar,pugIdChar syn match pugIdChar "#[[{]\@!" contained nextgroup=pugId @@ -99,6 +101,7 @@ hi def link pugCommentTodo Todo hi def link pugComment Comment hi def link pugCommentBlock Comment hi def link pugHtmlConditionalComment pugComment +hi def link pugJavascriptString String let b:current_syntax = "pug" diff --git a/sources_non_forked/vim-repeat/autoload/repeat.vim b/sources_non_forked/vim-repeat/autoload/repeat.vim index f2caeb4a..fde6a38e 100644 --- a/sources_non_forked/vim-repeat/autoload/repeat.vim +++ b/sources_non_forked/vim-repeat/autoload/repeat.vim @@ -40,7 +40,7 @@ " in your mapping will look like this: " " nnoremap MyMap -" \ :execute 'silent! call repeat#setreg("\Plug>MyMap", v:register)' +" \ :silent! call repeat#setreg("\Plug>MyMap", v:register) " \ call MyFunction(v:register, ...) " \ silent! call repeat#set("\Plug>MyMap") diff --git a/sources_non_forked/vim-snipmate/README.md b/sources_non_forked/vim-snipmate/README.md index b47b56df..f025dce5 100644 --- a/sources_non_forked/vim-snipmate/README.md +++ b/sources_non_forked/vim-snipmate/README.md @@ -96,6 +96,20 @@ will load the `ruby-rails` scope whenever the `ruby` scope is active. The buffer. The [vim-rails](https://github.com/tpope/vim-rails) plugin automatically does `:SnipMateLoadScope rails` when editing a Rails project for example. +> What are the snippet parser versions and what's the difference between them? + +Originally SnipMate used regex to parse a snippet. Determining where stops were, +what the placeholders were, where mirrors were, etc. were all done with regex. +Needless to say this was a little fragile. When the time came for a rewritten +parser, some incompatibilities were a little necessary. Rather than break +everyone's snippets everywhere, we provided both the new (version 1) and the old +(version 0) and let the user choose between them. + +Version 0 is considered legacy and not a lot of effort is going to go into +improving or even maintaining it. Version 1 is the future, and one can expect +new features to only exist for version 1 users. A full list of differences can +be found in the docs at `:h SnipMate-parser-versions`. + ## Release Notes ## ### 0.89 - 2016-05-29 ### diff --git a/sources_non_forked/vim-snipmate/doc/snipMate.txt b/sources_non_forked/vim-snipmate/doc/snipMate.txt index c97205a6..d00e6b20 100644 --- a/sources_non_forked/vim-snipmate/doc/snipMate.txt +++ b/sources_non_forked/vim-snipmate/doc/snipMate.txt @@ -148,7 +148,8 @@ g:snipMate.snippet_version 1 Use the newer parser If unset, SnipMate defaults to version 0. The value of this option is also used for all - .snippet files. + .snippet files. See |SnipMate-parser-versions| + for more information. g:snipMate.override As detailed below, when two snippets with the @@ -265,14 +266,18 @@ Note: Hard tabs in the expansion text are required. When the snippet is expanded in the text and 'expandtab' is set, each tab will be replaced with spaces based on 'softtabstop' if nonzero or 'shiftwidth' otherwise. -Which version parser the snippets in a file should be used with can be -specified with a version line, e.g.: > + +SnipMate currently provides two versions for the snippet parser. The +differences between them can be found at |SnipMate-parser-versions|. Which +version parser the snippets in a file should be used with can be specified +with a version line, e.g.: > version 1 Specification of a version applies to the snippets following it. Multiple version specifications can appear in a single file to intermix version 0 and -version 1 snippets. +version 1 snippets. The default is determined by the +g:snipMate.snippet_version option. |SnipMate-options| Comments can be made in .snippets files by starting a line with a # character. However these can't be used inside of snippet definitions: > @@ -286,7 +291,7 @@ However these can't be used inside of snippet definitions: > This should hopefully be clear with the included syntax highlighting. - *snipMate-extends* + *SnipMate-extends* Borrowing from UltiSnips, .snippets files can also contain an extends directive, for example: > @@ -296,6 +301,11 @@ will tell SnipMate to also read html, javascript, and css snippets. SNIPPET SYNTAX *snippet-syntax* *SnipMate-syntax* +As mentioned above, there are two versions of the snippet parser. They are +selected by the g:snipMate.snippet_version option (|SnipMate-options|) or the +version directive in .snippets files. Differences will be mentioned throughout +with a summary at |SnipMate-parser-versions|. + Anywhere in a snippet, a backslash escapes the character following it, regardless of whether that character is special or not. That is, '\a' will always result in an 'a' in the output. A single backslash can be output by @@ -366,13 +376,15 @@ edited. These look like a tab stop without a placeholder; $1 for example. In the event that no placeholder is specified for a certain tab stop--say $1--the first instance becomes the tab stop and the rest become mirrors. -Additionally substitutions similar to |:substitute| can be performed. For -instance ${1/foo/bar/g} will replace all instances of "foo" in the $1 mirror -with "bar". This uses |substitute()| behind the scenes. +Additionally, in version 1 of the parser, substitutions similar to +|:substitute| can be performed. For instance ${1/foo/bar/g} will replace all +instances of "foo" in the $1 mirror with "bar". This uses |substitute()| +behind the scenes. Note: Just like with tab stops, braces can be used to avoid ambiguities: ${1}2 is a mirror of the first tab stop followed by a 2. Version 0 of the snippet -parser offers no way to resolve such ambiguities. +parser offers no way to resolve such ambiguities. Version 0 also requires that +a tabstop have a placeholder before its mirrors work. As an example, > @@ -436,6 +448,39 @@ Example: >
${0:${VISUAL:}}
+< + *SnipMate-parser-versions* +Parser Versions~ + +SnipMate provides two versions for its snippet parser. Version 0 is the legacy +regex based version and is updated sparingly. Version 1 is the revamped +version with new features. Any newly developed features will likely only be +available to version 1 users. + +Which version is used is determined by version directives in snippet files +(|SnipMate-snippet-files|) and by the g:snipMate.snippet_version option +(|SnipMate-options|). + +A complete list of current differences is as follows: +- Backslash escaping is guaranteed to work in version 1. In certain edge cases + this may not work in version 0. +- Certain syntactic errors, such as a missing closing brace for a tabstop, are + more gracefully handled in version 1. In most cases, the parser will either + discard the error or, as in the previous example, end an item at the end of + line. Version 0 may not be predictable in this regard. +- Braces are not mandatory in version 1. SnipMate will determine which + instance of a stop ID to use based on the presence of a placeholder, or + whichever instance occurs first. Braces can therefore be used to + disambiguate between stop 12, $12, and stop 1 followed by a 2, ${1}2. In + other words, version 0 makes a distinction between a mirror and a stop while + version 1 resolves the differences for you. +- Placeholders are not mandatory to enable mirror support in version 1. +- Version 0 uses the confusing syntax {VISUAL} to refer to visual content. + Version 1 treats it as just another stop ID, so both $VISUAL and ${VISUAL} + work. Plus version 1 allows a default value in case no visual selection has + been made. +- Transformations similar to |:substitute| can be preformed on any mirror, + including visual content. ============================================================================== SNIPPET SOURCES *SnipMate-snippet-sources* diff --git a/sources_non_forked/vim-snippets/UltiSnips/rust.snippets b/sources_non_forked/vim-snippets/UltiSnips/rust.snippets index 482f78e4..24af1b37 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/rust.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/rust.snippets @@ -4,25 +4,6 @@ priority -50 -snippet let "let variable declaration" b -let ${1:name}${2:: ${3:type}} = $4; -endsnippet - -snippet letm "let mut variable declaration" b -let mut ${1:name}${2:: ${3:type}} = $4; -endsnippet - -snippet fn "A function, optionally with arguments and return type." -fn ${1:function_name}($2)${3/..*/ -> /}$3 { - ${VISUAL}$0 -} -endsnippet - -snippet pfn "A public function, optionally with arguments and return type." -pub fn ${1:function_name}($2)${3/..*/ -> /}$3 { - ${VISUAL}$0 -} -endsnippet snippet arg "Function Arguments" i ${1:a}: ${2:T}${3:, arg} @@ -38,18 +19,6 @@ ${1:move }|$2| { } endsnippet -snippet pri "print!(..)" b -print!("$1"${2/..*/, /}$2); -endsnippet - -snippet pln "println!(..)" b -println!("$1"${2/..*/, /}$2); -endsnippet - -snippet fmt "format!(..)" -format!("$1"${2/..*/, /}$2); -endsnippet - snippet macro "macro_rules!" b macro_rules! ${1:name} { (${2:matcher}) => ( @@ -58,49 +27,8 @@ macro_rules! ${1:name} { } endsnippet -snippet mod "A module" b -mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} { - ${VISUAL}$0 -} -endsnippet - -snippet for "for .. in .." b -for ${1:i} in $2 { - ${VISUAL}$0 -} -endsnippet - -snippet todo "A Todo comment" -// [TODO]: ${1:Description} - `!v strftime("%Y-%m-%d %I:%M%P")` -endsnippet - -snippet st "Struct" b -struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} { - ${VISUAL}$0 -} -endsnippet - -# TODO: fancy dynamic field mirroring like Python slotclass -snippet stn "Struct with new constructor." b -pub struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} { - fd$0 -} - -impl $1 { - pub fn new($2) -> $1 { - $1 { $3 } - } -} -endsnippet - snippet fd "Struct field definition" w ${1:name}: ${2:Type}, endsnippet -snippet impl "Struct/Trait implementation" b -impl ${1:Type/Trait}${2: for ${3:Type}} { - $0 -} -endsnippet - # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/tex.snippets b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets index 9957b3f7..5a67abbc 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/tex.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets @@ -78,6 +78,14 @@ snippet sec "Section" b $0 endsnippet +snippet sec* "Section" b +\section*{${1:section name}} +\label{sec:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} + +${0} +endsnippet + + snippet sub "Subsection" b \subsection{${1:subsection name}} \label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} @@ -85,6 +93,13 @@ snippet sub "Subsection" b $0 endsnippet +snippet sub* "Subsection" b +\subsection*{${1:subsection name}} +\label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} + +${0} +endsnippet + snippet ssub "Subsubsection" b \subsubsection{${1:subsubsection name}} \label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} @@ -92,6 +107,13 @@ snippet ssub "Subsubsection" b $0 endsnippet +snippet ssub* "Subsubsection" b +\subsubsection*{${1:subsubsection name}} +\label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} + +${0} +endsnippet + snippet par "Paragraph" b \paragraph{${1:paragraph name}} \label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} @@ -112,7 +134,7 @@ $0 endsnippet snippet pac "Package" b -\usepackage[${1:options}]{${2:package}}$0 +\usepackage`!p snip.rv='[' if t[1] else ""`${1:options}`!p snip.rv = ']' if t[1] else ""`{${2:package}}$0 endsnippet snippet lp "Long parenthesis" diff --git a/sources_non_forked/vim-snippets/snippets/cs.snippets b/sources_non_forked/vim-snippets/snippets/cs.snippets index decf79af..110c85f4 100644 --- a/sources_non_forked/vim-snippets/snippets/cs.snippets +++ b/sources_non_forked/vim-snippets/snippets/cs.snippets @@ -58,28 +58,34 @@ # # Main snippet sim - ${1:public }static int Main(string[] args) { + ${1:public} static int Main(string[] args) + { ${0} return 0; } snippet simc - public class Application { - ${1:public }static int Main(string[] args) { + public class Application + { + ${1:public} static int Main(string[] args) + { ${0} return 0; } } snippet svm - ${1:public }static void Main(string[] args) { + ${1:public} static void Main(string[] args) + { ${0} } # if condition snippet if - if (${1:true}) { + if (${1:true}) + { ${0:${VISUAL}} } snippet el - else { + else + { ${0:${VISUAL}} } snippet ifs @@ -92,81 +98,99 @@ snippet ? ${1} ? ${2} : ${0} # do while loop snippet do - do { + do + { ${0:${VISUAL}} } while (${1:true}); # while loop snippet wh - while (${1:true}) { + while (${1:true}) + { ${0:${VISUAL}} } # for loop snippet for - for (int ${1:i} = 0; $1 < ${2:count}; $1${3:++}) { + for (int ${1:i} = 0; $1 < ${2:count}; $1${3:++}) + { ${0} } snippet forr - for (int ${1:i} = ${2:length}; $1 >= 0; $1--) { + for (int ${1:i} = ${2:length}; $1 >= 0; $1--) + { ${0} } # foreach snippet fore - foreach (${1:var} ${2:entry} in ${3}) { + foreach (${1:var} ${2:entry} in ${3}) + { ${0} } snippet foreach - foreach (${1:var} ${2:entry} in ${3}) { + foreach (${1:var} ${2:entry} in ${3}) + { ${0} } snippet each - foreach (${1:var} ${2:entry} in ${3}) { + foreach (${1:var} ${2:entry} in ${3}) + { ${0} } # interfaces snippet interface - public interface ${1:`vim_snippets#Filename()`} { + public interface ${1:`vim_snippets#Filename()`} + { ${0} } snippet if+ - public interface ${1:`vim_snippets#Filename()`} { + public interface ${1:`vim_snippets#Filename()`} + { ${0} } # class bodies snippet class - public class ${1:`vim_snippets#Filename()`} { + public class ${1:`vim_snippets#Filename()`} + { ${0} } snippet cls - ${2:public} class ${1:`vim_snippets#Filename()`} { + ${2:public} class ${1:`vim_snippets#Filename()`} + { ${0} } snippet cls+ - public class ${1:`vim_snippets#Filename()`} { + public class ${1:`vim_snippets#Filename()`} + { ${0} } snippet cls+^ - public static class ${1:`vim_snippets#Filename()`} { + public static class ${1:`vim_snippets#Filename()`} + { ${0} } snippet cls& - internal class ${1:`vim_snippets#Filename()`} { + internal class ${1:`vim_snippets#Filename()`} + { ${0} } snippet cls&^ - internal static class ${1:`vim_snippets#Filename()`} { + internal static class ${1:`vim_snippets#Filename()`} + { ${0} } snippet cls| - protected class ${1:`vim_snippets#Filename()`} { + protected class ${1:`vim_snippets#Filename()`} + { ${0} } snippet cls|% - protected abstract class ${1:`vim_snippets#Filename()`} { + protected abstract class ${1:`vim_snippets#Filename()`} + { ${0} } # constructor snippet ctor - public ${1:`vim_snippets#Filename()`}() { + public ${1:`vim_snippets#Filename()`}() + { ${0} } # properties - auto properties by default. @@ -266,101 +290,124 @@ snippet ps- private string ${1} { get; set; } # members - void snippet m - ${1:public} ${2:void} ${3}(${4}) { + ${1:public} ${2:void} ${3}(${4}) + { ${0} } snippet m+ - public ${1:void} ${2}(${3}) { + public ${1:void} ${2}(${3}) + { ${0} } snippet m& - internal ${1:void} ${2}(${3}) { + internal ${1:void} ${2}(${3}) + { ${0} } snippet m| - protected ${1:void} ${2}(${3}) { + protected ${1:void} ${2}(${3}) + { ${0} } snippet m- - private ${1:void} ${2}(${3}) { + private ${1:void} ${2}(${3}) + { ${0} } # members - int snippet mi - ${1:public} int ${2}(${3}) { + ${1:public} int ${2}(${3}) + { ${0:return 0;} } snippet mi+ - public int ${1}(${2}) { + public int ${1}(${2}) + { ${0:return 0;} } snippet mi& - internal int ${1}(${2}) { + internal int ${1}(${2}) + { ${0:return 0;} } snippet mi| - protected int ${1}(${2}) { + protected int ${1}(${2}) + { ${0:return 0;} } snippet mi- - private int ${1}(${2}) { + private int ${1}(${2}) + { ${0:return 0;} } # members - bool snippet mb - ${1:public} bool ${2}(${3}) { + ${1:public} bool ${2}(${3}) + { ${0:return false;} } snippet mb+ - public bool ${1}(${2}) { + public bool ${1}(${2}) + { ${0:return false;} } snippet mb& - internal bool ${1}(${2}) { + internal bool ${1}(${2}) + { ${0:return false;} } snippet mb| - protected bool ${1}(${2}) { + protected bool ${1}(${2}) + { ${0:return false;} } snippet mb- - private bool ${1}(${2}) { + private bool ${1}(${2}) + { ${0:return false;} } # members - string snippet ms - ${1:public} string ${2}(${3}) { + ${1:public} string ${2}(${3}) + { ${0:return "";} } snippet ms+ - public string ${1}(${2}) { + public string ${1}(${2}) + { ${0:return "";} } snippet ms& - internal string ${1}(${2}) { + internal string ${1}(${2}) + { ${0:return "";} } snippet ms| - protected string ${1:}(${2:}) { + protected string ${1:}(${2:}) + { ${0:return "";} } snippet ms- - private string ${1}(${2}) { + private string ${1}(${2}) + { ${0:return "";} } # structure snippet struct - public struct ${1:`vim_snippets#Filename()`} { + public struct ${1:`vim_snippets#Filename()`} + { ${0} } # enumeration snippet enum - enum ${1} { + enum ${1} + { ${0} } snippet enum+ - public enum ${1} { + public enum ${1} + { ${0} } # preprocessor directives @@ -391,8 +438,10 @@ snippet cw # equals override snippet eq - public override bool Equals(object obj) { - if (obj == null || GetType() != obj.GetType()) { + public override bool Equals(object obj) + { + if (obj == null || GetType() != obj.GetType()) + { return false; } ${0:throw new NotImplementedException();} @@ -400,7 +449,8 @@ snippet eq } # exception snippet exc - public class ${1:MyException} : ${2:Exception} { + public class ${1:MyException} : ${2:Exception} + { public $1() { } public $1(string message) : base(message) { } public $1(string message, Exception inner) : base(message, inner) { } @@ -411,24 +461,28 @@ snippet exc } # indexer snippet index - public ${1:object} this[${2:int} index] { + public ${1:object} this[${2:int} index] + { get { ${0} } set { ${0} } } # eventhandler snippet inv EventHandler temp = ${1:MyEvent}; - if (${2:temp} != null) { + if (${2:temp} != null) + { $2(); } # lock snippet lock - lock (${1:this}) { + lock (${1:this}) + { ${0} } # namespace snippet namespace - namespace ${1:MyNamespace} { + namespace ${1:MyNamespace} + { ${0} } # property @@ -436,35 +490,42 @@ snippet prop public ${1:int} ${2:MyProperty} { get; set; } snippet propf private ${1:int} ${2:myVar}; - public $1 ${3:MyProperty} { - get { return $2; } - set { $2 = value; } - } + public $1 ${3:MyProperty} + { + get { return $2; } + set { $2 = value; } + } snippet propg public ${1:int} ${2:MyProperty} { get; private set; } # switch snippet switch - switch (${1:switch_on}) { + switch (${1:switch_on}) + { ${0} default: } # try snippet try - try { - ${0:${VISUAL}} - } - catch (${1:System.Exception}) { - throw; - } -snippet tryf - try { + try + { ${0:${VISUAL}} } - finally { + catch (${1:System.Exception}) + { + throw; + } +snippet tryf + try + { + ${0:${VISUAL}} + } + finally + { ${1} } # using snippet usi - using(${1:resource}) { + using (${1:resource}) + { ${0} } diff --git a/sources_non_forked/vim-snippets/snippets/elixir.snippets b/sources_non_forked/vim-snippets/snippets/elixir.snippets index ccc5fb73..963470e9 100644 --- a/sources_non_forked/vim-snippets/snippets/elixir.snippets +++ b/sources_non_forked/vim-snippets/snippets/elixir.snippets @@ -2,6 +2,12 @@ snippet do do ${0:${VISUAL}} end +snippet put IO.puts + IO.puts "${0}" +snippet ins IO.inspect + IO.inspect ${0} +snippet insl IO.inspect with label + IO.inspect(${0}label: "${1:label}") snippet if if .. do .. end if ${1} do ${0:${VISUAL}} @@ -44,14 +50,14 @@ snippet for for ${1:item} <- ${2:items} do ${0} end +snippet for: + for ${1:item} <- ${2:items}, do: ${0} snippet fori for ${1:item} <- ${2:items}, into: ${3} do ${0} end snippet wi - with( - ${1:item} <- ${2:items} - ) do + with ${1:item} <- ${2:items} do ${0} end snippet wie @@ -63,6 +69,16 @@ snippet wie ${4} -> ${0} end +snippet sp + @spec ${1:name}(${2:args}) :: ${3:returns} +snippet op + @opaque ${1:type_name} :: ${2:type} +snippet ty + @type ${1:type_name} :: ${2:type} +snippet typ + @typep ${1:type_name} :: ${2:type} +snippet cb + @callback ${1:name}(${2:args}) :: ${3:returns} snippet df def ${1:name}, do: ${2} snippet def @@ -157,3 +173,15 @@ snippet qu snippet beh @behaviour ${1:Mix.Task} ${0} +snippet >e pipe to each + |> Enum.each(fn ${1} -> ${0} end) +snippet >m pipe to map + |> Enum.map(fn ${1} -> ${0} end) +snippet >f pipe to filter + |> Enum.filter(fn ${1} -> ${0} end) +snippet >r pipe to reduce + |> Enum.reduce(${1:acc}, fn ${2}, ${3:acc} -> ${0} end) +snippet >i pipe to inspect + |> IO.inspect +snippet >il pipe to inspect with label + |> IO.inspect(label: "${1:label}") diff --git a/sources_non_forked/vim-snippets/snippets/elm.snippets b/sources_non_forked/vim-snippets/snippets/elm.snippets index 7898d5f3..7a4e3ef5 100644 --- a/sources_non_forked/vim-snippets/snippets/elm.snippets +++ b/sources_non_forked/vim-snippets/snippets/elm.snippets @@ -34,7 +34,8 @@ snippet - ${0} snippet let let - ${1} = ${2} + ${1} = + ${2} in ${0} snippet if diff --git a/sources_non_forked/vim-snippets/snippets/fortran.snippets b/sources_non_forked/vim-snippets/snippets/fortran.snippets index e61d3fb5..e04d4fda 100644 --- a/sources_non_forked/vim-snippets/snippets/fortran.snippets +++ b/sources_non_forked/vim-snippets/snippets/fortran.snippets @@ -91,6 +91,8 @@ snippet func end function $1 snippet pr write(*,*) $0 +snippet dpr + write(*,*) '$1 = ', $1 snippet read read(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) $0 snippet write diff --git a/sources_non_forked/vim-snippets/snippets/idris.snippets b/sources_non_forked/vim-snippets/snippets/idris.snippets new file mode 100644 index 00000000..abbedb62 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/idris.snippets @@ -0,0 +1,46 @@ +snippet mod + module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` + ${0} +snippet imp + import ${0:List} +snippet fn + ${1:fn} : ${2:a} -> ${3:a} + $1 ${4} = + ${0} +snippet fn1 + ${1:fn} : ${2:a} -> ${3:a} + $1 ${4} = + ${0} +snippet fn2 + ${1:fn} : ${2:a} -> ${3:a} -> ${4:a} + $1 ${5} = + ${0} +snippet fn3 + ${1:fn} : ${2:a} -> ${3:a} -> ${4:a} -> ${5:a} + $1 ${6} = + ${0} +snippet fn0 + ${1:fn} : ${2:a} + $1 = + ${0} +snippet case + case ${1} of + ${2} => + ${0} +snippet let + let + ${1} = + ${2} + in + ${0} +snippet wh + where + ${0} +snippet if + if ${1} then + ${2:${VISUAL}} + else + ${0} + ${0} +snippet \ "Lambda function (\x => ...)" + (\\${1:_} => ${0}) diff --git a/sources_non_forked/vim-snippets/snippets/purescript.snippets b/sources_non_forked/vim-snippets/snippets/purescript.snippets index 06d6b34a..cdbcbd2c 100644 --- a/sources_non_forked/vim-snippets/snippets/purescript.snippets +++ b/sources_non_forked/vim-snippets/snippets/purescript.snippets @@ -3,9 +3,9 @@ snippet mod ( ) where - import Prelude + import Prelude - ${0} + ${0} snippet imp import ${0:Data.List} snippet impq @@ -50,3 +50,8 @@ snippet testunit Assert.equal "Hello, world!" "Hello, sailor!" +snippet if + if ${1} then + ${2:${VISUAL}} + else + ${0} diff --git a/sources_non_forked/vim-snippets/snippets/python.snippets b/sources_non_forked/vim-snippets/snippets/python.snippets index b32ef0a8..faa716eb 100644 --- a/sources_non_forked/vim-snippets/snippets/python.snippets +++ b/sources_non_forked/vim-snippets/snippets/python.snippets @@ -150,6 +150,10 @@ snippet pdbbb snippet rpdb import rpdb rpdb.set_trace() +# web python debugger (wdb) +snippet wdb + import wdb + wdb.set_trace() # ptpython snippet ptpython from ptpython.repl import embed diff --git a/sources_non_forked/vim-snippets/snippets/ruby.snippets b/sources_non_forked/vim-snippets/snippets/ruby.snippets index 340391eb..3f909a0c 100644 --- a/sources_non_forked/vim-snippets/snippets/ruby.snippets +++ b/sources_non_forked/vim-snippets/snippets/ruby.snippets @@ -703,9 +703,9 @@ snippet is snippet isn it { should_not ${0} } snippet iexp - it { expect(${1:object}).${1} ${0} } + it { expect(${1:object}).${2} ${0} } snippet iexpb - it { expect { ${1:object} }.${1} ${0} } + it { expect { ${1:object} }.${2} ${0} } snippet iiexp it { is_expected.to ${0} } snippet iiexpn diff --git a/sources_non_forked/vim-snippets/snippets/rust.snippets b/sources_non_forked/vim-snippets/snippets/rust.snippets index 25effe6e..51f10055 100644 --- a/sources_non_forked/vim-snippets/snippets/rust.snippets +++ b/sources_non_forked/vim-snippets/snippets/rust.snippets @@ -39,10 +39,17 @@ snippet letm "let mut variable declaration with type inference" let mut ${1} = ${2}; snippet lettm "let mut variable declaration with explicit type annotation" let mut ${1}: ${2} = ${3}; +snippet pri "print!" + print!("${1}"); +snippet pri, "print! with format param" + print!("${1}", ${2}); snippet pln "println!" println!("${1}"); snippet pln, "println! with format param" println!("${1}", ${2}); +snippet fmt "format!" + format!("${1}", ${2}); + # Modules snippet ec "extern crate" extern crate ${1:sync}; diff --git a/sources_non_forked/vim-snippets/snippets/tex.snippets b/sources_non_forked/vim-snippets/snippets/tex.snippets index c095b5a4..2808cf71 100644 --- a/sources_non_forked/vim-snippets/snippets/tex.snippets +++ b/sources_non_forked/vim-snippets/snippets/tex.snippets @@ -149,12 +149,12 @@ snippet sub* \subsection* \\label{sub:${2:$1}} ${0} # Sub Sub Section -snippet subs \subsubsection +snippet ssub \subsubsection \\subsubsection{${1:subsubsection name}} \\label{ssub:${2:$1}} ${0} # Sub Sub Section without number -snippet subs* \subsubsection* +snippet ssub* \subsubsection* \\subsubsection*{${1:subsubsection name}} \\label{ssub:${2:$1}} ${0} From 0a8ca3c28bffe1743014eb093133d075b97a175f Mon Sep 17 00:00:00 2001 From: Nicolas Djambazian Date: Sat, 20 May 2017 11:33:48 +0200 Subject: [PATCH 26/74] Allow to install custom plugins --- .gitignore | 1 + my_plugins/.gitkeep | 0 vimrcs/plugins_config.vim | 1 + 3 files changed, 2 insertions(+) create mode 100644 my_plugins/.gitkeep diff --git a/.gitignore b/.gitignore index 56dee29f..55273366 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ temp_dirs/yankring_history_v2.txt sources_forked/yankring/doc/tags sources_non_forked/tlib/doc/tags sources_non_forked/ctrlp.vim/doc/tags* +my_plugins/ my_configs.vim tags .DS_Store diff --git a/my_plugins/.gitkeep b/my_plugins/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/vimrcs/plugins_config.vim b/vimrcs/plugins_config.vim index e67e5a07..05be1e6d 100644 --- a/vimrcs/plugins_config.vim +++ b/vimrcs/plugins_config.vim @@ -11,6 +11,7 @@ let s:vim_runtime = expand(':p:h')."/.." call pathogen#infect(s:vim_runtime.'/sources_forked/{}') call pathogen#infect(s:vim_runtime.'/sources_non_forked/{}') +call pathogen#infect(s:vim_runtime.'/my_plugins/{}') call pathogen#helptags() """""""""""""""""""""""""""""" From 48a2c325c30a079ada3719a7876b97546d0e58ad Mon Sep 17 00:00:00 2001 From: amix Date: Fri, 26 May 2017 11:30:32 +0200 Subject: [PATCH 27/74] Updated plugins and added vim-abolish --- sources_non_forked/ack.vim/README.md | 24 +- sources_non_forked/ctrlp.vim/plugin/ctrlp.vim | 4 +- .../nerdtree/autoload/nerdtree.vim | 4 +- sources_non_forked/nerdtree/doc/NERD_tree.txt | 2 +- .../nerdtree/lib/nerdtree/path.vim | 2 +- .../syntastic/doc/syntastic-checkers.txt | 33 + .../syntastic/plugin/syntastic.vim | 2 +- .../syntastic/syntax_checkers/go/gotype.vim | 18 +- .../syntastic/syntax_checkers/php/phpstan.vim | 49 ++ sources_non_forked/vim-abolish/.gitignore | 1 + .../vim-abolish/CONTRIBUTING.markdown | 1 + .../vim-abolish/README.markdown | 150 +++++ .../vim-abolish/doc/abolish.txt | 181 +++++ .../vim-abolish/plugin/abolish.vim | 631 ++++++++++++++++++ .../vim-bundle-mako/indent/mako.vim | 5 +- .../vim-fugitive/plugin/fugitive.vim | 45 +- .../vim-go/.github/CONTRIBUTING.md | 4 +- sources_non_forked/vim-go/CHANGELOG.md | 15 + .../vim-go/autoload/go/keyify.vim | 58 ++ .../vim-go/autoload/go/lint.vim | 13 +- .../vim-go/autoload/go/path.vim | 18 +- .../vim-go/autoload/go/tags.vim | 2 + .../vim-go/autoload/go/util.vim | 63 +- sources_non_forked/vim-go/doc/vim-go.txt | 90 ++- sources_non_forked/vim-go/ftplugin/go.vim | 2 + .../vim-go/ftplugin/go/commands.vim | 3 + .../vim-go/gosnippets/UltiSnips/go.snippets | 7 + .../vim-go/gosnippets/snippets/go.snip | 8 + sources_non_forked/vim-go/plugin/go.vim | 1 + .../vim-markdown/syntax/markdown.vim | 4 +- .../vim-snippets/UltiSnips/blade.snippets | 135 ++++ .../vim-snippets/UltiSnips/html.snippets | 568 ++++++++++++---- .../vim-snippets/UltiSnips/tex.snippets | 6 + .../vim-snippets/snippets/_.snippets | 3 +- .../vim-snippets/snippets/sh.snippets | 9 +- .../vim-snippets/snippets/typescript.snippets | 1 + .../vim-snippets/snippets/vue.snippets | 1 + update_plugins.py | 1 + 38 files changed, 1876 insertions(+), 288 deletions(-) create mode 100644 sources_non_forked/syntastic/syntax_checkers/php/phpstan.vim create mode 100644 sources_non_forked/vim-abolish/.gitignore create mode 100644 sources_non_forked/vim-abolish/CONTRIBUTING.markdown create mode 100644 sources_non_forked/vim-abolish/README.markdown create mode 100644 sources_non_forked/vim-abolish/doc/abolish.txt create mode 100644 sources_non_forked/vim-abolish/plugin/abolish.vim create mode 100644 sources_non_forked/vim-go/autoload/go/keyify.vim create mode 100644 sources_non_forked/vim-snippets/UltiSnips/blade.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/typescript.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/vue.snippets diff --git a/sources_non_forked/ack.vim/README.md b/sources_non_forked/ack.vim/README.md index 643ce65a..fca907fa 100644 --- a/sources_non_forked/ack.vim/README.md +++ b/sources_non_forked/ack.vim/README.md @@ -2,22 +2,22 @@ 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. +This plugin was designed as a Vim frontend for the programmer's search tool +[ack]. ack can be used as a replacement for 99% of the uses of `grep`. The +plugin allows you to search with ack from within 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 +### ack You will need ack (>= 2.0), of course. To install it follow the [manual](http://beyondgrep.com/install/). @@ -49,8 +49,6 @@ NeoBundle 'mileszs/ack.vim' [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}] @@ -60,7 +58,7 @@ for the `{pattern}`. 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 +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 @@ -140,22 +138,22 @@ the convention of Vim's built-in `:grep` and `:make` commands. ## Changelog -Please see [the Github releases page][releases]. +Please see [the GitHub releases page][releases]. ## Credits -This plugin is derived from Antoine Imbert's blog post [Ack and Vim +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. -And of course, where would we be without [Ack]. And, you know, Vim. +And of course, where would we be without [ack]. And, you know, Vim. -[Ack and Vim Integration]: http://blog.ant0ine.com/typepad/2007/03/ack-and-vim-integration.html +[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/ +[ack]: http://beyondgrep.com/ [vim-dispatch]: https://github.com/tpope/vim-dispatch [releases]: https://github.com/mileszs/ack.vim/releases diff --git a/sources_non_forked/ctrlp.vim/plugin/ctrlp.vim b/sources_non_forked/ctrlp.vim/plugin/ctrlp.vim index f31b64a2..1e56ecaf 100644 --- a/sources_non_forked/ctrlp.vim/plugin/ctrlp.vim +++ b/sources_non_forked/ctrlp.vim/plugin/ctrlp.vim @@ -39,7 +39,9 @@ if g:ctrlp_map != '' && !hasmapto('(ctrlp)') exe 'map' g:ctrlp_map '(ctrlp)' en -cal ctrlp#mrufiles#init() +if !exists('g:ctrlp_types') || index(g:ctrlp_types, 'mru') >= 0 + cal ctrlp#mrufiles#init() +en com! -bar CtrlPTag cal ctrlp#init(ctrlp#tag#id()) com! -bar CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id()) diff --git a/sources_non_forked/nerdtree/autoload/nerdtree.vim b/sources_non_forked/nerdtree/autoload/nerdtree.vim index 4402b4f4..63fa5c13 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree.vim @@ -89,7 +89,9 @@ function! nerdtree#deprecated(func, ...) endfunction " FUNCTION: nerdtree#exec(cmd) {{{2 -" same as :exec cmd but eventignore=all is set for the duration +" Same as :exec cmd but with eventignore set for the duration +" to disable the autocommands used by NERDTree (BufEnter, +" BufLeave and VimEnter) function! nerdtree#exec(cmd) let old_ei = &ei set ei=BufEnter,BufLeave,VimEnter diff --git a/sources_non_forked/nerdtree/doc/NERD_tree.txt b/sources_non_forked/nerdtree/doc/NERD_tree.txt index d0af4a82..3b7b9504 100644 --- a/sources_non_forked/nerdtree/doc/NERD_tree.txt +++ b/sources_non_forked/nerdtree/doc/NERD_tree.txt @@ -806,7 +806,7 @@ then all files ending in .vim or ~ will be ignored. There are 2 magic flags that can be appended to the end of each regular expression to specify that the regex should match only files or only dirs. These flags are "[[dir]]" and "[[file]]". Example: > - let NERDTreeIgnore=['.d$[[dir]]', '.o$[[file]]'] + let NERDTreeIgnore=['\.d$[[dir]]', '\.o$[[file]]'] < This will cause all dirs ending in ".d" to be ignored and all files ending in ".o" to be ignored. diff --git a/sources_non_forked/nerdtree/lib/nerdtree/path.vim b/sources_non_forked/nerdtree/lib/nerdtree/path.vim index 26db4a31..6f48a188 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/path.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/path.vim @@ -544,7 +544,7 @@ function! s:Path.readInfoFromDisk(fullpath) throw "NERDTree.InvalidFiletypeError: Cant handle FIFO files: " . a:fullpath endif - let self.pathSegments = split(fullpath, '/') + let self.pathSegments = filter(split(fullpath, '/'), '!empty(v:val)') let self.isReadOnly = 0 if isdirectory(a:fullpath) diff --git a/sources_non_forked/syntastic/doc/syntastic-checkers.txt b/sources_non_forked/syntastic/doc/syntastic-checkers.txt index e70d61a0..38248b07 100644 --- a/sources_non_forked/syntastic/doc/syntastic-checkers.txt +++ b/sources_non_forked/syntastic/doc/syntastic-checkers.txt @@ -4633,6 +4633,7 @@ The following checkers are available for PHP (filetype "php"): 2. PHP_CodeSniffer..........|syntastic-php-phpcs| 3. PHPLint..................|syntastic-php-phplint| 4. PHP Mess Detector........|syntastic-php-phpmd| + 5. PHPStan..................|syntastic-php-phpstan| ------------------------------------------------------------------------------ 1. PHP *syntastic-php-php* @@ -4712,6 +4713,24 @@ Checker options~ This checker is initialised using the "makeprgBuild()" function and thus it accepts the standard options described at |syntastic-config-makeprg|. +------------------------------------------------------------------------------ +5. PHP Static Analysis Tool *syntastic-php-phpstan* + +Name: phpstan +Maintainer: Przepompownia + +"PHPStan" focuses on finding errors in your code without actually running it. +See the project's page iat GitHub for details: + + https://github.com/phpstan/phpstan + +Syntastic supports "PHPStan" versions 0.7 and later. + +Checker options~ + +This checker is initialised using the "makeprgBuild()" function and thus it +accepts the standard options described at |syntastic-config-makeprg|. + ============================================================================== SYNTAX CHECKERS FOR POD *syntastic-checkers-pod* @@ -6123,6 +6142,13 @@ Installation~ You can install "Slim-Lint" with "gem": > gem install slim_lint < +Note~ + +You probably also need a plugin to set |filetype| for Slim files, such as +"vim-slim": + + https://github.com/slim-template/vim-slim + ------------------------------------------------------------------------------ 2. Slimrb *syntastic-slim-slimrb* @@ -6139,6 +6165,13 @@ Checker options~ This checker is initialised using the "makeprgBuild()" function and thus it accepts the standard options described at |syntastic-config-makeprg|. +Note~ + +You probably also need a plugin to set |filetype| for Slim files, such as +"vim-slim": + + https://github.com/slim-template/vim-slim + ============================================================================== SYNTAX CHECKERS FOR SML *syntastic-checkers-sml* diff --git a/sources_non_forked/syntastic/plugin/syntastic.vim b/sources_non_forked/syntastic/plugin/syntastic.vim index 06d60cc9..d5a9304e 100644 --- a/sources_non_forked/syntastic/plugin/syntastic.vim +++ b/sources_non_forked/syntastic/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:_SYNTASTIC_START endif -let g:_SYNTASTIC_VERSION = '3.8.0-51' +let g:_SYNTASTIC_VERSION = '3.8.0-55' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1 diff --git a/sources_non_forked/syntastic/syntax_checkers/go/gotype.vim b/sources_non_forked/syntastic/syntax_checkers/go/gotype.vim index ca276eb7..fefe3a4c 100644 --- a/sources_non_forked/syntastic/syntax_checkers/go/gotype.vim +++ b/sources_non_forked/syntastic/syntax_checkers/go/gotype.vim @@ -20,8 +20,24 @@ set cpo&vim function! SyntaxCheckers_go_gotype_GetLocList() dict let buf = bufnr('') + + if !exists('s:go_new') + let command = syntastic#util#shescape(syntastic#util#bufVar(buf, 'go_go_exec', 'go')) . ' version' + let version_output = syntastic#util#system(command) + call self.log('finding go version: ' . string(command) . ': ' . + \ string(split(version_output, "\n", 1)) . + \ (v:shell_error ? ' (exit code ' . v:shell_error . ')' : '')) + let parsed_ver = syntastic#util#parseVersion(version_output) + if len(parsed_ver) + let s:go_new = syntastic#util#versionIsAtLeast(parsed_ver, [1, 8]) + else + call syntastic#log#error("checker " . self.getCName() . ": can't parse go version (abnormal termination?)") + return [] + endif + endif + let makeprg = self.makeprgBuild({ - \ 'args': (bufname(buf) =~# '\m_test\.go$' ? '-a' : ''), + \ 'args': (bufname(buf) =~# '\m_test\.go$' ? (s:go_new ? '-t' : '-a') : ''), \ 'fname': '.' }) let errorformat = diff --git a/sources_non_forked/syntastic/syntax_checkers/php/phpstan.vim b/sources_non_forked/syntastic/syntax_checkers/php/phpstan.vim new file mode 100644 index 00000000..b81ccc97 --- /dev/null +++ b/sources_non_forked/syntastic/syntax_checkers/php/phpstan.vim @@ -0,0 +1,49 @@ +"============================================================================ +"File: phpstan.vim +"Description: Syntax checking plugin for syntastic +"Maintainer: Przepompownia przepompownia@users.noreply.github.com +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists('g:loaded_syntastic_php_phpstan_checker') + finish +endif +let g:loaded_syntastic_php_phpstan_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_php_phpstan_IsAvailable() dict + if !executable(self.getExec()) + return 0 + endif + return syntastic#util#versionIsAtLeast(self.getVersion(), [0, 7]) +endfunction + +function! SyntaxCheckers_php_phpstan_GetLocList() dict + let makeprg = self.makeprgBuild({ + \ 'exe_after': 'analyse', + \ 'args': '--level=5', + \ 'args_after': '--errorFormat raw' }) + + let errorformat = '%f:%l:%m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype' : 'Style' }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'php', + \ 'name': 'phpstan'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/vim-abolish/.gitignore b/sources_non_forked/vim-abolish/.gitignore new file mode 100644 index 00000000..0a56e3fc --- /dev/null +++ b/sources_non_forked/vim-abolish/.gitignore @@ -0,0 +1 @@ +/doc/tags diff --git a/sources_non_forked/vim-abolish/CONTRIBUTING.markdown b/sources_non_forked/vim-abolish/CONTRIBUTING.markdown new file mode 100644 index 00000000..b3f00951 --- /dev/null +++ b/sources_non_forked/vim-abolish/CONTRIBUTING.markdown @@ -0,0 +1 @@ +See the [contribution guidelines for pathogen.vim](https://github.com/tpope/vim-pathogen/blob/master/CONTRIBUTING.markdown). diff --git a/sources_non_forked/vim-abolish/README.markdown b/sources_non_forked/vim-abolish/README.markdown new file mode 100644 index 00000000..beb696cb --- /dev/null +++ b/sources_non_forked/vim-abolish/README.markdown @@ -0,0 +1,150 @@ +# abolish.vim + +I sat on this plugin for 3 years before releasing it, primarily +because it's so gosh darn hard to explain. It's three superficially +unrelated plugins in one that share a common theme: working with +variants of a word. + +## Abbreviation + +I know how to spell "separate". I know how to spell "desperate". My +fingers, however, have trouble distinguishing between the two, and I +invariably have a 50 percent chance of typing "seperate" or "desparate" +each time one of these comes up. At first, I tried abbreviations: + + :iabbrev seperate separate + :iabbrev desparate desperate + +But this falls short at the beginning of a sentence. + + :iabbrev Seperate Separate + :iabbrev Desparate Desperate + +To be really thorough, we need uppercase too! + + :iabbrev SEPERATE SEPARATE + :iabbrev DESPARATE DESPERATE + +Oh, but consider the noun form, and the adverb form! + + :iabbrev seperation separation + :iabbrev desparation desperation + :iabbrev seperately separately + :iabbrev desparately desperately + :iabbrev Seperation separation + :iabbrev Desparation Desperation + :iabbrev Seperately Separately + :iabbrev Desparately Desperately + :iabbrev SEPERATION SEPARATION + :iabbrev DESPARATION DESPERATION + :iabbrev SEPERATELY SEPARATELY + :iabbrev DESPARATELY DESPERATELY + +Wait, there's also "separates", "separated", "separating", +"separations", "separator"... + +Abolish.vim provides a simpler way. The following one command produces +48 abbreviations including all of the above. + + :Abolish {despa,sepe}rat{e,es,ed,ing,ely,ion,ions,or} {despe,sepa}rat{} + +My current configuration has 25 Abolish commands that create hundreds of +corrections my fingers refuse to learn. + +## Substitution + +One time I had an application with a domain model called +"facility" that needed to be renamed to "building". So, a simple +search and replace, right? + + :%s/facility/building/g + +Oh, but the case variants! + + :%s/Facility/Building/g + :%s/FACILITY/BUILDING/g + +Wait, the plural is more than "s" so we need to get that too! + + :%s/facilities/buildings/g + :%s/Facilities/Buildings/g + :%s/FACILITIES/BUILDINGS/g + +Abolish.vim has your back. One command to do all six, and you can +repeat it with `&` too! + + :%Subvert/facilit{y,ies}/building{,s}/g + +From a conceptual level, one way to think about how this substitution +works is to imagine that in the braces you are declaring the +requirements for turning that word from singular to plural. In +the facility example, the same base letters in both the singular +and plural form of the word are `facilit` To turn "facility" to a +plural word you must change the `y` to `ies` so you specify +`{y,ies}` in the braces. + +To convert the word "building" from singular to plural, again +look at the common letters between the singular and plural forms: +`building`. In this case you do not need to remove any letter +from building to turn it into plural form and you need to +add an `s` so the braces should be `{,s}`. + +A few more examples: + +Address to Reference + + :Subvert/address{,es}/reference{,s}/g + +Blog to Post (you can just do this with a regular :s also) + + :Subvert/blog{,s}/post{,s}/g + +Child to Adult + + :Subvert/child{,ren}/adult{,s}/g + +Be amazed as it correctly turns the word children into the word adults! + +Die to Spinner + + :Subvert/di{e,ce}/spinner{,s}/g + +You can abbreviate it as `:S`, and it accepts the full range of flags +including things like `c` (confirm). + +There's also a variant for searching and a variant for grepping. + +## Coercion + +Want to turn `fooBar` into `foo_bar`? Press `crs` (coerce to +snake\_case). MixedCase (`crm`), camelCase (`crc`), snake\_case +(`crs`), UPPER\_CASE (`cru`), dash-case (`cr-`), dot.case (`cr.`), +space case (`cr`), and Title Case (`crt`) are all just 3 +keystrokes away. These commands support +[repeat.vim](https://github.com/tpope/vim-repeat). + +## Installation + +If you don't have a preferred installation method, I recommend +installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and +then simply copy and paste: + + cd ~/.vim/bundle + git clone git://github.com/tpope/vim-abolish.git + +Once help tags have been generated, you can view the manual with +`:help abolish`. + +## Self-Promotion + +Like abolish.vim? Follow the repository on +[GitHub](https://github.com/tpope/vim-abolish) and vote for it on +[vim.org](http://www.vim.org/scripts/script.php?script_id=1545). And if +you're feeling especially charitable, follow [tpope](http://tpo.pe/) on +[Twitter](http://twitter.com/tpope) and +[GitHub](https://github.com/tpope). + +## License + +Copyright (c) Tim Pope. Distributed under the same terms as Vim itself. +See `:help license`. diff --git a/sources_non_forked/vim-abolish/doc/abolish.txt b/sources_non_forked/vim-abolish/doc/abolish.txt new file mode 100644 index 00000000..91f24da9 --- /dev/null +++ b/sources_non_forked/vim-abolish/doc/abolish.txt @@ -0,0 +1,181 @@ +*abolish.txt* Language friendly searches, substitutions, and abbreviations + +Author: Tim Pope +License: Same terms as Vim itself (see |license|) + +This plugin is only available if 'compatible' is not set. + +INTRODUCTION *abolish* *:Abolish* *:Subvert* + +Abolish lets you quickly find, substitute, and abbreviate several variations +of a word at once. By default, three case variants (foo, Foo, and FOO) are +operated on by every command. + +Two commands are provided. :Abolish is the most general interface. +:Subvert provides an alternative, more concise syntax for searching and +substituting. +> + :Abolish [options] {abbreviation} {replacement} + :Abolish -delete [options] {abbreviation} + + :Abolish -search [options] {pattern} + :Subvert/{pattern}[/flags] + :Abolish!-search [options] {pattern} + :Subvert?{pattern}[?flags] + + :Abolish -search [options] {pattern} {grep-arguments} + :Subvert /{pattern}/[flags] {grep-options} + :Abolish!-search [options] {pattern} {grep-arguments} + :Subvert!/{pattern}/[flags] {grep-options} + + :[range]Abolish -substitute [options] {pattern} {replacement} + :[range]Subvert/{pattern}/{replacement}[/flags] +< + *:S* +In addition to the :Subvert command, a :S synonym is provided if not +already defined. This will be used in examples below. + +PATTERNS *abolish-patterns* + +Patterns can include brace pairs that contain comma separated alternatives: + + box{,es} => box, boxes, Box, Boxes, BOX, BOXES + +For commands with a replacement, corresponding brace pairs are used in both +halves. If the replacement should be identical to the pattern, an empty +brace pair may be used. If fewer replacements are given than were given in +the pattern, they are looped. That is, {a,b} on the replacement side is the +same as {a,b,a,b,a,b,...} repeated indefinitely. + +The following replaces several different misspellings of "necessary": +> + :%S/{,un}nec{ce,ces,e}sar{y,ily}/{}nec{es}sar{}/g +< +ABBREVIATING *abolish-abbrev* + +By default :Abolish creates abbreviations, which replace words automatically +as you type. This is good for words you frequently misspell, or as +shortcuts for longer words. Since these are just Vim abbreviations, only +whole words will match. +> + :Abolish anomol{y,ies} anomal{} + :Abolish {,in}consistant{,ly} {}consistent{} + :Abolish Tqbf The quick, brown fox jumps over the lazy dog +< +Accepts the following options: + + -buffer: buffer local + -cmdline: work in command line in addition to insert mode + +A good place to define abbreviations is "after/plugin/abolish.vim", +relative to ~\vimfiles on Windows and ~/.vim everywhere else. + +With a bang (:Abolish!) the abbreviation is also appended to the file in +g:abolish_save_file. The default is "after/plugin/abolish.vim", relative +to the install directory. + +Abbreviations can be removed with :Abolish -delete: +> + Abolish -delete -buffer -cmdline anomol{y,ies} +< +SEARCHING *abolish-search* + +The -search command does a search in a manner similar to / key. +search. After searching, you can use |n| and |N| as you would with a normal +search. + +The following will search for box, Box, and BOX: +> + :Abolish -search box +< +When given a single word to operate on, :Subvert defaults to doing a +search as well: +> + :S/box/ +< +This one searches for box, boxes, boxed, boxing, Box, Boxes, Boxed, Boxing, +BOX, BOXES, BOXED, and BOXING: +> + :S/box{,es,ed,ing}/ +< +The following syntaxes search in reverse. +> + :Abolish! -search box + :S?box? +< +Flags can be given with the -flags= option to :Abolish, or by appending them +after the separator to :Subvert. The flags trigger the following behaviors: + + I: Disable case variations (box, Box, BOX) + v: Match inside variable names (match my_box, myBox, but not mybox) + w: Match whole words (like surrounding with \< and \>) + +A |search-offset| may follow the flags. +> + :Abolish -search -flags=avs+1 box + :S?box{,es,ed,ing}?we +< +GREPPING *abolish-grep* + +Grepping works similar to searching, and is invoked when additional options +are given. These options are passed directly to the :grep command. +> + :Abolish -search box{,es} + :S /box{,es}/ * + :S /box/aw *.txt *.html +< +The slash delimiters must both be present if used with :Subvert. They may +both be omitted if no flags are used. + +Both an external grepprg and vimgrep (via grepprg=internal) are supported. +With an external grep, the "v" flag behaves less intelligently, due to the +lack of look ahead and look behind support in grep regexps. + +SUBSTITUTING *abolish-substitute* + +Giving a range switches :Subvert into substitute mode. This command will +change box -> bag, boxes -> bags, Box -> Bag, Boxes -> Bags, BOX -> BAG, +BOXES -> BAGS across the entire document: +> + :%Abolish -substitute -flags=g box{,es} bag{,s} + :%S/box{,es}/bag{,s}/g +< +The "c", "e", "g", and "n" flags can be used from the substitute command +|:s_flags|, along with the "a", "I", "v", and "w" flags from searching. + +COERCION *abolish-coercion* *cr* + +Abolish's case mutating algorithms can be applied to the word under the cursor +using the cr mapping (mnemonic: CoeRce) followed by one of the following +characters: + + c: camelCase + m: MixedCase + _: snake_case + s: snake_case + u: SNAKE_UPPERCASE + U: SNAKE_UPPERCASE + -: dash-case (not usually reversible; see |abolish-coercion-reversible|) + k: kebab-case (not usually reversible; see |abolish-coercion-reversible|) + .: dot.case (not usually reversible; see |abolish-coercion-reversible|) + : space case (not usually reversible; see |abolish-coercion-reversible|) + t: Title Case (not usually reversible; see |abolish-coercion-reversible|) + +For example, cru on a lowercase word is a slightly easier to type equivalent +to gUiw. + +COERCION REVERSIBILITY *abolish-coercion-reversible* + +Some separators, such as "-" and ".", are listed as "not usually reversible". +The reason is that these are not "keyword characters", so vim (and +abolish.vim) will treat them as breaking a word. + +For example: "key_word" is a single keyword. The dash-case version, +"key-word", is treated as two keywords, "key" and "word". + +This behaviour is governed by the 'iskeyword' option. If a separator appears +in 'iskeyword', the corresponding coercion will be reversible. For instance, +dash-case is reversible in 'lisp' files, and dot-case is reversible in R +files. + + vim:tw=78:ts=8:ft=help:norl: diff --git a/sources_non_forked/vim-abolish/plugin/abolish.vim b/sources_non_forked/vim-abolish/plugin/abolish.vim new file mode 100644 index 00000000..e2486c11 --- /dev/null +++ b/sources_non_forked/vim-abolish/plugin/abolish.vim @@ -0,0 +1,631 @@ +" abolish.vim - Language friendly searches, substitutions, and abbreviations +" Maintainer: Tim Pope +" Version: 1.1 +" GetLatestVimScripts: 1545 1 :AutoInstall: abolish.vim + +" Initialization {{{1 + +if exists("g:loaded_abolish") || &cp || v:version < 700 + finish +endif +let g:loaded_abolish = 1 + +if !exists("g:abolish_save_file") + if isdirectory(expand("~/.vim")) + let g:abolish_save_file = expand("~/.vim/after/plugin/abolish.vim") + elseif isdirectory(expand("~/vimfiles")) || has("win32") + let g:abolish_save_file = expand("~/vimfiles/after/plugin/abolish.vim") + else + let g:abolish_save_file = expand("~/.vim/after/plugin/abolish.vim") + endif +endif + +" }}}1 +" Utility functions {{{1 + +function! s:function(name) + return function(substitute(a:name,'^s:',matchstr(expand(''), '\d\+_'),'')) +endfunction + +function! s:send(self,func,...) + if type(a:func) == type('') || type(a:func) == type(0) + let Func = get(a:self,a:func,'') + else + let Func = a:func + endif + let s = type(a:self) == type({}) ? a:self : {} + if type(Func) == type(function('tr')) + return call(Func,a:000,s) + elseif type(Func) == type({}) && has_key(Func,'apply') + return call(Func.apply,a:000,Func) + elseif type(Func) == type({}) && has_key(Func,'call') + return call(Func.call,a:000,s) + elseif type(Func) == type('') && Func == '' && has_key(s,'function missing') + return call('s:send',[s,'function missing',a:func] + a:000) + else + return Func + endif +endfunction + +let s:object = {} +function! s:object.clone(...) + let sub = deepcopy(self) + return a:0 ? extend(sub,a:1) : sub +endfunction + +if !exists("g:Abolish") + let Abolish = {} +endif +call extend(Abolish, s:object, 'force') +call extend(Abolish, {'Coercions': {}}, 'keep') + +function! s:throw(msg) + let v:errmsg = a:msg + throw "Abolish: ".a:msg +endfunction + +function! s:words() + let words = [] + let lnum = line('w0') + while lnum <= line('w$') + let line = getline(lnum) + let col = 0 + while match(line,'\<\k\k\+\>',col) != -1 + let words += [matchstr(line,'\<\k\k\+\>',col)] + let col = matchend(line,'\<\k\k\+\>',col) + endwhile + let lnum += 1 + endwhile + return words +endfunction + +function! s:extractopts(list,opts) + let i = 0 + while i < len(a:list) + if a:list[i] =~ '^-[^=]' && has_key(a:opts,matchstr(a:list[i],'-\zs[^=]*')) + let key = matchstr(a:list[i],'-\zs[^=]*') + let value = matchstr(a:list[i],'=\zs.*') + if type(get(a:opts,key)) == type([]) + let a:opts[key] += [value] + elseif type(get(a:opts,key)) == type(0) + let a:opts[key] = 1 + else + let a:opts[key] = value + endif + else + let i += 1 + continue + endif + call remove(a:list,i) + endwhile + return a:opts +endfunction + +" }}}1 +" Dictionary creation {{{1 + +function! s:mixedcase(word) + return substitute(s:camelcase(a:word),'^.','\u&','') +endfunction + +function! s:camelcase(word) + let word = substitute(a:word, '-', '_', 'g') + if word !~# '_' && word =~# '\l' + return substitute(word,'^.','\l&','') + else + return substitute(word,'\C\(_\)\=\(.\)','\=submatch(1)==""?tolower(submatch(2)) : toupper(submatch(2))','g') + endif +endfunction + +function! s:snakecase(word) + let word = substitute(a:word,'::','/','g') + let word = substitute(word,'\(\u\+\)\(\u\l\)','\1_\2','g') + let word = substitute(word,'\(\l\|\d\)\(\u\)','\1_\2','g') + let word = substitute(word,'[.-]','_','g') + let word = tolower(word) + return word +endfunction + +function! s:uppercase(word) + return toupper(s:snakecase(a:word)) +endfunction + +function! s:dashcase(word) + return substitute(s:snakecase(a:word),'_','-','g') +endfunction + +function! s:spacecase(word) + return substitute(s:snakecase(a:word),'_',' ','g') +endfunction + +function! s:dotcase(word) + return substitute(s:snakecase(a:word),'_','.','g') +endfunction + +function! s:titlecase(word) + return substitute(s:spacecase(a:word), '\(\<\w\)','\=toupper(submatch(1))','g') +endfunction + +call extend(Abolish, { + \ 'camelcase': s:function('s:camelcase'), + \ 'mixedcase': s:function('s:mixedcase'), + \ 'snakecase': s:function('s:snakecase'), + \ 'uppercase': s:function('s:uppercase'), + \ 'dashcase': s:function('s:dashcase'), + \ 'dotcase': s:function('s:dotcase'), + \ 'spacecase': s:function('s:spacecase'), + \ 'titlecase': s:function('s:titlecase') + \ }, 'keep') + +function! s:create_dictionary(lhs,rhs,opts) + let dictionary = {} + let i = 0 + let expanded = s:expand_braces({a:lhs : a:rhs}) + for [lhs,rhs] in items(expanded) + if get(a:opts,'case',1) + let dictionary[s:mixedcase(lhs)] = s:mixedcase(rhs) + let dictionary[tolower(lhs)] = tolower(rhs) + let dictionary[toupper(lhs)] = toupper(rhs) + endif + let dictionary[lhs] = rhs + endfor + let i += 1 + return dictionary +endfunction + +function! s:expand_braces(dict) + let new_dict = {} + for [key,val] in items(a:dict) + if key =~ '{.*}' + let redo = 1 + let [all,kbefore,kmiddle,kafter;crap] = matchlist(key,'\(.\{-\}\){\(.\{-\}\)}\(.*\)') + let [all,vbefore,vmiddle,vafter;crap] = matchlist(val,'\(.\{-\}\){\(.\{-\}\)}\(.*\)') + ["","","",""] + if all == "" + let [vbefore,vmiddle,vafter] = [val, ",", ""] + endif + let targets = split(kmiddle,',',1) + let replacements = split(vmiddle,',',1) + if replacements == [""] + let replacements = targets + endif + for i in range(0,len(targets)-1) + let new_dict[kbefore.targets[i].kafter] = vbefore.replacements[i%len(replacements)].vafter + endfor + else + let new_dict[key] = val + endif + endfor + if exists("redo") + return s:expand_braces(new_dict) + else + return new_dict + endif +endfunction + +" }}}1 +" Abolish Dispatcher {{{1 + +function! s:SubComplete(A,L,P) + if a:A =~ '^[/?]\k\+$' + let char = strpart(a:A,0,1) + return join(map(s:words(),'char . v:val'),"\n") + elseif a:A =~# '^\k\+$' + return join(s:words(),"\n") + endif +endfunction + +function! s:Complete(A,L,P) + let g:L = a:L + " Vim bug: :Abolish - calls this function with a:A equal to 0 + if a:A =~# '^[^/?-]' && type(a:A) != type(0) + return join(s:words(),"\n") + elseif a:L =~# '^\w\+\s\+\%(-\w*\)\=$' + return "-search\n-substitute\n-delete\n-buffer\n-cmdline\n" + elseif a:L =~# ' -\%(search\|substitute\)\>' + return "-flags=" + else + return "-buffer\n-cmdline" + endif +endfunction + +let s:commands = {} +let s:commands.abstract = s:object.clone() + +function! s:commands.abstract.dispatch(bang,line1,line2,count,args) + return self.clone().go(a:bang,a:line1,a:line2,a:count,a:args) +endfunction + +function! s:commands.abstract.go(bang,line1,line2,count,args) + let self.bang = a:bang + let self.line1 = a:line1 + let self.line2 = a:line2 + let self.count = a:count + return self.process(a:bang,a:line1,a:line2,a:count,a:args) +endfunction + +function! s:dispatcher(bang,line1,line2,count,args) + let i = 0 + let args = copy(a:args) + let command = s:commands.abbrev + while i < len(args) + if args[i] =~# '^-\w\+$' && has_key(s:commands,matchstr(args[i],'-\zs.*')) + let command = s:commands[matchstr(args[i],'-\zs.*')] + call remove(args,i) + break + endif + let i += 1 + endwhile + try + return command.dispatch(a:bang,a:line1,a:line2,a:count,args) + catch /^Abolish: / + echohl ErrorMsg + echo v:errmsg + echohl NONE + return "" + endtry +endfunction + +" }}}1 +" Subvert Dispatcher {{{1 + +function! s:subvert_dispatcher(bang,line1,line2,count,args) + try + return s:parse_subvert(a:bang,a:line1,a:line2,a:count,a:args) + catch /^Subvert: / + echohl ErrorMsg + echo v:errmsg + echohl NONE + return "" + endtry +endfunction + +function! s:parse_subvert(bang,line1,line2,count,args) + if a:args =~ '^\%(\w\|$\)' + let args = (a:bang ? "!" : "").a:args + else + let args = a:args + endif + let separator = matchstr(args,'^.') + let split = split(args,separator,1)[1:] + if a:count || split == [""] + return s:parse_substitute(a:bang,a:line1,a:line2,a:count,split) + elseif len(split) == 1 + return s:find_command(separator,"",split[0]) + elseif len(split) == 2 && split[1] =~# '^[A-Za-z]*n[A-Za-z]*$' + return s:parse_substitute(a:bang,a:line1,a:line2,a:count,[split[0],"",split[1]]) + elseif len(split) == 2 && split[1] =~# '^[A-Za-z]*\%([+-]\d\+\)\=$' + return s:find_command(separator,split[1],split[0]) + elseif len(split) >= 2 && split[1] =~# '^[A-Za-z]* ' + let flags = matchstr(split[1],'^[A-Za-z]*') + let rest = matchstr(join(split[1:],separator),' \zs.*') + return s:grep_command(rest,a:bang,flags,split[0]) + elseif len(split) >= 2 && separator == ' ' + return s:grep_command(join(split[1:],' '),a:bang,"",split[0]) + else + return s:parse_substitute(a:bang,a:line1,a:line2,a:count,split) + endif +endfunction + +function! s:normalize_options(flags) + if type(a:flags) == type({}) + let opts = a:flags + let flags = get(a:flags,"flags","") + else + let opts = {} + let flags = a:flags + endif + let g:op1 = copy(opts) + if flags =~# 'w' + let opts.boundaries = 2 + elseif flags =~# 'v' + let opts.boundaries = 1 + elseif !has_key(opts,'boundaries') + let opts.boundaries = 0 + endif + let opts.case = (flags !~# 'I' ? get(opts,'case',1) : 0) + let opts.flags = substitute(flags,'\C[avIiw]','','g') + let g:op2 = copy(opts) + return opts +endfunction + +" }}}1 +" Searching {{{1 + +function! s:subesc(pattern) + return substitute(a:pattern,'[][\\/.*+?~%()&]','\\&','g') +endfunction + +function! s:sort(a,b) + if a:a ==? a:b + return a:a == a:b ? 0 : a:a > a:b ? 1 : -1 + elseif strlen(a:a) == strlen(a:b) + return a:a >? a:b ? 1 : -1 + else + return strlen(a:a) < strlen(a:b) ? 1 : -1 + endif +endfunction + +function! s:pattern(dict,boundaries) + if a:boundaries == 2 + let a = '<' + let b = '>' + elseif a:boundaries + let a = '%(<|_@<=|[[:lower:]]@<=[[:upper:]]@=)' + let b = '%(>|_@=|[[:lower:]]@<=[[:upper:]]@=)' + else + let a = '' + let b = '' + endif + return '\v\C'.a.'%('.join(map(sort(keys(a:dict),function('s:sort')),'s:subesc(v:val)'),'|').')'.b +endfunction + +function! s:egrep_pattern(dict,boundaries) + if a:boundaries == 2 + let a = '\<' + let b = '\>' + elseif a:boundaries + let a = '(\<\|_)' + let b = '(\>\|_\|[[:upper:]][[:lower:]])' + else + let a = '' + let b = '' + endif + return a.'('.join(map(sort(keys(a:dict),function('s:sort')),'s:subesc(v:val)'),'\|').')'.b +endfunction + +function! s:c() + call histdel('search',-1) + return "" +endfunction + +function! s:find_command(cmd,flags,word) + let opts = s:normalize_options(a:flags) + let dict = s:create_dictionary(a:word,"",opts) + " This is tricky. If we use :/pattern, the search drops us at the + " beginning of the line, and we can't use position flags (e.g., /foo/e). + " If we use :norm /pattern, we leave ourselves vulnerable to "press enter" + " prompts (even with :silent). + let cmd = (a:cmd =~ '[?!]' ? '?' : '/') + let @/ = s:pattern(dict,opts.boundaries) + if opts.flags == "" || !search(@/,'n') + return "norm! ".cmd."\" + elseif opts.flags =~ ';[/?]\@!' + call s:throw("E386: Expected '?' or '/' after ';'") + else + return "exe 'norm! ".cmd.cmd.opts.flags."\'|call histdel('search',-1)" + return "" + endif +endfunction + +function! s:grep_command(args,bang,flags,word) + let opts = s:normalize_options(a:flags) + let dict = s:create_dictionary(a:word,"",opts) + if &grepprg == "internal" + let lhs = "'".s:pattern(dict,opts.boundaries)."'" + else + let lhs = "-E '".s:egrep_pattern(dict,opts.boundaries)."'" + endif + return "grep".(a:bang ? "!" : "")." ".lhs." ".a:args +endfunction + +let s:commands.search = s:commands.abstract.clone() +let s:commands.search.options = {"word": 0, "variable": 0, "flags": ""} + +function! s:commands.search.process(bang,line1,line2,count,args) + call s:extractopts(a:args,self.options) + if self.options.word + let self.options.flags .= "w" + elseif self.options.variable + let self.options.flags .= "v" + endif + let opts = s:normalize_options(self.options) + if len(a:args) > 1 + return s:grep_command(join(a:args[1:]," "),a:bang,opts,a:args[0]) + elseif len(a:args) == 1 + return s:find_command(a:bang ? "!" : " ",opts,a:args[0]) + else + call s:throw("E471: Argument required") + endif +endfunction + +" }}}1 +" Substitution {{{1 + +function! Abolished() + return get(g:abolish_last_dict,submatch(0),submatch(0)) +endfunction + +function! s:substitute_command(cmd,bad,good,flags) + let opts = s:normalize_options(a:flags) + let dict = s:create_dictionary(a:bad,a:good,opts) + let lhs = s:pattern(dict,opts.boundaries) + let g:abolish_last_dict = dict + return a:cmd.'/'.lhs.'/\=Abolished()'."/".opts.flags +endfunction + +function! s:parse_substitute(bang,line1,line2,count,args) + if get(a:args,0,'') =~ '^[/?'']' + let separator = matchstr(a:args[0],'^.') + let args = split(join(a:args,' '),separator,1) + call remove(args,0) + else + let args = a:args + endif + if len(args) < 2 + call s:throw("E471: Argument required") + elseif len(args) > 3 + call s:throw("E488: Trailing characters") + endif + let [bad,good,flags] = (args + [""])[0:2] + if a:count == 0 + let cmd = "substitute" + else + let cmd = a:line1.",".a:line2."substitute" + endif + return s:substitute_command(cmd,bad,good,flags) +endfunction + +let s:commands.substitute = s:commands.abstract.clone() +let s:commands.substitute.options = {"word": 0, "variable": 0, "flags": "g"} + +function! s:commands.substitute.process(bang,line1,line2,count,args) + call s:extractopts(a:args,self.options) + if self.options.word + let self.options.flags .= "w" + elseif self.options.variable + let self.options.flags .= "v" + endif + let opts = s:normalize_options(self.options) + if len(a:args) <= 1 + call s:throw("E471: Argument required") + else + let good = join(a:args[1:],"") + let cmd = a:bang ? "." : "%" + return s:substitute_command(cmd,a:args[0],good,self.options) + endif +endfunction + +" }}}1 +" Abbreviations {{{1 + +function! s:badgood(args) + let words = filter(copy(a:args),'v:val !~ "^-"') + call filter(a:args,'v:val =~ "^-"') + if empty(words) + call s:throw("E471: Argument required") + elseif !empty(a:args) + call s:throw("Unknown argument: ".a:args[0]) + endif + let [bad; words] = words + return [bad, join(words," ")] +endfunction + +function! s:abbreviate_from_dict(cmd,dict) + for [lhs,rhs] in items(a:dict) + exe a:cmd lhs rhs + endfor +endfunction + +let s:commands.abbrev = s:commands.abstract.clone() +let s:commands.abbrev.options = {"buffer":0,"cmdline":0,"delete":0} +function! s:commands.abbrev.process(bang,line1,line2,count,args) + let args = copy(a:args) + call s:extractopts(a:args,self.options) + if self.options.delete + let cmd = "unabbrev" + let good = "" + else + let cmd = "noreabbrev" + endif + if !self.options.cmdline + let cmd = "i" . cmd + endif + if self.options.delete + let cmd = "silent! ".cmd + endif + if self.options.buffer + let cmd = cmd . " " + endif + let [bad, good] = s:badgood(a:args) + if substitute(bad,'{.\{-\}.}','','g') !~ '^\k\+$' + call s:throw("E474: Invalid argument (not a keyword: ".string(bad).")") + endif + if !self.options.delete && good == "" + call s:throw("E471: Argument required".a:args[0]) + endif + let dict = s:create_dictionary(bad,good,self.options) + call s:abbreviate_from_dict(cmd,dict) + if a:bang + let i = 0 + let str = "Abolish ".join(args," ") + let file = g:abolish_save_file + if !isdirectory(fnamemodify(file,':h')) + call mkdir(fnamemodify(file,':h'),'p') + endif + + if filereadable(file) + let old = readfile(file) + else + let old = ["\" Exit if :Abolish isn't available.","if !exists(':Abolish')"," finish","endif",""] + endif + call writefile(old + [str],file) + endif + return "" +endfunction + +let s:commands.delete = s:commands.abbrev.clone() +let s:commands.delete.options.delete = 1 + +" }}}1 +" Maps {{{1 + +function! s:unknown_coercion(letter,word) + return a:word +endfunction + +call extend(Abolish.Coercions, { + \ 'c': Abolish.camelcase, + \ 'm': Abolish.mixedcase, + \ 's': Abolish.snakecase, + \ '_': Abolish.snakecase, + \ 'u': Abolish.uppercase, + \ 'U': Abolish.uppercase, + \ '-': Abolish.dashcase, + \ 'k': Abolish.dashcase, + \ '.': Abolish.dotcase, + \ ' ': Abolish.spacecase, + \ 't': Abolish.titlecase, + \ "function missing": s:function("s:unknown_coercion") + \}, "keep") + +function! s:coerce(transformation) + let clipboard = &clipboard + try + set clipboard= + let regbody = getreg('"') + let regtype = getregtype('"') + let c = v:count1 + while c > 0 + let c -= 1 + norm! yiw + let word = @@ + let @@ = s:send(g:Abolish.Coercions,a:transformation,word) + if !exists('begin') + let begin = getpos("'[") + endif + if word !=# @@ + let changed = 1 + norm! viwpw + else + norm! w + endif + endwhile + call setreg('"',regbody,regtype) + call setpos("'[",begin) + call setpos(".",begin) + if exists("changed") + silent! call repeat#set("\Coerce".a:transformation) + endif + finally + let &clipboard = clipboard + endtry +endfunction + +nnoremap Coerce :call coerce(nr2char(getchar())) + +" }}}1 + +if !exists("g:abolish_no_mappings") || ! g:abolish_no_mappings + nmap cr Coerce +endif + +command! -nargs=+ -bang -bar -range=0 -complete=custom,s:Complete Abolish + \ :exec s:dispatcher(0,,,,[]) +command! -nargs=1 -bang -bar -range=0 -complete=custom,s:SubComplete Subvert + \ :exec s:subvert_dispatcher(0,,,,) +if exists(':S') != 2 + command -nargs=1 -bang -bar -range=0 -complete=custom,s:SubComplete S + \ :exec s:subvert_dispatcher(0,,,,) +endif + +" vim:set ft=vim sw=2 sts=2: diff --git a/sources_non_forked/vim-bundle-mako/indent/mako.vim b/sources_non_forked/vim-bundle-mako/indent/mako.vim index 8f6b97b6..4433cc4a 100644 --- a/sources_non_forked/vim-bundle-mako/indent/mako.vim +++ b/sources_non_forked/vim-bundle-mako/indent/mako.vim @@ -42,8 +42,6 @@ " 0.1 - 06 June 2009 " - Initial public release of mako indent file -let sw=2 " default shiftwidth of 2 spaces - if exists("b:did_indent") finish endif @@ -53,6 +51,9 @@ setlocal nosmartindent setlocal noautoindent setlocal nocindent setlocal nolisp +setlocal expandtab +setlocal softtabstop=2 +setlocal shiftwidth=2 setlocal indentexpr=GetMakoIndent() setlocal indentkeys+=*,<>>,,end,: diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index 46a48613..9cda172b 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -298,6 +298,9 @@ endfunction function! s:repo_tree(...) dict abort if self.dir() =~# '/\.git$' let dir = self.dir()[0:-6] + if dir !~# '/' + let dir .= '/' + endif else let dir = s:configured_tree(self.git_dir) endif @@ -972,11 +975,14 @@ function! s:StageToggle(lnum1,lnum2) abort continue endif execute lnum - if filename =~ ' -> ' - let cmd = ['mv','--'] + reverse(split(filename,' -> ')) - let filename = cmd[-1] - elseif section ==# 'staged' - let cmd = ['reset','-q','--',filename] + if section ==# 'staged' + if filename =~ ' -> ' + let files_to_unstage = split(filename,' -> ') + else + let files_to_unstage = [filename] + endif + let filename = files_to_unstage[-1] + let cmd = ['reset','-q','--'] + files_to_unstage elseif getline(lnum) =~# '^#\tdeleted:' let cmd = ['rm','--',filename] elseif getline(lnum) =~# '^#\tmodified:' @@ -1118,7 +1124,7 @@ function! s:Commit(args, ...) abort elseif error ==# '!' return s:Status() else - call s:throw(error) + call s:throw(empty(error)?join(errors, ' '):error) endif endif catch /^fugitive:/ @@ -1385,6 +1391,7 @@ function! s:Edit(cmd,bang,...) abort endif endif endfor + diffoff! endif endif endif @@ -2894,7 +2901,7 @@ function! s:cfile() abort let ref = matchstr(getline('.'),'\x\{40\}') echoerr "warning: unknown context ".matchstr(getline('.'),'^\l*') - elseif getline('.') =~# '^[+-]\{3\} [abciwo12]\=/' + elseif getline('.') =~# '^[+-]\{3\} [abciow12]\=/' let ref = getline('.')[4:] elseif getline('.') =~# '^[+-]' && search('^@@ -\d\+,\d\+ +\d\+,','bnW') @@ -2908,7 +2915,7 @@ function! s:cfile() abort let lnum -= 1 endwhile let offset += matchstr(getline(lnum), type.'\zs\d\+') - let ref = getline(search('^'.type.'\{3\} [abciwo12]/','bnW'))[4:-1] + let ref = getline(search('^'.type.'\{3\} [abciow12]/','bnW'))[4:-1] let dcmds = [offset, 'normal!zv'] elseif getline('.') =~# '^rename from ' @@ -2917,22 +2924,22 @@ function! s:cfile() abort let ref = 'b/'.getline('.')[10:] elseif getline('.') =~# '^@@ -\d\+,\d\+ +\d\+,' - let diff = getline(search('^diff --git \%([abciwo12]/.*\|/dev/null\) \%([abciwo12]/.*\|/dev/null\)', 'bcnW')) + let diff = getline(search('^diff --git \%([abciow12]/.*\|/dev/null\) \%([abciow12]/.*\|/dev/null\)', 'bcnW')) let offset = matchstr(getline('.'), '+\zs\d\+') - let dref = matchstr(diff, '\Cdiff --git \zs\%([abciwo12]/.*\|/dev/null\)\ze \%([abciwo12]/.*\|/dev/null\)') - let ref = matchstr(diff, '\Cdiff --git \%([abciwo12]/.*\|/dev/null\) \zs\%([abciwo12]/.*\|/dev/null\)') + let dref = matchstr(diff, '\Cdiff --git \zs\%([abciow12]/.*\|/dev/null\)\ze \%([abciow12]/.*\|/dev/null\)') + let ref = matchstr(diff, '\Cdiff --git \%([abciow12]/.*\|/dev/null\) \zs\%([abciow12]/.*\|/dev/null\)') let dcmd = 'Gdiff! +'.offset - elseif getline('.') =~# '^diff --git \%([abciwo12]/.*\|/dev/null\) \%([abciwo12]/.*\|/dev/null\)' - let dref = matchstr(getline('.'),'\Cdiff --git \zs\%([abciwo12]/.*\|/dev/null\)\ze \%([abciwo12]/.*\|/dev/null\)') - let ref = matchstr(getline('.'),'\Cdiff --git \%([abciwo12]/.*\|/dev/null\) \zs\%([abciwo12]/.*\|/dev/null\)') + elseif getline('.') =~# '^diff --git \%([abciow12]/.*\|/dev/null\) \%([abciow12]/.*\|/dev/null\)' + let dref = matchstr(getline('.'),'\Cdiff --git \zs\%([abciow12]/.*\|/dev/null\)\ze \%([abciow12]/.*\|/dev/null\)') + let ref = matchstr(getline('.'),'\Cdiff --git \%([abciow12]/.*\|/dev/null\) \zs\%([abciow12]/.*\|/dev/null\)') let dcmd = 'Gdiff!' - elseif getline('.') =~# '^index ' && getline(line('.')-1) =~# '^diff --git \%([abciwo12]/.*\|/dev/null\) \%([abciwo12]/.*\|/dev/null\)' + elseif getline('.') =~# '^index ' && getline(line('.')-1) =~# '^diff --git \%([abciow12]/.*\|/dev/null\) \%([abciow12]/.*\|/dev/null\)' let line = getline(line('.')-1) - let dref = matchstr(line,'\Cdiff --git \zs\%([abciwo12]/.*\|/dev/null\)\ze \%([abciwo12]/.*\|/dev/null\)') - let ref = matchstr(line,'\Cdiff --git \%([abciwo12]/.*\|/dev/null\) \zs\%([abciwo12]/.*\|/dev/null\)') + let dref = matchstr(line,'\Cdiff --git \zs\%([abciow12]/.*\|/dev/null\)\ze \%([abciow12]/.*\|/dev/null\)') + let ref = matchstr(line,'\Cdiff --git \%([abciow12]/.*\|/dev/null\) \zs\%([abciow12]/.*\|/dev/null\)') let dcmd = 'Gdiff!' elseif line('$') == 1 && getline('.') =~ '^\x\{40\}$' @@ -2957,9 +2964,9 @@ function! s:cfile() abort let prefixes.a = myhash.'^:' let prefixes.b = myhash.':' endif - let ref = s:sub(ref, '^\(\w\)/', 'get(prefixes, submatch(1), "HEAD:")') + let ref = substitute(ref, '^\(\w\)/', '\=get(prefixes, submatch(1), "HEAD:")', '') if exists('dref') - let dref = s:sub(dref, '^\(\w\)/', 'get(prefixes, submatch(1), "HEAD:")') + let dref = substitute(dref, '^\(\w\)/', '\=get(prefixes, submatch(1), "HEAD:")', '') endif if ref ==# '/dev/null' diff --git a/sources_non_forked/vim-go/.github/CONTRIBUTING.md b/sources_non_forked/vim-go/.github/CONTRIBUTING.md index 450f9598..eebdd6b5 100644 --- a/sources_non_forked/vim-go/.github/CONTRIBUTING.md +++ b/sources_non_forked/vim-go/.github/CONTRIBUTING.md @@ -1,9 +1,9 @@ Thanks for improving vim-go! Before you dive in please read the following: 1. Please read our - [FAQ](https://github.com/fatih/vim-go/wiki/FAQ-Troubleshooting), it might + [Documentation](https://github.com/fatih/vim-go/blob/master/doc/vim-go.txt), it might have answers for your problem 2. If you add a new feature please don't forget to update the documentation: - [doc/vim-go.txt](https://github.com/fatih/vim-go/blob/master/doc/vim-go.txt) + [doc/vim-go.txt](https://github.com/fatih/vim-go/blob/master/doc/vim-go.txt. 3. If it's a breaking change or exceed +100 lines please open an issue first and describe the changes you want to make. diff --git a/sources_non_forked/vim-go/CHANGELOG.md b/sources_non_forked/vim-go/CHANGELOG.md index 2db6358a..77cbf810 100644 --- a/sources_non_forked/vim-go/CHANGELOG.md +++ b/sources_non_forked/vim-go/CHANGELOG.md @@ -1,12 +1,27 @@ ## unplanned +FEATURES: + +* New `:GoKeyify` command that turns unkeyed struct literals into keyed struct literals. [gh-1258] +* New `g:go_addtags_transform` setting to change the transform rule (snakecase, camelcase, etc..) for `:GoAddTags` command [gh-1275] +* New snippet shortcut assigned to `ife` that expands to `if err := foo(); err != nil { ... }` [gh-1268] + IMPROVEMENTS * :GoMetaLinter can now exclude linters with the new `g:go_metalinter_excludes` option [gh-1253] +* Override `` mapping so `:GoDef` is used by default (as we do the same for `CTRL-]`, `gd`, etc. [gh-1264] BUG FIXES: * job: fix race between channel close and job exit [gh-1247] +* internal: fix system calls when using tcsh [gh-1276] +* path: return the unmodified GOPATH if autodetect is disabled [gh-1280] +* fix jumping to quickfix window when autom gometalinter on save was enabled [gh-1293] + +BACKWARDS INCOMPATIBILITIES: + +* `:GoLint` works on the whole directory instead of the current file. To use it for the current file give it as an argument, i.e `:GoLint foo.go` [gh-1295] +* `go_snippet_case_type` is removed in favor of the new `go_addtags_transform` setting [gh-1299] ## 1.12 - (March 29, 2017) diff --git a/sources_non_forked/vim-go/autoload/go/keyify.vim b/sources_non_forked/vim-go/autoload/go/keyify.vim new file mode 100644 index 00000000..32b30c61 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/keyify.vim @@ -0,0 +1,58 @@ +function! go#keyify#Keyify() + let old_gopath = $GOPATH + let $GOPATH = go#path#Detect() + let bin_path = go#path#CheckBinPath("keyify") + let fname = fnamemodify(expand("%"), ':p:gs?\\?/?') + + if empty(bin_path) || !exists('*json_decode') + let $GOPATH = old_gopath + return + endif + + " Get result of command as json, that contains `start`, `end` and `replacement` + let command = printf("%s -json %s:#%s", bin_path, fname, go#util#OffsetCursor()) + let output = go#util#System(command) + silent! let result = json_decode(output) + + " We want to output the error message in case the result isn't a JSON + if type(result) != type({}) + call go#util#EchoError(s:chomp(output)) + let $GOPATH = old_gopath + return + endif + + " Because keyify returns the byte before the region we want, we goto the + " byte after that + execute "goto" result.start + 1 + let start = getpos('.') + execute "goto" result.end + let end = getpos('.') + + let vis_start = getpos("'<") + let vis_end = getpos("'>") + + " Replace contents between start and end with `replacement` + call setpos("'<", start) + call setpos("'>", end) + + let select = 'gv' + + " Make sure the visual mode is 'v', to avoid some bugs + normal! gv + if mode() !=# 'v' + let select .= 'v' + endif + + silent! execute "normal!" select."\"=result.replacement\p" + + " Replacement text isn't aligned, so it needs fix + normal! '= + + call setpos("'<", vis_start) + call setpos("'>", vis_end) + let $GOPATH = old_gopath +endfunction + +function! s:chomp(string) + return substitute(a:string, '\n\+$', '', '') +endfunction diff --git a/sources_non_forked/vim-go/autoload/go/lint.vim b/sources_non_forked/vim-go/autoload/go/lint.vim index cbc7b337..9c85b47f 100644 --- a/sources_non_forked/vim-go/autoload/go/lint.vim +++ b/sources_non_forked/vim-go/autoload/go/lint.vim @@ -123,12 +123,11 @@ function! go#lint#Golint(...) abort endif if a:0 == 0 - let goargs = shellescape(expand('%')) + let out = go#util#System(bin_path) else - let goargs = go#util#Shelljoin(a:000) + let out = go#util#System(bin_path . " " . go#util#Shelljoin(a:000)) endif - let out = go#util#System(bin_path . " " . goargs) if empty(out) echon "vim-go: " | echohl Function | echon "[lint] PASS" | echohl None return @@ -255,9 +254,13 @@ function s:lint_job(args) caddexpr a:msg let &errorformat = old_errorformat - " TODO(arslan): cursor still jumps to first error even If I don't want - " it. Seems like there is a regression somewhere, but not sure where. + " TODO(jinleileiking): give a configure to jump or not + let l:winnr = winnr() + copen + + exe l:winnr . "wincmd w" + endfunction function! s:exit_cb(job, exitval) closure diff --git a/sources_non_forked/vim-go/autoload/go/path.vim b/sources_non_forked/vim-go/autoload/go/path.vim index 5c1acd91..b34fd429 100644 --- a/sources_non_forked/vim-go/autoload/go/path.vim +++ b/sources_non_forked/vim-go/autoload/go/path.vim @@ -33,22 +33,16 @@ function! go#path#GoPath(...) abort let $GOPATH = a:1 endfunction -" Default returns the default GOPATH. If there is a single GOPATH it returns -" it. For multiple GOPATHS separated with a the OS specific separator, only -" the first one is returned. If GOPATH is not set, it uses the default GOPATH -" set starting with GO 1.8. This GOPATH can be retrieved via 'go env GOPATH' +" Default returns the default GOPATH. If GOPATH is not set, it uses the +" default GOPATH set starting with Go 1.8. This GOPATH can be retrieved via +" 'go env GOPATH' function! go#path#Default() abort if $GOPATH == "" " use default GOPATH via go env return go#util#gopath() endif - let go_paths = split($GOPATH, go#util#PathListSep()) - if len(go_paths) == 1 - return $GOPATH - endif - - return go_paths[0] + return $GOPATH endfunction " HasPath checks whether the given path exists in GOPATH environment variable @@ -134,8 +128,8 @@ function! go#path#BinPath() abort elseif $GOBIN != "" let bin_path = $GOBIN else - " GOPATH (user set or default GO) - let bin_path = expand(go#path#Default() . "/bin/") + let go_paths = split(go#path#Default(), go#util#PathListSep()) + let bin_path = expand(go_paths[0] . "/bin/") endif return bin_path diff --git a/sources_non_forked/vim-go/autoload/go/tags.vim b/sources_non_forked/vim-go/autoload/go/tags.vim index 4ef7d282..fecf52e3 100644 --- a/sources_non_forked/vim-go/autoload/go/tags.vim +++ b/sources_non_forked/vim-go/autoload/go/tags.vim @@ -122,11 +122,13 @@ func s:create_cmd(args) abort let l:offset = a:args.offset let l:mode = a:args.mode let l:cmd_args = a:args.cmd_args + let l:modifytags_transform = get(g:, 'go_addtags_transform', "snakecase") " start constructing the command let cmd = [bin_path] call extend(cmd, ["-format", "json"]) call extend(cmd, ["-file", a:args.fname]) + call extend(cmd, ["-transform", l:modifytags_transform]) if l:offset != 0 call extend(cmd, ["-offset", l:offset]) diff --git a/sources_non_forked/vim-go/autoload/go/util.vim b/sources_non_forked/vim-go/autoload/go/util.vim index 86d0726c..1edc02b4 100644 --- a/sources_non_forked/vim-go/autoload/go/util.vim +++ b/sources_non_forked/vim-go/autoload/go/util.vim @@ -94,19 +94,29 @@ function! go#util#osarch() abort return go#util#goos() . '_' . go#util#goarch() endfunction -" System runs a shell command. It will reset the shell to /bin/sh for Unix-like -" systems if it is executable. +" System runs a shell command. If possible, it will temporary set +" the shell to /bin/sh for Unix-like systems providing a Bourne +" POSIX like environment. function! go#util#System(str, ...) abort + " Preserve original shell and shellredir values let l:shell = &shell + let l:shellredir = &shellredir + + " Use a Bourne POSIX like shell. Some parts of vim-go expect + " commands to be executed using bourne semantics #988 and #1276. + " Alter shellredir to match bourne. Especially important if login shell + " is set to any of the csh or zsh family #1276. if !go#util#IsWin() && executable('/bin/sh') - let &shell = '/bin/sh' + set shell=/bin/sh shellredir=>%s\ 2>&1 endif try let l:output = call('system', [a:str] + a:000) return l:output finally + " Restore original values let &shell = l:shell + let &shellredir = l:shellredir endtry endfunction @@ -203,7 +213,7 @@ endfunction " snippetcase converts the given word to given preferred snippet setting type " case. function! go#util#snippetcase(word) abort - let l:snippet_case = get(g:, 'go_snippet_case_type', "snakecase") + let l:snippet_case = get(g:, 'go_addtags_transform', "snakecase") if l:snippet_case == "snakecase" return go#util#snakecase(a:word) elseif l:snippet_case == "camelcase" @@ -235,51 +245,6 @@ function! go#util#camelcase(word) abort endif endfunction -function! go#util#AddTags(line1, line2, ...) abort - " default is json - let l:keys = ["json"] - if a:0 - let l:keys = a:000 - endif - - let l:line1 = a:line1 - let l:line2 = a:line2 - - " If we're inside a struct and just call this function let us add the tags - " to all fields - " TODO(arslan): I don't like using patterns. Check if we can move it to - " `motion` and do it via AST based position - let ln1 = searchpair('struct {', '', '}', 'bcnW') - if ln1 == 0 - echon "vim-go: " | echohl ErrorMsg | echon "cursor is outside the struct" | echohl None - return - endif - - " searchpair only returns a single position - let ln2 = search('}', "cnW") - - " if no range is given we apply for the whole struct - if l:line1 == l:line2 - let l:line1 = ln1 + 1 - let l:line2 = ln2 - 1 - endif - - for line in range(l:line1, l:line2) - " get the field name (word) that are not part of a commented line - let l:matched = matchstr(getline(line), '\(\/\/.*\)\@ git clone https://github.com/fatih/vim-go.git \ ~/.vim/pack/plugins/start/vim-go @@ -167,7 +167,7 @@ COMMANDS *go-commands* *:GoLint* :GoLint [packages] - Run golint for the current Go file, or for given packages. + Run golint for the current directory, or for given packages. *:GoDoc* :GoDoc [word] @@ -219,14 +219,17 @@ COMMANDS *go-commands* If [!] is not given the first error is jumped to. *:GoDef* -:GoDef +:GoDef gd CTRL-] +g + - Goto declaration/definition for the declaration under the cursor. By default - the CTRL-] key and the mapping `gd` are enabled to invoke :GoDef for the - identifier under the cursor. See |'g:go_def_mapping_enabled'| to disable - them. No explicit arguments are supported. + Goto declaration/definition for the declaration under the cursor. By + default the CTRL-] shortcut, the mapping `gd` and , + g are enabled to invoke :GoDef for the identifier under the + cursor. See |'g:go_def_mapping_enabled'| to disable them. No explicit + arguments are supported. vim-go also keeps a per-window location stack, roughly analogous to how Vim's internal |tags| functionality works. This is pushed to every time a @@ -605,7 +608,7 @@ CTRL-t Changes the build tags for various commands. If you have any file that uses a custom build tag, such as `//+build integration` , this command can be used to pass it to all tools that accepts tags, such as guru, gorenate, - etc.. + etc.. The build tags is cleared (unset) if `""` is given. If no arguments is given it prints the current custom build tags. @@ -742,7 +745,22 @@ CTRL-t Toggles |'g:go_template_autocreate'|. + *:GoKeyify* +:GoKeyify + Uses `keyify` to turn unkeyed struct literals into keyed ones. + + For example: +> + Person{"John", "Smith"} +< + Becomes: +> + Person{ + Name: "John", + Surname: "Smith", + } +< ============================================================================== MAPPINGS *go-mappings* @@ -1128,9 +1146,10 @@ Use this option to define the command to be used for |:GoDef|. By default < *'g:go_def_mapping_enabled'* -Use this option to enable/disable the default mapping of CTRL-] and (`gd`) for -GoDef and CTRL-t for :GoDefPop. Disabling it allows you to map something else -to these keys or mappings. Default is enabled. > +Use this option to enable/disable the default mapping of CTRL-], +, g and (`gd`) for GoDef and CTRL-t for :GoDefPop. +Disabling it allows you to map something else to these keys or mappings. +Default is enabled. > let g:go_def_mapping_enabled = 1 < @@ -1169,28 +1188,6 @@ Use this option to define the default snippet engine. By default "ultisnips" is used. Use "neosnippet" for neosnippet.vim: > let g:go_snippet_engine = "ultisnips" -< - *'g:go_snippet_case_type'* - -Use this option to define the default conversion type of snippet expansion for -field tags. For the following case, if `snakecase` is used the `json` snippet -will expand to: -> - type T struct { - FooBarQuz string `json:"foo_bar_quz" - } -< - -If "camelcase" is used: -> - type T struct { - FooBarQuz string `json:"fooBarQuz" - } -< -By default "snakecase" is used. Current values are: ["snakecase", -"camelcase"]. -> - let g:go_snippet_case_type = "snakecase" < *'g:go_get_update'* @@ -1213,7 +1210,7 @@ set, so the relevant commands defaults are being used. *'g:go_build_tags'* These options that will be automatically passed to the `-tags` option of -various tools, such as `guru`, `gorename`, etc... This is a permanatent +various tools, such as `guru`, `gorename`, etc... This is a permanent setting. A more useful way is to use |:GoBuildTags| to dynamically change or remove build tags. By default it's not set. > @@ -1538,6 +1535,31 @@ default it's 60 seconds. Must be in milliseconds. > let g:go_statusline_duration = 60000 < + + *'g:go_addtags_transform'* + +Sets the `transform` option for `gomodifytags` when using |:GoAddTags| or if +it's being used for snippet expansion of single fields. Possible options are: +`snakecase`, `camelcase`. For the following case, if `snakecase` is used the +field will be transformed to: +> + type T struct { + FooBarQuz string `json:"foo_bar_quz" + } +< + +If "camelcase" is used: +> + type T struct { + FooBarQuz string `json:"fooBarQuz" + } +< +By default "snakecase" is used. Current values are: ["snakecase", +"camelcase"]. +> + let g:go_addtags_transform = 'snakecase' +< + ============================================================================== DEVELOPMENT *go-development* diff --git a/sources_non_forked/vim-go/ftplugin/go.vim b/sources_non_forked/vim-go/ftplugin/go.vim index de830f9c..8ebf4318 100644 --- a/sources_non_forked/vim-go/ftplugin/go.vim +++ b/sources_non_forked/vim-go/ftplugin/go.vim @@ -33,6 +33,8 @@ if get(g:, "go_def_mapping_enabled", 1) " useful again for Go source code nnoremap gd :GoDef nnoremap :GoDef + nnoremap :GoDef + nnoremap g :GoDef nnoremap :call go#def#Jump("split") nnoremap ] :call go#def#Jump("split") nnoremap :call go#def#StackPop(v:count1) diff --git a/sources_non_forked/vim-go/ftplugin/go/commands.vim b/sources_non_forked/vim-go/ftplugin/go/commands.vim index f5357d2a..692d0277 100644 --- a/sources_non_forked/vim-go/ftplugin/go/commands.vim +++ b/sources_non_forked/vim-go/ftplugin/go/commands.vim @@ -92,4 +92,7 @@ command! -nargs=* -buffer -complete=customlist,go#impl#Complete GoImpl call go#i " -- template command! -nargs=0 GoTemplateAutoCreateToggle call go#template#ToggleAutoCreate() +" -- keyify +command! -nargs=0 GoKeyify call go#keyify#Keyify() + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets b/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets index 9db78db1..89e13613 100644 --- a/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets +++ b/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets @@ -143,6 +143,13 @@ else { } endsnippet +# if inline error +snippet ife "If with inline erro" +if err := ${1:condition}; err != nil { + ${0:${VISUAL}} +} +endsnippet + # error snippet snippet errn "Error return " !b if err != nil { diff --git a/sources_non_forked/vim-go/gosnippets/snippets/go.snip b/sources_non_forked/vim-go/gosnippets/snippets/go.snip index 2db20f57..9a480b07 100644 --- a/sources_non_forked/vim-go/gosnippets/snippets/go.snip +++ b/sources_non_forked/vim-go/gosnippets/snippets/go.snip @@ -118,6 +118,14 @@ snippet else else { ${0} } + +# if inline error +snippet ife +abbr if err := ...; err != nil { ... } + if err := ${1:condition}; err != nil { + ${0} + } + # error snippet snippet errn abbr if err != nil { ... } diff --git a/sources_non_forked/vim-go/plugin/go.vim b/sources_non_forked/vim-go/plugin/go.vim index 577c72a9..1eb5c27f 100644 --- a/sources_non_forked/vim-go/plugin/go.vim +++ b/sources_non_forked/vim-go/plugin/go.vim @@ -21,6 +21,7 @@ let s:packages = [ \ "github.com/fatih/gomodifytags", \ "github.com/zmb3/gogetdoc", \ "github.com/josharian/impl", + \ "github.com/dominikh/go-tools/cmd/keyify", \ ] " These commands are available on any filetypes diff --git a/sources_non_forked/vim-markdown/syntax/markdown.vim b/sources_non_forked/vim-markdown/syntax/markdown.vim index 35dd1a36..14d288ba 100644 --- a/sources_non_forked/vim-markdown/syntax/markdown.vim +++ b/sources_non_forked/vim-markdown/syntax/markdown.vim @@ -97,7 +97,7 @@ exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start= syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart -syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*```*.*$" end="^\s*```*\ze\s*$" keepend +syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*````*.*$" end="^\s*````*\ze\s*$" keepend syn match markdownFootnote "\[^[^\]]\+\]" syn match markdownFootnoteDefinition "^\[^[^\]]\+\]:" @@ -108,7 +108,7 @@ if main_syntax ==# 'markdown' if has_key(s:done_include, matchstr(s:type,'[^.]*')) continue endif - exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*```*\s*'.matchstr(s:type,'[^=]*').'\>.*$" end="^\s*```*\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g') + exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*````*\s*'.matchstr(s:type,'[^=]*').'\S\@!.*$" end="^\s*````*\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g') let s:done_include[matchstr(s:type,'[^.]*')] = 1 endfor unlet! s:type diff --git a/sources_non_forked/vim-snippets/UltiSnips/blade.snippets b/sources_non_forked/vim-snippets/UltiSnips/blade.snippets new file mode 100644 index 00000000..e56610c2 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/blade.snippets @@ -0,0 +1,135 @@ +priority -50 + +extends html + +# We want to overwrite everything in parent ft. +priority -49 + +snippet break "@break" +@break +endsnippet + +snippet component "@component directive" +@component('$1') + ${2:${VISUAL}} +@endcomponent +endsnippet + +snippet each "@each directive" +@each('$1', $$2, '$3') +endsnippet + +snippet else "@else directive" +@else +endsnippet + +snippet eif "@else if directive" +@else if ($1) + ${2:${VISUAL}} +endsnippet + +snippet for "@for directive" +@for ($1) + ${2:${VISUAL}} +@endfor +endsnippet + +snippet foreach "@foreach directive" +@foreach ($$1 as $$2) + ${3:${VISUAL}} +@endforeach +endsnippet + +snippet extends "@extends directive" +@extends('$1') +endsnippet + +snippet if "@if directive" +@if ($1) + ${2:${VISUAL}} +@endif +endsnippet + +snippet ife "@if @else structure" +@if ($1) + ${2:${VISUAL}} +@else + ${3:${VISUAL}} +@endif +endsnippet + +snippet include "@include directive" +@include('$1') +endsnippet + +snippet includeIf "@includeIf directive" +@includeIf('$1') +endsnippet + +snippet isset "@isset directive" +@isset + ${1:${VISUAL}} +@endisset +endsnippet + +snippet inject "@inject directive" +@inject('$1', '$2') +endsnippet + +snippet php "@php directive" +@php + ${1:${VISUAL}} +@endphp +endsnippet + +snippet push "@push directive" +@push('$1') + ${2:${VISUAL}} +@endpush +endsnippet + +snippet section "@section directive" +@section('$1') +endsnippet + +snippet show "@show directive" +@show +endsnippet + +snippet slot "@slot directive" +@slot('$1') + ${2:${VISUAL}} +@endslot +endsnippet + +snippet unless "@unless directive" +@unless + ${1:${VISUAL}} +@endunless +endsnippet + +snippet verbatim "@verbatim directive" +@verbatim + ${0:$VISUAL} +@endverbatim +endsnippet + +snippet wh "@while directive" +@while ($1) + ${2:${VISUAL}} +@endwhile +endsnippet + +snippet yield "@yield directive" +@yield('$1') +endsnippet + +snippet { "{{ }} statement." +{{ $1 }} +endsnippet + +snippet {! "{!! !!} statement" +{!! $1 !!} +endsnippet + +# vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/html.snippets b/sources_non_forked/vim-snippets/UltiSnips/html.snippets index 6d98cb1c..04802770 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/html.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/html.snippets @@ -32,6 +32,18 @@ snippet escape "Escape (escape)" ⎋ endsnippet +snippet left "Left (left)" +← +endsnippet + +snippet return "Return (return)" +↩ +endsnippet + +snippet right "Right (right)" +→ +endsnippet + snippet shift "Shift (shift)" ⇧ endsnippet @@ -44,67 +56,103 @@ snippet up "Up (up)" ↑ endsnippet -snippet return "Return (return)" -↩ -endsnippet - -snippet right "Right (right)" -→ -endsnippet - -snippet left "Left (left)" -← -endsnippet - ############# # HTML TAGS # ############# -snippet input "Input with Label" w - +snippet a "Link" w +${4:Anchor Text} endsnippet -snippet input "HTML " w - +snippet abbr "" w +$1 endsnippet - -snippet option "Option" w -${3:$2} +snippet access "accesskey global attribute" +accesskey="$1" endsnippet -snippet select "Select Box" w - +snippet address "
" w +
$1
endsnippet - -snippet textarea "HTML +snippet article "
" +
+ ${1:article content} +
endsnippet -snippet mailto "HTML " w -${3:email me} +snippet aside "