Skip to content

Instantly share code, notes, and snippets.

@yageek
Last active April 30, 2018 06:28
Show Gist options
  • Save yageek/7528849 to your computer and use it in GitHub Desktop.
Save yageek/7528849 to your computer and use it in GitHub Desktop.
Vim configurations file
set nocompatible
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
set background=dark
Plugin 'VundleVim/Vundle.vim'
" Git "
Plugin 'tpope/vim-fugitive'
"Indentation guide
Plugin 'nathanaelkane/vim-indent-guides'
"Line numbers
Plugin 'jeffkreeftmeijer/vim-numbertoggle'
"File Browser
Plugin 'scrooloose/nerdtree'
"Function list
Plugin 'majutsushi/tagbar'
"Status bar
Plugin 'Lokaltog/powerline'
" Language syntax "
" Comments "
Plugin 'scrooloose/nerdcommenter'
" Generic "
Plugin 'scrooloose/syntastic'
Plugin 'Shougo/neocomplete.vim'
Plugin 'yageek/cscope_maps.vim'
" Go
Plugin 'nsf/gocode'
Plugin 'fatih/vim-go'
"Plug
Plugin 'tomasr/molokai'
call vundle#end() " required
filetype plugin indent on
" Basic customisation "
syntax on
set mouse=a
set relativenumber
" Color scheme "
set t_Co=256
colorscheme molokai
"Fix delete (Mac)
set backspace=indent,eol,start
"Leader
let mapleader=","
" Mapping "
map <F2> :NERDTreeToggle<CR>
map <F3> :Tagbar<CR>
imap <C-s> <esc>:w<cr>a
nnoremap <C-s> :w<cr>
map <Leader>i <C-w>f
map <Leader>s :vertical wincmd f<cr>
nnoremap <F5> :YcmForceCompileAndDiagnostics<cr>
" Plugs configurations "
" Add path to search "
set path+=/usr/local/include
set path+=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/
" Powerline
let g:airline#extensions#tabline#enabled = 1
set laststatus=2
" NerdTree
let NERDTreeShowHidden=1
" Ycm
let g:ycm_path_to_python_interpreter = '/usr/bin/python'
let g:ycm_confirm_extra_conf = 0
let g:ycm_show_diagnostics_ui = 1
" Syntastic "
let g:syntastic_cpp_check_header = 1
let g:syntastic_cpp_auto_refresh_includes = 1
let g:syntastic_cpp_compiler = 'clang++'
let g:syntastic_cpp_compiler_options = '-stdc=c++11 -stdlib=libc++'
let b:syntastic_cpp_cflags = '-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/usr/local/include'
" Neocomplete
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplete.
let g:neocomplete#enable_at_startup = 1
" Use smartcase.
let g:neocomplete#enable_smart_case = 1
" Set minimum syntax keyword length.
let g:neocomplete#sources#syntax#min_keyword_length = 3
" Plugin key-mappings.
inoremap <expr><C-g> neocomplete#undo_completion()
inoremap <expr><C-l> neocomplete#complete_common_string()
" Recommended key-mappings.
" <CR>: close popup and save indent.
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
return neocomplete#close_popup() . "\<CR>"
endfunction
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" <C-h>, <BS>: close popup and delete backword char.
inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><C-y> neocomplete#close_popup()
inoremap <expr><C-e> neocomplete#cancel_popup()
" Go related mappings
au FileType go nmap <Leader>i <Plug>(go-info)
au FileType go nmap <Leader>gd <Plug>(go-doc)
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 gd <Plug>(go-def-tab)
" emmet -vim"
let g:user_emmet_leader_key='<C-Y>'
let g:user_emmet_install_global = 0
autocmd FileType html,css EmmetInstall
" Gotags
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'
\ }
let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment