Skip to content
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

Add prefix position to hx CLI file args #5945

Closed
wants to merge 8 commits into from

Conversation

bheylin
Copy link

@bheylin bheylin commented Feb 12, 2023

Resolves #5437

A cursor position can now be specified using common prefix notation used by vim, nvim, kak, emacs and nano.

hx +10 Cargo.toml

This prefix notation also allows the user to set the cursor at the end of the file.

hx +: Cargo.toml

This allows hx to play nicely with other tools that want to open a file at a given position using prefix notation.

The existing postfix notation can still be used (hx Cargo.toml:10) but has been extended to support jumping to the end of a buffer.

hx Cargo.toml:

The prefix notation works for each file in the list.

hx +10 Cargo.toml +20 README

and can be intermixed with postfix notation.

hx +10 Cargo.toml README:20

Prefix notation also supports column indexing.

hx +10:20 Cargo.toml

A cursor position can now be specified using common prefix notation
used by vim, nvim, kak, emacs and nano.

eg. `hx +10 Cargo.toml`

This prefix notation also allows the user to set the cursor at the
end of the file.

eg. `hx +: Cargo.toml`

This allows `hx` to play nicely with other tools that want to open a
file at a given position using prefix notation.

The existing postfix notation can still be used (`hx Cargo.toml:10`)
but has been extended to support jumping to the end of a buffer.

eg. `hx Cargo.toml:`
bheylin added a commit to bheylin/zellij that referenced this pull request Feb 12, 2023
@the-mikedavis
Copy link
Member

Duplicate of #5603

@the-mikedavis the-mikedavis marked this as a duplicate of #5603 Feb 12, 2023
@bheylin
Copy link
Author

bheylin commented Feb 12, 2023

Duplicate of #5603

I would highlight that this PR implements file positioning just like Kakoune's CLI
so both positioning and the ability to jump to EOF.

@gibbz00 gibbz00 mentioned this pull request Feb 14, 2023
5 tasks
imsnif added a commit to zellij-org/zellij that referenced this pull request Feb 18, 2023
* Add Helix editor (`hx`) to editors that support prefix positions

This is dependant on Helix accepting the PR:

helix-editor/helix#5945

* Add `helix` variant to accepted editors

* Add branch for Helix file opening

* style(code): add clarification comment

* style(fmt): whitespace

---------

Co-authored-by: Aram Drevekenin <aram@poor.dev>
joshheyse pushed a commit to joshheyse/zellij that referenced this pull request Mar 11, 2023
* Add Helix editor (`hx`) to editors that support prefix positions

This is dependant on Helix accepting the PR:

helix-editor/helix#5945

* Add `helix` variant to accepted editors

* Add branch for Helix file opening

* style(code): add clarification comment

* style(fmt): whitespace

---------

Co-authored-by: Aram Drevekenin <aram@poor.dev>
@the-mikedavis
Copy link
Member

This was partially superseded by #8521

We wanted to support +N syntax only for tools like less that assume that editors support that syntax. Since we have that and the suffix way of specifying line/column (e.g. file.txt:5:3) I think we support enough ways to open lines/cols. I'm not sure what the use-case is for Kakoune's support of opening at the end with :. I think it would be ok to add that syntax (specifically file.txt:, not +:) in a separate PR but I will close this out because we want to keep the position handling relatively small/simple and supporting multiple +Ns is not necessary

@bheylin
Copy link
Author

bheylin commented Feb 12, 2024

@the-mikedavis All good Mike, as long as it works!

I'm not sure what the use-case is for Kakoune's support of opening at the end with :.

I'm also not sure where that came from, I presumed it was some sort of standard across editors.

Anyways my need here was to integrate helix into zellij with line number support and that's taken care of now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accept +num flag for opening at line number
2 participants