Score:1

gnome terminal - How to replace a text selection in currently typed command?

in flag

Default behavior is to append text in the currently typed command:

Behaviour example

In this case I would like to see mkdir music.

  1. Is there an extension that would allow such behavior?

  2. Is there another terminal emulator that can do it?

GNOME Terminal version is 3.44.0 for GNOME 42.

enter image description here

24601 avatar
in flag
which version/distro of Ubuntu are you using with Gnome 42 in place? [edit] your question accordingly.
cn flag
This operation would require such a cooperation between the _terminal emulator_ (where you highlight) and the _shell_ (where you wish to replace) that doesn't exist. Highlighting is an operation performed by the terminal emulator that the shell doesn't know anything about. However, the terminal emulator cannot just update the displayed text unbeknownst to the shell because then the shell's belief would be incorrect, and the terminal emulator cannot figure out on its own how to ask the shell to remove certain characters (the terminal emulator doesn't have the slightest clue what a _shell_ is).
cn flag
You might want to configure your _shell_ to do this, in a slightly different way: use the shell's mechanism to highlight the second word, and use the shell's mechanism to replace that with the clipboard contents (which wouldn't work across ssh). I don't know which shell is configurable to this extent, I'm not familiar with their line editing customization possibilities.
in flag
@graham Are you blind? It literally says *GNOME Terminal version is 3.44.0 for GNOME 42* in the question.
in flag
Oh I am stupid, sry, haven't read your question right, I'll update it.
in flag
@graham Updated it, will add it everytime in the future.
in flag
@egmont Thanks for the inside.
Score:1
cn flag

This is not how it works. The command line is a separate thing with different conventions than these in your graphical desktop environment. A terminal emulator brings that thing into your graphical desktop, but it remains somehow "disconnected". Therefore, pasting will not erase the characters you have selected.

To quickly delete words before pasting alternative text (using the mouse or the keyboard, Ctrl+Shift+V), you can use Ctrl+W or Alt+Backspace.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.