Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Point and click, or generally move the cursor to where you're looking in Vim

Tags:

vim

I am currently learning to use Vim. It has been a very good experience so far and I believe the Vim approach to be generally much more powerful than GUI based text editors.

There is however one feature that I miss. I sometimes have to read my document to correct potential mistakes. If I spot a mistake I need to move quickly to the position of the mistake, say in a middle of a sentence. In a standard text editor I will reach briefly for the mouse and point/click to move the cursor to this position.

This is slow, but in VIM it will take me much longer. Generally it is impractical to search for the word, because it may have spelling mistakes or occur many times. The fastest way I found is move to the line using line numbers, then move across sentences, then words, then letters. It is still much slower than reaching for the mouse, pointing and clicking.

My question is two-fold: is there a way to click with the mouse to move the cursor in Vim? I know that's not really the spirit but I think it could be useful occasionally. If not, am I doing something wrong? How do Vim users generally handle this problem of moving to a specific word you're looking at, far from where the cursor currently is, for example when you're reading back what you typed for mistakes?

Thanks

like image 230
user1188374 Avatar asked Feb 19 '15 20:02

user1188374


People also ask

Which key command in vim editor is used to move the cursor left of the screen?

The keys h , j , k , and l , right under your fingertips, will move the cursor: h. left, one space.

Which command in vi editor will move the cursor down?

j : Moves the cursor down one line. h : Moves the cursor to the left one character position. l : Moves the cursor to the right one character position. 0 or | : Positions cursor at beginning of line.


1 Answers

If your terminal supports it adding

set mouse=a 

to your vimrc will enable mouse support.

like image 146
FDinoff Avatar answered Oct 12 '22 14:10

FDinoff