mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-24 05:20:04 +08:00
Add dir support
This commit is contained in:
parent
8896c319b8
commit
7f4da473b4
@ -170,7 +170,7 @@ function! SpaceVim#mapping#space#init() abort
|
||||
" Searching in current buffer
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 's'], "call SpaceVim#plugins#flygrep#open({'input' : input(\"grep pattern:\"), 'files': bufname(\"%\")})",
|
||||
\ 'grep in current buffer', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'S'], "execute 'Unite grep:%::' . expand(\"<cword>\") . ' -start-insert'",
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'S'], "call SpaceVim#plugins#flygrep#open({'input' : expand(\"<cword>\"), 'files': bufname(\"%\")})",
|
||||
\ 'grep cursor word in current buffer', 1)
|
||||
" Searching in all loaded buffers
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'b'], "call SpaceVim#plugins#flygrep#open({'input' : input(\"grep pattern:\"), 'files':'@buffers'})",
|
||||
|
@ -7,6 +7,7 @@ let s:MPT._prompt.mpt = '➭ '
|
||||
|
||||
" keys:
|
||||
" files: files for grep, @buffers means listed buffer.
|
||||
" dir: specific a directory for grep
|
||||
function! SpaceVim#plugins#flygrep#open(agrv) abort
|
||||
rightbelow split __flygrep__
|
||||
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber
|
||||
@ -24,6 +25,12 @@ function! SpaceVim#plugins#flygrep#open(agrv) abort
|
||||
else
|
||||
let s:grep_files = ''
|
||||
endif
|
||||
let dir = get(a:agrv, 'dir', '')
|
||||
if !empty(dir) && isdirectory(dir)
|
||||
let s:grep_dir = dir
|
||||
else
|
||||
let s:grep_dir = ''
|
||||
endif
|
||||
call s:MPT.open()
|
||||
let &t_ve = save_tve
|
||||
endfunction
|
||||
|
Loading…
Reference in New Issue
Block a user