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 usedaugroup focus    au!    au TabLeave * silent! wall    au FocusLost * silent! wallaugroup ENDset autowriteallAnd 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.
How to auto save file when moving between split?
neovim;split;save
What you are looking for is a way to trigger the autocommand each time you leave a buffer to another location.Conveniently the autocommand event BufLeave was made precisely for that, so you just need to add a line like this in your autogroup:au BufLeave * silent! wallAs a bonus: the command :h autocommand-events might be pretty useful to you when you are looking for a new autocommand event.