" Tab functionality set expandtab set tabstop=4 set shiftwidth=4 set softtabstop=4 set autoindent " Ensure backspace actually works set backspace=2 " " allow for cursor beyond last character set virtualedit=onemore " lines to scroll when cursor leaves screen set scrolljump=5 " minimum lines to keep above and below cursor set scrolloff=3 " Enable mouse input set mousehide set mouse=a " Use more convenient leader let mapleader="\" " Remap jk to esc inoremap jk " Easy esc on TEX Yoda inoremap `` vnoremap `` " Change Working Directory to that of the current file cmap cwd lcd %:p:h cmap cd. lcd %:p:h " Bind Make to F5 like other IDEs nnoremap :make " Ctrl-Space for omnicompletions inoremap pumvisible() \|\| &omnifunc == '' ? \ "\C-n>" : \ "\C-x>\C-o>=pumvisible() ?" . \ "\"\\c-n>\\c-p>\\c-n>\" :" . \ "\" \\bs>\\C-n>\"\" imap augroup close_docs autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif augroup end " Toggle highlighting with \hr (highlight row) nnoremap hr :set cursorline! " Toggle Line numbers with Ctrl+N double tap nmap :set invnumber nmap ln :set invnumber " Toggle line wrap with Ctrl+L double tap nmap :set wrap! nmap lw :set wrap! " Toggle White Space nmap ws :set list! " Map Shift+U to redo nnoremap " Stupid shift key fixes cmap WQ wq cmap Wq wq cmap W w cmap Q q cmap Q! q! cmap Qa qa cmap Qa! qa! cmap QA qa cmap QA! qa! " Stupid semicolon files cnoremap w; w cnoremap W; w cnoremap q; q cnoremap Q; q " Avoid accidental Ex-mode :map Q " Clearing highlighted search nmap / :set hlsearch! hlsearch? " Clear search nmap cs :nohlsearch " Code fold nmap cf va{zf%:nohlsearch " Paste over vnoremap pp p vnoremap po "_dP " Terminal mode " Make switching to normal mode a bit easier if has('nvim') || has('terminal') tnoremap N endif if has('nvim') " Add bash related term commands command Bash e term://bash command VBash vsp term://bash command SBash sp term://bash command TBash tabedit term://bash " Add fish related term commands command Fish e term://fish command VFish vsp term://fish command SFish sp term://fish command TFish tabedit term://fish elseif has('terminal') " Add bash related term commands command Bash :terminal ++curwin bash command VBash vsp|:terminal ++curwin bash command SBash sp|:terminal ++curwin bash command TBash tabedit|:terminal ++curwin bash " Add fish related term commands command Fish :terminal ++curwin fish command VFish vsp|:terminal ++curwin fish command SFish sp|:terminal ++curwin fish command TFish tabedit|:terminal ++curwin fish endif " Buffer nav nmap gb :bn nmap gB :bp " Command to display TODO tags in project " Generally, this is overriden in vim-grepper command Todo grep TODO " Easy update tags " Generally this is overriden by Gutentags command TagsUpdate !ctags -R . " Set grepprg if executable('rg') set grepprg=rg\ --vimgrep\ --no-heading\ --color=never set grepformat=%f:%l:%c:%m,%f:%l:%m elseif executable('ag') set grepprg=ag\ --vimgrep\ --nogroup\ --nocolor elseif executable('ack') set grepprg=ack endif " Easily toggle spelling command Spell setlocal spell! spelllang=en_us