audio
audio

Reputation: 404

How do I change the WinGHCi editor via :set editor?

I want to use Notepad++ instead of Notepad as the editor GHCi calls when I type in :edit. Does anyone know how to do this? I tried

:set editor C:\Program Files (x86)\Notepad++
:set editor "C:\Program Files (x86)\Notepad++"

but none of these work.

Thanks for the help!

Upvotes: 10

Views: 5949

Answers (4)

Linkeer365
Linkeer365

Reputation: 31

You can add a new system environment variable called EDITOR to your system environment variables if you want to use the editor you like permenantly.

Attentions:

  1. You should add it to your system environment variables, not user's environment variables.
  2. EDITOR should be all capitalized.
  3. Most importantly, the value of this variable should be:
    • a Using double backslashes.
    • b keep the quotation marks! (like this: "C:\Users\\AppData\Local\Programs\Microsoft VS Code", I think other variables might not have or need this quotation marks, but it NEEDs in this case.)

Upvotes: 0

gron
gron

Reputation: 31

Just came across this one. The top answer is correct however I could only get this working by adding -multiInst to the command line i.e:

:set editor "C:/Program Files (x86)/Notepad++/notepad++.exe" -multiInst

or just

"C:/Program Files (x86)/Notepad++/notepad++.exe" -multiInst

in the settings dialog of WinGHCi which opens a new notepad++ instance on :e.

Upvotes: 3

AndrewC
AndrewC

Reputation: 32455

The editor is a String, so you need to escape \ as \\, like so:

:set editor "C:\\Program Files (x86)\\Notepad++"

but it's unix/windows agnostic for FilePaths, so you could alternatively do it as

:set editor "C:/Program Files (x86)/Notepad++"

As a side note, it's quicker to type :e instead of :edit; ghci will deduce what you mean from a substring like :ed if there's only one possibility.

Upvotes: 12

Chris
Chris

Reputation: 3050

I would guess that Notepad++ should be on your $PATH. If you can run Notepad++ from a newly-opened terminal, then you're good. Then use :set editor Notepad++ in ghci.

Upvotes: 2

Related Questions