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
I've noticed that if I'm re-running a command with different arguments several times, the argument I want to change isn't always at the end of the buffer. This means I have to spend some time moving the cursor leftwards. This is a hassle if I'm doing it several times. Wouldn't it be cool if fish could remember what the cursor position was when I pressed Enter, and restore it when I recall that command from history?
For example — with █ representing the cursor position — I have this buffer:
~> sudo systemctl status rtl_433@433.service rtl_433@916-scm.service net_metering.service█
If I press Enter and then Up, I get:
~> sudo systemctl status rtl_433@433.service rtl_433@916-scm.service net_metering.service█
So far so good. Next, I move the cursor over to status and replace it with stop. At this point, the buffer looks like:
In this example, it would save me from having to press Shift-Left three times. Some buffers require much more noodling around, especially multi-line buffers. ;-)
Is this somehow possible already, perhaps by hooking commandline -C in to some event? (Disclaimer, I know nothing about events or buffer modification yet.) Suggestions and alternate approaches appreciated. Thanks!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I've noticed that if I'm re-running a command with different arguments several times, the argument I want to change isn't always at the end of the buffer. This means I have to spend some time moving the cursor leftwards. This is a hassle if I'm doing it several times. Wouldn't it be cool if fish could remember what the cursor position was when I pressed Enter, and restore it when I recall that command from history?
For example — with
█
representing the cursor position — I have this buffer:If I press Enter and then Up, I get:
So far so good. Next, I move the cursor over to
status
and replace it withstop
. At this point, the buffer looks like:If I press Enter and then Up, I get:
But next I'm going to change
stop
tostart
, so I'd prefer if fish remembered "where I was", like this:In this example, it would save me from having to press Shift-Left three times. Some buffers require much more noodling around, especially multi-line buffers. ;-)
Is this somehow possible already, perhaps by hooking
commandline -C
in to some event? (Disclaimer, I know nothing about events or buffer modification yet.) Suggestions and alternate approaches appreciated. Thanks!Beta Was this translation helpful? Give feedback.
All reactions