Step 2 of 7

Completion

Completion

The feature you’ll meet most often is completion. In insert mode, once you’ve typed a couple of characters of a word, Helix pauses for a moment and asks the server what could come next. The answers appear in a popup at the cursor:

  • Tab highlights the first entry and moves on through the list; Shift-Tab goes back (Ctrl-n and Ctrl-p do the same)
  • Enter accepts the highlighted entry — with nothing highlighted it just starts a new line, so Tab first
  • Escape closes the popup and keeps what you typed

Ctrl-x asks for the popup by hand when it hasn’t appeared yet. A real server proposes what makes sense at that point in the code — a method of the value you’re on, a parameter name; this one proposes every word in the file, with the functions marked as such.

Add a second call in main below: start a new line under greet("helix"), type the first three letters, and take greet from the popup — Tab, then Enter — before typing the rest of the call.

  1. Open a line under greet("helix") and type gre 8gg then o starts an indented line below; three letters are enough for the popup.
  2. Accept greet from the popup, then finish the call as greet("world") Tab highlights greet, Enter takes it. Type the rest, then Escape.
Open a line under greet("helix") and type gre 8gg then o starts an indented line below; three letters are enough for the popup.

Next: Accept greet from the popup, then finish the call as greet("world")

Loading editor…