tags:

views:

37

answers:

2

I have following setting which lets me easily create a new file from the currently open file

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

Is there something similar which would let me create a directory from the current directory.

Otherwise what are the other tricks you are using to create a directory and then create a file there.

+1  A: 

This works with plain old vi:

:!mkdir myNewDirectory
mouviciel
You don't have to shell-escape the mkdir; vim has an internal mkdir function.
Jefromi
+2  A: 

Vim does have a mkdir function. It's probably up to you to decide how exactly to use it, since it depends on your use case, but you can do things like this:

function MkdirTabe(path) {
    mkdir(expand(path . ":p:h"))
    tabe(path)
}
Jefromi