We have rather complex file structure and I would like simplify opening file independently where am I in the filesystem at the moment.
Let's say we have a
project_folder and several files in it:
/project_folder/common-prefix/foo.txt /project_folder/common-prefix/bar.txt /project_folder/common-prefix/nested/zoo.txt
Usually I change to
project_folder/common-prefix and work from it. Some command and documentation usually expose full relative project path, e.g.
In this case I have to manually remove
common-prefix to modify interested file. How can I configure vim so that opening a file it's file name would be processed and known prefixes would be removed/replaced?
$ cd /project_folder/common-prefix/ $ vim foo.txt # this works naturally $ vim common-prefix/foo.txt # here I want to cut `common-prefix` $ vim ../common-prefix/foo.txt # probably I want to convert to absolute path, but this is a corner case
I read about
includeexpr, but it seems it olny works for
gf commands, whereas I want something like
I found similar questions:
- Modify the path of a file be opened
- How to edit file name under cursor in Vim/Gvim, when it starts with /cygdrive/ in Windows
And also two plugins, which probably close to the implementation I want: