Going back history with multiline commands #440
-
When my last command is a muiltiline comand, and I press up, the last command shows up, with the cursor at the very last of the command. Now If I press up again, I go to the second last line, pressing up again, the third last line, and so on... Can I configure some binding that instead of going up one line at a time (in the editor), I actually go back one command at a time? IE: pressing In other words: quickly go through history, even if there are multiline commands in the history. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 11 replies
-
In the default binding, PageUp and PageDown are bound by the history prefix search. If the history prefix search is started with an empty command line, it actually moves one history entry for every keypress. If you would like to configure C-up and C-down for the actual history movement, you can use the following settings: function my/emacs/set-up-history-movements-with-control {
# For emacs editing mode
ble-bind -m emacs -f C-up 'history-prev'
ble-bind -m emacs -f C-down 'history-next'
}
blehook/eval-after-load keymap_emacs my/emacs/set-up-history-movements-with-control
function my/vi/set-up-history-movements-with-control {
# For vi editing mode
ble-bind -m vi_imap -f C-up 'history-prev'
ble-bind -m vi_imap -f C-down 'history-next'
ble-bind -m vi_nmap -f C-up 'vi-command/history-prev'
ble-bind -m vi_nmap -f C-down 'vi-command/history-next'
}
blehook/eval-after-load keymap_vi my/vi/set-up-history-movements-with-control Or you can also configure the same through the readline interface: bind -m emacs '"\e[1;5A": previous-history'
bind -m emacs '"\e[1;5B": next-history'
bind -m vi-insert '"\e[1;5A": previous-history'
bind -m vi-insert '"\e[1;5B": next-history'
bind -m vi-command '"\e[1;5A": previous-history'
bind -m vi-command '"\e[1;5B": next-history' |
Beta Was this translation helpful? Give feedback.
-
@DJCrashdummy Let me create a separate thread because it is a related but separate discussion.
Hmm, that's actually a good question. I haven't cared about it and haven't noticed that C-up and C-down are unused. Come to think of it, yes, I don't have memory that I used C-up and C-down in Bash. I think we can bind it to these. I'll think about it. |
Beta Was this translation helpful? Give feedback.
-
though one additional and also somewhat related question @akinomyoga (which would make this feature for me personally perfect): |
Beta Was this translation helpful? Give feedback.
In the default binding, PageUp and PageDown are bound by the history prefix search. If the history prefix search is started with an empty command line, it actually moves one history entry for every keypress.
If you would like to configure C-up and C-down for the actual history movement, you can use the following settings: