From 797765087bf88e523f36889412d5fed08953cc81 Mon Sep 17 00:00:00 2001 From: Robert Kmiec Date: Wed, 22 May 2019 14:17:30 +0200 Subject: [PATCH] vim: cleanup configuration --- .vimrc | 244 +++++++++++++++++++++++---------------------------------- 1 file changed, 97 insertions(+), 147 deletions(-) diff --git a/.vimrc b/.vimrc index 2a3d9e9..19e24c6 100644 --- a/.vimrc +++ b/.vimrc @@ -1,5 +1,6 @@ if &compatible - set nocompatible " Be iMproved + set nocompatible " Be iMproved + set modelines=0 endif filetype plugin off @@ -8,7 +9,6 @@ filetype off " required " set the runtime path to include Vundle and initialize set runtimepath+=~/.vim/bundle/Vundle.vim call vundle#begin() -" alternatively, pass a path where Vundle should install plugins " let Vundle manage Vundle, required Plugin 'VundleVim/Vundle.vim' @@ -47,30 +47,23 @@ Plugin 'jez/vim-superman' "vman application "Plugin 'vim-scripts/DoxygenToolkit.vim' " Doxygen support "Plugin 'vim-scripts/a.vim' Curtine is the new a.vim "Plugin 'vim-scripts/taglist.vim' -Plugin 'airblade/vim-gitgutter' " Mark edited lines +"Plugin 'airblade/vim-gitgutter' " Mark edited lines +Plugin 'mhinz/vim-signify' " Mark edited lines - faster gitgutter Plugin 'ctrlpvim/ctrlp.vim' "Plugin 'ericcurtin/CurtineIncSw.vim' "Toggle .c .h files Plugin 'flazz/vim-colorschemes' " lots of colorschemes -Plugin 'justinmk/vim-sneak' +Plugin 'justinmk/vim-sneak' " easy movement Plugin 'kergoth/vim-bitbake' " Bitbake templates and syntax Plugin 'ludovicchabant/vim-gutentags' "Auto generate tags Plugin 'mileszs/ack.vim' " Ack integration +Plugin 'rhysd/git-messenger.vim' " show git history call vundle#end() " required -map :call CurtineIncSw() - -packadd termdebug -"let g:termdebugger="/opt/glibc-oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/mips-oe-linux/mips-oe-linux-gdb" - " ========== Vim Basic Settings =============" filetype plugin indent on -" Make vim incompatbile to vi. -set nocompatible -set modelines=0 - "TAB settings. set tabstop=4 set shiftwidth=4 @@ -78,19 +71,21 @@ set softtabstop=4 " More Common Settings. set encoding=utf-8 -set scrolloff=8 +set scrolloff=10 set autoindent set cino=l1,:0 set showmode set showcmd set hidden "set visualbell +set nowrapscan -"set cursorline +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 statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P set laststatus=2 "set relativenumber @@ -98,7 +93,7 @@ set number set norelativenumber set shell=/usr/local/bin/fish -set lazyredraw +set path+=** if exists("+undofile") if isdirectory($HOME . '/.vim/undo') == 0 @@ -109,7 +104,7 @@ if exists("+undofile") endif if isdirectory($HOME . '/.vim/tags') == 0 - :silent !mkdir -p ~/.vim/tags > /dev/null 2>&1 + :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'] @@ -117,23 +112,11 @@ let g:gutentags_cache_dir='~/.vim/tags' "Changing Leader Key let mapleader = "\\" -" Set title to window -set title - " Make pasting done without any indentation break set pastetoggle= -" Make Vim able to edit crontab fields again. -"set backupskip=/tmp/*,/private/tmp/*" - -" Enable Mouse -"set mouse=a - syntax on -"Settings for Searching and Moving -"nnoremap / /\v -"vnoremap / /\v "Control it with %/s///i - ignore and I - sens "set ignorecase set smartcase @@ -144,24 +127,14 @@ set showmatch set matchtime=3 set hlsearch nnoremap :noh -"nnoremap % +nnoremap % "vnoremap % " Make Vim to handle long lines nicely. set wrap set textwidth=79 -"set formatoptions=cqran1j set formatoptions=cqrnb1j -" Naviagations using keys up/down/left/right -" Disabling default keys to learn the hjkl -nnoremap k -nnoremap j -nnoremap h -nnoremap l -nnoremap :tabp -nnoremap :tabn - nnoremap j gj nnoremap k gk @@ -177,36 +150,33 @@ vnoremap vnoremap gv vnoremap gv -" Set vim to save the file on focus out. +" Set vim to save the file on focus out "au FocusLost * :wa -nmap w :wa -" Adding More Shorcuts keys using leader key. -" Leader Key provide separate namespace for specific commands. -",W Command to remove white space from a file. +" leader Command to remove white space from a file ""nnoremap W :%s/\s\+$//:let @/='' " Re-hardwrap Paragraph nnoremap q gqip -" ,v Select just pasted text. +" leader v Select just pasted text "nnoremap v V`] -" jj For Quicker Escaping between normal and editing mode. +" jj For Quicker Escaping between normal and editing mode inoremap jj +inoremap jk -" Working with split screen nicely -" Resize Split When the window is resized" +" Resize Split When the window is resized au VimResized * :wincmd = -" Wildmenu completion " +" 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 speolling world list" +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" @@ -214,50 +184,46 @@ set wildignore+=migrations "Django migrations" set wildignore+=*.pyc "Python Object codes" set wildignore+=*.orig "Merge resolution files" -"Make Sure that Vim returns to the same line when we reopen a file" -augroup line_return - au! - au BufReadPost * - \ if line("'\"") > 0 && line("'\"") <= line("$") | - \ execute 'normal! g`"zvzz' | - \ endif -augroup END - 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 + 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 - set t_Co=256 - colorscheme badwolf - set background=dark - " To show special characters in Vim - set listchars=tab:▸\ ,trail:¬ - set list - hi clear SpellBad - hi SpellBad cterm=underline + 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 ==========" " Mapping to NERDTree -nnoremap :NERDTreeToggle -let NERDTreeIgnore=['\.vim$', '\~$', '\.pyc$'] +"nnoremap :NERDTreeToggle +"let NERDTreeIgnore=['\.vim$', '\~$', '\.pyc$'] " Mini Buffer some settigns." -let g:miniBufExplMapWindowNavVim = 1 -let g:miniBufExplMapWindowNavArrows = 1 -let g:miniBufExplMapCTabSwitchBufs = 1 -let g:miniBufExplModSelTarget = 1 -let g:miniBufExplStatusLineText = '' +"let g:miniBufExplMapWindowNavVim = 1 +"let g:miniBufExplMapWindowNavArrows = 1 +"let g:miniBufExplMapCTabSwitchBufs = 1 +"let g:miniBufExplModSelTarget = 1 +"let g:miniBufExplStatusLineText = '' " Tab color settings to make it more visible. hi MBEChanged ctermfg=white @@ -266,10 +232,9 @@ hi MBENormal ctermfg=white " Tagbar key bindings." "nmap t :TagbarToggle "imap t :TagbarTogglei -nmap t :TlistToggle -imap t :TagbarTogglei +"nmap t :TlistToggle +"imap t :TagbarTogglei -nnoremap Y y$ map a gg0VG$ nnoremap 2 :set tabstop=2 softtabstop=2 shiftwidth=2 @@ -288,12 +253,12 @@ if has("autocmd") autocmd WinLeave * set nocursorline autocmd WinEnter * set cursorline - autocmd FileType tex set textwidth=79 + "autocmd FileType tex set textwidth=79 endif if has("cscope") "use both cscope and ctags - set cscopetag + "set cscopetag " change this to 1 to search ctags DBs first set csto=0 @@ -301,10 +266,10 @@ if has("cscope") set nocsverb " add any database in current directory if filereadable("cscope.out") - cs add cscope.out + cs add cscope.out " else add database pointed to by environment elseif $CSCOPE_DB != "" - cs add $CSCOPE_DB + cs add $CSCOPE_DB endif " 's' symbol: find all references to the token under cursor @@ -369,25 +334,21 @@ 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 -"nnoremap :ConoLineColorDark -"nnoremap :ConoLineColorLight map :colorscheme random +" Folding - space one line, home,end globally increase/decrease set foldenable -set foldlevelstart=5 +set foldlevelstart=3 set foldnestmax=5 +set foldtext=getline(v:foldstart) +set fillchars=fold:\ +set foldmethod=syntax nnoremap za +nnoremap zm +nnoremap zr nnoremap s :mksession! -"print the register -nmap q "ap -"save register -nmap Q "ayydd - -" Increment also letters -"set nrformats=alpha,octal,hex - " Jira config let b:jiracomplete_url = 'http://192.168.1.49:8080/jira' let b:jiracomplete_username = 'r.kmiec' @@ -403,13 +364,13 @@ set updatetime=4000 " additional mapping : complete a classical C multi-line comment: "inoremap /* /*/kA " additional mapping : { always opens a block -inoremap { {}O +"inoremap { {}O "vnoremap { S{}Pk=iB inoremap :w :wi "let g:clang_format#code_style = "WebKit" -let g:clang_format#command = "clang-format-3.9" +let g:clang_format#command = "clang-format" "let g:clang_format#auto_format_on_insert_leave = 1 "let g:clang_format#auto_format = 1 @@ -477,9 +438,6 @@ let g:clang_format#style_options = { "let g:vebugger_leader='d' "let g:vebugger_path_gdb='/home/kmir/ARM-TOOLCHAIN/cross/bin/arm-none-eabi-gdb' -set foldtext=getline(v:foldstart) -set fillchars=fold:\ -set foldmethod=syntax set expandtab "nnoremap :silent ! plantuml %:p && eog -g %:p:r.png &:redraw! @@ -490,18 +448,7 @@ let g:ctrlp_cmd = 'CtrlPLastMode' let g:ctrlp_user_command = 'ack --cpp --cc -f %s' let g:ctrlp_working_path_mode = 'rw' -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 - -let g:alternateSearchPath="sfr:../source,sfr:../src,sfr:../include,sfr:../inc,sfr:./Source,sfr:.." - -set nowrapscan - -tnoremap N -"set notimeout ttimeout timeoutlen=100 +tnoremap set spell set runtimepath+=/usr/share/vim/vimfiles @@ -514,6 +461,7 @@ set dictionary+=/usr/share/dict/words "let g:rtagsRcCmd='rtags-rc' set timeoutlen=1000 +set ttimeout set ttimeoutlen=0 let g:matchparen_timeout = 2 let g:matchparen_insert_timeout = 2 @@ -525,40 +473,42 @@ 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 + 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 +xnoremap S :s//g xmap x -set path+=** - 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 = 'hpp' - 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 + 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 = 'hpp' + 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() + +packadd termdebug