From 59e9f9b40f2163be07f3ee5a78f751925c030e1d Mon Sep 17 00:00:00 2001 From: liuyi Date: Fri, 22 Mar 2019 18:33:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E4=BA=9B=E6=8C=89?= =?UTF-8?q?=E9=94=AE=E5=92=8C=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit H wrap 模式下,光标移动到屏幕中显示的行首,而不是整行行首 L wrap 模式下,光标移动到屏幕中显示的行尾,而不是整行行尾 gh 光标移动到整行行首 gl 光标移动到整行行尾 J 光标移动到本页最下面一行,好处:可以方便地与 j 命令连用 K 光标移动到本页最上面一行,好处:可以方便地与 k 命令连用 ,x 同 :wq 或 :x ,快速保存并退出 取消光标所在列的高亮,这样阅读时不容易挡视线 开启 wrap 模式,这样比 nowrap 模式可读性更强,此好处尤其体现在需要用鼠标复制的时候 --- vimrc | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/vimrc b/vimrc index 2cc66df..fcb4600 100644 --- a/vimrc +++ b/vimrc @@ -44,7 +44,7 @@ set tm=500 " show location -set cursorcolumn +"set cursorcolumn set cursorline @@ -55,7 +55,7 @@ set scrolloff=7 " keep 3 lines when scrolling " show set ruler " show the current row and column set number " show line numbers -set nowrap +"set nowrap set showcmd " display incomplete commands set showmode " display current modes set showmatch " jump to matches when entering parentheses @@ -182,6 +182,8 @@ nnoremap k gk nnoremap gk k nnoremap j gj nnoremap gj j +nnoremap gh ^ +nnoremap gl $ map j map k @@ -194,7 +196,20 @@ nnoremap :set wrap! wrap? set pastetoggle= " when in insert mode, press to go to " paste mode, where you can paste mass data " that won't be autoindented + +" disbale paste mode when leaving insert mode au InsertLeave * set nopaste + +" F5 set paste问题已解决, 粘贴代码前不需要按F5了 +" F5 粘贴模式paste_mode开关,用于有格式的代码粘贴 +" Automatically set paste mode in Vim when pasting in insert mode +function! XTermPasteBegin() + set pastetoggle=[201~ + set paste + return "" +endfunction +inoremap [200~ XTermPasteBegin() + nnoremap :exec exists('syntax_on') ? 'syn off' : 'syn on' " kj 替换 Esc @@ -204,6 +219,8 @@ inoremap kj nnoremap q :q " Quickly save the current file nnoremap w :w +" Quickly save and quit +nnoremap x :x " select all map sa ggVG" @@ -243,8 +260,10 @@ map Y y$ nnoremap ; : " Shift+H goto head of the line, Shift+L goto end of the line -nnoremap H ^ -nnoremap L $ +nnoremap J L +nnoremap K H +nnoremap H g^ +nnoremap L g$ " save cmap w!! w !sudo tee >/dev/null %