" vim:foldmethod=marker:foldlevel=0 set viminfo+=n~/.vim/viminfo " Basic configuration {{{ if &compatible set nocompatible set modelines=1 endif " }}} " Plugins {{{ filetype plugin off filetype off " required " set the runtime path to include Vundle and initialize set runtimepath+=~/.vim/bundle/Vundle.vim call vundle#begin() " let Vundle manage Vundle, required Plugin 'VundleVim/Vundle.vim' " Completion engines {{{ "Plugin 'Valloric/YouCompleteMe' "Plugin 'zxqfl/tabnine-vim' "Plugin 'lifepillar/vim-mucomplete' "Plugin 'Shougo/neocomplete.vim' "Plugin 'lyuts/vim-rtags' "Plugin 'JBakamovic/cxxd-vim' Plugin 'neoclide/coc.nvim' Plugin 'jackguo380/vim-lsp-cxx-highlight' " }}} " Mappings {{{ "Plugin 'milkypostman/vim-togglelist' " Map of quickfix toggles " }}} " Code development helpers {{{ "Plugin 'rhysd/vim-clang-format' Plugin 'tpope/vim-commentary' " Toggle C style comments with gc "Plugin 'KabbAmine/zeavim.vim' " gz to open zeal Plugin 'mbbill/undotree' "Plugin 'kkoomen/vim-doge' Plugin 'SirVer/ultisnips' Plugin 'honza/vim-snippets' Plugin 'wellle/context.vim' Plugin 'svermeulen/vim-yoink' Plugin 'will133/vim-dirdiff' Plugin 'n0v1c3/vira' " }}} " Files switch, jump and grep-like tools {{{ "Plugin 'ericcurtin/CurtineIncSw.vim' "Toggle .c .h files Plugin 'preservim/nerdtree' Plugin 'Xuyuanp/nerdtree-git-plugin' "Plugin 'mileszs/ack.vim' " Ack integration Plugin 'junegunn/fzf.vim' "Plugin 'fholgado/minibufexpl.vim' Plugin 'justinmk/vim-sneak' " easy movement Plugin 'ludovicchabant/vim-gutentags' "Auto generate tags Plugin 'liuchengxu/vista.vim' Plugin 'wellle/targets.vim' Plugin 'inside/vim-search-pulse' " }}} " Git integration {{{ Plugin 'mhinz/vim-signify' " Mark edited lines - faster gitgutter "Plugin 'rhysd/git-messenger.vim' " show git history Plugin 'tpope/vim-fugitive' " Git integration " }}} " Syntax for random filetypes {{{ "Plugin 'gabrielelana/vim-markdown' Plugin 'kergoth/vim-bitbake' " Bitbake templates and syntax "Plugin 'vim-scripts/DoxygenToolkit.vim' " Doxygen support Plugin 'pboettch/vim-cmake-syntax' Plugin 'aklt/plantuml-syntax' " }}} " Colorschemes {{{ "Plugin 'flazz/vim-colorschemes' " lots of colorschemes "Plugin 'jeaye/color_coded' "Plugin 'thiagoalessio/rainbow_levels.vim' "Plugin 'fielding/vice' Plugin 'whatyouhide/vim-gotham' " }}} " Other plugins (external tools, etc) {{{ Plugin 'junegunn/goyo.vim' Plugin 'jez/vim-superman' "vman application Plugin 'vimwiki/vimwiki' "Plugin 'metakirby5/codi.vim' " live coding Plugin 'vim-airline/vim-airline' Plugin 'mhinz/vim-startify' " }}} call vundle#end() " required " Packages {{{ packadd termdebug " }}} filetype plugin indent on " }}} " TAB settings {{{ set tabstop=4 set shiftwidth=4 set softtabstop=4 set expandtab " }}} " More Common Settings {{{ set encoding=utf-8 set scrolloff=10 set autoindent set cino=l1,:0 set showmode set showcmd " do not force write on buffer switch set hidden "set visualbell set nowrapscan set cursorline set ttyfast set lazyredraw set ruler set backspace=eol,indent,start " statusline {{{ set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P set laststatus=2 " Vista configuration function! NearestMethodOrFunction() abort return get(b:, 'vista_nearest_method_or_function', '') endfunction set statusline+=\ set statusline+=%{NearestMethodOrFunction()} " }}} set number set relativenumber " Make Vim to handle long lines nicely. set wrap set textwidth=79 set formatoptions=cqrnb1j syntax on set showmatch "set matchtime=3 "Control it with %/s///i - ignore and I - sens set ignorecase set smartcase " %s///g not needed set gdefault set hlsearch set incsearch set shell=/bin/bash set path+=** set updatetime=100 set nospell set runtimepath+=/usr/share/vim/vimfiles set spelllang=en " Dictionary path, from which the words are being looked up. set dictionary+=/usr/share/dict/words set clipboard=unnamed " }}} " Undofile {{{ if exists("+undofile") if isdirectory($HOME . '/.vim/undo') == 0 :silent !mkdir -p ~/.vim/undo > /dev/null 2>&1 endif set undodir=~/.vim/undo/ set undofile endif " }}} " Ctags {{{ if isdirectory($HOME . '/.vim/tags') == 0 :silent !mkdir -p ~/.vim/tags > /dev/null 2>&1 endif let g:gutentags_cache_dir='~/.vim/tags' "let g:gutentags_ctags_extra_args=['--fields=+l'] " }}} " Mappings {{{ " Editing {{{ "Changing Leader Key let mapleader = "\\" "nnoremap j gj "nnoremap k gk " Get Rid of stupid Goddamned help keys inoremap nnoremap vnoremap " jj For Quicker Escaping between normal and editing mode inoremap jj inoremap jk inoremap :w :wi " space one line, home,end globally increase/decrease nnoremap za nnoremap zm nnoremap zr " Map : to ; also in command mode "nnoremap ; : " Reselect visual block after incrementing/decrementing vnoremap gv vnoremap gv nnoremap 2 :set tabstop=2 softtabstop=2 shiftwidth=2 nnoremap 4 :set tabstop=4 softtabstop=4 shiftwidth=4 nnoremap 8 :set tabstop=8 softtabstop=8 shiftwidth=8 map :colorscheme random nnoremap S :%s//g xnoremap S :s//g xmap x " Make pasting done without any indentation break set pastetoggle= " leader Command to remove white space from a file ""nnoremap W :%s/\s\+$//:let @/='' tnoremap nnoremap S :%s//g xnoremap S :s//g xmap x nnoremap :nohlsearch " }}} " Plugins {{{ inoremap pumvisible() ? "\" : "\u\" nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) nnoremap k :call show_documentation() "xmap 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 :CocListResume let g:UltiSnipsExpandTrigger="" let g:UltiSnipsJumpForwardTrigger="" let g:UltiSnipsJumpBackwardTrigger="p" " yoink configuration nmap p (YoinkPostPasteSwapBack) nmap n (YoinkPostPasteSwapForward) nmap p (YoinkPaste_p) nmap P (YoinkPaste_P) " Mapping to NERDTree nnoremap t :NERDTreeToggle let NERDTreeIgnore=['\.vim$', '\~$', '\.pyc$'] "nnoremap :e . "let g:netrw_banner=0 "let g:netrw_wisize=20 "let g:netrw_liststyle=3 "let g:netrw_lolcalrmdir='rm -r' "nnoremap n :Lexplore " Tagbar key bindings." "nmap t :TlistToggle nnoremap fl :Lines nnoremap fb :Buffers inoremap fs :Snippets nnoremap fa :Ag nnoremap ff :FZF " }}} " }}} " Wildmenu completion {{{ set wildmenu set wildmode=list:longest set wildignore+=.hg,.git,.svn " Version Controls" set wildignore+=*.aux,*.out,*.toc "Latex Indermediate files" set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg "Binary Imgs" set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest "Compiled Object files" set wildignore+=*.spl "Compiled spelling world list" set wildignore+=*.sw? "Vim swap files" set wildignore+=*.DS_Store "OSX SHIT" set wildignore+=*.luac "Lua byte code" set wildignore+=migrations "Django migrations" set wildignore+=*.pyc "Python Object codes" set wildignore+=*.orig "Merge resolution files" " }}} match Error /\s\+$\|DU\cPA/ " Removing scrollbars if !has("gui_running") colorscheme gotham256 set background=dark " To show special characters in Vim set listchars=tab:▸\ ,trail:¬ set list hi clear SpellBad hi SpellBad cterm=underline "hi Normal ctermbg=None endif if &term =~ '256color' " Disable Background Color Erase (BCE) so that color schemes " work properly when Vim is used inside tmux and GNU screen. " set t_ut= endif " Mini Buffer some settigns." let g:miniBufExplMapWindowNavVim = 1 let g:miniBufExplMapWindowNavArrows = 1 let g:miniBufExplMapCTabSwitchBufs = 1 let g:miniBufExplModSelTarget = 1 let g:miniBufExplStatusLineText = '' "Full line: "set colorcolumn=120 "call matchadd('ColorColumn', '\%80v', 100) " autocmd {{{ if has("autocmd") "restore cursor position autocmd BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif autocmd FileType helpfile set nonumber autocmd WinLeave * set nocursorline autocmd WinEnter * set cursorline " Set vim to save the file on focus out "au FocusLost * :wa " Resize Split When the window is resized au VimResized * :wincmd = " If you want to show the nearest function in your statusline automatically autocmd VimEnter * call vista#RunForNearestMethodOrFunction() endif "}}} " Folding {{{ function! FoldFormat() let foldsize = (v:foldend - v:foldstart) return getline(v:foldstart)."\t\t\t(".foldsize."\tmore lines)" endfunction set foldenable set foldlevelstart=999 set foldnestmax=5 set foldtext=FoldFormat() set fillchars=fold:\ " comment just to remove trailing set foldmethod=syntax if has('folding') setglobal foldopen+=jump endif " }}} function! FindAlternate() let l:ext = 'h' let l:curr_ext = expand('%:e') if (l:curr_ext == 'c') let l:ext = 'h' elseif (l:curr_ext == 'cpp') let l:ext = 'h' elseif (l:curr_ext == 'h') let l:ext = 'c' elseif (l:curr_ext == 'hpp') let l:ext = 'cpp' endif let l:file = expand('%:t:r') . '.' . l:ext :exec 'find ' . l:file endfunction nnoremap :call FindAlternate() "let g:alternateSearchPath="sfr:../source,sfr:../src,sfr:../include,sfr:../inc,sfr:./Source,sfr:.." "map :call CurtineIncSw() let g:startify_custom_header = '' setglobal complete-=i setglobal virtualedit=block setglobal shiftround set shortmess+=c inoremap coc#refresh() set signcolumn=yes set cmdheight=2 "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 function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('') else call CocAction('doHover') endif endfunction autocmd CursorHold * silent call CocActionAsync('highlight') "hi None ctermbg=None ctermfg=None let g:vim_search_pulse_mode = 'pattern' let g:vim_search_pulse_duration = 400