Fix hard-to-reproduce bug when writing in nvim, and the entire tmux pane is copied
bew opened this issue · comments
For unknown reason, when writting in nvim, the entire tmux pane content is auto-copied to a tmux buffer.
I think how it happens is that tmux capture-pane
is called, without more args, and it populates a new unnamed tmux buffer with the content of current pane..
(note: adding -p
outputs current pane to stdout)
It seems to happen ONLY ONCE per opened nvim instance..
It seems to happen ONLY when the tmux-complete.vim
plugin is enabled.
And I managed to kindof reproduce it by opening a vim file, and starting to type statusline
(usually it's quick, but not always reproducible at the same place... some deoplete delays or sth..).
I tried to log the command executed by that plugin, it is:
sh '/home/cloud-user/.local/share/nvim/plugins/tmux-complete.vim/sh/tmuxcomplete' -p '^.' -s 'words' -l '-a' -c '-J' -g '-i' -e
How I got that command:
diff --git a/autoload/tmuxcomplete.vim b/autoload/tmuxcomplete.vim
index 09176f8..7ac621e 100644
--- a/autoload/tmuxcomplete.vim
+++ b/autoload/tmuxcomplete.vim
@@ -27,21 +27,23 @@ function! s:build_command(base, capture_args, splitmode, as)
let command = s:addcommand2(command, a:as, '-g', grep_args)
if $TMUX_PANE !=# "" " if running inside tmux
let command = s:addcommand1(command, a:as, '-e') " exclude current pane
endif
return command
endfunction
function! tmuxcomplete#getcommand(base, splitmode)
- return s:build_command(a:base, s:capture_args, a:splitmode, 'string')
+ let command = s:build_command(a:base, s:capture_args, a:splitmode, 'string')
+ call writefile(["tmuxcomplete executing command: " . command], "/tmp/tmuxcomplete-cmd-logs", "a")
+ return command
endfunction
function! tmuxcomplete#getcommandlist(base, scrollback, splitmode)
let capture_args = s:capture_args . ' -S -' . a:scrollback
return s:build_command(a:base, capture_args, a:splitmode, 'list')
endfunction
function! tmuxcomplete#completions(base, capture_args, splitmode)
let command = s:build_command(a:base, a:capture_args, a:splitmode, 'string')
It seems to happen a few seconds AFTER that command is executed by the auto complete system, and running that command standalone does not trigger the bug, so it's probably somewhere else..
I stopped investigating for now..
I'll disable that plugin in the meantime
This is now outdated, I now use cmp-tmux
, written in Lua for cmp
completion framework and I never had this issue anymore.