Usually terminals allow text selection with the mouse, but the shell is not made aware of this. So unfortunately neither
es can support mouse-based editing. I think to do so, they would need to take greater control over the terminal.
However (and this is a bit of a stretch) if you open Vim or GVim, and then enter shell commands using:
then you can click your mouse to jump to anywhere in the line. (You will need to
:set mouse=a first if that is not already enabled.) The editing keys in this mode can be seen with
Vim also has quite a powerful command history mode, which can be reached by hitting q:. From there you can yank, delete and paste using Vim's normal-mode commands. In this mode, you can get the select-with-mouse and then delete feature you desire (by hitting d).
A significant caveat here is that Vim does not actually keep a live shell session running. Each command you execute will be run in a child process. So any changes made to environment variables or shell options by the child process will be lost.
That said, you can modify environment variables from within the Vim process, and use these from Vim's command line, and they will even be exported to child processes:
:let $FOO="bar" " the $ and the quotes are mandatory here
:echo $FOO " Vim's own echo command
:!echo "$FOO" " Passing the variable to a shell command
:!bash " Opening a child shell
$ echo "$FOO"
So if you are willing to pretend that Vim is actually some kind of weird shell, then you can enjoy its advanced editing features! Probably the biggest drawback is that you will have to start every command by typing either
Oh and by the way, if you want to get the output of the shell command into your current Vim buffer, you can do that like this (but beware it will clobber your current line):