You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cursor position after up arrow history cycling is unconventional on multi-line statements #999
Platform macOS Tahoe Terminal software WezTerm, but the behavior is the same in other Terminals
Steps to reproduce
Hit the up arrow to cycle to any multi-line statement in history
The cursor is at the end of the first line instead of the end of the multiline command
For example:
ls█ <-cursor after hitting up
::: | where type == file
Expected behavior:
ls
::: | where type == file█ <-cursor after hitting up
Screenshots/Screencaptures
Additional details
I could at least temporarily work around this issue if M-> (meta + greater than) was mapped for emacs mode, or G was mapped for vi mode to take me to the bottom, but neither is so I'm stuck arrowing around my commands.
I agree. It seems like the cursor should be to the right of file in your example. I bet this is specific to multiline handling. Thanks. Hopefully someone will be able to locate and fix the issue easily. Seems like it shouldn't be that tricky.
This isn't actually a bug. Its intended behaviour. When there are multi-line statements in the history, pressing up arrow n times will switch to nth last history. If the cursor was at the end then you would need to press >=n times to get to last nth history item.
The cursor was put at the end of the line in #899, and then it was reverted in #959.
I also made a pr to add G motion to vi mode a few months ago, but it didn't get any reviews and was left there: #953
This isn't actually a bug. Its intended behaviour. When there are multi-line statements in the history, pressing up arrow n times will switch to nth last history.
Oh, I see - the thinking is that that by putting the cursor in an unexpected place at the top of the first line of a buffer you get a shortcut to keep being able to hit up to cycle through history. One of the problems with that method is you then sacrifice the down arrow, which now has to cycle through the whole multiline buffer if you hit up one too many times and now want to go back down the history.
There are other ways to accomplish this behavior. Using Fish as an example, while you hit up and down it cycles history and the cursor is in the last position, but once you begin editing, then up and down cycle through the lines in the buffer. You can also achieve the same behavior in Zsh with ZLE widgets. See a Zsh example of the behavior I'm after: smart-up-and-down.zsh.
I'll not try to convince anyone that Nushell's default behavior here is a lousy out-of-the-box experience (which is of course subjective), but being able to fix it with a plugin is an objective measure of how capable reedline is. Is there a way to achieve this through nu scripting, even if it doesn't make it into the codebase as a more reasonable default?
I think it'll need to be changed in reedline. @ysthakur do you have any thoughts here? I'd also be up for something similar to @Juhan280's reedline PR but for emacs mode like Ctrl-ArrowDown takes you to the end of the multiline command line, or some such hotkey.
Using Fish as an example, while you hit up and down it cycles history and the cursor is in the last position, but once you begin editing, then up and down cycle through the lines in the buffer.
This sounds like it'd be best and I'd like to do this eventually, but it probably won't be super easy (not an expert here, can't say for sure).
@Juhan280's reedline PR but for emacs mode like Ctrl-ArrowDown takes you to the end of the multiline command line, or some such hotkey.
Yeah, that sounds easiest to implement right now. I'll review #953 soon. Then we can do the same for Emacs.
Activity
fdncred commentedon Jan 7, 2026
I agree. It seems like the cursor should be to the right of
filein your example. I bet this is specific to multiline handling. Thanks. Hopefully someone will be able to locate and fix the issue easily. Seems like it shouldn't be that tricky.Juhan280 commentedon Jan 8, 2026
This isn't actually a bug. Its intended behaviour. When there are multi-line statements in the history, pressing up arrow
ntimes will switch tonth last history. If the cursor was at the end then you would need to press>=ntimes to get to lastnth history item.The cursor was put at the end of the line in #899, and then it was reverted in #959.
I also made a pr to add
Gmotion to vi mode a few months ago, but it didn't get any reviews and was left there: #953fdncred commentedon Jan 8, 2026
I still like it at the end better myself. I'm fine with #953 but it doesn't fix the problem in emacs mode.
mattmc3 commentedon Jan 8, 2026
Oh, I see - the thinking is that that by putting the cursor in an unexpected place at the top of the first line of a buffer you get a shortcut to keep being able to hit up to cycle through history. One of the problems with that method is you then sacrifice the down arrow, which now has to cycle through the whole multiline buffer if you hit up one too many times and now want to go back down the history.
There are other ways to accomplish this behavior. Using Fish as an example, while you hit up and down it cycles history and the cursor is in the last position, but once you begin editing, then up and down cycle through the lines in the buffer. You can also achieve the same behavior in Zsh with ZLE widgets. See a Zsh example of the behavior I'm after: smart-up-and-down.zsh.
I'll not try to convince anyone that Nushell's default behavior here is a lousy out-of-the-box experience (which is of course subjective), but being able to fix it with a plugin is an objective measure of how capable reedline is. Is there a way to achieve this through nu scripting, even if it doesn't make it into the codebase as a more reasonable default?
fdncred commentedon Jan 8, 2026
I think it'll need to be changed in reedline. @ysthakur do you have any thoughts here? I'd also be up for something similar to @Juhan280's reedline PR but for emacs mode like Ctrl-ArrowDown takes you to the end of the multiline command line, or some such hotkey.
ysthakur commentedon Jan 9, 2026
This sounds like it'd be best and I'd like to do this eventually, but it probably won't be super easy (not an expert here, can't say for sure).
Yeah, that sounds easiest to implement right now. I'll review #953 soon. Then we can do the same for Emacs.
Looks like
Alt+<andAlt+>correspond to "go to beginning of buffer" and "go to end of buffer," respectively (http://xahlee.info/emacs/emacs/emacs_keys_basics.html).