I just love working in Vim and cannot even think of switching to a new editor. If you are also a Vim lover and you use Golang, you must read this post to make sure you have the right setup.
Here is how my vim looks like and yes the look is very simple though powerful.
Following are the most important features which I prefer to have:
- Peek at documentation
- Jump to symbols or functions definitions
- Automatic variable type and function signature info
- Pretty and lightweight status bar at bottom
- Version control information
In order to have all these features integrated in Vim, I used the following plugins:
git clone https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go
rm -r ~/.vim/pack/plugins/start/vim-go
git clone https://github.com/vim-airline/vim-airline ~/.vim/pack/dist/start/vim-airline
rm -r ~/.vim/pack/dist/start/vim-airline
git clone https://github.com/tpope/vim-fugitive.git ~/.vim/pack/dist/start/vim-fugitive
rm -r ~/.vim/pack/dist/start/vim-fugitive
After installing all the plugins, here is how you can configure
syntax on colo pablo set encoding=utf-8 set fileencoding=utf-8 set number set shiftwidth=2 " settings specific to Go file types autocmd Filetype go setlocal tabstop=4 shiftwidth=4 softtabstop=4 filetype plugin indent on set backspace=indent,eol,start " vim-go commands let g:go_fmt_command = "goimports" let g:go_auto_type_info = 1 let g:go_highlight_functions = 1 let g:go_highlight_methods = 1 let g:go_highlight_fields = 1 let g:go_highlight_types = 1 let g:go_highlight_operators = 1 let g:go_highlight_build_constraints = 1
I hope you have enjoyed this post and it will be helpful for you to setup your Vim. Please like and share and feel free to comment if you have any suggestions or feedback.