mirror of
https://github.com/chenasraf/vim-matchup.git
synced 2026-05-18 01:38:57 +00:00
Allow double click to select to match
This commit is contained in:
@@ -129,6 +129,10 @@ function! s:init_default_mappings()
|
||||
" call s:map('i', '<c-x><cr>', '<plug>(matchup-delim-close)')
|
||||
" XXX other maps..?
|
||||
endif
|
||||
|
||||
if get(g:, 'matchup_mouse_enabled', 1)
|
||||
call s:map('n', '<2-LeftMouse>', '<plug>(matchup-double-click)')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let s:modules = map(
|
||||
|
||||
@@ -21,6 +21,9 @@ function! matchup#text_obj#init_module() " {{{1
|
||||
execute 'o' . l:p1 . 'i' . l:p2 . '(1, 0' . l:p3
|
||||
execute 'o' . l:p1 . 'a' . l:p2 . '(0, 0' . l:p3
|
||||
endfor
|
||||
|
||||
nnoremap <silent> <plug>(matchup-double-click)
|
||||
\ :<c-u>call matchup#text_obj#double_click()<cr>
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
@@ -176,6 +179,15 @@ function! matchup#text_obj#delimited(is_inner, visual, type) " {{{1
|
||||
call matchup#pos#set_cursor(l:l2, l:c2)
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
function! matchup#text_obj#double_click() " {{{1
|
||||
if empty(matchup#delim#get_current('all', 'both_all'))
|
||||
execute "normal! \<2-LeftMouse>"
|
||||
else
|
||||
execute "normal v1\<plug>(matchup-a%)"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
|
||||
Reference in New Issue
Block a user