mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
feat: make :edit command supports file glob patterns
This commit is contained in:
parent
f9feafa5bb
commit
fa203cf3b8
@ -176,3 +176,12 @@ function! utils#CaptureCommandOutput(command) abort
|
||||
execute a:command
|
||||
redir END
|
||||
endfunction
|
||||
|
||||
" Edit all files matching the given patterns.
|
||||
function! utils#MultiEdit(patterns) abort
|
||||
for p in a:patterns
|
||||
for f in glob(p, 0, 1)
|
||||
execute 'edit ' . f
|
||||
endfor
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
@ -1,2 +1,5 @@
|
||||
" Capture output from a command to register @m, to paste, press "mp
|
||||
command! -nargs=1 -complete=command Redir call utils#CaptureCommandOutput(<q-args>)
|
||||
|
||||
command! -bar -bang -nargs=+ -complete=file Edit call utils#MultiEdit([<f-args>])
|
||||
call utils#Cabbrev('edit', 'Edit')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user