...
 
Commits (17)
  • Dustin L. Howett's avatar
    filetype: msbuild types => xml · 14fa9867
    Dustin L. Howett authored
    14fa9867
  • Dustin L. Howett's avatar
    Squashed 'pack/3rdparty/start/vim-go/' changes from 674d03986..c9d30dab2 · a61d8c21
    Dustin L. Howett authored
    c9d30dab2 Merge pull request #2110 from bhcleek/dry-neovim-adapter
    5aba6a34d DRY out Neovim handling in job.vim
    cbdd07253 update CHANGELOG.md for #2101
    8ddabb11a Merge pull request #2101 from hori-ryota/feature/fix-overriding-metalinter-command
    23409acfa update CHANGELOG.md for #2097
    c893efa64 Merge pull request #2097 from mixedCase/master
    05c08bc13 Check buffer is modifiable before setting fileencoding for asm files
    69cb45e9d Move modifiable check in tmpl creation to caller
    ad160a22c Ignore linters options if metalinter command overridden
    0700a93da Remove path checking for overriding matalinter command
    ead0ef3a1 Merge pull request #2102 from hori-ryota/feature/fix-gometalinter-errformat-comment
    68cc893eb fix gometalinter errformat description comment
    edaf02718 Fix overriding metalinter command (fix #1622)
    9f62a1925 Fix breaking non-modifiable buffers in some cases
    189676476 Merge pull request #2094 from bhcleek/remove-redundant-messages
    a83a86b55 Merge pull request #2093 from bhcleek/template-simplification
    df3747724 Merge pull request #2092 from bhcleek/restore-makeprg-reliably-and-asap
    65580d5ac remove unnecessary messages
    ecefd875b simplify go#template#create()
    7ac9daa74 add tests for code templates
    8ac84e8c8 restore makeprg in finally blocks
    e3627c724 update CHANGELOG.md for #2091
    c2aab49e1 Merge pull request #2082 from andyjack/fallback-needs-cache
    9cae5f144 Merge pull request #2091 from bhcleek/gocode-gomod/overlay
    07e9f27bd use modified buffer as input to gocode-gomod
    30cdcf3c1 Merge pull request #2090 from dhduvall/master
    a85361020 Restore &cpo even when finishing early
    2e1eb6ff7 Merge pull request #2088 from yaojingguo/remove-duplicated-importPath
    8ab8a4265 Remove duplicated l:importPath
    ef278b486 update CHANGELOG.md for #2086
    844e50207 fix sameid toggle
    75df08248 Merge pull request #2086 from 110y/fix-same-ids-toggle
    e7e23372b fix ToggleSameIds that calls SameIds with no args
    65a7c3c2c -fallback-to-source needs gocode cache importer
    3577e475a Merge pull request #2081 from bhcleek/fix-GoDoc
    b8b59edae remove reference to removed function
    c9b5c0905 update CHANGELOG.md for #2075
    7d1ff5899 Merge pull request #2075 from bhcleek/improve-debugger
    823dee0b6 add debug tests
    128e4c6d9 delay changing working directory for dlv test
    9a63383b7 Shutdown and detach from delve correctly
    02a814aaf fix uses of g:go_debug_commands
    d105ea42f use go list to get import path via go#package#FromPath
    d23266dab reset current directory after each test
    8a39d8ed6 Merge pull request #2074 from bhcleek/no-godoc
    418f03393 use go doc instead of godoc
    6cd33f6ae update CHANGELOG.md for #2070
    bde49a252 Merge pull request #2070 from bhcleek/no-godoc
    1d23f776a use go doc instead of godoc
    0ff2a642c set GO111MODULE=off in testing scripts
    78da2bdab update documentation for g:go_debug
    0a3969673 update CHANGELOG.md for #2055 and #2056
    c2fa1a176 Merge pull request #2056 from bhcleek/no-cursor-jump
    93aa011ff teach GoErrCheck how to not jump to first error
    d5428f3e2 teach GoLint how to not jump to first error
    af43efb02 teach GoMetaLinter how to not jump to first error
    6866d086f Merge pull request #2055 from bhcleek/vi-compatible-plugin
    4239c43ba don't spam users when Vim is started with Vi compatibility mode
    192725ad5 update CHANGELOG.md for #2054
    893065a2b Merge pull request #2054 from bhcleek/godef-modified-same-file
    68777e14b fix jumping to definition in modified buffer
    ece854027 remove special case for -fallback-to-source for gocode-mod
    6a17dc376 Merge pull request #2051 from bhcleek/gomod-no-fallback
    f8030c1e7 do not pass unsupported option to gocode-mod
    661e2b21a update docs for Neovim
    7abf54e05 update CHANGELOG.md for #2050
    955a4dfb6 Merge pull request #2050 from bhcleek/change-gococde-propose-source-default
    5a8b52fc0 update CHANGELOG.md for #2048
    5194ee77a update CHANGELOG.md for #2048
    b6fe0ac1c ctrlp: remove references to s:current_dir
    49a99fdfc Merge pull request #2048 from konstantinzolotarev/patch-1
    2c15ddca9 disable proposing source by default
    b6ee5a891 Fix for #2047
    8513febab update CHANGELOG.md for 1.19 release
    0045fb629 update CHANGELOG.md for #2041
    00d57e29b Merge pull request #2041 from cespare/search-bin-path-first
    ca4dd1d9b Add the go_search_bin_path_first option
    ab0eb131a Merge pull request #2037 from bhcleek/gocode/fallback-to-source
    0900c4038 pass -fallback-to-source to gocode
    d5ce080c2 Merge pull request #2032 from bhcleek/fix-go-version-check
    25e8c8720 check for >= go1.11 correctly
    e72b71690 Merge pull request #2030 from naoina/master
    6f577c86e Restore support for unimported packages
    
    git-subtree-dir: pack/3rdparty/start/vim-go
    git-subtree-split: c9d30dab225258c3cbe4b42a947dcf9b5edec18b
    a61d8c21
  • Dustin L. Howett's avatar
    Merge commit 'a61d8c21' · 31b1e5c7
    Dustin L. Howett authored
    31b1e5c7
  • Dustin L. Howett's avatar
    Squashed 'pack/3rdparty/start/vim-snippets/' changes from 936ac5177..9ff16f86e · 2b104c23
    Dustin L. Howett authored
    9ff16f86e Fix rust trait/iter snippet name conflict
    a6090b9bf Revert "Flip Rust assert_equal to match error output"
    ba30ad6ca Flip Rust assert_equal to match error output
    eef99a888 Reintegrate deleted snippets
    7945980e9 Remove un-needed snippets and match CP trigger
    b79fe10b1 Update ember-snippets to Ember v3
    1accde62a Replace lost Rust snippets
    17686c33e Adding kubernetes helm snippets .. (#1088)
    f7c1cd08d jenkins.snippets (#1087)
    539c9a13a  jenkins.snippets minor updates ..
    1ba2120c1  snippets/jenkins.snippets added ..
    97e4ae4fe Merge pull request #1086 from andys8/patch-1
    ce0e93cb1 [Elm] Snippet for describe
    bdefc3d4e 🐛 Re-added some UltiSnips TeX math snippets
    8c66615df Remove/merge duplicate UltiSnip tex math snippets
    06161e65c Merge pull request #1082 from sedrubal/python3-shebang
    37d54451e Remove default file encoding from python3 shebangs
    6fc0f80fe Replace unversioned python shebang with python3 shebang
    
    git-subtree-dir: pack/3rdparty/start/vim-snippets
    git-subtree-split: 9ff16f86ebacb6455058db8aac6b2f3d33d68a7c
    2b104c23
  • Dustin L. Howett's avatar
    Merge commit '2b104c23' · 593644de
    Dustin L. Howett authored
    593644de
  • Dustin L. Howett's avatar
    Squashed 'pack/3rdparty/start/vim-fugitive/' changes from 0fd64f8fb..40e8d0b9f · 4d432f0c
    Dustin L. Howett authored
    40e8d0b9f Support for :Grebase --interactive
    9aef73159 Add rebase summary to :Gstatus
    bad133160 Don't jump from :Gstatus another :Gstatus
    ce3d3df50 Fix maps in commit buffers
    cb18a9665 Do what I mean for :Grebase --autosquash
    b8364709e Refer :Gstatus p users to P
    b9825af3d Fix focus bug on reloading multiple :Gstatus buffers
    08179e186 Declare highlights as defaults
    682b2acda Remove outdated reference to :Gcommit calling :Gstatus
    d41dee9c0 Deprecate fugitive#buffer()
    b66141e25 Open todo file on Grebase --edit-todo
    ae8fed6dd Call Gcommit on Grebase --continue
    085060002 Combine unstaged and untracked files into one section
    86990ef89 Fix - on :Gstatus section headings
    f2b644a60 Set dispatch to :Gfetch in :Gstatus
    a1f9596d2 Add mods support to :Gmerge
    de1f8b5a2 Fix workaround to reload status after :Dispatch
    a32c301f5 Remove :Gcommit claiming :Gstatus window
    261c00986 Change vsplit map from S to gO
    01050c956 Fix :Gstatus error on branch without pull source
    d3468dd09 Prototype new :Gstatus
    d06080ae3 Reload status after dispatch.vim backed :Gpush
    1044e0f12 Fix config case sensitivity when cached
    d4eba8549 Add maps for :Gcommit --fixup/--squash
    b295f49e9 Change :Gstatus U to g|
    d625c5568 Fix erratic conf file type on :Gstatus
    baee3bbfe Prevent bad modeline from blocking a :split
    38c6acf27 Disable modelines while loading blob
    70170d825 Add Gitee link (#1099)
    0f6038881 Handle case sensitivity in config keys correctly
    4ecd7e893 Allow reusing dictionary for config queries
    73220820b Don't open :Gstatus on empty :Gcommit
    5540d257e Add s and u aliases for stage/unstage in :Gstatus
    d48fc4a5e Cache config queries
    c98daaacf Refactor :Gstatus reload cursor positioning
    e8f4f28c9 Replace deprecated repository relative path syntax
    da3b2f328 Support tab local working directories
    2564c37d0 fugitive.vim 2.5
    c316b924e Provide FugitivePrepare()
    7a190ead8 Remove transitional functions
    e48cf2dad Gblame: allow passing `--first-parent`
    6d497b0e6 Fix erroneous use of :keeppatterns g/.../s//.../
    dcf32d2b3 Clearer errors
    
    git-subtree-dir: pack/3rdparty/start/vim-fugitive
    git-subtree-split: 40e8d0b9f02b3948df0127055a26e6d6996ff129
    4d432f0c
  • Dustin L. Howett's avatar
    Merge commit '4d432f0c' · 700e0054
    Dustin L. Howett authored
    700e0054
  • Dustin L. Howett's avatar
    Squashed 'pack/3rdparty/start/vim-pathogen/' changes from 06da92160..e9fb0914d · 4c426e71
    Dustin L. Howett authored
    e9fb0914d Soften deprecation warning to dampen chicken little reaction
    24f5cdd80 Add a deprecation notice
    
    git-subtree-dir: pack/3rdparty/start/vim-pathogen
    git-subtree-split: e9fb0914dba5bdfe2feaa364dda2e9495c5620a2
    4c426e71
  • Dustin L. Howett's avatar
    Merge commit '4c426e71' · 5acccde7
    Dustin L. Howett authored
    5acccde7
  • Dustin L. Howett's avatar
    Squashed 'pack/3rdparty/start/vim-abolish/' changes from 9a0e96d35..b95463a1c · e1b51817
    Dustin L. Howett authored
    b95463a1c Add visual mode plug map
    33bac1b68 Support :Abolish {a,b} c
    56a76a8c1 Fix the `cr` mapping (#71)
    
    git-subtree-dir: pack/3rdparty/start/vim-abolish
    git-subtree-split: b95463a1cffd8fc9aff2a1ff0ae9327944948699
    e1b51817
  • Dustin L. Howett's avatar
    Merge commit 'e1b51817' · e174f5aa
    Dustin L. Howett authored
    e174f5aa
  • Dustin L. Howett's avatar
    Squashed 'pack/3rdparty/start/vim-speeddating/' changes from a41866779..799cd3473 · fb3ae529
    Dustin L. Howett authored
    799cd3473 Add Vim 8 package installation instructions
    
    git-subtree-dir: pack/3rdparty/start/vim-speeddating
    git-subtree-split: 799cd3473bc64adcb6b556bf349f549570666b62
    fb3ae529
  • Dustin L. Howett's avatar
    Merge commit 'fb3ae529' · ff6bf695
    Dustin L. Howett authored
    ff6bf695
  • Dustin L. Howett's avatar
    Squashed 'pack/3rdparty/start/ctrlp/' changes from ebc568c39..e953ee7a8 · 9df2e06b
    Dustin L. Howett authored
    e953ee7a8 Merge pull request #488 from ezequielv/dev_ezequielv-fix-issue_upstream-0463-nosyntaxhl_when_opening-01_01-upstream_01
    5e40e555d Merge pull request #489 from ctrlpvim/fix-487
    017bd686e Fix #487
    6d0a49df0 Split ctrlp#setlines() for ctrlp#init().  Fixes ctrlpvim/ctrlp.vim#463
    
    git-subtree-dir: pack/3rdparty/start/ctrlp
    git-subtree-split: e953ee7a80dc96cd00c20ed6fe82e0e817d977ff
    9df2e06b
  • Dustin L. Howett's avatar
    Merge commit '9df2e06b' · 332d6d61
    Dustin L. Howett authored
    332d6d61
  • Dustin L. Howett's avatar
    Squashed 'pack/3rdparty/start/neocomplete/' changes from 4be617947..d3b4d2860 · 030ff7de
    Dustin L. Howett authored
    d3b4d2860 Merge pull request #608 from jsit/bugfix/607
    42a3616c4 Remove final colons from CSS, Stylus, SCSS, Less keyword patterns Closes #607
    
    git-subtree-dir: pack/3rdparty/start/neocomplete
    git-subtree-split: d3b4d2860ec34648a2d6df4631718a6a7cfa5d40
    030ff7de
  • Dustin L. Howett's avatar
    Merge commit '030ff7de' · b32ff354
    Dustin L. Howett authored
    b32ff354
......@@ -9,5 +9,6 @@ augroup filetypedetect
au BufNewFile,BufRead *.zshrc setf zsh
au BufNewFile,BufRead *.md setf markdown
au BufNewFile,BufRead *.tmpl setf gohtmltmpl
au BufNewFile,BufRead *.*proj,*.props,*.targets setf xml
augroup END
"
......@@ -2015,7 +2015,7 @@ fu! s:bufnrfilpath(line)
let filpath = s:dyncwd.s:lash().a:line
en
let filpath = fnamemodify(filpath, ':p')
let bufnr = bufnr('^'.filpath.'$')
let bufnr = bufnr('^'.fnameescape(filpath).'$')
if (!filereadable(filpath) && bufnr < 1)
if (a:line =~ '[\/]\?\[\d\+\*No Name\]$')
let bufnr = str2nr(matchstr(a:line, '[\/]\?\[\zs\d\+\ze\*No Name\]$'))
......@@ -2567,9 +2567,13 @@ fu! ctrlp#getvar(var)
endf
"}}}1
" * Initialization {{{1
fu! ctrlp#setlines(...)
fu! s:setlines_pre(...)
if a:0 | let s:itemtype = a:1 | en
cal s:modevar()
let g:ctrlp_lines = []
endf
fu! s:setlines_post()
let inits = {'fil': 'ctrlp#files()', 'buf': 'ctrlp#buffers()', 'mru': 'ctrlp#mrufiles#list()'}
let types = map(copy(g:ctrlp_types), 'inits[v:val]')
if !empty(g:ctrlp_ext_vars)
......@@ -2578,6 +2582,11 @@ fu! ctrlp#setlines(...)
let g:ctrlp_lines = eval(types[s:itemtype])
endf
fu! ctrlp#setlines(...)
cal call('s:setlines_pre', a:000)
cal s:setlines_post()
endf
" Returns [lname, sname]
fu! s:CurTypeName()
if s:itemtype < len(s:coretypes)
......@@ -2632,8 +2641,16 @@ fu! ctrlp#init(type, ...)
retu
en
en
cal ctrlp#setlines(s:settype(type))
" Fixed issue ctrlpvim/ctrlp.vim#463 : Opening 'ctrlp' in certain modes
" (':CtrlPBufTag', ':CtrlPLine') seems to trigger a partially deffective
" intialisation (for example, syntax highlighting not working as expected).
" Fix: ctrlp#setlines() split in two, as the second part (now in
" s:setlines_post()) seems to need '&filetype', and s:DetectFileType() seems
" to need the first part of the old ctrlp#setlines() (now in
" s:setlines_pre()).
cal s:setlines_pre(s:settype(type))
let &filetype = s:DetectFileType(type, &filetype)
cal s:setlines_post()
cal ctrlp#syntax()
cal s:SetDefTxt()
let curName = s:CurTypeName()
......
......@@ -262,7 +262,7 @@ function! neocomplete#init#_variables() abort "{{{
call neocomplete#util#set_default_dictionary(
\'g:neocomplete#keyword_patterns',
\'css,stylus,scss,less',
\'[@#.]\?[[:alpha:]_:-][[:alnum:]_:-]*')
\'[@#.]\?[[:alpha:]_-][[:alnum:]_-]*')
call neocomplete#util#set_default_dictionary(
\'g:neocomplete#keyword_patterns',
\'tags',
......
......@@ -527,7 +527,7 @@ function! s:commands.abbrev.process(bang,line1,line2,count,args)
let cmd = cmd . " <buffer>"
endif
let [bad, good] = s:badgood(a:args)
if substitute(bad,'{.\{-\}.}','','g') !~ '^\k\+$'
if substitute(bad, '[{},]', '', 'g') !~# '^\k*$'
call s:throw("E474: Invalid argument (not a keyword: ".string(bad).")")
endif
if !self.options.delete && good == ""
......@@ -620,13 +620,14 @@ function! s:coerce(type) abort
endtry
endfunction
nnoremap <expr> <Plug>(abolish-coerce) <SID>coerce(nr2char(getchar())).'iw'
nnoremap <expr> <Plug>Coerce <SID>coerce(nr2char(getchar())).'iw'
nnoremap <expr> <Plug>(abolish-coerce) <SID>coerce(nr2char(getchar()))
nnoremap <expr> <Plug>(abolish-coerce) <SID>coerce(nr2char(getchar()))
nnoremap <expr> <plug>(abolish-coerce-word) <sid>coerce(nr2char(getchar())).'iw'
" }}}1
if !exists("g:abolish_no_mappings") || ! g:abolish_no_mappings
nmap cr <Plug>(abolish-coerce)iw
nmap cr <Plug>(abolish-coerce-word)
endif
command! -nargs=+ -bang -bar -range=0 -complete=custom,s:Complete Abolish
......
......@@ -39,11 +39,13 @@ making it like `git add` when called from a work tree file and like
Use `:Gbrowse` to open the current file on the web front-end of your favorite
hosting provider, with optional line range (try it in visual mode!). Plugins
are available for popular providers such as [GitHub][rhubarb.vim],
[GitLab][fugitive-gitlab.vim], and [Bitbucket][fubitive.vim].
[GitLab][fugitive-gitlab.vim], [Bitbucket][fubitive.vim],
and [Gitee][fugitive-gitee.vim].
[rhubarb.vim]: https://github.com/tpope/vim-rhubarb
[fugitive-gitlab.vim]: https://github.com/shumphrey/fugitive-gitlab.vim
[fubitive.vim]: https://github.com/tommcdo/vim-fubitive
[fugitive-gitee.vim]: https://github.com/linuxsuren/fugitive-gitee.vim
Add `%{FugitiveStatusline()}` to `'statusline'` to get an indicator
with the current branch in (surprise!) your statusline.
......
......@@ -47,35 +47,37 @@ that are part of Git repositories).
cw |:Gcommit| --amend --only
cva |:Gcommit| --verbose --amend
cvc |:Gcommit| --verbose
cf |:Gcommit| --fixup=
cs |:Gcommit| --squash=
cA |:Gcommit| --edit --squash=
D |:Gdiff|
ds |:Gsdiff|
dp |:Git!| diff (p for patch; use :Gw to apply)
dp |:Git| add --intent-to-add (untracked files)
dv |:Gvdiff|
gO |:Gvsplit|
g| |:Git| checkout
g| |:Git| checkout HEAD (staged files)
g| |:Git| clean (untracked files)
g| |:Git| rm (unmerged files)
O |:Gtabedit|
o |:Gsplit|
P |:Git| add --patch
P |:Git| reset --patch (staged files)
q close status
r reload status
S |:Gvsplit|
U |:Git| checkout
U |:Git| checkout HEAD (staged files)
U |:Git| clean (untracked files)
U |:Git| rm (unmerged files)
. enter |:| command line with file prepopulated
*fugitive-:Gcommit*
:Gcommit [args] A wrapper around git-commit. If there is nothing
to commit, |:Gstatus| is called instead. Unless the
arguments given would skip the invocation of an editor
(e.g., -m), a split window will be used to obtain a
commit message, or a new tab if -v is given. Write
and close that window (:wq or |:Gwrite|) to finish the
commit. Unlike when running the actual git-commit
command, it is possible (but unadvisable) to alter the
index with commands like git-add and git-reset while a
commit message is pending.
:Gcommit [args] A wrapper around git-commit. Unless the arguments
given would skip the invocation of an editor (e.g.,
-m), a split window will be used to obtain a commit
message, or a new tab if -v is given. Write and close
that window (:wq or |:Gwrite|) to finish the commit.
Unlike when running the actual git-commit command, it
is possible (but unadvisable) to alter the index with
commands like git-add and git-reset while a commit
message is pending.
*fugitive-:Gmerge*
:Gmerge [args] Calls git-merge and loads errors and conflicted files
......@@ -90,7 +92,7 @@ that are part of Git repositories).
*fugitive-:Grebase*
:Grebase [args] Like |:Gmerge|, but for git-rebase. Interactive
rebase not supported.
rebase is experimentally supported.
*fugitive-:Gpush*
:Gpush [args] Invoke git-push, load the results into the |quickfix|
......@@ -284,8 +286,8 @@ These maps are available in committed Git objects.
o Jump to the |fugitive-object| under the cursor in a
new split.
*fugitive-S*
S Jump to the |fugitive-object| under the cursor in a
*fugitive-gO*
gO Jump to the |fugitive-object| under the cursor in a
new vertical split.
*fugitive-O*
......
" fugitive.vim - A Git wrapper so awesome, it should be illegal
" Maintainer: Tim Pope <http://tpo.pe/>
" Version: 2.4
" Version: 2.5
" GetLatestVimScripts: 2975 1 :AutoInstall: fugitive.vim
if exists('g:loaded_fugitive')
......@@ -68,8 +68,18 @@ function! FugitiveParse(...) abort
throw v:errmsg
endfunction
function! FugitiveConfig(key, ...) abort
return fugitive#Config(a:key, FugitiveGitDir(a:0 ? a:1 : -1))
function! FugitivePrepare(...) abort
return call('fugitive#Prepare', a:000)
endfunction
function! FugitiveConfig(...) abort
if a:0 == 2 && type(a:2) != type({})
return fugitive#Config(a:1, FugitiveGitDir(a:2))
elseif a:0 == 1 && a:1 !~# '^[[:alnum:]-]\+\.'
return fugitive#Config(FugitiveGitDir(a:1))
else
return call('fugitive#Config', a:000)
endif
endfunction
function! FugitiveRemoteUrl(...) abort
......@@ -205,14 +215,6 @@ function! FugitiveDetect(path) abort
endif
endfunction
function! FugitiveRoute(...) abort
return call('FugitiveFind', a:000)
endfunction
function! FugitiveGenerate(...) abort
throw 'Use FugitiveFind() instead'
endfunction
function! s:Slash(path) abort
if exists('+shellslash')
return tr(a:path, '\', '/')
......@@ -254,6 +256,10 @@ augroup fugitive
\ call fugitive#MapCfile() |
\ endif
autocmd FileType gitcommit
\ if exists('b:git_dir') |
\ call fugitive#MapCfile('fugitive#MessageCfile()') |
\ endif
autocmd FileType fugitive
\ if exists('b:git_dir') |
\ call fugitive#MapCfile('fugitive#StatusCfile()') |
\ endif
......
if exists("b:current_syntax")
finish
endif
syn sync fromstart
syn spell notoplevel
syn include @fugitiveDiff syntax/diff.vim
syn match fugitiveHeader /^[A-Z][a-z][^:]*:/ nextgroup=fugitiveHash,fugitiveSymbolicRef skipwhite
syn region fugitiveSection start=/^\%(.*(\d\+)$\)\@=/ contains=fugitiveHeading end=/^$\@=/
syn match fugitiveHeading /^[A-Z][a-z][^:]*\ze (\d\+)$/ contains=fugitivePreposition contained nextgroup=fugitiveCount skipwhite
syn match fugitiveCount /(\d\+)/hs=s+1,he=e-1 contained
syn match fugitivePreposition /\<\%([io]nto\|from\|to\|Rebasing\%( detached\)\=\)\>/ transparent contained nextgroup=fugitiveHash,fugitiveSymbolicRef skipwhite
syn match fugitiveInstruction /^\l\l\+\>/ contained containedin=fugitiveSection nextgroup=fugitiveHash skipwhite
syn match fugitiveDone /^done\>/ contained containedin=fugitiveSection nextgroup=fugitiveHash skipwhite
syn match fugitiveStop /^stop\>/ contained containedin=fugitiveSection nextgroup=fugitiveHash skipwhite
syn match fugitiveModifier /^[MADRCU?]\{1,2} / contained containedin=fugitiveSection
syn match FugitiveSymbolicRef /\.\@!\%(\.\.\@!\|[^[:space:][:cntrl:]\:.]\)\+\.\@<!/ contained
syn match fugitiveHash /^\x\{4,\}\>/ contained containedin=fugitiveSection
syn match fugitiveHash /\<\x\{4,\}\>/ contained
syn region fugitiveHunk start=/^\%(@@ -\)\@=/ end=/^\%(diff --\%(git\|cc\|combined\) \|@@\|$\)\@=/ contains=@fugitiveDiff containedin=fugitiveSection fold
hi def link fugitiveHeader Label
hi def link fugitiveHeading PreProc
hi def link fugitiveModifier Type
hi def link fugitiveInstruction Type
hi def link fugitiveStop Function
hi def link fugitiveHash Identifier
hi def link fugitiveSymbolicRef Function
hi def link fugitiveCount Number
let b:current_syntax = "fugitive"
## unplanned
IMPROVEMENTS:
* Disable `g:go_gocode_propose_source` by default.
[[GH-2050]](https://github.com/fatih/vim-go/pull/2050)
* Don't spam users when Vim is run with vi compatibility.
[[GH-2055]](https://github.com/fatih/vim-go/pull/2055)
* Add bang support to lint commands to allow them to be run without jumping to
errors.
[[GH-2056]](https://github.com/fatih/vim-go/pull/2056)
* Use `go doc` for `:GoDoc` instead of `godoc`.
[[GH-2070]](https://github.com/fatih/vim-go/pull/2070)
* Detach from and shutdown dlv correctly.
[[GH-2075]](https://github.com/fatih/vim-go/pull/2075)
* Do not require `'autowrite'` or `'autowriteall'` to be set when using
autocompletion in module mode.
[[GH-2091]](https://github.com/fatih/vim-go/pull/2091)
* Fix use of g:go_metalinter_command _and_ apply it even when autosaving.
[[GH-2101]](https://github.com/fatih/vim-go/pull/2101)
BUG FIXES:
* Fix opening of non-existent file from `:GoDeclsDir` when the current
directory is not the directory containing the current buffer.
[[GH-2048]](https://github.com/fatih/vim-go/pull/2048)
* Fix jumping to an identifier with godef from a modified buffer.
[[GH-2054]](https://github.com/fatih/vim-go/pull/2054)
* Fix errors when `g:go_debug` contains `debugger-commands`.
[[GH-2075]](https://github.com/fatih/vim-go/pull/2075)
* Fix errors from `:GoDebugStop` in Neovim.
[[GH-2075]](https://github.com/fatih/vim-go/pull/2075)
* Fix `:GoSameIdsToggle`.
[[GH-2086]](https://github.com/fatih/vim-go/pull/2086)
* Do not set fileencoding or fileformat options or populate from template when
the buffer is not modifiable.
[[GH-2097]](https://github.com/fatih/vim-go/pull/2097)
## 1.19 - (November 4, 2018)
FEATURES:
* **go.mod file support!** This is the first feature for upcoming Go modules
......@@ -64,7 +100,8 @@ IMPROVEMENTS:
[[GH-2025]](https://github.com/fatih/vim-go/pull/2025)
* Update autocompletion to work with Go modules.
[[GH-1988]](https://github.com/fatih/vim-go/pull/1988)
* Add an option to search $GOPATH/bin or $GOBIN _after_ $PATH.
[[GH-2041]](https://github.com/fatih/vim-go/pull/2041)
BUG FIXES:
* Fix `:GoRun %` on Windows.
......
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
let s:go_decls_var = {
\ 'init': 'ctrlp#decls#init()',
\ 'exit': 'ctrlp#decls#exit()',
......@@ -20,7 +24,7 @@ function! ctrlp#decls#init() abort
endfunction
function! ctrlp#decls#exit() abort
unlet! s:decls s:current_dir s:target
unlet! s:decls s:target
endfunction
" The action to perform on the selected string
......@@ -32,10 +36,6 @@ function! ctrlp#decls#accept(mode, str) abort
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
let dir = getcwd()
try
" we jump to the file directory so we can get the fullpath via fnamemodify
" below
execute cd . s:current_dir
let vals = matchlist(a:str, '|\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)|')
" i.e: main.go
......@@ -50,14 +50,10 @@ function! ctrlp#decls#accept(mode, str) abort
call ctrlp#acceptfile(a:mode, filepath)
call cursor(line, col)
silent! norm! zvzz
finally
"jump back to old dir
execute cd . fnameescape(dir)
endtry
endfunction
function! ctrlp#decls#enter() abort
let s:current_dir = fnameescape(expand('%:p:h'))
let s:decls = []
let l:cmd = ['motion',
......@@ -117,7 +113,7 @@ function! ctrlp#decls#enter() abort
call add(s:decls, printf("%s\t%s |%s:%s:%s|\t%s",
\ decl.ident . space,
\ decl.keyword,
\ fnamemodify(decl.filename, ":."),
\ fnamemodify(decl.filename, ":p"),
\ decl.line,
\ decl.col,
\ decl.full,
......@@ -151,4 +147,8 @@ function! ctrlp#decls#cmd(mode, ...) abort
return s:id
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
function! s:code(group, attr) abort
let code = synIDattr(synIDtrans(hlID(a:group)), a:attr, "cterm")
if code =~ '^[0-9]\+$'
......@@ -146,4 +150,8 @@ function! fzf#decls#cmd(...) abort
\ }))
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
" Test alternates between the implementation of code and the test code.
function! go#alternate#Switch(bang, cmd) abort
let file = expand('%')
......@@ -24,4 +28,8 @@ function! go#alternate#Switch(bang, cmd) abort
endif
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
......@@ -15,6 +15,10 @@
"
" Flag to automatically call :Fmt when file is saved.
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
let s:got_fmt_error = 0
" This is a trimmed-down version of the logic in fmt.vim.
......@@ -65,4 +69,8 @@ function! go#asmfmt#ToggleAsmFmtAutoSave() abort
call go#util#EchoProgress("auto asmfmt disabled")
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
function! go#cmd#autowrite() abort
if &autowrite == 1 || &autowriteall == 1
silent! wall
......@@ -22,9 +26,7 @@ endfunction
function! go#cmd#Build(bang, ...) abort
" Create our command arguments. go build discards any results when it
" compiles multiple packages. So we pass the `errors` package just as an
" placeholder with the current folder (indicated with '.'). We also pass -i
" that tries to install the dependencies, this has the side effect that it
" caches the build results, so every other build is faster.
" placeholder with the current folder (indicated with '.').
let l:args =
\ ['build', '-tags', go#config#BuildTags()] +
\ map(copy(a:000), "expand(v:val)") +
......@@ -59,6 +61,7 @@ function! go#cmd#Build(bang, ...) abort
redraw!
finally
execute cd . fnameescape(dir)
let &makeprg = default_makeprg
endtry
let errors = go#list#Get(l:listtype)
......@@ -68,8 +71,6 @@ function! go#cmd#Build(bang, ...) abort
else
call go#util#EchoSuccess("[build] SUCCESS")
endif
let &makeprg = default_makeprg
endif
endfunction
......@@ -165,11 +166,15 @@ function! go#cmd#Run(bang, ...) abort
let l:listtype = go#list#Type("GoRun")
if l:listtype == "locationlist"
exe 'lmake!'
else
exe 'make!'
endif
try
if l:listtype == "locationlist"
exe 'lmake!'
else
exe 'make!'
endif
finally
let &makeprg = default_makeprg
endtry
let items = go#list#Get(l:listtype)
let errors = go#tool#FilterValids(items)
......@@ -180,7 +185,6 @@ function! go#cmd#Run(bang, ...) abort
call go#list#JumpToFirst(l:listtype)
endif
let &makeprg = default_makeprg
endfunction
" Install installs the package by simple calling 'go install'. If any argument
......@@ -222,6 +226,7 @@ function! go#cmd#Install(bang, ...) abort
redraw!
finally
execute cd . fnameescape(dir)
let &makeprg = default_makeprg
endtry
let errors = go#list#Get(l:listtype)
......@@ -231,8 +236,6 @@ function! go#cmd#Install(bang, ...) abort
else
call go#util#EchoSuccess("installed to ". go#path#Default())
endif
let &makeprg = default_makeprg
endfunction
" Generate runs 'go generate' in similar fashion to go#cmd#Build()
......@@ -251,12 +254,17 @@ function! go#cmd#Generate(bang, ...) abort
let l:listtype = go#list#Type("GoGenerate")
echon "vim-go: " | echohl Identifier | echon "generating ..."| echohl None
if l:listtype == "locationlist"
silent! exe 'lmake!'
else
silent! exe 'make!'
endif
redraw!
try
if l:listtype == "locationlist"
silent! exe 'lmake!'
else
silent! exe 'make!'
endif
finally
redraw!
let &makeprg = default_makeprg
endtry
let errors = go#list#Get(l:listtype)
call go#list#Window(l:listtype, len(errors))
......@@ -268,7 +276,6 @@ function! go#cmd#Generate(bang, ...) abort
redraws! | echon "vim-go: " | echohl Function | echon "[generate] SUCCESS"| echohl None
endif
let &makeprg = default_makeprg
endfunction
" ---------------------
......@@ -282,4 +289,8 @@ function! s:cmd_job(args) abort
call go#job#Spawn(a:args.cmd, a:args)
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
func! Test_GoBuildErrors()
try
let l:filename = 'cmd/bad.go'
......@@ -27,4 +31,8 @@ func! Test_GoBuildErrors()
endtry
endfunc
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
function! s:gocodeCommand(cmd, args) abort
let l:gocode_bin = "gocode"
let l:gomod = go#util#gomod()
if filereadable(l:gomod)
" Save the file when in module mode so that go list can read the
" imports. If the user doesn't have autowrite or autorwriteall enabled,
" they'll need to write the file manually to get reliable results.
" See https://github.com/fatih/vim-go/pull/1988#issuecomment-428576989.
"
" TODO(bc): don't save the file when in module mode once
" golang.org/x/tools/go/packages has support for an overlay and it's used
" by gocode.
call go#cmd#autowrite()
let l:gocode_bin = "gocode-gomod"
endif
......@@ -31,6 +26,12 @@ function! s:gocodeCommand(cmd, args) abort
if go#config#GocodeProposeSource()
let cmd = extend(cmd, ['-source'])
else
let cmd = extend(cmd, ['-fallback-to-source', '-cache'])
endif
if go#config#GocodeUnimportedPackages()
let cmd = extend(cmd, ['-unimported-packages'])
endif
let cmd = extend(cmd, [a:cmd])
......@@ -244,4 +245,8 @@ function! go#complete#ToggleAutoTypeInfo() abort
call go#util#EchoProgress("auto type info enabled")
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
func! Test_GetInfo()
let l:filename = 'complete/complete.go'
let l:tmp = gotest#load_fixture(l:filename)
......@@ -17,4 +21,8 @@ func! Test_GetInfo()
unlet g:go_info_mode
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
function! go#config#AutodetectGopath() abort
return get(g:, 'go_autodetect_gopath', 0)
endfunction
......@@ -135,6 +139,10 @@ function! go#config#SetGuruScope(scope) abort
endif
endfunction
function! go#config#GocodeUnimportedPackages() abort
return get(g:, 'go_gocode_unimported_packages', 0)
endfunction
let s:sock_type = (has('win32') || has('win64')) ? 'tcp' : 'unix'
function! go#config#GocodeSocketType() abort
return get(g:, 'go_gocode_socket_type', s:sock_type)
......@@ -145,7 +153,7 @@ function! go#config#GocodeProposeBuiltins() abort
endfunction
function! go#config#GocodeProposeSource() abort
return get(g:, 'go_gocode_propose_source', 1)
return get(g:, 'go_gocode_propose_source', 0)
endfunction
function! go#config#EchoCommandInfo() abort
......@@ -198,7 +206,7 @@ endfunction
function! go#config#DebugCommands() abort
" make sure g:go_debug_commands is set so that it can be added to easily.
let g:go_debug_commands = get(g:, 'go_debug_commands', {})
let g:go_debug_commands = get(g:, 'go_debug_commands', [])
return g:go_debug_commands
endfunction
......@@ -306,10 +314,6 @@ function! go#config#DeclsMode() abort
return get(g:, "go_decls_mode", "")
endfunction
function! go#config#DocCommand() abort
return get(g:, "go_doc_command", ["godoc"])
endfunction
function! go#config#FmtCommand() abort
return get(g:, "go_fmt_command", "gofmt")
endfunction
......@@ -352,6 +356,10 @@ function! go#config#BinPath() abort
return get(g:, "go_bin_path", "")
endfunction
function! go#config#SearchBinPathFirst() abort
return get(g:, 'go_search_bin_path_first', 1)
endfunction
function! go#config#HighlightArrayWhitespaceError() abort
return get(g:, 'go_highlight_array_whitespace_error', 0)
endfunction
......@@ -437,4 +445,8 @@ if exists("g:go_gorename_prefill") && g:go_gorename_prefill == 1
unlet g:go_gorename_prefill
endif
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
let s:toggle = 0
" Buffer creates a new cover profile with 'go test -coverprofile' and changes
......@@ -286,4 +290,8 @@ function! s:coverage_browser_callback(coverfile, job, exit_status, data)
call delete(a:coverfile)
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
scriptencoding utf-8
if !exists('s:state')
......@@ -67,81 +71,40 @@ function! s:call_jsonrpc(method, ...) abort
echom 'sending to dlv ' . a:method
endif
if len(a:000) > 0 && type(a:000[0]) == v:t_func
let Cb = a:000[0]
let args = a:000[1:]
else
let args = a:000
endif
let l:args = a:000
let s:state['rpcid'] += 1
let req_json = json_encode({
let l:req_json = json_encode({
\ 'id': s:state['rpcid'],
\ 'method': a:method,
\ 'params': args,
\ 'params': l:args,
\})
try
" Use callback
if exists('l:Cb')
if has('nvim')
let state = {'callback': Cb}
function! state.on_data(ch, msg, event) abort
call self.state.callback(a:ch, a:msg)
endfunction
let l:ch = sockconnect('tcp', go#config#DebugAddress(), {'on_data': state.on_data, 'state': state})
call chansend(l:ch, req_json)
if go#util#HasDebug('debugger-commands')
let g:go_debug_commands = add(g:go_debug_commands, {
\ 'request': req_json,
\ 'response': Cb,
\ })
endif
return
endif
let l:ch = ch_open(go#config#DebugAddress(), {'mode': 'nl', 'callback': Cb})
call ch_sendraw(l:ch, req_json)
if go#util#HasDebug('debugger-commands')
let g:go_debug_commands = add(g:go_debug_commands, {
\ 'request': req_json,
\ 'response': Cb,
\ })
endif
return
endif
let l:ch = s:state['ch']
if has('nvim')
let state = {'done': 0}
function! state.on_data(ch, msg, event) abort
let self.state.resp = a:msg
let self.state.done = 1
endfunction
let l:ch = sockconnect('tcp', go#config#DebugAddress(), {'on_data': state.on_data, 'state': state})
call chansend(l:ch, req_json)
while state.done == 0
call chansend(l:ch, l:req_json)
while len(s:state.data) == 0
sleep 50m
endwhile
let resp_json = state.resp
let resp_json = s:state.data[0]
let s:state.data = s:state.data[1:]
else
let ch = ch_open(go#config#DebugAddress(), {'mode': 'raw', 'timeout': 20000})
call ch_sendraw(ch, req_json)
let resp_json = ch_readraw(ch)
call ch_sendraw(l:ch, req_json)
let l:resp_raw = ch_readraw(l:ch)
let resp_json = json_decode(l:resp_raw)
endif
if go#util#HasDebug('debugger-commands')
let g:go_debug_commands = add(g:go_debug_commands, {
\ 'request': req_json,
\ 'response': resp_json,
let g:go_debug_commands = add(go#config#DebugCommands(), {
\ 'request': l:req_json,
\ 'response': l:resp_json,
\ })
endif
let obj = json_decode(resp_json)
if type(obj) == v:t_dict && has_key(obj, 'error') && !empty(obj.error)
throw obj.error
if type(l:resp_json) == v:t_dict && has_key(l:resp_json, 'error') && !empty(l:resp_json.error)
throw l:resp_json.error
endif
return obj
return l:resp_json
catch
throw substitute(v:exception, '^Vim', '', '')
endtry
......@@ -247,12 +210,12 @@ function! s:clearState() abort
let s:state['localVars'] = {}
let s:state['functionArgs'] = {}
let s:state['message'] = []
silent! sign unplace 9999
endfunction
function! s:stop() abort
" TODO(bc): call Detach
call go#job#Stop(s:state['job'])
let l:res = s:call_jsonrpc('RPCServer.Detach', {'kill': v:true})
call s:clearState()
if has_key(s:state, 'job')
......@@ -262,9 +225,19 @@ function! s:stop() abort
if has_key(s:state, 'ready')
call remove(s:state, 'ready')
endif
if has_key(s:state, 'ch')
call remove(s:state, 'ch')
endif
if has_key( s:state, 'data')
call remove(s:state, 'data')
endif
endfunction
function! go#debug#Stop() abort
" TODO(bc): don't remove breakpoints that were set before debugging started
" (see out_cb).
" Remove signs.
for k in keys(s:state['breakpoint'])
let bt = s:state['breakpoint'][k]
......@@ -426,15 +399,11 @@ function! s:expand_var() abort
endif
endfunction
function! s:start_cb(ch, json) abort
let res = json_decode(a:json)
if type(res) == v:t_dict && has_key(res, 'error') && !empty(res.error)
throw res.error
endif
if empty(res) || !has_key(res, 'result')
function! s:start_cb(res) abort
if empty(a:res) || !has_key(a:res, 'result')
return
endif
for bt in res.result.Breakpoints
for bt in a:res.result.Breakpoints
if bt.id >= 0
let s:state['breakpoint'][bt.id] = bt
exe 'sign place '. bt.id .' line=' . bt.line . ' name=godebugbreakpoint file=' . bt.file
......@@ -520,7 +489,6 @@ function! s:err_cb(ch, msg) abort
return
endif
call go#util#EchoError(a:msg)
let s:state['message'] += [a:msg]
endfunction
......@@ -530,10 +498,49 @@ function! s:out_cb(ch, msg) abort
return
endif
call go#util#EchoProgress(a:msg)
let s:state['message'] += [a:msg]
if stridx(a:msg, go#config#DebugAddress()) != -1
if has('nvim')
let s:state['data'] = []
let l:state = {'databuf': ''}
function! s:on_data(ch, data, event) dict abort closure
let l:data = self.databuf
for msg in a:data
let l:data .= l:msg
endfor
try
let l:res = json_decode(l:data)
let s:state['data'] = add(s:state['data'], l:res)
let self.databuf = ''
catch
" there isn't a complete message in databuf: buffer l:data and try
" again when more data comes in.
let self.databuf = l:data
finally
endtry
endfunction
" explicitly bind callback to state so that within it, self will
" always refer to state. See :help Partial for more information.
let l:state.on_data = function('s:on_data', [], l:state)
let l:ch = sockconnect('tcp', go#config#DebugAddress(), {'on_data': l:state.on_data, 'state': l:state})
if l:ch == 0
call go#util#EchoError("could not connect to debugger")
call go#job#Stop(s:state['job'])
return
endif
else
let l:ch = ch_open(go#config#DebugAddress(), {'mode': 'raw', 'timeout': 20000})
if ch_status(l:ch) !=# 'open'
call go#util#EchoError("could not connect to debugger")
call go#job#Stop(s:state['job'])
return
endif
endif
let s:state['ch'] = l:ch
" After this block executes, Delve will be running with all the
" breakpoints setup, so this callback doesn't have to run again; just log
" future messages.
......@@ -546,7 +553,8 @@ function! s:out_cb(ch, msg) abort
call go#debug#Breakpoint(bt.line)
endfor
call s:call_jsonrpc('RPCServer.ListBreakpoints', function('s:start_cb'))
let res = s:call_jsonrpc('RPCServer.ListBreakpoints')
call s:start_cb(res)
endif
endfunction
......@@ -571,13 +579,6 @@ function! go#debug#Start(is_test, ...) abort
call go#config#SetDebugDiag(s:state)
endif
" cd in to test directory; this is also what running "go test" does.
if a:is_test
lcd %:p:h
endif
let s:state.is_test = a:is_test
let dlv = go#path#CheckBinPath("dlv")
if empty(dlv)
return
......@@ -586,14 +587,27 @@ function! go#debug#Start(is_test, ...) abort
try
if len(a:000) > 0
let l:pkgname = a:1
" Expand .; otherwise this won't work from a tmp dir.
if l:pkgname[0] == '.'
let l:pkgname = go#package#FromPath(getcwd()) . l:pkgname[1:]
let l:pkgname = go#package#FromPath(l:pkgname)
endif
else
let l:pkgname = go#package#FromPath(getcwd())
endif
if l:pkgname is -1
call go#util#EchoError('could not determine package name')
return
endif
" cd in to test directory; this is also what running "go test" does.
if a:is_test
" TODO(bc): Either remove this if it's ok to do so or else record it and
" reset cwd after the job completes.
lcd %:p:h
endif
let s:state.is_test = a:is_test
let l:args = []
if len(a:000) > 1
let l:args = ['--'] + a:000[1:]
......@@ -608,7 +622,6 @@ function! go#debug#Start(is_test, ...) abort
\ '--api-version', '2',
\ '--log', '--log-output', 'debugger,rpc',
\ '--listen', go#config#DebugAddress(),
\ '--accept-multiclient',
\]
let buildtags = go#config#BuildTags()
......@@ -803,20 +816,13 @@ function! s:update_stacktrace() abort
endtry
endfunction
function! s:stack_cb(ch, json) abort
function! s:stack_cb(res) abort
let s:stack_name = ''
let res = json_decode(a:json)
if type(res) == v:t_dict && has_key(res, 'error') && !empty(res.error)
call go#util#EchoError(res.error)
call s:clearState()
call go#debug#Restart()
return
endif
if empty(res) || !has_key(res, 'result')
if empty(a:res) || !has_key(a:res, 'result')
return
endif
call s:update_breakpoint(res)
call s:update_breakpoint(a:res)
call s:update_stacktrace()
call s:update_variables()
endfunction
......@@ -847,7 +853,14 @@ function! go#debug#Stack(name) abort
call s:call_jsonrpc('RPCServer.CancelNext')
endif
let s:stack_name = l:name
call s:call_jsonrpc('RPCServer.Command', function('s:stack_cb'), {'name': l:name})
try
let res = s:call_jsonrpc('RPCServer.Command', {'name': l:name})
call s:stack_cb(res)
catch
call go#util#EchoError(v:exception)
call s:clearState()
call go#debug#Restart()
endtry
catch
call go#util#EchoError(v:exception)
endtry
......@@ -944,4 +957,8 @@ endfunction
sign define godebugbreakpoint text=> texthl=GoDebugBreakpoint
sign define godebugcurline text== linehl=GoDebugCurrent texthl=GoDebugCurrent
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
function! Test_GoDebugStart_Empty() abort
call s:debug()
endfunction
function! Test_GoDebugStart_RelativePackage() abort
call s:debug('./debugmain')
endfunction
function! Test_GoDebugStart_Package() abort
call s:debug('debugmain')
endfunction
function! s:debug(...) abort
if !go#util#has_job()
return
endif
try
let l:tmp = gotest#load_fixture('debugmain/debugmain.go')
call go#debug#Breakpoint(6)
call assert_false(exists(':GoDebugStop'))
if a:0 == 0
let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd'
execute l:cd . ' debugmain'
call go#debug#Start(0)
else
call go#debug#Start(0, a:1)
endif
let l:start = reltime()
while !exists(':GoDebugStop') && reltimefloat(reltime(l:start)) < 10
sleep 100m
endwhile
call go#debug#Stop()
call assert_false(exists(':GoDebugStop'))
finally
call delete(l:tmp, 'rf')
endtry
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
function! go#decls#Decls(mode, ...) abort
let decls_mode = go#config#DeclsMode()
if decls_mode == 'ctrlp'
......@@ -15,4 +19,8 @@ function! go#decls#Decls(mode, ...) abort
end
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
let s:go_stack = []
let s:go_stack_level = 0
......@@ -10,21 +14,18 @@ function! go#def#Jump(mode) abort
" covers all edge cases, but now anyone can switch to godef if they wish
let bin_name = go#config#DefMode()
if bin_name == 'godef'
if &modified
" Write current unsaved buffer to a temp file and use the modified content
let l:tmpname = tempname()
call writefile(go#util#GetLines(), l:tmpname)
let fname = l:tmpname
endif
let [l:out, l:err] = go#util#Exec(['godef',
let l:cmd = ['godef',
\ '-f=' . l:fname,
\ '-o=' . go#util#OffsetCursor(),
\ '-t'])
if exists("l:tmpname")
call delete(l:tmpname)
endif
\ '-t']
if &modified
let l:stdin_content = join(go#util#GetLines(), "\n")
call add(l:cmd, "-i")
let [l:out, l:err] = go#util#Exec(l:cmd, l:stdin_content)
else
let [l:out, l:err] = go#util#Exec(l:cmd)
endif
elseif bin_name == 'guru'
let cmd = [go#path#CheckBinPath(bin_name)]
let buildtags = go#config#BuildTags()
......@@ -35,7 +36,7 @@ function! go#def#Jump(mode) abort
let stdin_content = ""
if &modified
let content = join(go#util#GetLines(), "\n")
let content = join(go#util#GetLines(), "\n")
let stdin_content = fname . "\n" . strlen(content) . "\n" . content
call add(cmd, "-modified")
endif
......@@ -83,7 +84,6 @@ function! s:jump_to_declaration_cb(mode, bin_name, job, exit_status, data) abort
endif
call go#def#jump_to_declaration(a:data[0], a:mode, a:bin_name)
call go#util#EchoSuccess(fnamemodify(a:data[0], ":t"))
" capture the active window so that after the exit_cb and close_cb callbacks
" can return to it when a:mode caused a split.
......@@ -317,4 +317,8 @@ function s:def_job(args, state) abort
call go#job#Start(a:args.cmd, l:start_options)
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
func! Test_jump_to_declaration_guru() abort
try
let l:filename = 'def/jump.go'
......@@ -63,4 +67,8 @@ func! Test_Jump_leaves_lists() abort
endtry
endfunc
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
......@@ -2,6 +2,10 @@
" Use of this source code is governed by a BSD-style
" license that can be found in the LICENSE file.
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
let s:buf_nr = -1
function! go#doc#OpenBrowser(...) abort
......@@ -51,13 +55,8 @@ endfunction
function! go#doc#Open(newmode, mode, ...) abort
" With argument: run "godoc [arg]".
if len(a:000)
if empty(go#path#CheckBinPath(go#config#DocCommand()[0]))
return
endif
let [l:out, l:err] = go#util#Exec(go#config#DocCommand() + a:000)
" Without argument: run gogetdoc on cursor position.
else
let [l:out, l:err] = go#util#Exec(['go', 'doc'] + a:000)
else " Without argument: run gogetdoc on cursor position.
let [l:out, l:err] = s:gogetdoc(0)
if out == -1
return
......@@ -189,4 +188,8 @@ function! s:godocWord(args) abort
return [pkg, exported_name]
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
function! go#fillstruct#FillStruct() abort
let l:cmd = ['fillstruct',
\ '-file', bufname(''),
......@@ -61,4 +65,8 @@ function! go#fillstruct#FillStruct() abort
endtry
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
func! Test_fillstruct() abort
try
let l:tmp = gotest#write_file('a/a.go', [
......@@ -87,4 +91,8 @@ func! Test_fillstruct_two_cursor() abort
endtry
endfunc
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
......@@ -5,6 +5,10 @@
" fmt.vim: Vim command to format Go files with gofmt (and gofmt compatible
" toorls, such as goimports).
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
" we have those problems :
" http://stackoverflow.com/questions/12741977/prevent-vim-from-updating-its-undo-tree
" http://stackoverflow.com/questions/18532692/golang-formatter-and-vim-how-to-destroy-history-record?rq=1
......@@ -211,4 +215,8 @@ function! go#fmt#ToggleFmtAutoSave() abort
call go#util#EchoProgress("auto fmt enabled")
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
func! Test_run_fmt() abort
let actual_file = tempname()
call writefile(readfile("test-fixtures/fmt/hello.go"), actual_file)
......@@ -46,4 +50,8 @@ func! Test_goimports() abort
call assert_equal(expected, actual)
endfunc
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" guru.vim -- Vim integration for the Go guru.
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
" guru_cmd returns a dict that contains the command to execute guru. args
" is dict with following options:
" mode : guru mode, such as 'implements'
......@@ -483,7 +487,7 @@ function! s:same_ids_highlight(exit_val, output, mode) abort
" is redisplayed: e.g. :edit, :GoRename, etc.
augroup vim-go-sameids
autocmd!
autocmd BufWinEnter <buffer> nested call go#guru#SameIds()
autocmd BufWinEnter <buffer> nested call go#guru#SameIds(0)
augroup end
endif
endfunction
......@@ -515,11 +519,11 @@ endfunction
function! go#guru#ToggleSameIds() abort
if go#guru#ClearSameIds() != 0
call go#guru#SameIds()
call go#guru#SameIds(1)
endif
endfunction
function! go#guru#AutoToogleSameIds() abort
function! go#guru#AutoToggleSameIds() abort
if go#config#AutoSameids()
call go#util#EchoProgress("sameids auto highlighting disabled")
call go#guru#ClearSameIds()
......@@ -586,4 +590,8 @@ function! go#guru#Scope(...) abort
endif
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
function Test_GuruScope_Set() abort
silent call go#guru#Scope("example.com/foo/bar")
let actual = go#config#GuruScope()
......@@ -12,4 +16,8 @@ function Test_GuruScope_Set() abort
endif
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
function! Test_gomodVersion_highlight() abort
try
syntax on
......@@ -92,4 +96,8 @@ function! Test_gomodVersion_incompatible_highlight() abort
endtry
endfunc
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
function! go#iferr#Generate()
let [l:out, l:err] = go#util#Exec(['iferr',
\ '-pos=' . go#util#OffsetCursor()], go#util#GetLines())
......@@ -14,3 +18,9 @@ function! go#iferr#Generate()
call setpos('.', l:pos)
silent normal! 4j
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
function! go#impl#Impl(...) abort
let recv = ""
let iface = ""
......@@ -164,4 +168,8 @@ function! go#impl#Complete(arglead, cmdline, cursorpos) abort
endif
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
func! Test_impl() abort
try
let l:tmp = gotest#write_file('a/a.go', [
......@@ -35,3 +39,9 @@ func! Test_impl_get() abort
call delete(l:tmp, 'rf')
endtry
endfunc
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et