Using other editor with TortoiseHg
Asked Answered
L

2

16

I'm trying to use other editor with TortoiseHG, instead of (Windows) Notepad.

I have tried the solutions mentioned here:

Mercurial and Notepad++ Integration

and here:

https://bitbucket.org/tortoisehg/thg/wiki/OpenAtLine

But no results. When I right-click a file and choose "Edit Local" no file is opened at all, except when I don't set any specific editor (then file is opened in Notepad).

I have tried different editors, like Notepad++ and Sublime Text 2, and no result. Also, I tried to change configuration using "Setting" in GUI, and editing "C:\Users\<my_user>\mercurial.ini"

For example, I tried:

#### # For Sublime Text 2
[tortoisehg]
editor = C:\Program Files\Sublime Text 2\sublime_text.exe [$FILE:$LINENUM]

#### # Or, for NotePad++ :
[tortoisehg]
editor = C:\Program Files (x86)\Notepad++\Notepad++.exe ["$FILE" -n$LINENUM] -multiInst -nosession

What I'm doing wrong?

Lottie answered 6/6, 2012 at 12:58 Comment(4)
I doubt it will help, but your NotePad++ path looks incorrect (missing "\" between the two instances of "Notepad++") in the above exampleGrasmere
Path corrected. Thanks. I just wrote it wrong here.Lottie
Sorry to ask, but where is that settings file that you are editing? In the repo, or in TortoiseHG install path?Margetts
In windows, C:\Program Files\TortoiseHg\Mercurial.ini for site-wide configuration and C:\Documents and Settings\username\Mercurial.ini for per-user configuration. And repo-root\.hg\hgrc for a per-repository configuration.Lottie
B
25

You'll kick yourself...

Change:

[tortoisehg] 
editor = C:\Program Files (x86)\Notepad++\Notepad++.exe ["$FILE" -n$LINENUM] -multiInst -nosession

To:

[tortoisehg]
editor = "C:\Program Files (x86)\Notepad++\Notepad++.exe" ["$FILE" -n$LINENUM] -multiInst -nosession

Note the additional quotes around the path to Notepad++.
I'm guessing it's exactly the same issue with your path to Sublime Text too as both paths contain a space.

Bignoniaceous answered 7/6, 2012 at 10:29 Comment(4)
Incredible... how people can be helpful together. ^_^Lottie
Why should we always start new instance of NP++?Jeter
I just kicked myself!Bronchitis
@Jeter This is late, but I hope it still helps: Certain commands, for example hg histedit, wait for the editor process to close and then process the file. Without the new instance, this most likely happens immediately.Loreanloredana
C
1

Strange editor = C:\Program Files (x86)\Notepad++\Notepad++.exe without double quotes worked for me

Classy answered 29/8, 2013 at 16:33 Comment(1)
Since you have no additional arguments, it might as well workNuno

© 2022 - 2024 — McMap. All rights reserved.