" Basic configuration if &compatible set nocompatible " Be iMproved set modelines=0 endif 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' " Mappings "Plugin 'milkypostman/vim-togglelist' " Map of quickfix toggles " Code development helpers "Plugin 'rhysd/vim-clang-format' "Plugin 'quark-zju/vim-cpp-auto-include' Plugin 'tpope/vim-commentary' " Toggle C style comments with gc "Plugin 'mnpk/vim-jira-complete' "Plugin 'KabbAmine/zeavim.vim' " gz to open zeal Plugin 'mbbill/undotree' " Files switch, jump and grep-like tools "Plugin 'ericcurtin/CurtineIncSw.vim' "Toggle .c .h files "Plugin 'vim-scripts/a.vim' Curtine is the new a.vim "Plugin 'scrooloose/nerdtree' Plugin 'mileszs/ack.vim' " Ack integration "Plugin 'jremmen/vim-ripgrep' Plugin 'ctrlpvim/ctrlp.vim' "Plugin 'junegunn/fzf.vim' "Plugin 'fholgado/minibufexpl.vim Plugin 'justinmk/vim-sneak' " easy movement "Plugin 'easymotion/vim-easymotion' Plugin 'ludovicchabant/vim-gutentags' "Auto generate tags "Plugin 'andymass/vim-matchup' " Improve if-else matches Plugin 'vim-scripts/taglist.vim' " Git integration "Plugin 'airblade/vim-gitgutter' " Mark edited lines 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' " Colorschemes Plugin 'flazz/vim-colorschemes' " lots of colorschemes "Plugin 'octol/vim-cpp-enhanced-highlight' "Plugin 'vim-scripts/CycleColor' "Plugin 'jeaye/color_coded' "Plugin 'thiagoalessio/rainbow_levels.vim' " Other plugins (external tools, etc) "Plugin 'Shougo/vimproc.vim' Plugin 'junegunn/goyo.vim' Plugin 'jez/vim-superman' "vman application Plugin 'vimwiki/vimwiki' "Plugin 'metakirby5/codi.vim' " live coding "Plugin 'pelodelfuego/vim-swoop' " editing in parallel "Plugin 'vim-airline/vim-airline' Plugin 'mhinz/vim-startify' call vundle#end() " required " ========== Vim Basic Settings =============" 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 set hidden "set visualbell set nowrapscan set cursorline set ttyfast set lazyredraw set ruler set backspace=eol,indent,start set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P set laststatus=2 "set relativenumber set number set norelativenumber set shell=/usr/local/bin/fish set path+=** 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 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'] "Changing Leader Key let mapleader = "\\" " Make pasting done without any indentation break set pastetoggle= syntax on "Control it with %/s///i - ignore and I - sens "set ignorecase set smartcase " %s///g not needed set gdefault set incsearch set showmatch set matchtime=3 set hlsearch nnoremap :noh " Make Vim to handle long lines nicely. set wrap set textwidth=79 set formatoptions=cqrnb1j nnoremap j gj nnoremap k gk " Get Rid of stupid Goddamned help keys inoremap nnoremap vnoremap " Map : to ; also in command mode. "nnoremap ; : " Reselect visual block after incrementing/decrementing vnoremap gv vnoremap gv " Set vim to save the file on focus out "au FocusLost * :wa " leader Command to remove white space from a file ""nnoremap W :%s/\s\+$//:let @/='' " Re-hardwrap Paragraph nnoremap q gqip " leader v Select just pasted text "nnoremap v V`] " jj For Quicker Escaping between normal and editing mode inoremap jj inoremap jk " Resize Split When the window is resized au VimResized * :wincmd = " 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\+$\|DUPA\c/ " Removing scrollbars if has("gui_running") set guitablabel=%-0.12t%M set guioptions-=T set guioptions-=r set guioptions-=L set guioptions+=a set guioptions-=m colorscheme molokai set listchars=tab:▸\ ,eol:¬ " Invisibles using the Textmate style else colorscheme badwolf set background=dark " To show special characters in Vim set listchars=tab:▸\ ,trail:¬ set list hi clear SpellBad hi SpellBad cterm=underline 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 " ========== Plugin Settings ==========" " Mini Buffer some settigns." "let g:miniBufExplMapWindowNavVim = 1 "let g:miniBufExplMapWindowNavArrows = 1 "let g:miniBufExplMapCTabSwitchBufs = 1 "let g:miniBufExplModSelTarget = 1 "let g:miniBufExplStatusLineText = '' " Tagbar key bindings." "nmap t :TlistToggle 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 "Full line: "set colorcolumn=120 "call matchadd('ColorColumn', '\%80v', 100) 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 "autocmd FileType tex set textwidth=79 "autocmd FileType c,cpp,hpp,h :RainbowLevelsOn endif "hi! link RainbowLevel0 Constant "hi! link RainbowLevel1 Type "hi! link RainbowLevel2 Function "hi! link RainbowLevel3 String "hi! link RainbowLevel4 PreProc "hi! link RainbowLevel5 Statement "hi! link RainbowLevel6 Identifier "hi! link RainbowLevel7 Normal "hi! link RainbowLevel8 Comment " if has("cscope") "use both cscope and ctags "set cscopetag " change this to 1 to search ctags DBs first set csto=0 set cst set nocsverb " add any database in current directory if filereadable("cscope.out") cs add cscope.out " else add database pointed to by environment elseif $CSCOPE_DB != "" cs add $CSCOPE_DB endif " 's' symbol: find all references to the token under cursor " 'g' global: find global definition(s) of the token under cursor " 'c' calls: find all calls to the function name under cursor " 't' text: find all instances of the text under cursor " 'e' egrep: egrep search for the word under cursor " 'f' file: open the filename under cursor " 'i' includes: find files that include the filename under cursor " 'd' called: find functions that function under cursor calls " Using 'CTRL-\' then a search type makes the vim window " "shell-out", with search results displayed on the bottom nmap s :cs find s =expand("") nmap g :cs find g =expand("") nmap c :cs find c =expand("") nmap t :cs find t =expand("") nmap e :cs find e =expand("") nmap f :cs find f =expand("") nmap i :cs find i ^=expand("")$ nmap d :cs find d =expand("") "" Using 'CTRL-spacebar' then a search type makes the vim window "" split horizontally, with search result displayed in "" the new window. " nmap s :scs find s =expand("") " nmap g :scs find g =expand("") " nmap c :scs find c =expand("") " nmap t :scs find t =expand("") " nmap e :scs find e =expand("") " nmap f :scs find f =expand("") " nmap i :scs find i ^=expand("")$ " nmap d :scs find d =expand("") "" Hitting CTRL-space *twice* before the search type does a vertical "" split instead of a horizontal one " nmap s :vert scs find s =expand("") " nmap g :vert scs find g =expand("") " nmap c :vert scs find c =expand("") " nmap t :vert scs find t =expand("") " nmap e :vert scs find e =expand("") " nmap i :vert scs find i ^=expand("")$ " nmap d :vert scs find d =expand("") endif nnoremap yg :YcmCompleter GoTo nnoremap yf :YcmCompleter FixIt nnoremap yd :YcmCompleter GetDoc nnoremap yt :YcmCompleter GetType nnoremap yp :YcmCompleter GetParent let g:ycm_confirm_extra_conf = 0 let g:ycm_warning_symbol = '>' let g:ycm_complete_in_strings = 0 "let g:ycm_server_log_level = 'debug' "let g:ycm_server_use_vim_stdout = 1 let g:ycm_collect_identifiers_from_tags_files = 1 let g:ycm_enable_diagnostic_highlighting = 0 let g:ycm_autoclose_preview_window_after_completion = 0 let g:ycm_autoclose_preview_window_after_insertion = 1 let g:ycm_min_num_of_chars_for_completion = 99 map :colorscheme random function! FoldFormat() let foldsize = (v:foldend - v:foldstart) return getline(v:foldstart)."\t\t\t(".foldsize."\tmore lines)" endfunction " Folding - space one line, home,end globally increase/decrease set foldenable set foldlevelstart=3 set foldnestmax=5 set foldtext=FoldFormat() set fillchars=fold:\ set foldmethod=syntax nnoremap za nnoremap zm nnoremap zr nnoremap s :mksession! " Jira config let b:jiracomplete_url = 'http://192.168.1.49:8080/jira' let b:jiracomplete_username = 'r.kmiec' let b:jiracomplete_password = 'password' " We can also use v:val.menu let b:jiracomplete_format = '"[". v:val.abbr. "]"' set updatetime=4000 " From C.vim: " ADDITIONAL MAPPING : complete a classical C comment: '/*' => '/* | */' "vnoremap /* s/**/p " additional mapping : complete a classical C multi-line comment: "inoremap /* /*/kA " additional mapping : { always opens a block "inoremap { {}O "vnoremap { S{}Pk=iB inoremap :w :wi "nnoremap :silent ! plantuml %:p && eog -g %:p:r.png &:redraw! " ctrlp configuration let g:ctrlp_map = '' let g:ctrlp_cmd = 'CtrlPLastMode' let g:ctrlp_user_command = 'ack --cpp --cc -f %s' let g:ctrlp_working_path_mode = 'rw' tnoremap set spell set runtimepath+=/usr/share/vim/vimfiles set spelllang=en,pl " Dictionary path, from which the words are being looked up. set dictionary+=/usr/share/dict/words " from vimconfig.com "set showbreak=++ "let g:rtagsRcCmd='rtags-rc' set timeoutlen=1000 set ttimeout set ttimeoutlen=0 let g:matchparen_timeout = 2 let g:matchparen_insert_timeout = 2 " Mapping to NERDTree "nnoremap :NERDTreeToggle "let NERDTreeIgnore=['\.vim$', '\~$', '\.pyc$'] let g:netrw_banner=0 let g:netrw_wisize=20 let g:netrw_liststyle=3 let g:netrw_lolcalrmdir='rm -r' nnoremap n :Lexplore " taken from Damian Conway nnoremap n n:call HLNext(0.2) nnoremap N N:call HLNext(0.2) function! HLNext(blinktime) let [bufnum, lnum, col, off] = getpos('.') let matchlen = strlen(matchstr(strpart(getline('.'), col - 1), @/)) let target_pat = '\c\%#'.@/ let blinks = 1 for n in range(1, blinks) let red = matchadd('WarningMsg', target_pat, 101) redraw exec 'sleep ' . float2nr(a:blinktime / (2*blinks) * 1000) . 'm' call matchdelete(red) redraw exec 'sleep ' . float2nr(a:blinktime / (2*blinks) * 1000) . 'm' endfor endfunction nnoremap S :%s//g xnoremap S :s//g xmap x 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 = 'cpp' 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() packadd termdebug let g:startify_custom_header = '' "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 " "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() " "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') "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