Vim :e starting directory?

vim

Solution

There's a lot of reasons not to like autochdir as it messes up some plugins and if you end up doing :e ../../../foo.txt you are not gaining anything. Just as an idea try this cmap I knocked up

:cnoremap red edit <c-r>=expand("%:h")<cr>/

then you can type :red and get

:e /the/path/to/your/current/files/dir/

(edit: perhaps use z instead of red as there are commands that start with red)

To expand the topic, also check out the FuzzyFinder plugin and some custom mappings to rapidly jump to common files you are always editing. Eg

10 or so of your regular files should be no more than 2 keystrokes away. It helps if they are systematically named

Here's an idea I use for django.

http://code.djangoproject.com/wiki/UsingVimWithDjango#Mappings

Problem

I code in Vim, not an IDE. My source code is often nested 2-3 directories deep. ``` ~/foo$ find xyz bar/abc bar/def ~/foo$ vim // inside of vim :e bar/abc ... some work ... :e <-- is there a way I can have this :e start in ~/foo/bar instead of ~/foo ? ``` Basically, I want :e to start the directory in "pathname of last edited file" Thanks!

Original source