VIM and putty - mouse issues
i'm not very experienced in VIM. i'm using VIM with putty, and i often use mouse scroll and move text cursor with mouse. also sometimes i need to paste some code from windows clipboard, so i have to type ":set mouse=" to turn off mouse handling in VIM, paste the code with right mouse button and then turn mouse handling on again with ":set mouse=a". i'm looking for a better way to do it.
Simply by <Shift> + LeftMouse
to do a selection, <Shift> + RightMouse
to paste your code as usual (set mouse="" state)
Here's an excerpt from my vimrc. It maps a key to toggle the mouse mode between vim and external handling ("a" and ""). It's mapped twice so that it works both in normal and input mode, and it echoes which mode you've ended up in (though that'll be obscured in insert mode if you have showmode turned on).
" toggle between terminal and vim mouse
map <silent><F12> :let &mouse=(&mouse == "a"?"":"a")<CR>:call ShowMouseMode()<CR>
imap <silent><F12> :let &mouse=(&mouse == "a"?"":"a")<CR>:call ShowMouseMode()<CR>
function ShowMouseMode()
if (&mouse == 'a')
echo "mouse-vim"
else
echo "mouse-xterm"
endif
endfunction