From dc947b9762c42ea6a66e62be17c7be5f4ef074d6 Mon Sep 17 00:00:00 2001 From: Simone Gentili Date: Mon, 3 Aug 2015 08:21:27 +0000 Subject: [PATCH 1/3] Added new Composer Require method --- README.md | 5 +++++ plugin/vim-composer.vim | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index 035c619..146fd9c 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,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 `. + ```vim :ComposerJSON ``` diff --git a/plugin/vim-composer.vim b/plugin/vim-composer.vim index f3608fc..e25e79d 100644 --- a/plugin/vim-composer.vim +++ b/plugin/vim-composer.vim @@ -25,6 +25,8 @@ endif command! -narg=* ComposerRun call s:ComposerRunFunc() command! -narg=* ComposerInstall call s:ComposerInstallFunc() command! -narg=* ComposerUpdate call s:ComposerUpdateFunc() +command! -narg=* ComposerRequire call s:ComposerRequireFunc() + command! ComposerGet call s:ComposerGetFunc() command! ComposerJSON call s:OpenComposerJSON() @@ -60,6 +62,10 @@ function! s:ComposerUpdateFunc(arg) exe s:ComposerRunFunc("update") endfunction +function! s:ComposerRequireFunc(repo, version) + exe s:ComposerRunFunc("require", repo, version) +endfunction + function! g:ComposerKnowWhereCurrentFileIs() let g:currentWord = expand('') let l:command = "grep " . g:currentWord . " ./vendor/composer -R | awk '{print $6}' | awk -F\\' '{print $2}'" From 350b37f7c52716cd49699932cff9653270fbc473 Mon Sep 17 00:00:00 2001 From: Simone Gentili Date: Wed, 2 Sep 2015 09:52:51 +0200 Subject: [PATCH 2/3] Added a command to init new composer project --- README.md | 6 ++++++ plugin/vim-composer.vim | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 9fe53c4..216665f 100644 --- a/README.md +++ b/README.md @@ -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 %' diff --git a/plugin/vim-composer.vim b/plugin/vim-composer.vim index e25e79d..f135412 100644 --- a/plugin/vim-composer.vim +++ b/plugin/vim-composer.vim @@ -24,6 +24,7 @@ endif command! -narg=* ComposerRun call s:ComposerRunFunc() command! -narg=* ComposerInstall call s:ComposerInstallFunc() +command! -narg=* ComposerInit call s:ComposerInit() command! -narg=* ComposerUpdate call s:ComposerUpdateFunc() command! -narg=* ComposerRequire call s:ComposerRequireFunc() @@ -58,6 +59,13 @@ function! s:ComposerInstallFunc(arg) endif endfunction +function! s:ComposerInit(arg) + exe s:ComposerRunFunc("init") + if len(g:composer_install_callback) > 0 + exe "call ".g:composer_install_callback."()" + endif +endfunction + function! s:ComposerUpdateFunc(arg) exe s:ComposerRunFunc("update") endfunction From 3b05878c8ef6a3977c10d0762ba276db480452a8 Mon Sep 17 00:00:00 2001 From: Simone Gentili Date: Wed, 2 Sep 2015 10:02:15 +0200 Subject: [PATCH 3/3] Fixed init and require functions --- plugin/vim-composer.vim | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/plugin/vim-composer.vim b/plugin/vim-composer.vim index f135412..a5565f2 100644 --- a/plugin/vim-composer.vim +++ b/plugin/vim-composer.vim @@ -59,19 +59,16 @@ function! s:ComposerInstallFunc(arg) endif endfunction -function! s:ComposerInit(arg) +function! s:ComposerInit() exe s:ComposerRunFunc("init") - if len(g:composer_install_callback) > 0 - exe "call ".g:composer_install_callback."()" - endif endfunction function! s:ComposerUpdateFunc(arg) exe s:ComposerRunFunc("update") endfunction -function! s:ComposerRequireFunc(repo, version) - exe s:ComposerRunFunc("require", repo, version) +function! s:ComposerRequireFunc() + exe s:ComposerRunFunc("require") endfunction function! g:ComposerKnowWhereCurrentFileIs()