Refactor plugin

* Use better and more consitent variable names
* Extract local functions to simplify logic
* Make non-public functions local
* Add rake task for running tests
It accesses the `%` register which contains the current file path. Maybe extract into a `s:CurrentFilePath` function for clarity?