5

In Vim I can actually position the cursor in insert-mode using the mouse. So I assume this should (technically) also be enable-able for the bash. Is it possible? This would be quite useful at times when small changes have to be made to very long commands.

(I am using fish actually, but I guess referring to bash I reach a wider audience.)

Raffael
  • 3,731
  • 7
  • 25
  • 38
  • 2
    A quick solution see here: http://askubuntu.com/questions/359686/in-ubuntu-is-there-any-terminal-that-allows-for-the-position-of-the-cursor-to-b – jmunsch Mar 13 '14 at 23:13
  • 1
    From "info readline" character-search `Ctrl+]` A character is read and point is moved to the next occurrence of that character. character-search-backward `Meta+Ctrl+]` A character is read and point is moved to the previous occurrence of that character... Also consider `Ctrl+a` to move to the beginning of line. And `Ctrl+e` to move to the end of line. `Alt+Shift+f` to move forward a word and `Alt+Shift+b` to move back a word. – jmunsch Mar 14 '14 at 00:24
  • 1
    In bash itself - no. There's several layers to have in mind. Mouse support can be done in certain applications (vim, emacs, nano) some of which are built using curses library, but generally shells don't have support for it (and they don't rely on curses library). Additionally, the terminal window has to support that. – Sergiy Kolodyazhnyy Mar 31 '19 at 05:16

1 Answers1

0

Does that work ? It should print escaped sequences on your terminal when using the mouse

echo -e "\e[?1000;1006;1015h" # Enable tracking

If it works : test my script on github

Details : Read my answer in another post

Tinmarino
  • 111
  • 3
  • 1
    think the shebang should be `#!/bin/bash` in your script –  Dec 11 '19 at 05:53
  • 1
    @bacOn, tk for the feedback. Yes my `#!/usr/bin/bash` is bad. I putted: `#!/usr/bin/env bash` as state here https://stackoverflow.com/questions/10376206/what-is-the-preferred-bash-shebang' – Tinmarino Dec 11 '19 at 13:49