mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-02 20:20:05 +08:00
feat(cscope): add list_files_command
layer option
This commit is contained in:
parent
ad05af6837
commit
7f2dd0642d
@ -29,6 +29,17 @@ scriptencoding utf-8
|
||||
" 2. `cscope_command`: set the command or path of `cscope` executable.
|
||||
" 3. `open_location`: enable/disable open location list after searching.
|
||||
" 4. `preload_path`: set the proload paths.
|
||||
" 5. `list_files_command`: set the command to list all files which should
|
||||
" be involed to create cscope database, By default it is:
|
||||
"
|
||||
" `['rg', '--color=never', '--files']`
|
||||
"
|
||||
" To specific filetypes, use custom command, for example:
|
||||
" >
|
||||
" [[layers]]
|
||||
" name = 'cscope'
|
||||
" list_files_command = ['rg', '--color=never', '--files', '--type', 'c']
|
||||
" <
|
||||
"
|
||||
" @subsection key bindings
|
||||
"
|
||||
@ -57,6 +68,7 @@ endif
|
||||
|
||||
let s:cscope_command = 'cscope'
|
||||
let s:auto_update = 1
|
||||
let s:list_files_command = ['rg', '--color=never', '--files']
|
||||
|
||||
function! SpaceVim#layers#cscope#plugins() abort
|
||||
let plugins = [
|
||||
@ -109,6 +121,9 @@ function! SpaceVim#layers#cscope#set_variable(var) abort
|
||||
let g:cscope_preload_path = get(a:var,
|
||||
\ 'preload_path',
|
||||
\ '')
|
||||
let g:cscope_list_files_command = get(a:ver,
|
||||
\ 'list_files_command',
|
||||
\ s:list_files_command)
|
||||
|
||||
endfunction
|
||||
|
||||
|
8
bundle/cscope.vim/autoload/cscope.vim
vendored
8
bundle/cscope.vim/autoload/cscope.vim
vendored
@ -149,7 +149,13 @@ function! s:list_files_exit(id, date, event) abort
|
||||
endfunction
|
||||
|
||||
function! s:list_project_files(dir, cscope_files, cscope_db, load) abort
|
||||
let jobid = s:JOB.start(['rg', '--color=never', '--files', a:dir], {
|
||||
if exists('g:cscope_list_files_command')
|
||||
\ && type(g:cscope_list_files_command) ==# type([])
|
||||
let list_files_command = g:cscope_list_files_command + [a:dir]
|
||||
else
|
||||
let list_files_command = ['rg', '--color=never', '--files', a:dir]
|
||||
endif
|
||||
let jobid = s:JOB.start(list_files_command, {
|
||||
\ 'on_stdout' : function('s:list_files_stdout'),
|
||||
\ 'on_exit' : function('s:list_files_exit')
|
||||
\ })
|
||||
|
@ -1863,6 +1863,17 @@ The layer option can be used when loading the `cscope` layer, for example:
|
||||
2. `cscope_command`: set the command or path of `cscope` executable.
|
||||
3. `open_location`: enable/disable open location list after searching.
|
||||
4. `preload_path`: set the proload paths.
|
||||
5. `list_files_command`: set the command to list all files which should be
|
||||
involed to create cscope database, By default it is:
|
||||
|
||||
`['rg', '--color=never', '--files']`
|
||||
|
||||
To specific filetypes, use custom command, for example:
|
||||
>
|
||||
[[layers]]
|
||||
name = 'cscope'
|
||||
list_files_command = ['rg', '--color=never', '--files', '--type', 'c']
|
||||
<
|
||||
|
||||
KEY BINDINGS
|
||||
|
||||
|
@ -54,6 +54,16 @@ scoop install cscope
|
||||
- `auto_update`: 启用/禁用数据库自动更新,若启用,则在保存文件时自动更新数据库。
|
||||
- `open_location`: 启用/禁用自动打开搜索结果列表。
|
||||
- `preload_path`: 设置预加载的数据量路径。
|
||||
- `list_files_command`: 设置列出项目内需要生成cscope数据库的所有文件的命令,默认是:
|
||||
```
|
||||
['rg', '--color=never', '--files']
|
||||
```
|
||||
如果需要指定哪些文件需要生成数据库,可以参考如下设置:
|
||||
```
|
||||
[[layers]]
|
||||
name = 'cscope'
|
||||
list_files_command = ['rg', '--color=never', '--files', '--type', 'c']
|
||||
```
|
||||
|
||||
## 快捷键
|
||||
|
||||
|
@ -51,7 +51,17 @@ To use this configuration layer, add it to your configuration file.
|
||||
- `auto_update`: enable/disable auto udpate when saving files.
|
||||
- `open_location`: enable/disable open location list after searching.
|
||||
- `preload_path`: set the proload paths.
|
||||
|
||||
- `list_files_command`: set the command to list all files which should be
|
||||
involed to create cscope database, By default it is:
|
||||
```
|
||||
['rg', '--color=never', '--files']
|
||||
```
|
||||
To specific filetypes, use custom command, for example:
|
||||
```
|
||||
[[layers]]
|
||||
name = 'cscope'
|
||||
list_files_command = ['rg', '--color=never', '--files', '--type', 'c']
|
||||
```
|
||||
|
||||
## Key bindings
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user