vim mouse events in insert mode improvement
dblume

dblume commited on 2025-01-24 15:11:12
Showing 2 changed files, with 2 additions and 0 deletions.


Turns out I don't like the mouse moving the cursor while in insert mode.
Probably because I lost mental context of what I was doing if I was
in a different window and I'm clicking back to vim.

So now switch to normal mode and set a jump point. That way I can just
either:
  * Switch back to insert mode where I am.
  * <C-o> to return to where the insert point previously was.
... ...
@@ -101,6 +101,7 @@ au InsertLeave * hi statusline term=bold,reverse cterm=bold,reverse ctermfg=23 c
101 101
 
102 102
 " Set jump point from before mouse click.
103 103
 nnoremap <LeftMouse> m'<LeftMouse>
104
+inoremap <LeftMouse> <Esc>m'<LeftMouse>
104 105
 
105 106
 " Make c-] show a list of tags, or jump straight if only single tag
106 107
 " Note cscope_maps plugin might map c-].
... ...
@@ -109,6 +109,7 @@ au InsertLeave * hi statusline term=bold,reverse cterm=bold,reverse ctermfg=23 c
109 109
 set mouse=nvi  " Matches neovim's default
110 110
 " Set jump point from before mouse click.
111 111
 nnoremap <LeftMouse> m'<LeftMouse>
112
+inoremap <LeftMouse> <Esc>m'<LeftMouse>
112 113
 
113 114
 set tags=tags;/
114 115
 
115 116