The dictionary feature in vim allows you to use a file (for instance /usr/share/dict/words) and set multiple paths within the dict option to search on.

Now the file I'm searching on has several words with - in them, and I still wish to match after the - after activating autocomplete, so is there a way to make the - a matched character within the dict feature?

  • 2
    I think that set iskeyword+=- should do what you want. See :h 'iskeyword'. I'm not posting this as an answer because I can't test it right now so let me know if that work?
    – statox
    Commented Jan 30, 2017 at 8:02
  • 1
    @statox I tried it and that did the trick! Thank you!
    – leeand00
    Commented Jan 31, 2017 at 21:09

1 Answer 1


The option iskeyword defines which characters should be considered as part of a word. This option uses the += and -= syntax to add or remove some characters. Thus the following line will add the character - in the option and will allow you to complete words containing a -:

set iskeyword+=-
  • If you want to change iskeyword just for a particular file type (eg CSS and SCSS), run something like: autocmd FileType css,scss setlocal iskeyword+=-
    – Flimm
    Commented Jul 19, 2022 at 9:34
  • @Flimm I would advise to create a custom ftplugin instead (:h ftplugin-overrule) using an autocommand is just reimplementing the ftplugin mechanism.
    – statox
    Commented Jul 19, 2022 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.