diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-10-11 17:17:35 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-10-11 17:17:35 +0900 |
| commit | 21230c82c7e40e04974e93279141cc99ea31a4ea (patch) | |
| tree | bfedc291df31b97e263c047b0495b3f401087b62 /.config/nvim/lua/init/03-autocmds.lua | |
| parent | b07192ea5e86d0ed43252e30ce6de9b390294e77 (diff) | |
| download | dotfiles-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.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 |
