diff options
| author | jdhao <jdhao@hotmail.com> | 2022-08-20 00:52:33 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-20 00:52:33 -0500 |
| commit | fdf8236fc26a20498b4b342cfc742c8482d95731 (patch) | |
| tree | 275d40b627bf60635f9f912ec34de3b5e2adf5c9 /lua/utils.lua | |
| parent | efa7b215e7010de3d1d03cc3e4adbc5ca89f3b26 (diff) | |
| parent | 085c8017d8ed3c83d1f61306d6b42f460d2857bc (diff) | |
Merge pull request #69 from jdhao/fix-autocmd
update the autocmd for saving a file
Diffstat (limited to 'lua/utils.lua')
| -rw-r--r-- | lua/utils.lua | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lua/utils.lua b/lua/utils.lua index ae9e0e9..3312479 100644 --- a/lua/utils.lua +++ b/lua/utils.lua @@ -15,13 +15,12 @@ function M.executable(name) return false end -function M.may_create_dir() - local fpath = fn.expand('<afile>') - local parent_dir = fn.fnamemodify(fpath, ":p:h") - local res = fn.isdirectory(parent_dir) +--- Create a dir if if does not exist +function M.may_create_dir(dir) + local res = fn.isdirectory(dir) if res == 0 then - fn.mkdir(parent_dir, 'p') + fn.mkdir(dir, 'p') end end |
