aboutsummaryrefslogtreecommitdiffhomepage
path: root/.config/nvim/lua/init/03-autocmds.lua
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-10-11 17:17:35 +0900
committernsfisis <nsfisis@gmail.com>2025-10-11 17:17:35 +0900
commit21230c82c7e40e04974e93279141cc99ea31a4ea (patch)
treebfedc291df31b97e263c047b0495b3f401087b62 /.config/nvim/lua/init/03-autocmds.lua
parentb07192ea5e86d0ed43252e30ce6de9b390294e77 (diff)
downloaddotfiles-21230c82c7e40e04974e93279141cc99ea31a4ea.tar.gz
dotfiles-21230c82c7e40e04974e93279141cc99ea31a4ea.tar.zst
dotfiles-21230c82c7e40e04974e93279141cc99ea31a4ea.zip
nvim: suppress auto-creation of directory for ephemeral buffers
Diffstat (limited to '.config/nvim/lua/init/03-autocmds.lua')
-rw-r--r--.config/nvim/lua/init/03-autocmds.lua7
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