Skip to content

Instantly share code, notes, and snippets.

@patricksuo
Last active October 3, 2017 16:45
Show Gist options
  • Save patricksuo/c0fada443c00869f436e5daf7a0f4765 to your computer and use it in GitHub Desktop.
Save patricksuo/c0fada443c00869f436e5daf7a0f4765 to your computer and use it in GitHub Desktop.
vim config
# 1. install plugin manager vundle
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
# 2. save vimrc
curl https://gist.github.com/sillyousu/c0fada443c00869f436e5daf7a0f4765/raw/8c5ed19be89a786873759ac1c78d56d0ebd99489/vimrc > $HOME/.vimrc
# 3. install other plugin
vim +PluginInstall +qall
# 4. install vim-go dependency
vim command :GoInstallBinaries
# 5. configure build tags
for syntastic `let g:syntastic_go_go_build_args="-tags sometags"`
ref
https://github.com/VundleVim/Vundle.vim
https://github.com/fatih/vim-go
http://www.ibm.com/developerworks/library/l-vim-script-1/
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'fatih/vim-go'
Plugin 'majutsushi/tagbar'
Plugin 'chazy/cscope_maps'
Plugin 'scrooloose/syntastic'
Plugin 'dhruvasagar/vim-table-mode'
Plugin 'altercation/vim-colors-solarized'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" Configuration filDTreeBookmarksFile=expand("$HOME/.vim-NERDTreeBookmarks")
set modelines=0 " CVE-2007-2438
" Normally we use vim-extensions. If you want true vi-compatibility
" remove change the following statements
set nocompatible " Use Vim defaults instead of 100% vi compatibility
set backspace=2 " more powerful backspacing
" Don't write backup file if vim is being called by "crontab -e"
au BufWrite /private/tmp/crontab.* set nowritebackup
" Don't write backup file if vim is being called by "chpass"
au BufWrite /private/etc/pw.* set nowritebackup
au FileChangedShell * echo "Warning: File changed on disk"
au BufNewFile,BufRead SCons* set filetype=scons
" nginx
au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/conf/* if &ft == '' | setfiletype nginx | endif
filetype indent plugin on
set ruler
set number
set showcmd
set background=dark
"set background=light
set nocompatible
"set cursorline
"colorscheme evening
colorscheme solarized
syntax enable
"set foldmethod=syntax
"autocmd FileType go autocmd BufWritePre <buffer> Fmt
autocmd FileType python,scons setlocal et sta sw=4 sts=4
autocmd FileType python,scons setlocal foldmethod=indent
set foldlevel=99
autocmd FileType html setlocal et sta sw=2 sts=2
autocmd FileType html setlocal foldmethod=indent
"set et sta sw=4 sts=4
""taglist config
"let Tlist_Show_One_File = 1 "只显示当前文件的tag
"let Tlist_Exit_OnlyWindow = 1 "当taglist是最后一个窗口时 自动退出
""let Tlist_Use_Right_Window = 1
"let Tlist_GainFocus_On_ToggleOpen = 1
"let Tlist_Close_On_Select = 1
""让taglist支持golang
"let tlist_go_settings = 'go;f:func;v:var;t:type'
"
""F6打开/关闭taglist
"map <silent> <F6> :TlistToggle<cr>
"F6打开/关闭tagbar
map <silent> <F6> :TagbarToggle<CR>
"let g:tagbar_left = 1
"添加golang支持
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds' : [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin' : 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }
"nerdtree config
let NERDTreeShowLineNumbers = 1 "在nerdtree中显示行号
let NERDTreeQuitOnOpen = 0
let NERDTreeWinSize=40
let NERDTreeBookmarksFile=expand("$HOME/.vim-NERDTreeBookmarks")
let NERDTreeShowBookmarks=1
"F5打开/关闭nerdtree
map <silent> <F5> :NERDTreeToggle<cr>
"golang
set rtp+=$GOROOT/misc/vim
set completeopt=menu
syntax on
set showcmd
let g:indent_guides_auto_colors = 0
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=3
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=4
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
"默认开启搜索高亮
set hls
au BufNewFile,BufRead *.goc setf c
let g:solarized_termcolors=256
let g:tagbar_ctags_bin="/usr/bin/ctags"
let g:LargeFile=10
"set statusline+=%#warningmsg#
"set statusline+=%{SyntasticStatuslineFlag()}
"set statusline+=%*
"
"let g:syntastic_always_populate_loc_list = 1
"let g:syntastic_auto_loc_list = 1
"let g:syntastic_check_on_open = 0
"let g:syntastic_check_on_wq = 0
"let g:syntastic_shell = "/usr/bin/zsh"
"
"let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
"let g:syntastic_go_checkers = ['errcheck']
"let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
map <Leader>tm :TableModeToggle<cr>
" Disable annoying beeping
set noerrorbells
set vb t_vb=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment