diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2013-09-12 17:22:37 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2013-09-12 17:22:37 +0200 |
commit | 4c2025af5cee3fcd08321c2f23c38e460d3991a9 (patch) | |
tree | 70e89149aa9778b5aa4950d456ea3b736e965625 /ftplugin | |
parent | 35433aa23c6f7753fe96c67ed2ffdbb5291085a0 (diff) | |
download | vim-polyglot-4c2025af5cee3fcd08321c2f23c38e460d3991a9.tar.gz vim-polyglot-4c2025af5cee3fcd08321c2f23c38e460d3991a9.zip |
vim-go -> vim-golang
Diffstat (limited to 'ftplugin')
-rw-r--r-- | ftplugin/go.vim | 17 | ||||
-rw-r--r-- | ftplugin/go/fmt.vim | 16 | ||||
-rw-r--r-- | ftplugin/go/import.vim | 35 |
3 files changed, 10 insertions, 58 deletions
diff --git a/ftplugin/go.vim b/ftplugin/go.vim deleted file mode 100644 index 8066733c..00000000 --- a/ftplugin/go.vim +++ /dev/null @@ -1,17 +0,0 @@ -" Copyright 2013 The Go Authors. All rights reserved. -" Use of this source code is governed by a BSD-style -" license that can be found in the LICENSE file. -" -" go.vim: Vim filetype plugin for Go. - -if exists("b:did_ftplugin") - finish -endif -let b:did_ftplugin = 1 - -setlocal comments=s1:/*,mb:*,ex:*/,:// -setlocal commentstring=//\ %s - -let b:undo_ftplugin = "setl com< cms<" - -" vim:ts=4:sw=4:et diff --git a/ftplugin/go/fmt.vim b/ftplugin/go/fmt.vim index 5447d457..30814fdf 100644 --- a/ftplugin/go/fmt.vim +++ b/ftplugin/go/fmt.vim @@ -12,25 +12,11 @@ " It tries to preserve cursor position and avoids " replacing the buffer with stderr output. " -" Options: -" -" g:go_fmt_commands [default=1] -" -" Flag to indicate whether to enable the commands listed above. -" if exists("b:did_ftplugin_go_fmt") finish endif - -if !exists("g:go_fmt_commands") - let g:go_fmt_commands = 1 -endif - - -if g:go_fmt_commands - command! -buffer Fmt call s:GoFormat() -endif +command! -buffer Fmt call s:GoFormat() function! s:GoFormat() let view = winsaveview() diff --git a/ftplugin/go/import.vim b/ftplugin/go/import.vim index 91c8697a..1d969e46 100644 --- a/ftplugin/go/import.vim +++ b/ftplugin/go/import.vim @@ -24,40 +24,23 @@ " imported, an error will be displayed and the buffer will be " untouched. " -" If you would like to add shortcuts, you can do so by doing the following: +" In addition to these commands, there are also two shortcuts mapped: " -" Import fmt -" au Filetype go nnoremap <buffer> <LocalLeader>f :Import fmt<CR> +" \f - Runs :Import fmt +" \F - Runs :Drop fmt " -" Drop fmt -" au Filetype go nnoremap <buffer> <LocalLeader>F :Drop fmt<CR> -" -" Import the word under your cursor -" au Filetype go nnoremap <buffer> <LocalLeader>k -" \ :exe 'Import ' . expand('<cword>')<CR> -" -" The backslash '\' is the default maplocalleader, so it is possible that +" The backslash is the default maplocalleader, so it is possible that " your vim is set to use a different character (:help maplocalleader). " -" Options: -" -" g:go_import_commands [default=1] -" -" Flag to indicate whether to enable the commands listed above. -" if exists("b:did_ftplugin_go_import") finish endif -if !exists("g:go_import_commands") - let g:go_import_commands = 1 -endif - -if g:go_import_commands - command! -buffer -nargs=? -complete=customlist,go#complete#Package Drop call s:SwitchImport(0, '', <f-args>) - command! -buffer -nargs=1 -complete=customlist,go#complete#Package Import call s:SwitchImport(1, '', <f-args>) - command! -buffer -nargs=* -complete=customlist,go#complete#Package ImportAs call s:SwitchImport(1, <f-args>) -endif +command! -buffer -nargs=? -complete=customlist,go#complete#Package Drop call s:SwitchImport(0, '', <f-args>) +command! -buffer -nargs=1 -complete=customlist,go#complete#Package Import call s:SwitchImport(1, '', <f-args>) +command! -buffer -nargs=* -complete=customlist,go#complete#Package ImportAs call s:SwitchImport(1, <f-args>) +map <buffer> <LocalLeader>f :Import fmt<CR> +map <buffer> <LocalLeader>F :Drop fmt<CR> function! s:SwitchImport(enabled, localname, path) let view = winsaveview() |