Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When in Vim insert mode, is there a way to add filepath autocompletion?

I write a lot of shell scripts and I am constantly having to enter in filepaths. I am wondering if anyone knows of a way to get Vim to autocomplete filepaths while in insert mode, just like when you are in your favorite shell you tab to complete the path of the directory or file.

Extra credit if you can get CTRLD functionality of the shell into Vim insert mode (i.e. to see what files/directories are in the current path).

like image 765
stephenmm Avatar asked Dec 17 '09 04:12

stephenmm


People also ask

How do I autocomplete in Vim?

to enter the *edit* mode and type any JavaScript keyword in the text editor and press *Ctrl + x* followed by *Ctrl + o*. Vim editor will show the possible auto-complete suggestions.

How do I add a filename to Vim?

It's time to open up the command mode of Vim by pressing the “:” key. Now, press the “w” key from the keyword followed by the space key and the new name of a file. Tap “Enter” to execute this command on Vim. Now, the exact copy of the same file has been created in the home folder with a new filename.


1 Answers

For file name omni completion, you can use:

Ctrl-XCtrl-F

like image 141
Christian C. Salvadó Avatar answered Oct 07 '22 19:10

Christian C. Salvadó