vimautocompleteneovim

Neovim - How to select autocomplete option in :e command without opening it?


Suppose I have a path dir1/myfile.txt and want to use :e command for open myfile.txt.

When I type :e and press tab I have dir1 in autocomplete list and when I hit enter, directory file is opened.

How to insert dir1 in the path using autocomplete without opening it?


Solution

  • To insert dir1 in the path using autocomplete without immediately opening it, you can use the following method in Neovim:

    1. Type :e followed by the initial part of the path (e.g., dir).
    2. Press Tab to autocomplete to dir1.
    3. Instead of pressing Enter (which would open the directory), press Ctrl + D to list all possible completions.
    4. Continue typing the path or use Tab again to further autocomplete.
    5. When the full path is typed out, press Enter to open the file.

    This approach allows you to utilize autocomplete without immediately executing the command.