Is there a way for clicking on a Vim window to focus that window if inactive (without moving the cursor), then move the cursor if the window is already active?
Here's what I've got so far:
noremap <expr> <LeftMouse> IsWinFocused() ? '<LeftMouse>' : '<LeftMouse>`m'
au BufLeave * mark m
Which leaves a marker behind as you leave a window, then comes back to it after rejoining the window.
But this isn't ideal as you have to have unfocused the window since opening it in order for focusing it to work properly, and if that's not the case it could yeet you into the depths of a file if marker m was in prior use.
Also I'm not a huge fan of seeing the window jump to where I clicked and back every time I focus a window
Edit: using Neovim wrapped in Nvy on Windows 11