RetroCode UK

Published Date May 12, 2018 Reading Time ~1 minutes RSS Feed Vim Linux

Vim Autocompletion

IMPORTANT: This content is over 1 year old, and may now be obsolete, irrelevant and/or no longer accurate.

Vim has some really handy features that aren’t immediately apparent.

Autocompleting file paths

One of these is the ability to autocomplete / navigate paths - type all of the following keys while holding Control:

  • x then f: bring up the first file or path found
  • n: select the next entry
  • p: select the previous entry
  • Repeat x then f to recurse into the selected path
  • Press w to go back up a level


Autocompleting variables

You can also autocomplete a word that’s contained in the current file. This can be useful for method or variable autocompletion while programming.

To show a list of autocomplete options simply press Control + p or Control + n as with the file paths to select the previous or next match.