mirror of
				https://github.com/amix/vimrc
				synced 2025-10-31 14:43:35 +08:00 
			
		
		
		
	Updated plugins
This commit is contained in:
		| @ -19,7 +19,7 @@ function! s:godocWord(args) | ||||
|   if !executable('godoc') | ||||
|     let msg = "godoc command not found." | ||||
|     let msg .= "  install with: go get golang.org/x/tools/cmd/godoc" | ||||
|     call go#util#echoWarning(msg) | ||||
|     call go#util#EchoWarning(msg) | ||||
|     return [] | ||||
|   endif | ||||
|  | ||||
|  | ||||
							
								
								
									
										31
									
								
								sources_non_forked/vim-go/autoload/go/template.vim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								sources_non_forked/vim-go/autoload/go/template.vim
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,31 @@ | ||||
| let s:current_file = expand("<sfile>") | ||||
|  | ||||
| function! go#template#create() | ||||
|   let l:root_dir = fnamemodify(s:current_file, ':h:h:h') | ||||
|  | ||||
|   let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' | ||||
|   let dir = getcwd() | ||||
|   execute cd . fnameescape(expand("%:p:h")) | ||||
|  | ||||
|   let l:package_name = go#tool#PackageName() | ||||
|  | ||||
|   " if we can't figure out any package name(no Go files or non Go package | ||||
|   " files) from the directory create the template  | ||||
|   if l:package_name == -1 | ||||
|     let l:template_file = get(g:, 'go_template_file', "hello_world.go") | ||||
|     let l:template_path = go#util#Join(l:root_dir, "templates", l:template_file) | ||||
|     exe '0r ' . l:template_path | ||||
|     $delete _ | ||||
|   else   | ||||
|     let l:content = printf("package %s", l:package_name) | ||||
|     call append(0, l:content) | ||||
|     $delete _ | ||||
|   endif | ||||
|  | ||||
|   " Remove the '... [New File]' message line from the command line | ||||
|   echon | ||||
|  | ||||
|   execute cd . fnameescape(dir) | ||||
| endfunction | ||||
|  | ||||
| " vim: sw=2 ts=2 et | ||||
| @ -43,6 +43,16 @@ function! go#tool#Imports() | ||||
|   return imports | ||||
| endfunction | ||||
|  | ||||
| function! go#tool#PackageName() | ||||
|   let command = "go list -f '{{.Name}}'" | ||||
|   let out = go#tool#ExecuteInDir(command) | ||||
|   if go#util#ShellError() != 0 | ||||
|       return -1 | ||||
|   endif | ||||
|  | ||||
|   return split(out, '\n')[0] | ||||
| endfunction | ||||
|  | ||||
| function! go#tool#ParseErrors(lines) | ||||
|   let errors = [] | ||||
|  | ||||
|  | ||||
| @ -25,6 +25,12 @@ function! go#util#LineEnding() | ||||
|   return "\n" | ||||
| endfunction | ||||
|  | ||||
| " Join joins any number of path elements into a single path, adding a | ||||
| " Separator if necessary and returns the result | ||||
| function! go#util#Join(...) | ||||
|   return join(a:000, go#util#PathSep()) | ||||
| endfunction | ||||
|  | ||||
| " IsWin returns 1 if current OS is Windows or 0 otherwise | ||||
| function! go#util#IsWin() | ||||
|   let win = ['win16', 'win32', 'win64', 'win95'] | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 amix
					amix