lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Configuration Point & Click


From: David Wright
Subject: Re: Configuration Point & Click
Date: Wed, 20 Feb 2019 22:56:11 -0600
User-agent: NeoMutt/20170113 (1.7.2)

On Wed 20 Feb 2019 at 10:51:31 (-0700), foxfanfare wrote:
> Hi everybody,
> 
> I didn't take the time to update the thread earlier because of intense
> working, but I wanted to write a little more about the issue and the
> solution that worked. I hope this could help some people who wants to make a
> working environment for LP between VIM and zathura. BTW everything seems to
> work "out of the box" with gvim, things get more complicated with vim.

Had you told us why vim is essential, as opposed to gvim?

> The solution of using vim in servermode was right, I just didn't configure
> it well between, remote and server-mode... So here's what I put in my
> .vimrc:
> 
>   export EDITOR="vim"
>   export LYEDITOR="vim --servername LP --remote-tab-silent '+call
> cursor(%(line)s, %(column)s)' %(file)s && wmctrl -a LP && exit"
> 
> This solution needs to edit lilypond files in a named vim instance (here
> LP), that's why I use --remote-tab-silent in order to open new files without
> errors in the same instance. I also installed wmctrl in order to focus the
> ly file after clicking on the link in the PDF.

Does that warp the mouse to the vim window? (I'm not familiar with i3.)

> In usr/share/vim/vimfiles/ftplugin/lilypond.vim
> 
> " <F6>  view pdf with zathura 
> map <buffer> <F6> :!zathura "%<.pdf" &<Return>:!wmctrl -a LP<Return><Return>
> 
> This opens the PDF and then focus the original file.
> 
> The .ly file must be called the servername LP then.

Is this just opening the appropriate PDF when you press F6 in vim?

> For those using file
> browser ranger, here's the line I've added to automate things:
> 
> ext ly = vim --servername LP --remote-tab-silent "$@"

What does it automate in the file manager? Opening the .ly file in
vim, or opening the .pdf in zathura?

> And the the result in action.
> <http://lilypond.1069038.n5.nabble.com/file/t5604/27.png> 

Here, you're double-clicking on a note and vim moves its cursor
to the corresponding "b", right?

> There's still a lot of things to configure, but now Point & Click is working
> as expected. The only little "problem" I couldn't solve, is that when
> calling lilypond-invoke-editor, it returns a little message with the current
> LilyPond version. And this message appears in the vim file which is a bit
> annoying... You can see this in the screenshot. I have to refresh the
> terminal in vim (ctrl+l) in order to get rid of this message and wasn't able
> to find the solution for this. I don't know if there is a way to call
> lilypond-invoke-editor silently? If someone has an idea I would be
> interested!

Well, the problem is that you seem to have deliberately set things up
to work that way. I've managed to replicate your problem by:

Start zathura in an xterm, using & to make it run in the background so
that I get a bash prompt. Zathura runs in its own window.

    $ EDITOR=gvim zathura windmills.pdf &

Now run vim as a server in the xterm itself, not in a separate
window (which is what gvim would do).

    $ vim --servername GVIM windmills.ly

Now double click on a note. This calls lilypond-invoke-editor and,
as best I can tell, that writes "lilypond-invoke-editor (GNU LilyPond) 2.18.2"
onto standard error of wherever zathura was run from. But zathura
was started from the same xterm in which you're running vim, so
that's where the message is sent.

Now I'm not sure why you need to start vim in the same xterm that
started zathura. The idea behind having --servername names is to
register the name so that any other process in the X session can
find it by that name. (I'm assuming that a VC or another X session
would be out of scope, but I don't actually know the mechanism
that's working away behind the scenes.)

If i3, which I believe has a tree of windows, is forcing some
relationship between where vim and zathura are started, then one
solution might be to start zathura in xterm A, then start
another xterm B from A, then run vim in xterm B. Put xterm B
side by side with zathura. Hide, shrink or occlude xterm A as
it's not needed for anything except being the parent of both
xterm B and zathura (and receiving those annoying messages).

Cheers,
David.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]