Hi Andrew
First review after trying your tutorial in Fedora (for the purpose of
adapting these instructions for the Usage manual).
Fedora doesn't use AppArmor. I don't have SELinux enabled, so I'm not
sure if that might be a problem.
Il giorno lun 25 feb 2019 alle 8:56, Andrew Bernard
<andrew.bern...@gmail.com> ha scritto:
Hi All,
Federico has pointed out that it seems to be the season for people
wanting to get point and click going (for some reason!). In the
spirit of the season I offer the fruit of my work on this, trying to
get it all going over the last week.
I hope this may be able to be incorporated into the NR. If not, it's
here now in the archives for future reference.
Andrew
The Guide to getting Point and Click going with Gvim under Ubuntu 18
--------------------------------------------------------------------
The NR leaves out some important information about how to configure a
Ubuntu
system to use Gvim for point and click from Lilypond PDF files. Where
the NR is
substantially correct, that information is copied here.
Requirements
------------
Ubuntu 18.10
Document Viewer (evince)
gvim version 8.0 (vim-gtk3 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.
In Fedora GNOME is able to read environment variables defined in
.bashrc or .bash_profile.
You just need to logout and login again.
Installing Gvim
---------------
Gvim is in the following package, not a package called gvim.
# apt install vim-gtk3
In Fedora it's called 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 gnome-open program:
$ sudo apt install libgnome2-bin
Then:
$ gnome-open textedit:///etc/issue:1:0:0
If all is correct lilypond-invoke-editor will run and display the
file.
No need to install libgnome2-bin. You should use xdg-open, which
_should_ be available in all modern Linux installations. (package
xdg-utils, at least in Fedora)
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, the following rather daunting error
message is
shown, and you have to press ENTER to continue, each time.
: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'.
Yep, I see this problem.
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.]
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-editgor 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 Ubuntu and change the window behaviour to be 'focus on
hover'. This is
a personal matter.
All the other editors I tried automatically get the window focus, so
you can start editing the .ly file immediately after click. I think
this is a must. Any way to set this in Gvim?
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 Nautilus.
Now
clicking on a grob will take you to the line and column where that
object is in
the lilypond source file.
That's true.
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user