aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/utils.vim9
-rw-r--r--plugin/command.vim3
2 files changed, 12 insertions, 0 deletions
diff --git a/autoload/utils.vim b/autoload/utils.vim
index 4077be2..d1a4a47 100644
--- a/autoload/utils.vim
+++ b/autoload/utils.vim
@@ -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
diff --git a/plugin/command.vim b/plugin/command.vim
index e39859b..83cc750 100644
--- a/plugin/command.vim
+++ b/plugin/command.vim
@@ -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')