Clone wiki

thg / OpenAtLine

TortoiseHg 2.0 adds variable expansion to tortoisehg.editor to allow you to open source files to particular lines. This is particularly useful when searching repository history.

In general, the syntax is:

editor = myeditor -flags [$FILE --num=$LINENUM] [--highlight "$SEARCH"] -moreflags

$LINENUM and $SEARCH are key-phrases. If you specify them in a bracketed section and those parameters are not passed to the editor, the entire bracketed phrase is removed from the command line.

$FILE is optional. If it is not expanded in any phrase, the filename will be appended at the end of the command line.

More specific examples:


Tested on Windows 7 Professional : Scite v2.11, Notepad++ v5.6.8, Textpad v5.3.1.

# Scite :
editor = "<path\to\>Scite.exe" ["-open:$FILE" -goto:$LINENUM] ["-find:$SEARCH"]

# NotePad++ :
editor = "<path\to\>Notepad++.exe" [$FILE -n$LINENUM] -multiInst -nosession

# TextPad :
editor = "<path\to\>TextPad.exe" [$FILE($LINENUM)]

# (G)VIM, must be in %PATH%
editor = gvim -f [-c":set hls" -c"/$SEARCH/"] [+$LINENUM $FILE]

# Sublime Text 2
editor = "<path\to\>sublime_text.exe" [$FILE:$LINENUM]

Linux / Unix

# (G)VIM
editor = gvim -f [-c':set hls' -c'/$SEARCH/'] [+$LINENUM $FILE]

# (x)emacs
editor = emacs [+$LINENUM $FILE] [--eval '(highlight-regexp "$SEARCH")']

# Scite
editor = scite [-open:$FILE -goto:$LINENUM] ["-find:$SEARCH"]

# gedit
editor = gedit [+$LINENUM]

OS X Editors

# TextWrangler
editor = edit [+$LINENUM --wait $FILE]

# TextMate
editor = mate --wait [--line $LINENUM $FILE]