" plugin/mouse_toggle.vim " mouse_toggle -> toggle 'mouse' option " m -> mouse_toggle " Written by Kobus Retief if !has("mouse") finish endif if exists("loaded_mouse_toggle") finish endif let loaded_mouse_toggle = 1 let s:save_cpo = &cpo set cpo&vim let s:oldmouse = exists("mouse_default") ? mouse_default : "a" function s:mouse_toggle() if &mouse == "" let &mouse = s:oldmouse echo "mouse enabled (=" . &mouse . ")" else let s:oldmouse = &mouse let &mouse = "" echo "mouse disabled" endif endfunction nnoremap mouse_toggle :call mouse_toggle() if ! hasmapto("mouse_toggle") map m mouse_toggle endif let &cpo = s:save_cpo unlet s:save_cpo