call plug#begin('~/.vim/plugged') Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } " Amazing combination of features. "Plug 'godoctor/godoctor.vim' " Some refactoring tools Plug 'plytophogy/vim-virtualenv' Plug 'mg979/vim-visual-multi' Plug 'airblade/vim-rooter' Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' " Plug 'majutsushi/tagbar' " install exuberant-ctags Plug 'tpope/vim-commentary' Plug 'tpope/vim-fugitive' " Plug 'SirVer/ultisnips' " Plug 'neomake/neomake' " Plug 'godlygeek/tabular' Plug 'lepture/vim-jinja' Plug 'b4b4r07/vim-hcl' Plug 'hashivim/vim-packer' Plug 'hashivim/vim-terraform' " Plug 'scrooloose/nerdtree' Plug 'preservim/nerdtree' Plug 'PotatoesMaster/i3-vim-syntax' "Plug 'tpope/vim-surround' "Plugin 'jiangmiao/auto-pairs' "Plug 'elzr/vim-json' Plug 'tsandall/vim-rego' Plug 'honza/vim-snippets' if !has('nvim') " Plugins for when you're not using neovim endif if has('nvim') " Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'} Plug 'neoclide/coc.nvim', {'branch': 'release'} "Plug 'jodosha/vim-godebug' " Debugger integration via delve endif " All of your Plugs must be added before the following line call plug#end() """"""""""""""""" " Plugin Config " """"""""""""""""" """ deoplete if has('nvim') " --------------------------------------------------------------------------- " coc.nvim default settings " --------------------------------------------------------------------------- " if hidden is not set, TextEdit might fail. set hidden " Better display for messages set cmdheight=2 " Smaller updatetime for CursorHold & CursorHoldI set updatetime=300 " don't give |ins-completion-menu| messages. set shortmess+=c " always show signcolumns set signcolumn=yes " Use tab for trigger completion with characters ahead and navigate. " Use command ':verbose imap ' to make sure tab is not mapped by other plugin. inoremap \ pumvisible() ? "\" : \ check_back_space() ? "\" : \ coc#refresh() inoremap pumvisible() ? "\" : "\" function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction " Use to trigger completion. inoremap coc#refresh() " Use `[c` and `]c` to navigate diagnostics nmap [c (coc-diagnostic-prev) nmap ]c (coc-diagnostic-next) " Remap keys for gotos nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) " Use U to show documentation in preview window nnoremap U :call show_documentation() " Remap for rename current word nmap rn (coc-rename) " Remap for format selected region vmap f (coc-format-selected) nmap f (coc-format-selected) " Show all diagnostics nnoremap a :CocList diagnostics " Manage extensions nnoremap e :CocList extensions " Show commands nnoremap c :CocList commands " Find symbol of current document nnoremap o :CocList outline " Search workspace symbols nnoremap s :CocList -I symbols " Do default action for next item. nnoremap j :CocNext " Do default action for previous item. nnoremap k :CocPrev " Resume latest coc list nnoremap p :CocListResumen """" Snippets " " Use for trigger snippet expand. " imap (coc-snippets-expand) " " Use for select text for visual placeholder of snippet. " vmap (coc-snippets-select) " " Use for jump to next placeholder, it's default of coc.nvim " let g:coc_snippet_next = '' " " Use for jump to previous placeholder, it's default of coc.nvim " let g:coc_snippet_prev = '' " " Use for both expand and jump (make expand higher priority.) " imap (coc-snippets-expand-jump) " " Use x for convert visual selected code to snippet " xmap x (coc-convert-snippet) inoremap \ pumvisible() ? coc#_select_confirm() : \ coc#expandableOrJumpable() ? "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : \ check_back_space() ? "\" : \ coc#refresh() function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction let g:coc_snippet_next = '' endif """ tagbar nmap :TagbarToggle 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' \ } """ vim-rooter " let g:rooter_use_lcd = 1 let g:rooter_cd_cmd="lcd" let g:rooter_silent_chdir = 1 let g:rooter_resolve_links = 1 """ vim-terraform let g:terraform_fmt_on_save=1 "autocmd filetype tf set syntax=terraform autocmd FileType terraform setlocal commentstring=#%s """ vim-jinja autocmd BufNewFile,BufRead *.j2 set filetype=jinja """ vim-go " disable all linters as that is taken care of by coc.nvim let g:go_diagnostics_enabled = 0 let g:go_metalinter_enabled = [] " don't jump to errors after metalinter is invoked let g:go_jump_to_error = 0 " run go imports on file save let g:go_fmt_command = "goimports" " automatically highlight variable your cursor is on let g:go_auto_sameids = 0 let g:go_highlight_types = 1 let g:go_highlight_types = 1 let g:go_highlight_fields = 1 let g:go_highlight_functions = 1 let g:go_highlight_function_calls = 1 let g:go_highlight_operators = 1 let g:go_highlight_extra_types = 1 let g:go_highlight_build_constraints = 1 let g:go_highlight_generate_tags = 1 " let g:go_def_mode='gopls' " let g:go_info_mode='gopls' let g:go_term_enabled = 1 " disable vim-go :GoDef short cut (gd) " this is handled by LanguageClient [LC] let g:go_def_mapping_enabled = 0 """ neomake " Full config: when writing or reading a buffer, and on changes in insert and " normal mode (after 1s; no delay when writing). " call neomake#configure#automake('nrwi', 500) """ NERDtree " nnoremap n :NERDTreeFocus " nnoremap :NERDTree nnoremap :NERDTreeToggle nnoremap :NERDTreeFind " Start NERDTree when Vim starts with a directory argument. autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') | \ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | endif " Exit Vim if NERDTree is the only window remaining in the only tab. autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif " Close the tab if NERDTree is the only window remaining in it. autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif " If another buffer tries to replace NERDTree, put it in the other window, and bring back NERDTree. autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 | \ let buf=bufnr() | buffer# | execute "normal! \w" | execute 'buffer'.buf | endif """ airline let g:airline_theme='powerlineish' " is a valid theme name let g:airline_powerline_fonts = 1 " powerline symbols let g:airline_left_sep = '' let g:airline_left_alt_sep = '' let g:airline_right_sep = '' let g:airline_right_alt_sep = '' let g:airline_symbols = {} let g:airline_symbols.branch = '' let g:airline_symbols.readonly = '' let g:airline_symbols.linenr = '☰' let g:airline_symbols.maxlinenr = '' let g:airline_symbols.dirty='⚡' """"""""""""""""""""" " Personal Settings " """"""""""""""""""""" set number colorscheme Czar hi Normal guibg=NONE ctermbg=NONE command! W w !sudo tee >/dev/null % set backupdir=~/.vim/tmp/backup// set directory=~/.vim/tmp/swap// set undodir=~/.vim/tmp/undo// set completeopt-=preview set colorcolumn=80 autocmd Filetype java setlocal colorcolumn=100 autocmd Filetype html setlocal colorcolumn=100 autocmd Filetype go setlocal colorcolumn=100 autocmd Filetype netrw setlocal colorcolumn= set tabstop=2 set shiftwidth=2 set noexpandtab autocmd FileType python setlocal expandtab autocmd FileType python setlocal tabstop=4 autocmd FileType python setlocal shiftwidth=4 autocmd filetype json setlocal expandtab autocmd filetype tf setlocal expandtab "set list lcs=tab:\┆\ ,trail:▓,space:. "set list lcs=tab:\⇥\ ,trail:▓,space:. set list lcs=tab:\⇥\ ,trail:▓ """ Help Navigation autocmd FileType help nnoremap autocmd FileType help nnoremap autocmd FileType help nnoremap o /'\l\{2,\}' autocmd FileType help nnoremap O ?'\l\{2,\}' autocmd FileType help nnoremap s /\|\zs\S\+\ze\| autocmd FileType help nnoremap S ?\|\zs\S\+\ze\|