Set prev jump point on mouse click
dblume

dblume commited on 2025-01-10 13:02:28
Showing 2 changed files, with 5 additions and 0 deletions.


Now that I've enabled mouse in vim, I sometimes want to just
return the cursor to where it was when I've clicked the terminal
window to foreground it. This lets a jump point so I can <c-i/o>
back where I want.
... ...
@@ -99,6 +99,9 @@ au InsertLeave * hi statusline term=bold,reverse cterm=bold,reverse ctermfg=23 c
99 99
 " See https://neovim.io/doc/user/vim_diff.html#_default-mouse
100 100
 " set mouse=  " neovim defaults to nvi
101 101
 
102
+" Set jump point from before mouse click.
103
+nnoremap <LeftMouse> m'<LeftMouse>
104
+
102 105
 " Make c-] show a list of tags, or jump straight if only single tag
103 106
 " Note cscope_maps plugin might map c-].
104 107
 nnoremap <c-]> g<c-]>
... ...
@@ -107,6 +107,8 @@ au InsertEnter * hi statusline guibg=Cyan ctermfg=25 guifg=Black ctermbg=248
107 107
 au InsertLeave * hi statusline term=bold,reverse cterm=bold,reverse ctermfg=23 ctermbg=250 guifg=black guibg=#c2bfa5
108 108
 
109 109
 set mouse=nvi  " Matches neovim's default
110
+" Set jump point from before mouse click.
111
+nnoremap <LeftMouse> m'<LeftMouse>
110 112
 
111 113
 set tags=tags;/
112 114
 
113 115