Ad blocker interference detected!
Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers
Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.
When you are using another application and select go back to Vim by clicking inside Vim's text area, it not only switches application focus to Vim, but it also moves the cursor to that location. If you don't want the cursor to move, put the following in your vimrc:
augroup NO_CURSOR_MOVE_ON_FOCUS au! au FocusLost * let g:oldmouse=&mouse | set mouse= au FocusGained * if exists('g:oldmouse') | let &mouse=g:oldmouse | unlet g:oldmouse | endif augroup END
Alternatively, if you are on a system which allows this, simply clicking on the GUI window chrome instead of the buffer text should give Vim focus without changing the cursor position.
Nice (although I haven't tested it). This should handle the OP problem, but with split windows, the same issue occurs: After
:split, clicking in a window selects that window and moves the cursor to the position of the click. Perhaps some horrible kludge with WinLeave/WinEnter could be used (save/restore cursor?), although that seems unnecessary or even undesirable. We can simply make it clear exactly what the tip does with another sentence or two. JohnBeckett 07:53, January 4, 2012 (UTC)