Fast and extendable vim-based go development environment. Inspired by farazdagi's vim-go-ide and powering fatih's vim-go plugin.
- Get a high enough version of Vim (7.4+) and MacVim:
$ brew install vim --with-lua
$ brew install macvim --with-lua
You probably need to add this to your .bash_profile
to pick the right vim:
alias vim="/usr/local/bin/vim"
Don't forget to source afterwards:
$ source ~/.bash_profile
- Backup your old .vimrc, .gvimrc or .ctags if you have any:
$ cp ~/.vimrc ~/.vimrc_backup
- Clone this repository to your home folder and run the install script (this takes some time):
$ git clone --recursive [email protected]:codepushr/vim-go-runtime.git ~/.vim-go-runtime
$ sh ~/.vim-go-runtime/install.sh
- Install Go binaries (inside Vim):
:GoInstallBinaries
No submodule mapping found in .gitmodules for path 'sources_non_forked/gruvbox'
Failed to recurse into submodule path 'submodules/amix-vimrc'
Simply ignore this. This is a gruvbox submodule error in amix' repository (from which we use the base vimrc config). This setup even includes gruvbox with the vim-colorschemes plugin.
ycm_client_support.[so|pyd|dll] and ycm_core.[so|pyd|dll] not detected;
you need to compile YCM before using it. Read the docs!
This is just a warning, don't be scared. Just let the install script finish and it will compile it afterwards. Everything should run just fine after the script ends.
There are several vimrcs that play together in this configuration.
- The base vimrc by amix located in
submodules/amix-vimrc/vimrcs/basic.vim
- The extended vimrc for custom configs located in
vimrc/extended.vim
- The plugins vimrc with the list of plugins an their configs located in
vimrcs/plugins.vim
- The shortcut config for mvim (gui_running) located in
gvimrcs/shortcuts.vim
Plugin | Description |
Valloric/YouCompleteMe | You need this for proper auto completion when coding in go. |
kien/ctrlp | Switch between files, buffers or tags in no time. Yeah! |
xolox/vim-misc | Dependency for vim-session, see below. |
xolox/vim-session | Don't abuse tmux, use vim-session to reopen all your buffers! |
fatih/vim-go | This is THE golang plugin for vim! The reason I switched to vim. |
garyburd/go-explorer | Nice to have plugin to show documentation for a specific package. |
sirver/ultisnips | Really useful plugin if you want to generate boilerplate code. |
tpope/vim-fugitive | Git integration to check commits, status and more directly in vim. |
tomtom/tcomment_vim | Plugin for super fast and convenient commenting (inline, block). |
scrooloose/nerdtree | Shows a file tree on the left and lets you modify files directly in vim. |
Raimondi/delimitMate | Very useful plugin for auto-completing quotes, parens, brackets etc. |
rking/ag | This plugin lets you browse for code throughout your whole project. |
majutsushi/tagbar | Shows a sexy tag-bar on the right and lets you jump directly to tags. |
ap/vim-buftabline | Displays a bar on the top showing all your open buffers. |
itchyny/lightline | This plugin shows a nice status bar and is very configurable. |
flazz/vim-colorschemes | Gives you tons of color schemes for vim. |
mhinz/vim-sayonara | This plugin helps you to close buffers or whole windows. |
The leader is configured as ,
Here's a quick list of shortcuts that I configured. You can change them to your needs in vimrcs/extended.vim
or vimrcs/plugins.vim
or gvimrcs/shortcuts.vim
.
Shortcut | Description |
[ctrl]+Tab |
Switch to next buffer |
[ctrl]+[shift]+Tab |
Switch to previous buffer |
[cmd]+[alt]+Left |
Switch to left pane (mvim) |
[cmd]+[alt]+Right |
Switch to right pane (mvim) |
[cmd]+[alt]+Up |
Switch to upper pane (mvim) |
[cmd]+[alt]+Down |
Switch to lower pane (mvim) |
[cmd]+w |
Close buffer (mvim) |
[cmd]+[shift]+w |
Close window & buffer (mvim) |
[leader]+n |
Toggle nerdtree navigator |
[leader]+m |
Toggle tagbar |
Shortcut | Description |
[leader]+j |
List of last opened buffers |
[crtl]+f |
List of all files in the project |
[crtl]+d |
List of all tags in current buffer |
Shortcut | Description |
[ctrl]+n |
Go to next occurance |
[ctrl]+p |
Go to previous occurance |
[leader]+a |
Close quickfix window |
Shortcut | Description |
[leader]+i |
Run go info on the current selection |
[leader]+r |
Run current file |
[leader]+b |
Build current project |
[leader]+d |
Run go doc on the current selection |
[leader]+f |
Jump to the definition of selection |
Shortcut | Description |
[leader]+__ |
Toggle comment selection |
Shortcut | Description |
[leader]+g |
Search for term |
[ctrl]+n |
Go to next occurance |
[ctrl]+p |
Go to previous occurance |
[leader]+a |
Close quickfix window |
MIT LICENCE
Copyright 2015 - by Aleksandar Palic - http://www.twitter.com/codepushr
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.