[vim] cursor clips, fix #1084

my try at a fix. unlike @metatheos, instead of keeping track of `vim.head`, i peek at the current mode

some notes / thoughts:
the mode should probably be a string instead of the now 3 bools
similarly, instead of defining a new bool for each keymap w/ an init function, keymaps should have optional callbacks
i had to modify codemirror's `historyChangeFromChange`, as modifying the cursor in the `beforeSelectionChange` callback caused an issue where undoing a deletion would delete a character to the left of the cursor

@mightyguava