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

Add SPC s * mappings for searching

This commit is contained in:
wsdjeg 2017-06-23 00:11:15 +08:00
parent becf30ac7c
commit 1f2873c7e7
3 changed files with 46 additions and 0 deletions

View File

@ -73,6 +73,33 @@ function! SpaceVim#mapping#space#init() abort
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)
" Searching in current buffer
call SpaceVim#mapping#space#def('nnoremap', ['s', 's'], 'Unite line', 'grep in current buffer', 1)
call SpaceVim#mapping#space#def('nnoremap', ['s', 'S'], "execute 'Unite grep:%::' . expand(\"<cword>\") . ' -start-insert'",
\ 'grep cursor word in current buffer', 1)
" Searching in all loaded buffers
call SpaceVim#mapping#space#def('nnoremap', ['s', 'b'], 'Unite grep:$buffers', 'grep in all loaded buffers', 1)
call SpaceVim#mapping#space#def('nnoremap', ['s', 'B'], "execute 'Unite grep:$buffers::' . expand(\"<cword>\") . ' -start-insert'",
\ 'grep cursor word in all loaded buffers', 1)
" Searching in files in an arbitrary directory
call SpaceVim#mapping#space#def('nnoremap', ['s', 'f'], 'Unite grep', 'grep in arbitrary directory', 1)
call SpaceVim#mapping#space#def('nnoremap', ['s', 'F'], "execute 'Unite grep:::' . expand(\"<cword>\") . ' -start-insert'",
\ 'grep in arbitrary directory', 1)
" Searching in project
call SpaceVim#mapping#space#def('nnoremap', ['s', 'p'], 'Unite grep:.', 'grep in project', 1)
call SpaceVim#mapping#space#def('nnoremap', ['s', 'P'], "execute 'Unite grep:.::' . expand(\"<cword>\") . ' -start-insert'",
\ 'grep in project', 1)
" Searching tools
" ag
let g:_spacevim_mappings_space.s.a = {'name' : '+ag'}
let g:_spacevim_mappings_space.s.g = {'name' : '+grep'}
let g:_spacevim_mappings_space.s.k = {'name' : '+ack'}
let g:_spacevim_mappings_space.s.r = {'name' : '+rg'}
let g:_spacevim_mappings_space.s.t = {'name' : '+pt'}
endfunction
function! SpaceVim#mapping#space#def(m, keys, cmd, desc, is_cmd) abort

View File

@ -306,6 +306,7 @@ augroup unite_buffer_feature
augroup END
function! s:unite_my_settings()
" Overwrite settings.
setlocal nowrap
" Play nice with supertab
let b:SuperTabDisabled=1

View File

@ -70,6 +70,7 @@ title: "Documentation"
* [With an external tool](#with-an-external-tool)
* [Useful key bindings](#useful-key-bindings)
* [Searching in current file](#searching-in-current-file)
* [Searching in all loaded buffers](#searching-in-all-loaded-buffers)
* [Editing](#editing)
* [Multi-Encodings](#multi-encodings)
* [Errors handling](#errors-handling)
@ -980,6 +981,23 @@ Key Binding Description
`SPC s r r` | rg
`SPC s r R` | rg with default input
#### Searching in all loaded buffers
Key Binding Description
-----------| -----------
`SPC s b` | search with the first found tool
`SPC s B` | search with the first found tool with default input
`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 k b` | ack
`SPC s k B` | ack with default input
`SPC s r b` | rg
`SPC s r B` | rg with default input
`SPC s t b` | pt
`SPC s t B` | pt with default input
### Editing
#### Multi-Encodings