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 `<F24><F25>` 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.
This commit is contained in:
Kenneth Benzie 2021-01-27 19:23:13 +00:00
parent 9c64158445
commit 92a23103e3
2 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,8 @@
if get(g:, 'loaded_tmux_focus_events', 0)
" Override vim-tmux-focue-events command-line mappings when tmux send <F24>
" FocusLost and <F25> 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 <silent> <F24> <C-\>edo#sink()<CR>
cnoremap <silent> <F25> <C-\>edo#sink()<CR>
endif

View File

@ -96,3 +96,7 @@ function! do#signify() abort
" Enable update on text change e.g. undo/redo " Enable update on text change e.g. undo/redo
autocmd signify TextChanged <buffer> call sy#start() autocmd signify TextChanged <buffer> call sy#start()
endfunction endfunction
" A sink for mappings to do nothing
function! do#sink() abort
endfunction