Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Vim运行自定义命令_Vim - Fatal编程技术网

使用Vim运行自定义命令

使用Vim运行自定义命令,vim,Vim,我想在Vim中创建一个artisan命令,以便执行以下操作: :artisan make:migration create_blah_table --create=blah 并让它运行以下功能: ssh -t vagrant "cd /var/www && php artisan make:migration create_blah_table --create=blah" 这可能吗 更新 make:migration create_blah_表--create=blah位可

我想在Vim中创建一个
artisan
命令,以便执行以下操作:

:artisan make:migration create_blah_table --create=blah
并让它运行以下功能:

ssh -t vagrant "cd /var/www && php artisan make:migration create_blah_table --create=blah"
这可能吗

更新


make:migration create_blah_表--create=blah
位可以是任何内容。

请参见
:帮助用户命令

It is possible to define your own Ex commands.  A user-defined command can act
just like a built-in command (it can have a range or arguments, arguments can
be completed as filenames or buffer names, etc), except that when the command
is executed, it is transformed into a normal Ex command and then executed.

For starters: See section |40.2| in the user manual.

          *E183* *E841* *user-cmd-ambiguous*
All user defined commands must start with an uppercase letter, to avoid
confusion with builtin commands. 
您需要
:命令

:com[mand][!] [{attr}...] {cmd} {rep}
                        Define a user command.  The name of the command is
                        {cmd} and its replacement text is {rep}.  The command's
                        attributes (see below) are {attr}.  If the command
                        already exists, an error is reported, unless a ! is
                        specified, in which case the command is redefined.
您可以将其放入
~/.vimrc

command -nargs=* Artisan !ssh -t vagrant "cd /var/www && php artisan <args>"
command-nargs=*Artisan!ssh-t vagrant“cd/var/www&&php artisan”

然后在ex模式下使用
:Artisan make:migration create_blah_table--create=blah
命令。

make:migration create_blah_table--create=blah不希望硬编码到命令中。我希望能够运行
:Artisan whatever
,并让它运行
ssh-t vagrant“cd/var/www&&php Artisan whatever”
小型强子对撞机:哎哟,错过了。修复。我尝试运行时遇到
E488:尾随字符
错误,例如
Artisan缓存:清除
我修复了一个输入错误,请重试?