开发者

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 w开发者_运维百科hich 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.


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


This works with plain old vi:

:!mkdir myNewDirectory
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜