SirVer/ultisnips — pull request #119 by guns (2013-12-23 22:58:03+00:00)
Title: Evaluate word boundaries with Vim, not r'\b'

Hello,

UltiSnips currently has a hard-coded notion of a word boundary (python's
`r'\b'`), which makes using snippets from languages like Scheme and
Clojure a bit problematic.

e.g.

```
snippet map "map" w
(map ${0:pred} ${1:coll})
endsnippet
```

`-` is a word character in Lisps, so the following should not trigger
the snippet:

```clojure
(hash-map^I)
```

If we use vim's regex engine to do the word matching, we can have
dynamic word character classes per FileType. This is what this patch
implements. I ran the test suite and all tests pass with Vim 7.4.131.

Please let me know if you'd like me to make any amendments.

Cheers!

From the patch header:

Certain non ALGOL-derived languages (notably LISP derivatives) do not
share the alphanumeric + underscore definition of a word character.

Fortunately, each language FileType has its own definition of a word
character, which Vim's regex engine uses when matching against the
boundary classes `\<` and `\>`.

We change the word matching routine of 'w' snippets to use Vim's regex
engine instead of a static pattern.