Learn Essential Vim Skills
with Drew Neil, author of Practical Vim
External commands
category applies to 2 screencasts and 2 articles:
We can use pandoc as a filter to clean up WYSIWYG-generated HTML. Pandoc is a commandline program, but we can call it from inside Vim either using the bang Ex command, or by configuring the formatprg
option to make the gq
operator invoke pandoc.
The vimgrep
command uses Vim’s native regular expressions to search the contents of multiple files. There are several ways that we can specify the list of files to look inside, including *
and **
wildcards. It would be handy if we could instruct vimgrep
to look inside all of the files in the current project, excluding those listed in the .gitignore
file. That’s where the git ls-files
command comes in.
I love the way that ack let’s me specify the files to search inside. For starters, ack does the right thing by ignoring the contents of VCS directories, backup files, core dumps etc., which gives a good signal to noise ratio. On top of that, ack provides a convenient syntax for specifying filetypes to include or exclude from the set (see ack --help-types
). I can target ruby files only with the --ruby
option, or everything but ruby files with --noruby
.
‘Do one thing and do it well’ is the principle of the Unix toolkit. Editing text is a broad domain, and there are many related tasks with which it overlaps. Vim acknowledges this by enabling certain tasks to be outsourced to external programs which do that one thing, and do it well. This episode will demonstrate how the par program can be used for formatting text.
Watch screencast