[vim keymap] Eliminate globals/Remove unused function/Add tests