For example, if I find I miss one letter in a long command, currently I need to press ← to move the cursor, which is slow. Why can't we use mouse to put the cursor in the place we want?
-
1Did you try Ctrl - left or Ctrl - right?– user85164Oct 16, 2013 at 4:48
-
1Thank. I knew it. I hope a more flexible move. I think the mouse is much more convenient. I find the python console in PyCharm is as friendly as an editor. But how about other terminals?– user1914692Oct 16, 2013 at 5:27
-
1I would love to know if this was possible with gnome-terminal. Apparently you can do so in OSX: news.ycombinator.com/item?id=7051091.– Fern MossJan 14, 2014 at 6:24
-
For native terminal, you will probably have no luck. See the mouse section in the terminal howto of The Linux Documentation Project.– IzzyJan 16, 2014 at 21:58
5 Answers
Use emacs.
sudo apt-get install emacs
Upon the install, start emacs:
emacs
Press Alt+X, and type term
and press Enter. Voila!
You have a terminal where you can change the cursor position with mouse.
If mouse click does not change the cursor (in 99% of the cases, it will, by default), then put (xterm-mouse-mode t) in your .emacs file:
echo (xterm-mouse-mode t) > ~/.emacs
-
Since there doesn't seem to be a way with gnome-terminal, this seems like the easiest method. Jan 20, 2014 at 2:45
-
I just tried the method. The mouse click does not change the cursor. Then as instructed, I put: echo (xterm-mouse-mode t) > ~/.emacs; The error information is: bash: syntax error near unexpected token `xterm-mouse-mode' (I use Ubuntu 16.04) Aug 14, 2016 at 16:27
The terminal itself can take mouse input. You can test this opening a text file with nano
and enabling mouse
(M-M) Mouse support enable/disable
(On my keyboard that's ESC+M.)
Then you can change the position of the cursor by clicking.
If you are asking about changing the position of cursor in the SHELL, there was a discussion in ubuntuforums mentioning gpm. There is also a duplicate of this question in stackoverflow with some alternatives proposed.
-
1The question is about the shell, specifically moving the cusor position (since you can easily select text with the mouse, for instance, in gnome-terminal). Jan 14, 2014 at 19:53
-
In vi mode (when the the command line behave as vi, enabled by set -o vi
) you can launch a full vi to edit the current line:
Pass in command mode with ESC
, then press v
. and in vi you should be able to use your mouse to move to the expect character.
I don't know if this kind of command exist for the emacs mode (set -o emacs
), the default one.
You can use jupyter qtconsole
with the bash_kernel to accomplish this! Follow the install instructions at github repos in the links provided, then from the terminal run
jupyter console --kernel bash
This will launch an new window with a versatile and powerful shell that has
- mouse cursor positioning
- text selection and editing
- autocomplete
- history
- so much more