1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 10:20:05 +08:00

Some fixes for FlyGrep (#3908)

This commit is contained in:
blankname 2020-10-17 00:33:16 -04:00 committed by GitHub
parent 105ba4edb1
commit 3c795e6d42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 7 deletions

View File

@ -38,7 +38,12 @@ main () {
_detect autoload/SpaceVim/api/vim/buffer.vim
_detect autoload/SpaceVim/api/vim/regex.vim
_detect autoload/SpaceVim/api/vim/compatible.vim
_detect autoload/SpaceVim/api/vim/floating.vim
_detect autoload/SpaceVim/api/vim/highlight.vim
_detect autoload/SpaceVim/api/vim/statusline.vim
_detect autoload/SpaceVim/api/vim/window.vim
_detect autoload/SpaceVim/api/neovim/floating.vim
_detect autoload/SpaceVim/api/data/dict.vim
_detect autoload/SpaceVim/api/data/list.vim
_detect autoload/SpaceVim/api/data/json.vim
_detect autoload/SpaceVim/api/prompt.vim
@ -77,21 +82,21 @@ main () {
""
" FlyGrep will start to searching code after a delay, the default value is
" 500ms.
let g:FlyGrep_input_delay = 500
let g:FlyGrep_input_delay = get(g:, 'FlyGrep_input_delay', 500)
""
" A list of searching tools will be userd.
let g:FlyGrep_search_tools = ['ag', 'rg', 'grep', 'pt', 'ack']
let g:FlyGrep_search_tools = get(g:, 'FlyGrep_search_tools', ['ag', 'rg', 'grep', 'pt', 'ack'])
let g:spacevim_data_dir = '~/.cache'
let g:spacevim_data_dir = get(g:, 'spacevim_data_dir', '~/.cache')
""
" Enable FlyGrep statusline
let g:FlyGrep_enable_statusline = 1
let g:FlyGrep_enable_statusline = get(g:, 'FlyGrep_enable_statusline', 1)
""
" Set FlyGrep default command prompt
let g:spacevim_commandline_prompt = '➭'
let g:spacevim_commandline_prompt = get(g:, 'spacevim_commandline_prompt', '➭')
command! -nargs=0 FlyGrep call FlyGrep#open({})
EOT

View File

@ -167,11 +167,13 @@ endfunction
if s:self.__floating.exists()
function! s:self.close_float() abort
call self.__floating.win_close(self.__winid, 1)
if get(self, '__winid', -1) != -1
call self.__floating.win_close(self.__winid, 1)
endif
endfunction
else
function! s:self.close_float() abort
if has_key(self, '__winid') && win_id2tabwin(self.__winid)[0] == tabpagenr()
if get(self, '__winid', -1) != -1 && win_id2tabwin(self.__winid)[0] == tabpagenr()
noautocmd execute win_id2win(self.__winid).'wincmd w'
noautocmd close
endif

View File

@ -913,6 +913,10 @@ endfunction
" }}}
function! s:update_statusline() abort
if !g:FlyGrep_enable_statusline
return
endif
if s:SL.support_float() && win_id2tabwin(s:flygrep_win_id)[0] ==# tabpagenr() && s:Window.is_float(win_id2win(s:flygrep_win_id))
noautocmd call s:SL.open_float([
\ ['FlyGrep ', 'SpaceVim_statusline_a_bold'],