Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.
/ vim-go-runtime Public archive

Fast and extendable vim-based go development environment.

Notifications You must be signed in to change notification settings

0x7061/vim-go-runtime

Repository files navigation

vim-go-runtime

Fast and extendable vim-based go development environment. Inspired by farazdagi's vim-go-ide and powering fatih's vim-go plugin.

vim-go-runtime

Install

  1. 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
  1. Backup your old .vimrc, .gvimrc or .ctags if you have any:

$ cp ~/.vimrc ~/.vimrc_backup

  1. 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
  1. Install Go binaries (inside Vim):
:GoInstallBinaries

Troubleshooting

After cloning the repository I'm getting the following git error
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.

I'm getting a YouCompleteMe error after running the install script
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.

Vimrcs

There are several vimrcs that play together in this configuration.

  1. The base vimrc by amix located in submodules/amix-vimrc/vimrcs/basic.vim
  2. The extended vimrc for custom configs located in vimrc/extended.vim
  3. The plugins vimrc with the list of plugins an their configs located in vimrcs/plugins.vim
  4. The shortcut config for mvim (gui_running) located in gvimrcs/shortcuts.vim

Plugins

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.

Leader

The leader is configured as ,

Shortcuts

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.

Navigation

Basic
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
Ctrlp
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
Quickfix
Shortcut Description
[ctrl]+n Go to next occurance
[ctrl]+p Go to previous occurance
[leader]+a Close quickfix window

Golang

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

Comments

Shortcut Description
[leader]+__ Toggle comment selection

Project wide search

Shortcut Description
[leader]+g Search for term
[ctrl]+n Go to next occurance
[ctrl]+p Go to previous occurance
[leader]+a Close quickfix window

Licence Information

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.

About

Fast and extendable vim-based go development environment.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published