Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. ## Cursor movement
  2.  
  3. - h - move left
  4. - j - move down
  5. - k - move up
  6. - l - move right
  7. - w - jump by start of words (punctuation considered words)
  8. - W - jump by words (spaces separate words)
  9. - e - jump to end of words (punctuation considered words)
  10. - E - jump to end of words (no punctuation)
  11. - b - jump backward by words (punctuation considered words)
  12. - B - jump backward by words (no punctuation)
  13. - 0 - (zero) start of line
  14. - ^ - first non-blank character of line
  15. - $ - end of line
  16. - G - Go To command (prefix with number - 5G goes to line 5)
  17. Note: Prefix a cursor movement command with a number to repeat it. For example, 4j moves down 4 lines.
  18.  
  19.  
  20. ## Insert Mode - Inserting/Appending text
  21.  
  22. - i - start insert mode at cursor
  23. - I - insert at the beginning of the line
  24. - a - append after the cursor
  25. - A - append at the end of the line
  26. - o - open (append) blank line below current line (no need to press return)
  27. - O - open blank line above current line
  28. - ea - append at end of word
  29. - Esc - exit insert mode
  30.  
  31.  
  32. ## Editing
  33.  
  34. - r - replace a single character (does not use insert mode)
  35. - J - join line below to the current one
  36. - cc - change (replace) an entire line
  37. - cw - change (replace) to the end of word
  38. - c$ - change (replace) to the end of line
  39. - s - delete character at cursor and subsitute text
  40. - S - delete line at cursor and substitute text (same as cc)
  41. - xp - transpose two letters (delete and paste, technically)
  42. - u - undo
  43. - . - repeat last command
  44.  
  45.  
  46. ## Marking text (visual mode)
  47.  
  48. - v - start visual mode, mark lines, then do command (such as y-yank)
  49. - V - start Linewise visual mode
  50. - o - move to other end of marked area
  51. - Ctrl+v - start visual block mode
  52. - O - move to Other corner of block
  53. - aw - mark a word
  54. - ab - a () block (with braces)
  55. - aB - a {} block (with brackets)
  56. - ib - inner () block
  57. - iB - inner {} block
  58. - Esc - exit visual mode
  59.  
  60.  
  61. ## Visual commands
  62.  
  63. - \> - shift right
  64. - < - shift left
  65. - y - yank (copy) marked text
  66. - d - delete marked text
  67. - ~ - switch case
  68.  
  69.  
  70. ## Cut and Paste
  71.  
  72. - yy - yank (copy) a line
  73. - 2yy - yank 2 lines
  74. - yw - yank word
  75. - y$ - yank to end of line
  76. - p - put (paste) the clipboard after cursor
  77. - P - put (paste) before cursor
  78. - dd - delete (cut) a line
  79. - dw - delete (cut) the current word
  80. - x - delete (cut) current character
  81.  
  82.  
  83. ## Exiting
  84.  
  85. - :w - write (save) the file, but don't exit
  86. - :wq - write (save) and quit
  87. - :q - quit (fails if anything has changed)
  88. - :q! - quit and throw away changes
  89.  
  90.  
  91. ## Search/Replace
  92.  
  93. - /pattern - search for pattern
  94. - ?pattern - search backward for pattern
  95. - n - repeat search in same direction
  96. - N - repeat search in opposite direction
  97. - :%s/old/new/g - replace all old with new throughout file
  98. - :%s/old/new/gc - replace all old with new throughout file with confirmations
  99.  
  100.  
  101. ## Working with multiple files
  102.  
  103. - :e filename - Edit a file in a new buffer
  104. - :bnext (or :bn) - go to next buffer
  105. - :bprev (of :bp) - go to previous buffer
  106. - :bd - delete a buffer (close a file)
  107. - :sp filename - Open a file in a new buffer and split window
  108. - ctrl+ws - Split windows
  109. - ctrl+ww - switch between windows
  110. - ctrl+wq - Quit a window
  111. - ctrl+wv - Split windows vertically
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement