mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated plugins
This commit is contained in:
@ -1,25 +1,57 @@
|
||||
## 1.7 (unreleased)
|
||||
## 1.8 (unplanned)
|
||||
|
||||
IMPROVEMENTS:
|
||||
|
||||
* `:GoDoc` accepts arguments now which are passed directly to `godoc`. So usages like `:GoDoc flag` works again (it was changed in previous versions [gh-894]
|
||||
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
* Escape `#` characters when opening URL's, as it's handled as alternative file in vim [gh-895]
|
||||
* Fix typos in `doc/vim-go.txt` about usages of syntax highglightings [gh-897]
|
||||
|
||||
## 1.7.1 (June 7, 2016)
|
||||
|
||||
BUG FIXES:
|
||||
* Fixed typo in `syntax/go.vim` file from `go:go_highlight_fields` to `g:go_highlight_fields`
|
||||
|
||||
## 1.7 (June 7, 2016)
|
||||
|
||||
FEATURES:
|
||||
|
||||
* New **`:GoImpl`** command that generates method stubs for implementing an interface. Checkout the [demo](https://twitter.com/fatih/status/729991365581545472) to see how it works. [gh-846]
|
||||
* `godef` support is added back as an optional setting. By default `:GoDef` still uses `guru`, but can be changed to `godef` by adding the option: `let g:go_def_mode = 'godef'` [gh-888]
|
||||
* New `<C-w><C-]>` and `<C-w>]>` shortcuts to split current window and jumpt to the identifier under cursor. [gh-838]
|
||||
* New syntax setting" `g:go_highlight_fields` that highlights struct field references [gh-854]
|
||||
|
||||
IMPROVEMENTS:
|
||||
|
||||
* Invoking `:GoRename` now reloads all files to reflect new changes automatically [gh-855]
|
||||
* Calling `:GoTestCompile` does not create any temporary binary file anymore [gh-879]
|
||||
* Enable passing the `-tags` flag to `:GoDef`. Now you can pass build tags to `:GoDef` via `:GoGuruTags` or `g:go_guru_tags`
|
||||
* Internal refactoring to use custom `system()` function that wraps both the standard `system()` call and `vimproc`. Now all system calls will take advantage and will use `vimproc` if installed. [gh-801]
|
||||
* Completion enables now `gocode`'s `autobuild` and `propose-builtins` flags automatically. With these settings packages will be automatically build to get the freshest completion candidates and builtin keywords will be showed as well. By defaults these settings are enabled. Settings can be disabled/enabled via `g:go_gocode_autobuild` and `g:go_gocode_propose_builtins`. [gh-815]
|
||||
* Added new `http.HandlerFunc` snippets with `hf` and `hhf` shortcuts [gh-816]
|
||||
* Added new `Example` and `Benchmark` snippets with `example` and `benchmark` shortcuts [gh-836]
|
||||
* Search tool binaries first in `GOBIN` and then in `PATH` as most of vim-go users installs it to `GOBIN` mostly [gh-823]
|
||||
* Improve `guru` based commands by providing automatically detected GOPATHS, such as `gb`, `godep` to be used if possible [gh-861]
|
||||
* Add `<Plug>(go-imports)` mapping to make it assignable to other keys [gh-878]
|
||||
* Increase compatibility with tcsh [gh-869]
|
||||
* Improve `:GoInstallBinaries` for GOPATH's which don't have packages that work well with `go get -u`. We have a new `g:go_get_update` setting to disable it. By default it's enabled. [gh-883]
|
||||
|
||||
|
||||
|
||||
BUG FIXES:
|
||||
* Fix `(go-freevars)` plug mapping to work as in visual mode instead of noncompatible normal mode [gh-832]
|
||||
* Commands based on guru now shows a more meaningful error message instead of just showing the exit status (-1)
|
||||
* Fix `:GoCoverage` accidently enabling syntax highlighting for users who don't use syntax (i.e syntax off) [gh-827]
|
||||
* Fix `:GoCoverage` colors to work for xterm as well [gh-863]
|
||||
* Fix commenting out block of texts for Go templates (filetype gothtmltmpl) [gh-813]
|
||||
* Fix `:GoImplements` failing because of an empty scope definition. Now we default to current package to make it usable.
|
||||
* Fix `:GoPlay` posting to non HTTPS url. [gh-847]
|
||||
* Fix escaping the filenames for lint and motion commands [gh-862]
|
||||
* Fix escaping the filename to `:GoDef` completely for tcsh [gh-868]
|
||||
* Fix showing SUCCESS for `go test` related commands if no test files are available [gh-859]
|
||||
|
||||
|
||||
|
||||
|
@ -52,7 +52,7 @@ disabled/enabled easily.
|
||||
|
||||
## Install
|
||||
|
||||
Master branch is supposed to be a development branch. So stuff here can break and change.
|
||||
Master branch is supposed to be a development branch. So stuff here can break and change.
|
||||
Please try use always the [latest release](https://github.com/fatih/vim-go/releases/latest)
|
||||
|
||||
Vim-go follows the standard runtime path structure, so I highly recommend to
|
||||
@ -180,6 +180,7 @@ To change it:
|
||||
```vim
|
||||
let g:go_highlight_functions = 1
|
||||
let g:go_highlight_methods = 1
|
||||
let g:go_highlight_fields = 1
|
||||
let g:go_highlight_structs = 1
|
||||
let g:go_highlight_interfaces = 1
|
||||
let g:go_highlight_operators = 1
|
||||
@ -218,6 +219,11 @@ let g:go_bin_path = expand("~/.gotools")
|
||||
let g:go_bin_path = "/home/fatih/.mypath" "or give absolute path
|
||||
```
|
||||
|
||||
Disable updating dependencies when installing/updating binaries:
|
||||
```vim
|
||||
let g:go_get_update = 0
|
||||
```
|
||||
|
||||
### Using with Neovim (beta)
|
||||
|
||||
Note: Neovim currently is not a first class citizen for vim-go. You are free
|
||||
|
@ -191,12 +191,14 @@ function! go#cmd#Test(bang, compile, ...)
|
||||
" don't run the test, only compile it. Useful to capture and fix errors or
|
||||
" to create a test binary.
|
||||
if a:compile
|
||||
call add(args, "-c")
|
||||
let compile_file = "vim-go-test-compile"
|
||||
call extend(args, ["-c", "-o", compile_file])
|
||||
endif
|
||||
|
||||
if a:0
|
||||
" expand all wildcards(i.e: '%' to the current file name)
|
||||
let goargs = map(copy(a:000), "expand(v:val)")
|
||||
let goargs = go#util#Shelllist(goargs, 1)
|
||||
|
||||
call extend(args, goargs, 1)
|
||||
else
|
||||
@ -217,6 +219,11 @@ function! go#cmd#Test(bang, compile, ...)
|
||||
else
|
||||
let id = go#jobcontrol#Spawn(a:bang, "test", args)
|
||||
endif
|
||||
|
||||
if a:compile
|
||||
call go#jobcontrol#AddHandler(function('s:test_compile_handler'))
|
||||
let s:test_compile_handlers[id] = compile_file
|
||||
endif
|
||||
return id
|
||||
endif
|
||||
|
||||
@ -229,6 +236,10 @@ function! go#cmd#Test(bang, compile, ...)
|
||||
|
||||
let l:listtype = "quickfix"
|
||||
|
||||
if a:compile
|
||||
call delete(compile_file)
|
||||
endif
|
||||
|
||||
if go#util#ShellError() != 0
|
||||
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
|
||||
let dir = getcwd()
|
||||
@ -332,4 +343,19 @@ function! go#cmd#Generate(bang, ...)
|
||||
let $GOPATH = old_gopath
|
||||
endfunction
|
||||
|
||||
|
||||
" -----------------------
|
||||
" | Neovim job handlers |
|
||||
" -----------------------
|
||||
let s:test_compile_handlers = {}
|
||||
|
||||
function! s:test_compile_handler(job, exit_status, data)
|
||||
if !has_key(s:test_compile_handlers, a:job.id)
|
||||
return
|
||||
endif
|
||||
let l:compile_file = s:test_compile_handlers[a:job.id]
|
||||
call delete(l:compile_file)
|
||||
unlet s:test_compile_handlers[a:job.id]
|
||||
endfunction
|
||||
|
||||
" vim:ts=4:sw=4:et
|
||||
|
@ -1,9 +1,4 @@
|
||||
if !exists("g:go_gocode_bin")
|
||||
let g:go_gocode_bin = "gocode"
|
||||
endif
|
||||
|
||||
|
||||
fu! s:gocodeCurrentBuffer()
|
||||
function! s:gocodeCurrentBuffer()
|
||||
let buf = getline(1, '$')
|
||||
if &encoding != 'utf-8'
|
||||
let buf = map(buf, 'iconv(v:val, &encoding, "utf-8")')
|
||||
@ -17,9 +12,9 @@ fu! s:gocodeCurrentBuffer()
|
||||
call writefile(buf, file)
|
||||
|
||||
return file
|
||||
endf
|
||||
endfunction
|
||||
|
||||
fu! s:gocodeCommand(cmd, preargs, args)
|
||||
function! s:gocodeCommand(cmd, preargs, args)
|
||||
for i in range(0, len(a:args) - 1)
|
||||
let a:args[i] = go#util#Shellescape(a:args[i])
|
||||
endfor
|
||||
@ -27,7 +22,7 @@ fu! s:gocodeCommand(cmd, preargs, args)
|
||||
let a:preargs[i] = go#util#Shellescape(a:preargs[i])
|
||||
endfor
|
||||
|
||||
let bin_path = go#path#CheckBinPath(g:go_gocode_bin)
|
||||
let bin_path = go#path#CheckBinPath("gocode")
|
||||
if empty(bin_path)
|
||||
return
|
||||
endif
|
||||
@ -49,20 +44,43 @@ fu! s:gocodeCommand(cmd, preargs, args)
|
||||
endif
|
||||
return result
|
||||
endif
|
||||
endf
|
||||
endfunction
|
||||
|
||||
fu! s:gocodeCurrentBufferOpt(filename)
|
||||
function! s:gocodeCurrentBufferOpt(filename)
|
||||
return '-in=' . a:filename
|
||||
endf
|
||||
endfunction
|
||||
|
||||
let s:optionsEnabled = 0
|
||||
function! s:gocodeEnableOptions()
|
||||
if s:optionsEnabled
|
||||
return
|
||||
endif
|
||||
|
||||
let bin_path = go#path#CheckBinPath("gocode")
|
||||
if empty(bin_path)
|
||||
return
|
||||
endif
|
||||
|
||||
let s:optionsEnabled = 1
|
||||
|
||||
call go#util#System(printf('%s set propose-builtins %s', go#util#Shellescape(bin_path), s:toBool(get(g:, 'go_gocode_propose_builtins', 1))))
|
||||
call go#util#System(printf('%s set autobuild %s', go#util#Shellescape(bin_path), s:toBool(get(g:, 'go_gocode_autobuild', 1))))
|
||||
endfunction
|
||||
|
||||
function! s:toBool(val)
|
||||
if a:val | return 'true ' | else | return 'false' | endif
|
||||
endfunction
|
||||
|
||||
function! s:gocodeAutocomplete()
|
||||
call s:gocodeEnableOptions()
|
||||
|
||||
fu! s:gocodeAutocomplete()
|
||||
let filename = s:gocodeCurrentBuffer()
|
||||
let result = s:gocodeCommand('autocomplete',
|
||||
\ [s:gocodeCurrentBufferOpt(filename), '-f=vim'],
|
||||
\ [expand('%:p'), go#util#OffsetCursor()])
|
||||
call delete(filename)
|
||||
return result
|
||||
endf
|
||||
endfunction
|
||||
|
||||
function! go#complete#GetInfo()
|
||||
let offset = go#util#OffsetCursor()+1
|
||||
@ -120,7 +138,7 @@ function! s:trim_bracket(val)
|
||||
return a:val
|
||||
endfunction
|
||||
|
||||
fu! go#complete#Complete(findstart, base)
|
||||
function! go#complete#Complete(findstart, base)
|
||||
"findstart = 1 when we need to get the text length
|
||||
if a:findstart == 1
|
||||
execute "silent let g:gocomplete_completions = " . s:gocodeAutocomplete()
|
||||
|
@ -28,6 +28,19 @@ function! go#coverage#Buffer(bang, ...)
|
||||
return -1
|
||||
endif
|
||||
|
||||
" check if there is any test file, if not we just return
|
||||
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
|
||||
let dir = getcwd()
|
||||
try
|
||||
execute cd . fnameescape(expand("%:p:h"))
|
||||
if empty(glob("*_test.go"))
|
||||
call go#util#EchoError("no tests files available")
|
||||
return
|
||||
endif
|
||||
finally
|
||||
execute cd . fnameescape(dir)
|
||||
endtry
|
||||
|
||||
let s:toggle = 1
|
||||
let l:tmpname = tempname()
|
||||
let args = [a:bang, 0, "-coverprofile", l:tmpname]
|
||||
@ -221,9 +234,9 @@ function! go#coverage#overlay(file)
|
||||
endfor
|
||||
|
||||
syntax manual
|
||||
highlight normaltext term=bold ctermfg=59 guifg=#75715E
|
||||
highlight covered term=bold ctermfg=118 guifg=#A6E22E
|
||||
highlight uncover term=bold ctermfg=197 guifg=#F92672
|
||||
highlight normaltext term=bold ctermfg=darkgrey guifg=#75715E
|
||||
highlight covered term=bold ctermfg=green guifg=#A6E22E
|
||||
highlight uncover term=bold ctermfg=red guifg=#F92672
|
||||
|
||||
" clear the matches if we leave the buffer
|
||||
autocmd BufWinLeave <buffer> call go#coverage#Clear()
|
||||
|
@ -2,201 +2,227 @@ let s:go_stack = []
|
||||
let s:go_stack_level = 0
|
||||
|
||||
function! go#def#Jump(mode)
|
||||
let bin_path = go#path#CheckBinPath("guru")
|
||||
if empty(bin_path)
|
||||
return
|
||||
endif
|
||||
let old_gopath = $GOPATH
|
||||
let $GOPATH = go#path#Detect()
|
||||
|
||||
let old_gopath = $GOPATH
|
||||
let $GOPATH = go#path#Detect()
|
||||
let fname = fnamemodify(expand("%"), ':p:gs?\\?/?')
|
||||
|
||||
let flags = ""
|
||||
if exists('g:go_guru_tags')
|
||||
let tags = get(g:, 'go_guru_tags')
|
||||
let flags = printf(" -tags %s", tags)
|
||||
endif
|
||||
" so guru right now is slow for some people. previously we were using
|
||||
" godef which also has it's own quirks. But this issue come up so many
|
||||
" times I've decided to support both. By default we still use guru as it
|
||||
" covers all edge cases, but now anyone can switch to godef if they wish
|
||||
let bin_name = get(g:, 'go_def_mode', 'guru')
|
||||
if bin_name == 'godef'
|
||||
let bin_path = go#path#CheckBinPath("godef")
|
||||
if empty(bin_path)
|
||||
let $GOPATH = old_gopath
|
||||
return
|
||||
endif
|
||||
let command = printf("%s -f=%s -o=%s -t", bin_path, fname, go#util#OffsetCursor())
|
||||
let out = go#util#System(command)
|
||||
|
||||
let fname = fnamemodify(expand("%"), ':p:gs?\\?/?')
|
||||
let command = printf("%s %s definition %s:#%s", bin_path, flags, shellescape(fname), go#util#OffsetCursor())
|
||||
" append the type information to the same line so our
|
||||
" jump_to_declaration() function can parse it. This makes it
|
||||
" compatible with guru definition as well too
|
||||
let out = join(split(out, '\n'), ':')
|
||||
elseif bin_name == 'guru'
|
||||
let bin_path = go#path#CheckBinPath("guru")
|
||||
if empty(bin_path)
|
||||
let $GOPATH = old_gopath
|
||||
return
|
||||
endif
|
||||
|
||||
let out = go#util#System(command)
|
||||
if go#util#ShellError() != 0
|
||||
call go#util#EchoError(out)
|
||||
return
|
||||
endif
|
||||
let flags = ""
|
||||
if exists('g:go_guru_tags')
|
||||
let tags = get(g:, 'go_guru_tags')
|
||||
let flags = printf(" -tags %s", tags)
|
||||
endif
|
||||
|
||||
call s:jump_to_declaration(out, a:mode)
|
||||
let $GOPATH = old_gopath
|
||||
let fname = shellescape(fname.':#'.go#util#OffsetCursor())
|
||||
let command = printf("%s %s definition %s", bin_path, flags, fname)
|
||||
let out = go#util#System(command)
|
||||
else
|
||||
call go#util#EchoError('go_def_mode value: '. bin_name .' is not valid. Valid values are: [godef, guru]')
|
||||
return
|
||||
endif
|
||||
|
||||
if go#util#ShellError() != 0
|
||||
call go#util#EchoError(out)
|
||||
return
|
||||
endif
|
||||
|
||||
call s:jump_to_declaration(out, a:mode)
|
||||
let $GOPATH = old_gopath
|
||||
endfunction
|
||||
|
||||
function! s:jump_to_declaration(out, mode)
|
||||
" strip line ending
|
||||
let out = split(a:out, go#util#LineEnding())[0]
|
||||
if go#util#IsWin()
|
||||
let parts = split(out, '\(^[a-zA-Z]\)\@<!:')
|
||||
else
|
||||
let parts = split(out, ':')
|
||||
endif
|
||||
" strip line ending
|
||||
let out = split(a:out, go#util#LineEnding())[0]
|
||||
if go#util#IsWin()
|
||||
let parts = split(out, '\(^[a-zA-Z]\)\@<!:')
|
||||
else
|
||||
let parts = split(out, ':')
|
||||
endif
|
||||
|
||||
let filename = parts[0]
|
||||
let line = parts[1]
|
||||
let col = parts[2]
|
||||
let ident = parts[3]
|
||||
let filename = parts[0]
|
||||
let line = parts[1]
|
||||
let col = parts[2]
|
||||
let ident = parts[3]
|
||||
|
||||
" Remove anything newer than the current position, just like basic
|
||||
" vim tag support
|
||||
if s:go_stack_level == 0
|
||||
let s:go_stack = []
|
||||
else
|
||||
let s:go_stack = s:go_stack[0:s:go_stack_level-1]
|
||||
endif
|
||||
" Remove anything newer than the current position, just like basic
|
||||
" vim tag support
|
||||
if s:go_stack_level == 0
|
||||
let s:go_stack = []
|
||||
else
|
||||
let s:go_stack = s:go_stack[0:s:go_stack_level-1]
|
||||
endif
|
||||
|
||||
" increment the stack counter
|
||||
let s:go_stack_level += 1
|
||||
" increment the stack counter
|
||||
let s:go_stack_level += 1
|
||||
|
||||
" push it on to the jumpstack
|
||||
let stack_entry = {'line': line("."), 'col': col("."), 'file': expand('%:p'), 'ident': ident}
|
||||
call add(s:go_stack, stack_entry)
|
||||
" push it on to the jumpstack
|
||||
let stack_entry = {'line': line("."), 'col': col("."), 'file': expand('%:p'), 'ident': ident}
|
||||
call add(s:go_stack, stack_entry)
|
||||
|
||||
" needed for restoring back user setting this is because there are two
|
||||
" modes of switchbuf which we need based on the split mode
|
||||
let old_switchbuf = &switchbuf
|
||||
" needed for restoring back user setting this is because there are two
|
||||
" modes of switchbuf which we need based on the split mode
|
||||
let old_switchbuf = &switchbuf
|
||||
|
||||
" jump to existing buffer if, 1. we have enabled it, 2. the buffer is loaded
|
||||
" and 3. there is buffer window number we switch to
|
||||
if get(g:, 'go_def_reuse_buffer', 0) && bufloaded(filename) != 0 && bufwinnr(filename) != -1
|
||||
" jumpt to existing buffer if it exists
|
||||
execute bufwinnr(filename) . 'wincmd w'
|
||||
elseif a:mode == "tab"
|
||||
let &switchbuf = "usetab"
|
||||
if bufloaded(filename) == 0
|
||||
tab split
|
||||
endif
|
||||
elseif a:mode == "split"
|
||||
split
|
||||
elseif a:mode == "vsplit"
|
||||
vsplit
|
||||
endif
|
||||
" jump to existing buffer if, 1. we have enabled it, 2. the buffer is loaded
|
||||
" and 3. there is buffer window number we switch to
|
||||
if get(g:, 'go_def_reuse_buffer', 0) && bufloaded(filename) != 0 && bufwinnr(filename) != -1
|
||||
" jumpt to existing buffer if it exists
|
||||
execute bufwinnr(filename) . 'wincmd w'
|
||||
elseif a:mode == "tab"
|
||||
let &switchbuf = "usetab"
|
||||
if bufloaded(filename) == 0
|
||||
tab split
|
||||
endif
|
||||
elseif a:mode == "split"
|
||||
split
|
||||
elseif a:mode == "vsplit"
|
||||
vsplit
|
||||
endif
|
||||
|
||||
" open the file and jump to line and column
|
||||
exec 'edit '.filename
|
||||
call cursor(line, col)
|
||||
" open the file and jump to line and column
|
||||
exec 'edit '.filename
|
||||
call cursor(line, col)
|
||||
|
||||
" also align the line to middle of the view
|
||||
normal! zz
|
||||
" also align the line to middle of the view
|
||||
normal! zz
|
||||
|
||||
let &switchbuf = old_switchbuf
|
||||
let &switchbuf = old_switchbuf
|
||||
endfunction
|
||||
|
||||
function! go#def#SelectStackEntry()
|
||||
let target_window = go#ui#GetReturnWindow()
|
||||
if empty(target_window)
|
||||
let target_window = winnr()
|
||||
endif
|
||||
let target_window = go#ui#GetReturnWindow()
|
||||
if empty(target_window)
|
||||
let target_window = winnr()
|
||||
endif
|
||||
|
||||
let highlighted_stack_entry = matchstr(getline("."), '^..\zs\(\d\+\)')
|
||||
if !empty(highlighted_stack_entry)
|
||||
execute target_window . "wincmd w"
|
||||
call go#def#Stack(str2nr(highlighted_stack_entry))
|
||||
endif
|
||||
let highlighted_stack_entry = matchstr(getline("."), '^..\zs\(\d\+\)')
|
||||
if !empty(highlighted_stack_entry)
|
||||
execute target_window . "wincmd w"
|
||||
call go#def#Stack(str2nr(highlighted_stack_entry))
|
||||
endif
|
||||
|
||||
call go#ui#CloseWindow()
|
||||
call go#ui#CloseWindow()
|
||||
endfunction
|
||||
|
||||
function! go#def#StackUI()
|
||||
if len(s:go_stack) == 0
|
||||
call go#util#EchoError("godef stack empty")
|
||||
return
|
||||
endif
|
||||
if len(s:go_stack) == 0
|
||||
call go#util#EchoError("godef stack empty")
|
||||
return
|
||||
endif
|
||||
|
||||
let stackOut = ['" <Up>,<Down>:navigate <Enter>:jump <Esc>,q:exit']
|
||||
let stackOut = ['" <Up>,<Down>:navigate <Enter>:jump <Esc>,q:exit']
|
||||
|
||||
let i = 0
|
||||
while i < len(s:go_stack)
|
||||
let entry = s:go_stack[i]
|
||||
let prefix = ""
|
||||
let i = 0
|
||||
while i < len(s:go_stack)
|
||||
let entry = s:go_stack[i]
|
||||
let prefix = ""
|
||||
|
||||
if i == s:go_stack_level
|
||||
let prefix = ">"
|
||||
else
|
||||
let prefix = " "
|
||||
endif
|
||||
if i == s:go_stack_level
|
||||
let prefix = ">"
|
||||
else
|
||||
let prefix = " "
|
||||
endif
|
||||
|
||||
call add(stackOut, printf("%s %d %s|%d col %d|%s",
|
||||
\ prefix, i+1, entry["file"], entry["line"], entry["col"], entry["ident"]))
|
||||
let i += 1
|
||||
endwhile
|
||||
call add(stackOut, printf("%s %d %s|%d col %d|%s",
|
||||
\ prefix, i+1, entry["file"], entry["line"], entry["col"], entry["ident"]))
|
||||
let i += 1
|
||||
endwhile
|
||||
|
||||
if s:go_stack_level == i
|
||||
call add(stackOut, "> ")
|
||||
endif
|
||||
if s:go_stack_level == i
|
||||
call add(stackOut, "> ")
|
||||
endif
|
||||
|
||||
call go#ui#OpenWindow("GoDef Stack", stackOut, "godefstack")
|
||||
call go#ui#OpenWindow("GoDef Stack", stackOut, "godefstack")
|
||||
|
||||
noremap <buffer> <silent> <CR> :<C-U>call go#def#SelectStackEntry()<CR>
|
||||
noremap <buffer> <silent> <Esc> :<C-U>call go#ui#CloseWindow()<CR>
|
||||
noremap <buffer> <silent> q :<C-U>call go#ui#CloseWindow()<CR>
|
||||
noremap <buffer> <silent> <CR> :<C-U>call go#def#SelectStackEntry()<CR>
|
||||
noremap <buffer> <silent> <Esc> :<C-U>call go#ui#CloseWindow()<CR>
|
||||
noremap <buffer> <silent> q :<C-U>call go#ui#CloseWindow()<CR>
|
||||
endfunction
|
||||
|
||||
function! go#def#StackClear(...)
|
||||
let s:go_stack = []
|
||||
let s:go_stack_level = 0
|
||||
let s:go_stack = []
|
||||
let s:go_stack_level = 0
|
||||
endfunction
|
||||
|
||||
function! go#def#StackPop(...)
|
||||
if len(s:go_stack) == 0
|
||||
call go#util#EchoError("godef stack empty")
|
||||
return
|
||||
endif
|
||||
if len(s:go_stack) == 0
|
||||
call go#util#EchoError("godef stack empty")
|
||||
return
|
||||
endif
|
||||
|
||||
if s:go_stack_level == 0
|
||||
call go#util#EchoError("at bottom of the godef stack")
|
||||
return
|
||||
endif
|
||||
if s:go_stack_level == 0
|
||||
call go#util#EchoError("at bottom of the godef stack")
|
||||
return
|
||||
endif
|
||||
|
||||
if !len(a:000)
|
||||
let numPop = 1
|
||||
else
|
||||
let numPop = a:1
|
||||
endif
|
||||
if !len(a:000)
|
||||
let numPop = 1
|
||||
else
|
||||
let numPop = a:1
|
||||
endif
|
||||
|
||||
let newLevel = str2nr(s:go_stack_level) - str2nr(numPop)
|
||||
call go#def#Stack(newLevel + 1)
|
||||
let newLevel = str2nr(s:go_stack_level) - str2nr(numPop)
|
||||
call go#def#Stack(newLevel + 1)
|
||||
endfunction
|
||||
|
||||
function! go#def#Stack(...)
|
||||
if len(s:go_stack) == 0
|
||||
call go#util#EchoError("godef stack empty")
|
||||
return
|
||||
endif
|
||||
if len(s:go_stack) == 0
|
||||
call go#util#EchoError("godef stack empty")
|
||||
return
|
||||
endif
|
||||
|
||||
if !len(a:000)
|
||||
" Display interactive stack
|
||||
call go#def#StackUI()
|
||||
return
|
||||
else
|
||||
let jumpTarget = a:1
|
||||
endif
|
||||
if !len(a:000)
|
||||
" Display interactive stack
|
||||
call go#def#StackUI()
|
||||
return
|
||||
else
|
||||
let jumpTarget = a:1
|
||||
endif
|
||||
|
||||
if jumpTarget !~ '^\d\+$'
|
||||
if jumpTarget !~ '^\s*$'
|
||||
call go#util#EchoError("location must be a number")
|
||||
endif
|
||||
return
|
||||
endif
|
||||
if jumpTarget !~ '^\d\+$'
|
||||
if jumpTarget !~ '^\s*$'
|
||||
call go#util#EchoError("location must be a number")
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
let jumpTarget = str2nr(jumpTarget) - 1
|
||||
let jumpTarget = str2nr(jumpTarget) - 1
|
||||
|
||||
if jumpTarget >= 0 && jumpTarget < len(s:go_stack)
|
||||
let s:go_stack_level = jumpTarget
|
||||
let target = s:go_stack[s:go_stack_level]
|
||||
if jumpTarget >= 0 && jumpTarget < len(s:go_stack)
|
||||
let s:go_stack_level = jumpTarget
|
||||
let target = s:go_stack[s:go_stack_level]
|
||||
|
||||
" jump
|
||||
exec 'edit '.target["file"]
|
||||
call cursor(target["line"], target["col"])
|
||||
normal! zz
|
||||
else
|
||||
call go#util#EchoError("invalid location. Try :GoDefStack to see the list of valid entries")
|
||||
endif
|
||||
" jump
|
||||
exec 'edit '.target["file"]
|
||||
call cursor(target["line"], target["col"])
|
||||
normal! zz
|
||||
else
|
||||
call go#util#EchoError("invalid location. Try :GoDefStack to see the list of valid entries")
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -77,17 +77,28 @@ function! go#doc#OpenBrowser(...)
|
||||
endfunction
|
||||
|
||||
function! go#doc#Open(newmode, mode, ...)
|
||||
" check if we have 'gogetdoc' and use it automatically
|
||||
let bin_path = go#path#CheckBinPath('gogetdoc')
|
||||
if empty(bin_path)
|
||||
return
|
||||
if len(a:000)
|
||||
" check if we have 'godoc' and use it automatically
|
||||
let bin_path = go#path#CheckBinPath('godoc')
|
||||
if empty(bin_path)
|
||||
return
|
||||
endif
|
||||
|
||||
let command = printf("%s %s", bin_path, join(a:000, ' '))
|
||||
else
|
||||
" check if we have 'gogetdoc' and use it automatically
|
||||
let bin_path = go#path#CheckBinPath('gogetdoc')
|
||||
if empty(bin_path)
|
||||
return
|
||||
endif
|
||||
|
||||
let offset = go#util#OffsetCursor()
|
||||
let fname = expand("%:p:gs!\\!/!")
|
||||
let pos = shellescape(fname.':#'.offset)
|
||||
|
||||
let command = printf("%s -pos %s", bin_path, pos)
|
||||
endif
|
||||
|
||||
let offset = go#util#OffsetCursor()
|
||||
let fname = expand("%:p")
|
||||
|
||||
let command = printf("%s -pos %s:#%s", bin_path, fname, offset)
|
||||
|
||||
let out = go#util#System(command)
|
||||
if go#util#ShellError() != 0
|
||||
call go#util#EchoError(out)
|
||||
@ -134,6 +145,7 @@ function! s:GodocView(newposition, position, content)
|
||||
call append(0, split(a:content, "\n"))
|
||||
sil $delete _
|
||||
setlocal nomodifiable
|
||||
sil normal! gg
|
||||
|
||||
" close easily with <esc> or enter
|
||||
noremap <buffer> <silent> <CR> :<C-U>close<CR>
|
||||
|
@ -87,7 +87,7 @@ function! go#fmt#Format(withGoimport)
|
||||
|
||||
" get the command first so we can test it
|
||||
let fmt_command = g:go_fmt_command
|
||||
if a:withGoimport == 1
|
||||
if a:withGoimport == 1
|
||||
let fmt_command = g:go_goimports_bin
|
||||
endif
|
||||
|
||||
@ -109,18 +109,15 @@ function! go#fmt#Format(withGoimport)
|
||||
|
||||
" populate the final command with user based fmt options
|
||||
let command = fmt_command . ' -w '
|
||||
if a:withGoimport != 1
|
||||
if a:withGoimport != 1
|
||||
let command = command . g:go_fmt_options
|
||||
endif
|
||||
|
||||
if fmt_command == "goimports"
|
||||
if !exists('b:goimports_vendor_compatible')
|
||||
let out = go#util#System("goimports --help")
|
||||
let out = go#util#System(bin_path . " --help")
|
||||
if out !~ "-srcdir"
|
||||
echohl WarningMsg
|
||||
echomsg "vim-go: goimports does not support srcdir."
|
||||
echomsg " update with: :GoUpdateBinaries"
|
||||
echohl None
|
||||
call go#util#EchoWarning("vim-go: goimports does not support srcdir. update with: :GoUpdateBinaries")
|
||||
else
|
||||
let b:goimports_vendor_compatible = 1
|
||||
endif
|
||||
|
@ -74,7 +74,8 @@ func! s:RunGuru(mode, format, selected, needs_scope) range abort
|
||||
endif
|
||||
|
||||
" this is our final command
|
||||
let command .= printf(' %s %s:%s', a:mode, shellescape(filename), pos)
|
||||
let filename .= ':'.pos
|
||||
let command .= printf(' %s %s', a:mode, shellescape(filename))
|
||||
|
||||
let old_gopath = $GOPATH
|
||||
let $GOPATH = go#path#Detect()
|
||||
|
@ -24,7 +24,7 @@ endif
|
||||
|
||||
function! go#lint#Gometa(autosave, ...) abort
|
||||
if a:0 == 0
|
||||
let goargs = expand('%:p:h')
|
||||
let goargs = shellescape(expand('%:p:h'))
|
||||
else
|
||||
let goargs = go#util#Shelljoin(a:000)
|
||||
endif
|
||||
|
@ -46,7 +46,7 @@ function! go#package#Paths()
|
||||
let dirs += [s:goroot]
|
||||
endif
|
||||
|
||||
let workspaces = split($GOPATH, go#util#PathListSep())
|
||||
let workspaces = split(go#path#Detect(), go#util#PathListSep())
|
||||
if workspaces != []
|
||||
let dirs += workspaces
|
||||
endif
|
||||
|
@ -151,6 +151,9 @@ function! go#path#CheckBinPath(binpath)
|
||||
|
||||
" if it's in PATH just return it
|
||||
if executable(binpath)
|
||||
if v:version == 704 && has('patch235')
|
||||
let binpath = exepath(binpath)
|
||||
endif
|
||||
let $PATH = old_path
|
||||
return binpath
|
||||
endif
|
||||
|
@ -36,6 +36,15 @@ function! go#rename#Rename(bang, ...)
|
||||
|
||||
let out = go#tool#ExecuteInDir(cmd)
|
||||
|
||||
" reload all files to reflect the new changes. We explicitly call
|
||||
" checktime to trigger a reload of all files. See
|
||||
" http://www.mail-archive.com/vim@vim.org/msg05900.html for more info
|
||||
" about the autoread bug
|
||||
let current_autoread = &autoread
|
||||
set autoread
|
||||
silent! checktime
|
||||
let &autoread = current_autoread
|
||||
|
||||
" strip out newline on the end that gorename puts. If we don't remove, it
|
||||
" will trigger the 'Hit ENTER to continue' prompt
|
||||
let clean = split(out, '\n')
|
||||
|
@ -16,7 +16,7 @@ endif
|
||||
function! go#textobj#Function(mode)
|
||||
let offset = go#util#OffsetCursor()
|
||||
|
||||
let fname = expand("%:p")
|
||||
let fname = shellescape(expand("%:p"))
|
||||
if &modified
|
||||
" Write current unsaved buffer to a temp file and use the modified content
|
||||
let l:tmpname = tempname()
|
||||
@ -103,7 +103,7 @@ function! go#textobj#FunctionJump(mode, direction)
|
||||
|
||||
let offset = go#util#OffsetCursor()
|
||||
|
||||
let fname = expand("%:p")
|
||||
let fname = shellescape(expand("%:p"))
|
||||
if &modified
|
||||
" Write current unsaved buffer to a temp file and use the modified content
|
||||
let l:tmpname = tempname()
|
||||
|
@ -1,19 +1,21 @@
|
||||
function! go#tool#Files()
|
||||
if go#util#IsWin()
|
||||
let command = 'go list -f "{{range $f := .GoFiles}}{{$.Dir}}\{{$f}}{{printf \"\n\"}}{{end}}{{range $f := .CgoFiles}}{{$.Dir}}\{{$f}}{{printf \"\n\"}}{{end}}"'
|
||||
let format = '{{range $f := .GoFiles}}{{$.Dir}}\{{$f}}{{printf \"\n\"}}{{end}}{{range $f := .CgoFiles}}{{$.Dir}}\{{$f}}{{printf \"\n\"}}{{end}}'
|
||||
else
|
||||
let command = "go list -f '{{range $f := .GoFiles}}{{$.Dir}}/{{$f}}{{printf \"\\n\"}}{{end}}{{range $f := .CgoFiles}}{{$.Dir}}/{{$f}}{{printf \"\\n\"}}{{end}}'"
|
||||
let format = "{{range $f := .GoFiles}}{{$.Dir}}/{{$f}}{{printf \"\\n\"}}{{end}}{{range $f := .CgoFiles}}{{$.Dir}}/{{$f}}{{printf \"\\n\"}}{{end}}"
|
||||
endif
|
||||
let command = 'go list -f '.shellescape(format)
|
||||
let out = go#tool#ExecuteInDir(command)
|
||||
return split(out, '\n')
|
||||
endfunction
|
||||
|
||||
function! go#tool#Deps()
|
||||
if go#util#IsWin()
|
||||
let command = 'go list -f "{{range $f := .Deps}}{{$f}}{{printf \"\n\"}}{{end}}"'
|
||||
let format = '{{range $f := .Deps}}{{$f}}{{printf \"\n\"}}{{end}}'
|
||||
else
|
||||
let command = "go list -f $'{{range $f := .Deps}}{{$f}}\n{{end}}'"
|
||||
let format = "{{range $f := .Deps}}{{$f}}\n{{end}}"
|
||||
endif
|
||||
let command = 'go list -f '.shellescape(format)
|
||||
let out = go#tool#ExecuteInDir(command)
|
||||
return split(out, '\n')
|
||||
endfunction
|
||||
@ -21,10 +23,11 @@ endfunction
|
||||
function! go#tool#Imports()
|
||||
let imports = {}
|
||||
if go#util#IsWin()
|
||||
let command = 'go list -f "{{range $f := .Imports}}{{$f}}{{printf \"\n\"}}{{end}}"'
|
||||
let format = '{{range $f := .Imports}}{{$f}}{{printf \"\n\"}}{{end}}'
|
||||
else
|
||||
let command = "go list -f $'{{range $f := .Imports}}{{$f}}\n{{end}}'"
|
||||
let format = "{{range $f := .Imports}}{{$f}}{{printf \"\\n\"}}{{end}}"
|
||||
endif
|
||||
let command = 'go list -f '.shellescape(format)
|
||||
let out = go#tool#ExecuteInDir(command)
|
||||
if go#util#ShellError() != 0
|
||||
echo out
|
||||
@ -32,7 +35,7 @@ function! go#tool#Imports()
|
||||
endif
|
||||
|
||||
for package_path in split(out, '\n')
|
||||
let cmd = "go list -f {{.Name}} " . package_path
|
||||
let cmd = "go list -f '{{.Name}}' " . shellescape(package_path)
|
||||
let package_name = substitute(go#tool#ExecuteInDir(cmd), '\n$', '', '')
|
||||
let imports[package_name] = package_path
|
||||
endfor
|
||||
@ -168,10 +171,10 @@ function! go#tool#OpenBrowser(url)
|
||||
return
|
||||
endif
|
||||
if cmd =~ '^!'
|
||||
let cmd = substitute(cmd, '%URL%', '\=shellescape(a:url)', 'g')
|
||||
let cmd = substitute(cmd, '%URL%', '\=escape(shellescape(a:url),"#")', 'g')
|
||||
silent! exec cmd
|
||||
elseif cmd =~ '^:[A-Z]'
|
||||
let cmd = substitute(cmd, '%URL%', '\=a:url', 'g')
|
||||
let cmd = substitute(cmd, '%URL%', '\=escape(a:url,"#")', 'g')
|
||||
exec cmd
|
||||
else
|
||||
let cmd = substitute(cmd, '%URL%', '\=shellescape(a:url)', 'g')
|
||||
|
@ -87,7 +87,7 @@ function! go#ui#OpenDefinition(filter)
|
||||
|
||||
" don't touch our first line or any blank line
|
||||
if curline =~ a:filter || curline =~ "^$"
|
||||
" supress information about calling this function
|
||||
" suppress information about calling this function
|
||||
echo ""
|
||||
return
|
||||
endif
|
||||
|
@ -439,7 +439,8 @@ CTRL-t
|
||||
:GoInstallBinaries
|
||||
|
||||
Download and Install all necessary Go tool binaries such as `godef`,
|
||||
`goimports`, `gocode`, etc.. under `g:go_bin_path`
|
||||
`goimports`, `gocode`, etc.. under `g:go_bin_path`. Set |g:go_get_update|
|
||||
to disable updating dependencies.
|
||||
|
||||
*:GoUpdateBinaries*
|
||||
:GoUpdateBinaries
|
||||
@ -630,6 +631,7 @@ CTRL-t
|
||||
:GoImpl f *Foo io.Writer
|
||||
:GoImpl T io.ReadWriteCloser
|
||||
<
|
||||
|
||||
|
||||
===============================================================================
|
||||
MAPPINGS *go-mappings*
|
||||
@ -672,17 +674,14 @@ Calls `go build` for the current package
|
||||
|
||||
Calls `go generate` for the current package
|
||||
|
||||
|
||||
*(go-info)*
|
||||
|
||||
Shows type information for the word under the cursor
|
||||
|
||||
|
||||
*(go-install)*
|
||||
|
||||
Calls `go install` for the current package
|
||||
|
||||
|
||||
*(go-test)*
|
||||
|
||||
Calls `go test` for the current package
|
||||
@ -710,6 +709,10 @@ Calls `go test -coverprofile-temp.out` for the current package and shows the
|
||||
coverage annotation. If run agains it acts as a toggle and clears the
|
||||
annotation.
|
||||
|
||||
*(go-imports)*
|
||||
|
||||
Calls `goimports` for the current package
|
||||
|
||||
*(go-vet)*
|
||||
|
||||
Calls `go vet` for the current package
|
||||
@ -834,6 +837,11 @@ Alternates between the implementation and test code in a new horizontal split
|
||||
|
||||
Alternates between the implementation and test code in a new vertical split
|
||||
|
||||
*(go-import)*
|
||||
|
||||
Calls `:GoImport` for the current package
|
||||
|
||||
|
||||
===============================================================================
|
||||
TEXT OBJECTS *go-text-objects*
|
||||
|
||||
@ -973,6 +981,14 @@ K , keywordprg shortcut. Usually this shortcut is set to use the program `man`.
|
||||
In Go, using `godoc` is more idiomatic. Default is enabled. >
|
||||
|
||||
let g:go_doc_keywordprg_enabled = 1
|
||||
<
|
||||
*'g:go_def_mode'*
|
||||
|
||||
Use this option to define the command to be used for |:GoDef|. By default
|
||||
`guru` is being used as it covers all edge cases. But one might also use
|
||||
`godef` as it's more faster. Current valid options are: `[guru, godef]` >
|
||||
|
||||
let g:go_def_mode = 'guru'
|
||||
<
|
||||
*'g:go_def_mapping_enabled'*
|
||||
|
||||
@ -1028,6 +1044,14 @@ is used. Use "neosnippet" for neosnippet.vim: >
|
||||
let g:go_snippet_engine = "ultisnips"
|
||||
<
|
||||
|
||||
*'g:go_get_update'*
|
||||
|
||||
Use this option to disable updating dependencies with |GoInstallBinaries|. By
|
||||
default this is enabled.
|
||||
>
|
||||
let g:go_get_update = 1
|
||||
<
|
||||
|
||||
*'g:go_guru_scope'*
|
||||
|
||||
Use this option to define the scope of the analysis to be passed for guru
|
||||
@ -1098,7 +1122,13 @@ Highlights method names. By default it's disabled. >
|
||||
|
||||
Highlights struct names. By default it's disabled. >
|
||||
|
||||
let g:go_highlight_structs = 0
|
||||
let g:go_highlight_structs = 0
|
||||
<
|
||||
*'g:go_highlight_fields'*
|
||||
|
||||
Highlights field names. By default it's disabled. >
|
||||
|
||||
let g:go_highlight_fields = 0
|
||||
<
|
||||
*'g:go_highlight_interfaces'*
|
||||
|
||||
@ -1243,10 +1273,24 @@ By default it is set to edit.
|
||||
*g:go_gorename_prefill*
|
||||
|
||||
Specifies whether |:GoRename| prefills the new identifier name with the
|
||||
word under the cursor. By default is is enabled.
|
||||
word under the cursor. By default it is enabled.
|
||||
>
|
||||
let g:go_gorename_prefill = 1
|
||||
<
|
||||
*g:go_gocode_autobuild*
|
||||
|
||||
Specifies whether `gocode` should automatically build out-of-date packages
|
||||
when their source fiels are modified, in order to obtahin the freshes
|
||||
autocomplete results for them. By default it is enabled.
|
||||
>
|
||||
let g:go_gocode_autobuild = 1
|
||||
<
|
||||
*g:go_gocode_propose_builtins*
|
||||
|
||||
Specifies whether `gocode` should add built-in types, functions and constants
|
||||
to an autocompletion proposals. By default it is enabled.
|
||||
>
|
||||
let g:go_gocode_propose_builtins = 1
|
||||
|
||||
|
||||
===============================================================================
|
||||
|
@ -33,6 +33,7 @@ nnoremap <silent> <Plug>(go-files) :<C-u>call go#tool#Files()<CR>
|
||||
nnoremap <silent> <Plug>(go-deps) :<C-u>call go#tool#Deps()<CR>
|
||||
nnoremap <silent> <Plug>(go-info) :<C-u>call go#complete#Info(0)<CR>
|
||||
nnoremap <silent> <Plug>(go-import) :<C-u>call go#import#SwitchImport(1, '', expand('<cword>'), '')<CR>
|
||||
nnoremap <silent> <Plug>(go-imports) :<C-u>call go#fmt#Format(1)<CR>
|
||||
|
||||
nnoremap <silent> <Plug>(go-implements) :<C-u>call go#guru#Implements(-1)<CR>
|
||||
nnoremap <silent> <Plug>(go-callees) :<C-u>call go#guru#Callees(-1)<CR>
|
||||
|
@ -307,19 +307,17 @@ abbr if err != nil { t.Fatalf(...) }
|
||||
}
|
||||
# test example
|
||||
snippet example
|
||||
func Example${1:Method}() {
|
||||
${0}
|
||||
// Output:
|
||||
}
|
||||
endsnippet
|
||||
func Example${1:Method}() {
|
||||
${0}
|
||||
// Output:
|
||||
}
|
||||
# test benchmark
|
||||
snippet benchmark
|
||||
func Benchmark${1:Method}(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
${0}
|
||||
func Benchmark${1:Method}(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
${0}
|
||||
}
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
# variable declaration
|
||||
snippet var
|
||||
abbr var x Type [= ...]
|
||||
|
@ -8,11 +8,12 @@ let g:go_loaded_install = 1
|
||||
" needed by the user with GoInstallBinaries
|
||||
let s:packages = [
|
||||
\ "github.com/nsf/gocode",
|
||||
\ "github.com/alecthomas/gometalinter",
|
||||
\ "github.com/alecthomas/gometalinter",
|
||||
\ "golang.org/x/tools/cmd/goimports",
|
||||
\ "golang.org/x/tools/cmd/guru",
|
||||
\ "golang.org/x/tools/cmd/gorename",
|
||||
\ "github.com/golang/lint/golint",
|
||||
\ "github.com/rogpeppe/godef",
|
||||
\ "github.com/kisielk/errcheck",
|
||||
\ "github.com/jstemmer/gotags",
|
||||
\ "github.com/klauspost/asmfmt/cmd/asmfmt",
|
||||
@ -65,13 +66,16 @@ function! s:GoInstallBinaries(updateBinaries)
|
||||
set noshellslash
|
||||
endif
|
||||
|
||||
let cmd = "go get -u -v "
|
||||
let cmd = "go get -v "
|
||||
if get(g:, "go_get_update", 1) != 0
|
||||
let cmd .= "-u "
|
||||
endif
|
||||
|
||||
let s:go_version = matchstr(go#util#System("go version"), '\d.\d.\d')
|
||||
|
||||
" https://github.com/golang/go/issues/10791
|
||||
if s:go_version > "1.4.0" && s:go_version < "1.5.0"
|
||||
let cmd .= "-f "
|
||||
let cmd .= "-f "
|
||||
endif
|
||||
|
||||
for pkg in s:packages
|
||||
|
@ -67,6 +67,10 @@ if !exists("g:go_highlight_methods")
|
||||
let g:go_highlight_methods = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_fields")
|
||||
let g:go_highlight_fields = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_structs")
|
||||
let g:go_highlight_structs = 0
|
||||
endif
|
||||
@ -308,6 +312,12 @@ if g:go_highlight_methods != 0
|
||||
endif
|
||||
hi def link goMethod Type
|
||||
|
||||
" Fields;
|
||||
if g:go_highlight_fields != 0
|
||||
syn match goField /\(\.\)\@<=\a\+\([\ \n\r\:\)]\)\@=/
|
||||
endif
|
||||
hi def link goField Type
|
||||
|
||||
" Structs;
|
||||
if g:go_highlight_structs != 0
|
||||
syn match goStruct /\(.\)\@<=\w\+\({\)\@=/
|
||||
|
Reference in New Issue
Block a user