set encoding=UTF-8 let mapleader = " " set nocompatible set completeopt-=preview filetype off set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() Plugin 'tpope/vim-surround' Plugin 'easymotion/vim-easymotion' Plugin 'sheerun/vim-polyglot' Plugin 'ctrlpvim/ctrlp.vim' Plugin 'chrisbra/Recover.vim' Plugin 'nanotech/jellybeans.vim' Plugin 'unblevable/quick-scope' Plugin 'tpope/vim-repeat' Plugin 'adelarsq/vim-matchit' Plugin 'majutsushi/tagbar' Plugin 'ludovicchabant/vim-gutentags' Plugin 'mbbill/undotree' Plugin 'tpope/vim-commentary' Plugin 'wellle/context.vim' call vundle#end() filetype plugin indent on " jellybeans colo jellybeans set background=dark let g:gruvbox_italics = 1 let g:jellybeans_overrides = { \ 'Todo': { 'guifg': '000000', 'guibg': '00cc00', \ 'ctermfg': 'Black', 'ctermbg': 'Blue', \ 'attr': 'bold' }, \ 'Comment': { 'guifg': '339966' }, \ 'background': { "guibg": "000000", "ctermbg":"none"}, \ 'StorageClass': {"guifg": '9966ff' }, \ 'Exception': {"guifg": "99cc00"}, \ "Ignore": {"guifg": "336699"}, \ "SpecialComment": {"guifg": "009900"}, \ "Macro": {"guifg": "0099cc"} \} let g:jellybeans_use_term_italics = 1 "set exrc set encoding=UTF-8 set linebreak set breakindent set wrap set tagbsearch set secure set list set showmatch set number set relativenumber set noerrorbells set hidden set novisualbell set expandtab set smarttab set autoindent set shell=ksh set autoread set ignorecase set smartcase set hlsearch set incsearch set magic set lazyredraw set ttyfast set scrolloff=0 set tagbsearch set wildmenu set diffopt=internal,algorithm:patience set tags=./tags,tags;$HOME syntax on set directory^=$HOME/.vim/tmp// nmap nmap nmap nmap nmap nmap nmap nmap imap imap map :bp map :bn nnoremap :Vexplore map :TagbarToggle nnoremap :UndotreeToggle map :q set timeoutlen=1000 ttimeoutlen=100 set =^[[21;2~ map map! nnoremap :vsp nnoremap :sp nnoremap :ContextToggle set pastetoggle= nnoremap cd :cd %:p:h nmap ]c :cn nmap [c :cp function! GetBufferList() redir =>buflist silent! ls! redir END return buflist endfunction function! ToggleList(bufname, pfx) let buflist = GetBufferList() for bufnum in map(filter(split(buflist, '\n'), 'v:val =~ "'.a:bufname.'"'), 'str2nr(matchstr(v:val, "\\d\\+"))') if bufwinnr(bufnum) != -1 exec(a:pfx.'close') return endif endfor if a:pfx == 'l' && len(getloclist(0)) == 0 echohl ErrorMsg echo "Location List is Empty." return endif let winnr = winnr() exec(a:pfx.'open') if winnr() != winnr wincmd p endif endfunction nmap l :call ToggleList("Location List", 'l') nmap q :call ToggleList("Quickfix List", 'c') set laststatus=2 function! InsertStatuslineColor(mode) if a:mode == 'i' hi statusline ctermfg=22 ctermbg=15 guibg=#005f00 guifg=#ffffff elseif a:mode == 'r' hi statusline ctermfg=52 ctermbg=15 guibg=#5f0000 guifg=#ffffff else hi statusline ctermfg=25 ctermbg=63 guibg=#005faf guifg=#5f5fff endif endfunction au InsertEnter * call InsertStatuslineColor(v:insertmode) au InsertLeave * hi statusline ctermfg=24 ctermbg=15 guibg=#005f87 guifg=#ffffff hi statusline ctermfg=24 ctermbg=15 guibg=#005f87 guifg=#ffffff hi statuslineNC ctermfg=0 ctermbg=24 term=bold guifg=#000000 guibg=#005f87 set statusline=[%f] "file name set statusline+=[%{strlen(&fenc)?&fenc:'none'}, "file encoding set statusline+=%{&ff}] "file format set statusline+=%y "filetype set statusline+=%h "help file flag set statusline+=%m "modified flag set statusline+=\ %= " align left set statusline+=Line:%l/%L[%p%%] " line X of Y [percent of file] set statusline+=\ Col:%c " current column set statusline+=\ Buf:%n " Buffer number set statusline+=\ [%b][0x%B]\ " ASCII and byte code under cursor set fillchars+=vert:\ " whitespace signifacant hi VertSplit ctermbg=0 ctermfg=0 guibg=#000000 guifg=#000000 " highlight groups hi def InterestingWord1 ctermfg=16 ctermbg=214 guifg=#000000 guibg=#ffaf00 hi def InterestingWord2 ctermfg=16 ctermbg=154 guifg=#000000 guibg=#afff00 hi def InterestingWord3 ctermfg=16 ctermbg=121 guifg=#000000 guibg=#87ffaf hi def InterestingWord4 ctermfg=16 ctermbg=137 guifg=#000000 guibg=#af875f hi def InterestingWord5 ctermfg=16 ctermbg=211 guifg=#000000 guibg=#ff87af hi def InterestingWord6 ctermfg=16 ctermbg=195 guifg=#000000 guibg=#d7ffff hi def InterestingWord7 ctermfg=16 ctermbg=99 guifg=#000000 guibg=#875fff hi def InterestingWord8 ctermfg=16 ctermbg=35 guifg=#000000 guibg=#00af5f hi def InterestingWord9 ctermfg=16 ctermbg=57 guifg=#000000 guibg=#5f00ff hi def InterestingWord0 ctermfg=16 ctermbg=39 guifg=#000000 guibg=#00afff " Steve Losh's highlight function function HighInterestingWord(n) normal! mz normal! "zyiw let mid = 88888 + a:n silent! call matchdelete(mid) let pat = '\V\<' . escape(@z, '\') . '\>' call matchadd("InterestingWord".a:n, pat, 1, mid) normal! `z endfunction " multiple highlights nnoremap 1 :call HighInterestingWord(1) nnoremap 2 :call HighInterestingWord(2) nnoremap 3 :call HighInterestingWord(3) nnoremap 4 :call HighInterestingWord(4) nnoremap 5 :call HighInterestingWord(5) nnoremap 6 :call HighInterestingWord(6) nnoremap 7 :call HighInterestingWord(7) nnoremap 8 :call HighInterestingWord(8) nnoremap 9 :call HighInterestingWord(9) nnoremap 0 :call HighInterestingWord(0) au BufNewFile,BufEnter *.s set ft=nasm "copy and paste between different Vim sessions nmap _Y :!echo ""> ~/.vi_tmp:w! ~/.vi_tmp vmap _Y :w! ~/.vi_tmp nmap _P :r ~/.vi_tmp inoremap I inoremap A iab pritn print iab retrun return iab fucntion function iab funciton function nnoremap :bd map nnoremap c :call clearmatches() map w :w nnoremap t :bel term nnoremap r :!%:p let g:qs_highlight_on_keys = ["f", "F", "t", "T"] " undotree if has("persistent_undo") set undodir=~/.undodir/ set undofile endif let g:undotree_WindowLayout = 4 "highlight search highlight Search ctermfg=White ctermbg=DarkGreen cterm=Bold highlight IncSearch ctermfg=White ctermbg=DarkBlue cterm=Bold highlight WildMenu ctermfg=DarkBlue ctermbg=DarkGreen cterm=Bold "netrw let g:netrw_sort_by = 'date' let g:netrw_sort_direction = 'reverse' let g:netrw_banner = 0 let g:netrw_liststyle = 3 let g:netrw_browse_split = 1 let g:netrw_winsize = 15 let g:netrw_fastbrowse = 1 let g:netrw_sort_by = 'name' let g:netrw_sort_direction = 'normal' "tagbar let g:tagbar_compact = 1 let g:tagbar_show_linenumbers = 2 let g:tagbar_width = 50 highlight TagbarSignature ctermfg=DarkBlue "view the python docs for the word under cursor in a split window function! s:pythondoc() let l:vword = expand("") botright vnew setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap execute ".!pydoc3 " . l:vword setlocal nomodifiable set syntax=man 1 endfunction command! -complete=shellcmd -nargs=0 PythonDoc call s:pythondoc() nnoremap h :PythonDoc "camel and snake case motion let g:camelchar = "A-Z0-9.,;:{([`'\"_" nnoremap :call search('\C\<\\%(^\[^'.g:camelchar.']\@<=\)['.g:camelchar.']\['.g:camelchar.']\ze\%([^'.g:camelchar.']\&\>\@!\)\\%^','bW') nnoremap :call search('\C\<\\%(^\[^'.g:camelchar.']\@<=\)['.g:camelchar.']\['.g:camelchar.']\ze\%([^'.g:camelchar.']\&\>\@!\)\\%$','W') inoremap :call search('\C\<\\%(^\[^'.g:camelchar.']\@<=\)['.g:camelchar.']\['.g:camelchar.']\ze\%([^'.g:camelchar.']\&\>\@!\)\\%^','bW') inoremap :call search('\C\<\\%(^\[^'.g:camelchar.']\@<=\)['.g:camelchar.']\['.g:camelchar.']\ze\%([^'.g:camelchar.']\&\>\@!\)\\%$','W') vnoremap :call search('\C\<\\%(^\[^'.g:camelchar.']\@<=\)['.g:camelchar.']\['.g:camelchar.']\ze\%([^'.g:camelchar.']\&\>\@!\)\\%^','bW')v`>o vnoremap `>:call search('\C\<\\%(^\[^'.g:camelchar.']\@<=\)['.g:camelchar.']\['.g:camelchar.']\ze\%([^'.g:camelchar.']\&\>\@!\)\\%$','W')v` inoremap ' '' inoremap ( () inoremap [ [] inoremap { {} inoremap { {}O "window resizing if bufwinnr(1) nnoremap > nnoremap < nnoremap - nnoremap + endif if has('cscope') set cscopetag cscopeverbose if has('quickfix') set cscopequickfix=s-,c-,d-,i-,t-,e- endif cnoreabbrev csa ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs add' : 'csa') cnoreabbrev csf ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs find' : 'csf') cnoreabbrev csk ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs kill' : 'csk') cnoreabbrev csr ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs reset' : 'csr') cnoreabbrev css ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs show' : 'css') cnoreabbrev csh ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs help' : 'csh') command -nargs=0 Cscope cs add $VIMSRC/src/cscope.out $VIMSRC/src endif if has("gui") set guifont=DejaVu_Sans_Mono_for_Powerline:h10 set guioptions-=m set guioptions-=T set guioptions-=L set guioptions-=r endif