From 254d4491182c09759f9fd8b0ec0df7be620267fc Mon Sep 17 00:00:00 2001 From: Von Random Date: Mon, 6 Mar 2017 12:10:51 +0300 Subject: [PATCH] move togglemouse into vimrc, fix compatibility --- vimplugins | 4 ---- vimrc | 25 +++++++++++++++++++++---- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/vimplugins b/vimplugins index e8201db..5535aa3 100644 --- a/vimplugins +++ b/vimplugins @@ -14,7 +14,6 @@ Plug 'ervandew/supertab' Plug 'jeetsukumaran/vim-buffergator' Plug 'junegunn/vim-easy-align' Plug 'mhinz/vim-signify' -Plug 'nvie/vim-togglemouse' Plug 'tpope/vim-fugitive' Plug 'tpope/vim-sleuth' Plug 'vimwiki/vimwiki' @@ -35,9 +34,6 @@ call plug#end() let g:signify_vcs_list=[ 'git', 'fossil' ] let g:signify_sign_change='~' -" vim-togglemouse options -nmap m - " easy-align options xmap a (EasyAlign) nmap a (EasyAlign) diff --git a/vimrc b/vimrc index 658bb52..84b8e09 100644 --- a/vimrc +++ b/vimrc @@ -1,6 +1,6 @@ " various settings set nobackup number nomodeline cursorline backspace=indent,eol,start -set formatoptions+=j foldmethod=marker ttymouse=xterm2 mouse= +set foldmethod=marker ttymouse=xterm2 mouse= " hidden characters set list listchars=tab:\|_,nbsp:x,trail:* " search @@ -20,11 +20,10 @@ set statusline=[%F]\ %R%H%W%M\ %=[%{&fenc}/%{&ff}]\ %y\ [%4l/%L:%3v] let g:sh_indent_case_labels=1 " version specific settings if v:version >= 703 - set colorcolumn=80 relativenumber + set colorcolumn=80 relativenumber formatoptions+=j endif if v:version >= 800 - set breakindent - set keymap=russian-jcukenwintype iminsert=0 imsearch=0 + set breakindent keymap=russian-jcukenwintype iminsert=0 imsearch=0 inoremap cnoremap inoremap @@ -68,6 +67,24 @@ nnoremap qa :qa nnoremap qs :wq nnoremap s :w +" mouse toggle +fun! s:ToggleMouse() + if !exists("s:old_mouse") + let s:old_mouse = "a" + endif + + if &mouse == "" + let &mouse = s:old_mouse + echo "mouse enabled (" . &mouse . ")" + else + let s:old_mouse = &mouse + let &mouse="" + echo "mouse disabled" + endif +endfunction +noremap m :call ToggleMouse() +inoremap m :call ToggleMouse()a + " plugins let plugins = expand("$HOME/.vimplugins") if filereadable(plugins) && v:version >= 703