bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fg via keybind modifies tty settings


From: Martin D Kealey
Subject: Re: fg via keybind modifies tty settings
Date: Mon, 18 Nov 2024 14:49:32 +1000

On Sun, 17 Nov 2024 at 04:52, David Moberg <kaddkaka@gmail.com> wrote:

> That looks very complicated, how do interpret that? And where/when to run
> it?
>
To me this seems to have taken a wrong turn before the question was even
asked.

Just because readline has a "run a command" mode does NOT mean it's
necessarily the appropriate way to invoke the 'fg' command. As clearly
shown in the manual, there's a whole bunch of stuff around bind -x that's
intended to support invoking a command *as a way to do specialised editing
within the command line.*

This is clearly *not* "editing within the command line", so just do it the
old fashioned way, with a macro:

bind -m emacs '"\C-_":"\C-e\C-ufg\n"'
bind -m vi '"\C-_": "ddafg\C-j"'
bind -m vi-insert '"\C-_":"\e0Cfg\n"'

(Choose your own preferred key instead of ctrl-_ of course)

These all do the same thing in different input modes: erase the current
line, then type "fg" and enter it. (If you actually want to keep the text
that was in the edit buffer, you can just paste it back in at the next
prompt; ctrl-Y ("yank") in emacs mode, and p or P ("put") in vi mode.)

-Martin


reply via email to

[Prev in Thread] Current Thread [Next in Thread]