O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Practical Vim, 2nd Edition

Book Description

Vim is a fast and efficient text editor that will make you a faster and more efficient developer. It's available on almost every OS, and if you master the techniques in this book, you'll never need another text editor. In more than 120 Vim tips, you'll quickly learn the editor's core functionality and tackle your trickiest editing and writing tasks. This beloved bestseller has been revised and updated to Vim 7.4 and includes three brand-new tips and five fully revised tips.

Table of Contents

  1. Practical Vim, Second Edition
    1. For the Best Reading Experience...
    2. Table of Contents
    3. What readers are saying about Practical Vim
    4. Acknowledgments
    5. Foreword to the First Edition
    6. Read Me
      1. How This Book Is Structured
      2. A Note on the Examples
      3. Learn to Touch Type, Then Learn Vim
    7. Read the Forgotten Manual
      1. Get to Know Vim’s Built-in Documentation
      2. Notation for Simulating Vim on the Page
      3. Downloading the Examples
      4. Use Vim’s Factory Settings
      5. On the Role of Vim Script
      6. On Vim Versions
    8. Chapter 1: The Vim Way
    9. Meet the Dot Command
    10. Don’t Repeat Yourself
    11. Take One Step Back, Then Three Forward
    12. Act, Repeat, Reverse
    13. Find and Replace by Hand
    14. Meet the Dot Formula
    15. Part 1: Modes
      1. Chapter 2: Normal Mode
      2. Pause with Your Brush Off the Page
      3. Chunk Your Undos
      4. Compose Repeatable Changes
      5. Use Counts to Do Simple Arithmetic
      6. Don’t Count If You Can Repeat
      7. Combine and Conquer
      8. Chapter 3: Insert Mode
      9. Make Corrections Instantly from Insert Mode
      10. Get Back to Normal Mode
      11. Paste from a Register Without Leaving Insert Mode
      12. Do Back-of-the-Envelope Calculations in Place
      13. Insert Unusual Characters by Character Code
      14. Insert Unusual Characters by Digraph
      15. Overwrite Existing Text with Replace Mode
      16. Chapter 4: Visual Mode
      17. Grok Visual Mode
      18. Define a Visual Selection
      19. Repeat Line-Wise Visual Commands
      20. Prefer Operators to Visual Commands Where Possible
      21. Edit Tabular Data with Visual-Block Mode
      22. Change Columns of Text
      23. Append After a Ragged Visual Block
      24. Chapter 5: Command-Line Mode
      25. Meet Vim’s Command Line
      26. Execute a Command on One or More Consecutive Lines
      27. Duplicate or Move Lines Using ‘:t’ and ‘:m’ Commands
      28. Run Normal Mode Commands Across a Range
      29. Repeat the Last Ex Command
      30. Tab-Complete Your Ex Commands
      31. Insert the Current Word at the Command Prompt
      32. Recall Commands from History
      33. Run Commands in the Shell
      34. Run Multiple Ex Commands as a Batch
    16. Part 2: Files
      1. Chapter 6: Manage Multiple Files
      2. Track Open Files with the Buffer List
      3. Group Buffers into a Collection with the Argument List
      4. Manage Hidden Files
      5. Divide Your Workspace into Split Windows
      6. Organize Your Window Layouts with Tab Pages
      7. Chapter 7: Open Files and Save Them to Disk
      8. Open a File by Its Filepath Using ‘:edit’
      9. Open a File by Its Filename Using ‘:find’
      10. Explore the File System with netrw
      11. Save Files to Nonexistent Directories
      12. Save a File as the Super User
    17. Part 3: Getting Around Faster
      1. Chapter 8: Navigate Inside Files with Motions
      2. Keep Your Fingers on the Home Row
      3. Distinguish Between Real Lines and Display Lines
      4. Move Word-Wise
      5. Find by Character
      6. Search to Navigate
      7. Trace Your Selection with Precision Text Objects
      8. Delete Around, or Change Inside
      9. Mark Your Place and Snap Back to It
      10. Jump Between Matching Parentheses
      11. Chapter 9: Navigate Between Files with Jumps
      12. Traverse the Jump List
      13. Traverse the Change List
      14. Jump to the Filename Under the Cursor
      15. Snap Between Files Using Global Marks
    18. Part 4: Registers
      1. Chapter 10: Copy and Paste
      2. Delete, Yank, and Put with Vim’s Unnamed Register
      3. Grok Vim’s Registers
      4. Replace a Visual Selection with a Register
      5. Paste from a Register
      6. Interact with the System Clipboard
      7. Chapter 11: Macros
      8. Record and Execute a Macro
      9. Normalize, Strike, Abort
      10. Play Back with a Count
      11. Repeat a Change on Contiguous Lines
      12. Append Commands to a Macro
      13. Act Upon a Collection of Files
      14. Evaluate an Iterator to Number Items in a List
      15. Edit the Contents of a Macro
    19. Part 5: Patterns
      1. Chapter 12: Matching Patterns and Literals
      2. Tune the Case Sensitivity of Search Patterns
      3. Use the \v Pattern Switch for Regex Searches
      4. Use the \V Literal Switch for Verbatim Searches
      5. Use Parentheses to Capture Submatches
      6. Stake the Boundaries of a Word
      7. Stake the Boundaries of a Match
      8. Escape Problem Characters
      9. Chapter 13: Search
      10. Meet the Search Command
      11. Highlight Search Matches
      12. Preview the First Match Before Execution
      13. Offset the Cursor to the End of a Search Match
      14. Operate on a Complete Search Match
      15. Create Complex Patterns by Iterating upon Search History
      16. Count the Matches for the Current Pattern
      17. Search for the Current Visual Selection
      18. Chapter 14: Substitution
      19. Meet the Substitute Command
      20. Find and Replace Every Match in a File
      21. Eyeball Each Substitution
      22. Reuse the Last Search Pattern
      23. Replace with the Contents of a Register
      24. Repeat the Previous Substitute Command
      25. Rearrange CSV Fields Using Submatches
      26. Perform Arithmetic on the Replacement
      27. Swap Two or More Words
      28. Find and Replace Across Multiple Files
      29. Chapter 15: Global Commands
      30. Meet the Global Command
      31. Delete Lines Containing a Pattern
      32. Collect TODO Items in a Register
      33. Alphabetize the Properties of Each Rule in a CSS File
    20. Part 6: Tools
      1. Chapter 16: Index and Navigate Source Code with ctags
      2. Meet ctags
      3. Configure Vim to Work with ctags
      4. Navigate Keyword Definitions with Vim’s Tag Navigation Commands
      5. Chapter 17: Compile Code and Navigate Errors with the Quickfix List
      6. Compile Code Without Leaving Vim
      7. Browse the Quickfix List
      8. Recall Results from a Previous Quickfix List
      9. Customize the External Compiler
      10. Chapter 18: Search Project-Wide with grep, vimgrep, and Others
      11. Call grep Without Leaving Vim
      12. Customize the grep Program
      13. Grep with Vim’s Internal Search Engine
      14. Chapter 19: Dial X for Autocompletion
      15. Meet Vim’s Keyword Autocompletion
      16. Work with the Autocomplete Pop-Up Menu
      17. Understand the Source of Keywords
      18. Autocomplete Words from the Dictionary
      19. Autocomplete Entire Lines
      20. Autocomplete Sequences of Words
      21. Autocomplete Filenames
      22. Autocomplete with Context Awareness
      23. Chapter 20: Find and Fix Typos with Vim’s Spell Checker
      24. Spell Check Your Work
      25. Use Alternate Spelling Dictionaries
      26. Add Words to the Spell File
      27. Fix Spelling Errors from Insert Mode
    21. Chapter 21: Now What?
      1. Keep Practicing!
      2. Make Vim Your Own
      3. Know the Saw, Then Sharpen It
    22. Appendix 1: Customize Vim to Suit Your Preferences
      1. Change Vim’s Settings on the Fly
      2. Save Your Configuration in a vimrc File
      3. Apply Customizations to Certain Types of Files
      4. You May Be Interested I n…