1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-07 09:08:01 +00:00

Add Creating Non-Existent Directories as a vim til.

This commit is contained in:
jbranchaud
2015-11-23 21:20:44 -06:00
parent 9768099da3
commit 2944ec0792
2 changed files with 13 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
# Creating Non-Existent Directories
When creating new files from withing vim, using `:e`, you may find yourself
creating that file in a directory that doesn't yet exist. Vim will tell you
as much if you then try to save that file. To get around this, I have often
shelled out with `:!mkdir %:h`. This is a bit awkward to type though.
The [`vim-eunuch`](https://github.com/tpope/vim-eunuch) plugin comes with a
handy command for this. `:Mkdir` will create the parent directory for the
current buffer. If you're in a situation where multiple levels of the
buffer's directory don't exist, you can use `:Mkdir!` which will invoke
`mkdir` with the `-p` flag.