Is there a register or variable that holds the line numbers for currently selected range?
line(".") works as for the current line but is there one for in a visual range?
EDIT
As mentioned below the '< and '> registers hold the beginning and ending lines.
What I ended up doing in addition to using the above was writing a function in VimScript which takes those line numbers and executes an external command, I’ll include it below:
function! Github(line1, line2)
execute "!github -f " . expand("%") . " -l " . a:line1 . " -n " . a:line2
endfunction
com! -range Github call Github(<line1>, <line2>)
I’m brand new to VimScript but from what I gathered from an initial google search, the above function accepts a range. I then take the beginning and ending line numbers and use them to execute the external script github which interfaces with the Github API and/or opens a browser to a github page based on the git info.
'<and'>respectively.So:
line("'<")andline("'>")should be what you expectAlso,
to sort the last visual selection
`< to jump to the start of the last visual selection (also see
:he v_o)Finally, if
'cpoptions'does not include*, you can use:*as a synonym for:'<,'>: