I'd like to automatically save buffer after moving into another split.
If you're interested why I'm interested in that read section below.
I've started using vim and then neovim not so long ago, so I'm still figuring stuff out. I've noticed a particular pattern in my workflow. I'm splitting terminal (for now I'm using tmux for splits, but I've used iterm2 and terminator for that previously) and one part of the screen is vim and other part is shell where I'm doing something, like running tests, REPL or debugging.
I don't want save files manually before running tests or debugging every time, so I've used
augroup focus
au!
au TabLeave * silent! wall
au FocusLost * silent! wall
augroup END
set autowriteall
And a plugin so that focus related events would work with tmux. So If I use tmux everything works smoothly here for me, but I don't like that I need to memorize another set of keybindings that basically doing the same thing. Like splitting windows, creating windows etc. So I thought, why not just use neovim terminal emulator. It works well for me, but one thing is missing, when I'm invoking terminal in split my buffer isn't saved.
Maybe the right way to do it is just configure tmux somehow to replicate all vim keybindings (It has nice features like persistent sessions and stuff), but for now I'd like to use neovim emulator if possible.
BufLeave
do the trick? It is triggered before leaving to another buffer, so I guess it would be triggered before switching to the terminal, right? I don't use neovim so I'm not really sure.