mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-23 17:49:57 +08:00
Add git-grep support (#3717)
This commit is contained in:
parent
1288ecd44f
commit
752b81feeb
@ -1008,9 +1008,21 @@ let g:spacevim_enable_powerline_fonts = 1
|
|||||||
" <
|
" <
|
||||||
let g:spacevim_lint_on_save = 1
|
let g:spacevim_lint_on_save = 1
|
||||||
""
|
""
|
||||||
|
" @section search_tools, options-search_tools
|
||||||
|
" @parentsection options
|
||||||
" Default search tools supported by flygrep. The default order is ['rg', 'ag',
|
" Default search tools supported by flygrep. The default order is ['rg', 'ag',
|
||||||
" 'pt', 'ack', 'grep', 'findstr']
|
" 'pt', 'ack', 'grep', 'findstr', 'git']
|
||||||
let g:spacevim_search_tools = ['rg', 'ag', 'pt', 'ack', 'grep', 'findstr']
|
" The `git` command means using `git-grep`. If you prefer to use `git-grep` by
|
||||||
|
" default. You can change this option to:
|
||||||
|
" >
|
||||||
|
" [options]
|
||||||
|
" search_tools = ['git', 'rg', 'ag']
|
||||||
|
" <
|
||||||
|
|
||||||
|
""
|
||||||
|
" 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']
|
||||||
""
|
""
|
||||||
" Set the project rooter patterns, by default it is
|
" Set the project rooter patterns, by default it is
|
||||||
" `['.git/', '_darcs/', '.hg/', '.bzr/', '.svn/']`
|
" `['.git/', '_darcs/', '.hg/', '.bzr/', '.svn/']`
|
||||||
@ -1407,7 +1419,8 @@ endfunction
|
|||||||
|
|
||||||
""
|
""
|
||||||
" @section Usage, usage
|
" @section Usage, usage
|
||||||
" the usage guide for SpaceVim
|
" General guide for using SpaceVim. Including layer configuration, bootstrap
|
||||||
|
" function.
|
||||||
|
|
||||||
""
|
""
|
||||||
" @section FAQ, faq
|
" @section FAQ, faq
|
||||||
|
@ -11,15 +11,24 @@
|
|||||||
" @parentsection api
|
" @parentsection api
|
||||||
" @subsection Intro
|
" @subsection Intro
|
||||||
"
|
"
|
||||||
" vim#window API provides some basic functions for setting and getting config
|
" `vim#window` API provides some basic functions for setting and getting config
|
||||||
" of vim window.
|
" of vim window.
|
||||||
"
|
"
|
||||||
" @subsection Functions
|
" @subsection Functions
|
||||||
"
|
"
|
||||||
" get_cursor({winid})
|
" get_cursor({winid})
|
||||||
"
|
"
|
||||||
" Gets the cursor position in the window {winid}, to get the ID of a window,
|
" Gets the cursor position in the window {winid}, to get the ID of a window,
|
||||||
" checkout |window-ID|.
|
" checkout |window-ID|.
|
||||||
|
"
|
||||||
|
" set_cursor({winid}, {pos})
|
||||||
|
"
|
||||||
|
" Sets the cursor position to {pos} in the window {winid}.
|
||||||
|
"
|
||||||
|
" is_float({winnr})
|
||||||
|
"
|
||||||
|
" Check if the window is a floating windows, return `v:true` if the window
|
||||||
|
" is a floating window.
|
||||||
|
|
||||||
let s:self = {}
|
let s:self = {}
|
||||||
|
|
||||||
|
@ -77,6 +77,16 @@ let s:search_tools.g.default_fopts = []
|
|||||||
let s:search_tools.g.smart_case = []
|
let s:search_tools.g.smart_case = []
|
||||||
let s:search_tools.g.ignore_case = ['-i']
|
let s:search_tools.g.ignore_case = ['-i']
|
||||||
|
|
||||||
|
let s:search_tools.G = {}
|
||||||
|
let s:search_tools.G.command = 'git'
|
||||||
|
let s:search_tools.G.default_opts = ['grep', '-n', '--column']
|
||||||
|
let s:search_tools.G.expr_opt = ['-E']
|
||||||
|
let s:search_tools.G.fixed_string_opt = ['-F']
|
||||||
|
let s:search_tools.G.recursive_opt = ['.']
|
||||||
|
let s:search_tools.G.default_fopts = []
|
||||||
|
let s:search_tools.G.smart_case = []
|
||||||
|
let s:search_tools.G.ignore_case = ['-i']
|
||||||
|
|
||||||
let s:search_tools.i = {}
|
let s:search_tools.i = {}
|
||||||
let s:search_tools.i.command = 'findstr'
|
let s:search_tools.i.command = 'findstr'
|
||||||
let s:search_tools.i.default_opts = ['/RSN']
|
let s:search_tools.i.default_opts = ['/RSN']
|
||||||
|
@ -420,6 +420,23 @@ function! SpaceVim#mapping#space#init() abort
|
|||||||
\ 'Background search cursor words in project with grep', 1)
|
\ 'Background search cursor words in project with grep', 1)
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'g', 'J'], 'call SpaceVim#plugins#searcher#find(expand("<cword>"), "grep")',
|
call SpaceVim#mapping#space#def('nnoremap', ['s', 'g', 'J'], 'call SpaceVim#plugins#searcher#find(expand("<cword>"), "grep")',
|
||||||
\ 'Background search cursor words in project with grep', 1)
|
\ 'Background search cursor words in project with grep', 1)
|
||||||
|
" git grep
|
||||||
|
let g:_spacevim_mappings_space.s.G = {'name' : '+git grep'}
|
||||||
|
call SpaceVim#mapping#space#def('nnoremap', ['s', 'G', 'b'], 'call SpaceVim#mapping#search#grep("G", "b")',
|
||||||
|
\ 'search in all buffers with git-grep', 1)
|
||||||
|
call SpaceVim#mapping#space#def('nnoremap', ['s', 'G', 'B'], 'call SpaceVim#mapping#search#grep("G", "B")',
|
||||||
|
\ 'search cursor word in all buffers with git-grep', 1)
|
||||||
|
call SpaceVim#mapping#space#def('nnoremap', ['s', 'G', 'd'], 'call SpaceVim#mapping#search#grep("G", "d")', 'search in buffer directory with grep', 1)
|
||||||
|
call SpaceVim#mapping#space#def('nnoremap', ['s', 'G', 'D'], 'call SpaceVim#mapping#search#grep("G", "D")',
|
||||||
|
\ 'search cursor word in buffer directory with git-grep', 1)
|
||||||
|
call SpaceVim#mapping#space#def('nnoremap', ['s', 'G', 'p'], 'call SpaceVim#mapping#search#grep("G", "p")', 'search in project with git-grep', 1)
|
||||||
|
call SpaceVim#mapping#space#def('nnoremap', ['s', 'G', 'P'], 'call SpaceVim#mapping#search#grep("G", "P")',
|
||||||
|
\ 'search cursor word in project with git-grep', 1)
|
||||||
|
call SpaceVim#mapping#space#def('nnoremap', ['s', 'G', 'f'], 'call SpaceVim#mapping#search#grep("G", "f")',
|
||||||
|
\ 'search in arbitrary directory with git-grep', 1)
|
||||||
|
call SpaceVim#mapping#space#def('nnoremap', ['s', 'G', 'F'], 'call SpaceVim#mapping#search#grep("G", "F")',
|
||||||
|
\ 'search cursor word in arbitrary directory with git-grep', 1)
|
||||||
|
|
||||||
" ack
|
" ack
|
||||||
let g:_spacevim_mappings_space.s.k = {'name' : '+ack'}
|
let g:_spacevim_mappings_space.s.k = {'name' : '+ack'}
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'k', 'b'], 'call SpaceVim#mapping#search#grep("k", "b")', 'search in all buffers with ack', 1)
|
call SpaceVim#mapping#space#def('nnoremap', ['s', 'k', 'b'], 'call SpaceVim#mapping#search#grep("k", "b")', 'search in all buffers with ack', 1)
|
||||||
|
@ -58,18 +58,19 @@ CONTENTS *SpaceVim-contents*
|
|||||||
38. realtime_leader_guide.......|SpaceVim-options-realtime_leader_guide|
|
38. realtime_leader_guide.......|SpaceVim-options-realtime_leader_guide|
|
||||||
39. relativenumber.....................|SpaceVim-options-relativenumber|
|
39. relativenumber.....................|SpaceVim-options-relativenumber|
|
||||||
40. retry_cnt...............................|SpaceVim-options-retry_cnt|
|
40. retry_cnt...............................|SpaceVim-options-retry_cnt|
|
||||||
41. sidebar_width.......................|SpaceVim-options-sidebar_width|
|
41. search_tools.........................|SpaceVim-options-search_tools|
|
||||||
42. snippet_engine.....................|SpaceVim-options-snippet_engine|
|
42. sidebar_width.......................|SpaceVim-options-sidebar_width|
|
||||||
43. statusline_iseparator.......|SpaceVim-options-statusline_iseparator|
|
43. snippet_engine.....................|SpaceVim-options-snippet_engine|
|
||||||
44. statusline_left_sections.|SpaceVim-options-statusline_left_sections|
|
44. statusline_iseparator.......|SpaceVim-options-statusline_iseparator|
|
||||||
45. statusline_separator.........|SpaceVim-options-statusline_separator|
|
45. statusline_left_sections.|SpaceVim-options-statusline_left_sections|
|
||||||
46. terminal_cursor_shape.......|SpaceVim-options-terminal_cursor_shape|
|
46. statusline_separator.........|SpaceVim-options-statusline_separator|
|
||||||
47. vim_help_language...............|SpaceVim-options-vim_help_language|
|
47. terminal_cursor_shape.......|SpaceVim-options-terminal_cursor_shape|
|
||||||
48. vimcompatible.......................|SpaceVim-options-vimcompatible|
|
48. vim_help_language...............|SpaceVim-options-vim_help_language|
|
||||||
49. warning_symbol.....................|SpaceVim-options-warning_symbol|
|
49. vimcompatible.......................|SpaceVim-options-vimcompatible|
|
||||||
50. windows_index_type.............|SpaceVim-options-windows_index_type|
|
50. warning_symbol.....................|SpaceVim-options-warning_symbol|
|
||||||
51. windows_leader.....................|SpaceVim-options-windows_leader|
|
51. windows_index_type.............|SpaceVim-options-windows_index_type|
|
||||||
52. windows_smartclose.............|SpaceVim-options-windows_smartclose|
|
52. windows_leader.....................|SpaceVim-options-windows_leader|
|
||||||
|
53. windows_smartclose.............|SpaceVim-options-windows_smartclose|
|
||||||
3. Configuration...........................................|SpaceVim-config|
|
3. Configuration...........................................|SpaceVim-config|
|
||||||
4. Commands..............................................|SpaceVim-commands|
|
4. Commands..............................................|SpaceVim-commands|
|
||||||
5. Functions............................................|SpaceVim-functions|
|
5. Functions............................................|SpaceVim-functions|
|
||||||
@ -538,6 +539,18 @@ to 0 to disable this feature, or you can set to another number.
|
|||||||
update_retry_cnt = 3
|
update_retry_cnt = 3
|
||||||
<
|
<
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
SEARCH_TOOLS *SpaceVim-options-search_tools*
|
||||||
|
|
||||||
|
Default search tools supported by flygrep. The default order is ['rg', 'ag',
|
||||||
|
'pt', 'ack', 'grep', 'findstr', 'git'] The `git` command means using
|
||||||
|
`git-grep`. If you prefer to use `git-grep` by default. You can change this
|
||||||
|
option to:
|
||||||
|
>
|
||||||
|
[options]
|
||||||
|
search_tools = ['git', 'rg', 'ag']
|
||||||
|
<
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
SIDEBAR_WIDTH *SpaceVim-options-sidebar_width*
|
SIDEBAR_WIDTH *SpaceVim-options-sidebar_width*
|
||||||
|
|
||||||
@ -1131,7 +1144,7 @@ Enable/Disable lint on save feature of SpaceVim's maker. Default is 1.
|
|||||||
|
|
||||||
*g:spacevim_search_tools*
|
*g:spacevim_search_tools*
|
||||||
Default search tools supported by flygrep. The default order is ['rg', 'ag',
|
Default search tools supported by flygrep. The default order is ['rg', 'ag',
|
||||||
'pt', 'ack', 'grep', 'findstr']
|
'pt', 'ack', 'grep', 'findstr', 'git']
|
||||||
|
|
||||||
*g:spacevim_project_rooter_patterns*
|
*g:spacevim_project_rooter_patterns*
|
||||||
Set the project rooter patterns, by default it is `['.git/', '_darcs/',
|
Set the project rooter patterns, by default it is `['.git/', '_darcs/',
|
||||||
@ -3301,7 +3314,8 @@ This layer provides Zeal integration for SpaceVim
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
USAGE *SpaceVim-usage*
|
USAGE *SpaceVim-usage*
|
||||||
|
|
||||||
the usage guide for SpaceVim
|
General guide for using SpaceVim. Including layer configuration, bootstrap
|
||||||
|
function.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
CUSTOM_PLUGINS *SpaceVim-usage-custom_plugins*
|
CUSTOM_PLUGINS *SpaceVim-usage-custom_plugins*
|
||||||
@ -3527,16 +3541,25 @@ VIM#BUFFER *SpaceVim-api-vim-window*
|
|||||||
|
|
||||||
INTRO
|
INTRO
|
||||||
|
|
||||||
vim#window API provides some basic functions for setting and getting config of
|
`vim#window` API provides some basic functions for setting and getting config
|
||||||
vim window.
|
of vim window.
|
||||||
|
|
||||||
FUNCTIONS
|
FUNCTIONS
|
||||||
|
|
||||||
get_cursor({winid})
|
get_cursor({winid})
|
||||||
|
|
||||||
Gets the cursor position in the window {winid}, to get the ID of a window,
|
Gets the cursor position in the window {winid}, to get the ID of a window,
|
||||||
checkout |window-ID|.
|
checkout |window-ID|.
|
||||||
|
|
||||||
|
set_cursor({winid}, {pos})
|
||||||
|
|
||||||
|
Sets the cursor position to {pos} in the window {winid}.
|
||||||
|
|
||||||
|
is_float({winnr})
|
||||||
|
|
||||||
|
Check if the window is a floating windows, return `v:true` if the window
|
||||||
|
is a floating window.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
VIM#COMMAND *SpaceVim-api-vim-command*
|
VIM#COMMAND *SpaceVim-api-vim-command*
|
||||||
|
|
||||||
|
@ -445,7 +445,7 @@ SpaceVim 在终端下默认使用了真色,因此使用之前需要确认下
|
|||||||
| `SPC t i` | 切换显示当前对齐(TODO) |
|
| `SPC t i` | 切换显示当前对齐(TODO) |
|
||||||
| `SPC t n` | 显示/隐藏行号 |
|
| `SPC t n` | 显示/隐藏行号 |
|
||||||
| `SPC t b` | 切换背景色 |
|
| `SPC t b` | 切换背景色 |
|
||||||
| `SPC t c` | 切换 conceal 模式 |
|
| `SPC t c` | 切换 conceal 模式 |
|
||||||
| `SPC t p` | 切换 paste 模式 |
|
| `SPC t p` | 切换 paste 模式 |
|
||||||
| `SPC t t` | 打开 Tab 管理器 |
|
| `SPC t t` | 打开 Tab 管理器 |
|
||||||
| `SPC T ~` | 显示/隐藏 Buffer 结尾空行行首的 `~` |
|
| `SPC T ~` | 显示/隐藏 Buffer 结尾空行行首的 `~` |
|
||||||
@ -1258,13 +1258,14 @@ SpaceVim 中的搜索命令以 `SPC s` 为前缀,前一个键是使用的工
|
|||||||
|
|
||||||
下表是全部的工具键:
|
下表是全部的工具键:
|
||||||
|
|
||||||
| 工具 | 键 |
|
| 工具 | 键 |
|
||||||
| ---- | --- |
|
| -------- | --- |
|
||||||
| ag | a |
|
| ag | a |
|
||||||
| grep | g |
|
| grep | g |
|
||||||
| ack | k |
|
| git grep | G |
|
||||||
| rg | r |
|
| ack | k |
|
||||||
| pt | t |
|
| rg | r |
|
||||||
|
| pt | t |
|
||||||
|
|
||||||
应当避免的范围和对应按键为:
|
应当避免的范围和对应按键为:
|
||||||
|
|
||||||
@ -1333,71 +1334,85 @@ endfunction
|
|||||||
|
|
||||||
#### 搜索当前文件所在的文件夹
|
#### 搜索当前文件所在的文件夹
|
||||||
|
|
||||||
| 快捷键 | 功能描述 |
|
以下快捷键为搜索当前文件所在的文件夹,比如,当正在编辑文件`src/util/help.c`时,
|
||||||
| ----------- | ----------------------------------------------------------- |
|
以下这些快捷键搜索的位置为`src/util/`文件夹内的内容。
|
||||||
| `SPC s d` | searching in buffer directory with default tool |
|
|
||||||
| `SPC s D` | searching in buffer directory cursor word with default tool |
|
| 快捷键 | 功能描述 |
|
||||||
| `SPC s a d` | searching in buffer directory with ag |
|
| ----------- | -------------------------------- |
|
||||||
| `SPC s a D` | searching in buffer directory cursor word with ag |
|
| `SPC s d` | 使用默认的搜索工具进行搜索 |
|
||||||
| `SPC s g d` | searching in buffer directory with grep |
|
| `SPC s D` | 使用默认的搜索工具搜索光标下的词 |
|
||||||
| `SPC s g D` | searching in buffer directory cursor word with grep |
|
| `SPC s a d` | 使用`ag`进行搜索 |
|
||||||
| `SPC s k d` | searching in buffer directory with ack |
|
| `SPC s a D` | 使用`ag`搜索光标下的词 |
|
||||||
| `SPC s k D` | searching in buffer directory cursor word with ack |
|
| `SPC s g d` | 使用`grep`进行搜索 |
|
||||||
| `SPC s r d` | searching in buffer directory with rg |
|
| `SPC s g D` | 使用`grep`搜索光标下的词 |
|
||||||
| `SPC s r D` | searching in buffer directory cursor word with rg |
|
| `SPC s k d` | 使用`ack`进行搜索 |
|
||||||
| `SPC s t d` | searching in buffer directory with pt |
|
| `SPC s k D` | 使用`ack`搜索光标下的词 |
|
||||||
| `SPC s t D` | searching in buffer directory cursor word with pt |
|
| `SPC s r d` | 使用`rg`进行搜索 |
|
||||||
|
| `SPC s r D` | 使用`rg`搜索光标下的词 |
|
||||||
|
| `SPC s t d` | 使用`pt`进行搜索 |
|
||||||
|
| `SPC s t D` | 使用`pt`搜索光标下的词 |
|
||||||
|
|
||||||
#### 在所有打开的缓冲区中进行搜索
|
#### 在所有打开的缓冲区中进行搜索
|
||||||
|
|
||||||
| 快捷键 | 功能描述 |
|
以下快捷键为搜索已经打开的文件列表,搜索的目标位置仅限于已经在 Vim 中打开的文件列表。
|
||||||
| ----------- | --------------------------------------------------- |
|
在 Vim 中,可以使用命令`:ls`查看已经打开的文件列表。
|
||||||
| `SPC s b` | search with the first found tool |
|
|
||||||
| `SPC s B` | search with the first found tool with default input |
|
如若已经载入了模糊搜索的模块,则可以使用快捷键`SPC b b`查看已打开的文件。
|
||||||
| `SPC s a b` | ag |
|
|
||||||
| `SPC s a B` | ag with default input |
|
| 快捷键 | 功能描述 |
|
||||||
| `SPC s g b` | grep |
|
| ----------- | -------------------------------- |
|
||||||
| `SPC s g B` | grep with default input |
|
| `SPC s b` | 使用默认的搜索工具进行搜索 |
|
||||||
| `SPC s k b` | ack |
|
| `SPC s B` | 使用默认的搜索工具搜索光标下的词 |
|
||||||
| `SPC s k B` | ack with default input |
|
| `SPC s a b` | 使用`ag`进行搜索 |
|
||||||
| `SPC s r b` | rg |
|
| `SPC s a B` | 使用`ag`搜索光标下的词 |
|
||||||
| `SPC s r B` | rg with default input |
|
| `SPC s g b` | 使用`grep`进行搜索 |
|
||||||
| `SPC s t b` | pt |
|
| `SPC s g B` | 使用`grep`搜索光标下的词 |
|
||||||
| `SPC s t B` | pt with default input |
|
| `SPC s k b` | 使用`ack`进行搜索 |
|
||||||
|
| `SPC s k B` | 使用`ack`搜索光标下的词 |
|
||||||
|
| `SPC s r b` | 使用`rg`进行搜索 |
|
||||||
|
| `SPC s r B` | 使用`rg`搜索光标下的词 |
|
||||||
|
| `SPC s t b` | 使用`pt`进行搜索 |
|
||||||
|
| `SPC s t B` | 使用`pt`搜索光标下的词 |
|
||||||
|
|
||||||
#### 在任意目录中进行搜索
|
#### 在任意目录中进行搜索
|
||||||
|
|
||||||
| 快捷键 | 功能描述 |
|
以下快捷用于指定搜索目录具体文件夹位置,比如需要去搜索非当前项目下的一些文件。
|
||||||
| ----------- | --------------------------------------------------- |
|
按下快捷键后,首先提示的是输入搜索词,之后提示输入搜索的目录地址。
|
||||||
| `SPC s f` | search with the first found tool |
|
|
||||||
| `SPC s F` | search with the first found tool with default input |
|
| 快捷键 | 功能描述 |
|
||||||
| `SPC s a f` | ag |
|
| ----------- | -------------------------------- |
|
||||||
| `SPC s a F` | ag with default text |
|
| `SPC s f` | 使用默认的搜索工具进行搜索 |
|
||||||
| `SPC s g f` | grep |
|
| `SPC s F` | 使用默认的搜索工具搜索光标下的词 |
|
||||||
| `SPC s g F` | grep with default text |
|
| `SPC s a f` | 使用`ag`进行搜索 |
|
||||||
| `SPC s k f` | ack |
|
| `SPC s a F` | 使用`ag`搜索光标下的词 |
|
||||||
| `SPC s k F` | ack with default text |
|
| `SPC s g f` | 使用`grep`进行搜索 |
|
||||||
| `SPC s r f` | rg |
|
| `SPC s g F` | 使用`grep`搜索光标下的词 |
|
||||||
| `SPC s r F` | rg with default text |
|
| `SPC s k f` | 使用`ack`进行搜索 |
|
||||||
| `SPC s t f` | pt |
|
| `SPC s k F` | 使用`ack`搜索光标下的词 |
|
||||||
| `SPC s t F` | pt with default text |
|
| `SPC s r f` | 使用`rg`进行搜索 |
|
||||||
|
| `SPC s r F` | 使用`rg`搜索光标下的词 |
|
||||||
|
| `SPC s t f` | 使用`pt`进行搜索 |
|
||||||
|
| `SPC s t F` | 使用`pt`搜索光标下的词 |
|
||||||
|
|
||||||
#### 在工程中进行搜索
|
#### 在工程中进行搜索
|
||||||
|
|
||||||
| 快捷键 | 功能描述 |
|
以下这些快捷键是用于搜索整个工程目录的,搜索的文件夹位置为当前文件所在的项目根目录。
|
||||||
| ------------------- | --------------------------------------------------- |
|
项目的根目录默认会自动检测识别,主要是依据`project_rooter_patterns`选项设定。
|
||||||
| `SPC /` / `SPC s p` | search with the first found tool |
|
|
||||||
| `SPC *` / `SPC s P` | search with the first found tool with default input |
|
| 快捷键 | 功能描述 |
|
||||||
| `SPC s a p` | ag |
|
| ----------- | -------------------------------- |
|
||||||
| `SPC s a P` | ag with default text |
|
| `SPC s p` | 使用默认的搜索工具进行搜索 |
|
||||||
| `SPC s g p` | grep |
|
| `SPC s P` | 使用默认的搜索工具搜索光标下的词 |
|
||||||
| `SPC s g p` | grep with default text |
|
| `SPC s a p` | 使用`ag`进行搜索 |
|
||||||
| `SPC s k p` | ack |
|
| `SPC s a P` | 使用`ag`搜索光标下的词 |
|
||||||
| `SPC s k P` | ack with default text |
|
| `SPC s g p` | 使用`grep`进行搜索 |
|
||||||
| `SPC s t p` | pt |
|
| `SPC s g P` | 使用`grep`搜索光标下的词 |
|
||||||
| `SPC s t P` | pt with default text |
|
| `SPC s k p` | 使用`ack`进行搜索 |
|
||||||
| `SPC s r p` | rg |
|
| `SPC s k P` | 使用`ack`搜索光标下的词 |
|
||||||
| `SPC s r P` | rg with default text |
|
| `SPC s r p` | 使用`rg`进行搜索 |
|
||||||
|
| `SPC s r P` | 使用`rg`搜索光标下的词 |
|
||||||
|
| `SPC s t p` | 使用`pt`进行搜索 |
|
||||||
|
| `SPC s t P` | 使用`pt`搜索光标下的词 |
|
||||||
|
|
||||||
**提示**: 在工程中进行搜索的话,无需提前打开文件。在工程保存目录中使用 `SPC p p` 和 `C-s`,就比如 `SPC s p`。(TODO)
|
**提示**: 在工程中进行搜索的话,无需提前打开文件。在工程保存目录中使用 `SPC p p` 和 `C-s`,就比如 `SPC s p`。(TODO)
|
||||||
|
|
||||||
@ -1437,24 +1452,24 @@ endfunction
|
|||||||
|
|
||||||
#### 实时代码检索
|
#### 实时代码检索
|
||||||
|
|
||||||
| 快捷键 | 功能描述 |
|
| 快捷键 | 功能描述 |
|
||||||
| ----------- | -------------------------------- |
|
| --------- | -------------------------------- |
|
||||||
| `SPC s g G` | 在工程中使用默认工具实时检索代码 |
|
| `SPC s /` | 在工程中使用默认工具实时检索代码 |
|
||||||
|
|
||||||
FlyGrep 缓冲区的按键绑定:
|
Flygrep 搜索窗口结果窗口内的常用快捷键:
|
||||||
|
|
||||||
| 快捷键 | 功能描述 |
|
| 快捷键 | 功能描述 |
|
||||||
| ------------------- | --------------------------------- |
|
| ------------------- | ---------------------- |
|
||||||
| `<Esc>` | close FlyGrep buffer |
|
| `<Esc>` | 关闭搜索窗口 |
|
||||||
| `<Enter>` | open file at the cursor line |
|
| `<Enter>` | 打开当前选中的文件位置 |
|
||||||
| `<Tab>` | move cursor line down |
|
| `<Tab>` | 选中下一行文件位置 |
|
||||||
| `Shift-<Tab>` | move cursor line up |
|
| `Shift-<Tab>` | 选中上一行文件位置 |
|
||||||
| `<Backspace>` | remove last character |
|
| `<Backspace>` | 删除上一个输入字符 |
|
||||||
| `Ctrl-w` | remove the Word before the cursor |
|
| `Ctrl-w` | 删除光标前的单词 |
|
||||||
| `Ctrl-u` | remove the Line before the cursor |
|
| `Ctrl-u` | 删除光标前所有内容 |
|
||||||
| `Ctrl-k` | remove the Line after the cursor |
|
| `Ctrl-k` | 删除光标后所有内容 |
|
||||||
| `Ctrl-a` / `<Home>` | Go to the beginning of the line |
|
| `Ctrl-a` / `<Home>` | 将光标移至行首 |
|
||||||
| `Ctrl-e` / `<End>` | Go to the end of the line |
|
| `Ctrl-e` / `<End>` | 将光标移至行尾 |
|
||||||
|
|
||||||
#### 保持高亮
|
#### 保持高亮
|
||||||
|
|
||||||
|
@ -1217,7 +1217,7 @@ for example, load the denite layer:
|
|||||||
|
|
||||||
```toml
|
```toml
|
||||||
[[layers]]
|
[[layers]]
|
||||||
name = "denite"
|
name = "denite"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Key bindings**
|
**Key bindings**
|
||||||
@ -1255,18 +1255,18 @@ The above key bindings are only part of fuzzy finder layers, please read the lay
|
|||||||
|
|
||||||
**Key bindings within fuzzy finder buffer**
|
**Key bindings within fuzzy finder buffer**
|
||||||
|
|
||||||
| Key Bindings | Descriptions |
|
| Key Bindings | Descriptions |
|
||||||
| ------------------------ | ------------------------------- |
|
| ---------------------- | ------------------------------- |
|
||||||
| `<Tab>` / `Ctrl-j` | Select next line |
|
| `<Tab>` / `Ctrl-j` | Select next line |
|
||||||
| `Shift-<Tab>` / `Ctrl-k` | Select previous line |
|
| `Shift-Tab` / `Ctrl-k` | Select previous line |
|
||||||
| `<Esc>` | Leave Insert mode |
|
| `<Esc>` | Leave Insert mode |
|
||||||
| `Ctrl-w` | Delete backward path |
|
| `Ctrl-w` | Delete backward path |
|
||||||
| `Ctrl-u` | Delete whole line before cursor |
|
| `Ctrl-u` | Delete whole line before cursor |
|
||||||
| `<Enter>` | Run default action |
|
| `<Enter>` | Run default action |
|
||||||
| `Ctrl-s` | Open in a split |
|
| `Ctrl-s` | Open in a split |
|
||||||
| `Ctrl-v` | Open in a vertical split |
|
| `Ctrl-v` | Open in a vertical split |
|
||||||
| `Ctrl-t` | Open in a new tab |
|
| `Ctrl-t` | Open in a new tab |
|
||||||
| `Ctrl-g` | Close fuzzy finder |
|
| `Ctrl-g` | Close fuzzy finder |
|
||||||
|
|
||||||
#### With an external tool
|
#### With an external tool
|
||||||
|
|
||||||
@ -1286,13 +1286,14 @@ If the tool key is omitted then a default tool will be automatically selected fo
|
|||||||
|
|
||||||
The tool keys are:
|
The tool keys are:
|
||||||
|
|
||||||
| Tool | Key |
|
| Tool | Key |
|
||||||
| ---- | --- |
|
| -------- | --- |
|
||||||
| ag | a |
|
| ag | a |
|
||||||
| grep | g |
|
| grep | g |
|
||||||
| ack | k |
|
| git grep | G |
|
||||||
| rg | r |
|
| ack | k |
|
||||||
| pt | t |
|
| rg | r |
|
||||||
|
| pt | t |
|
||||||
|
|
||||||
The available scopes and corresponding keys are:
|
The available scopes and corresponding keys are:
|
||||||
|
|
||||||
@ -1319,9 +1320,9 @@ The following example shows how to change the default option of searching tool `
|
|||||||
|
|
||||||
```vim
|
```vim
|
||||||
function! myspacevim#before() abort
|
function! myspacevim#before() abort
|
||||||
let profile = SpaceVim#mapping#search#getprofile('rg')
|
let profile = SpaceVim#mapping#search#getprofile('rg')
|
||||||
let default_opt = profile.default_opts + ['--no-ignore-vcs']
|
let default_opt = profile.default_opts + ['--no-ignore-vcs']
|
||||||
call SpaceVim#mapping#search#profile({'rg' : {'default_opts' : default_opt}})
|
call SpaceVim#mapping#search#profile({'rg' : {'default_opts' : default_opt}})
|
||||||
endfunction
|
endfunction
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -1372,6 +1373,8 @@ The structure of searching tool profile is:
|
|||||||
| `SPC s a D` | searching in buffer directory cursor word with ag |
|
| `SPC s a D` | searching in buffer directory cursor word with ag |
|
||||||
| `SPC s g d` | searching in buffer directory with grep |
|
| `SPC s g d` | searching in buffer directory with grep |
|
||||||
| `SPC s g D` | searching in buffer directory cursor word with grep |
|
| `SPC s g D` | searching in buffer directory cursor word with grep |
|
||||||
|
| `SPC s G d` | searching in buffer directory with git-grep |
|
||||||
|
| `SPC s G D` | searching in buffer directory cursor word with git-grep |
|
||||||
| `SPC s k d` | searching in buffer directory with ack |
|
| `SPC s k d` | searching in buffer directory with ack |
|
||||||
| `SPC s k D` | searching in buffer directory cursor word with ack |
|
| `SPC s k D` | searching in buffer directory cursor word with ack |
|
||||||
| `SPC s r d` | searching in buffer directory with rg |
|
| `SPC s r d` | searching in buffer directory with rg |
|
||||||
@ -1389,6 +1392,8 @@ The structure of searching tool profile is:
|
|||||||
| `SPC s a B` | ag with default input |
|
| `SPC s a B` | ag with default input |
|
||||||
| `SPC s g b` | grep |
|
| `SPC s g b` | grep |
|
||||||
| `SPC s g B` | grep with default input |
|
| `SPC s g B` | grep with default input |
|
||||||
|
| `SPC s G b` | git-grep |
|
||||||
|
| `SPC s G B` | git-grep with default input |
|
||||||
| `SPC s k b` | ack |
|
| `SPC s k b` | ack |
|
||||||
| `SPC s k B` | ack with default input |
|
| `SPC s k B` | ack with default input |
|
||||||
| `SPC s r b` | rg |
|
| `SPC s r b` | rg |
|
||||||
@ -1406,6 +1411,8 @@ The structure of searching tool profile is:
|
|||||||
| `SPC s a F` | ag with default text |
|
| `SPC s a F` | ag with default text |
|
||||||
| `SPC s g f` | grep |
|
| `SPC s g f` | grep |
|
||||||
| `SPC s g F` | grep with default text |
|
| `SPC s g F` | grep with default text |
|
||||||
|
| `SPC s G f` | git-grep |
|
||||||
|
| `SPC s G F` | git-grep with default text |
|
||||||
| `SPC s k f` | ack |
|
| `SPC s k f` | ack |
|
||||||
| `SPC s k F` | ack with default text |
|
| `SPC s k F` | ack with default text |
|
||||||
| `SPC s r f` | rg |
|
| `SPC s r f` | rg |
|
||||||
@ -1415,20 +1422,20 @@ The structure of searching tool profile is:
|
|||||||
|
|
||||||
#### Searching in a project
|
#### Searching in a project
|
||||||
|
|
||||||
| Key Bindings | Descriptions |
|
| Key Bindings | Descriptions |
|
||||||
| ------------------- | --------------------------------------------------- |
|
| ------------ | --------------------------------------------------- |
|
||||||
| `SPC /` / `SPC s p` | search with the first found tool |
|
| `SPC s p` | search with the first found tool |
|
||||||
| `SPC *` / `SPC s P` | search with the first found tool with default input |
|
| `SPC s P` | search with the first found tool with default input |
|
||||||
| `SPC s a p` | ag |
|
| `SPC s a p` | ag |
|
||||||
| `SPC s a P` | ag with default text |
|
| `SPC s a P` | ag with default text |
|
||||||
| `SPC s g p` | grep |
|
| `SPC s g p` | grep |
|
||||||
| `SPC s g p` | grep with default text |
|
| `SPC s g p` | grep with default text |
|
||||||
| `SPC s k p` | ack |
|
| `SPC s k p` | ack |
|
||||||
| `SPC s k P` | ack with default text |
|
| `SPC s k P` | ack with default text |
|
||||||
| `SPC s t p` | pt |
|
| `SPC s t p` | pt |
|
||||||
| `SPC s t P` | pt with default text |
|
| `SPC s t P` | pt with default text |
|
||||||
| `SPC s r p` | rg |
|
| `SPC s r p` | rg |
|
||||||
| `SPC s r P` | rg with default text |
|
| `SPC s r P` | rg with default text |
|
||||||
|
|
||||||
**Hint**: It is also possible to search in a project without needing to open a file beforehand. To do so use `SPC p p` and then `C-s` on a given project to directly search into it like with `SPC s p`. (TODO)
|
**Hint**: It is also possible to search in a project without needing to open a file beforehand. To do so use `SPC p p` and then `C-s` on a given project to directly search into it like with `SPC s p`. (TODO)
|
||||||
|
|
||||||
@ -1465,7 +1472,7 @@ Background search keyword in a project, when searching done, the count will be s
|
|||||||
|
|
||||||
| Key Bindings | Descriptions |
|
| Key Bindings | Descriptions |
|
||||||
| ------------ | -------------------------------------------------- |
|
| ------------ | -------------------------------------------------- |
|
||||||
| `SPC s g G` | Searching in project on the fly with default tools |
|
| `SPC s /` | Searching in project on the fly with default tools |
|
||||||
|
|
||||||
Key bindings in FlyGrep buffer:
|
Key bindings in FlyGrep buffer:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user