From fd479f7523e9adf4f2e5dd8544ed6600e95ea8eb Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 1 May 2018 14:55:09 +0800 Subject: [PATCH] Fix flygrep --- autoload/SpaceVim/mapping/space.vim | 7 +++++-- autoload/SpaceVim/plugins/flygrep.vim | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/autoload/SpaceVim/mapping/space.vim b/autoload/SpaceVim/mapping/space.vim index b179eca2f..9df7eec03 100644 --- a/autoload/SpaceVim/mapping/space.vim +++ b/autoload/SpaceVim/mapping/space.vim @@ -199,9 +199,12 @@ function! SpaceVim#mapping#space#init() abort \ . " expand(\"\"), 'dir' : input(\"arbitrary dir:\", '', 'dir')})", \ 'grep cursor word in arbitrary directory', 1) " Searching in project - call SpaceVim#mapping#space#def('nnoremap', ['s', 'p'], "call SpaceVim#plugins#flygrep#open({'input' : input(\"grep pattern:\")})", + call SpaceVim#mapping#space#def('nnoremap', ['s', 'p'], + \ 'call SpaceVim#plugins#flygrep#open(' . + \ "{'input' : input(\"grep pattern:\"), 'dir' : get(b:, \"rootDir\", getcwd())})", \ 'grep in project', 1) - call SpaceVim#mapping#space#def('nnoremap', ['s', 'P'], "call SpaceVim#plugins#flygrep#open({'input' : expand(\"\")})", + call SpaceVim#mapping#space#def('nnoremap', ['s', 'P'], + \ "call SpaceVim#plugins#flygrep#open({'input' : expand(\"\"), 'dir' : get(b:, \"rootDir\", getcwd())})", \ 'grep cursor word in project', 1) " Searching background call SpaceVim#mapping#space#def('nnoremap', ['s', 'j'], diff --git a/autoload/SpaceVim/plugins/flygrep.vim b/autoload/SpaceVim/plugins/flygrep.vim index 20c8be571..03b18f64a 100644 --- a/autoload/SpaceVim/plugins/flygrep.vim +++ b/autoload/SpaceVim/plugins/flygrep.vim @@ -172,8 +172,8 @@ function! s:close_buffer() abort if s:grep_timer_id != 0 call timer_stop(s:grep_timer_id) endif - pclose - q + noautocmd pclose + noautocmd q endfunction let s:MPT._onclose = function('s:close_buffer') " }}} @@ -415,7 +415,7 @@ function! SpaceVim#plugins#flygrep#open(agrv) abort let s:mode = '' " set default handle func: s:flygrep let s:MPT._handle_fly = function('s:flygrep') - rightbelow split __flygrep__ + noautocmd rightbelow split __flygrep__ let s:flygrep_buffer_id = bufnr('%') setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber let save_tve = &t_ve