vim 命令整理(从FreePlane的mm格式导出)

~ Vim

  • 修改记录
    • 2012年1月16日23:40:56创建
      • ver1:
        Vim Commands and shortcuts
        By : Joe Martinez
        http://jrmiii.com@capitalist
    • 2012年1月23日18:02:10修改增加
      • 根据Vim Keymapping.jpg进行修改增加
    • 2012年4月3日8:52:43
      • 对一些超级有用的加红以强调
    • 2013年3月25日14:57:48
      • 从早上六点半开始复习与练习,到增加对“"+”[ydp]{motion}的理解,现在使用gvim应该可以达到与ue一样的效果了
  • Macros
    • qa := start recoding a macro in register a([a-zA-Z0-9])
    • q := end recording
    • @a := replay macro in register a([a-zA-Z0-9])
    • :reg := view contents of registers
  • Multi-File
    • :e filename := edit a file in new buffer
    • :enew := new file
    • :bn := go to next buffer
    • :bd := delete a buffer (close file)
    • :sp fn := open a file in new buffer and split window
    • c-w -window commands
      • c-w s := split windows horizontally
      • c-w v := split windows vertically
      • c-w w := switch windows
      • c-w c := close window
      • c-w q := quit a window
    • Tab Commands
      • :tabe fn := edit file in new tab
      • gt := next tab
      • gT := previous tab
      • :tabr :=first tab
      • :tabl := last tab
      • :tabm[N] := move current tab after tab N
      • :tabdo command := do command in all tabs
      • :tabnew := open a new tab
      • c-PgUp := switch to tab on right
      • c-PgDown := switch to tab on left
  • Exiting
    • :w := save
    • :wq := save and quit
    • :x := save and quit
    • :q := quit, but buffer is unsaved
    • :q! :=quit, without warning
  • Search/Replace
    • /pattern := search for pattern
    • ?pattern := search backwards for pattern
    • n := repeat search in same direction
    • N := repeat search in opposite direction
    • :%s/old/new/gc := replace(s) all old with new and confirm(c) each one throught(g) file
    • % : move to matching bracket from under cursor(括号配对)
    • :#, &s/old/new/g := do replace in line # to &
  • Visual Mode
    • Marking Text
      • v := start visual mode
      • V := start linewise visual mode
      • c-v := start blockwise visual mode
      • o := move the other end of marked area
      • U := upper case of marked area
      • O := move to other corner of block
      • aw := mark a word
      • ab := a block with parens (braces) (paren:括号 brace:大括号)
      • aB := a block with brackets (curly braces) ( bracket: 方括号)
      • ib := inner () block
      • iB := inner {} block
    • Commands
      • > := shift right
      • < := shift left
      • y := yank (mean copy)
      • d := delete
      • ~ := switch case
  • Cut and Paste
    • dd := delete (cut) a line
    • dw := delete current word
    • x := delete current character
    • X := delete previous character
    • D := delete to end of line
    • yy := yank (copy a line)
    • yw := yank word
    • y$ := yank to end of line
    • p := put the clipboard after cursor / current line
    • P := put the clipboard befoe cursor /current line
    • ]p := put the clipboard at the proper indentation (proper:适当的 indentation:缩进)
    • [p := put the clipboard at the ?
    • "a := use a register named a for the next yank / paste operation
    • "[+*]y{motion}:= copy to host clipboard,"motion"可以进行的移动
      • "+y2w : 复制光标所在的两个单词(后的)到系统的剪贴版

        "+d2b : 删除光标所在的两个单词(前的)到系统的剪贴版

        应该说:“"+”是代码向vim进程外或向vim进程内与系统的剪贴板进行操作,这个操作可以是复制(y); 可以是剪切(d); 可以是粘贴(p)。并且这个动作还可以增加相应的范围(如"+y2w,"+d4b,5e)(p时没有范围)!!!

    • "[+*]p := paste from the host clipboard
    • :#,&d := delete from line # to &
    • "[a-zA-Z0-9]dd := delete to register(同样的动作对于拷贝与粘贴也是启作用的)
  • Code Folding
    • zo := open fold
    • zc := close fold
    • zr := reduce fold level
    • zm := increase fold level
    • zR := reduce all folds
    • zM := increase all folds
    • zj := move to next fold downward
    • zk := move to next fold upward
    • zd := delete fold
    • zE := delete all folds
    • zf#j := create fold of # lines below cursors
    • :#, & fold := create fold betweeen line # and &
    • zfap := create fold of paragraph
    • zfa} := create fold in {} brackets
    • zfa) := create fold in () brackets
    • zfa] := create fold in [] brackets
    • zfa> := create fold in <> brackets
  • Cursor Movement
    • h := left character
    • j := next line
    • k := previous line
    • l := right character
    • gk := move cursor up one display line
    • gj := move cursor down one display line
    • c-f := page down
    • c-b := page up
    • c-u := page up half a screenful
    • c-d := page down half a screenful
    • % := jump to matching brace
    • w :=jump to end of words(punctuation)
    • W := jump by words
    • e := jump to end of words(punctuation)
    • E := jump to end if words
    • b := jump backward by words(punctuation)
    • B := jump backward by words
    • 0 := start of line
    • ^ := first character of line
    • $ := end of line
    • gg := go to first line
    • gd := go to def of the function or var under the cursor
    • [N]G := go to line N or last line
    • fx := move the cursor forword to the next occurrence of character x on the current line
    • ; := repeat last command
    • tx := like fx but move right before the character
    • Fx := move the cursor backwards to the next occurrence of x
    • ),( := move the cursor to next, previous sentence
    • * := read the string under the cursor and go to next occurrence(这个对我来说太重要了2013年3月25日7:21:06)
    • # := same as * but gose to previous occurrence
    • `. := go to line last edited
    • Screenwise
      • H := move the cursor to the Highest line on the screen
      • M := .........................................Middle....................................
      • L := .........................................Lowest...................................
    • Bookmarks
      • m[a~zA-Z] := make a make named [a~z]  at the current cursor position
      • '[a~zA-Z] := go to bookmard [a~z] (backtick : 重音符, not single quote)
      • :marks := show all marks
      • c-g := show current position in file
      • f := show line nubers
  • Insert Mode
    • i := insert mode at cursor
    • I := insert at the beginning of line
    • a := append after the cursor
    • A := append at the end of the line
    • o := open blank line below current line
    • O := open blank line above current line
    • ESC := exit insert mode
    • Completions(type a few chars then)
      • c-n := next completion
      • c-p := previous completion
  • Editing
    • r := replace a single character(!insert mode)
    • J := join line below to the current line
    • cc := change an entire line
    • cw := change to the end of word
    • c$ := change to the end of line
    • s := delete character at cursor and substitude next
    • S := delete line at cursor and substitude next
    • xp := transpose to letters
    • u := undo
    • c-r := redo
    • . := repeat last command
    • ~ := switch case
    • g~iw := switch case of current word
    • gUiw := make current word uppercase
    • guiw := make current word lowercase
    • >> := indent line one columm right
    • << := indent line one column left
    • == := auto-indent current line
    • ci[")}]>'] := replace between "",(),{},{},<>,''
    • cit := replace between XML/HTML tag pair
  • Panes
    • :vnew := split window/pane vertically
    • :new := split window/pane horizontally
    • c + [HJKL] := move cursor in windows like
    • c + [+-><] :=Increase/Decrease current pane height or width
    • c + _ := give all vertical space to current pane
    • c + | := give all horizontally space for all panes
    • c + = := evenly distrubute space for all panes
  • Miscellaneous
    • u := undo
    • U := restore line
    • J := join line below to current line
    • . := repeat last command
  • External Calls
    • :! command := excute an external command in the shell
    • :r file := insert the contents of file at cursor position
    • :r !command := insert output of command at cursor position
    • 数学复习
      • 1 + 1 = ?
  • good example
    • :tabdo %s/gbk/utf-8/g :=在所有标签中执行全局替换动作(2012年1月21日21:45:01)
    • map <leader><F5> i<C-R>=strftime("%Y年%m月%d %H:%M:%S")<ESC><ESC>         "插入时间(2012年4月2日21:13:16)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值