4

Is it possible to hook up vim save all command on tmux window change?

I know that gui vim has option to save on focus lost. I'd like to have similar behavior in console.

1

Saving on lost focus is achieved through the following command in the .vimrc:

autocmd BufLeave,FocusLost * silent! wall

The syntax is:

:au[tocmd] [group] {event} {pat} [nested] {cmd}

In your case, you want to add VimResized to the list of events, see full doc here.

The final result in the .vimrc file looks like:

autocmd BufLeave,FocusLost,VimResized * silent! wall
  • I know about FocusLost. The thing is FocusLost is not triggered when I change tmux window. In my experience it works only for GUI vim, not for console one. – mikea May 9 '13 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.