18

I use Mac OS X Terminal.app. But the answer to this would probably apply to any typical UNIX-ish terminal emulator in a graphical environment.

Question -- what do I do to: Use my mouse cursor to click on a character-position in the current line of the terminal, and have the terminal's cursor jump to that spot?

Typically, you have to hold down an arrow key to move to the correct cursor position. If you're pasting in a long string of text at the shell prompt, or working in an editor like VI, this can take a long time. I know editors have other navigation keys like jump-words, but I like my mouse cursor.

3 Answers 3

26

vim:

 :set mouse=a
7
  • 1
    At the time this answer was given, Terminal did not support Mouse Reporting, so this answer was invalid—which makes me wonder how it could be the accepted answer. However, as of OS X 10.11 El Capitan, Terminal now supports Mouse Reporting and this will work in Vim.
    – Chris Page
    Oct 13, 2015 at 2:12
  • It would improve this answer to add an explanation of how to use ~/.vimrc to enable Mouse Reporting automatically.
    – Chris Page
    Oct 13, 2015 at 2:13
  • 4
    @ChrisPage: if you want to improve this answer: click the edit link. regarding the "at the time the answer was given the answer was invalid": i would not have given the answer if it would not have worked on my machine at that time. and it worked for OP at that time as well.
    – akira
    Oct 15, 2015 at 9:03
  • You must have had the MouseTerm SIMBL plugin installed. bitheap.org/mouseterm
    – Chris Page
    Jan 15, 2016 at 3:00
  • I really wonder HOW one usefull I'd say ESSENCIAL thing doesn't come ready BY DEFAULT ... Jan 11, 2017 at 18:59
17

In Mac OS X Terminal, you can hold down Option (or Alt) and click, and the typing cursor will move to the mouse cursor.

2

Nano can do this with the '-m' argument.

5
  • At the time this answer was given, Terminal did not support Mouse Reporting, so this answer was invalid. However, as of OS X 10.11 El Capitan, Terminal now supports Mouse Reporting and this will work in Vim.
    – Chris Page
    Oct 13, 2015 at 2:12
  • It would improve this answer to add an explanation of how to use ~/.nanorc to enable Mouse Reporting automatically.
    – Chris Page
    Oct 13, 2015 at 2:14
  • You probably had the MouseTerm SIMBL plugin installed: bitheap.org/mouseterm
    – Chris Page
    Jan 15, 2016 at 3:01
  • 2
    @ChrisPage why is it relevant that the answer was invalid (for you?) at the time it was written, if it worked for OP? Anyhow, remember you can improve answers too, the edit link is right there :)
    – Enrico
    Feb 25, 2017 at 13:33
  • @Enrico Invalid for everyone who did not install third-party software that is not mentioned. That's critical information.
    – Chris Page
    Feb 26, 2021 at 1:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .