You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A clear and concise description of what the bug is:
When grabbing a permalink for a visually-selected range the ordering of the line numbers at the end of the URL is dependent on the cursor position in the visual selection (i.e. is it on the first line of the selection or the last line).
What were you trying to do?
Trying to get a github permalink URL for a visually-selected range of lines.
What was the expected result?
I expect the line numbers to be in ascending order, like L2-L23, rather than dependent on cursor state.
Note that the line number ordering doesn't matter when opening a link in the browser to view the selected lines, so if you're just looking to open the page in the browser then
However, I was a bit sad to learn today that github is not so flexible if you are trying to reference code in a comment. Normally for permalinks in the same repo Github will expand a link into a little embed, like so:
If the cursor is on the first line of the selection then the order is swapped, so it's $ENDLINE-$STARTLINE, but if I have the cursor on the last line of the selection then it's $STARTLINE-$ENDLINE.
select a range of lines and do <leader>gy to get the git permalink
observe that the order of the line numbers depends on whether the visual mode cursor is at the end or the beginning of the selection (see video below). I can freely toggle back-and-forth between these two behaviors by hitting o.
Screenshots
Screen.Recording.2022-09-26.at.12.56.05.PM.mov
System (please complete the following information):
OS: macOS 12.6
neovim --version: NVIM v0.8.0-dev+516-g8ea09fc90
git --version: 2.37.3
The text was updated successfully, but these errors were encountered:
Describe the bug
A clear and concise description of what the bug is:
When grabbing a permalink for a visually-selected range the ordering of the line numbers at the end of the URL is dependent on the cursor position in the visual selection (i.e. is it on the first line of the selection or the last line).
What were you trying to do?
Trying to get a github permalink URL for a visually-selected range of lines.
What was the expected result?
I expect the line numbers to be in ascending order, like
L2-L23
, rather than dependent on cursor state.Note that the line number ordering doesn't matter when opening a link in the browser to view the selected lines, so if you're just looking to open the page in the browser then
https://github.com/alicewriteswrongs/dotfiles/blob/c61ec53b39c49202aff593387fcb483cb0f74fee/nvim/init.vim#L481-L483
is as good as
https://github.com/alicewriteswrongs/dotfiles/blob/c61ec53b39c49202aff593387fcb483cb0f74fee/nvim/init.vim#L483-L481
However, I was a bit sad to learn today that github is not so flexible if you are trying to reference code in a comment. Normally for permalinks in the same repo Github will expand a link into a little embed, like so:
gitlinker.nvim/lua/gitlinker.lua
Lines 3 to 6 in c68d487
But this link, which just has the order of the line numbers swapped, doesn't work:
https://github.com/ruifm/gitlinker.nvim/blob/c68d4873a14d2ae614875685ccca2e49472989e8/lua/gitlinker.lua#L6-L3
What was the actual result?
If the cursor is on the first line of the selection then the order is swapped, so it's
$ENDLINE-$STARTLINE
, but if I have the cursor on the last line of the selection then it's$STARTLINE-$ENDLINE
.To Reproduce
I'm not using any fancy setup stuff, just doing the following in my init.vim:
To reproduce the error:
<leader>gy
to get the git permalinko
.Screenshots
Screen.Recording.2022-09-26.at.12.56.05.PM.mov
System (please complete the following information):
neovim --version
: NVIM v0.8.0-dev+516-g8ea09fc90git --version
: 2.37.3The text was updated successfully, but these errors were encountered: