Hi folks,
The original discussion was MacOS-focused, but it got me thinking about
the Windows side of life. I run a bit of an odd setup where I use the
Windows Subsystem for Linux and have LilyPond installed there, but I do
all my editing in Windows with Visual Studio Code. This setup works
fine except for point-n-click, which is not something I usually needed.
But reading this thread made me realize that I have been missing a
useful productivity aid, so I sought to get it working.
Custom URL handling in Windows is pretty easy to set up. You just need
to do a little registry modification, and it doesn't even require
rebooting. Here is a registry file that will enable textedit for the
current user:
textedit.reg:
====
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Classes\textedit]
"URL Protocol"=""
@="URL:textedit"
[HKEY_CURRENT_USER\Software\Classes\textedit\shell]
[HKEY_CURRENT_USER\Software\Classes\textedit\shell\open]
[HKEY_CURRENT_USER\Software\Classes\textedit\shell\open\command]
@="C:\\Tools\\textedit\\textedit.cmd %1"
====
At this point, Windows will now know to execute a command when it
encounters a textedit URL. Here is the command script that I am using:
textedit.cmd:
====
@ECHO OFF
SETLOCAL
SET CODE=/mnt/c/Program\ Files/Microsoft\ VS\ Code/bin/code
SET URL=vscode://file/`/bin/wslpath -m
%%(file)s`:%%(line)s:%%(column)s
SET ENV=/usr/bin/env -i LYEDITOR='%CODE% --open-url %URL%'
SET CMD=/usr/local/bin/lilypond-invoke-editor %*
C:\Windows\System32\wsl.exe %ENV% %CMD%
====
Here I am using lilypond-invoke-editor with a custom LYEDITOR variable
so that it ends up launching my editor with the correct file path.
Despite the back and forth, it is pretty quick providing VS Code is
already running, where it only needs focus the editor and move the
cursor.
NOTE: There are hard-coded paths in both the registry file and command
script. You would need to adapt these to your own system.
Now I realize my setup is rather esoteric, but hopefully this
information can still be useful.
-- Aaron Hill
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user