Learn Essential Vim Skills
with Drew Neil, author of Practical Vim
For the VimGolf challenge “List the first 100 prime numbers”, there’s a solution that uses a regular expression to detect prime numbers. At 43 keystokes, it’s not the winning solution, but I think it’s the most interesting one. It uses a few clever Vim tricks, including macros, control-a to increment, the very magic pattern switch, and the :global
command. There’s a lot to learn from those 43 keystrokes, so let’s study it!
Git provides tools for searching the contents of files, commit messages, and even whether text was added or removed by a commit. In this episode, we’ll see how fugitive’s Ggrep
and Glog
commands wrap this functionality up so that we can search the contents and history of a git repo from right inside of Vim.
This is the last of our five part series on fugitive.vim.
Watch screencastWith the fugitive plugin, you’re not limited to just working with files in your working tree. The :Gedit
command allows you to open files in other branches, and to browse any git object, including tags, commits and trees. Plus, if your repository is hosted on github, you can easily bring up the webpage for any git object using the :Gbrowse
command.
This is the penultimate of a five part series on fugitive.vim.
Watch screencastWhen git branches are merged, there is always the chance of a conflict arising if a file was modified in both the target and merge branches. You can resolve merge conflicts using a combination of fugitive’s :Gdiff
command, and Vim’s built in diffget
and diffput
. In this episode, we’ll find out how.
This is the third in a five part series on fugitive.vim.
Watch screencastThe fugitive plugin provides an interactive status window, where you can easily stage and review your changes for the next commit. The :Gdiff
command visualizes the changes made to a file, by comparing the working copy with the index. In this episode, we’ll learn how to stage hunks of changes to the index without using the git add --patch
command.
This is the second of a five part series on fugitive.vim. In the next episode, we’ll learn how to resolve a git merge conflict by performing a 3-way vimdiff.
Watch screencastThe fugitive plugin, by Tim Pope, is a git wrapper for Vim. It complements the command line interface to git, but doesn’t aim to replace it. In this episode, we’ll see how some of fugitive’s commands can streamline your workflow.
This is the first of a five part series on fugitive.
Watch screencastThe undo command is almost universally available in software today. Being able to rollback unwanted changes can be a real timesaver. In most applications you can only go backwards and forwards linearly, but Vim keeps your changes in a tree structure, which means that you can retrieve edits from distant branches in your history. This episode will show you how.
Watch screencastThere are times when you can improve the readability of your code by lining up the elements on neighbouring lines. In this episode, I demonstrate how this can be achieved using the Tabular plugin.
Watch screencastWhen you need to build a complex command, or devise a non-trivial search pattern, Vim’s command-line mode can be rather limiting. In this episode, I will introduce the command-line window, which allows you to use the full power of Vim when editing search queries and commands.
Watch screencastIf you use Vim on muliple machines, it can be difficult to keep your configuration files synchronized across them. One solution is to put your dotfiles under version control. In this episode, I demonstrate how to keep your vimrc and plugins synchronized using git submodules and the pathogen plugin.
Watch screencast