How to create a directory using nerdtree
Asked Answered
I

2

160

I have been using NERDTree for a while. Every time I need to create a new directory I need to go to terminal. Is there a quick and easy way to create a directory using NERDTree.

I read the doc but could not find anything.

Infare answered 22/5, 2010 at 17:5 Comment(3)
This might belong in Super User.Rowel
I wouldn't move it to Super User. Sysadmins use Vim, but developers who use Vim live in it all day; I'd venture it's more applicable to devs. If there were a way to link/clone it, that'd be a good choice.Lindsy
The relevant lines in the doc is very inconspicuous. It is in the 'NERDTreeMenu' section.Hominoid
C
265

When in the NERDTree window, press 'm'; you should see a menu at the bottom. Type in 'a' for add childnode. Now input the directory you want to create, making sure to add a '/' at the end, otherwise the script would create a file.

AFAIK NERDTree cannot create parent directories like 'mkdir -p' does.

Capitation answered 22/5, 2010 at 21:59 Comment(5)
when type a I get an error Error detected while processing function <SNR>_15_showMenu..... . Culprit could be some other plugin. I will debug it later. thanks.Infare
i use mkdir but nodetree filesystem structire does not refresh automaticallySerotine
What's more ,you should put the nerdtree_plugin dir(which is in your download package) into the .vim dir ,or when you press 'm' there would be an error happen. Thanks for Housetier's answerIdleman
@Serotine you should go back to nerdtree, and press RDagall
Now NERDTree can create parent directories.Jankell
N
17

Pressing m would open a menu below and you can select from a list of actions.

NERDTree Menu. Use j/k/enter and the shortcuts indicated
==========================================================
> (a)dd a childnode
  (m)ove the current node
  (d)elete the current node
  (r)eveal in Finder the current node
  (o)pen the current node with system editor
  (q)uicklook the current node
  (c)opy the current node
Add a childnode
==========================================================
Enter the dir/file name to be created. Dirs end with a '/'
/Library/WebServer/Documents/new-teacher-center/app/Model/

Pressing a would let you add a childnode. A childnode can be a file or folder depending if you add a forward slash ( / ) or not.

If you don’t add a forward slash like below, it would create a file.

Add a childnode
==========================================================
Enter the dir/file name to be created. Dirs end with a '/'
/Library/WebServer/Documents/new-project/app/Model/file

If you add a forward slash like below, it would create a folder.

Add a childnode
==========================================================
Enter the dir/file name to be created. Dirs end with a '/'
/Library/WebServer/Documents/new-project/app/Model/folder/
Nefen answered 1/8, 2017 at 9:36 Comment(1)
This is the correct, more up-to-date answer. Its not a very well, or very obvious option in the menu, but this handles it. Otherwise :!mkdir -p path/to/dest.Jimmiejimmy

© 2022 - 2024 — McMap. All rights reserved.