lilypond-user
[Top][All Lists]
Advanced

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

Getting point and click going with gvim on Alma Linux


From: Andrew Bernard
Subject: Getting point and click going with gvim on Alma Linux
Date: Mon, 5 Sep 2022 09:46:44 +1000

In response to the recent thread on alternatives to Frescobaldi on Alma Linux I have prepared this set of instructions. I have tested this and there are two points in addition to the notes below.

One, I am unable to get rid of the last line of the extensive status message gvim shows at the bottom when invoked with a remote call. This is puzzling - I am working on it.

Second, in 2.23.12 at least, there is an error, strangely only for gvim, in libexec/lilypond-invoke editor. Line 130 is missing a comma, and must be updated to:

    "gvim": [("gvim", "--remote", "+:%(line)s:norm%(column)s", "%(file)s")],

I have submitted a bug report request about this.

This is a variant of the document 'The Guide to getting Point and Click going with Gvim under Ubuntu 18' I submitted to the list some years ago, and the comments members made there may be useful to read still.

https://mail.gnu.org/archive/html/lilypond-user/2019-02/msg00536.html

These instructions are readily adaptable to other text editors that are supported in libexec/lilypond-invoke-editor. I used Alma Linux 9.0 to develop these notes.


Andrew

========


The Guide to getting Point and Click going with Gvim under Alma Linux 9
-----------------------------------------------------------------------

The NR has no detailed information about Lilypond point and click with gvim for Alma Linux. This note attempts to remedy that. Some information from the NR is
copied here for ease of reference.

Requirements
------------

Alma Linux 9.0
Document Viewer (evince)
Lilypond
gvim version 8.2 (vim-X11 package)
[assumes bash shell]


Setting the EDITOR variable
---------------------------

Lilypond uses the environment variable EDITOR to select which editor to use to
display point and click links. For gvim, simply use the value 'gvim':

export EDITOR=gvim

Setting LYEDITOR is not required.

You can start evince from a terminal command to view a PDF. But if you want to click on a PDF in GNOME Nautilus to view it then just exporting this variable from the various bash startup files is inadequate. Gnome is started by Xsession in X11 before terminals and shells. Therefore it is unable to see environment
variables set in .bashrc (or .bash_profile, etc). To resolve this matter,
recall that Xsession uses the startup file $HOME/.xsessionrc. For environment variables that are to be shared between GNOME applications and terminal shells, do the following. Create a file for variable declarations, of arbitrary name.

Add the EDITOR setting to that file:

 $ echo 'export EDITOR=gvim' > ~/.my_env_vars

Then edit ~/.xsessionrc to contain:

if [ -f ~/.my_env_vars ]; then
    . ~/.my_env_vars
fi

Now also add these same lines to ~/.bashrc. Some like to use .bash_profile or
other mechanisms, but the principle is the same. Manage any shared variables
that Nautilus and a bash shell both need in this third file. To make this take
effect, logout and login again so that a new Xsession is started.


Installing Gvim
---------------

Gvim is in the following package, not a package called gvim.

# dnf install vim-X11


Configuring the GNOME 3 Desktop
-------------------------------

Create the file 'lilypond-invoke-editor.desktop':

[Desktop Entry]
Version=1.0
Name=lilypond-invoke-editor
GenericName=Textedit URI handler
Comment=URI handler for textedit:
Exec=lilypond-invoke-editor %u
Terminal=false
Type=Application
MimeType=x-scheme-handler/textedit;
Categories=Editor
NoDisplay=true

Run:

$ xdg-desktop-menu install ./lilypond-invoke-editor.desktop
$ xdg-mime default lilypond-invoke-editor.desktop x-scheme-handler/textedit

Check that this works. Install the xdg-open program:

# dnf install xdg-utils

Then:

$ xdg-open textedit:///etc/os-release:1:0:0

If all is correct lilypond-invoke-editor will run and display the file.


Configuring Gvim
----------------

Not all users see this problem, but if you do, it is hard to solve if you don't
know. On a plain new gvim install, every time you click on a lilypond grob
under the setup described here, a rather daunting status message is shown, and
you have to press ENTER to continue, each time. This is just an example:

:if !exists('+acd')||!&acd|if haslocaldir()|cd -|lcd -|elseif getcwd() ==# '/home/andro'|cd -|endif|endif
::1898:norm3|cal foreground()|if &im|star|en|redr|f

And also 'Press ENTER or type command to continue'.

The solution to this is to change the size of the message display in gvim. Add
the following to ~/.gvimrc:

if exists('+cmdheight') && (&ch < 2)
  set ch=2
endif

You may need to set the height to 3, depending on various sizes.
[As for why some people do not see this issue, I am unclear.]

[n.b. this is from the previous issue of this document for Ubuntu 18 but the
messsage in Alma Linux persists despite this fix. I am currently working on
it.]

A Personal Preference
---------------------

Because gvim comes by default with mouse enabled, and this is a useful feature,
if you click in the window after lilypond-invoke-editor has set the cursor
position in the file, the cursor will move to the mouse click. You can either
disable mouse in gvim, or do what I prefer which is to use the GNOME Tweaks
tool in Alma Linux and change the window behaviour to be 'focus on hover'. This
is a personal matter.


Running Gvim and Evince
-----------------------

Run gvim in server mode by doing - exactly nothing! Simply running gvim will
start the process in a new window. From the terminal this suffixes:

$ gvim

By default gvim will respond to remote requests such as from
lilypond-invoke-editor. There is no need to use the --servername option as the
name defaults to GVIM (and you can see this in the title bar). By default
lilypond sends point and click requests to the gvim server named GVIM.

Run evince from the shell or by clicking on a PDF file in Files. Now clicking
on a grob will take you to the line and column where that object is in the
lilypond source file.







reply via email to

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