I'd like to lose focus when I'm in insert mode, to trigger auto-save on *.coffee buffers and also I need it to change mode from insert to normal mode to trigger Live compile feature of vim-coffee-script plguin.
What I achieved now:
autocmd BufWritePost,FocusLost *.coffee :wa
But how to bring it to normal mode?
Thanks in advance.
autocmd BufWritePost * :<ESC>
. It won't work because user needs to switch to normal mode first before be able to do the command<ES>
. I'm trying to put two commands in a function.:<Esc>
—does that work?autocmd FocusLost *.coffee :wa | stopinsert
. But from what I've tested I have to move to another buffer in the same window (buffer1 | buffer2
) to trigger normal mode in that buffer then go back to.coffee
to get normal, idk why. I setmousefocus
to do what I've mentioned.live preview compiling
- CoffeeWatch can only be triggered when .coffee saved and buffer in normal mode or just normal mode. auto-save on first post will run in background and keep buffer in insert mode. For quick testing purpose I need to paste and back to another app.