Replace YanRing with yank-stack and update plugins

pull/375/head
amix 6 years ago
parent 2ca843a22a
commit 53894de44b
  1. 127
      sources_non_forked/YankRing.vim/README
  2. 1662
      sources_non_forked/YankRing.vim/doc/yankring.txt
  3. 2885
      sources_non_forked/YankRing.vim/plugin/yankring.vim
  4. 31
      sources_non_forked/lightline.vim/autoload/lightline/colorscheme.vim
  5. 7
      sources_non_forked/lightline.vim/autoload/lightline/colorscheme/16color.vim
  6. 4
      sources_non_forked/lightline.vim/autoload/lightline/colorscheme/PaperColor.vim
  7. 4
      sources_non_forked/lightline.vim/autoload/lightline/colorscheme/materia.vim
  8. 4
      sources_non_forked/lightline.vim/autoload/lightline/colorscheme/material.vim
  9. 2
      sources_non_forked/lightline.vim/autoload/lightline/colorscheme/nord.vim
  10. 37
      sources_non_forked/lightline.vim/autoload/lightline/colorscheme/one.vim
  11. 4
      sources_non_forked/lightline.vim/autoload/lightline/colorscheme/solarized.vim
  12. 50
      sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim
  13. 29
      sources_non_forked/nerdtree/lib/nerdtree/ui.vim
  14. 4
      sources_non_forked/vim-coffee-script/syntax/coffee.vim
  15. 6
      sources_non_forked/vim-fugitive/plugin/fugitive.vim
  16. 3
      sources_non_forked/vim-go/.coveragerc
  17. 5
      sources_non_forked/vim-go/.gitignore
  18. 8
      sources_non_forked/vim-go/.travis.yml
  19. 79
      sources_non_forked/vim-go/CHANGELOG.md
  20. 5
      sources_non_forked/vim-go/Dockerfile
  21. 19
      sources_non_forked/vim-go/Makefile
  22. 22
      sources_non_forked/vim-go/autoload/go/cmd.vim
  23. 32
      sources_non_forked/vim-go/autoload/go/complete.vim
  24. 5
      sources_non_forked/vim-go/autoload/go/coverage.vim
  25. 6
      sources_non_forked/vim-go/autoload/go/def.vim
  26. 14
      sources_non_forked/vim-go/autoload/go/doc.vim
  27. 15
      sources_non_forked/vim-go/autoload/go/fmt.vim
  28. 6
      sources_non_forked/vim-go/autoload/go/guru.vim
  29. 26
      sources_non_forked/vim-go/autoload/go/impl.vim
  30. 37
      sources_non_forked/vim-go/autoload/go/impl_test.vim
  31. 14
      sources_non_forked/vim-go/autoload/go/jobcontrol.vim
  32. 5
      sources_non_forked/vim-go/autoload/go/keyify.vim
  33. 2
      sources_non_forked/vim-go/autoload/go/package.vim
  34. 10
      sources_non_forked/vim-go/autoload/go/path.vim
  35. 6
      sources_non_forked/vim-go/autoload/go/rename.vim
  36. 7
      sources_non_forked/vim-go/autoload/go/term.vim
  37. 34
      sources_non_forked/vim-go/autoload/go/test.vim
  38. 8
      sources_non_forked/vim-go/autoload/go/tool.vim
  39. 2
      sources_non_forked/vim-go/autoload/gotest.vim
  40. 86
      sources_non_forked/vim-go/doc/vim-go.txt
  41. 2
      sources_non_forked/vim-go/ftplugin/go/commands.vim
  42. 49
      sources_non_forked/vim-go/ftplugin/go/snippets.vim
  43. 3
      sources_non_forked/vim-go/gosnippets/minisnip/_go_eq
  44. 3
      sources_non_forked/vim-go/gosnippets/minisnip/_go_err
  45. 4
      sources_non_forked/vim-go/gosnippets/minisnip/_go_errt
  46. 3
      sources_non_forked/vim-go/gosnippets/minisnip/_go_errw
  47. 3
      sources_non_forked/vim-go/gosnippets/minisnip/_go_f
  48. 1
      sources_non_forked/vim-go/gosnippets/minisnip/_go_ff
  49. 3
      sources_non_forked/vim-go/gosnippets/minisnip/_go_fori
  50. 2
      sources_non_forked/vim-go/gosnippets/minisnip/_go_pkg
  51. 2
      sources_non_forked/vim-go/gosnippets/minisnip/_go_sp
  52. 17
      sources_non_forked/vim-go/plugin/go.vim
  53. 93
      sources_non_forked/vim-go/rplugin/python3/denite/source/decls.py
  54. 27
      sources_non_forked/vim-go/scripts/run-vim
  55. 28
      sources_non_forked/vim-go/scripts/runtest.vim
  56. 68
      sources_non_forked/vim-go/scripts/test
  57. 36
      sources_non_forked/vim-go/syntax/go.vim
  58. 55
      sources_non_forked/vim-go/test/gopath_test.vim
  59. 4
      sources_non_forked/vim-snippets/UltiSnips/python.snippets
  60. 2
      sources_non_forked/vim-snippets/snippets/python.snippets
  61. 6
      sources_non_forked/vim-snippets/snippets/scala.snippets
  62. 2
      sources_non_forked/vim-yankstack/.gitignore
  63. 4
      sources_non_forked/vim-yankstack/Gemfile
  64. 25
      sources_non_forked/vim-yankstack/Gemfile.lock
  65. 134
      sources_non_forked/vim-yankstack/README.md
  66. 197
      sources_non_forked/vim-yankstack/autoload/yankstack.vim
  67. 124
      sources_non_forked/vim-yankstack/doc/yankstack.txt
  68. 1
      sources_non_forked/vim-yankstack/plugin/yankstack.vim
  69. 115
      sources_non_forked/vim-yankstack/spec/fixtures/repeat.vim
  70. 9
      sources_non_forked/vim-yankstack/spec/spec_helper.rb
  71. 343
      sources_non_forked/vim-yankstack/spec/yankstack/yankstack_spec.rb
  72. 3
      update_plugins.py

@ -1,127 +0,0 @@
This is a mirror of http://www.vim.org/scripts/script.php?script_id=1234
Vim already maintains a list of numbered registers containing the last 9 deletes. These previous deletes can be referenced using [register]p, so "1p will paste the last delete, "2p the 2nd last delete. For more information see |quote_number|.
Vim does not provide any mechanism to reference previous yanked, deleted or changed text. In Emacs this feature is called the "kill ring".
The YankRing plugin allows the user to configure the number of yanked, deleted and changed text. A split window can be used to choose which element(s) from the yankring you wish to paste. Alternately after text has been pasted (using p), it can be replaced with a previous value from the yankring with a single key stroke.
The captured text is stored in a file (location configurable) and is instantly available (also configurable) to any other instance of Vim also running on the same machine. This can especially be useful on *nix machines when you are sshed in running Vim in multiple terminals.
Storing the capture text in a file allows the text to be shared easily between multiple instances of Vim running in X, Windows, SSH or Screen.
A tutorial is included to take you through the various features of the plugin. After you have installed the plugin just run:
:h yankring.txt
:h yankring-tutorial
The yankring can be interacted with in two ways: a GUI or via maps.
The yankring supports all of Vim motions and text-objects. There are very few new keystrokes the user must learn. One keystroke to open the yankring to choose which item to paste is all that is required. It has been designed work seamlessly with Vim
All the mappings and behaviours are configurable via global variables you can optionally specify in your vimrc.
The plugin can be toggled on and off, and supports:
Ranges
Registers
Counts
All visual modes (characterwise, linewise and blockwise)
All motions
All text-objects
Examples:
yy - Adds the current line to the yankring.
dd - Adds the current line to the yankring and deletes it.
5yw - Adds 5 words to the yankring.
"ade - Deletes the word, and puts it into both the yankring and the "a register.
cw - Changes the word and stores the previous value in the yankring.
10"zyy - Places 10 lines into both the yankring and the "z register.
:1,4YRYankRange - Similar to 1,4y
:3,$YRDeleteRange - Similar to 3,$d
If you wish to paste previous values from the yankring and do not want to use the GUI, there are only two additional maps you must learn (these are configurable via your vimrc if needed). The purpose of the yankring is to gain access to previously yanked (or deleted) elements. The YRReplace command will replace the previously pasted text with a different entry from the yankring. By default, I choose <C-P> (P for previous) to replace the text last pasted while moving backwards through your previous text from the yankring and <C-N> (N for next) to replace the previous paste while moving forward through the yankring.
A separate buffer window to allow you to easily interact with the contents of the yankring. The window is similar to many other plugins: TagList, SelectBuf and so on. You can use the mouse or standard Vim keys (p, gp, P, ...). Visual mode is used to support counts, pasting multiple times and reversing the order of pasted elements.
The GUI significantly simplifies your interaction with the yankring for basic functions. But often it useful to take advantage of the more powerful features of the yankring.
Here is a small section from the tutorial (using maps) so you have some idea of how you interact with the plugin gaining access to previous yanks. Using the GUI for basic operations is self explanatory.
:h yankring-tutorial
---- Partial Tutorial ----
To understand how to use the yankring, the following example should demonstrate the various features.
Assume we have this buffer:
one
two
three
four
five
Now yank (yy) each line separately starting at line 1. Display the
contents of the yankring.
:YRShow
--- YankRing ---
Elem Content
5 five^@
4 four^@
3 three^@
2 two^@
1 one^@
Since we yanked the text starting at line 1 and finishing at line 5, the most current yankring element is the last one, the contents of line 5.
"five^@" is displayed, the "^@" is a newline character (since we issued a "yy").
Now, go to the end of the file and press p. The resulting buffer appears as:
one
two
three
four
five
five
Now press <C-P> to move backwards through the yankring, this results in:
one
two
three
four
five
four
Now press 2<C-P>. This would be the same as pressing <C-P> two times in a row. This results in:
one
two
three
four
five
two
Now press <C-N> to move forwards through the yankring, this results in:
one
two
three
four
five
three
You can create a map to display a buffer displaying the yankring's contents:
nnoremap <silent> <F11> :YRShow<CR>
YRShow creates a new split buffer (you can configure where it should be and it's size)
:YRShow
AutoClose=1;Cmds:<enter>,[g]p,[p]P,d,r,a,u,q,<space>;Help=?
--- YankRing ---
Elem Content
3 three^@
2 two^@
1 one^@
5 five^@
4 four^@
You can simply hit "p", <enter>, double click on an item and it will be pasted into your document. The window will automatically close (by default) after you have made a choice. The element will be pasted into the correct buffer if you have multiple split windows.
You can paste multiple items using visual mode.
You can also remove items from the yankring.
---- Partial Tutorial ----
Concentrating on the last line of the buffer you could see how we were able to replace our pasted text with lines yanked previously. This is a feature Vim only has for deletes, and is limited to 9. This plugin enables the same features for both yanks, deletes and changes, the size of the history is configurable.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -2,7 +2,7 @@
" Filename: autoload/lightline/colorscheme.vim
" Author: itchyny
" License: MIT License
" Last Change: 2015/03/18 08:37:17.
" Last Change: 2017/11/29 12:54:05.
" =============================================================================
let s:save_cpo = &cpo
@ -224,5 +224,34 @@ function! lightline#colorscheme#flatten(p) abort
return a:p
endfunction
if has('gui_running')
function! lightline#colorscheme#background() abort
return &background
endfunction
else
" &background is set inappropriately when the colorscheme sets ctermbg of the Normal group
function! lightline#colorscheme#background() abort
let bg_color = synIDattr(synIDtrans(hlID('Normal')), 'bg', 'cterm')
if bg_color !=# ''
if bg_color < 16
return &background
elseif 232 <= bg_color && bg_color < 244
return 'dark'
elseif 244 <= bg_color
return 'light'
endif
endif
let fg_color = synIDattr(synIDtrans(hlID('Normal')), 'fg', 'cterm')
if fg_color !=# ''
if fg_color < 8 || 232 <= fg_color && fg_color < 244
return 'light'
elseif 8 <= fg_color && fg_color < 16 || 244 <= fg_color
return 'dark'
endif
endif
return &background
endfunction
endif
let &cpo = s:save_cpo
unlet s:save_cpo

@ -2,8 +2,9 @@
" Filename: autoload/lightline/colorscheme/16color.vim
" Author: itchyny
" License: MIT License
" Last Change: 2014/01/02 10:04:03.
" Last Change: 2017/11/25 11:14:04.
" =============================================================================
let s:base03 = [ '#808080', 8 ]
let s:base02 = [ '#000000', 0 ]
let s:base01 = [ '#00ff00', 10 ]
@ -20,12 +21,14 @@ let s:violet = [ '#ff00ff', 13 ]
let s:blue = [ '#000080', 4 ]
let s:cyan = [ '#008080', 6 ]
let s:green = [ '#008000', 2 ]
if &background ==# 'light'
if lightline#colorscheme#background() ==# 'light'
let [s:base03, s:base3] = [s:base3, s:base03]
let [s:base02, s:base2] = [s:base2, s:base02]
let [s:base01, s:base1] = [s:base1, s:base01]
let [s:base00, s:base0] = [s:base0, s:base00]
endif
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
let s:p.normal.left = [ [ s:base3, s:blue ], [ s:base3, s:base01 ] ]
let s:p.normal.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ]

@ -2,10 +2,10 @@
" Filename: autoload/lightline/colorscheme/PaperColor.vim
" Author: TKNGUE
" License: MIT License
" Last Change: 2015/07/28 07:35:00.
" Last Change: 2017/11/25 11:13:35.
" =============================================================================
if &background ==# 'light'
if lightline#colorscheme#background() ==# 'light'
let g:lightline#colorscheme#PaperColor#palette = g:lightline#colorscheme#PaperColor_light#palette
else
let g:lightline#colorscheme#PaperColor#palette = g:lightline#colorscheme#PaperColor_dark#palette

@ -2,7 +2,7 @@
" Filename: autoload/lightline/colorscheme/materia.vim
" Author: Lokesh Krishna
" License: MIT License
" Last Change: 2017/10/21 11:32:27.
" Last Change: 2017/11/25 11:13:40.
" =============================================================================
" Common colors
@ -16,7 +16,7 @@ let s:yellow = '#ffcc00'
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
if &background ==# 'light'
if lightline#colorscheme#background() ==# 'light'
" Light variant
let s:bg = '#ffffff'
let s:gray1 = '#2c393f'

@ -2,7 +2,7 @@
" Filename: autoload/lightline/colorscheme/material.vim
" Author: Lokesh Krishna
" License: MIT License
" Last Change: 2017/10/30 16:35:27.
" Last Change: 2017/11/25 11:13:42.
" =============================================================================
" Common colors
@ -16,7 +16,7 @@ let s:yellow = '#ffcb6b'
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
if &background ==# 'light'
if lightline#colorscheme#background() ==# 'light'
" Light variant
let s:bg = '#ffffff'
let s:gray1 = '#2e3c43'

@ -31,7 +31,7 @@ let s:p.normal.warning = [ [ s:nord1, s:nord13 ] ]
let s:p.normal.error = [ [ s:nord1, s:nord11 ] ]
let s:p.inactive.left = [ [ s:nord1, s:nord8 ], [ s:nord5, s:nord1 ] ]
let s:p.inactive.middle = [ [ s:nord5, s:nord0 ] ]
let s:p.inactive.middle = [ [ s:nord5, s:nord1 ] ]
let s:p.inactive.right = [ [ s:nord5, s:nord1 ], [ s:nord5, s:nord1 ] ]
let s:p.insert.left = [ [ s:nord1, s:nord6 ], [ s:nord5, s:nord1 ] ]

@ -2,26 +2,27 @@
" Filename: autoload/lightline/colorscheme/one.vim
" Author: Zoltan Dalmadi
" License: MIT License
" Last Change: 2016/11/2 17:34:27.
" Last Change: 2017/11/28 21:53:01.
" =============================================================================
" Common colors
let s:fg = '#abb2bf'
let s:blue = '#61afef'
let s:green = '#98c379'
let s:purple = '#c678dd'
let s:red1 = '#e06c75'
let s:red2 = '#be5046'
let s:yellow = '#e5c07b'
let s:fg = [ '#abb2bf', 145 ]
let s:blue = [ '#61afef', 75 ]
let s:green = [ '#98c379', 76 ]
let s:purple = [ '#c678dd', 176 ]
let s:red1 = [ '#e06c75', 168 ]
let s:red2 = [ '#be5046', 168 ]
let s:yellow = [ '#e5c07b', 180 ]
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
if &background ==# 'light'
if lightline#colorscheme#background() ==# 'light'
" Light variant
let s:bg = '#fafafa'
let s:gray1 = '#494b53'
let s:gray2 = '#f0f0f0'
let s:gray3 = '#d0d0d0'
let s:bg = [ '#fafafa', 255 ]
let s:gray1 = [ '#494b53', 238 ]
let s:gray2 = [ '#f0f0f0', 255 ]
let s:gray3 = [ '#d0d0d0', 250 ]
let s:green = [ '#98c379', 35 ]
let s:p.normal.left = [ [ s:bg, s:green, 'bold' ], [ s:gray1, s:gray3 ] ]
let s:p.normal.middle = [ [ s:gray1, s:gray2 ] ]
@ -33,10 +34,10 @@ if &background ==# 'light'
let s:p.visual.left = [ [ s:bg, s:purple, 'bold' ], [ s:gray1, s:gray3 ] ]
else
" Dark variant
let s:bg = '#282c34'
let s:gray1 = '#5c6370'
let s:gray2 = '#2c323d'
let s:gray3 = '#3e4452'
let s:bg = [ '#282c34', 235 ]
let s:gray1 = [ '#5c6370', 241 ]
let s:gray2 = [ '#2c323d', 235 ]
let s:gray3 = [ '#3e4452', 240 ]
let s:p.normal.left = [ [ s:bg, s:green, 'bold' ], [ s:fg, s:gray3 ] ]
let s:p.normal.middle = [ [ s:fg, s:gray2 ] ]
@ -60,4 +61,4 @@ let s:p.tabline.tabsel = [ [ s:bg, s:purple, 'bold' ] ]
let s:p.tabline.middle = [ [ s:gray3, s:gray2 ] ]
let s:p.tabline.right = copy(s:p.normal.right)
let g:lightline#colorscheme#one#palette = lightline#colorscheme#fill(s:p)
let g:lightline#colorscheme#one#palette = lightline#colorscheme#flatten(s:p)

@ -2,7 +2,7 @@
" Filename: autoload/lightline/colorscheme/solarized.vim
" Author: itchyny
" License: MIT License
" Last Change: 2016/08/08 10:31:00.
" Last Change: 2017/11/25 11:13:46.
" =============================================================================
let s:cuicolors = {
@ -53,7 +53,7 @@ let s:blue = [ '#268bd2', s:cuicolors.blue[s:cuiindex] ]
let s:cyan = [ '#2aa198', s:cuicolors.cyan[s:cuiindex] ]
let s:green = [ '#859900', s:cuicolors.green[s:cuiindex] ]
if &background ==# 'light'
if lightline#colorscheme#background() ==# 'light'
let [ s:base03, s:base3 ] = [ s:base3, s:base03 ]
let [ s:base02, s:base2 ] = [ s:base2, s:base02 ]
let [ s:base01, s:base1 ] = [ s:base1, s:base01 ]

@ -227,24 +227,30 @@ function! s:closeTreeWindow()
endif
endfunction
" FUNCTION: s:deleteBookmark(bm) {{{1
" if the cursor is on a bookmark, prompt to delete
function! s:deleteBookmark(bm)
echo "Are you sure you wish to delete the bookmark:\n\"" . a:bm.name . "\" (yN):"
" FUNCTION: s:deleteBookmark(bookmark) {{{1
" Prompt the user to confirm the deletion of the selected bookmark.
function! s:deleteBookmark(bookmark)
let l:message = "Delete the bookmark \"" . a:bookmark.name
\ . "\" from the bookmark list?"
if nr2char(getchar()) ==# 'y'
try
call a:bm.delete()
call b:NERDTree.root.refresh()
call b:NERDTree.render()
redraw
catch /^NERDTree/
call nerdtree#echoWarning("Could not remove bookmark")
endtry
else
call nerdtree#echo("delete aborted" )
let l:choices = "&Yes\n&No"
echo | redraw
let l:selection = confirm(l:message, l:choices, 1, 'Warning')
if l:selection != 1
call nerdtree#echo('bookmark not deleted')
return
endif
try
call a:bookmark.delete()
silent call b:NERDTree.root.refresh()
call b:NERDTree.render()
echo | redraw
catch /^NERDTree/
call nerdtree#echoWarning('could not remove bookmark')
endtry
endfunction
" FUNCTION: s:displayHelp() {{{1
@ -255,10 +261,16 @@ function! s:displayHelp()
call b:NERDTree.ui.centerView()
endfunction
" FUNCTION: s:findAndRevealPath() {{{1
function! s:findAndRevealPath()
" FUNCTION: s:findAndRevealPath(path) {{{1
function! s:findAndRevealPath(path)
let l:path = a:path
if empty(l:path)
let l:path = expand('%:p')
endif
try
let p = g:NERDTreePath.New(expand("%:p"))
let p = g:NERDTreePath.New(l:path)
catch /^NERDTree.InvalidArgumentsError/
call nerdtree#echo("no file for the current buffer")
return
@ -581,7 +593,7 @@ function! nerdtree#ui_glue#setupCommands()
command! -n=0 -bar NERDTreeClose :call g:NERDTree.Close()
command! -n=1 -complete=customlist,nerdtree#completeBookmarks -bar NERDTreeFromBookmark call g:NERDTreeCreator.CreateTabTree('<args>')
command! -n=0 -bar NERDTreeMirror call g:NERDTreeCreator.CreateMirror()
command! -n=0 -bar NERDTreeFind call s:findAndRevealPath()
command! -n=? -complete=file -bar NERDTreeFind call s:findAndRevealPath('<args>')
command! -n=0 -bar NERDTreeFocus call NERDTreeFocus()
command! -n=0 -bar NERDTreeCWD call NERDTreeCWD()
endfunction

@ -164,20 +164,14 @@ function! s:UI.getPath(ln)
let indent = self._indentLevelFor(line)
"remove the tree parts and the leading space
let curFile = self._stripMarkup(line, 0)
let wasdir = 0
if curFile =~# '/$'
let wasdir = 1
let curFile = substitute(curFile, '/\?$', '/', "")
endif
let curFile = self._stripMarkup(line)
let dir = ""
let lnum = a:ln
while lnum > 0
let lnum = lnum - 1
let curLine = getline(lnum)
let curLineStripped = self._stripMarkup(curLine, 1)
let curLineStripped = self._stripMarkup(curLine)
"have we reached the top of the tree?
if lnum == rootLine
@ -228,7 +222,7 @@ function! s:UI.getLineNum(file_node)
let indent = self._indentLevelFor(curLine)
if indent ==# curPathComponent
let curLine = self._stripMarkup(curLine, 1)
let curLine = self._stripMarkup(curLine)
let curPath = join(pathcomponents, '/') . '/' . curLine
if stridx(fullpath, curPath, 0) ==# 0
@ -366,14 +360,12 @@ function! s:UI.setShowHidden(val)
let self._showHidden = a:val
endfunction
"FUNCTION: s:UI._stripMarkup(line, removeLeadingSpaces){{{1
"FUNCTION: s:UI._stripMarkup(line){{{1
"returns the given line with all the tree parts stripped off
"
"Args:
"line: the subject line
"removeLeadingSpaces: 1 if leading spaces are to be removed (leading spaces =
"any spaces before the actual text of the node)
function! s:UI._stripMarkup(line, removeLeadingSpaces)
function! s:UI._stripMarkup(line)
let line = a:line
"remove the tree parts and the leading space
let line = substitute (line, g:NERDTreeUI.MarkupReg(),"","")
@ -390,18 +382,7 @@ function! s:UI._stripMarkup(line, removeLeadingSpaces)
"strip off any generic flags
let line = substitute (line, '\[[^]]*\]', "","")
let wasdir = 0
if line =~# '/$'
let wasdir = 1
endif
let line = substitute (line,' -> .*',"","") " remove link to
if wasdir ==# 1
let line = substitute (line, '/\?$', '/', "")
endif
if a:removeLeadingSpaces
let line = substitute (line, '^ *', '', '')
endif
return line
endfunction

@ -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\|await\)\>/
syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\|debugger\|import\|export\|default\|await\)\>/
\ display
" The `own` keyword is only a keyword after `for`.
syn match coffeeKeyword /\<for\s\+own\>/ contained containedin=coffeeRepeat
@ -107,7 +107,7 @@ hi def link coffeeFloat Float
" An error for reserved keywords, taken from the RESERVED array:
" http://coffeescript.org/documentation/docs/lexer.html#section-67
syn match coffeeReservedError /\<\%(case\|default\|function\|var\|void\|with\|const\|let\|enum\|native\|implements\|interface\|package\|private\|protected\|public\|static\)\>/
syn match coffeeReservedError /\<\%(case\|function\|var\|void\|with\|const\|let\|enum\|native\|implements\|interface\|package\|private\|protected\|public\|static\)\>/
\ display
hi def link coffeeReservedError Error

@ -241,7 +241,7 @@ augroup fugitive
autocmd!
autocmd BufNewFile,BufReadPost * call fugitive#detect(expand('%:p'))
autocmd FileType netrw call fugitive#detect(expand('%:p'))
autocmd User NERDTreeInit,NERDTreeNewRoot call fugitive#detect(b:NERDTreeRoot.path.str())
autocmd User NERDTreeInit,NERDTreeNewRoot call fugitive#detect(b:NERDTree.root.path.str())
autocmd VimEnter * if expand('<amatch>')==''|call fugitive#detect(getcwd())|endif
autocmd CmdWinEnter * call fugitive#detect(expand('#:p'))
autocmd BufWinLeave * execute getwinvar(+bufwinnr(+expand('<abuf>')), 'fugitive_leave')
@ -661,7 +661,9 @@ function! s:buffer_expand(rev) dict abort
else
let file = a:rev
endif
return s:sub(s:sub(file,'\%$',self.path()),'\.\@<=/$','')
return s:sub(substitute(file,
\ '%$\|\\\([[:punct:]]\)','\=len(submatch(1)) ? submatch(1) : self.path()','g'),
\ '\.\@<=/$','')
endfunction
function! s:buffer_containing_commit() dict abort

@ -0,0 +1,3 @@
[run]
plugins = covimerage
data_file = .coverage.covimerage

@ -1,2 +1,5 @@
doc/tags
.DS_Store
/doc/tags
/.coverage.covimerage
/coverage.xml
*.pyc

@ -3,12 +3,12 @@ notifications:
email: false
matrix:
include:
- env: SCRIPT=test VIM_VERSION=vim-7.4
- env: SCRIPT=test VIM_VERSION=vim-8.0
- env: SCRIPT=test VIM_VERSION=nvim
- env: SCRIPT="test -c" VIM_VERSION=vim-7.4
- env: SCRIPT="test -c" VIM_VERSION=vim-8.0
- env: SCRIPT="test -c" VIM_VERSION=nvim
- env: SCRIPT=lint VIM_VERSION=vim-8.0
install:
- ./scripts/install-vim $VIM_VERSION
- pip install --user vim-vint
- pip install --user vim-vint covimerage codecov
script:
- ./scripts/$SCRIPT $VIM_VERSION

@ -1,11 +1,43 @@
## unplanned
BACKWARDS INCOMPATIBILITIES:
FEATURES:
* Display a warning for Vim versions older than 7.4.1689. Older versions may
still work, but are not supported. You can use `let g:go_version_warning = 0`
to disable the warning.
[[GH-1524]](https://github.com/fatih/vim-go/pull/1524).
* Add `g:go_doc_url` to change the `godoc` server from `godoc.org` to a custom
private instance. Currently only `godoc -http` instances are supported.
[[GH-1957]](https://github.com/fatih/vim-go/pull/1957).
* New setting `g:go_test_prepend_name` (off by default) to add the failing test
name to the output of `:GoTest`
[[GH-1578]](https://github.com/fatih/vim-go/pull/1578).
* Support [denite.vim](https://github.com/Shougo/denite.nvim) for `:GoDecls[Dir]`
[[GH-1604]](https://github.com/fatih/vim-go/pull/1604).
IMPROVEMENTS:
* `:GoRename` is a bit smarter when automatically pre-filling values, and what
gets pre-filled can be configured with `g:go_gorename_prefill` option.
In addition `:GoRename <Tab>` now lists some common options.
[[GH-1465]](https://github.com/fatih/vim-go/pull/1465).
* Add support for `g:go_build_tags` to the `:GoTest` family of functions.
[[GH-1562]](https://github.com/fatih/vim-go/pull/1562).
* Pass `--tests` to gometalinter when autosaving and when a custom gometalinter
command has not been set.
[[GH-1563]](https://github.com/fatih/vim-go/pull/1563).
* Do not spam messages when command is run in a directory that does not exist.
[[GH-1527]](https://github.com/fatih/vim-go/pull/1527).
* Run `syntax sync fromstart` after `:GoFmt`; this should make syntax
highlighting break slightly less often after formatting code
[[GH-1582]](https://github.com/fatih/vim-go/pull/1582).
* `:GoDescribe` doesn't require a scope anymore
[[GH-1596]](https://github.com/fatih/vim-go/pull/1596).
* Add some standard snippets for
[vim-minisnip](https://github.com/joereynolds/vim-minisnip)
[[GH-1589]](https://github.com/fatih/vim-go/pull/1589).
* `g:go_snippet_engine` now defaults to `automatic` to use the first installed
snippet engine it can find.
[[GH-1589]](https://github.com/fatih/vim-go/pull/1589).
* Make sure temporary files created for `:GoFmt` end with `.go` suffix as this
is required by some Go formatting tools
[[GH-1601]](https://github.com/fatih/vim-go/pull/1601).
BUG FIXES:
@ -23,24 +55,27 @@ BUG FIXES:
[[GH-1535]](https://github.com/fatih/vim-go/pull/1535)
* Fix test output processing to correctly handle panics and log statements.
[[GH-1513]](https://github.com/fatih/vim-go/pull/1513)
* `:GoImpl` tab-completion would sometimes stop working
[[GH-1581]](https://github.com/fatih/vim-go/pull/1581).
* Add `g:go_highlight_function_arguments` to highlight function arguments.
[[GH-1587]](https://github.com/fatih/vim-go/pull/1587).
* Fix installation of `gocode` on MS-Windows.
[[GH-1606]](https://github.com/fatih/vim-go/pull/1606).
IMPROVEMENTS:
BACKWARDS INCOMPATIBILITIES:
* `:GoRename` is a bit smarter when automatically pre-filling values, and what
gets pre-filled can be configured with `g:go_gorename_prefill` option.
In addition `:GoRename <Tab>` now lists some common options.
[[GH-1465]](https://github.com/fatih/vim-go/pull/1465).
* Disable `g:go_autodetect_gopath` by default. [[GH-1461]](https://github.com/fatih/vim-go/pull/1461).
* Add support for `g:go_build_tags` to the `:GoTest` family of functions.
[[GH-1562]](https://github.com/fatih/vim-go/pull/1562).
* Pass `--tests` to gometalinter when autosaving and when a custom gometalinter
command has not been set.
[[GH-1563]](https://github.com/fatih/vim-go/pull/1563).
* Do not spam messages when command is run in a directory that does not exist.
[[GH-1527]](https://github.com/fatih/vim-go/pull/1527).
* New setting `g:go_test_prepend_name` (off by default) to add the failing test
name to the output of `:GoTest`
[[GH-1578]](https://github.com/fatih/vim-go/pull/1578).
* Display a warning for Vim versions older than 7.4.1689. Older versions may
still work, but are not supported. You can use `let g:go_version_warning = 0`
to disable the warning.
[[GH-1524]](https://github.com/fatih/vim-go/pull/1524).
* `g:go_autodetect_gopath` is *disabled* by default, as support for `vendor` has
been in Go for a while.<br>
Also change the implementation for `g:go_autodetect_gopath`; instead of manually
setting it before every command it will now be set with the `BufEnter` event,
and reset with the `BufLeave` event. This means that `$GOPATH` will be
changed for all commands run from Vim.
[[GH-1461]](https://github.com/fatih/vim-go/pull/1461) and
[[GH-1525]](https://github.com/fatih/vim-go/pull/1525).
## 1.15 - (October 3, 2017)
@ -191,8 +226,6 @@ BACKWARDS INCOMPATIBILITIES:
here](https://github.com/fatih/vim-go/issues/1375#issuecomment-317535953)
[[GH-1382]](https://github.com/fatih/vim-go/pull/1382)
## 1.13 - (June 6, 2017)
FEATURES:

@ -1,10 +1,12 @@
FROM golang:1.9.1
FROM golang:1.9.2
RUN apt-get update -y && \
apt-get install -y build-essential curl git libncurses5-dev python3-pip && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN pip3 install vim-vint
RUN useradd -ms /bin/bash -d /vim-go vim-go
USER vim-go
@ -14,6 +16,5 @@ WORKDIR /vim-go
RUN scripts/install-vim vim-7.4
RUN scripts/install-vim vim-8.0
RUN scripts/install-vim nvim
RUN pip3 install vim-vint
ENTRYPOINT ["make"]

@ -1,16 +1,18 @@
VIMS ?= vim-7.4 vim-8.0 nvim
all: install test lint
install:
@echo "==> Installing Vims"
@./scripts/install-vim vim-7.4
@./scripts/install-vim vim-8.0
@./scripts/install-vim nvim
@echo "==> Installing Vims: $(VIMS)"
@for vim in $(VIMS); do \
./scripts/install-vim $$vim; \
done
test:
@echo "==> Running tests"
@./scripts/test vim-7.4
@./scripts/test vim-8.0
@./scripts/test nvim
@echo "==> Running tests for $(VIMS)"
@for vim in $(VIMS); do \
./scripts/test $$vim; \
done
lint:
@echo "==> Running linting tools"
@ -24,5 +26,4 @@ clean:
@echo "==> Cleaning /tmp/vim-go-test"
@rm -rf /tmp/vim-go-test
.PHONY: all test install clean lint docker

@ -41,8 +41,6 @@ function! go#cmd#Build(bang, ...) abort
" Vim 7.4 without async
else
let old_gopath = $GOPATH
let $GOPATH = go#path#Detect()
let default_makeprg = &makeprg
let &makeprg = "go " . join(go#util#Shelllist(args), ' ')
@ -72,7 +70,6 @@ function! go#cmd#Build(bang, ...) abort
endif
let &makeprg = default_makeprg
let $GOPATH = old_gopath
endif
endfunction
@ -125,9 +122,6 @@ function! go#cmd#Run(bang, ...) abort
" anything. Once this is implemented we're going to make :GoRun async
endif
let old_gopath = $GOPATH
let $GOPATH = go#path#Detect()
if go#util#IsWin()
exec '!go run ' . go#util#Shelljoin(go#tool#Files())
if v:shell_error
@ -136,7 +130,6 @@ function! go#cmd#Run(bang, ...) abort
redraws! | echon "vim-go: [run] " | echohl Function | echon "SUCCESS"| echohl None
endif
let $GOPATH = old_gopath
return
endif
@ -165,7 +158,6 @@ function! go#cmd#Run(bang, ...) abort
call go#list#JumpToFirst(l:listtype)
endif
let $GOPATH = old_gopath
let &makeprg = default_makeprg
endfunction
@ -190,8 +182,6 @@ function! go#cmd#Install(bang, ...) abort
return
endif
let old_gopath = $GOPATH
let $GOPATH = go#path#Detect()
let default_makeprg = &makeprg
" :make expands '%' and '#' wildcards, so they must also be escaped
@ -220,10 +210,9 @@ function! go#cmd#Install(bang, ...) abort
if !empty(errors) && !a:bang
call go#list#JumpToFirst(l:listtype)
else
call go#util#EchoSuccess("installed to ". go#path#Detect())
call go#util#EchoSuccess("installed to ". go#path#Default())
endif
let $GOPATH = old_gopath
let &makeprg = default_makeprg
endfunction
@ -231,9 +220,6 @@ endfunction
function! go#cmd#Generate(bang, ...) abort
let default_makeprg = &makeprg
let old_gopath = $GOPATH
let $GOPATH = go#path#Detect()
" :make expands '%' and '#' wildcards, so they must also be escaped
let goargs = go#util#Shelljoin(map(copy(a:000), "expand(v:val)"), 1)
if go#util#ShellError() != 0
@ -264,7 +250,6 @@ function! go#cmd#Generate(bang, ...) abort
endif
let &makeprg = default_makeprg
let $GOPATH = old_gopath
endfunction
" ---------------------
@ -311,10 +296,6 @@ function s:cmd_job(args) abort
\ 'exit_cb': callbacks.exit_cb,
\ }
" modify GOPATH if needed
let old_gopath = $GOPATH
let $GOPATH = go#path#Detect()
" pre start
let dir = getcwd()
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
@ -325,7 +306,6 @@ function s:cmd_job(args) abort
" post start
execute cd . fnameescape(dir)
let $GOPATH = old_gopath
endfunction
" vim: sw=2 ts=2 et

@ -19,25 +19,25 @@ function! s:gocodeCommand(cmd, preargs, args) abort
return
endif
" we might hit cache problems, as gocode doesn't handle well different
" GOPATHS: https://github.com/nsf/gocode/issues/239
let old_gopath = $GOPATH
" We might hit cache problems, as gocode doesn't handle different GOPATHs
" well. See: https://github.com/nsf/gocode/issues/239
let old_goroot = $GOROOT
let $GOPATH = go#path#Detect()
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),
\ join(a:args)
\ )
let result = go#util#System(cmd)
let $GOPATH = old_gopath
let $GOROOT = old_goroot
try
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),
\ join(a:args)
\ )
let result = go#util#System(cmd)
finally
let $GOROOT = old_goroot
endtry
if go#util#ShellError() != 0
return "[\"0\", []]"

@ -300,10 +300,6 @@ function s:coverage_job(args)
\ 'exit_cb': callbacks.exit_cb,
\ }
" modify GOPATH if needed
let old_gopath = $GOPATH
let $GOPATH = go#path#Detect()
" pre start
let dir = getcwd()
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
@ -320,7 +316,6 @@ function s:coverage_job(args)
" post start
execute cd . fnameescape(dir)
let $GOPATH = old_gopath
endfunction
" coverage_callback is called when the coverage execution is finished

@ -2,9 +2,6 @@ let s:go_stack = []
let s:go_stack_level = 0
function! go#def#Jump(mode) abort
let old_gopath = $GOPATH
let $GOPATH = go#path#Detect()
let fname = fnamemodify(expand("%"), ':p:gs?\\?/?')
" so guru right now is slow for some people. previously we were using
@ -22,7 +19,6 @@ function! go#def#Jump(mode) abort
let bin_path = go#path#CheckBinPath("godef")
if empty(bin_path)
let $GOPATH = old_gopath
return
endif
let command = printf("%s -f=%s -o=%s -t", go#util#Shellescape(bin_path),
@ -34,7 +30,6 @@ function! go#def#Jump(mode) abort
elseif bin_name == 'guru'
let bin_path = go#path#CheckBinPath("guru")
if empty(bin_path)
let $GOPATH = old_gopath
return
endif
@ -88,7 +83,6 @@ function! go#def#Jump(mode) abort
endif
call go#def#jump_to_declaration(out, a:mode, bin_name)
let $GOPATH = old_gopath
endfunction
function! s:jump_to_declaration_cb(mode, bin_name, job, exit_status, data) abort

@ -29,7 +29,19 @@ function! go#doc#OpenBrowser(...) abort
let name = out["name"]
let decl = out["decl"]
let godoc_url = "https://godoc.org/" . import
let godoc_url = get(g:, 'go_doc_url', 'https://godoc.org')
if godoc_url isnot 'https://godoc.org'
" strip last '/' character if available
let last_char = strlen(godoc_url) - 1
if godoc_url[last_char] == '/'
let godoc_url = strpart(godoc_url, 0, last_char)
endif
" custom godoc installations expects it
let godoc_url .= "/pkg"
endif
let godoc_url .= "/" . import
if decl !~ "^package"
let godoc_url .= "#" . name
endif

@ -58,7 +58,7 @@ function! go#fmt#Format(withGoimport) abort
endif
" Write current unsaved buffer to a temp file
let l:tmpname = tempname()
let l:tmpname = tempname() . '.go'
call writefile(go#util#GetLines(), l:tmpname)
if go#util#IsWin()
let l:tmpname = tr(l:tmpname, '\', '/')
@ -101,6 +101,9 @@ function! go#fmt#Format(withGoimport) abort
" be smart and jump to the line the new statement was added/removed
call cursor(line('.') + diff_offset, current_col)
" Syntax highlighting breaks less often.
syntax sync fromstart
endfunction
" update_file updates the target file with the given formatted source
@ -158,21 +161,11 @@ function! go#fmt#run(bin_name, source, target)
return
endif
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

@ -212,16 +212,12 @@ 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()
let res = s:async_guru(a:args)
else
let res = s:sync_guru(a:args)
endif
let $GOPATH = old_gopath
return res
endfunction
@ -366,7 +362,7 @@ function! go#guru#DescribeInfo() abort
\ 'mode': 'describe',
\ 'format': 'json',
\ 'selected': -1,
\ 'needs_scope': 1,
\ 'needs_scope': 0,
\ 'custom_parse': function('s:info'),
\ 'disable_progress': 1,
\ }

@ -1,16 +1,11 @@
function! go#impl#Impl(...) abort
let binpath = go#path#CheckBinPath('impl')
if empty(binpath)
return
endif
let recv = ""
let iface = ""
let interactive = 0
let pos = getpos('.')
if a:0 == 0
if a:0 is 0
" Interactive mode if user didn't pass any arguments.
let recv = s:getReceiver()
let iface = input("vim-go: generating method stubs for interface: ")
@ -19,7 +14,7 @@ function! go#impl#Impl(...) abort
call go#util#EchoError('usage: interface type is not provided')
return
endif
elseif a:0 == 1
elseif a:0 is 1
" we assume the user only passed the interface type,
" i.e: ':GoImpl io.Writer'
let recv = s:getReceiver()
@ -41,19 +36,19 @@ function! go#impl#Impl(...) abort
try
let dirname = fnameescape(expand('%:p:h'))
let result = go#util#System(join(go#util#Shelllist([binpath, '-dir', dirname, recv, iface], ' ')))
let [result, err] = go#util#Exec(['impl', '-dir', dirname, recv, iface])
let result = substitute(result, "\n*$", "", "")
if go#util#ShellError() != 0
if err
call go#util#EchoError(result)
return
endif
if result ==# ''
if result is# ''
return
end
put =''
put =result
silent put =result
finally
call setpos('.', pos)
endtry
@ -99,10 +94,6 @@ function! s:root_dirs() abort
endif
let paths = map(split(go#util#env("gopath"), go#util#PathListSep()), "substitute(v:val, '\\\\', '/', 'g')")
if go#util#ShellError()
return []
endif
if !empty(filter(paths, 'isdirectory(v:val)'))
call extend(dirs, paths)
endif
@ -120,11 +111,12 @@ function! s:go_packages(dirs) abort
endfunction
function! s:interface_list(pkg) abort
let contents = split(go#util#System('go doc ' . a:pkg), "\n")
if go#util#ShellError()
let [contents, err] = go#util#Exec(['go', 'doc', a:pkg])
if err
return []
endif
let contents = split(contents, "\n")
call filter(contents, 'v:val =~# ''^type\s\+\h\w*\s\+interface''')
return map(contents, 'a:pkg . "." . matchstr(v:val, ''^type\s\+\zs\h\w*\ze\s\+interface'')')
endfunction

@ -0,0 +1,37 @@
func! Test_impl() abort
try
let l:tmp = gotest#write_file('a/a.go', [
\ 'package a',
\ '',
\ ''])
call go#impl#Impl('r', 'reader', 'io.Reader')
call gotest#assert_buffer(1, [
\ 'func (r reader) Read(p []byte) (n int, err error) {',
\ ' panic("not implemented")',
\ '}'])
finally
call delete(l:tmp, 'rf')
endtry
endfunc
func! Test_impl_get() abort
try
let l:tmp = gotest#write_file('a/a.go', [
\ 'package a',
\ '',
\ 'type reader struct {}'])
call go#impl#Impl('io.Reader')
call gotest#assert_buffer(0, [
\ 'package a',
\ '',
\ 'type reader struct {}',
\ '',
\ 'func (r *reader) Read(p []byte) (n int, err error) {',
\ ' panic("not implemented")',
\ '}'])
finally
call delete(l:tmp, 'rf')
endtry
endfunc

@ -33,10 +33,9 @@ function! go#jobcontrol#RemoveHandler(id) abort
unlet s:handlers[a:id]
endfunction
" spawn spawns a go subcommand with the name and arguments with jobstart. Once
" a job is started a reference will be stored inside s:jobs. spawn changes the
" GOPATH when g:go_autodetect_gopath is enabled. The job is started inside the
" current files folder.
" spawn spawns a go subcommand with the name and arguments with jobstart. Once a
" job is started a reference will be stored inside s:jobs. The job is started
" inside the current files folder.
function! s:spawn(bang, desc, for, args) abort
let status_type = a:args[0]
let status_dir = expand('%:p:h')
@ -65,10 +64,6 @@ function! s:spawn(bang, desc, for, args) abort
\ 'for' : a:for,
\ }
" modify GOPATH if needed
let old_gopath = $GOPATH
let $GOPATH = go#path#Detect()
" execute go build in the files directory
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
@ -94,9 +89,6 @@ function! s:spawn(bang, desc, for, args) abort
execute cd . fnameescape(dir)
" restore back GOPATH
let $GOPATH = old_gopath
return job
endfunction

@ -1,11 +1,8 @@
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
@ -18,7 +15,6 @@ function! go#keyify#Keyify()
" 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
@ -51,7 +47,6 @@ function! go#keyify#Keyify()
call setpos("'<", vis_start)
call setpos("'>", vis_end)
let $GOPATH = old_gopath
endfunction
function! s:chomp(string)

@ -46,7 +46,7 @@ function! go#package#Paths() abort
let dirs += [s:goroot]
endif
let workspaces = split(go#path#Detect(), go#util#PathListSep())
let workspaces = split(go#path#Default(), go#util#PathListSep(