4

:1 jumps to the first line, :$ jumps to the last line, :+ jumps to the next line, etc.

It seems to me that there is a default ex command which accepts a range and jumps to it: what's the name of this ex command?

Where can I find it in vim help? I guessed it might be in various.txt, but I can't find it.

7
  • It's unclear what you want from your question. Maybe add an example of what the command would do. Just assume the command is command_name and add in the question how you would invoke the command and what it would output.
    – 3N4N
    Commented May 2, 2019 at 14:57
  • There are already 3 examples, I don't have problem calling this commands, but I don't know the name of this command, and I want to know it.
    – dedowsdi
    Commented May 2, 2019 at 15:02
  • Oh, I misunderstood then. I guess you want to look at :h cmdline-ranges. But that is obvious from how the ex-commands are acting that these are just ranges.
    – 3N4N
    Commented May 2, 2019 at 15:05
  • It doesn't describe command line with only range.
    – dedowsdi
    Commented May 2, 2019 at 15:09
  • Sorry, I am really unable to understand your question. Sorry for not being able to help.
    – 3N4N
    Commented May 2, 2019 at 15:11

1 Answer 1

8

This command has no name, but is simply the default behavior of the ex (and, notably, ed). Given a range, which may be one of the special sequences you mentioned, or a search, or even just a plain line number (e.g., :42), ex will jump to that spot in the file.

It does, however, have a place in the doc:

:help :[range]

As requested, an in-depth look at my help-searching process:

  • man ex: Always a good start. This took me to the vim man-page, which more or less points to the online help
  • man ed: Remembering that ex descends from ed, I thought I'd try here. I'm not sure if the behavior is documented there, but it was worth a shot
  • :help ex led to :help Ex-mode, neither of which were helpful
  • Remembering something about viusage and exusage, I tried :help exusage: an interesting command to run
  • I didn't see a range-based command in the index... hm. What about :help range? Took me to a useful page, but not quite there
  • Ok, commands taking ranges are documented like :[range]command, so maybe :help [range]: Not quite, that's just above where we were
  • :help :[range]: at long last.

(This is slightly exaggerated: in reality, post-exusage I jumped straight to :help :[range] because that's the syntax of the command. It was a lucky guess.)

9
  • It tickles me to not be able to find such a basic thing in vim help. I shall accept it as the answer if no one objects for some time.
    – dedowsdi
    Commented May 2, 2019 at 15:21
  • @dedowsdi me too. Ive cleaned up your question a bit and am about to go try finding it myself.
    – D. Ben Knoble
    Commented May 2, 2019 at 15:22
  • @dedowsdi see update
    – D. Ben Knoble
    Commented May 2, 2019 at 15:26
  • 1
    @dedowsdi Uh, luck? Good guessing? Actually, I started with help exusage, and then that led me to a part of the index where i couldnt find it. So i thought well maybe ill try the range help (and I knew the syntax for the help doc bc it’s pretty standardized).
    – D. Ben Knoble
    Commented May 2, 2019 at 16:16
  • 1
    @dedowsdi see update
    – D. Ben Knoble
    Commented May 3, 2019 at 1:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.