From 103fe0763cb0c0b3869060c73fae3ba13bb84dcb Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Sat, 8 Jun 2019 20:57:16 +0800 Subject: [PATCH] Use 2-leftmouse to toggle tree ref: https://github.com/Shougo/defx.nvim/issues/135 --- config/plugins/defx.vim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/config/plugins/defx.vim b/config/plugins/defx.vim index 1ba504565..520437641 100644 --- a/config/plugins/defx.vim +++ b/config/plugins/defx.vim @@ -99,8 +99,13 @@ function! s:defx_init() \ defx#is_directory() ? \ defx#do_action('open_directory') : defx#do_action('drop') nnoremap <2-LeftMouse> - \ defx#is_directory() ? - \ defx#do_action('open_tree') : defx#do_action('drop') + \ defx#is_directory() ? + \ ( + \ defx#is_opened_tree() ? + \ defx#do_action('close_tree') : + \ defx#do_action('open_tree') + \ ) + \ : defx#do_action('drop') nnoremap sg \ defx#do_action('drop', 'vsplit') nnoremap sv