I have two separate instances of Vim running. I would like to set up my system so that when I search for something in one Vim (using /, ?, * or #), then press n or N in the other Vim, it searches for the same something in the second Vim. I am running Ubuntu.
I already make use of the primary system clipboard for things yanked in vim by using set clipboard=unnamed in my .vimrc file.
Research so far
The command-line tool “xsel” lets me access three different clipboards in Ubuntu: the primary clipboard (used when you select text and middle-click to paste), the clipboard clipboard (used for Ctrl+C, Ctrl+V etc.), and the secondary clipboard (which seems to be unused). My thought at the moment for Vim to use xsel to set the secondary clipboard when /, ?, * or # are used, and use xsel to access the same clipboard when n or N are pressed.
I was going to just post the code I cobbled together for this here, but then decided to bundle it up into a tiny plugin: https://github.com/dahu/VimSharedSearch