Last Updated: February 25, 2016
·
909
· dmichaelavila

Vim Edit File From Current Directory

Anywhere that vim asks you to select a file you can first press CTRL-p (aka ^p). This will automatically add the current files directory to start off with.

For instance, open vim, run :e, then strike the ^p combo.

If you wanted to map this functionality to access it more easily you can add the following to your vimrc:

map :E :e <C-R>=expand("%:p:h") . "/" <CR>

Full Disclosure I learned the ^p stuff from @Effektz (on twitter)