Practical Vim: Edit Text at the Speed of Thought

bf-book-cover

Metadata

Authors: Drew Neil Tags: computers general keyboarding pragmatic_bookshelf programming utilities Lists: Currently Reading Book URL: https://reader.bookfusion.com/books/6075758-practical-vim-edit-text-at-the-speed-of-thought?type=epub_reflowable 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—if you master the techniques in this book, you’ll never need another text editor. Practical Vim shows you 120 vim recipes so you can quickly learn the editor’s core functionality and tackle your trickiest editing and writing tasks. Vim, like its classic ancestor vi, is a serious tool for programmers, web developers, and sysadmins. No other text editor comes close to Vim for speed and efficiency; it runs on almost every system imaginable and supports most coding and markup languages. Learn how to edit text the “Vim way:” complete a series of repetitive changes with The Dot Formula, using one keystroke to strike the target, followed by one keystroke to execute the change. Automate complex tasks by recording your keystrokes as a macro. Run the same command on a selection of lines, or a set of files. Discover the “very magic” switch, which makes Vim’s regular expression syntax more like Perl’s. Build complex patterns by iterating on your search history. Search inside multiple files, then run Vim’s substitute command on the result set for a project-wide search and replace. All without installing a single plugin! You’ll learn how to navigate text documents as fast as the eye moves—with only a few keystrokes. Jump from a method call to its definition with a single command. Use Vim’s jumplist, so that you can always follow the breadcrumb trail back to the file you were working on before. Discover a multilingual spell-checker that does what it’s told. Practical Vim will show you new ways to work with Vim more efficiently, whether you’re a beginner or an intermediate Vim user. All this, without having to touch the mouse. What You Need: Vim version 7 Date Added: 2025-05-25 22:35:42 UTC Last Updated: 2025-05-27 19:16:20 UTC Progress: 7.55%


Highlights & Notes

Notation for Simulating Vim on the Page

Practical Vim: Edit Text at the Speed of Thought

Date Created: 2025-05-26 08:20:37 UTC Color: 79cf76 ■

$

Enter the command line in an external shell

View highlight

Practical Vim: Edit Text at the Speed of Thought

Date Created: 2025-05-26 08:18:42 UTC Color: 79cf76 ■

:

Use Command-Line mode to execute an Ex command

/

Use Command-Line mode to perform a forward search

?

Use Command-Line mode to perform a backward search

=

Use Command-Line mode to evaluate a Vim script expression

View highlight

Meet the Dot Command

Practical Vim: Edit Text at the Speed of Thought

Date Created: 2025-05-27 13:03:04 UTC Color: 79cf76 ■

Tip 1 Meet the Dot Command The dot command lets us repeat the last change. It is the most powerful and versatile command in Vim.

View highlight

Practical Vim: Edit Text at the Speed of Thought

Date Created: 2025-05-27 12:57:01 UTC Color: 79cf76 ■

The x command deletes the character under the cursor. When we use the dot command in this context, “repeat last change” tells Vim to delete the character under the cursor:

View highlight

Practical Vim: Edit Text at the Speed of Thought

Date Created: 2025-05-27 12:57:10 UTC Color: 79cf76 ■

The dd command also performs a deletion, but this one acts on the current line as a whole. If we use the dot command after dd, then “repeat last change” instructs Vim to delete the current line:

View highlight

Practical Vim: Edit Text at the Speed of Thought

Date Created: 2025-05-27 13:03:35 UTC Color: 79cf76 ■

>G command increases the indentation from the current line until the end of the file

View highlight

Practical Vim: Edit Text at the Speed of Thought

Date Created: 2025-05-27 13:04:53 UTC Color: 79cf76 ■

The Dot Command Is a Micro Macro

Later, in Chapter 11, ​Macros​, we’ll see that Vim can record any arbitrary number of keystrokes to be played back later. This allows us to capture our most repetitive workflows and replay them at a keystroke. We can think of the dot command as being a miniature macro, or a “micro” if you prefer

View highlight