" vim map setting " Treat long lines as break lines (useful when moving around in them) map j gj map k gk nnoremap j gj nnoremap k gk " fast saving nmap w :w! " use tab as % nmap % vmap % " smart way to move between windows map j map k map h map l " Useful mappings for managin tabs map tn :tabnew map to :tabonly map tc :tabclose " Disable arrowkeys noremap noremap noremap noremap " visual mode copy and paste to system clipboard "vmap "+y "vmap "+c "vmap "+p " 将VIM中将内容复制到系统粘贴板,或者从系统粘贴板粘贴到VIM nnoremap "+y vnoremap "+y vnoremap "+gP nnoremap "+gP " 快速移动当前行 nnoremap :m .+1== nnoremap :m .-2== inoremap :m .+1==gi inoremap :m .-2==gi vnoremap :m '>+1gv=gv vnoremap :m '<-2gv=gv " 空格关闭高亮,清空所有已经显示 nnoremap :set hlsearch! hlsearch? " Save a file as root (,W) noremap W :w !sudo tee % > /dev/null " sudo write " https://catonmat.net/sudo-vim cnoremap sudow w !sudo tee % >/dev/null " Strip trailing whitespace (,ss) function! StripWhitespace() let save_cursor = getpos(".") let old_query = getreg('/') :%s/\s\+$//e call setpos('.', save_cursor) call setreg('/', old_query) endfunction noremap ss :call StripWhitespace() set hidden " 避免必须保存修改才可以跳转 buffer " buffer "nmap n :bnext "nmap p :bprev function! Xml() set filetype=xml :%s/>\r<替换成>回车< :normal gg=G endfunction map xml :call Xml() " plugin map setting " Normal mode F2 to call NERDTree nmap :NERDTreeToggle nnoremap i :PlugInstall nnoremap u :PlugUpdate " fzf nnoremap :GFiles nnoremap f :Files nnoremap C :Colors nnoremap :Buffers nnoremap fl :Lines nnoremap ag :Ag! nnoremap m :History