From fe31b3943b13912e2be5325f279881709a8b114a Mon Sep 17 00:00:00 2001 From: Caleb Thompson Date: Fri, 13 Nov 2015 09:29:46 -0600 Subject: [PATCH] Add golang configuration samples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add suggested Go configuration for Vim into the `ftplugin` folder and the vim-go plugin. We may use this as a template for adding further language-specific settings in the future for languages that aren't universally used by the team. * `fatih/vim-go`: The de-facto Golang Vim plugin. * `softtabstop=2`: As a side effect of setting how "large" a tab is in insert mode, Vim is able to delete tabs with the backspace key in Insert mode. * `compiler go`: Necessary for plugins using the `make` command, such as vim-dispatch. * `listchars=tab:\ \ `: Don't highlight tabs as "»·" as if they were problem characters in go files. Also recommended for *sh files and any others which which should also be using tabs. * `go_fmt_command = "goimports"`: Tell vim-go to use the `goimports` command rather than `gofmt`, which attempts to find dependencies and adds them to your import statement. --- vim/ftplugin/go.vim | 6 ++++++ vimrc.bundles | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 vim/ftplugin/go.vim diff --git a/vim/ftplugin/go.vim b/vim/ftplugin/go.vim new file mode 100644 index 0000000000..e3de397a41 --- /dev/null +++ b/vim/ftplugin/go.vim @@ -0,0 +1,6 @@ +let g:go_fmt_command = "goimports" + +setlocal softtabstop=2 +setlocal listchars=tab:\ \ ,trail:·,nbsp:· + +compiler go diff --git a/vimrc.bundles b/vimrc.bundles index 3663ab7fa8..76c7ca224f 100644 --- a/vimrc.bundles +++ b/vimrc.bundles @@ -28,8 +28,9 @@ call plug#begin('~/.vim/bundle') " Define bundles via Github repos Plug 'christoomey/vim-run-interactive' -Plug 'kchmck/vim-coffee-script' Plug 'ctrlpvim/ctrlp.vim' +Plug 'fatih/vim-go' +Plug 'kchmck/vim-coffee-script' Plug 'pbrisbin/vim-mkdir' Plug 'scrooloose/syntastic' Plug 'slim-template/vim-slim'