I’m trying to use vim’s compl-filename
feature (Ctrl-XCtrl-F) to complete paths in INSERT
mode, but I can’t work out how to traverse into directories without (temporarily) ending the completion mode:
Let’s say I want to complete the path /etc/sysconfig/network-scripts/ifup
.
I would like to be able to do something like:
/eCtrl-XCtrl-F /etc/ /etc/sysCtrl-F /etc/sysconfig/ /etc/sysconfig/netCtrl-F /etc/sysconfig/netconsoleCtrl-N /etc/sysconfig/networkCtrl-N /etc/sysconfig/network-scripts/ /etc/sysconfig/network-scripts/ifupCtrl-Y /etc/sysconfig/network-scripts/ifup
The issue is, as soon as I start typing* after a path match (like /etc/
), it ends file name completion. I would like it to stay in file name completion, so that I can still use Ctrl-F, Ctrl-N, etc. Since it ends completion, I have to type Ctrl-XCtrl-F again to restart it, and the helpful completion popup menu disappears in the meantime.
Is there an option I can set to change this?
* By ‘typing’ here, I am referring to characters in 'isfname'
-- of course, typing other characters (like space or punctuation) should not continue file name completion.
I'm not sure exactly what you're saying, but you can just press Ctrl-XCtrl-F again on a directory while you're in the completion menu to expand it. You don't have to close out of the menu first. I just keep Ctrl held down and tap xf
to traverse a directory, n
and p
to move up and down and w
to go back up.
If you don't use :h i_CTRL-F
then you could remap it. For example,
inoremap <C-f> <C-x><C-f>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With