marijnh/CodeMirror — pull request #965 by mattsacks (2012-11-12 22:49:45+00:00)
Title: Add support for text-objects ' and " for vim

The text-object list included `(`, `[`, and `{` before, but not `'` and `"`. This pull adds support for quote-objects.

The function `findMatchedSymbol` is currently written in such a way that it always expects some reverse symbol different from itself, so adding support for matching identical symbols was difficult enough that I created a new function, `findBeginningAndEnd` (there's probably a better name for it).

All it does it take in a CodeMirror instance and a symbol to match on the current cursor's line, returning the object used by `textObjectManipulation`. Currently it doesn't support matching multiple lines and has the small issue of going into insert mode using `c-{motion}` even if there's no match. It also has the third argument (a boolean) to match the symbol as well, rather than just inside of it.

I've done basic testing on it, seems to work pretty well for most cases but could definitely get some other opinions on how it matches up against the original.