PeepOpen-Issues icon indicating copy to clipboard operation
PeepOpen-Issues copied to clipboard

Modify to communicate with Vim via client-server functionality

Open brendanjerwin opened this issue 13 years ago • 5 comments

See: http://vimdoc.sourceforge.net/htmldoc/remote.html

Currently it seems that PeepOpen is shelling vim/macvim to get it to open the file. That is why they always open in a new window/tab.

Using the client-server functionality of Vim (the server name could be sent to PeepOpen when it is launched from Vim) it should be possible to call a function in Vim with the path of the file to be opened.

Once that change is done then many other Vim related issues/feature requests could be implemented:

  • Open in current buffer
  • Open in split
  • Open in new tab

The launching command would send a hint to PeepOpen, and when PeepOpen calls back it could provide that hint back, allowing the appropriate dispatch.

brendanjerwin avatar Jul 15 '12 01:07 brendanjerwin

This script can be used to help ensure that a reasonable server name is set:


#!/bin/bash

mvim --servername "${PWD##*/}" .

brendanjerwin avatar Jul 15 '12 02:07 brendanjerwin

Here is a simple example of sending a command to a running instance:

mvim --servername VIM --remote-send ":echo 'hello from the outside'<CR>"

brendanjerwin avatar Jul 15 '12 02:07 brendanjerwin

Looks like this was requested many times (even patch provided) but unfortunately was never implemented :( That's sad.

EDmitry avatar May 19 '13 07:05 EDmitry

I've experimented with this in the past and wasn't able to get it to work reliably.

Would everyone need to launch vim or mvim with the script that sets the name of the server? I'd like to make this work without changing developers' existing workflows.

However, this could make a way for PeepOpen to work with terminal vim, which would be really cool. It could be enough to make me switch from Emacs to Vim. ;-)

topfunky avatar May 20 '13 17:05 topfunky

Also, MacVim already has a setting that basically fixes the main problem by opening files in the current window:

https://peepcode.com/system/uploads/2010/PeepOpen-Help/editors%20-%20macvim.html

topfunky avatar May 20 '13 17:05 topfunky