- Tip 1. Meet the Dot Command:
.,x,u,dd,>G,i,<Esc> - Tip 2. Don’t Repeat Yourself:
$,a,A - Tip 3. Take One Step Back, Then Three Forward:
f{char},s,; - Tip 4. Act, Repeat, Reverse:
F{char}/T{char},/pattern<CR>,:s/target/replacement - Tip 5. Find and Replace by Hand:
/target,*,*nn,cw - Tip 6. Meet the Dot Formula: One key to move, One key to execute
- Tip 7. Pause with Your Brush Off the Page
- Tip 8. Chunk Your Undos
- Tip 9. Compose Repeatable Changes:
db,b,dw,daw - Tip 10. Use Counts to Do Simple Arithmetic:
<C-a>,<C-x>,yyp,cw,cW - Tip 11. Don’t Count If You Can Repeat:
d2w/W,2dw/W,dw. - Tip 12. Combine and Conquer:
gu,gU,y,d,c,=
- Tip 13. Make Corrections Instantly from Insert Mode:
<C-h>,<C-w>,<C-u> - Tip 14. Get Back to Normal Mode:
<Esc>,<C-[>,<C-o>,zz - Tip 15. Paste from a Register Without Leaving Insert Mode:
yt,,<C-r>0 - Tip 16. Do Back-of-the-Envelope Calculations in Place:
<C-r>= - Tip 17. Insert Unusual Characters by Character Code:
ga,<C-v>,<C-k - Tip 18. Insert Unusual Characters by Digraph:
<C-k>{char1}{char2} - Tip 19. Overwrite Existing Text with Replace Mode:
R,gR,r,gr
- Tip 20. Grok Visual Mode:
viw,c - Tip 21. Define a Visual Selection:
v,V,<C-v>,gv,o,e - Tip 22. Repeat Line-Wise Visual Commands:
<,> - Tip 23. Prefer Operators to Visual Commands Where Possible:
vit,U - Tip 24. Edit Tabular Data with Visual-Block Mode:
3j,r,yyp - Tip 25. Change Columns of Text:
- Tip 26. Append After a Ragged Visual Block:
$
- Tip 27. Meet Vim’s Command Line:
:,<C-w><C-u>,<C-v><C-k>,<C-r>{register} - Tip 28. Execute a Command on One or More Consecutive Lines:
:print,:digit,:$,:3p,:3d,:2,5p,.,:%p,:%s/old/new/,'<,'>,:/<html>/,/<\/html>/p - Tip 29. Duplicate or Move Lines Using ‘:t’ and ‘:m’ Commands:
:copy :co :t,:move :m,dGp - Tip 30. Run Normal Mode Commands Across a Range:
:normal,%normal A;,%normal i// - Tip 31. Repeat the Last Ex Command:
:@:,:@@,:bn[ext],:bp[revious],<C-o> - Tip 32. Tab-Complete Your Ex Commands:
:col<C-d> - Tip 33. Insert the Current Word at the Command Prompt:
<C-r><C-w> - Tip 34. Recall Commands from History:
q:,<C-f> - Tip 35. Run Commands in the Shell:
:!ls,:ls,:!ruby %,:shell,<C-z>,jobs,fg,:read !{cmd},:write !{cmd},:[range]!{cmd/filter},:2,$!sort -t',' -k2,!{motion},!G
- Tip 36. Track Open Files with the Buffer List:
:bnext,:ls,<C-^>,:bprev,:bfirst,:blast,:buffer N,:buffer {bufname},:bufdo,:argdo,:bd[elete] - Tip 37. Group Buffers into a Collection with the Argument List:
:args {arglist} - Tip 38. Manage Hidden Files:
:wirte,:edit!,qall!,:wall, - Tip 39. Divide Your Workspace into Split Windows:
<C-w>s,<C-w>v,:edit,:close,:only - Tip 40. Organize Your Window Layouts with Tab Pages:
:lcd{path},:tabe[dit] {filename},:tabmove [N] - Tip 41. Open a File by Its Filepath Using ':edit':
:edit %<Tab>,:edit %:h<Tab> - Tip 42. Open a File by Its Filename Using ':find':
:find,:set path+=app/** - Tip 43. Explore the File System with netrw:
:edit .,:e.,:Explore,:E. - Tip 44. Save Files to Nonexistent Directories:
<C-g>,:!mkdir -p %:h - Tip 45. Save a File as the Super User:
:w !sudo tee % > /dev/null
- Tip 46. Keep Your Fingers on the Home Row:
h,j,k,l - Tip 47. Distinguish Between Real Lines and Display Lines:
gj,gk,g0,g$,g^ - Tip 48. Move Word-Wise:
w,b,e,ge,ea,gea,W,cW - Tip 49. Find by Character:
f{char},;,,,F{char},t{char},T{char},dt. - Tip 50. Search to Navigate:
/{char},n,N - Tip 51. Trace Your Selection with Precision Text Objects:
vi},a",i",at,it - Tip 52. Delete Around, or Change Inside:
iw,iW,is,ip,aw,aW,as,ap - Tip 53. Mark Your Place and Snap Back to It:
m{a-zA-Z},'{mark} - Tip 54. Jump Between Matching Parentheses:
%,S"
- Tip 55. Traverse the Jump List:
<C-o>,<C-i> - Tip 56. Traverse the Change List:
:changes,.**, **^ - Tip 57. Jump to the Filename Under the Cursor:
gf - Tip 58. Snap Between Files Using Global Marks:
:vimgrep
- Tip 59. Delete, Yank, and Put with Vim’s Unnamed Register:
x,p,xp,dd,ddp,yyp,P,diw - Tip 60. Grok Vim’s Registers:
"{register},"ayiw,"bdd,"ap,"bp,:delete c,:put c,""p,"0P,:reg "0,"_d{motion},"+,"+p <C-r>+ - Tip 61. Replace a Visual Selection with a Register:
m{char}, ``{char}` - Tip 62. Paste from a Register:
<C-r>{register},p,P,gp,gP - Tip 63. Interact with the System Clipboard:
:set pastetoggle=<f5>
- Tip 64. Record and Execute a Macro:
q,q{register},:reg a,@{register},@@ - Tip 65. Normalize, Strike, Abort:
number@a - Tip 66. Play Back with a Count:
qq;.q - Tip 67. Repeat a Change on Contiguous Lines:
0,:normal @a - Tip 68. Append Commands to a Macro:
qa,qA - Tip 69. Act Upon a Collection of Files:
gg/class<CR>,:argdo,:edit!,:argdo normal @a,:argdo write,:wall,:wnext - Tip 70. Evaluate an Iterator to Number Items in a List:
:let i=0,:echo i,<C-r>=i<CR> - Tip 71. Edit the Contents of a Macro:
~,vU,:put a
- Tip 72. Tune the Case Sensitivity of Search Patterns:
\c,\C - Tip 73. Use the \v Pattern Switch for Regex Searches
- Tip 74. Use the \V Literal Switch for Verbatim Searches
- Tip 75. Use Parentheses to Capture Submatches
- Tip 76. Stake the Boundaries of a Word
- Tip 77. Stake the Boundaries of a Match
- Tip 78. Escape Problem Characters
- Tip 79. Meet the Search Command
- Tip 80. Highlight Search Matches
- Tip 81. Preview the First Match Before Execution
- Tip 82. Count the Matches for the Current Pattern
- Tip 83. Offset the Cursor to the End of a Search Match
- Tip 84. Operate on a Complete Search Match
- Tip 85. Create Complex Patterns by Iterating upon Search History
- Tip 86. Search for the Current Visual Selection
- Tip 87. Meet the Substitute Command
- Tip 88. Find and Replace Every Match in a File
- Tip 89. Eyeball Each Substitution
- Tip 90. Reuse the Last Search Pattern
- Tip 91. Replace with the Contents of a Register
- Tip 92. Repeat the Previous Substitute Command
- Tip 93. Rearrange CSV Fields Using Submatches
- Tip 94. Perform Arithmetic on the Replacement
- Tip 95. Swap Two or More Words
- Tip 96. Find and Replace Across Multiple Files
- Tip 97. Meet the Global Command
- Tip 98. Delete Lines Containing a Pattern
- Tip 99. Collect TODO Items in a Register
- Tip 100. Alphabetize the Properties of Each Rule in a CSS File
- Tip 101. Meet ctags
- Tip 102. Configure Vim to Work with ctags
- Tip 103. Navigate Keyword Definitions with Vim’s Tag Navigation Commands
- Tip 104. Compile Code Without Leaving Vim
- Tip 105. Browse the Quickfix List
- Tip 106. Recall Results from a Previous Quickfix List
- Tip 107. Customize the External Compiler
- Tip 108. Call grep Without Leaving Vim
- Tip 109. Customize the grep Program
- Tip 110. Grep with Vim’s Internal Search Engine
- Tip 111. Meet Vim’s Keyword Autocompletion
- Tip 112. Work with the Autocomplete Pop-Up Menu
- Tip 113. Understand the Source of Keywords
- Tip 114. Autocomplete Words from the Dictionary
- Tip 115. Autocomplete Entire Lines
- Tip 116. Autocomplete Filenames
- Tip 117. Autocomplete with Context Awareness
- Tip 118. Spell Check Your Work
- Tip 119. Use Alternate Spelling Dictionaries
- Tip 120. Add Words to the Spell File
- Tip 121. Fix Spelling Errors from Insert Mode
- 21.1 Keep Practicing!
- 21.2 Make Vim Your Own
- 21.3 Know the Saw, Then Sharpen It