Vim Kata Meetup
This repo is the supporting content for a Boston Vim meetup held on November 12th, 2012.
The process is pretty simple. Each folder is a single exercise and contains two files; the before file and after file. The suggested approach is:
- Open Vim with an even vertical split before file on left, after file on right.
- Hack on the before file until it matches the after file.
- Try again using a different bit of vim functionality?
Each of the problems can be approached using a number of different Vim features, and as in life there is rarely a single correct answer. Feel free to experiment and try more than one technique to solve a problem. Have a solid handle on search and replace? Try macros. Already mastered macros? Try the global command.
:diffthis command in both buffers) can be a great help to understand
the problem. The following maps can help with activating vimdiff mode. To
enable diff mode just use the
<leader>dt map in both buffers. To disable, use
<leader>do map in either buffer.
nmap <leader>dt :diffthis<cr> nmap <leader>do :diffoff<cr>
These maps have also been provided in a file named "diff_maps.vim" in the root
of this repo for easy sourcing. Simply
:source diff_maps.vim<cr> and you're set.
References & Support
Some sources that make for excellent deliberate Vim practice tools:
- Vimgolf - Vim exercises with before and after text. Goal is to define the shortest sequence of Vim keystrokes that will change the before into the after.
- RubyQuiz - An archive of a weekly coding challenging implimented in Ruby. Still great for practice
- ProjectEuler - A math / logic focused programming challenge site. These ones get very tough very quick.
- General Code Katas - Collection of general code katas from the Pragmatic Programmers.
- VimKata - A Vim plugin based kata that has a sequence of increasingly advanced Vim exercises.
- Gary Bernhardt String Calculator Kata - A short video of Gary Bernhardt performing a string calculator kata using TDD in Vim. Very impressive.