Nick Vanderbilt
Nick Vanderbilt

Reputation: 38450

creating a new dirctory in vim

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.

Upvotes: 0

Views: 108

Answers (2)

Cascabel
Cascabel

Reputation: 496902

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)
}

Upvotes: 2

mouviciel
mouviciel

Reputation: 67829

This works with plain old vi:

:!mkdir myNewDirectory

Upvotes: 1

Related Questions