---
# System prepended metadata

title: vimrc

---

vimrc
===
```
~/.vimrc

nnoremap <silent> <F5> :NERDTree<CR>
nnoremap <silent> <F2> :YcmDiags<CR>
nnoremap <silent> <F3> :TlistToggle<CR>
nnoremap <silent> <F4> :wincmd p<CR>
nnoremap <silent> <F12> :%s/\s\+$//e<CR>
nmap <F10> ivoid main()<CR>{<CR>printf("hello\n");<CR>} <ESC>
nnoremap <silent> <F7> :set nu!<CR>
map <silent> <F8> :!indent<CR>V`]=
setlocal cinoptions=>4,e-2,n-2,{2,^-2,:2,=2,g0,h2,p5,t0,+2,(0,u0,w1,m1,e2-2
nnoremap <silent> <F9>
      \ :if exists('w:long_line_match') <Bar>
      \   silent! call matchdelete(w:long_line_match) <Bar>
      \   unlet w:long_line_match <Bar>
      \ elseif &textwidth > 0 <Bar>
      \   let w:long_line_match = matchadd('ErrorMsg', '\%>'.&tw.'v.\+', -1) <Bar>
      \ else <Bar>
      \   let w:long_line_match = matchadd('ErrorMsg', '\%>80v.\+', -1) <Bar>
      \ endif<CR>

"function DoSaveAndMake()
"    w
"    !make
"endfunction

set nocp
filetype plugin on
set number
au BufNewFile,BufRead *.md set filetype=lisp
au BufNewFile,BufRead *.cu set filetype=cuda
au BufNewFile,BufRead *.def set filetype=cpp
au BufNewFile,BufRead *.i set filetype=cpp
au BufNewFile,BufRead *.c set filetype=cpp
au BufNewFile,BufRead *.cpp set syntax=cpp11
au BufNewFile,BufRead *.cl  set syntax=cl


let Tlist_Exit_OnlyWindow = 1
set tabstop=8

" High light unwanted spaces in end of line
highlight ExtraWhitespace ctermbg=darkred guibg=darkcyan
autocmd BufEnter * if &ft != 'help' | match ExtraWhitespace /\s\+$/ | endif
autocmd BufEnter * if &ft == 'help' | match none /\s\+$/ | endif

" High light over length in a line
"au BufWinEnter * let w:long_line_match=matchadd('ErrorMsg', '\%>80v.\+', -1)
au BufWinEnter * let w:m1=matchadd('Search', '\%<101v.\%>81v', -1)
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>100v.\+', -1)

" Automatically removing all trailing whitespace
" autocmd BufWritePre * :%s/\s\+$//e
set nobackup
set nowritebackup
set noautoindent
set noai
set nocindent
set nosmartindent

set laststatus=2
set statusline+=%F
set statusline+=:%l


"let g:ycm_global_ycm_extra_conf = '/home/users/kito/.vim/.ycm_extra_conf.py'
let g:ycm_add_preview_to_completeopt = 0
set completeopt-=preview
nnoremap <leader>jd :YcmCompleter GoToDefinitionElseDeclaration<CR>

" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
  au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
    \| exe "normal! g'\"" | endif
endif

" Set highlight for search result
set hlsearch
set backspace=indent,eol,start

hi DiffAdd    ctermbg=235  ctermfg=35  guibg=#262626 guifg=#87af87 cterm=reverse gui=reverse
hi DiffChange ctermbg=235  ctermfg=7  guibg=#262626 guifg=#8787af cterm=reverse gui=reverse
hi DiffDelete ctermbg=235  ctermfg=138  guibg=#262626 guifg=#af5f5f cterm=reverse gui=reverse
hi DiffText   ctermbg=235  ctermfg=32  guibg=#262626 guifg=#ff8700 cterm=reverse gui=reverse
hi Search cterm=NONE ctermbg=blue
```

