Wednesday, February 25, 2015

Re: what does iskeyword option do?

On 2015-02-25 08:02, FlashBurn wrote:
> I'm trying to understand the meaning of 'iskeyword' option but I
> can't figure out from the help what it does. Any help in finding
> out of the meaning of this option is greatly appreciated.

'isk' contains a list of characters (or character-ranges) for those
characters that should be considered a "word". This comes into play
when using "\<", "\>", "\k" and "\K" in a regular expression; what
gets considered when you use "*" and "#" to search; what the "iw" and
"aw" text-objects select; what's considered a "w"ord motion; how
abbreviations are found; and plenty of other places.

For example, by default "-" isn't part of the 'isk' setting, but if
you wanted "vip" to highlight/select whole CSS selectors like
"background-color"

:set isk+=-

to add the dash. Now, if you do "viw" anywhere in the attribute,
it will highlight/select the entire "background-color" not just
"background" or "color".

It's a little tricky to add certain characters as they have special
meaning. The easiest way I've found is to make a range of length one
for "@":

:set isk+=@-@ " add an at-sign, good for email addresses
" and Python decorators

-tim




--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: