Add vim plugin
diff --git a/README b/README
index e8751ec..a2cac54 100644
--- a/README
+++ b/README
@@ -27,10 +27,6 @@
Vim
---
Add this to your ~/.vimrc:
- function! s:GoLint()
- cexpr system("golint " . shellescape(expand('%')))
- copen
- endfunction
- command! GoLint :call s:GoLint()
+ exe "set rtp+=" . globpath($GOPATH, "src/github.com/golang/lint/misc/vim")
-Running :GoLint will run golint on the current file and populate the quickfix list.
+Running :Lint will run golint on the current file and populate the quickfix list.
diff --git a/misc/vim/ftplugin/go/lint.vim b/misc/vim/ftplugin/go/lint.vim
new file mode 100644
index 0000000..7dffd18
--- /dev/null
+++ b/misc/vim/ftplugin/go/lint.vim
@@ -0,0 +1,31 @@
+" 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.
+"
+" lint.vim: Vim command to lint Go files with golint.
+"
+" https://github.com/golang/lint
+"
+" This filetype plugin add a new commands for go buffers:
+"
+" :Lint
+"
+" Run golint for the current Go file.
+"
+if exists("b:did_ftplugin_go_lint")
+ finish
+endif
+
+if !executable("golint")
+ finish
+endif
+
+command! -buffer Lint call s:GoLint()
+
+function! s:GoLint() abort
+ cexpr system('golint ' . shellescape(expand('%')))
+endfunction
+
+let b:did_ftplugin_go_lint = 1
+
+" vim:ts=4:sw=4:et