mirror of
				https://github.com/amix/vimrc
				synced 2025-10-31 06:33:35 +08:00 
			
		
		
		
	Updated plugins
This commit is contained in:
		| @ -39,10 +39,15 @@ disabled/enabled easily. | ||||
| * Share your current code to [play.golang.org](http://play.golang.org) with `:GoPlay` | ||||
| * On-the-fly type information about the word under the cursor. Plug it into | ||||
|   your custom vim function. | ||||
| * Go asm formatting on save | ||||
| * Tagbar support to show tags of the source code in a sidebar with `gotags` | ||||
| * Custom vim text objects such as `a function` or `inner function` | ||||
| * All commands support collecting and displaying errors in Vim's location | ||||
|   list. | ||||
| * A async launcher for the go command is implemented for Neovim, fully async | ||||
|   building and testing (beta). | ||||
| * Integrated with the Neovim terminal, launch `:GoRun` and other go commands | ||||
|   in their own new terminal. (beta) | ||||
| * Alternate between implementation and test code with `:GoAlternate` | ||||
|  | ||||
| ## Install | ||||
|  | ||||
| @ -73,15 +78,18 @@ installed binaries. | ||||
|  | ||||
| * Autocompletion is enabled by default via `<C-x><C-o>`. To get real-time | ||||
| completion (completion by type) install: | ||||
| [YCM](https://github.com/Valloric/YouCompleteMe) or | ||||
| [neocomplete](https://github.com/Shougo/neocomplete.vim). | ||||
| [neocomplete](https://github.com/Shougo/neocomplete.vim) for Vim or | ||||
| [deoplete](https://github.com/Shougo/deoplete.nvim) and | ||||
| [deoplete-go](https://github.com/zchee/deoplete-go) for NeoVim | ||||
| * To display source code tag information on a sidebar install | ||||
| [tagbar](https://github.com/majutsushi/tagbar). | ||||
| * For snippet features install: | ||||
| [ultisnips](https://github.com/SirVer/ultisnips) or | ||||
| [neosnippet](https://github.com/Shougo/neosnippet.vim). | ||||
| * Screenshot color scheme is a slightly modified molokai: [fatih/molokai](https://github.com/fatih/molokai). | ||||
| * For a better documentation viewer checkout: [go-explorer](https://github.com/garyburd/go-explorer). | ||||
| [neosnippet](https://github.com/Shougo/neosnippet.vim) or | ||||
| [ultisnips](https://github.com/SirVer/ultisnips). | ||||
| * Screenshot color scheme is a slightly modified molokai: | ||||
|   [fatih/molokai](https://github.com/fatih/molokai). | ||||
| * For a better documentation viewer checkout: | ||||
|   [go-explorer](https://github.com/garyburd/go-explorer). | ||||
|  | ||||
| ## Usage | ||||
|  | ||||
| @ -99,9 +107,9 @@ vim-go has several `<Plug>` mappings which can be used to create custom | ||||
| mappings. Below are some examples you might find useful: | ||||
|  | ||||
| Run commands such as `go run` for the current file with `<leader>r` or `go | ||||
| build` and `go test` for the current package with `<leader>b` and `<leader>t` respectively. | ||||
| Display beautifully annotated source code to see which functions are covered | ||||
| with `<leader>c`. | ||||
| build` and `go test` for the current package with `<leader>b` and `<leader>t` | ||||
| respectively. Display beautifully annotated source code to see which functions | ||||
| are covered with `<leader>c`. | ||||
|  | ||||
| ```vim | ||||
| au FileType go nmap <leader>r <Plug>(go-run) | ||||
| @ -159,7 +167,8 @@ recommendations, you are free to create more advanced mappings or functions | ||||
| based on `:he go-commands`. | ||||
|  | ||||
| ## Settings | ||||
| Below are some settings you might find useful. For the full list see `:he go-settings`. | ||||
| Below are some settings you might find useful. For the full list see `:he | ||||
| go-settings`. | ||||
|  | ||||
| By default syntax-highlighting for Functions, Methods and Structs is disabled. | ||||
| To change it: | ||||
| @ -167,6 +176,7 @@ To change it: | ||||
| let g:go_highlight_functions = 1 | ||||
| let g:go_highlight_methods = 1 | ||||
| let g:go_highlight_structs = 1 | ||||
| let g:go_highlight_interfaces = 1 | ||||
| let g:go_highlight_operators = 1 | ||||
| let g:go_highlight_build_constraints = 1 | ||||
| ``` | ||||
| @ -203,23 +213,39 @@ let g:go_bin_path = expand("~/.gotools") | ||||
| let g:go_bin_path = "/home/fatih/.mypath"      "or give absolute path | ||||
| ``` | ||||
|  | ||||
| ### Location list navigation | ||||
| ### Using with Neovim (beta) | ||||
|  | ||||
| All commands support collecting and displaying errors in Vim's location | ||||
|   list. | ||||
| Note: Neovim currently is not a first class citizen for vim-go. You are free | ||||
| to open bugs but I'm not going to look at them. Even though I'm using Neovim | ||||
| myself, Neovim itself is still alpha. So vim-go might not work well as good as | ||||
| in Vim. I'm happy to accept pull requests or very detailed bug reports. | ||||
|  | ||||
| Quickly navigate through these location lists with `:lne` for next error and `:lp`  | ||||
| for previous.  You can also bind these to keys, for example: | ||||
|  | ||||
| Run `:GoRun` in a new tab, horizontal split or vertical split terminal | ||||
|  | ||||
| ```vim | ||||
| map <C-n> :lne<CR> | ||||
| map <C-m> :lp<CR> | ||||
| au FileType go nmap <leader>rt <Plug>(go-run-tab) | ||||
| au FileType go nmap <Leader>rs <Plug>(go-run-split) | ||||
| au FileType go nmap <Leader>rv <Plug>(go-run-vertical) | ||||
| ``` | ||||
|  | ||||
| By default new terminals are opened in a vertical split. To change it | ||||
|  | ||||
| ```vim | ||||
| let g:go_term_mode = "split" | ||||
| ``` | ||||
|  | ||||
| By default the testing commands run asynchronously in the background and | ||||
| display results with `go#jobcontrol#Statusline()`. To make them run in a new | ||||
| terminal | ||||
|  | ||||
| ```vim | ||||
| let g:go_term_enabled = 1 | ||||
| ``` | ||||
|  | ||||
| ### Using with Syntastic | ||||
| Sometimes when using both `vim-go` and `syntastic` Vim will start lagging while saving and opening | ||||
| files. The following fixes this: | ||||
| Sometimes when using both `vim-go` and `syntastic` Vim will start lagging while | ||||
| saving and opening files. The following fixes this: | ||||
|  | ||||
| ```vim | ||||
| let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck'] | ||||
| @ -228,13 +254,17 @@ let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] } | ||||
|  | ||||
| ## More info | ||||
|  | ||||
| Check out the [Wiki](https://github.com/fatih/vim-go/wiki) page for more information. It includes [Screencasts](https://github.com/fatih/vim-go/wiki/Screencasts), an [FAQ | ||||
| section](https://github.com/fatih/vim-go/wiki/FAQ-Troubleshooting), and many other [various pieces](https://github.com/fatih/vim-go/wiki) of information. | ||||
| Check out the [Wiki](https://github.com/fatih/vim-go/wiki) page for more | ||||
| information. It includes | ||||
| [Screencasts](https://github.com/fatih/vim-go/wiki/Screencasts), an [FAQ | ||||
| section](https://github.com/fatih/vim-go/wiki/FAQ-Troubleshooting), and many | ||||
| other [various pieces](https://github.com/fatih/vim-go/wiki) of information. | ||||
|  | ||||
| ## Credits | ||||
|  | ||||
| * Go Authors for official vim plugins | ||||
| * Gocode, Godef, Golint, Oracle, Goimports, Gotags, Errcheck projects and authors of those projects. | ||||
| * Gocode, Godef, Golint, Oracle, Goimports, Gotags, Errcheck projects and | ||||
|   authors of those projects. | ||||
| * Other vim-plugins, thanks for inspiration (vim-golang, go.vim, vim-gocode, | ||||
|   vim-godef) | ||||
| * [Contributors](https://github.com/fatih/vim-go/graphs/contributors) of vim-go | ||||
|  | ||||
							
								
								
									
										30
									
								
								sources_non_forked/vim-go/autoload/go/alternate.vim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								sources_non_forked/vim-go/autoload/go/alternate.vim
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,30 @@ | ||||
| " By default use edit (current buffer view) to switch | ||||
| if !exists("g:go_alternate_mode") | ||||
|   let g:go_alternate_mode = "edit" | ||||
| endif | ||||
|  | ||||
| " Test alternates between the implementation of code and the test code. | ||||
| function! go#alternate#Switch(bang, cmd) | ||||
|   let l:file = go#alternate#Filename(fnameescape(expand("%"))) | ||||
|   if !filereadable(l:file) && !bufexists(l:file) && !a:bang | ||||
|     redraws! | echon "vim-go: " | echohl ErrorMsg | echon "couldn't find ".file | echohl None | ||||
|     return | ||||
|   elseif empty(a:cmd) | ||||
|     execute ":" . g:go_alternate_mode . " " . file | ||||
|   else | ||||
|     execute ":" . a:cmd . " " . file | ||||
|   endif | ||||
| endfunction | ||||
|  | ||||
| " Filename returns the name of the test file or implementation file | ||||
| " depending on the arguments | ||||
| function! go#alternate#Filename(path) | ||||
|   if empty(matchstr(a:path, "_test")) | ||||
|     let l:root = split(a:path, ".go$")[0] | ||||
|     let l:file = l:root . "_test.go" | ||||
|   else | ||||
|     let l:root = split(a:path, "_test.go$")[0] | ||||
|     let l:file = l:root . ".go" | ||||
|   endif | ||||
|   return l:file | ||||
| endfunction | ||||
							
								
								
									
										52
									
								
								sources_non_forked/vim-go/autoload/go/asmfmt.vim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								sources_non_forked/vim-go/autoload/go/asmfmt.vim
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,52 @@ | ||||
| " asmfmt.vim: Vim command to format Go asm files with asmfmt | ||||
| " (github.com/klauspost/asmfmt). | ||||
| " | ||||
| " This filetype plugin adds new commands for asm buffers: | ||||
| " | ||||
| "   :Fmt | ||||
| " | ||||
| "       Filter the current asm buffer through asmfmt. | ||||
| "       It tries to preserve cursor position and avoids | ||||
| "       replacing the buffer with stderr output. | ||||
| " | ||||
| " Options: | ||||
| " | ||||
| "   g:go_asmfmt_autosave [default=1] | ||||
| " | ||||
| "       Flag to automatically call :Fmt when file is saved. | ||||
|  | ||||
| let s:got_fmt_error = 0 | ||||
|  | ||||
| " This is a trimmed-down version of the logic in fmt.vim. | ||||
|  | ||||
| function! go#asmfmt#Format() | ||||
|   " Save state. | ||||
|   let l:curw = winsaveview() | ||||
|  | ||||
|   " Write the current buffer to a tempfile. | ||||
|   let l:tmpname = tempname() | ||||
|   call writefile(getline(1, '$'), l:tmpname) | ||||
|  | ||||
|   " Run asmfmt. | ||||
|   let path = go#path#CheckBinPath("asmfmt") | ||||
|   if empty(path) | ||||
|     return | ||||
|   endif | ||||
|   let out = system(path . ' -w ' . l:tmpname) | ||||
|  | ||||
|   " If there's no error, replace the current file with the output. | ||||
|   if v:shell_error == 0 | ||||
|     " Remove undo point caused by BufWritePre. | ||||
|     try | silent undojoin | catch | endtry | ||||
|  | ||||
|     " Replace the current file with the temp file; then reload the buffer. | ||||
|     let old_fileformat = &fileformat | ||||
|     call rename(l:tmpname, expand('%')) | ||||
|     silent edit! | ||||
|     let &fileformat = old_fileformat | ||||
|     let &syntax = &syntax | ||||
|   endif | ||||
|  | ||||
|   " Restore the cursor/window positions. | ||||
|   call winrestview(l:curw) | ||||
| endfunction | ||||
| @ -9,7 +9,7 @@ function! go#cmd#autowrite() | ||||
| endfunction | ||||
|  | ||||
|  | ||||
| " Build buils the source code without producting any output binary. We live in | ||||
| " Build builds the source code without producting any output binary. We live in | ||||
| " an editor so the best is to build it to catch errors and fix them. By | ||||
| " default it tries to call simply 'go build', but it first tries to get all | ||||
| " dependent files for the current folder and passes it to go build. | ||||
| @ -27,6 +27,7 @@ function! go#cmd#Build(bang, ...) | ||||
|  | ||||
|     " if we have nvim, call it asynchronously and return early ;) | ||||
|     if has('nvim') | ||||
|         call go#util#EchoProgress("building dispatched ...") | ||||
|         call go#jobcontrol#Spawn(a:bang, "build", args) | ||||
|         return | ||||
|     endif | ||||
| @ -36,29 +37,32 @@ function! go#cmd#Build(bang, ...) | ||||
|     let default_makeprg = &makeprg | ||||
|     let &makeprg = "go " . join(args, ' ') | ||||
|  | ||||
|     let l:listtype = go#list#Type("quickfix") | ||||
|     " execute make inside the source folder so we can parse the errors | ||||
|     " correctly | ||||
|     let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' | ||||
|     let dir = getcwd() | ||||
|     try | ||||
|       execute cd . fnameescape(expand("%:p:h")) | ||||
|       if g:go_dispatch_enabled && exists(':Make') == 2 | ||||
|           call go#util#EchoProgress("building dispatched ...") | ||||
|           silent! exe 'Make' | ||||
|       else | ||||
|           silent! exe 'lmake!' | ||||
|       endif | ||||
|       redraw! | ||||
|         execute cd . fnameescape(expand("%:p:h")) | ||||
|         if g:go_dispatch_enabled && exists(':Make') == 2 | ||||
|             call go#util#EchoProgress("building dispatched ...") | ||||
|             silent! exe 'Make' | ||||
|         elseif l:listtype == "locationlist" | ||||
|             silent! exe 'lmake!' | ||||
|         else | ||||
|             silent! exe 'make!' | ||||
|         endif | ||||
|         redraw! | ||||
|     finally | ||||
|       execute cd . fnameescape(dir) | ||||
|         execute cd . fnameescape(dir) | ||||
|     endtry | ||||
|  | ||||
|     let errors = go#list#Get() | ||||
|     call go#list#Window(len(errors)) | ||||
|     let errors = go#list#Get(l:listtype) | ||||
|     call go#list#Window(l:listtype, len(errors)) | ||||
|  | ||||
|     if !empty(errors) | ||||
|         if !a:bang | ||||
|             call go#list#JumpToFirst() | ||||
|             call go#list#JumpToFirst(l:listtype) | ||||
|         endif | ||||
|     else | ||||
|         call go#util#EchoSuccess("[build] SUCCESS") | ||||
| @ -108,19 +112,23 @@ function! go#cmd#Run(bang, ...) | ||||
|         let &makeprg = "go run " . go#util#Shelljoin(map(copy(a:000), "expand(v:val)"), 1) | ||||
|     endif | ||||
|  | ||||
|     let l:listtype = go#list#Type("quickfix") | ||||
|  | ||||
|     if g:go_dispatch_enabled && exists(':Make') == 2 | ||||
|         silent! exe 'Make' | ||||
|     elseif l:listtype == "locationlist" | ||||
|         silent! exe 'lmake!' | ||||
|     else | ||||
|         exe 'lmake!' | ||||
|         silent! exe 'make!' | ||||
|     endif | ||||
|  | ||||
|     let items = go#list#Get() | ||||
|     let items = go#list#Get(l:listtype) | ||||
|     let errors = go#tool#FilterValids(items) | ||||
|  | ||||
|     call go#list#Populate(errors) | ||||
|     call go#list#Window(len(errors)) | ||||
|     call go#list#Populate(l:listtype, errors) | ||||
|     call go#list#Window(l:listtype, len(errors)) | ||||
|     if !empty(errors) && !a:bang | ||||
|         call go#list#JumpToFirst() | ||||
|         call go#list#JumpToFirst(l:listtype) | ||||
|     endif | ||||
|  | ||||
|     let $GOPATH = old_gopath | ||||
| @ -128,26 +136,46 @@ function! go#cmd#Run(bang, ...) | ||||
| endfunction | ||||
|  | ||||
| " Install installs the package by simple calling 'go install'. If any argument | ||||
| " is given(which are passed directly to 'go instal') it tries to install those | ||||
| " is given(which are passed directly to 'go install') it tries to install those | ||||
| " packages. Errors are populated in the location window. | ||||
| function! go#cmd#Install(bang, ...) | ||||
|     let command = 'go install ' . go#util#Shelljoin(a:000) | ||||
|     call go#cmd#autowrite() | ||||
|     let out = go#tool#ExecuteInDir(command) | ||||
|     if v:shell_error | ||||
|         let errors = go#tool#ParseErrors(split(out, '\n')) | ||||
|         call go#list#Populate(errors) | ||||
|         call go#list#Window(len(errors)) | ||||
|         if !empty(errors) && !a:bang | ||||
|             call go#list#JumpToFirst() | ||||
|     let default_makeprg = &makeprg | ||||
|  | ||||
|     " :make expands '%' and '#' wildcards, so they must also be escaped | ||||
|     let goargs = go#util#Shelljoin(map(copy(a:000), "expand(v:val)"), 1) | ||||
|     let &makeprg = "go install " . goargs | ||||
|  | ||||
|     let l:listtype = go#list#Type("quickfix") | ||||
|     " execute make inside the source folder so we can parse the errors | ||||
|     " correctly | ||||
|     let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' | ||||
|     let dir = getcwd() | ||||
|     try | ||||
|         execute cd . fnameescape(expand("%:p:h")) | ||||
|         if g:go_dispatch_enabled && exists(':Make') == 2 | ||||
|             call go#util#EchoProgress("building dispatched ...") | ||||
|             silent! exe 'Make' | ||||
|         elseif l:listtype == "locationlist" | ||||
|             silent! exe 'lmake!' | ||||
|         else | ||||
|             silent! exe 'make!' | ||||
|         endif | ||||
|         redraw! | ||||
|     finally | ||||
|         execute cd . fnameescape(dir) | ||||
|     endtry | ||||
|  | ||||
|     let errors = go#list#Get(l:listtype) | ||||
|     call go#list#Window(l:listtype, len(errors)) | ||||
|     if !empty(errors) | ||||
|         if !a:bang | ||||
|             call go#list#JumpToFirst(l:listtype) | ||||
|         endif | ||||
|         return | ||||
|     else | ||||
|         call go#list#Clean() | ||||
|         call go#list#Window() | ||||
|         redraws! | echon "vim-go: " | echohl Function | echon "installed to ". $GOPATH | echohl None | ||||
|     endif | ||||
|  | ||||
|     echon "vim-go: " | echohl Function | echon "installed to ". $GOPATH | echohl None | ||||
|     let &makeprg = default_makeprg | ||||
| endfunction | ||||
|  | ||||
| " Test runs `go test` in the current directory. If compile is true, it'll | ||||
| @ -166,14 +194,19 @@ function! go#cmd#Test(bang, compile, ...) | ||||
|         " expand all wildcards(i.e: '%' to the current file name) | ||||
|         let goargs = map(copy(a:000), "expand(v:val)") | ||||
|  | ||||
|         " escape all shell arguments before we pass it to test | ||||
|         call extend(args, go#util#Shelllist(goargs, 1)) | ||||
|         call extend(args, goargs, 1) | ||||
|     else | ||||
|         " only add this if no custom flags are passed | ||||
|         let timeout  = get(g:, 'go_test_timeout', '10s') | ||||
|         call add(args, printf("-timeout=%s", timeout)) | ||||
|     endif | ||||
|  | ||||
|     if a:compile | ||||
|         echon "vim-go: " | echohl Identifier | echon "compiling tests ..." | echohl None | ||||
|     else | ||||
|         echon "vim-go: " | echohl Identifier | echon "testing ..." | echohl None | ||||
|     endif | ||||
|  | ||||
|     if has('nvim') | ||||
|         if get(g:, 'go_term_enabled', 0) | ||||
|             call go#term#new(a:bang, ["go"] + args) | ||||
| @ -183,34 +216,38 @@ function! go#cmd#Test(bang, compile, ...) | ||||
|         return | ||||
|     endif | ||||
|  | ||||
|     if a:compile | ||||
|         echon "vim-go: " | echohl Identifier | echon "compiling tests ..." | echohl None | ||||
|     else | ||||
|         echon "vim-go: " | echohl Identifier | echon "testing ..." | echohl None | ||||
|     endif | ||||
|  | ||||
|     call go#cmd#autowrite() | ||||
|     redraw | ||||
|  | ||||
|     let command = "go " . join(args, ' ') | ||||
|  | ||||
|     let out = go#tool#ExecuteInDir(command) | ||||
|     if v:shell_error | ||||
|         let errors = go#tool#ParseErrors(split(out, '\n')) | ||||
|         let errors = go#tool#FilterValids(errors) | ||||
|  | ||||
|         call go#list#Populate(errors) | ||||
|         call go#list#Window(len(errors)) | ||||
|     let l:listtype = "quickfix" | ||||
|  | ||||
|     if v:shell_error | ||||
|         let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' | ||||
|         let dir = getcwd() | ||||
|         try | ||||
|             execute cd fnameescape(expand("%:p:h")) | ||||
|             let errors = go#tool#ParseErrors(split(out, '\n')) | ||||
|             let errors = go#tool#FilterValids(errors) | ||||
|         finally | ||||
|             execute cd . fnameescape(dir) | ||||
|         endtry | ||||
|  | ||||
|         call go#list#Populate(l:listtype, errors) | ||||
|         call go#list#Window(l:listtype, len(errors)) | ||||
|         if !empty(errors) && !a:bang | ||||
|             call go#list#JumpToFirst() | ||||
|             call go#list#JumpToFirst(l:listtype) | ||||
|         elseif empty(errors) | ||||
|             " failed to parse errors, output the original content | ||||
|             call go#util#EchoError(out) | ||||
|         endif | ||||
|         echon "vim-go: " | echohl ErrorMsg | echon "[test] FAIL" | echohl None | ||||
|     else | ||||
|         call go#list#Clean() | ||||
|         call go#list#Window() | ||||
|         call go#list#Clean(l:listtype) | ||||
|         call go#list#Window(l:listtype) | ||||
|  | ||||
|         if a:compile | ||||
|             echon "vim-go: " | echohl Function | echon "[test] SUCCESS" | echohl None | ||||
| @ -256,19 +293,21 @@ function! go#cmd#Coverage(bang, ...) | ||||
|  | ||||
|     let command = "go test -coverprofile=" . l:tmpname . ' ' . go#util#Shelljoin(a:000) | ||||
|  | ||||
|  | ||||
|     let l:listtype = "quickfix" | ||||
|     call go#cmd#autowrite() | ||||
|     let out = go#tool#ExecuteInDir(command) | ||||
|     if v:shell_error | ||||
|         let errors = go#tool#ParseErrors(split(out, '\n')) | ||||
|         call go#list#Populate(errors) | ||||
|         call go#list#Window(len(errors)) | ||||
|         call go#list#Populate(l:listtype, errors) | ||||
|         call go#list#Window(l:listtype, len(errors)) | ||||
|         if !empty(errors) && !a:bang | ||||
|             call go#list#JumpToFirst() | ||||
|             call go#list#JumpToFirst(l:listtype) | ||||
|         endif | ||||
|     else | ||||
|         " clear previous location list  | ||||
|         call go#list#Clean() | ||||
|         call go#list#Window() | ||||
|         call go#list#Clean(l:listtype) | ||||
|         call go#list#Window(l:listtype) | ||||
|  | ||||
|         let openHTML = 'go tool cover -html='.l:tmpname | ||||
|         call go#tool#ExecuteInDir(openHTML) | ||||
| @ -293,19 +332,23 @@ function! go#cmd#Generate(bang, ...) | ||||
|         let &makeprg = "go generate " . goargs . ' ' . gofiles | ||||
|     endif | ||||
|  | ||||
|     let l:listtype = go#list#Type("quickfix") | ||||
|  | ||||
|     echon "vim-go: " | echohl Identifier | echon "generating ..."| echohl None | ||||
|     if g:go_dispatch_enabled && exists(':Make') == 2 | ||||
|         silent! exe 'Make' | ||||
|     else | ||||
|     elseif l:listtype == "locationlist" | ||||
|         silent! exe 'lmake!' | ||||
|     else | ||||
|         silent! exe 'make!' | ||||
|     endif | ||||
|     redraw! | ||||
|  | ||||
|     let errors = go#list#Get() | ||||
|     call go#list#Window(len(errors)) | ||||
|     let errors = go#list#Get(l:listtype) | ||||
|     call go#list#Window(l:listtype, len(errors)) | ||||
|     if !empty(errors)  | ||||
|         if !a:bang | ||||
|             call go#list#JumpToFirst() | ||||
|             call go#list#JumpToFirst(l:listtype) | ||||
|         endif | ||||
|     else | ||||
|         redraws! | echon "vim-go: " | echohl Function | echon "[generate] SUCCESS"| echohl None | ||||
|  | ||||
| @ -87,7 +87,7 @@ fu! s:gocodeCurrentBufferOpt(filename) | ||||
|     return '-in=' . a:filename | ||||
| endf | ||||
|  | ||||
| fu! s:gocodeCursor() | ||||
| fu! go#complete#gocodeCursor() | ||||
|     if &encoding != 'utf-8' | ||||
|         let sep = &l:fileformat == 'dos' ? "\r\n" : "\n" | ||||
|         let c = col('.') | ||||
| @ -95,6 +95,7 @@ fu! s:gocodeCursor() | ||||
|         let buf .= c == 1 ? "" : getline('.')[:c-2] | ||||
|         return printf('%d', len(iconv(buf, &encoding, "utf-8"))) | ||||
|     endif | ||||
|  | ||||
|     return printf('%d', line2byte(line('.')) + (col('.')-2)) | ||||
| endf | ||||
|  | ||||
| @ -102,16 +103,16 @@ fu! s:gocodeAutocomplete() | ||||
|     let filename = s:gocodeCurrentBuffer() | ||||
|     let result = s:gocodeCommand('autocomplete', | ||||
|                 \ [s:gocodeCurrentBufferOpt(filename), '-f=vim'], | ||||
|                 \ [expand('%:p'), s:gocodeCursor()]) | ||||
|                 \ [expand('%:p'), go#complete#gocodeCursor()]) | ||||
|     call delete(filename) | ||||
|     return result | ||||
| endf | ||||
|  | ||||
| function! go#complete#GetInfo() | ||||
| function! go#complete#GetInfoFromOffset(offset) | ||||
|     let filename = s:gocodeCurrentBuffer() | ||||
|     let result = s:gocodeCommand('autocomplete', | ||||
|                 \ [s:gocodeCurrentBufferOpt(filename), '-f=godit'], | ||||
|                 \ [expand('%:p'), s:gocodeCursor()]) | ||||
|                 \ [expand('%:p'), a:offset]) | ||||
|     call delete(filename) | ||||
|  | ||||
|     " first line is: Charcount,,NumberOfCandidates, i.e: 8,,1 | ||||
| @ -147,6 +148,11 @@ function! go#complete#GetInfo() | ||||
|     return "" | ||||
| endfunction | ||||
|  | ||||
| function! go#complete#GetInfo() | ||||
|     let offset = go#complete#gocodeCursor() | ||||
|     return go#complete#GetInfoFromOffset(offset) | ||||
| endfunction | ||||
|  | ||||
| function! go#complete#Info() | ||||
|     let result = go#complete#GetInfo() | ||||
|     if !empty(result) | ||||
|  | ||||
| @ -2,6 +2,15 @@ if !exists("g:go_godef_bin") | ||||
| 	let g:go_godef_bin = "godef" | ||||
| endif | ||||
|  | ||||
| if go#vimproc#has_vimproc() | ||||
| 	let s:vim_system = get(g:, 'gocomplete#system_function', 'vimproc#system2') | ||||
| else | ||||
| 	let s:vim_system = get(g:, 'gocomplete#system_function', 'system') | ||||
| endif | ||||
|  | ||||
| fu! s:system(str, ...) | ||||
| 	return call(s:vim_system, [a:str] + a:000) | ||||
| endf | ||||
|  | ||||
| " modified and improved version of vim-godef | ||||
| function! go#def#Jump(...) | ||||
| @ -21,10 +30,11 @@ function! go#def#Jump(...) | ||||
| 	let old_gopath = $GOPATH | ||||
| 	let $GOPATH = go#path#Detect() | ||||
|  | ||||
| 	let command = bin_path . " -f=" . shellescape(expand("%:p")) . " -i " . shellescape(arg) | ||||
| 	let fname = fnamemodify(expand("%"), ':p:gs?\\?/?') | ||||
| 	let command = bin_path . " -f=" . shellescape(fname) . " -i " . shellescape(arg) | ||||
|  | ||||
| 	" get output of godef | ||||
| 	let out=system(command, join(getbufline(bufnr('%'), 1, '$'), go#util#LineEnding())) | ||||
| 	let out = s:system(command, join(getbufline(bufnr('%'), 1, '$'), go#util#LineEnding())) | ||||
|  | ||||
| 	" jump to it | ||||
| 	call s:godefJump(out, "") | ||||
| @ -43,10 +53,11 @@ function! go#def#JumpMode(mode) | ||||
| 	let old_gopath = $GOPATH | ||||
| 	let $GOPATH = go#path#Detect() | ||||
|  | ||||
| 	let command = bin_path . " -f=" . shellescape(expand("%:p")) . " -i " . shellescape(arg) | ||||
| 	let fname = fnamemodify(expand("%"), ':p:gs?\\?/?') | ||||
| 	let command = bin_path . " -f=" . shellescape(fname) . " -i " . shellescape(arg) | ||||
|  | ||||
| 	" get output of godef | ||||
| 	let out=system(command, join(getbufline(bufnr('%'), 1, '$'), go#util#LineEnding())) | ||||
| 	let out = s:system(command, join(getbufline(bufnr('%'), 1, '$'), go#util#LineEnding())) | ||||
|  | ||||
| 	call s:godefJump(out, a:mode) | ||||
| 	let $GOPATH = old_gopath | ||||
| @ -74,7 +85,7 @@ function! s:godefJump(out, mode) | ||||
| 	let &errorformat = "%f:%l:%c" | ||||
|  | ||||
| 	if a:out =~ 'godef: ' | ||||
| 		let out=substitute(a:out, go#util#LineEnding() . '$', '', '') | ||||
| 		let out = substitute(a:out, go#util#LineEnding() . '$', '', '') | ||||
| 		echom out | ||||
| 	else | ||||
| 		let parts = split(a:out, ':') | ||||
|  | ||||
| @ -43,8 +43,6 @@ if !exists("g:go_fmt_experimental") | ||||
|     let g:go_fmt_experimental = 0 | ||||
| endif | ||||
|  | ||||
| let s:got_fmt_error = 0 | ||||
|  | ||||
| "  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 | ||||
| @ -54,8 +52,13 @@ let s:got_fmt_error = 0 | ||||
| "  this and have VimL experience, please look at the function for | ||||
| "  improvements, patches are welcome :) | ||||
| function! go#fmt#Format(withGoimport) | ||||
|     " save cursor position and many other things | ||||
|     let l:curw=winsaveview() | ||||
|     " save cursor position, folds and many other things | ||||
|     let l:curw = {} | ||||
|     try | ||||
|         mkview! | ||||
|     catch | ||||
|         let l:curw=winsaveview() | ||||
|     endtry | ||||
|  | ||||
|     " Write current unsaved buffer to a temp file | ||||
|     let l:tmpname = tempname() | ||||
| @ -105,6 +108,7 @@ function! go#fmt#Format(withGoimport) | ||||
|         let $GOPATH = old_gopath | ||||
|     endif | ||||
|  | ||||
|     let l:listtype = "locationlist" | ||||
|     "if there is no error on the temp file replace the output with the current | ||||
|     "file (if this fails, we can always check the outputs first line with: | ||||
|     "splitted =~ 'package \w\+') | ||||
| @ -119,13 +123,13 @@ function! go#fmt#Format(withGoimport) | ||||
|         let &fileformat = old_fileformat | ||||
|         let &syntax = &syntax | ||||
|  | ||||
|         " clean up previous location list, but only if it's due fmt | ||||
|         if s:got_fmt_error  | ||||
|             let s:got_fmt_error = 0 | ||||
|             call go#list#Clean() | ||||
|             call go#list#Window() | ||||
|         " clean up previous location list, but only if it's due to fmt | ||||
|         if exists('b:got_fmt_error') && b:got_fmt_error | ||||
|             let b:got_fmt_error = 0 | ||||
|             call go#list#Clean(l:listtype) | ||||
|             call go#list#Window(l:listtype) | ||||
|         endif | ||||
|     elseif g:go_fmt_fail_silently == 0  | ||||
|     elseif g:go_fmt_fail_silently == 0 | ||||
|         let splitted = split(out, '\n') | ||||
|         "otherwise get the errors and put them to location list | ||||
|         let errors = [] | ||||
| @ -142,12 +146,12 @@ function! go#fmt#Format(withGoimport) | ||||
|             % | " Couldn't detect gofmt error format, output errors | ||||
|         endif | ||||
|         if !empty(errors) | ||||
|             call go#list#Populate(errors) | ||||
|             call go#list#Populate(l:listtype, errors) | ||||
|             echohl Error | echomsg "Gofmt returned error" | echohl None | ||||
|         endif | ||||
|  | ||||
|         let s:got_fmt_error = 1 | ||||
|         call go#list#Window(len(errors)) | ||||
|         let b:got_fmt_error = 1 | ||||
|         call go#list#Window(l:listtype, len(errors)) | ||||
|  | ||||
|         " We didn't use the temp file, so clean up | ||||
|         call delete(l:tmpname) | ||||
| @ -159,8 +163,12 @@ function! go#fmt#Format(withGoimport) | ||||
|         call delete(tmpundofile) | ||||
|     endif | ||||
|  | ||||
|     " restore our cursor/windows positions | ||||
|     call winrestview(l:curw) | ||||
|     " restore our cursor/windows positions, folds, etc.. | ||||
|     if empty(l:curw) | ||||
|         silent! loadview | ||||
|     else | ||||
|         call winrestview(l:curw) | ||||
|     endif | ||||
| endfunction | ||||
|  | ||||
|  | ||||
|  | ||||
| @ -96,14 +96,16 @@ endfunction | ||||
| function! s:on_exit(job_id, exit_status) | ||||
|   let std_combined = self.stderr + self.stdout | ||||
|   if a:exit_status == 0 | ||||
|     call go#list#Clean() | ||||
|     call go#list#Window() | ||||
|     call go#list#Clean(0) | ||||
|     call go#list#Window(0) | ||||
|  | ||||
|     let self.state = "SUCCESS" | ||||
|     call go#util#EchoSuccess("SUCCESS") | ||||
|     return | ||||
|   endif | ||||
|  | ||||
|   let self.state = "FAILED" | ||||
|   call go#util#EchoError("FAILED") | ||||
|  | ||||
|   let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' | ||||
|   let dir = getcwd() | ||||
| @ -123,10 +125,11 @@ function! s:on_exit(job_id, exit_status) | ||||
|  | ||||
|   " if we are still in the same windows show the list | ||||
|   if self.winnr == winnr() | ||||
|     call go#list#Populate(errors) | ||||
|     call go#list#Window(len(errors)) | ||||
|     let l:listtype = "locationlist" | ||||
|     call go#list#Populate(l:listtype, errors) | ||||
|     call go#list#Window(l:listtype, len(errors)) | ||||
|     if !empty(errors) && !self.bang | ||||
|       call go#list#JumpToFirst() | ||||
|       call go#list#JumpToFirst(l:listtype) | ||||
|     endif | ||||
|   endif | ||||
| endfunction | ||||
|  | ||||
| @ -63,10 +63,11 @@ function! go#lint#Gometa(autosave, ...) abort | ||||
|  | ||||
|     let out = go#tool#ExecuteInDir(meta_command) | ||||
|  | ||||
|     let l:listtype = "quickfix" | ||||
|     if v:shell_error == 0 | ||||
|         redraw | echo | ||||
|         call go#list#Clean() | ||||
|         call go#list#Window() | ||||
|         call go#list#Clean(l:listtype) | ||||
|         call go#list#Window(l:listtype) | ||||
|         echon "vim-go: " | echohl Function | echon "[metalinter] PASS" | echohl None | ||||
|     else | ||||
|         " GoMetaLinter can output one of the two, so we look for both: | ||||
| @ -76,13 +77,13 @@ function! go#lint#Gometa(autosave, ...) abort | ||||
|         let errformat = "%f:%l:%c:%t%*[^:]:\ %m,%f:%l::%t%*[^:]:\ %m" | ||||
|  | ||||
|         " Parse and populate our location list | ||||
|         call go#list#ParseFormat(errformat, split(out, "\n")) | ||||
|         call go#list#ParseFormat(l:listtype, errformat, split(out, "\n")) | ||||
|  | ||||
|         let errors = go#list#Get() | ||||
|         call go#list#Window(len(errors)) | ||||
|         let errors = go#list#Get(l:listtype) | ||||
|         call go#list#Window(l:listtype, len(errors)) | ||||
|  | ||||
|         if !a:autosave | ||||
|             call go#list#JumpToFirst() | ||||
|             call go#list#JumpToFirst(l:listtype) | ||||
|         endif | ||||
|     endif | ||||
| endfunction | ||||
| @ -107,10 +108,11 @@ function! go#lint#Golint(...) abort | ||||
|         return | ||||
|     endif | ||||
|  | ||||
|     call go#list#Parse(out) | ||||
|     let errors = go#list#Get() | ||||
|     call go#list#Window(len(errors)) | ||||
|     call go#list#JumpToFirst() | ||||
|     let l:listtype = "quickfix" | ||||
|     call go#list#Parse(l:listtype, out) | ||||
|     let errors = go#list#Get(l:listtype) | ||||
|     call go#list#Window(l:listtype, len(errors)) | ||||
|     call go#list#JumpToFirst(l:listtype) | ||||
| endfunction | ||||
|  | ||||
| " Vet calls 'go vet' on the current directory. Any warnings are populated in | ||||
| @ -123,17 +125,19 @@ function! go#lint#Vet(bang, ...) | ||||
|     else | ||||
|         let out = go#tool#ExecuteInDir('go tool vet ' . go#util#Shelljoin(a:000)) | ||||
|     endif | ||||
|  | ||||
|     let l:listtype = "quickfix" | ||||
|     if v:shell_error | ||||
|         let errors = go#tool#ParseErrors(split(out, '\n')) | ||||
|         call go#list#Populate(errors) | ||||
|         call go#list#Window(len(errors)) | ||||
|         call go#list#Populate(l:listtype, errors) | ||||
|         call go#list#Window(l:listtype, len(errors)) | ||||
|         if !empty(errors) && !a:bang | ||||
|             call go#list#JumpToFirst() | ||||
|             call go#list#JumpToFirst(l:listtype) | ||||
|         endif | ||||
|         echon "vim-go: " | echohl ErrorMsg | echon "[vet] FAIL" | echohl None | ||||
|     else | ||||
|         call go#list#Clean() | ||||
|         call go#list#Window() | ||||
|         call go#list#Clean(l:listtype) | ||||
|         call go#list#Window(l:listtype) | ||||
|         redraw | echon "vim-go: " | echohl Function | echon "[vet] PASS" | echohl None | ||||
|     endif | ||||
| endfunction | ||||
| @ -159,21 +163,17 @@ function! go#lint#Errcheck(...) abort | ||||
|     echon "vim-go: " | echohl Identifier | echon "errcheck analysing ..." | echohl None | ||||
|     redraw | ||||
|  | ||||
|     let command = bin_path . ' ' . goargs | ||||
|     let command = bin_path . ' -abspath ' . goargs | ||||
|     let out = go#tool#ExecuteInDir(command) | ||||
|  | ||||
|     let l:listtype = "quickfix" | ||||
|     if v:shell_error | ||||
|         let errors = [] | ||||
|         let mx = '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)' | ||||
|         for line in split(out, '\n') | ||||
|             let tokens = matchlist(line, mx) | ||||
|             if !empty(tokens) | ||||
|                 call add(errors, {"filename": expand(go#path#Default() . "/src/" . tokens[1]), | ||||
|                             \"lnum": tokens[2], | ||||
|                             \"col": tokens[3], | ||||
|                             \"text": tokens[4]}) | ||||
|             endif | ||||
|         endfor | ||||
|         let errformat = "%f:%l:%c:\ %m, %f:%l:%c\ %#%m" | ||||
|  | ||||
|         " Parse and populate our location list | ||||
|         call go#list#ParseFormat(l:listtype, errformat, split(out, "\n")) | ||||
|  | ||||
|         let errors = go#list#Get(l:listtype) | ||||
|  | ||||
|         if empty(errors) | ||||
|             echohl Error | echomsg "GoErrCheck returned error" | echohl None | ||||
| @ -182,15 +182,15 @@ function! go#lint#Errcheck(...) abort | ||||
|         endif | ||||
|  | ||||
|         if !empty(errors) | ||||
|             call go#list#Populate(errors) | ||||
|             call go#list#Window(len(errors)) | ||||
|             call go#list#Populate(l:listtype, errors) | ||||
|             call go#list#Window(l:listtype, len(errors)) | ||||
|             if !empty(errors) | ||||
|                 call go#list#JumpToFirst() | ||||
|                 call go#list#JumpToFirst(l:listtype) | ||||
|             endif | ||||
|         endif | ||||
|     else | ||||
|         call go#list#Clean() | ||||
|         call go#list#Window() | ||||
|         call go#list#Clean(l:listtype) | ||||
|         call go#list#Window(l:listtype) | ||||
|         echon "vim-go: " | echohl Function | echon "[errcheck] PASS" | echohl None | ||||
|     endif | ||||
|  | ||||
|  | ||||
| @ -1,18 +1,27 @@ | ||||
| " Window opens the location list with the given height up to 10 lines maximum. | ||||
| if !exists("g:go_list_type") | ||||
|     let g:go_list_type = "" | ||||
| endif | ||||
|  | ||||
| " Window opens the list with the given height up to 10 lines maximum. | ||||
| " Otherwise g:go_loclist_height is used. If no or zero height is given it | ||||
| " closes the window | ||||
| function! go#list#Window(...) | ||||
| function! go#list#Window(listtype, ...) | ||||
|     let l:listtype = go#list#Type(a:listtype) | ||||
|     " we don't use lwindow to close the location list as we need also the | ||||
|     " ability to resize the window. So, we are going to use lopen and cclose | ||||
|     " ability to resize the window. So, we are going to use lopen and lclose | ||||
|     " for a better user experience. If the number of errors in a current | ||||
|     " location list increases/decreases, cwindow will not resize when a new | ||||
|     " updated height is passed. lopen in the other hand resizes the screen. | ||||
|     if !a:0 || a:1 == 0 | ||||
|         lclose | ||||
|         if l:listtype == "locationlist" | ||||
|             lclose | ||||
|         else | ||||
|             cclose | ||||
|         endif | ||||
|         return | ||||
|     endif | ||||
|  | ||||
|     let height = get(g:, "go_loclist_height", 0) | ||||
|     let height = get(g:, "go_list_height", 0) | ||||
|     if height == 0 | ||||
|         " prevent creating a large location height for a large set of numbers | ||||
|         if a:1 > 10 | ||||
| @ -22,50 +31,96 @@ function! go#list#Window(...) | ||||
|         endif | ||||
|     endif | ||||
|  | ||||
|     exe 'lopen '. height | ||||
|     if l:listtype == "locationlist" | ||||
|       exe 'lopen ' . height | ||||
|     else | ||||
|       exe 'copen ' . height | ||||
|     endif | ||||
| endfunction | ||||
|  | ||||
|  | ||||
| " Get returns the current list of items from the location list | ||||
| function! go#list#Get() | ||||
|   return getloclist(0) | ||||
| function! go#list#Get(listtype) | ||||
|     let l:listtype = go#list#Type(a:listtype) | ||||
|     if l:listtype == "locationlist" | ||||
|         return getloclist(0) | ||||
|     else | ||||
|         return getqflist() | ||||
|     endif | ||||
| endfunction | ||||
|  | ||||
| " Populate populate the location list with the given items | ||||
| function! go#list#Populate(items) | ||||
| 	call setloclist(0, a:items, 'r') | ||||
| function! go#list#Populate(listtype, items) | ||||
|     let l:listtype = go#list#Type(a:listtype) | ||||
|     if l:listtype == "locationlist" | ||||
|         call setloclist(0, a:items, 'r') | ||||
|     else | ||||
|         call setqflist(a:items, 'r') | ||||
|     endif | ||||
| endfunction | ||||
|  | ||||
| function! go#list#PopulateWin(winnr, items) | ||||
| 	call setloclist(a:winnr, a:items, 'r') | ||||
|     call setloclist(a:winnr, a:items, 'r') | ||||
| endfunction | ||||
|  | ||||
| " Parse parses the given items based on the specified errorformat nad | ||||
| " populates the location list. | ||||
| function! go#list#ParseFormat(errformat, items) | ||||
|   " backup users errorformat, will be restored once we are finished | ||||
|   let old_errorformat = &errorformat | ||||
| function! go#list#ParseFormat(listtype, errformat, items) | ||||
|     let l:listtype = go#list#Type(a:listtype) | ||||
|     " backup users errorformat, will be restored once we are finished | ||||
|     let old_errorformat = &errorformat | ||||
|  | ||||
| 	" parse and populate the location list | ||||
|   let &errorformat = a:errformat | ||||
| 	lgetexpr a:items | ||||
|     " parse and populate the location list | ||||
|     let &errorformat = a:errformat | ||||
|     if l:listtype == "locationlist" | ||||
|         lgetexpr a:items | ||||
|     else | ||||
|         cgetexpr a:items | ||||
|     endif | ||||
|  | ||||
| 	"restore back | ||||
|   let &errorformat = old_errorformat | ||||
|     "restore back | ||||
|     let &errorformat = old_errorformat | ||||
| endfunction | ||||
|  | ||||
| " Parse parses the given items based on the global errorformat nad | ||||
| " Parse parses the given items based on the global errorformat and | ||||
| " populates the location list. | ||||
| function! go#list#Parse(items) | ||||
| 	lgetexpr a:items | ||||
| function! go#list#Parse(listtype, items) | ||||
|     let l:listtype = go#list#Type(a:listtype) | ||||
|     if l:listtype == "locationlist" | ||||
|         lgetexpr a:items | ||||
|     else | ||||
|         cgetexpr a:items | ||||
|     endif | ||||
| endfunction | ||||
|  | ||||
| " JumpToFirst jumps to the first item in the location list | ||||
| function! go#list#JumpToFirst() | ||||
|   ll 1  | ||||
| function! go#list#JumpToFirst(listtype) | ||||
|     let l:listtype = go#list#Type(a:listtype) | ||||
|     if l:listtype == "locationlist" | ||||
|         ll 1 | ||||
|     else | ||||
|         cc 1 | ||||
|     endif | ||||
| endfunction | ||||
|  | ||||
| " Clean cleans the location list | ||||
| function! go#list#Clean() | ||||
| 	lex [] | ||||
| function! go#list#Clean(listtype) | ||||
|     let l:listtype = go#list#Type(a:listtype) | ||||
|     if l:listtype == "locationlist" | ||||
|         lex [] | ||||
|     else | ||||
|         cex [] | ||||
|     endif | ||||
| endfunction | ||||
|  | ||||
| function! go#list#Type(listtype) | ||||
|     if g:go_list_type == "locationlist" | ||||
|         return "locationlist" | ||||
|     elseif g:go_list_type == "quickfix" | ||||
|         return "quickfix"  | ||||
|     else | ||||
|         return a:listtype | ||||
|     endif | ||||
| endfunction | ||||
|  | ||||
| " vim:ts=4:sw=4:et | ||||
|  | ||||
| @ -35,8 +35,8 @@ func! s:loclist(output) | ||||
|         endif | ||||
|         call add(llist, item) | ||||
|     endfor | ||||
|     call go#list#Populate(llist) | ||||
|     call go#list#Window(len(llist)) | ||||
|     call go#list#Populate("locationlist", llist) | ||||
|     call go#list#Window("locationlist", len(llist)) | ||||
| endfun | ||||
|  | ||||
| " This uses Vim's errorformat to parse the output from Oracle's 'plain output | ||||
| @ -56,10 +56,10 @@ func! s:loclistSecond(output) | ||||
|     " useful and location only has the ability to show one line and column | ||||
|     " number | ||||
|     let errformat = "%f:%l.%c-%[%^:]%#:\ %m,%f:%l:%c:\ %m" | ||||
|     call go#list#ParseFormat(errformat, split(a:output, "\n")) | ||||
|     call go#list#ParseFormat("locationlist", errformat, split(a:output, "\n")) | ||||
|  | ||||
|     let errors = go#list#Get() | ||||
|     call go#list#Window(len(errors)) | ||||
|     let errors = go#list#Get("locationlist") | ||||
|     call go#list#Window("locationlist", len(errors)) | ||||
| endfun | ||||
|  | ||||
| func! s:getpos(l, c) | ||||
|  | ||||
| @ -31,17 +31,19 @@ endif | ||||
| function! go#package#Paths() | ||||
|     let dirs = [] | ||||
|  | ||||
|     if executable('go') | ||||
|         let goroot = substitute(system('go env GOROOT'), '\n', '', 'g') | ||||
|         if v:shell_error | ||||
|             echomsg '''go env GOROOT'' failed' | ||||
|     if !exists("s:goroot") | ||||
|         if executable('go') | ||||
|             let s:goroot = substitute(system('go env GOROOT'), '\n', '', 'g') | ||||
|             if v:shell_error | ||||
|                 echomsg '''go env GOROOT'' failed' | ||||
|             endif | ||||
|         else | ||||
|             let s:goroot = $GOROOT | ||||
|         endif | ||||
|     else | ||||
|         let goroot = $GOROOT | ||||
|     endif | ||||
|  | ||||
|     if len(goroot) != 0 && isdirectory(goroot) | ||||
|         let dirs += [goroot] | ||||
|     if len(s:goroot) != 0 && isdirectory(s:goroot) | ||||
|         let dirs += [s:goroot] | ||||
|     endif | ||||
|  | ||||
|     let workspaces = split($GOPATH, go#util#PathListSep()) | ||||
|  | ||||
| @ -91,7 +91,7 @@ function! go#path#Detect() | ||||
|         " gb vendor plugin | ||||
|         " (https://github.com/constabulary/gb/tree/master/cmd/gb-vendor) | ||||
|         let gb_vendor_root = src_path . "vendor" . go#util#PathSep() | ||||
|         if !empty(gb_vendor_root) && !go#path#HasPath(gb_vendor_root) | ||||
|         if isdirectory(gb_vendor_root) && !go#path#HasPath(gb_vendor_root) | ||||
|             let gopath = gb_vendor_root . go#util#PathListSep() . gopath | ||||
|         endif | ||||
|  | ||||
|  | ||||
| @ -2,21 +2,32 @@ if !exists("g:go_gorename_bin") | ||||
|     let g:go_gorename_bin = "gorename" | ||||
| endif | ||||
|  | ||||
| if !exists("g:go_gorename_prefill") | ||||
|     let g:go_gorename_prefill = 1 | ||||
| endif | ||||
|  | ||||
| function! go#rename#Rename(bang, ...) | ||||
|     let to = "" | ||||
|     if a:0 == 0 | ||||
|         let from = expand("<cword>") | ||||
|         let ask = printf("vim-go: rename '%s' to: ", from) | ||||
|         let to = input(ask, from) | ||||
|         redraw | ||||
|         if g:go_gorename_prefill | ||||
|             let to = input(ask, from) | ||||
|         else | ||||
|             let to = input(ask) | ||||
|         endif | ||||
|         redraw! | ||||
|         if empty(to) | ||||
|             return | ||||
|         endif | ||||
|     else | ||||
|         let to = a:1 | ||||
|     endif | ||||
|  | ||||
|     "return with a warning if the bin doesn't exist | ||||
|     let bin_path = go#path#CheckBinPath(g:go_gorename_bin)  | ||||
|     if empty(bin_path)  | ||||
|         return  | ||||
|     let bin_path = go#path#CheckBinPath(g:go_gorename_bin) | ||||
|     if empty(bin_path) | ||||
|         return | ||||
|     endif | ||||
|  | ||||
|     let fname = expand('%:p') | ||||
| @ -29,20 +40,21 @@ function! go#rename#Rename(bang, ...) | ||||
|     " will trigger the 'Hit ENTER to continue' prompt | ||||
|     let clean = split(out, '\n') | ||||
|  | ||||
|     let l:listtype = "quickfix" | ||||
|     if v:shell_error | ||||
|         let errors = go#tool#ParseErrors(split(out, '\n')) | ||||
|         call go#list#Populate(errors) | ||||
|         call go#list#Window(len(errors)) | ||||
|         call go#list#Populate(l:listtype, errors) | ||||
|         call go#list#Window(l:listtype, len(errors)) | ||||
|         if !empty(errors) && !a:bang | ||||
|             call go#list#JumpToFirst() | ||||
|             call go#list#JumpToFirst(l:listtype) | ||||
|         elseif empty(errors) | ||||
|             " failed to parse errors, output the original content | ||||
|             call go#util#EchoError(out) | ||||
|         endif | ||||
|         return | ||||
|     else | ||||
|         call go#list#Clean() | ||||
|         call go#list#Window() | ||||
|         call go#list#Clean(l:listtype) | ||||
|         call go#list#Window(l:listtype) | ||||
|         redraw | echon "vim-go: " | echohl Function | echon clean[0] | echohl None | ||||
|     endif | ||||
|  | ||||
|  | ||||
| @ -8,7 +8,7 @@ let s:jobs = {} | ||||
| " new creates a new terminal with the given command. Mode is set based on the | ||||
| " global variable g:go_term_mode, which is by default set to :vsplit | ||||
| function! go#term#new(bang, cmd) | ||||
|     call go#term#newmode(a:bang, a:cmd, g:go_term_mode) | ||||
|     return go#term#newmode(a:bang, a:cmd, g:go_term_mode) | ||||
| endfunction | ||||
|  | ||||
| " new creates a new terminal with the given command and window mode. | ||||
| @ -98,10 +98,11 @@ function! s:on_exit(job_id, data) | ||||
|     endif | ||||
|     let job = s:jobs[a:job_id] | ||||
|  | ||||
|     let l:listtype = "locationlist" | ||||
|     " usually there is always output so never branch into this clause | ||||
|     if empty(job.stdout) | ||||
|         call go#list#Clean() | ||||
|         call go#list#Window() | ||||
|         call go#list#Clean(l:listtype) | ||||
|         call go#list#Window(l:listtype) | ||||
|     else | ||||
|         let errors = go#tool#ParseErrors(job.stdout) | ||||
|         let errors = go#tool#FilterValids(errors) | ||||
| @ -109,14 +110,14 @@ function! s:on_exit(job_id, data) | ||||
|             " close terminal we don't need it | ||||
|             close  | ||||
|  | ||||
|             call go#list#Populate(errors) | ||||
|             call go#list#Window(len(errors)) | ||||
|             call go#list#Populate(l:listtype, errors) | ||||
|             call go#list#Window(l:listtype, len(errors)) | ||||
|             if !self.bang | ||||
|                 call go#list#JumpToFirst() | ||||
|                 call go#list#JumpToFirst(l:listtype) | ||||
|             endif | ||||
|         else | ||||
|             call go#list#Clean() | ||||
|             call go#list#Window() | ||||
|             call go#list#Clean(l:listtype) | ||||
|             call go#list#Window(l:listtype) | ||||
|         endif | ||||
|  | ||||
|     endif | ||||
|  | ||||
| @ -1,70 +1,82 @@ | ||||
| " PathSep returns the appropriate OS specific path separator. | ||||
| function! go#util#PathSep() | ||||
| 	if go#util#IsWin() | ||||
| 		return '\' | ||||
| 	endif | ||||
| 	return '/' | ||||
|     if go#util#IsWin() | ||||
|         return '\' | ||||
|     endif | ||||
|     return '/' | ||||
| endfunction | ||||
|  | ||||
| " PathListSep returns the appropriate OS specific path list separator. | ||||
| function! go#util#PathListSep() | ||||
| 	if go#util#IsWin() | ||||
| 		return ";" | ||||
| 	endif | ||||
| 	return ":" | ||||
|     if go#util#IsWin() | ||||
|         return ";" | ||||
|     endif | ||||
|     return ":" | ||||
| endfunction | ||||
|  | ||||
| " LineEnding returns the correct line ending, based on the current fileformat | ||||
| function! go#util#LineEnding() | ||||
| 	if &fileformat == 'dos' | ||||
| 		return "\r\n" | ||||
| 	elseif &fileformat == 'mac' | ||||
| 		return "\r" | ||||
| 	endif | ||||
|     if &fileformat == 'dos' | ||||
|         return "\r\n" | ||||
|     elseif &fileformat == 'mac' | ||||
|         return "\r" | ||||
|     endif | ||||
|  | ||||
| 	return "\n" | ||||
|     return "\n" | ||||
| endfunction | ||||
|  | ||||
| " IsWin returns 1 if current OS is Windows or 0 otherwise | ||||
| function! go#util#IsWin() | ||||
| 	let win = ['win16', 'win32', 'win64', 'win95'] | ||||
| 	for w in win | ||||
| 		if (has(w)) | ||||
| 			return 1 | ||||
| 		endif | ||||
| 	endfor | ||||
|     let win = ['win16', 'win32', 'win64', 'win95'] | ||||
|     for w in win | ||||
|         if (has(w)) | ||||
|             return 1 | ||||
|         endif | ||||
|     endfor | ||||
|  | ||||
| 	return 0 | ||||
|     return 0 | ||||
| endfunction | ||||
|  | ||||
| " StripPath strips the path's last character if it's a path separator. | ||||
| " example: '/foo/bar/'  -> '/foo/bar' | ||||
| function! go#util#StripPathSep(path) | ||||
| 	let last_char = strlen(a:path) - 1 | ||||
| 	if a:path[last_char] == go#util#PathSep() | ||||
| 		return strpart(a:path, 0, last_char) | ||||
| 	endif | ||||
|     let last_char = strlen(a:path) - 1 | ||||
|     if a:path[last_char] == go#util#PathSep() | ||||
|         return strpart(a:path, 0, last_char) | ||||
|     endif | ||||
|  | ||||
| 	return a:path | ||||
|     return a:path | ||||
| endfunction | ||||
|  | ||||
| " Shelljoin returns a shell-safe string representation of arglist. The | ||||
| " {special} argument of shellescape() may optionally be passed. | ||||
| function! go#util#Shelljoin(arglist, ...) | ||||
| 	if a:0 | ||||
| 		return join(map(copy(a:arglist), 'shellescape(v:val, ' . a:1 . ')'), ' ') | ||||
| 	endif | ||||
|     try | ||||
|         let ssl_save = &shellslash | ||||
|         set noshellslash | ||||
|         if a:0 | ||||
|             return join(map(copy(a:arglist), 'shellescape(v:val, ' . a:1 . ')'), ' ') | ||||
|         endif | ||||
|  | ||||
| 	return join(map(copy(a:arglist), 'shellescape(v:val)'), ' ') | ||||
|         return join(map(copy(a:arglist), 'shellescape(v:val)'), ' ') | ||||
|     finally | ||||
|         let &shellslash = ssl_save | ||||
|     endtry | ||||
| endfunction | ||||
|  | ||||
| " Shelljoin returns a shell-safe representation of the items in the given | ||||
| " Shelllist returns a shell-safe representation of the items in the given | ||||
| " arglist. The {special} argument of shellescape() may optionally be passed. | ||||
| function! go#util#Shelllist(arglist, ...) | ||||
| 	if a:0 | ||||
| 		return map(copy(a:arglist), 'shellescape(v:val, ' . a:1 . ')') | ||||
|     endif | ||||
| 	return map(copy(a:arglist), 'shellescape(v:val)') | ||||
|     try | ||||
|         let ssl_save = &shellslash | ||||
|         set noshellslash | ||||
|         if a:0 | ||||
|             return map(copy(a:arglist), 'shellescape(v:val, ' . a:1 . ')') | ||||
|         endif | ||||
|         return map(copy(a:arglist), 'shellescape(v:val)') | ||||
|     finally | ||||
|         let &shellslash = ssl_save | ||||
|     endtry | ||||
| endfunction | ||||
|  | ||||
| " TODO(arslan): I couldn't parameterize the highlight types. Check if we can | ||||
|  | ||||
| @ -14,14 +14,15 @@ | ||||
| =============================================================================== | ||||
| CONTENTS                                                          *go-contents* | ||||
|  | ||||
| 	1. Intro........................................|go-intro| | ||||
| 	2. Install......................................|go-install| | ||||
| 	3. Commands.....................................|go-commands| | ||||
| 	4. Mappings.....................................|go-mappings| | ||||
| 	5. Text Objects.................................|go-text-objects| | ||||
| 	6. Settings.....................................|go-settings| | ||||
| 	7. Troubleshooting..............................|go-troubleshooting| | ||||
| 	8. Credits......................................|go-credits| | ||||
|   1. Intro........................................|go-intro| | ||||
|   2. Install......................................|go-install| | ||||
|   3. Commands.....................................|go-commands| | ||||
|   4. Mappings.....................................|go-mappings| | ||||
|   5. Text Objects.................................|go-text-objects| | ||||
|   6. Functions....................................|go-functions| | ||||
|   7. Settings.....................................|go-settings| | ||||
|   8. Troubleshooting..............................|go-troubleshooting| | ||||
|   9. Credits......................................|go-credits| | ||||
|  | ||||
| =============================================================================== | ||||
| INTRO                                                                *go-intro* | ||||
| @ -61,10 +62,14 @@ easily. | ||||
|   * Share your current code to [play.golang.org](http://play.golang.org) with `:GoPlay` | ||||
|   * On-the-fly type information about the word under the cursor. Plug it into | ||||
|     your custom vim function. | ||||
|   * Go asm formatting on save | ||||
|   * Tagbar support to show tags of the source code in a sidebar with `gotags` | ||||
|   * Custom vim text objects such as `a function` or `inner function` | ||||
|   * All commands support collecting and displaying errors in Vim's location | ||||
|   list. | ||||
|   * A async launcher for the go command is implemented for neovim, fully async | ||||
|     building and testing. | ||||
|   * Integrated with the neovim terminal, launch `:GoRun` and other go commands | ||||
|     in their own new terminal. | ||||
|   * Alternate between implementation and test code with `:GoAlternate` | ||||
|  | ||||
| =============================================================================== | ||||
| INSTALL                                                           *go-install* | ||||
| @ -108,13 +113,15 @@ packages. | ||||
|  | ||||
| * Autocompletion is enabled by default via `<C-x><C-o>`, to get real-time | ||||
| completion (completion by type) install: | ||||
| https://github.com/Valloric/YouCompleteMe or | ||||
| https://github.com/Shougo/neocomplete.vim | ||||
| https://github.com/Shougo/neocomplete.vim for Vim or | ||||
| https://github.com/Shougo/deoplete.nvim and | ||||
| https://github.com/zchee/deoplete-go for Neovim | ||||
| * To get displayed source code tag informations on a sidebar install | ||||
| https://github.com/majutsushi/tagbar. | ||||
| * For snippet feature install: | ||||
| https://github.com/SirVer/ultisnips or | ||||
| https://github.com/Shougo/neosnippet.vim. | ||||
| https://github.com/Shougo/neosnippet.vim or | ||||
| https://github.com/SirVer/ultisnips. | ||||
| * For a better documentation viewer checkout: https://github.com/garyburd/go-explorer | ||||
|  | ||||
| =============================================================================== | ||||
| COMMANDS                                                          *go-commands* | ||||
| @ -222,11 +229,15 @@ COMMANDS                                                          *go-commands* | ||||
|  | ||||
|     If [!] is not given the first error is jumped to. | ||||
|  | ||||
|     If using neovim then `:GoRun` will run in a new terminal according to | ||||
|     |g:go_term_mode|. | ||||
|  | ||||
|                                                                    *:GoBuild* | ||||
| :GoBuild[!] [expand] | ||||
|  | ||||
|     Build your package with `go build`. It automatically builds only the files | ||||
|     that depends on the current file. GoBuild doesn't produce a result file. | ||||
|     Build your package with `go build`. Errors are populated in the quickfix | ||||
|     window. It automatically builds only the files that depends on the current | ||||
|     file. `:GoBuild` doesn't produce a result file. | ||||
|     Use 'make' to create a result file. | ||||
|  | ||||
|     You may optionally pass any valid go build flags/options. For a full list | ||||
| @ -234,6 +245,9 @@ COMMANDS                                                          *go-commands* | ||||
|  | ||||
|     If [!] is not given the first error is jumped to. | ||||
|  | ||||
|     If using neovim then this command is fully async, it does not block the | ||||
|     UI. | ||||
|  | ||||
|                                                                    *:GoGenerate* | ||||
| :GoGenerate[!] [expand] | ||||
|  | ||||
| @ -266,8 +280,8 @@ COMMANDS                                                          *go-commands* | ||||
| :GoTest[!] [expand] | ||||
|  | ||||
|     Run the tests on your _test.go files via in your current directory. Errors | ||||
|     are populated in location list.  If an argument is passed, 'expand' is | ||||
|     used as file selector (useful for cases like `:GoTest ./...`). | ||||
|     are populated in the quickfix window.  If an argument is passed, 'expand' | ||||
|     is used as file selector (useful for cases like `:GoTest ./...`). | ||||
|  | ||||
|     You may optionally pass any valid go test flags/options. For a full list | ||||
|     please see `go help test`. | ||||
| @ -278,6 +292,10 @@ COMMANDS                                                          *go-commands* | ||||
|  | ||||
|     If [!] is not given the first error is jumped to. | ||||
|  | ||||
|     If using neovim `:GoTest` will run in a new terminal or run asynchronously | ||||
|     in the background according to |g:go_term_enabled|. You can set the mode of | ||||
|     the new terminal with |g:go_term_mode|. | ||||
|  | ||||
|                                                               *:GoTestFunc* | ||||
| :GoTestFunc[!] [expand] | ||||
|  | ||||
| @ -290,17 +308,25 @@ COMMANDS                                                          *go-commands* | ||||
|  | ||||
|     If [!] is not given the first error is jumped to. | ||||
|  | ||||
|     If using neovim `:GoTestFunc` will run in a new terminal or run asynchronously | ||||
|     in the background according to |g:go_term_enabled|. You can set the mode of | ||||
|     the new terminal with |g:go_term_mode|. | ||||
|  | ||||
|                                                               *:GoTestCompile* | ||||
| :GoTestCompile[!] [expand] | ||||
|  | ||||
|     Compile your _test.go files via in your current directory. Errors are | ||||
|     populated in location list.  If an argument is passed, 'expand' is used | ||||
|     as file selector (useful for cases like `:GoTest ./...`). Useful to not | ||||
|     run the tests and capture/fix errors before running the tests or to | ||||
|     populated in the quickfix window.  If an argument is passed, 'expand' is | ||||
|     used as file selector (useful for cases like `:GoTest ./...`). Useful to | ||||
|     not run the tests and capture/fix errors before running the tests or to | ||||
|     create test binary. | ||||
|  | ||||
|     If [!] is not given the first error is jumped to. | ||||
|  | ||||
|     If using neovim `:GoTestCompile` will run in a new terminal or run asynchronously | ||||
|     in the background according to |g:go_term_enabled|. You can set the mode of | ||||
|     the new terminal with |g:go_term_mode|. | ||||
|  | ||||
|                                                                 *:GoCoverage* | ||||
| :GoCoverage[!] [options] | ||||
|  | ||||
| @ -316,7 +342,7 @@ COMMANDS                                                          *go-commands* | ||||
| :GoErrCheck [options] | ||||
|  | ||||
|     Check for unchecked errors in you current package. Errors are populated in | ||||
|     location list. | ||||
|     the quickfix window. | ||||
|  | ||||
|     You may optionally pass any valid errcheck flags/options. For a full list | ||||
|     please see `errcheck -h`. | ||||
| @ -349,7 +375,7 @@ COMMANDS                                                          *go-commands* | ||||
|  | ||||
|     Show 'implements' relation for a selected package. A list of interfaces | ||||
|     for the type that implements an interface under the cursor (or selected | ||||
|     package) is shown location list. | ||||
|     package) is shown in a location list. | ||||
|                                                                 *:GoRename* | ||||
| :GoRename[!] [to] | ||||
|  | ||||
| @ -394,7 +420,7 @@ COMMANDS                                                          *go-commands* | ||||
| :GoCallstack | ||||
|  | ||||
|     Shows 'callstack' relation for the selected function. An arbitrary path | ||||
|     from the root of the callgraph to the selected function is showed in a | ||||
|     from the root of the callgraph to the selected function is shown in a | ||||
|     location list. This may be useful to understand how the function is | ||||
|     reached in a given program. | ||||
|  | ||||
| @ -435,8 +461,8 @@ COMMANDS                                                          *go-commands* | ||||
| :GoMetaLinter [path] | ||||
|  | ||||
|     Calls the underlying `gometalinter` tool and displays all warnings and | ||||
|     errors in a location list. By default the following linters are enabled: | ||||
|     "'vet', 'golint', 'errcheck'". This can be changed with the | ||||
|     errors in the quickfix window. By default the following linters are | ||||
|     enabled: "'vet', 'golint', 'errcheck'". This can be changed with the | ||||
|     |g:go_metalinter_enabled| variable. To override the command completely use | ||||
|     the variable |g:go_metalinter_command|. To override the maximum linters | ||||
|     execution time use |g:go_metalinter_deadline| variable. | ||||
| @ -445,12 +471,38 @@ COMMANDS                                                          *go-commands* | ||||
| :GoOracleTags [tags] | ||||
|  | ||||
|     Changes the custom |g:go_oracle_tags| setting and overrides it with the | ||||
|     given build tags. This command cooperate with GoReferrers command when  | ||||
|     there exist mulitiple build tags in your project,then you can set one  | ||||
|     given build tags. This command cooperate with GoReferrers command when | ||||
|     there exist mulitiple build tags in your project, then you can set one | ||||
|     of the build tags for GoReferrers to find more accurate. | ||||
|     The custom build tags is cleared (unset) if `""` is given. If no arguments | ||||
|     is given it prints the current custom build tags. | ||||
|  | ||||
|                                                                      *:AsmFmt* | ||||
| :AsmFmt | ||||
|  | ||||
|     Filter the current Go asm buffer through asmfmt. It tries to preserve cursor | ||||
|     position and avoids replacing the buffer with stderr output. | ||||
|  | ||||
|  | ||||
|                                                                    *:GoAlternate* | ||||
| :GoAlternate[!] | ||||
|  | ||||
|     Alternates between the implementation and test code. For example if in main.go, | ||||
|     switch to main_test.go. Uses the |g:go_alternate_mode| setting as the command | ||||
|     to open the file. | ||||
|  | ||||
|     If [!] is given then it switches to the new file even if it does not exist. | ||||
|  | ||||
|     If you would like to override the traditional commands for alternating, add | ||||
|     the following to your .vimrc: | ||||
| > | ||||
|     augroup go | ||||
|       autocmd! | ||||
|       autocmd Filetype go command! -bang A call go#alternate#Switch(<bang>0, 'edit') | ||||
|       autocmd Filetype go command! -bang AV call go#alternate#Switch(<bang>0, 'vsplit') | ||||
|       autocmd Filetype go command! -bang AS call go#alternate#Switch(<bang>0, 'split') | ||||
|     augroup END | ||||
| < | ||||
|  | ||||
| =============================================================================== | ||||
| MAPPINGS                                                        *go-mappings* | ||||
| @ -469,6 +521,21 @@ documentation in the |go-commands| section. Available <Plug> keys are: | ||||
|  | ||||
| Calls `go run` for the current file | ||||
|  | ||||
|                                                                *(go-run-tab)* | ||||
|  | ||||
| Calls `go run` for the current file in a new terminal tab | ||||
| This option is neovim only. | ||||
|  | ||||
|                                                               *(go-run-split)* | ||||
|  | ||||
| Calls `go run` for the current file in a new terminal horizontal split | ||||
| This option is neovim only. | ||||
|  | ||||
|                                                               *(go-run-vertical)* | ||||
|  | ||||
| Calls `go run` for the current file in a new terminal vertical split | ||||
| This option is neovim only. | ||||
|  | ||||
|  | ||||
|                                                                 *(go-build)* | ||||
|  | ||||
| @ -604,6 +671,18 @@ Show all refs to entity denoted by selected identifier | ||||
|  | ||||
| Calls `go-metalinter` for the current directory | ||||
|  | ||||
|                                                         *(go-alternate-edit)* | ||||
|  | ||||
| Alternates between the implementation and test code in the current window | ||||
|  | ||||
|                                                       *(go-alternate-split)* | ||||
|  | ||||
| Alternates between the implementation and test code in a new horizontal split | ||||
|  | ||||
|                                                     *(go-alternate-vertical)* | ||||
|  | ||||
| Alternates between the implementation and test code in a new vertical split | ||||
|  | ||||
| =============================================================================== | ||||
| TEXT OBJECTS                                                 *go-text-objects* | ||||
|  | ||||
| @ -620,6 +699,22 @@ if			      "inside a function", select contents of a function, | ||||
|  | ||||
|  | ||||
|  | ||||
| =============================================================================== | ||||
| FUNCTIONS                                                       *go-functions* | ||||
|  | ||||
|                                                   *go#jobcontrol#Statusline()* | ||||
|  | ||||
| Shows the status of a job running asynchronously. Can be used to plug into the | ||||
| statusline. It works to show the status per package instead of per | ||||
| file. Assume you have three files open, all belonging to the same package, | ||||
| if the package build (`:GoBuild`) is successful, all statusline's will be empty | ||||
| (means SUCCESS), if you it fails all file's statusline will show FAILED. | ||||
|  | ||||
|                                                       *go#complete#GetInfo()* | ||||
|  | ||||
| Returns the description of the identifer under the cursor. Can be used to plug | ||||
| into the statusline. This function is also used for |g:go_auto_type_info|. | ||||
|  | ||||
| =============================================================================== | ||||
| SETTINGS                                                        *go-settings* | ||||
|  | ||||
| @ -691,7 +786,7 @@ is empty. > | ||||
|                                                    *'g:go_fmt_fail_silently'* | ||||
|  | ||||
| Use this option to disable showing a location list when |g:go_fmt_command| | ||||
| fails. By default it's disabled. > | ||||
| fails. By default the location list is shown. > | ||||
|  | ||||
|   let g:go_fmt_fail_silently = 0 | ||||
| < | ||||
| @ -707,26 +802,24 @@ it's causing problems on some Vim versions. By default it's disabled. > | ||||
| < | ||||
|                                               *'g:go_doc_keywordprg_enabled'* | ||||
|  | ||||
| Use this option to change the enable GoDoc to run on words under the cursor | ||||
| with the default K , keywordprg shortcut. This shortcut is by default set to | ||||
| use the program man. However in go using godoc is more idiomatic. Default is | ||||
| enabled. > | ||||
| Use this option to run `godoc` on words under the cursor with the default | ||||
| 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_mapping_enabled'* | ||||
|  | ||||
| Use this option to enabled/ disable the default mapping (`gd`) for GoDef | ||||
| enabled. Disabling it allows you to map something else to the mapping `gd`. | ||||
| Default is enabled. > | ||||
| Use this option to enable/disable the default mapping of (`gd`) for GoDef. | ||||
| Disabling it allows you to map something else to `gd`. Default is enabled. > | ||||
|  | ||||
|   let g:go_def_mapping_enabled = 1 | ||||
| < | ||||
|                                                     *'g:go_dispatch_enabled'* | ||||
|  | ||||
| Use this option to enable/disable the use of Dispatch to execute the | ||||
| `:GoRun`, `:GoBuild` and `:GoGenerate` commands.  More information about Dispatch is | ||||
| available at https://github.com/tpope/vim-dispatch. Default is disabled. > | ||||
| `:GoRun`, `:GoBuild` and `:GoGenerate` commands. More information about Dispatch | ||||
| is available at https://github.com/tpope/vim-dispatch. Default is disabled. > | ||||
|  | ||||
|   let g:go_dispatch_enabled = 0 | ||||
| < | ||||
| @ -762,13 +855,12 @@ is used. Use "neosnippet" for neosnippet.vim: > | ||||
|  | ||||
|                                                       *'g:go_oracle_scope'* | ||||
|  | ||||
| Use this option to define the scope of the analysis to be passed for Oracle | ||||
| related commands, such as |GoImplements|, |GoCallers|, etc..  By default it's | ||||
| not set, so only the current packages go files are passed as scope. You can | ||||
| change it on-the-fly with |GoOracleScope|. For more | ||||
| info please have look at Oracle's User Manual: | ||||
| https://docs.google.com/document/d/1SLk36YRjjMgKqe490mSRzOPYEDe0Y_WQNRv-EiFYUyw/view#heading=h.nwso96pj07q8 | ||||
| > | ||||
| Use this option to define the scope of the analysis to be passed for oracle | ||||
| related commands, such as |GoImplements|, |GoCallers|, etc.  By default it's | ||||
| not set, so only the current package's go files are passed as scope. You can | ||||
| change it on-the-fly with |GoOracleScope|. For more info, please have a look | ||||
| at oracle's user manual: | ||||
| https://golang.org/s/oracle-user-manual#heading=h.nwso96pj07q8 > | ||||
|  | ||||
|   let g:go_oracle_scope = '' | ||||
| < | ||||
| @ -782,8 +874,8 @@ Highlights white space after "[]". > | ||||
|  | ||||
|                                       *'g:go_highlight_chan_whitespace_error'* | ||||
|  | ||||
| Highlights white space around the communications operator that don't follow | ||||
| the standard style. > | ||||
| Highlights white space around the communications operator (`<-`) that doesn't | ||||
| follow the standard style. > | ||||
|  | ||||
|   let g:go_highlight_chan_whitespace_error = 1 | ||||
| < | ||||
| @ -810,7 +902,7 @@ Highlights trailing white space. > | ||||
| < | ||||
|                                                   *'g:go_highlight_operators'* | ||||
|  | ||||
| Highlights operators such as `:=` , `==`, `-=`, etc ...By default it's | ||||
| Highlights operators such as `:=` , `==`, `-=`, etc. By default it's | ||||
| disabled. > | ||||
|  | ||||
| 	let g:go_highlight_operators = 0 | ||||
| @ -832,6 +924,12 @@ Highlights method names. By default it's disabled. > | ||||
| Highlights struct names. By default it's disabled. > | ||||
|  | ||||
| 	let g:go_highlight_structs = 0 | ||||
| < | ||||
|                                                *'g:go_highlight_interfaces'* | ||||
|  | ||||
| Highlights interface names. By default it's disabled. > | ||||
|  | ||||
|   let g:go_highlight_interfaces = 0 | ||||
| < | ||||
|                                         *'g:go_highlight_build_constraints'* | ||||
|  | ||||
| @ -841,8 +939,8 @@ Highlights build constraints. By default it's disabled. > | ||||
| < | ||||
|                                         *'g:go_highlight_string_spellcheck* | ||||
|  | ||||
| Specifies spell checking enabled for strings. Spelling errors are highlighted | ||||
| if |spell| is enabled. By default it's enabled. > | ||||
| Use this option to highlight spelling errors in strings when |spell| is | ||||
| also enabled. By default it's enabled. > | ||||
|  | ||||
| 	let g:go_highlight_string_spellcheck = 1 | ||||
| < | ||||
| @ -850,7 +948,7 @@ if |spell| is enabled. By default it's enabled. > | ||||
|                                                 *'g:go_autodetect_gopath'* | ||||
|  | ||||
| Automatically modifies GOPATH for certain directory structures, such as for | ||||
| the tool godep which has his own dependencies via the `Godeps` folder. What | ||||
| the tool `godep` which has his own dependencies via the `Godeps` folder. What | ||||
| this means is that all tools are now working with the newly modified GOPATH. | ||||
| So |GoDef| for example jumps to the source inside the `Godeps` (vendored) | ||||
| source. Currently `godep` and `gb` is supported, in the near future more tool | ||||
| @ -874,14 +972,14 @@ the active buffer will be shown. By default it's disabled > | ||||
|                                          *'g:go_metalinter_autosave_enabled'* | ||||
|  | ||||
| Specifies the enabled linters for auto |GoMetaLinter| on save. By | ||||
| default it's using `vet` and `golint` | ||||
| default it's using `vet` and `golint`. | ||||
| > | ||||
|   let g:go_metalinter_autosave_enabled = ['vet', 'golint'] | ||||
| < | ||||
|                                                   *'g:go_metalinter_enabled'* | ||||
|  | ||||
| Specifies the currently enabled linters for the |GoMetaLinter| command. By | ||||
| default it's using `vet`, `golint` and `errcheck` | ||||
| default it's using `vet`, `golint` and `errcheck`. | ||||
| > | ||||
|   let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck'] | ||||
| < | ||||
| @ -889,7 +987,7 @@ default it's using `vet`, `golint` and `errcheck` | ||||
|  | ||||
| Overrides the command to be executed when |GoMetaLinter| is called. This is | ||||
| an advanced settings and is for users who want to have a complete control | ||||
| over of how `gometalinter` should be executed. By default it's empty. | ||||
| over how `gometalinter` should be executed. By default it's empty. | ||||
| > | ||||
|   let g:go_metalinter_command = "" | ||||
| < | ||||
| @ -900,14 +998,75 @@ seconds. | ||||
| > | ||||
|   let g:go_metalinter_deadline = "5s" | ||||
| < | ||||
|                                                   *'g:go_loclist_height'* | ||||
|                                                   *'g:go_list_height'* | ||||
|  | ||||
| Specifies the current location list height for all location lists. The default | ||||
| value (empty) sets automatically the height to the number of errors (maximum | ||||
| up to 10 errors to prevent large heights). Setting the value explicitly | ||||
| overrides this behavior. To get default Vim behavior set it to 10. | ||||
| Specifies the window height for the quickfix and location list windows. The | ||||
| default value (empty) automatically sets the height to the number of items | ||||
| (maximum up to 10 items to prevent large heights). Setting the value | ||||
| explicitly overrides this behavior. For standard Vim behavior, set it to 10. | ||||
| > | ||||
|   let g:go_loclist_height = 0 | ||||
|   let g:go_list_height = 0 | ||||
| < | ||||
|                                                   *'g:go_list_type'* | ||||
|  | ||||
| Specifies the type of list to use. The default value (empty) will use the | ||||
| appropriate kind of list for the command that was called. Supported values are | ||||
| "", "quickfix", and "locationlist". > | ||||
|  | ||||
|   let g:go_list_type = "" | ||||
| < | ||||
|                                                   *'g:go_asmfmt_autosave'* | ||||
|  | ||||
| Use this option to auto |:AsmFmt| on save. By default it's enabled. > | ||||
|  | ||||
|   let g:go_asmfmt_autosave = 1 | ||||
| < | ||||
|                                                        *g:go_term_mode* | ||||
|  | ||||
| This option is Neovim only. Use it to change the default command used to | ||||
| open a new terminal for go commands such as |:GoRun|. | ||||
| The default is vsplit. | ||||
| > | ||||
|   let g:go_term_mode = "vsplit" | ||||
| < | ||||
|                                                        *g:go_term_height* | ||||
|                                                         *g:go_term_width* | ||||
|  | ||||
| These options are Neovim only. Use them to control the height and width of | ||||
| a terminal split. By default these are not set, meaning that the height and | ||||
| width are set automatically by Neovim. The height only applies to a | ||||
| horizontal split and width only applies to a vertical split. | ||||
|  | ||||
| For example here is how to set each to 30. | ||||
| > | ||||
|   let g:go_term_height = 30 | ||||
|   let g:go_term_width = 30 | ||||
| < | ||||
|                                                        *g:go_term_enabled* | ||||
|  | ||||
| This option is Neovim only. Use it to change the behavior of the test | ||||
| commands. If set to 1 it opens the test commands inside a new terminal | ||||
| according to |g:go_term_mode|, otherwise it will run them in the background | ||||
| just like `:GoBuild` and then display the status with |go#jobcontrol#Statusline()|. | ||||
| By default it is disabled. | ||||
| > | ||||
|   let g:go_term_enabled = 0 | ||||
| < | ||||
|                                                         *g:go_alternate_mode* | ||||
|  | ||||
| Specifies the command that |:GoAlternate| uses to open the alternate file. | ||||
| By default it is set to edit. | ||||
| > | ||||
|   let g:go_alternate_mode = "edit" | ||||
| < | ||||
|                                                        *g:go_gorename_prefill* | ||||
|  | ||||
| Specifies whether |:GoRename| prefills the new identifier name with the | ||||
| word under the cursor. By default is is enabled. | ||||
| > | ||||
|   let g:go_gorename_prefill = 1 | ||||
| < | ||||
|  | ||||
|  | ||||
| =============================================================================== | ||||
| TROUBLESHOOTING                                         *go-troubleshooting* | ||||
|  | ||||
| @ -5,11 +5,11 @@ let s:current_fileformats = '' | ||||
| let s:current_fileencodings = '' | ||||
|  | ||||
| " define fileencodings to open as utf-8 encoding even if it's ascii. | ||||
| function! s:gofiletype_pre() | ||||
| function! s:gofiletype_pre(type) | ||||
|     let s:current_fileformats = &g:fileformats | ||||
|     let s:current_fileencodings = &g:fileencodings | ||||
|     set fileencodings=utf-8 fileformats=unix | ||||
|     setlocal filetype=go | ||||
|     let &l:filetype = a:type | ||||
| endfunction | ||||
|  | ||||
| " restore fileencodings as others | ||||
| @ -19,9 +19,13 @@ function! s:gofiletype_post() | ||||
| endfunction | ||||
|  | ||||
| au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix | ||||
| au BufRead *.go call s:gofiletype_pre() | ||||
| au BufRead *.go call s:gofiletype_pre("go") | ||||
| au BufReadPost *.go call s:gofiletype_post() | ||||
|  | ||||
| au BufNewFile *.s setfiletype asm | setlocal fileencoding=utf-8 fileformat=unix | ||||
| au BufRead *.s call s:gofiletype_pre("asm") | ||||
| au BufReadPost *.s call s:gofiletype_post() | ||||
|  | ||||
| au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl | ||||
|  | ||||
| " vim:ts=4:sw=4:et | ||||
|  | ||||
							
								
								
									
										17
									
								
								sources_non_forked/vim-go/ftplugin/asm.vim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								sources_non_forked/vim-go/ftplugin/asm.vim
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | ||||
| " asm.vim: Vim filetype plugin for Go assembler. | ||||
|  | ||||
| if exists("b:did_ftplugin") | ||||
|     finish | ||||
| endif | ||||
| let b:did_ftplugin = 1 | ||||
|  | ||||
| let b:undo_ftplugin = "setl fo< com< cms<" | ||||
|  | ||||
| setlocal formatoptions-=t | ||||
|  | ||||
| setlocal comments=s1:/*,mb:*,ex:*/,:// | ||||
| setlocal commentstring=//\ %s | ||||
|  | ||||
| setlocal noexpandtab | ||||
|  | ||||
| command! -nargs=0 AsmFmt call go#asmfmt#Format() | ||||
| @ -53,4 +53,7 @@ command! -nargs=* GoLint call go#lint#Golint(<f-args>) | ||||
| command! -nargs=* -bang GoVet call go#lint#Vet(<bang>0, <f-args>) | ||||
| command! -nargs=* -complete=customlist,go#package#Complete GoErrCheck call go#lint#Errcheck(<f-args>) | ||||
|  | ||||
| " -- alternate | ||||
| command! -bang GoAlternate call go#alternate#Switch(<bang>0, '') | ||||
|  | ||||
| " vim:ts=4:sw=4:et | ||||
|  | ||||
| @ -5,17 +5,16 @@ | ||||
| " which by default is enabled. For commands the user has the ability to pass | ||||
| " the '!', such as :GoBuild or :GoBuild! | ||||
| if !exists("g:go_jump_to_error") | ||||
|     let g:go_jump_to_error = 1 | ||||
| 	let g:go_jump_to_error = 1 | ||||
| endif | ||||
|  | ||||
|  | ||||
| " Some handy plug mappings | ||||
| nnoremap <silent> <Plug>(go-run) :<C-u>call go#cmd#Run(!g:go_jump_to_error, '%')<CR> | ||||
| nnoremap <silent> <Plug>(go-run) :<C-u>call go#cmd#Run(!g:go_jump_to_error)<CR> | ||||
|  | ||||
| if has("nvim") | ||||
| 	nnoremap <silent> <Plug>(go-run-vertical) :<C-u>call go#cmd#RunTerm('vsplit')<CR> | ||||
| 	nnoremap <silent> <Plug>(go-run-split) :<C-u>call go#cmd#RunTerm('split')<CR> | ||||
| 	nnoremap <silent> <Plug>(go-run-tab) :<C-u>call go#cmd#RunTerm('tab')<CR> | ||||
| 	nnoremap <silent> <Plug>(go-run-vertical) :<C-u>call go#cmd#RunTerm(!g:go_jump_to_error, 'vsplit')<CR> | ||||
| 	nnoremap <silent> <Plug>(go-run-split) :<C-u>call go#cmd#RunTerm(!g:go_jump_to_error, 'split')<CR> | ||||
| 	nnoremap <silent> <Plug>(go-run-tab) :<C-u>call go#cmd#RunTerm(!g:go_jump_to_error, 'tabe')<CR> | ||||
| endif | ||||
|  | ||||
| nnoremap <silent> <Plug>(go-build) :<C-u>call go#cmd#Build(!g:go_jump_to_error)<CR> | ||||
| @ -56,4 +55,6 @@ nnoremap <silent> <Plug>(go-doc-browser) :<C-u>call go#doc#OpenBrowser()<CR> | ||||
| nnoremap <silent> <Plug>(go-metalinter) :<C-u>call go#lint#Gometa(0)<CR> | ||||
| nnoremap <silent> <Plug>(go-vet) :<C-u>call go#lint#Vet(!g:go_jump_to_error)<CR> | ||||
|  | ||||
|  | ||||
| nnoremap <silent> <Plug>(go-alternate-edit) :<C-u>call go#alternate#Switch(0, "edit")<CR> | ||||
| nnoremap <silent> <Plug>(go-alternate-vertical) :<C-u>call go#alternate#Switch(0, "vsplit")<CR> | ||||
| nnoremap <silent> <Plug>(go-alternate-split) :<C-u>call go#alternate#Switch(0, "split")<CR> | ||||
|  | ||||
| @ -124,6 +124,7 @@ abbr if err != nil { ... } | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	${0} | ||||
| # error snippet in TestFunc | ||||
| snippet errt | ||||
| abbr if err != nil { ... } | ||||
| @ -135,11 +136,10 @@ abbr if err != nil { ... } | ||||
| snippet errn, | ||||
| abbr if err != nil { return [...], err } | ||||
| 	if err != nil { | ||||
| 		return ${2}$1, err | ||||
| 		return ${1:nil}, err | ||||
| 	} | ||||
| 	${0} | ||||
|  | ||||
|  | ||||
| # error snippet handle and return | ||||
| snippet errh | ||||
| abbr if err != nil { return } | ||||
| @ -153,6 +153,7 @@ abbr if err != nil { return } | ||||
| snippet json | ||||
| abbr \`json:key\` | ||||
| 	\`json:"${1:keyName}"\` | ||||
|  | ||||
| # fallthrough | ||||
| snippet ft | ||||
| abbr fallthrough | ||||
|  | ||||
| @ -3,3 +3,42 @@ if exists("b:did_indent") | ||||
| endif | ||||
|  | ||||
| runtime! indent/html.vim | ||||
|  | ||||
| " Indent Golang HTML templates | ||||
| setlocal indentexpr=GetGoHTMLTmplIndent(v:lnum) | ||||
| setlocal indentkeys+==else,=end | ||||
|  | ||||
| " Only define the function once. | ||||
| if exists("*GetGoHTMLTmplIndent") | ||||
|   finish | ||||
| endif | ||||
|  | ||||
| function! GetGoHTMLTmplIndent(lnum) | ||||
|   " Get HTML indent | ||||
|   if exists('*HtmlIndent') | ||||
|     let ind = HtmlIndent() | ||||
|   else | ||||
|     let ind = HtmlIndentGet(a:lnum) | ||||
|   endif | ||||
|  | ||||
|   " The value of a single shift-width | ||||
|   if exists('*shiftwidth') | ||||
|     let sw = shiftwidth() | ||||
|   else | ||||
|     let sw = &sw | ||||
|   endif | ||||
|  | ||||
|   " If need to indent based on last line | ||||
|   let last_line = getline(a:lnum-1) | ||||
|   if last_line =~ '^\s*{{\s*\%(if\|else\|range\|with\|define\|block\).*}}' | ||||
|     let ind += sw | ||||
|   endif | ||||
|  | ||||
|   " End of FuncMap block | ||||
|   let current_line = getline(a:lnum) | ||||
|   if current_line =~ '^\s*{{\s*\%(else\|end\).*}}' | ||||
|     let ind -= sw | ||||
|   endif | ||||
|  | ||||
|   return ind | ||||
| endfunction | ||||
|  | ||||
| @ -17,6 +17,7 @@ let s:packages = [ | ||||
|             \ "github.com/golang/lint/golint", | ||||
|             \ "github.com/kisielk/errcheck", | ||||
|             \ "github.com/jstemmer/gotags", | ||||
|             \ "github.com/klauspost/asmfmt/cmd/asmfmt", | ||||
|             \ ] | ||||
|  | ||||
| " These commands are available on any filetypes | ||||
| @ -119,6 +120,23 @@ endfunction | ||||
|  | ||||
| " Autocommands | ||||
| " ============================================================================ | ||||
| " | ||||
| function! s:echo_go_info() | ||||
|     if !exists('v:completed_item') || empty(v:completed_item) | ||||
|         return | ||||
|     endif | ||||
|     let item = v:completed_item | ||||
|  | ||||
|     if !has_key(item, "info") | ||||
|         return | ||||
|     endif | ||||
|  | ||||
|     if empty(item.info) | ||||
|         return | ||||
|     endif | ||||
|  | ||||
|     redraws! | echo "vim-go: " | echohl Function | echon item.info | echohl None | ||||
| endfunction | ||||
|  | ||||
| augroup vim-go | ||||
|     autocmd! | ||||
| @ -128,11 +146,22 @@ augroup vim-go | ||||
|         autocmd CursorHold *.go nested call go#complete#Info() | ||||
|     endif | ||||
|  | ||||
|     " code formatting on save | ||||
|     " Echo the identifier information when completion is done. Useful to see | ||||
|     " the signature of a function, etc... | ||||
|     if exists('##CompleteDone') | ||||
|         autocmd CompleteDone *.go nested call s:echo_go_info() | ||||
|     endif | ||||
|  | ||||
|     " Go code formatting on save | ||||
|     if get(g:, "go_fmt_autosave", 1) | ||||
|         autocmd BufWritePre *.go call go#fmt#Format(-1) | ||||
|     endif | ||||
|  | ||||
|     " Go asm formatting on save | ||||
|     if get(g:, "go_asmfmt_autosave", 1) | ||||
|         autocmd BufWritePre *.s call go#asmfmt#Format() | ||||
|     endif | ||||
|  | ||||
|     " run gometalinter on save | ||||
|     if get(g:, "go_metalinter_autosave", 0) | ||||
|         autocmd BufWritePost *.go call go#lint#Gometa(1) | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
| "     let OPTION_NAME = 1 | ||||
| "   to enable particular options. | ||||
| "   At present, all options default to on, except highlight of: | ||||
| "   functions, methods and structs. | ||||
| "   functions, methods, structs, operators, build constraints and interfaces. | ||||
| " | ||||
| "   - go_highlight_array_whitespace_error | ||||
| "     Highlights white space after "[]". | ||||
| @ -69,6 +69,10 @@ if !exists("g:go_highlight_structs") | ||||
|   let g:go_highlight_structs = 0 | ||||
| endif | ||||
|  | ||||
| if !exists("g:go_highlight_interfaces") | ||||
|   let g:go_highlight_interfaces = 0 | ||||
| endif | ||||
|  | ||||
| if !exists("g:go_highlight_build_constraints") | ||||
|   let g:go_highlight_build_constraints = 0 | ||||
| endif | ||||
| @ -291,6 +295,14 @@ endif | ||||
| hi def link     goStruct            Function | ||||
| hi def link     goStructDef         Function | ||||
|  | ||||
| " Interfaces; | ||||
| if g:go_highlight_interfaces != 0 | ||||
|   syn match goInterface             /\(.\)\@<=\w\+\({\)\@=/ | ||||
|   syn match goInterfaceDef          /\(type\s\+\)\@<=\w\+\(\s\+interface\s\+{\)\@=/ | ||||
| endif | ||||
| hi def link     goInterface         Function | ||||
| hi def link     goInterfaceDef      Function | ||||
|  | ||||
| " Build Constraints | ||||
| if g:go_highlight_build_constraints != 0 | ||||
|     syn match   goBuildKeyword      display contained "+build" | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 amix
					amix