Monday, June 19, 2023

Re: t_fe and t_fd in tmux corrupts split with ^[[O

I forgot to add a vital piece of info. I also have vim-tmux-navigator.
Not the Vim plugin, but the minimal necessary code stolen from it.

function! TmuxOrSplitSwitch(wincmd, tmuxdir) abort
let previous_winnr = winnr()
silent! execute "wincmd " . a:wincmd
if previous_winnr == winnr()
call system("tmux list-panes -F '#F' | grep -q Z
\|| tmux select-pane -" . a:tmuxdir)
endif
endfunction

let previous_title = substitute(system("tmux display-message -p
\ '#{pane_title}'"), '\n', '', '')
let &t_ti = "\<Esc>]2;vim\<Esc>\\" . &t_ti
let &t_te = "\<Esc>]2;". previous_title . "\<Esc>\\" . &t_te

nnoremap <silent> <C-h> :call TmuxOrSplitSwitch('h', 'L')<CR>
nnoremap <silent> <C-j> :call TmuxOrSplitSwitch('j', 'D')<CR>
nnoremap <silent> <C-k> :call TmuxOrSplitSwitch('k', 'U')<CR>
nnoremap <silent> <C-l> :call TmuxOrSplitSwitch('l', 'R')<CR>

Turns out, the control code "^[[O" was emitted from TmuxOrSplitSwitch().
All I had to do was prepend a ":h :silent" (not ":h map-<silent>; that
was already there) to the keymap. Now Vim corrupt the window with that
control code.

--
Enan

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20230619225513.00007ad3%40gmail.com.

No comments: