Discussion:
[iterm2-discuss] How does iTerm handle opening files?
Jerguš Lejko
2018-06-28 10:25:44 UTC
Permalink
Hello,

I'd like to ask how does iTerm actually handles opening file (by
cmd+clicking on file path) in my preferred system editor. I know about
macOS `open` command which handles this by examining the file.

But, the curios bit is that if I, in iTerm, click on "path/to/file.txt:30",
iTerm instructs my editor to scroll to line "30". I tried to search the
codebase, unsuccessfully.

Thanks for any/all suggestions!
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
George Nachman
2018-06-28 18:24:09 UTC
Permalink
iTerm2 knows about how specific editors work and tailors the opening
process to pass in a line and column number if they are available. If your
editor is Atom, then it passes file:line:column to it. Other editors use
particular URL schemes. The code path for opening a file to a line number
is here:
https://github.com/gnachman/iTerm2/blob/master/sources/iTermSemanticHistoryController.m#L285
Post by Jerguš Lejko
Hello,
I'd like to ask how does iTerm actually handles opening file (by
cmd+clicking on file path) in my preferred system editor. I know about
macOS `open` command which handles this by examining the file.
But, the curios bit is that if I, in iTerm, click on
"path/to/file.txt:30", iTerm instructs my editor to scroll to line "30". I
tried to search the codebase, unsuccessfully.
Thanks for any/all suggestions!
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jerguš Lejko
2018-06-29 05:55:42 UTC
Permalink
Oh, right! Thank you for the explanation!
Post by George Nachman
iTerm2 knows about how specific editors work and tailors the opening
process to pass in a line and column number if they are available. If your
editor is Atom, then it passes file:line:column to it. Other editors use
particular URL schemes. The code path for opening a file to a line number
https://github.com/gnachman/iTerm2/blob/master/sources/iTermSemanticHistoryController.m#L285
Post by Jerguš Lejko
Hello,
I'd like to ask how does iTerm actually handles opening file (by
cmd+clicking on file path) in my preferred system editor. I know about
macOS `open` command which handles this by examining the file.
But, the curios bit is that if I, in iTerm, click on
"path/to/file.txt:30", iTerm instructs my editor to scroll to line "30". I
tried to search the codebase, unsuccessfully.
Thanks for any/all suggestions!
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...