Friday, December 18, 2009

Re: Vim client-server communication

On Tue, Dec 15, 2009 at 08:59:45AM EST, MBro wrote:

[..]

> Not sure how relevant this is to your situation, but I use the client-
> server for a few things in my day-to-day
> work environment:

> 1. all MAN pages all show up under one gvim [I'm not an expert BASH
> writer]:
> function man() {
> gvim_server="MANPAGES1"
> title=+"set titlestring="Man_Page"
> silent="--remote-silent"
> oldIFS=$IFS
> IFS=
>
> # Keep track of previously run 'man pages'
> # this speeds up the process of looking at the same MAN pages over
> and over again...
> if [ ! -e /tmp/man.$* ]; then
> /bin/man $* | col -b cat >/tmp/man.$*
> fi
> gvim --servername $gvim_server -R $title $silent /tmp/man.$* >/dev/
> null &
> IFS=$oldIFS
> }

I like the idea..!

I often end up with a bunch of vim instances on various terminals one
for each of the man pages I looked at over the last 24 hours or so, and
that's clutter.

Hence, having them all in one dedicated vim instance, sounds like a
great idea.

I'm thinking that the best way to speed this up would possibly be to
have a directory such as ~/manvim with formatted vim pages from previous
runs and check it for the existence of a given man page, and if it
exists, skip the /usr/bin/man | col -b > /wherever sequence.

Since I use terminal vim in GNU/screen, I added a 'screen -X select 16'
which takes me automatically to screen window #16.. looks like this
setup will suit me better than the :Man plugin, or the vman bash
function that I already have.

I have to play with it a couple of days before I can make an informed
decision.

> 2. In a perl script I open a desired file in a remote gvim and goto
> the specified line number:
> # This is a stripped-down version of my code
> my $file = "path/to/file-name.ext";
> my $viewer = "/bin/gvim";
> my $editor_options = '--servername PDU_VIM -R --remote-silent +
> \"set filetype=MIB|LINE_NUM\"';
> $editor_options =~ s/LINE_NUM/$requested_line_number/;
> system "$viewer $editor_options $file";
>
> It appears to work reasonable for my needs :-)

I'll take a closer look at this one tomorrow.

But how come your executables are in /bin/ rather /usr/bin/..?

Is this personal customization, or the distro you are running?

Thanks much for your comments.

CJ

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: