mssch
mssch

Reputation: 154

using :find or gf on a file with wrong absolute path

Is it possible to perform a kind of temporary chroot in vim in order to use :find or gf on a file with an absolute path ?

e.g, a real world example which prompted me with this question: on an ubuntu system, the file /usr/share/initramfs-tools/init sources the functions file located at /usr/share/initramfs-tools/scripts/functions as such:

. /scripts/functions

How could I jump (using gf) to the functions file while editing init file?

Upvotes: 2

Views: 148

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172520

I would use the visual mode variant of gf, and select the correct relative path scripts/functions (e.g. with wviWol). Then, you only need to :cd to the right root dir, and everything should work out fine.

Upvotes: 1

Related Questions