Many VIM users depend on NERDTree plugin to browse directory but rare use it to create a new file on without leaving Vim (at least I was one such Vim user).
I found nice blog entry which told me how to do so - Link here
To summarize -
- Open NERDTree panel
- Navigate to the directory where you want to create new file or directory.
m- which opens up NERDTree Filesystem Menu.
ato create the child node and type the name of file or directory. For directory append
/at the end.
- That's it.
While I was experimenting on the steps above I made a silly mistake. I didn't open the newly created file before typing my experiment with NERDTree. So I typed my content in an un-named buffer. To wiggle out, I decided to rely on VIM help. This is what I did -
:h save- this opened up the help window with VIM
saveascommand in VIM helps us same the current buffer into a file.
!option to save to an existing file.
- I will let the reader experiment with this with their own hands-on exercise.