1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-13 02:05:40 +08:00

Fix unite grep source config

This commit is contained in:
wsdjeg 2017-06-22 23:17:15 +08:00
parent 367a01fe89
commit becf30ac7c
3 changed files with 34 additions and 2 deletions

View File

@ -20,6 +20,7 @@ function! SpaceVim#mapping#space#init() abort
let g:_spacevim_mappings_space.h = {'name' : '+Help'}
let g:_spacevim_mappings_space.l = {'name' : '+Language Specified'}
let g:_spacevim_mappings_space.s = {'name' : '+Searching'}
let g:_spacevim_mappings_space.r = {'name' : '+Registers/rings/resume'}
" Windows
for i in range(1, 9)
exe "call SpaceVim#mapping#space#def('nnoremap', [" . i . "], 'call SpaceVim#layers#core#statusline#jump(" . i . ")', 'window " . i . "', 1)"
@ -71,6 +72,7 @@ function! SpaceVim#mapping#space#init() abort
call SpaceVim#mapping#menu('toggle line number', '[SPC]tn', 'set nu!')
call SpaceVim#mapping#space#def('nnoremap', ['b', 'b'], 'Unite buffer', 'buffer list', 1)
call extend(g:_spacevim_mappings_prefixs['[SPC]'], get(g:, '_spacevim_mappings_space', {}))
call SpaceVim#mapping#space#def('nnoremap', ['r', 'l'], 'Unite resume', 'resume unite buffer', 1)
endfunction
function! SpaceVim#mapping#space#def(m, keys, cmd, desc, is_cmd) abort

View File

@ -199,9 +199,14 @@ elseif executable('ag')
" Use ag (the silver searcher)
" https://github.com/ggreer/the_silver_searcher
let g:unite_source_grep_command = 'ag'
let g:unite_source_grep_default_opts = '-i --line-numbers --nocolor --nogroup --hidden --ignore ' .
let g:unite_source_grep_default_opts =
\ '-i --vimgrep --hidden --ignore ' .
\ '''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr'''
let g:unite_source_grep_recursive_opt = ''
elseif executable('rg') && 0
let g:unite_source_grep_command = 'rg'
let g:unite_source_grep_default_opts = ''
let g:unite_source_grep_recursive_opt = ''
elseif executable('pt')
" Use pt (the platinum searcher)
" https://github.com/monochromegane/the_platinum_searcher

View File

@ -68,6 +68,8 @@ title: "Documentation"
* [Auto-saving](#auto-saving)
* [Searching](#searching)
* [With an external tool](#with-an-external-tool)
* [Useful key bindings](#useful-key-bindings)
* [Searching in current file](#searching-in-current-file)
* [Editing](#editing)
* [Multi-Encodings](#multi-encodings)
* [Errors handling](#errors-handling)
@ -953,7 +955,30 @@ It is possible to search in the current file by double pressing the second key o
Notes:
- `rg`, `ag` and `pt` are optimized to be used in a source control repository but they can be used in an arbitrary directory as well.
- It is also possible to search in several directories at once by marking them in the unite buffer (not available in Ivy).
- It is also possible to search in several directories at once by marking them in the unite buffer.
**Beware** if you use `pt`, [TCL parser tools](https://core.tcl.tk/tcllib/doc/trunk/embedded/www/tcllib/files/apps/pt.html) also install a command line tool called `pt`.
#### Useful key bindings
Key Binding | Description
-----------| -----------
`SPC r l` | resume the last completion buffer
`` SPC s ` `` | go back to the previous place before jump
Prefix argument | will ask for file extensions
#### Searching in current file
Key Binding Description
-----------| -----------
`SPC s s` | search with the first found tool
`SPC s S` | search with the first found tool with default input
`SPC s a a` | ag
`SPC s a A` | ag with default input
`SPC s g g` | grep
`SPC s g G` | grep with default input
`SPC s r r` | rg
`SPC s r R` | rg with default input
### Editing