Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a large project, and I have to work in and switch between a few directories often. My solution was to symlink all the files that I want to get to quickly into a sandbox directory.

I just used the command:

mklink sandbox/myfile.py somerealdirectory/myfile.py

I want to simply be able to use vim's

:e myfile

without having to worry about the directory structure.

If I open sandbox/myfile.py in vim, make some edits, and save, the changes propigate as expected.

However, when I try to write a second time, vim complains that the file is readonly, and now it no longer will write to the correct file. It looks like the symlink was destroyed during the writing process.

I've seen some other issues about this, but no satisfactory answers.

share|improve this question
up vote 2 down vote accepted

You shouldn't need to do that kind of horrible hack.

Vim uses a special wildcard for "any subdirectory": **. Supposing your working directory is /path/to/project and you don't have autochdir on, you can list and choose any file containing foo in its filename, wherever it is under the working directory, with:

:e **/foo<Tab>

which would propose:

/path/to/project/dir1/dirb/foo.js
/path/to/project/dir1/dirb/dir5/dirx/barfoo.js
…
share|improve this answer
    
Wow, how useful. Thanks. – Erotemic Apr 14 '13 at 19:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .