hoschi / yode-nvim

Yode plugin for NeoVim
MIT License
371 stars 3 forks source link

Close all acwrite buffers on vim exit #7

Closed timtyrrell closed 2 years ago

timtyrrell commented 2 years ago

Restoring a session will restore the acwrite buffers in a non-awesome way. Is there a recommended method or a command that I can run to close all the buftype acwrite buffers when I exit vim or can one be added?

EDIT: Using https://github.com/kazhala/close-buffers.nvim I am able to run :BDelete glob=yode* and they all get closed. Although, when I create an autocmd using the same command I am getting some errors. I tried a few of the exit and leave events and seemed to get the same error each time. Any thoughts on it?

autocmd ExitPre * :BDelete glob=yode*

Screen Shot 2022-02-12 at 2 28 12 PM
timtyrrell commented 2 years ago

I was able to add that to a pre_save_cmds in my session plugin, I am good.

hoschi commented 2 years ago

Saving and loading sessions is something I haven't implemented for floating windows and seditors yet, unfortunately.

hoschi commented 2 years ago

@timtyrrell Could you please post your fix in #2, for the other users?

timtyrrell commented 2 years ago

@hoschi Sorry I didn't post earlier because I leverage plugins for the workflow, so it is surely not a solution for the masses but works for me. The main part is the close-buffers glob feature and then having the session plugin use the pre-save callback to run the command:

call plug#begin('~/.config/nvim/plugged')

Plug 'nvim-lua/plenary.nvim'
Plug 'hoschi/yode-nvim'
Plug 'kazhala/close-buffers.nvim'
Plug 'rmagatti/auto-session'

call plug#end()

lua << EOF

require('yode-nvim').setup {}
require('auto-session').setup {
  pre_save_cmds = {"BDelete glob=yode*"}
}

EOF