While in vim I want to create a new file called blog_spec.rb
inside [working directory]/spec/models/
, but the directory doesn't exist yet?
What's the fastest way to create the directory and start editing the file? Any oneliners?
You can either click the Terminal icon in the Apps menu, or press Ctrl + Alt + T at the same time to open the Terminal. Navigate to the directory you want to create a file in. To do so, type cd followed by the path to the directory you want to create a file in and press Enter..
Press m to bring up the NERDTree Filesystem Menu. This menu allows you to create, rename, and delete files and directories. Type a to add a child node and then simply enter the filename. You're done!
:!mkdir -p spec/models :w spec/models/blog_spec.rb
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With