Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim's Ctrl+P autocomplete for identifiers with dash '-'

In Lispy code there can be identifiers with dash signs instead of underscores, like that:

(defn create-something ...)
(defn create-anything ...)
(defn create-nothing ...)

If type crea^P, Vim shows just "create" as completing result. How to make it interpret '-' as part of identifier and offer the whole identifiers for completion?

like image 334
Vi. Avatar asked May 28 '12 19:05

Vi.


1 Answers

For those (like me) who ended up here more for CSS than lisp, the accepted (and correct!) answer may not be appropriate for you. Using set lisp also changes other things (like indentation).

A less intrusive method is to add the hyphen to your iskeyword, something like this:

:set iskeyword+=\-

See help iskeyword as @romainl suggested.

like image 143
Payton Swick Avatar answered Sep 20 '22 22:09

Payton Swick