From 92a23103e3905f84b040c65ea589c9c7b47fdc68 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Wed, 27 Jan 2021 19:23:13 +0000 Subject: [PATCH] Fix vim-tmux-focus-events errors in command-line When changing focus away and back to vim while in the middle of editing the command-line, vim-tmux-focus-events emits errors from the function called by the `:cnoremap` mappings. This patch replaces these mappings with a call to `do#sink()` which does nothing. Simply removing the mappings will result in `` being inserted on the command-line since tmux will send this text when `tmux set-option -g focus-events on`, this is why `do#sink()` is needed. --- after/plugin/mappings.vim | 8 ++++++++ autoload/do.vim | 4 ++++ 2 files changed, 12 insertions(+) create mode 100644 after/plugin/mappings.vim diff --git a/after/plugin/mappings.vim b/after/plugin/mappings.vim new file mode 100644 index 0000000..01a0398 --- /dev/null +++ b/after/plugin/mappings.vim @@ -0,0 +1,8 @@ +if get(g:, 'loaded_tmux_focus_events', 0) + " Override vim-tmux-focue-events command-line mappings when tmux send + " FocusLost and FocusLost instead of to call do#sink() which does + " nothing. This is required due to errors emitted from the + " vim-tmux-focus-events plugin when chaning focus. + cnoremap edo#sink() + cnoremap edo#sink() +endif diff --git a/autoload/do.vim b/autoload/do.vim index 68ba12e..aca11c8 100644 --- a/autoload/do.vim +++ b/autoload/do.vim @@ -96,3 +96,7 @@ function! do#signify() abort " Enable update on text change e.g. undo/redo autocmd signify TextChanged call sy#start() endfunction + +" A sink for mappings to do nothing +function! do#sink() abort +endfunction