Vim auto autocomplete, how do I enter a directory?

When I want to open a file in vim, I enter: e to see the directories on my disk (install wildmenu). Vim shows me the list of directories that I have, then I click the tab several times to select the directory I need, and when I select this directory (vim emphasizes it), what should I do to stop completion at the current level and enter this directory?

I know that in insert input mode it is ctrl-y, from the vim help file:

*complete_CTRL-Y* When the popup menu is displayed you can use CTRL-Y to stop completion and accept the currently selected entry. The CTRL-Y is not inserted. Typing a space, Enter, or some other unprintable character will leave completion mode and insert that typed character." 

how to do it in command mode?

+6
source share
3 answers

I think its ctrl e in command mode

From vim docs ,

  *complete_CTRL-E* 

When the action is completed, you can use CTRL-E to stop it, and return to the original typed text. CTRL-E will not be inserted.

I tried this in my gVim and it works.

EDIT . Thanks to @ Franรงois's suggestion, Ctrl D does the same with some additional information. those. it stops at the current level and also displays the contents of the current selection

Sort of

 :e eclipse-cpp-indigo-SR2-incubation-win32-x86_64\eclipse\ <Ctrl><D> artifacts.xml eclipse.exe epl-v10.html p2\ configuration\ eclipse.ini features\ plugins\ dropins\ eclipsec.exe notice.html readme\ 

It displays content inside the eclipse folder too, except for stopping completion at the eclipse directory level.

+10
source

When you reach the desired directory by pressing the tab key, press the right arrow key (or enter a character and delete it). After this completion, use the directory as the base and iterate through its subdirectories.

For example, you have the following file structure in the current directory:

  - a
 - b
   - c
     - d 

You enter the e command and press the tab key. The first suggested directory is. Press the tab key again to select the next directory - b. And now press the right arrow key. After that directory b is selected and its completion begins.

As I said, you can enter a character and erase it. If you leave a character (or a sequence of characters, such as a prefix), it is used as a filter (selects only those directories whose name begins with a prefix).

I think there are other solutions. But for me itโ€™s enough.

+1
source

Another option: when I want to select and continue, I just enter another "/" and continue the tab. It looks a little ugly in my status bar, but this is one keystroke and I don't need to leave the home bar.

0
source

Source: https://habr.com/ru/post/913595/


All Articles