Built-in autocomplete

Vim supports native autocomplete based on words available in open buffers. It's available out of the box starting with Vim 7.0. Start by typing the beginning of a function name and hit Ctrl + n to bring up the autocomplete list. You can navigate the list using Ctrl + n and Ctrl + p. For example, open animal_farm.py, enter insert mode, and start typing the first two letters of a function name: ma (make_animal). Press Ctrl + n. This will bring up a list of available options:

Continue typing to dismiss the list.

In fact, Vim has an insert-completion mode, which supports multiple completion types. Press Ctrl + followed by one of the following keys:

  • Ctrl + l to complete the whole line
  • Ctrl + ] to complete tags
  • Ctrl + to complete filenames
  • s to complete spelling suggestions (if :set spell is enabled)
These are the commands I found useful in the past, but there are more! Read :help ins-completion for a full list of supported commands—everyone's workflow is unique, and you never know which commands you'll find yourself utilizing a lot. You should also check :help 'complete', which is an option that controls where Vim looks for completion (by default, Vim looks in buffers, tag files, and headers).
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.143.239