Reply to message «Re: File path completion relative to current file directory», 
sent 19:27:22 15 April 2011, Friday
by Gary Johnson:

> This may not be exactly what you're looking for, but here's what I
> do.
> 
>     :e <C-R>%
> 
> where :e can be any ex command requiring a file name and <C-R> means
> Ctrl-R.  <C-R>% will expand to the current file name.  Then type
> Ctrl-W one or more times to delete the current file name up to the
> directory name.
You can use `%:h<Tab>' instead.

> Then begin typing the name of the desired file and
> file name completion will work.
I guess he wanted insert mode completion as it makes more sense (for example, 
for «#include "..."» preprocesser statement). In this case he has to write 
custom vim function to do completion (:h complete()).

Original message:
> On 2011-04-15, Martin Lundberg wrote:
> > Hi,
> > 
> > Is it possible to make the file path completion relative to the current
> > files directory? I don't want to set autochdir but only want for file
> > path completion.
> 
> This may not be exactly what you're looking for, but here's what I
> do.
> 
>     :e <C-R>%
> 
> where :e can be any ex command requiring a file name and <C-R> means
> Ctrl-R.  <C-R>% will expand to the current file name.  Then type
> Ctrl-W one or more times to delete the current file name up to the
> directory name.  Then begin typing the name of the desired file and
> file name completion will work.
> 
> HTH,
> Gary

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to