Skip to content

Commit dc947b9

Browse files
committed
Added new Composer Require method
1 parent 97fc996 commit dc947b9

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ In this example after every `composer install` I exec a ctags generation
2828
```
2929
This command exec `composer update`.
3030

31+
```vim
32+
:ComposerRequireFunc
33+
```
34+
This command exec `composer require <vendor/repository> <version>`.
35+
3136
```vim
3237
:ComposerJSON
3338
```

plugin/vim-composer.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ endif
2525
command! -narg=* ComposerRun call s:ComposerRunFunc(<q-args>)
2626
command! -narg=* ComposerInstall call s:ComposerInstallFunc(<q-args>)
2727
command! -narg=* ComposerUpdate call s:ComposerUpdateFunc(<q-args>)
28+
command! -narg=* ComposerRequire call s:ComposerRequireFunc(<q-args>)
29+
2830
command! ComposerGet call s:ComposerGetFunc()
2931
command! ComposerJSON call s:OpenComposerJSON()
3032

@@ -60,6 +62,10 @@ function! s:ComposerUpdateFunc(arg)
6062
exe s:ComposerRunFunc("update")
6163
endfunction
6264

65+
function! s:ComposerRequireFunc(repo, version)
66+
exe s:ComposerRunFunc("require", repo, version)
67+
endfunction
68+
6369
function! g:ComposerKnowWhereCurrentFileIs()
6470
let g:currentWord = expand('<cword>')
6571
let l:command = "grep " . g:currentWord . " ./vendor/composer -R | awk '{print $6}' | awk -F\\' '{print $2}'"

0 commit comments

Comments
 (0)