Skip to content

Instantly share code, notes, and snippets.

@hayajo
Last active November 7, 2017 07:50
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hayajo/f945c26a5ceb8e88c01d9ada99c153d8 to your computer and use it in GitHub Desktop.
Save hayajo/f945c26a5ceb8e88c01d9ada99c153d8 to your computer and use it in GitHub Desktop.
ct-study #10 で使った .vimrc
set nocompatible
set backspace=indent,eol,start
set cursorline
set completeopt=menuone
set noswapfile
set autochdir
set ignorecase
set smartcase
"set hlsearch
set autoindent
set shiftwidth=4
set softtabstop=4
set tabstop=4
set number
"let mapleader="\<Space>"
syntax on
call plug#begin('~/.vim/plugged')
Plug 'fatih/vim-go'
call plug#end()
let g:go_highlight_functions=1
let g:go_highlight_methods=1
let g:go_highlight_structs=1
let g:go_fmt_command="goimports"
autocmd FileType go :highlight goErr cterm=bold ctermfg=214
autocmd FileType go :match goErr /\<err\>/
autocmd FileType go nmap <Leader>gi :GoImport
autocmd FileType go nmap <Leader>gl :GoLint<CR>
autocmd FileType go nmap <leader>gr <Plug>(go-run)
autocmd FileType go nmap <leader>gb <Plug>(go-build)
autocmd FileType go nmap <leader>gt <Plug>(go-test)

Usage

$ curl -sfLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
$ cp .vimrc ~/.vimrc
$ vim -c 'PlugInstall' -c 'quitall' # or `vim -c 'PlugUpdate' -c 'quitall'`
$ vim -c 'GoInstallBinaries' -c 'quitall' # or `vim -c 'GoUpdateBinaries' -c 'quitall'`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment