4 ms·
I still wonder why editors don't understand line numbers on the CLI <editor> file:5 The editor should try to find if 'file:5' exist and open it if so, if it do
by renox 4y ago
I still wonder why editors don't understand line numbers on the CLI
<editor> file:5
The editor should try to find if 'file:5' exist and open it if so, if it doesn't it should try to open 'foo' and then go to line 5.
Sounds sensible no?
But I don't know any editor which does this.
- oftenwrong 4y agovim does: vim file +5
- euiq 4y agoVisual Studio Code does this (see "File links"): <https://code.visualstudio.com/docs/terminal/basics#_links https://code.visualstudio.com/docs/terminal/basics#_links>
- matsemann 4y agoJetBrains products do this for lots of stuff if you use the built in terminal to launch stuff or their runner.
- masklinn 4y ago> The editor should try to find if 'file:5' exist and open it if so, if it doesn't it should try to open 'foo' and then go to line 5. Opening a file is often done in creation, and `file:5` is a perfectly valid filename, so it's a bit debatable for a default. OTOH in Emacs you should be able to define a find-file-not-found-functions hook[0] and implement whatever fallback you want. I assume `emacs <file>` calls `find-file` after it's initialised the editor itself. [0] https://www.gnu.org/software/emacs/manual/html_node/elisp/Visiting-Functions.html#index-find_002dfile_002dnot_002dfound_002dfunctions https://www.gnu.org/software/emacs/manual/html_node/elisp/Vi...
- Measter 4y ago> Opening a file is often done in creation, and `file:5` is a perfectly valid filename, so it's a bit debatable for a default. It gets even more fun on Windows! Giving a filename of `foo:5` can result in a file called `foo` with an alternate datastream called `5`.
- renox 4y ago> Opening a file is often done in creation, and `file:5` is a perfectly valid filename, so it's a bit debatable for a default You're right, but even as an option I think it'd be nice.
- LtWorf 4y agoIt works with kwrite/kate/kdevelop.
- yakubin 4y agoThat works in Emacs compilation buffers. You can also define custom patterns to match the output formats of different compilers.