2016-04-16 21 views
0

2つのバッファを並べてバッファー1に入れてみましょう。コンパイラ(またはコマンドラインプログラム)を実行してその出力(stdoutVimではコマンドを実行してstdoutを特定のバッファにリダイレクトします

現在のバッファまたは特定のバッファをこのコマンドラインプログラムにstdinとしてどのように送りますか?これが不可能な場合は、ソースコードをファイルに保存し、コンパイラのパラメータとして指定することができます。しかし、とにかく私はバッファ2の出力を見たいです。

+1

[quickrun plugin](http://vimawesome.com/plugin/vim-quickrun)をご覧ください。 – yolenoyer

+1

'stdout'で何をする予定ですか? ':help:make'と':help quickfix'について知っていますか? – romainl

+0

@romainl私はquickfixプラグインを知らなかった、それはおそらく私が必要なものだ。ありがとう。 –

答えて

1

:r! commandを使用して、シェルコマンドを実行し、出力を現在のバッファに読み込むことができます。

+0

私はそれを知っていますが、現在のものではなく特定のバッファに出力したいのですが... –

2

あなたは:h :bを見れば:

:[N]b[uffer][!] [+cmd] [N]    :b :bu :buf :buffer E86 
       Edit buffer [N] from the buffer list. If [N] is not given, 
       the current buffer remains being edited. See :buffer-! for 
       [!]. This will also edit a buffer that is not in the buffer 
       list, without setting the 'buflisted' flag. 
       Also see +cmd. 

そして+cmdのために:だから

             +cmd [+cmd] 
The [+cmd] argument can be used to position the cursor in the newly opened 
file, or execute any other command: 
     +    Start at the last line. 
     +{num}   Start at line {num}. 
     +/{pat}   Start at first line containing {pat}. 
     +{command}  Execute {command} after opening the new file. 
         {command} is any Ex command. 

:2b +r!date 

がバッファ2を開き、dateの出力に読んでいましたコマンド。

関連する問題