mirror of https://github.com/einverne/dotfiles.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.4 KiB
70 lines
1.4 KiB
" 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 <leader>w :w!<cr> |
|
|
|
" use tab as % |
|
nmap <tab> % |
|
vmap <tab> % |
|
|
|
" smart way to move between windows |
|
map <C-j> <C-W>j |
|
map <C-k> <C-W>k |
|
map <C-h> <C-W>h |
|
map <C-l> <C-W>l |
|
|
|
" Useful mappings for managin tabs |
|
map <leader>tn :tabnew<cr> |
|
map <leader>to :tabonly<cr> |
|
map <leader>tc :tabclose<cr> |
|
|
|
" Disable arrowkeys |
|
noremap <Up> <Nop> |
|
noremap <Down> <Nop> |
|
noremap <Left> <Nop> |
|
noremap <Right> <Nop> |
|
|
|
" visual mode copy and paste to system clipboard |
|
"vmap <C-c> "+y |
|
"vmap <C-x> "+c |
|
"vmap <C-v> "+p |
|
|
|
" 将VIM中将内容复制到系统粘贴板,或者从系统粘贴板粘贴到VIM |
|
nnoremap <C-y> "+y |
|
vnoremap <C-y> "+y |
|
vnoremap <C-p> "+gP |
|
nnoremap <C-p> "+gP |
|
|
|
" 快速移动当前行 |
|
nnoremap <A-j> :m .+1<CR>== |
|
nnoremap <A-k> :m .-2<CR>== |
|
inoremap <A-j> <Esc>:m .+1<CR>==gi |
|
inoremap <A-k> <Esc>:m .-2<CR>==gi |
|
vnoremap <A-j> :m '>+1<CR>gv=gv |
|
vnoremap <A-k> :m '<-2<CR>gv=gv |
|
|
|
" 空格关闭高亮,清空所有已经显示 |
|
nnoremap <Space> :set hlsearch! hlsearch?<CR> |
|
|
|
set hidden " 避免必须保存修改才可以跳转 buffer |
|
" buffer |
|
"nmap <leader>n :bnext<CR> |
|
"nmap <leader>p :bprev<CR> |
|
|
|
function! Xml() |
|
set filetype=xml |
|
:%s/></>\r</g "把><替换成>回车< |
|
:normal gg=G<cr> |
|
endfunction |
|
map <leader>xml :call Xml() |
|
|
|
" plugin map setting |
|
|
|
" Normal mode F2 to call NERDTree |
|
nmap <F2> :NERDTreeToggle<cr>
|
|
|