Updated vim plugins

pull/233/merge
amix 7 years ago
parent 50ae0a55f6
commit 75beb5f4ba
  1. 3
      sources_non_forked/ctrlp.vim/autoload/ctrlp.vim
  2. 2
      sources_non_forked/ctrlp.vim/doc/ctrlp.txt
  3. 170
      sources_non_forked/goyo.vim/doc/goyo.txt
  4. 37
      sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE.md
  5. 4
      sources_non_forked/nerdtree/README.markdown
  6. 29
      sources_non_forked/syntastic/autoload/syntastic/preprocess.vim
  7. 112
      sources_non_forked/syntastic/doc/syntastic-checkers.txt
  8. 2
      sources_non_forked/syntastic/plugin/syntastic.vim
  9. 48
      sources_non_forked/syntastic/syntax_checkers/d/dscanner.vim
  10. 41
      sources_non_forked/syntastic/syntax_checkers/dockerfile/hadolint.vim
  11. 43
      sources_non_forked/syntastic/syntax_checkers/solidity/solium.vim
  12. 52
      sources_non_forked/vim-gitgutter/README.mkd
  13. 14
      sources_non_forked/vim-gitgutter/autoload/gitgutter.vim
  14. 8
      sources_non_forked/vim-gitgutter/autoload/gitgutter/async.vim
  15. 4
      sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim
  16. 34
      sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim
  17. 28
      sources_non_forked/vim-gitgutter/autoload/gitgutter/sign.vim
  18. 37
      sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim
  19. 1
      sources_non_forked/vim-gitgutter/doc/gitgutter.txt
  20. 8
      sources_non_forked/vim-go/CHANGELOG.md
  21. 6
      sources_non_forked/vim-go/autoload/go/cmd.vim
  22. 8
      sources_non_forked/vim-go/autoload/go/fmt.vim
  23. 115
      sources_non_forked/vim-go/autoload/go/path.vim
  24. 9
      sources_non_forked/vim-go/doc/vim-go.txt
  25. 12
      sources_non_forked/vim-go/plugin/go.vim
  26. 4
      sources_non_forked/vim-go/syntax/gotexttmpl.vim
  27. 16
      sources_non_forked/vim-indent-object/doc/indent-object.txt
  28. 8
      sources_non_forked/vim-snippets/UltiSnips/cs.snippets
  29. 1
      sources_non_forked/vim-snippets/UltiSnips/vue.snippets
  30. 28
      sources_non_forked/vim-snippets/snippets/c.snippets
  31. 14
      sources_non_forked/vim-snippets/snippets/cpp.snippets
  32. 30
      sources_non_forked/vim-snippets/snippets/erlang.snippets

@ -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

@ -848,7 +848,7 @@ Example: >
When this is set to 1, the <bs> 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

@ -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]<CTRL-W + `>`, `<`, `+`, `-`
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 <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>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:

@ -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?)_
>…

@ -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

@ -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] !=# '{'

@ -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_<option>' variables. The only exception is
'g:syntastic_d_dmd_exec', which can still be used to override the checker's
executable.
------------------------------------------------------------------------------
2. D-Scanner *syntastic-d-dscanner*
Name: dscanner
Maintainer: ANtlord
"D-Scanner" is a tool for analyzing D source code (https://dlang.org/). See
the project's page at GitHub for more information:
https://github.com/Hackerpilot/Dscanner
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 DART *syntastic-checkers-dart*
@ -1934,6 +1951,7 @@ SYNTAX CHECKERS FOR DOCKERFILE *syntastic-checkers-dockerfile*
The following checkers are available for Dockerfile (filetype "dockerfile"):
1. dockerfile-lint..........|syntastic-dockerfile-dockerfile_lint|
2. Hadolint.................|syntastic-dockerfile-hadolint|
------------------------------------------------------------------------------
1. dockerfile-lint *syntastic-dockerfile-dockerfile_lint*
@ -1957,6 +1975,22 @@ Checker options~
This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|.
------------------------------------------------------------------------------
2. Hadolint *syntastic-dockerfile-hadolint*
Name: hadolint
Maintainer: Jesper B. Rosenkilde <jbr@humppa.dk>
"Hadolint" is a dockerfile linter written in Haskell. See the project's page
at GitHub for details:
https://github.com/lukasmartinelli/hadolint
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 DUST *syntastic-checkers-dustjs*
@ -4884,59 +4918,11 @@ SYNTAX CHECKERS FOR R *syntastic-checkers-r*
The following checkers are available for R (filetype "r"):
1. lint.....................|syntastic-r-lint|
2. lintr....................|syntastic-r-lintr|
3. svtools..................|syntastic-r-svtools|
------------------------------------------------------------------------------
1. lint *syntastic-r-lint*
Name: lint
Maintainer: LCD 47 <lcd047@gmail.com>
This is a style checker for R files, using the R package "lint":
http://cran.r-project.org/web/packages/lint/
Checker option~
*'g:syntastic_r_lint_styles'*
Type: string
Default: "lint.style"
R list of style tests to apply.
Set 'g:syntastic_r_lint_styles' to something like this: >
let g:syntastic_r_lint_styles =
\ 'list(spacing.indentation.notabs, spacing.indentation.evenindent)'
<
See "lint"'s manual for possible values:
http://cran.r-project.org/web/packages/lint/lint.pdf
Note~
This checker doesn't call the "makeprgBuild()" function, and thus it ignores
the usual 'g:syntastic_r_lint_<option>' variables. The only exception is
'g:syntastic_r_lint_exec', which can still be used to override the "R"
executable.
Limitations~
The checker uses column numbers only when running into syntax errors. If
you're checking files containing tab characters, then Vim's 'tabstop' must
match R's idea of tabstop, otherwise column numbers will be shifted. At the
time of this writing R's tabstop is hardcoded to 8, so you should probably
add something like this to your vimrc: >
set tabstop=8
<
The "lint" package will only show at most 5 messages of a kind. At the time of
this writing this is not configurable.
Beware also that the checker is pretty slow when using the default style
setting of "lint.style".
1. lintr....................|syntastic-r-lintr|
2. svtools..................|syntastic-r-svtools|
------------------------------------------------------------------------------
2. lintr *syntastic-r-lintr*
1. lintr *syntastic-r-lintr*
Name: lintr
Maintainer: Jim Hester <james.f.hester@gmail.com>
@ -4984,7 +4970,7 @@ executable.
See also: |syntastic-rmd-lintr|.
------------------------------------------------------------------------------
3. svtools *syntastic-r-svtools*
2. svtools *syntastic-r-svtools*
Name: svtools
Maintainer: LCD 47 <lcd047@gmail.com>
@ -5953,6 +5939,7 @@ SYNTAX CHECKERS FOR SOLIDITY *syntastic-checkers-solidity*
The following checkers are available for Solidity (filetype "solidity"):
1. solc.....................|syntastic-solidity-solc|
2. Solium...................|syntastic-solidity-solium|
------------------------------------------------------------------------------
1. solc *syntastic-solidity-solc*
@ -5977,6 +5964,27 @@ You probably also need a plugin to set |filetype| for Solidity files, such as
https://github.com/tomlion/vim-solidity
------------------------------------------------------------------------------
2. Solium *syntastic-solidity-solium*
Name: solium
Maintainer: Matthijs van den Bos <matthijs@vandenbos.org>
"Solium" is a linter for "Solidity" files. See the project's page for details:
https://github.com/duaraghav8/Solium
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 Solidity files, such as
"vim-solidity":
https://github.com/tomlion/vim-solidity
==============================================================================
SYNTAX CHECKERS FOR SQL *syntastic-checkers-sql*

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START
endif
let g:_SYNTASTIC_VERSION = '3.8.0-26'
let g:_SYNTASTIC_VERSION = '3.8.0-35'
lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1

@ -0,0 +1,48 @@
"============================================================================
"File: dscanner.vim
"Description: Syntax checking plugin for syntastic
"Maintainer: ANtlord
"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_d_dscanner_checker')
finish
endif
let g:loaded_syntastic_d_dscanner_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_d_dscanner_GetHighlightRegex(i)
let term = matchstr(a:i['text'], '\m^.\{-}''\zs\S\+\ze''')
return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
endfunction
function! SyntaxCheckers_d_dscanner_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_after': '--report',
\ 'tail': '2>' . syntastic#util#DevNull() })
let errorformat = '%f:%l:%c:%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'dscanner',
\ 'subtype': 'Style',
\ 'returns': [0] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'd',
\ 'name': 'dscanner' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -0,0 +1,41 @@
"============================================================================
"File: hadolint.vim
"Description: Dockerfile linter written in Haskell
" (http://hadolint.lukasmartinelli.ch/).
"Maintainer: Jesper B. Rosenkilde <jbr at humppa dot dk>
"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_dockerfile_hadolint_checker')
finish
endif
let g:loaded_syntastic_dockerfile_hadolint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_dockerfile_hadolint_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat = '%W%f:%l %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'returns': [0, 1] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'dockerfile',
\ 'name': 'hadolint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -0,0 +1,43 @@
"============================================================================
"File: solium.vim
"Description: Solidity syntax checker - using solium
"Maintainer: Matthijs van den Bos <matthijs@vandenbos.org>
"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_solidity_solium_checker')
finish
endif
let g:loaded_syntastic_solidity_solium_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_solidity_solium_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_after': '-R gcc',
\ 'fname_before': '--file'})
let errorformat =
\ '%f:%l:%c: %trror: %m,' .
\ '%f:%l:%c: %tarning: %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'returns': [0, 1] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'solidity',
\ 'name': 'solium'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -427,6 +427,58 @@ Let's say, for example, you want to remove trailing whitespace from all changed
```
#### Cycle through hunks in all buffers
`]c` and `[c` jump from one hunk to the next in the current buffer. You can use this code to jump to the next hunk no matter which buffer it's in.
```viml
function! NextHunkAllBuffers()
let line = line('.')
GitGutterNextHunk
if line('.') != line
return
endif
let bufnr = bufnr('')
while 1
bnext
if bufnr('') == bufnr
return
endif
if !empty(GitGutterGetHunks())
normal! 1G
GitGutterNextHunk
return
endif
endwhile
endfunction
function! PrevHunkAllBuffers()
let line = line('.')
GitGutterPrevHunk
if line('.') != line
return
endif
let bufnr = bufnr('')
while 1
bprevious
if bufnr('') == bufnr
return
endif
if !empty(GitGutterGetHunks())
normal! G
GitGutterPrevHunk
return
endif
endwhile
endfunction
nmap <silent> ]c :call NextHunkAllBuffers()<CR>
nmap <silent> [c :call PrevHunkAllBuffers()<CR>
```
### FAQ
> Why can't I unstage staged changes?

@ -44,7 +44,7 @@ endfunction
function! gitgutter#handle_diff(diff) abort
call gitgutter#debug#log(a:diff)
call setbufvar(gitgutter#utility#bufnr(), 'gitgutter_tracked', 1)
call gitgutter#utility#setbufvar(gitgutter#utility#bufnr(), 'tracked', 1)
call gitgutter#hunk#set_hunks(gitgutter#diff#parse_diff(a:diff))
let modified_lines = gitgutter#diff#process_hunks(gitgutter#hunk#hunks())
@ -209,10 +209,16 @@ function! gitgutter#undo_hunk() abort
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()
" CTRL-Y and CTRL-E treat negative counts as positive counts.
let x = line('w0')
silent edit
let offset = wl - winline()
execute "normal! ".offset."\<C-Y>"
let y = line('w0')
let z = x - y
if z > 0
execute "normal! ".z."\<C-E>"
else
execute "normal! ".z."\<C-Y>"
endif
endif
silent! call repeat#set("\<Plug>GitGutterUndoHunk", -1)<CR>

@ -59,11 +59,7 @@ function! gitgutter#async#execute(cmd) abort
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]
let command = "cmd.exe /c ".a:cmd
else
throw 'unknown os'
endif
@ -79,7 +75,7 @@ function! gitgutter#async#execute(cmd) abort
endfunction
function! gitgutter#async#handle_diff_job_nvim(job_id, data, event) abort
function! gitgutter#async#handle_diff_job_nvim(job_id, data, event) dict abort
call gitgutter#debug#log('job_id: '.a:job_id.', event: '.a:event.', buffer: '.self.buffer)
let job_bufnr = self.buffer

@ -56,7 +56,7 @@ function! gitgutter#diff#run_diff(realtime, preserve_full_diff) abort
let cmd = '('
let bufnr = gitgutter#utility#bufnr()
let tracked = getbufvar(bufnr, 'gitgutter_tracked') " i.e. tracked by git
let tracked = gitgutter#utility#getbufvar(bufnr, 'tracked', 0) " 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?
@ -95,6 +95,7 @@ function! gitgutter#diff#run_diff(realtime, preserve_full_diff) abort
let cmd .= g:gitgutter_git_executable
if s:c_flag
let cmd .= ' -c "diff.autorefreshindex=0"'
let cmd .= ' -c "diff.noprefix=false"'
endif
let cmd .= ' diff --no-ext-diff --no-color -U0 '.g:gitgutter_diff_args.' '
@ -165,7 +166,6 @@ function! gitgutter#diff#parse_hunk(line) abort
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))

@ -1,47 +1,53 @@
let s:hunks = []
function! gitgutter#hunk#set_hunks(hunks) abort
let s:hunks = a:hunks
call gitgutter#utility#setbufvar(gitgutter#utility#bufnr(), 'hunks', a:hunks)
call s:reset_summary()
endfunction
function! gitgutter#hunk#hunks() abort
return s:hunks
return gitgutter#utility#getbufvar(gitgutter#utility#bufnr(), 'hunks', [])
endfunction
function! gitgutter#hunk#reset() abort
call gitgutter#utility#setbufvar(gitgutter#utility#bufnr(), 'hunks', [])
call s:reset_summary()
endfunction
function! gitgutter#hunk#summary(bufnr) abort
return get(getbufvar(a:bufnr,''), 'gitgutter_summary', [0,0,0])
return gitgutter#utility#getbufvar(a:bufnr, 'summary', [0,0,0])
endfunction
function! gitgutter#hunk#reset() abort
call setbufvar(gitgutter#utility#bufnr(), 'gitgutter_summary', [0,0,0])
function! s:reset_summary() abort
call gitgutter#utility#setbufvar(gitgutter#utility#bufnr(), '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)
call gitgutter#utility#setbufvar(bufnr, '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)
call gitgutter#utility#setbufvar(bufnr, '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)
call gitgutter#utility#setbufvar(bufnr, '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
for hunk in gitgutter#hunk#hunks()
if hunk[2] > current_line
let hunk_count += 1
if hunk_count == a:count
@ -58,7 +64,7 @@ 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))
for hunk in reverse(copy(gitgutter#hunk#hunks()))
if hunk[2] < current_line
let hunk_count += 1
if hunk_count == a:count
@ -77,7 +83,7 @@ endfunction
function! gitgutter#hunk#current_hunk() abort
let current_hunk = []
for hunk in s:hunks
for hunk in gitgutter#hunk#hunks()
if gitgutter#hunk#cursor_in_hunk(hunk)
let current_hunk = hunk
break
@ -105,7 +111,7 @@ endfunction
" 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
for hunk in gitgutter#hunk#hunks()
if gitgutter#hunk#cursor_in_hunk(hunk)
break
else

@ -15,9 +15,9 @@ 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')
let sign_ids = map(values(gitgutter#utility#getbufvar(bufnr, 'gitgutter_signs')), 'v:val.id')
call gitgutter#sign#remove_signs(sign_ids, 1)
call setbufvar(bufnr, 'gitgutter_gitgutter_signs', {})
call gitgutter#utility#setbufvar(bufnr, 'gitgutter_signs', {})
endfunction
@ -47,17 +47,17 @@ endfunction
function! gitgutter#sign#add_dummy_sign() abort
let bufnr = gitgutter#utility#bufnr()
if !getbufvar(bufnr, 'gitgutter_dummy_sign')
if !gitgutter#utility#getbufvar(bufnr, 'dummy_sign')
execute "sign place" s:dummy_sign_id "line=" . 9999 "name=GitGutterDummy buffer=" . bufnr
call setbufvar(bufnr, 'gitgutter_dummy_sign', 1)
call gitgutter#utility#setbufvar(bufnr, '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)
if gitgutter#utility#getbufvar(bufnr, '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)
call gitgutter#utility#setbufvar(bufnr, 'dummy_sign', 0)
endif
endfunction
@ -101,9 +101,9 @@ function! gitgutter#sign#find_current_signs() abort
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)
call gitgutter#utility#setbufvar(bufnr, 'dummy_sign', dummy_sign_placed)
call gitgutter#utility#setbufvar(bufnr, 'gitgutter_signs', gitgutter_signs)
call gitgutter#utility#setbufvar(bufnr, 'other_signs', other_signs)
endfunction
@ -113,7 +113,7 @@ function! gitgutter#sign#obsolete_gitgutter_signs_to_remove(new_gitgutter_signs_
let bufnr = gitgutter#utility#bufnr()
let signs_to_remove = [] " list of [<id (number)>, ...]
let remove_all_signs = 1
let old_gitgutter_signs = getbufvar(bufnr, 'gitgutter_gitgutter_signs')
let old_gitgutter_signs = gitgutter#utility#getbufvar(bufnr, '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)
@ -128,8 +128,8 @@ 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')
if a:all_signs && s:supports_star && empty(gitgutter#utility#getbufvar(bufnr, 'other_signs'))
let dummy_sign_present = gitgutter#utility#getbufvar(bufnr, 'dummy_sign')
execute "sign unplace * buffer=" . bufnr
if dummy_sign_present
execute "sign place" s:dummy_sign_id "line=" . 9999 "name=GitGutterDummy buffer=" . bufnr
@ -144,8 +144,8 @@ 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')
let other_signs = gitgutter#utility#getbufvar(bufnr, 'other_signs')
let old_gitgutter_signs = gitgutter#utility#getbufvar(bufnr, 'gitgutter_signs')
for line in a:modified_lines
let line_number = line[0] " <number>

@ -2,6 +2,23 @@ let s:file = ''
let s:using_xolox_shell = -1
let s:exit_code = 0
function! gitgutter#utility#setbufvar(buffer, varname, val)
let dict = get(getbufvar(a:buffer, ''), 'gitgutter', {})
let dict[a:varname] = a:val
call setbufvar(a:buffer, 'gitgutter', dict)
endfunction
function! gitgutter#utility#getbufvar(buffer, varname, ...)
let dict = get(getbufvar(a:buffer, ''), 'gitgutter', {})
if has_key(dict, a:varname)
return dict[a:varname]
else
if a:0
return a:1
endif
endif
endfunction
function! gitgutter#utility#warn(message) abort
echohl WarningMsg
echo 'vim-gitgutter: ' . a:message
@ -10,8 +27,8 @@ function! gitgutter#utility#warn(message) abort
endfunction
function! gitgutter#utility#warn_once(message, key) abort
if empty(getbufvar(s:bufnr, a:key))
call setbufvar(s:bufnr, a:key, '1')
if empty(gitgutter#utility#getbufvar(s:bufnr, a:key))
call gitgutter#utility#setbufvar(s:bufnr, a:key, '1')
echohl WarningMsg
redraw | echo 'vim-gitgutter: ' . a:message
echohl None
@ -92,11 +109,11 @@ function! gitgutter#utility#has_unsaved_changes() abort
endfunction
function! gitgutter#utility#has_fresh_changes() abort
return getbufvar(s:bufnr, 'changedtick') != getbufvar(s:bufnr, 'gitgutter_last_tick')
return getbufvar(s:bufnr, 'changedtick') != gitgutter#utility#getbufvar(s:bufnr, 'last_tick')
endfunction
function! gitgutter#utility#save_last_seen_change() abort
call setbufvar(s:bufnr, 'gitgutter_last_tick', getbufvar(s:bufnr, 'changedtick'))
call gitgutter#utility#setbufvar(s:bufnr, 'last_tick', getbufvar(s:bufnr, 'changedtick'))
endfunction
function! gitgutter#utility#shell_error() abort
@ -136,12 +153,12 @@ function! gitgutter#utility#system(cmd, ...) abort
endfunction
function! gitgutter#utility#file_relative_to_repo_root() abort
let file_path_relative_to_repo_root = getbufvar(s:bufnr, 'gitgutter_repo_relative_path')
let file_path_relative_to_repo_root = gitgutter#utility#getbufvar(s:bufnr, '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)
call gitgutter#utility#setbufvar(s:bufnr, 'repo_relative_path', file_path_relative_to_repo_root)
endif
return file_path_relative_to_repo_root
endfunction
@ -174,14 +191,10 @@ 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)
call system(g:gitgutter_git_executable.' -c foo.bar=baz --version')
return !v:shell_error
endfunction
function! gitgutter#utility#stringify(list) abort

@ -138,6 +138,7 @@ Commands for staging or undoing individual hunks:
:GitGutterPreviewHunk *:GitGutterPreviewHunk*
Preview the hunk the cursor is in.
Use |:pclose| or |CTRL-W_CTRL-Z| to close the preview window.
===============================================================================
5. AUTOCOMMAND *GitGutterAutocmd*

@ -1,5 +1,7 @@
## unplanned
## 1.12 - (March 29, 2017)
FEATURES:
* New `:GoAddTags` and `:GoRemoveTags` command based on the tool
@ -20,6 +22,7 @@ if err != nil {
IMPROVEMENTS:
* vim-go works now even if GOPATH is not set (starting with Go 1.8) [gh-1248]
* Lowercase `<Leader>` 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
@ -27,6 +30,8 @@ IMPROVEMENTS:
* 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]
* Improve docs for :GoDef usage [gh-1242]
* Highlight trimming syntax for Go templates [gh-1235]
BUG FIXES:
@ -44,12 +49,13 @@ BUG FIXES:
* 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]
* Fix `:GoInstall` to accept additional arguments if async mode was enabled [gh-1246]
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]
all new commands such as `gorename` [gh-1232]
* The setting `g:go_guru_tags` is removed in favour of the new setting
`g:go_build_tags` [gh-1232]

@ -177,9 +177,6 @@ function! go#cmd#Install(bang, ...) abort
" expand all wildcards(i.e: '%' to the current file name)
let goargs = map(copy(a:000), "expand(v:val)")
" escape all shell arguments before we pass it to make
let goargs = go#util#Shelllist(goargs, 1)
if get(g:, 'go_echo_command_info', 1)
call go#util#EchoProgress("installing dispatched ...")
endif
@ -221,7 +218,7 @@ function! go#cmd#Install(bang, ...) abort
if !empty(errors) && !a:bang
call go#list#JumpToFirst(l:listtype)
else
call go#util#EchoSuccess("installed to ". $GOPATH)
call go#util#EchoSuccess("installed to ". go#path#Detect())
endif
let $GOPATH = old_gopath
@ -407,7 +404,6 @@ function! go#cmd#Generate(bang, ...) abort
let $GOPATH = old_gopath
endfunction
" ---------------------
" | Vim job callbacks |
" ---------------------

@ -136,6 +136,10 @@ endfunction
" formated.
function! go#fmt#run(bin_name, source, target)
let cmd = s:fmt_cmd(a:bin_name, a:source, a:target)
if empty(cmd)
return
endif
if cmd[0] == "goimports"
" change GOPATH too, so goimports can pick up the correct library
let old_gopath = $GOPATH
@ -162,7 +166,7 @@ function! s:fmt_cmd(bin_name, source, target)
" 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
return []
endif
" start constructing the command
@ -176,7 +180,7 @@ function! s:fmt_cmd(bin_name, source, target)
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))
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

@ -9,35 +9,41 @@ let s:initial_go_path = ""
" GOPATH with it. If two double quotes are passed (the empty string in go),
" it'll clear the GOPATH and will restore to the initial GOPATH.
function! go#path#GoPath(...) abort
" no argument, show GOPATH
if len(a:000) == 0
echo go#path#Detect()
return
endif
" we have an argument, replace GOPATH
if len(a:000)
" clears the current manually set GOPATH and restores it to the
" initial GOPATH, which was set when Vim was started.
if len(a:000) == 1 && a:1 == '""'
if !empty(s:initial_go_path)
let $GOPATH = s:initial_go_path
let s:initial_go_path = ""
endif
echon "vim-go: " | echohl Function | echon "GOPATH restored to ". $GOPATH | echohl None
return
" clears the current manually set GOPATH and restores it to the
" initial GOPATH, which was set when Vim was started.
if len(a:000) == 1 && a:1 == '""'
if !empty(s:initial_go_path)
let $GOPATH = s:initial_go_path
let s:initial_go_path = ""
endif
echon "vim-go: " | echohl Function | echon "GOPATH changed to ". a:1 | echohl None
let s:initial_go_path = $GOPATH
let $GOPATH = a:1
echon "vim-go: " | echohl Function | echon "GOPATH restored to ". $GOPATH | echohl None
return
endif
echo go#path#Detect()
echon "vim-go: " | echohl Function | echon "GOPATH changed to ". a:1 | echohl None
let s:initial_go_path = $GOPATH
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
" 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'
function! go#path#Default() abort
let go_paths = split($GOPATH, go#util#PathListSep())
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
@ -48,7 +54,7 @@ endfunction
" HasPath checks whether the given path exists in GOPATH environment variable
" or not
function! go#path#HasPath(path) abort
let go_paths = split($GOPATH, go#util#PathListSep())
let go_paths = split(go#path#Default(), go#util#PathListSep())
let last_char = strlen(a:path) - 1
" check cases of '/foo/bar/' and '/foo/bar'
@ -70,7 +76,7 @@ endfunction
" over the current GOPATH. It also detects diretories whose are outside
" GOPATH.
function! go#path#Detect() abort
let gopath = $GOPATH
let gopath = go#path#Default()
" don't lookup for godeps if autodetect is disabled.
if !get(g:, "go_autodetect_gopath", 1)
@ -122,57 +128,58 @@ function! go#path#BinPath() abort
let bin_path = ""
" check if our global custom path is set, if not check if $GOBIN is set so
" we can use it, otherwise use $GOPATH + '/bin'
" we can use it, otherwise use default GOPATH
if exists("g:go_bin_path")
let bin_path = g:go_bin_path
elseif $GOBIN != ""
let bin_path = $GOBIN
elseif $GOPATH != ""
let bin_path = expand(go#path#Default() . "/bin/")
else
" could not find anything
endif
else
" GOPATH (user set or default GO)
let bin_path = expand(go#path#Default() . "/bin/")
endif
return bin_path
return bin_path
endfunction
" CheckBinPath checks whether the given binary exists or not and returns the
" path of the binary. It returns an empty string doesn't exists.
function! go#path#CheckBinPath(binpath) abort
" remove whitespaces if user applied something like 'goimports '
let binpath = substitute(a:binpath, '^\s*\(.\{-}\)\s*$', '\1', '')
" save off original path
let old_path = $PATH
" check if we have an appropriate bin_path
let go_bin_path = go#path#BinPath()
if !empty(go_bin_path)
" append our GOBIN and GOPATH paths and be sure they can be found there...
" let us search in our GOBIN and GOPATH paths
let $PATH = go_bin_path . go#util#PathListSep() . $PATH
endif
" remove whitespaces if user applied something like 'goimports '
let binpath = substitute(a:binpath, '^\s*\(.\{-}\)\s*$', '\1', '')
" save off original path
let old_path = $PATH
" check if we have an appropriate bin_path
let go_bin_path = go#path#BinPath()
if !empty(go_bin_path)
" append our GOBIN and GOPATH paths and be sure they can be found there...
" let us search in our GOBIN and GOPATH paths
let $PATH = go_bin_path . go#util#PathListSep() . $PATH
endif
" if it's in PATH just return it
if executable(binpath)
if exists('*exepath')
let binpath = exepath(binpath)
endif
let $PATH = old_path
return binpath
" if it's in PATH just return it
if executable(binpath)
if exists('*exepath')
let binpath = exepath(binpath)
endif
let $PATH = old_path
return binpath
endif
" just get the basename
let basename = fnamemodify(binpath, ":t")
if !executable(basename)
echom "vim-go: could not find '" . basename . "'. Run :GoInstallBinaries to fix it."
" restore back!
let $PATH = old_path
return ""
endif
" just get the basename
let basename = fnamemodify(binpath, ":t")
if !executable(basename)
call go#util#EchoError(printf("could not find '%s'. Run :GoInstallBinaries to fix it", basename))
" restore back!
let $PATH = old_path
return ""
endif
let $PATH = old_path
return go_bin_path . go#util#PathSep() . basename
return go_bin_path . go#util#PathSep() . basename
endfunction
" vim: sw=2 ts=2 et

@ -217,15 +217,14 @@ COMMANDS *go-commands*
If [!] is not given the first error is jumped to.
*:GoDef*
:GoDef [identifier]
:GoDef
gd
CTRL-]
Goto declaration/definition for the given [identifier]. If no argument is
given, it will jump to the declaration under the cursor. By default the
CTRL-] key and the mapping `gd` are enabled to invoke :GoDef for the
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.
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

@ -33,15 +33,15 @@ command! -nargs=? -complete=dir GoPath call go#path#GoPath(<f-args>)
" target instal