mirror of
https://github.com/amix/vimrc
synced 2025-08-03 19:54:59 +08:00
Updated vim plugins
This commit is contained in:
@ -14,21 +14,24 @@ function! go#template#create() abort
|
||||
" files) from the directory create the template or use the cwd
|
||||
" as the name
|
||||
if l:package_name == -1 && l:go_template_use_pkg != 1
|
||||
let l:template_file = get(g:, 'go_template_file', "hello_world.go")
|
||||
let l:filename = fnamemodify(expand("%"), ':t')
|
||||
if l:filename =~ "_test.go$"
|
||||
let l:template_file = get(g:, 'go_template_test_file', "hello_world_test.go")
|
||||
else
|
||||
let l:template_file = get(g:, 'go_template_file', "hello_world.go")
|
||||
endif
|
||||
let l:template_path = go#util#Join(l:root_dir, "templates", l:template_file)
|
||||
exe '0r ' . fnameescape(l:template_path)
|
||||
$delete _
|
||||
elseif l:package_name == -1 && l:go_template_use_pkg == 1
|
||||
" cwd is now the dir of the package
|
||||
let l:path = fnamemodify(getcwd(), ':t')
|
||||
let l:content = printf("package %s", l:path)
|
||||
call append(0, l:content)
|
||||
$delete _
|
||||
else
|
||||
let l:content = printf("package %s", l:package_name)
|
||||
call append(0, l:content)
|
||||
$delete _
|
||||
endif
|
||||
$delete _
|
||||
|
||||
" Remove the '... [New File]' message line from the command line
|
||||
echon
|
||||
|
Reference in New Issue
Block a user