summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Niemeyer <gustavo@niemeyer.net>2011-02-01 11:12:57 +1100
committerGustavo Niemeyer <gustavo@niemeyer.net>2011-02-01 11:12:57 +1100
commitc7940bd0f2b7bf83d4b5e0985962f35b5eaec1a4 (patch)
tree19c4014dc9b3f41ceefdc95c32c8786230e80df8
parent9e5fd228e24343b35e0ea5d54fc4a5ecb0bf4a38 (diff)
downloadgo-c7940bd0f2b7bf83d4b5e0985962f35b5eaec1a4.tar.gz
misc/vim: Define import commands on buffer switch
This change fixes the import plugin so that the defined commands are available when opening a new Go buffer from within Vim itself. R=adg, rsc CC=golang-dev http://codereview.appspot.com/3998053 Committer: Andrew Gerrand <adg@golang.org>
-rw-r--r--misc/vim/ftplugin/go/import.vim8
1 files changed, 3 insertions, 5 deletions
diff --git a/misc/vim/ftplugin/go/import.vim b/misc/vim/ftplugin/go/import.vim
index 494414962..b5814ca5d 100644
--- a/misc/vim/ftplugin/go/import.vim
+++ b/misc/vim/ftplugin/go/import.vim
@@ -32,11 +32,9 @@
" The backslash is the default maplocalleader, so it is possible that
" your vim is set to use a different character (:help maplocalleader).
"
-
-if exists("s:loaded") || exists("b:did_ftplugin")
+if exists("b:did_ftplugin")
finish
endif
-let s:loaded = 1
command! -buffer -nargs=? Drop call s:SwitchImport(0, '', <f-args>)
command! -buffer -nargs=1 Import call s:SwitchImport(1, '', <f-args>)
@@ -44,7 +42,7 @@ command! -buffer -nargs=* 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)
+function! s:SwitchImport(enabled, localname, path)
let view = winsaveview()
let path = a:path
@@ -196,7 +194,7 @@ function s:SwitchImport(enabled, localname, path)
endfunction
-function s:Error(s)
+function! s:Error(s)
echohl Error | echo a:s | echohl None
endfunction