Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8647133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:59:23+00:00 2026-06-12T12:59:23+00:00

Is there a register or variable that holds the line numbers for currently selected

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:59:24+00:00Added an answer on June 12, 2026 at 12:59 pm
    • '< and '> respectively.

      So: line("'<") and line("'>") should be what you expect

    • Also,

      :'<,'>sort
      

      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 :'<,'>:

      :se cpoptions-=*
      :*sort
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any function / global variable in PHP that returns the current state
are there any libraries for Linux wrote with C++, that could register global hotkeys
I am currently developing a rather complex jQuery plugin. One that I am designing
Is there anyway to register a PHP callback function to be executed when the
I'm creating some restful apis. There is a register api, user can POST an
Is there a way to register for events or receive any other kinds of
Is there a way to register for global mouse moved events in Cocoa? I
Is there a catchall handler I can register for the BeginInvoke method in C#?
Is there a danger in using the $gp register to store a value? I
Is there a way for a custom panel for Flash CS4 to register for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.