From c892ce225ca2f4bb7595a59bca85898c8765395b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 31 Jan 2025 12:56:10 +0800 Subject: [PATCH] docs(flygrep): add `flygrep_next_version` opt --- autoload/SpaceVim.vim | 3 +++ autoload/SpaceVim/layers/core.vim | 3 +++ autoload/SpaceVim/mapping/space.vim | 9 +++++++-- docs/documentation.md | 8 ++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index f9b00d189..9e9a21f2d 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -1334,6 +1334,9 @@ let g:spacevim_lint_on_save = 1 " Default search tools supported by flygrep. The default order is ['rg', 'ag', " 'pt', 'ack', 'grep', 'findstr', 'git'] let g:spacevim_search_tools = ['rg', 'ag', 'pt', 'ack', 'grep', 'findstr', 'git'] + +let g:spacevim_flygrep_next_version = v:false + "" " @section project_rooter_patterns, options-project_rooter_patterns " @parentsection options diff --git a/autoload/SpaceVim/layers/core.vim b/autoload/SpaceVim/layers/core.vim index 4476be858..68733b0b3 100644 --- a/autoload/SpaceVim/layers/core.vim +++ b/autoload/SpaceVim/layers/core.vim @@ -250,6 +250,9 @@ function! SpaceVim#layers#core#plugins() abort if s:enable_winbar call add(plugins, [g:_spacevim_root_dir . 'bundle/winbar.nvim' , { 'merged' : 0} ]) endif + if g:spacevim_flygrep_next_version + call add(plugins, [g:_spacevim_root_dir . 'bundle/flygrep.nvim' , { 'merged' : 0} ]) + endif return plugins endfunction diff --git a/autoload/SpaceVim/mapping/space.vim b/autoload/SpaceVim/mapping/space.vim index 895ae35d8..738912bdb 100644 --- a/autoload/SpaceVim/mapping/space.vim +++ b/autoload/SpaceVim/mapping/space.vim @@ -637,8 +637,13 @@ function! SpaceVim#mapping#space#init() abort call SpaceVim#mapping#space#def('nnoremap', ['s', 't', 'J'], 'call SpaceVim#plugins#searcher#find(expand(""), "pt")', \ 'Background search cursor words in project with pt', 1) - call SpaceVim#mapping#space#def('nnoremap', ['s', '/'], 'call SpaceVim#plugins#flygrep#open({})', - \ 'grep-on-the-fly', 1) + if g:spacevim_flygrep_next_version + call SpaceVim#mapping#space#def('nnoremap', ['s', '/'], 'FlyGrep', + \ 'grep-on-the-fly', 1) + else + call SpaceVim#mapping#space#def('nnoremap', ['s', '/'], 'call SpaceVim#plugins#flygrep#open({})', + \ 'grep-on-the-fly', 1) + endif call SpaceVim#mapping#space#def('nnoremap', ['s', 'c'], 'call SpaceVim#plugins#searcher#clear()', \ 'clear-search-results', 1) diff --git a/docs/documentation.md b/docs/documentation.md index 2e78022c7..b41cbdd09 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -1787,6 +1787,14 @@ Key bindings in FlyGrep buffer: | `Ctrl-a` / `` | Go to the beginning of the line | | `Ctrl-e` / `` | Go to the end of the line | +The next version of FlyGrep.vim is WIP, If you want to have a try. Set `flygrep_next_version` to `true`. +This option maybe removed when `flygrep.nvim` development is done. + +``` +[options] + flygrep_next_version = true +``` + #### Persistent highlighting SpaceVim uses `search_highlight_persist` to keep the searched expression highlighted until the next search.