Skip to content

Commit

Permalink
Merge pull request #20 from sensorario/master
Browse files Browse the repository at this point in the history
Require and/or init commands
  • Loading branch information
Gianluca Arbezzano committed Sep 9, 2015
2 parents c5ac786 + 3b05878 commit 584c053
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Expand Up @@ -15,6 +15,12 @@ This command exec the installation flow of composer's install. This process requ
:ComposerInstall [--no-dev ..]
```
This command exec `composer install`. Now you can attach after this command a custom callback to exec your personal flow.

```vim
:ComposerInit [--no-dev ..]
```
This command exec `composer init`.

```vim
function! MyCallbackFunction()
exec ':silent ! ctags -a %'
Expand All @@ -28,6 +34,11 @@ In this example after every `composer install` I exec a ctags generation
```
This command exec `composer update`.

```vim
:ComposerRequireFunc
```
This command exec `composer require <vendor/repository> <version>`.

```vim
:ComposerJSON
```
Expand Down
11 changes: 11 additions & 0 deletions plugin/vim-composer.vim
Expand Up @@ -24,7 +24,10 @@ endif

command! -narg=* ComposerRun call s:ComposerRunFunc(<q-args>)
command! -narg=* ComposerInstall call s:ComposerInstallFunc(<q-args>)
command! -narg=* ComposerInit call s:ComposerInit(<q-args>)
command! -narg=* ComposerUpdate call s:ComposerUpdateFunc(<q-args>)
command! -narg=* ComposerRequire call s:ComposerRequireFunc(<q-args>)

command! ComposerGet call s:ComposerGetFunc()
command! ComposerJSON call s:OpenComposerJSON()

Expand Down Expand Up @@ -56,10 +59,18 @@ function! s:ComposerInstallFunc(arg)
endif
endfunction

function! s:ComposerInit()
exe s:ComposerRunFunc("init")
endfunction

function! s:ComposerUpdateFunc(arg)
exe s:ComposerRunFunc("update")
endfunction

function! s:ComposerRequireFunc()
exe s:ComposerRunFunc("require")
endfunction

function! g:ComposerKnowWhereCurrentFileIs()
let g:currentWord = expand('<cword>')
let l:command = "grep " . g:currentWord . " ./vendor/composer -R | awk '{print $6}' | awk -F\\' '{print $2}'"
Expand Down

0 comments on commit 584c053

Please sign in to comment.