6

How to move one editing row up (back) or down (forward) in a multi-line command in bash/readline?

Somethnig like gj/gk in Vim.

1 Answer 1

-1

I'm assuming you're using Emacs keybindings in readline (the default), in which case you can use the following:

  • Ctrl + P - go to previous line
  • Ctrl + N - go to next line

If you prefer vi keybindings, those can be enabled by adding the following to your ~/.inputrc: set editing-mode vi

2
  • 4
    Yes, emacs mode. But it's not the answer. Ctrl+P/N goes to the previous/next command line. I am asking how to move cursor "screen width" characters back/forward so it's looks like moving one editing line up/down in a (long) multi-line command. Jul 13, 2015 at 8:43
  • 1
    @HansGinzel Ah, I misunderstood slightly. Unfortunately I can't see anything obvious in the readline documentation. I believe the Emacs equivalent commands would be next-logical-line and previous-logical-line but I don't think readline has anything similar.
    – mjturner
    Jul 13, 2015 at 9:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .