klokop
klokop

Reputation: 2410

How to define a set of CSS class names so Vim knows how to autocomplete

Mostly, I'm very happy the way Vim autocompletes words for me. Currently, I'm working in a HTML/CML/Javascript/CSS framework, that uses a defined set of CSS class names to style an application. Class names like eg

  Framework_Table
  FrameWork_NumberInput
  Framework_TextOutput

which one would use like

  .Framework_Table {}
  .FrameWork_NumberInput {}
  .Framework_TextOutput {}

Question is, how/where do I list these class names to Vim's autocomplete can pick them up?

Upvotes: 1

Views: 261

Answers (1)

romainl
romainl

Reputation: 196576

You can use dictionary-based completion.

  1. Put all your identifiers in a file, say /path/to/project/cssdict.txt.

    Framework_Table
    FrameWork_NumberInput
    Framework_TextOutput
    
  2. In Vim, do :setlocal dictionary=/path/to/project/cssdict.txt.

  3. Hit <C-x><C-k> to complete using that dictionary.

Read :help 'dictionary' and :help compl-dictionary.

Upvotes: 2

Related Questions