lilypond-user
[Top][All Lists]
Advanced

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

Re: Windows/WSL textedit handling (was Re: Interactive PDF Link to Notes


From: Federico Bruni
Subject: Re: Windows/WSL textedit handling (was Re: Interactive PDF Link to Notes in Preview)
Date: Thu, 19 Jul 2018 19:10:08 +0200

Hi Aaron

Thanks for the instructions!

I haven't had the time to properly test it yet.
I made a quick try now and not surprisingly (I'm not a Windows user) did not work.

I have a few questions:

- have you used a multistring for Classes\textedit key? Otherwise you cannot put the two lines. Does it have to have a special name?

- I guess that the CMD path to lilypond-invoke-editor is wrong (it seems a Linux path). Should I use what PowerShell gcm finds for it? Full paths are necessary, right?

- C:// becomes /mnt/c in cmd scripts?



Il giorno mar 10 lug 2018 alle 6:11, Aaron Hill <address@hidden> ha scritto:
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
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user




reply via email to

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