-- Stolen from https://github.com/jghauser/mkdir.nvim local auto = require 'std.auto' local mkdir = function () local dir = vim.fn.expand ':p:h' -- This handles URLs using netrw. See ':help netrw-transparent' for details. if dir:find '%l+://' == 1 then return end if vim.fn.isdirectory( dir ) == 0 then vim.fn.mkdir( dir, 'p' ) end end auto 'mkdir_buffer' { description = 'Mkdir for current buffer, if it does not exist.', events = 'BufWritePre', pattern = '*', command = mkdir, }