TVアニメーション「女子高生の無駄づかい」PV第2弾
アニメ『女子高生の無駄づかい』
周囲はとても面白いのに、主人公が一番つまらんです。
:から始まるExコマンドについても学習してきましたが、Exコマンドをスクリプトから実行するにはexexute関数を使います。
ヘルプを確認。
:h extecute(
execute({command} [, {silent}]) *execute()* Execute an Ex command or commands and return the output as a string. {command} can be a string or a List. In case of a List the lines are executed one by one. This is equivalent to: redir => var {command} redir END The optional {silent} argument can have these values: "" no `:silent` used "silent" `:silent` used "silent!" `:silent!` used The default is "silent". Note that with "silent!", unlike `:redir`, error messages are dropped. When using an external command the screen may be messed up, use `system()` instead. *E930* It is not possible to use `:redir` anywhere in {command}. To get a list of lines use |split()| on the result: split(execute('args'), "\n") To execute a command in another window than the current one use `win_execute()`. When used recursively the output of the recursive call is not included in the output of the higher level call.
使ってみます。
/tmp $ touch test_{1..5}.txt /tmp $ vim test_*.txt
extecuteの結果をechoで表示
:echo execute("args")
コメント