fix(autocmds): don't auto create dirs for urls. Fixes #583

This commit is contained in:
Folke Lemaitre
2023-04-16 07:53:42 +02:00
parent 1c06aa35ee
commit 7476da7811

View File

@ -72,6 +72,9 @@ vim.api.nvim_create_autocmd("FileType", {
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
group = augroup("auto_create_dir"),
callback = function(event)
if event.match:match("^%w%w+://") then
return
end
local file = vim.loop.fs_realpath(event.match) or event.match
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
end,