New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proposal: support for file addresses #4707
Comments
There have been some discussions about it in the past. I suppose a custom core plugin could solve it. Note, although unlikely, this wish is quite controversial and might prevent actually editing a file that is actually called with a colon. So I believe a custom plugin is better than changing the semantics. There is at least vim-fetch, not sure how well it works or what other alternatives exists. I remember having seen a similar plugin 10 years ago, but can't remember. |
Agreed, we don't want to break backwards compatibility here. A custom core plugin sounds like a good compromise.
Thanks. I've edited my comment above to add a list of plugins which we could use as a reference point if this is something we want to make core. |
I don't know if this is helpful but it could be solved with a little shell script. You could write a Vim wrapper, for example you can name it simply "v". It would split the parameter you showed in your example ... v path/to/file:$line:$colbyteoffset and call vim for you with ... vim path/to/file -c 'normal $lineG$colbyteoffset|' e.g. v foobar.txt:39:12 |
There is also https://github.com/bogado/file-line and https://github.com/lervag/file-line . The only problem with a wrapper script is |
true, there is only |
There is also my search-and-view |
@marcotrosi a key part of this proposal is that it should be easy to copy-paste file addresses from output of commands, e.g. compiler output, grep etc. Hence the |
yes I know. And I agree that some things should work out of the box even if they could be easily realized with small command or function. Like here you could write a command named :E and implement what you need, but as I said some things should work by default. E.g. for consistency reasons. |
The proposal here is not for this to work out of the box. Per @chrisbra's comment, because of backwards compatibility concerns we need this to be something that is turned on by enabling a plugin or some such. I'm not quite sure I follow your point about trying to eliminate any copy paste by saying people should use quickfix lists. This proposal includes that this should also work from the command line. Also, there are plenty of times when the output I am working with is not in Vim. Are there specific reasons you think this proposal, as a plugin, would not work/be a bad idea? |
Oh I'm sorry if I made you think that I'm pro or against any solution. I did not judge. I only wanted to discuss pros and cons of possible solutions. Just collecting thoughts and ideas and listing pros and cons. Just some happy chatting with you guys. Nothing more. Sorry if I transported a different message. |
Look into using an autocmd (probably BufReadCmd) in a plugin. |
Is your feature request related something that is currently hard to do? Please describe.
The feature I am looking for can currently be provided by plugins, for example https://github.com/plan9-for-vimspace/plan9-for-vimspace/.
I'm raising this proposal because I think this is something that could usefully be provided natively.
Describe the solution you'd like
https://github.com/plan9-for-vimspace/plan9-for-vimspace/ and others support the concept of opening files at specific addresses. e.g. from the command line:
would open
path/to/file
and move the cursor to line$line
and col byte offset$colbyteoffset
.This form also works within vim, via
:e
,:sp
etc.I believe this format of address is relatively standard (and has its origins in
sam
)Here is a rough list of plugins that provide this functionality:
Describe alternatives you've considered
An alternative is clearly to implement this in a plugin. But this requires people to install a plugin for something that is relatively "core".
Additional context
n/a
The text was updated successfully, but these errors were encountered: