diff options
| -rw-r--r-- | .config/nvim/lua/init/03-autocmds.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/.config/nvim/lua/init/03-autocmds.lua b/.config/nvim/lua/init/03-autocmds.lua index e3505cf..b8e53ec 100644 --- a/.config/nvim/lua/init/03-autocmds.lua +++ b/.config/nvim/lua/init/03-autocmds.lua @@ -39,6 +39,13 @@ A('BufRead', { -- License: NYSL A('BufWritePre', { callback = function() + -- Don't create directory for ephemeral buffers. + -- See :help 'bufhidden' + local bufhidden = vim.bo.bufhidden + if bufhidden == 'unload' or bufhidden == 'delete' or bufhidden == 'wipe' then + return + end + local dir = F.expand('<afile>:p:h') if F.isdirectory(dir) ~= 0 then return |
