How to create a directory using nerdtree

VimNerdtree

Vim Problem Overview


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.

Vim Solutions


Solution 1 - Vim

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.

Solution 2 - Vim

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/

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNick VanderbiltView Question on Stackoverflow
Solution 1 - VimhousetierView Answer on Stackoverflow
Solution 2 - VimmrdedView Answer on Stackoverflow