Automatically creates non-existent parent directories when writing a file.
Pure lua. Single file.
:write /foo/bar/file.txt
.bar
directory doesn't exist.bar
directory will be silently created and the write command will succeed.Use your favorite package manager.
lazy.nvim
require("lazy").setup({
"mateuszwieloch/automkdir.nvim"
})
vim-plug
Plug "mateuszwieloch/automkdir.nvim"
++p
flag to :write
, for example :write ++p /path/to/file.txt
. However, that's still some extra keystrokes that I prefer to avoid.