Skip to content

Commit 584c053

Browse files
author
Gianluca Arbezzano
committed
Merge pull request #20 from sensorario/master
Require and/or init commands
2 parents c5ac786 + 3b05878 commit 584c053

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ This command exec the installation flow of composer's install. This process requ
1515
:ComposerInstall [--no-dev ..]
1616
```
1717
This command exec `composer install`. Now you can attach after this command a custom callback to exec your personal flow.
18+
19+
```vim
20+
:ComposerInit [--no-dev ..]
21+
```
22+
This command exec `composer init`.
23+
1824
```vim
1925
function! MyCallbackFunction()
2026
exec ':silent ! ctags -a %'
@@ -28,6 +34,11 @@ In this example after every `composer install` I exec a ctags generation
2834
```
2935
This command exec `composer update`.
3036

37+
```vim
38+
:ComposerRequireFunc
39+
```
40+
This command exec `composer require <vendor/repository> <version>`.
41+
3142
```vim
3243
:ComposerJSON
3344
```

plugin/vim-composer.vim

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ endif
2424

2525
command! -narg=* ComposerRun call s:ComposerRunFunc(<q-args>)
2626
command! -narg=* ComposerInstall call s:ComposerInstallFunc(<q-args>)
27+
command! -narg=* ComposerInit call s:ComposerInit(<q-args>)
2728
command! -narg=* ComposerUpdate call s:ComposerUpdateFunc(<q-args>)
29+
command! -narg=* ComposerRequire call s:ComposerRequireFunc(<q-args>)
30+
2831
command! ComposerGet call s:ComposerGetFunc()
2932
command! ComposerJSON call s:OpenComposerJSON()
3033

@@ -56,10 +59,18 @@ function! s:ComposerInstallFunc(arg)
5659
endif
5760
endfunction
5861

62+
function! s:ComposerInit()
63+
exe s:ComposerRunFunc("init")
64+
endfunction
65+
5966
function! s:ComposerUpdateFunc(arg)
6067
exe s:ComposerRunFunc("update")
6168
endfunction
6269

70+
function! s:ComposerRequireFunc()
71+
exe s:ComposerRunFunc("require")
72+
endfunction
73+
6374
function! g:ComposerKnowWhereCurrentFileIs()
6475
let g:currentWord = expand('<cword>')
6576
let l:command = "grep " . g:currentWord . " ./vendor/composer -R | awk '{print $6}' | awk -F\\' '{print $2}'"

0 commit comments

Comments
 (0)