Created
October 15, 2019 15:52
-
-
Save elleryq/fe6ba95972db89871fbe28236e3bfcb4 to your computer and use it in GitHub Desktop.
.vimrc for go. First, you need to install pathogen: https://blog.longwin.com.tw/2014/07/vim-use-pathogen-manage-plugin-2014/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" First, you need to install pathogen: https://blog.longwin.com.tw/2014/07/vim-use-pathogen-manage-plugin-2014/ | |
execute pathogen#infect() | |
set nocompatible | |
set t_Co=256 | |
set nu " line number | |
set cursorline | |
" set cursorcolumn | |
set showmatch | |
" indent | |
set tabstop=4 | |
set shiftwidth=4 | |
set autoindent | |
set incsearch | |
set ignorecase | |
syntax enable | |
syntax on | |
filetype plugin indent on | |
" 退出插入模式指定类型的文件自动保存 | |
au InsertLeave *.go,*.sh,*.php write | |
call plug#begin('~/.vim/plugged') | |
Plug 'fatih/vim-go' | |
Plug 'dgryski/vim-godef' | |
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } | |
Plug 'fatih/molokai' | |
call plug#end() | |
" vim-go | |
let g:go_highlight_functions = 1 | |
let g:go_highlight_methods = 1 | |
let g:go_highlight_structs = 1 | |
let g:go_highlight_operators = 1 | |
let g:go_highlight_build_constraints = 1 | |
au FileType go nmap <leader>r <Plug>(go-run) | |
au FileType go nmap <leader>b <Plug>(go-build) | |
au FileType go nmap <leader>t <Plug>(go-test) | |
au FileType go nmap <leader>c <Plug>(go-coverage) | |
let g:go_fmt_command = "goimports" | |
colorscheme molokai | |
set directory^=$HOME/.vim/.swap// | |
set undodir^=$HOME/.vim/.undo// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment