vim: cleanup configuration

This commit is contained in:
Robert Kmiec
2019-05-22 14:17:30 +02:00
parent fb039cc690
commit 797765087b

244
.vimrc
View File

@@ -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 <F6> :call CurtineIncSw()<CR>
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=<F3>
" 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 <leader><space> :noh<cr>
"nnoremap <tab> %
nnoremap <tab> %
"vnoremap <tab> %
" 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 <up> <C-w>k
nnoremap <down> <C-w>j
nnoremap <left> <C-w>h
nnoremap <right> <C-w>l
nnoremap <Home> :tabp<CR>
nnoremap <End> :tabn<CR>
nnoremap j gj
nnoremap k gk
@@ -177,36 +150,33 @@ vnoremap <F1> <ESC>
vnoremap <c-a> <c-a>gv
vnoremap <c-x> <c-x>gv
" Set vim to save the file on focus out.
" Set vim to save the file on focus out
"au FocusLost * :wa
nmap <leader>w :wa<CR>
" 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 <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
" Re-hardwrap Paragraph
nnoremap <leader>q gqip
" ,v Select just pasted text.
" leader v Select just pasted text
"nnoremap <leader>v V`]
" jj For Quicker Escaping between normal and editing mode.
" jj For Quicker Escaping between normal and editing mode
inoremap jj <ESC>
inoremap jk <ESC>
" 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 <C-n> :NERDTreeToggle<cr>
let NERDTreeIgnore=['\.vim$', '\~$', '\.pyc$']
"nnoremap <C-n> :NERDTreeToggle<cr>
"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 <leader>t <ESC>:TagbarToggle<cr>
"imap <leader>t <ESC>:TagbarToggle<cr>i
nmap <leader>t :TlistToggle<cr>
imap <leader>t <ESC>:TagbarToggle<cr>i
"nmap <leader>t :TlistToggle<cr>
"imap <leader>t <ESC>:TagbarToggle<cr>i
nnoremap Y y$
map <Leader>a gg0VG$
nnoremap <leader>2 <esc>:set tabstop=2 softtabstop=2 shiftwidth=2<cr>
@@ -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 <F10> :ConoLineColorDark<CR>
"nnoremap <S-F10> :ConoLineColorLight<CR>
map <F12> :colorscheme random<CR>
" 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 <space> za
nnoremap <Home> zm
nnoremap <End> zr
nnoremap <leader>s :mksession!<CR>
"print the register
nmap <leader>q "ap
"save register
nmap <leader>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 <buffer> /*<CR> /*<CR><CR>/<Esc>kA<Space>
" additional mapping : {<CR> always opens a block
inoremap <buffer> {<CR> {<CR>}<Esc>O
"inoremap <buffer> {<CR> {<CR>}<Esc>O
"vnoremap <buffer> {<CR> S{<CR>}<Esc>Pk=iB
inoremap :w<CR> <Esc>:w<CR>i
"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='<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 <F2> :silent ! plantuml %:p && eog -g %:p:r.png &<CR>:redraw!<CR>
@@ -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 <Esc> <C-W>N
"set notimeout ttimeout timeoutlen=100
tnoremap <Esc> <C-W><C-W>
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 <silent> n n:call HLNext(0.2)<cr>
nnoremap <silent> N N:call HLNext(0.2)<cr>
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<LEFT><LEFT>
xnoremap S :s//g<LEFT><LEFT>
xnoremap S :s//g<LEFT><LEFT>
xmap <BS> 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 <F6> :call FindAlternate()<CR>
"let g:alternateSearchPath="sfr:../source,sfr:../src,sfr:../include,sfr:../inc,sfr:./Source,sfr:.."
"map <F6> :call CurtineIncSw()<CR>
packadd termdebug