<div dir="ltr">I started playing with xclipboard, for the most part, sending a different event doesn't seem hard at first glance:<div><br></div><div>- I put logic in on_user_command checking if currently active app is vim</div><div>- If it is, I emulate fake $self->key_press and $self->key_release events (or even tt_write the special ctrl sequence)</div><div>- If not, I do the logic that's already there</div><div><br></div><div>The only problem I'm seeing now is that I can't get the fact that vim is running, no matter what, even using logic of urxvt that should be able to get me that. Here is what I tried. It also seems like urxvt never updates $term->env() after initially reading it (which seems like a bug to me, it's possible that other parameters I'm reading are subject to the same bug too). Here is what I tried:</div><div><br></div><div>- view $self->resource('title'), assuming it's set to the current window title, it's not, it always seems to be set to urxvt (even though the window title for the terminal says VIM)</div><div>- view $self->resource('term_name'), because my .vimrc overrides term, no effect, it's always the same as one defined in .bashrc</div><div>- view $self->env()->{'DISABLE_CLIPBOARD'} and launch vim with "DISABLE_CLIPBOARD=1 vim", that ENV var is never visible from urxvt, only ones defined in .bashrc are</div><div>- view if env is getting updated at all: $self->env()->{'PWD'}, initial $PWD is correct, but it never changes after, so my suspicion that urxvt isn't reading env updates is correct</div><div><br></div><div> So the bug seems to be:</div><div>urxvt seems to ignore any updates to the environment that weren't already there at the time it was loaded.</div><div><br></div><div>Also, if there is a better way to detect current environment/app, please let me know, thanks.</div><div><br></div><div>version info:</div><div><br></div><div><div>rxvt-unicode (urxvt) v9.19 - released: 2013-10-27</div><div>options: perl,xft,styles,combining,blink,iso14755,unicode3,encodings=eu+vn+jp+jp-ext+kr+zh+zh-ext,fade,transparent,tint,pixbuf,XIM,frills,selectionscrolling,wheel,slipwheel,smart-resize,cursorBlink,pointerBlank,scrollbars=plain+rxvt+NeXT+xterm</div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 12, 2015 at 3:33 AM, Alexander Tsepkov <span dir="ltr"><<a href="mailto:atsepkov@gmail.com" target="_blank">atsepkov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm trying to use the same copy/paste keys for both, the terminal and vim. Effectively I want the terminal to be able to detect which one is more appropriate given the situation (vim window on foreground) rather than me trying to remember which combo to use. The terminal has advantage that I can use it with any app. However, vim's internal copy-paste offers more flexibility (ability to ignore line numbers, ability to auto-switch to normal/insert mode as needed), so I would like to use vim's copy/paste (which I already mapped) when vim is active.<div><br></div><div>I can have vim set the title of urxvt, and since urxvt already uses xclipboard perl script to manipulate copy/paste, maybe even have the script auto-detect that the current app is vim and cancel, passing through the key sequence to vim. Is this doable? If not, can I do something else, like send '"*y' (yank to system clipboard) sequence to vim upon copy shortcut if the active app is vim and '"*p' (paste from system clipboard) on paste shortcut?</div><div><br></div><div>Thanks</div></div>
</blockquote></div><br></div>