1

Suppose I want to jump x amount of lines up or down. Is there a convenient command for it?

  • 1
    Say you want to jump 5 lines: c-u 5 and then c-p, c-n or arrows. A shortcut would be M-5 and then navigation keys. – Pouya Jan 9 at 12:38
  • Suppose I want to create my own keybinding to jumping 10 lines. How would I do that? – Prikshet Sharma Jan 9 at 13:00
  • 1
    Please ask one question per post. – Dan Jan 9 at 13:03
  • 2
    @PrikshetSharma, you can do something like (global-set-key (kbd "C-p") (lambda () (interactive) (previous-line 5))). But I would absolutely not recommend it. You should get used to c-u number shortcuts which you can use in other places. – Pouya Jan 9 at 13:07
  • What @Dan said. This question is about how to find an existing command that does what you want. A different question is how to bind a command to a key. And please use Search here, to see if your question has already been posted (avoid duplicates). With Search you can enter a tag name, in brackets. e.g. [help]. Tag [help] is about Emacs commands that provide help such as what you're looking for, of which apropos-command is one. – Drew Jan 9 at 17:47
2

To discover an existing command that moves up or down lines, use command apropos-command, bound to C-h a by default.

Commands involving lines often have line in their name. So try that: C-h a line RET. Among the displayed command names and their descriptions, you'll find next-line and previous-line.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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