" Better escape inoremap jk inoremap kj " Better Y nmap Y y$ " Basic file commands nnoremap :!touch nnoremap :!crf nnoremap :!mkdir nnoremap :!mv% " Shorten default replace command nnoremap :%s//g " Delete trailing whitespace nnoremap :%s/\s\+$//e " Use alt + hjkl to resize windows nnoremap :resize -2 nnoremap :resize +2 nnoremap :vertical resize -2 nnoremap :vertical resize +2 " Better window navigation nnoremap h nnoremap j nnoremap k nnoremap l " Terminal window navigation " tnoremap h " tnoremap j " tnoremap k " tnoremap l tnoremap " Cancel actions nnoremap inoremap i " Move between buffers nnoremap :bnext nnoremap :bprevious " Just do it " cmap w!! w !sudo tee % " Fix indenting visual block vmap < >gv " Move selected line / block of text in visual mode xnoremap K :move '<-2gv-gv xnoremap J :move '>+1gv-gv " Bad hands cnoreabbrev W! w! cnoreabbrev Q! q! cnoreabbrev Qall! qall! cnoreabbrev Qa! qa! cnoreabbrev QA! qa! cnoreabbrev Wq wq cnoreabbrev Wa wa cnoreabbrev wQ wq cnoreabbrev WQ wq cnoreabbrev W w cnoreabbrev Q q cnoreabbrev Qall qall cnoreabbrev Qa qa cnoreabbrev QA qa cnoreabbrev Wqa wqa cnoreabbrev WQa wqa function! ToggleIndentStyle() if &expandtab == 1 set noexpandtab set softtabstop& set shiftwidth& echomsg "Switched to indent with tabs." else set expandtab set softtabstop = 4 set shiftwidth = 4 echomsg "Switched to indent with 4 spaces." endif endfunction noremap :call ToggleIndentStyle()