1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

use lua for may_create_dir

This commit is contained in:
jdhao
2022-01-13 20:27:48 +08:00
parent 6fd7155787
commit 146ef5d0b8
3 changed files with 11 additions and 10 deletions

View File

@@ -14,4 +14,14 @@ function M.executable(name)
return false
end
function M.may_create_dir()
local fpath = vim.fn.expand('<afile>')
local parent_dir = vim.fn.fnamemodify(fpath, ":p:h")
local res = vim.fn.isdirectory(parent_dir)
if res == 0 then
vim.fn.mkdir(parent_dir, 'p')
end
end
return M