tmsvg / pear-tree

A Vim auto-pair plugin that supports multi-character pairs, intelligent matching, and more
MIT License
392 stars 12 forks source link

Support for VimL quotes #3

Closed ELLIOTTCABLE closed 5 years ago

ELLIOTTCABLE commented 5 years ago

At the moment, pear-tree makes writing VimL really annoying — it tries to pair the initial quote of a Vim comment. Some sort of heuristic may be a good plan here!

tmsvg commented 5 years ago

I've been a little hesitant to fix this because I'm not crazy about having filetype-specific criteria in the main pairing functions. However, I think Vim's unfortunate comment prefix makes this necessary. Right now I think I will make it so that " is matched unless:

  1. The cursor is on an empty line, or

  2. The cursor follows more than one whitespace character.

This would handle end-of-line comments so long as the user precedes them with multiple spaces, and would still auto-pair " for most cases where it is intended as a string delimiter.

I've also considered simply disabling " matching in Vim files entirely via a ftplugin, but this might not be ideal from a user perspective. Feedback is welcome.