Vimスクリプト(vimgrep)(その3)

テキストエディタ(Vimやその他)

:vimgrep続きです。

:copenした時に表示されるQuickfix Listとは何でしょう。調べてみます。

どんな単語でヘルプを見れば良いか分からないので、とりあえずquickfixで。

:h quickfix
1. Using QuickFix commands                      *quickfix* *Quickfix* *E42*

Vim has a special mode to speedup the edit-compile-edit cycle.  This is
inspired by the quickfix option of the Manx's Aztec C compiler on the Amiga.
The idea is to save the error messages from the compiler in a file and use Vim
to jump to the errors one by one.  You can examine each problem and fix it,
without having to remember all the error messages.

In Vim the quickfix commands are used more generally to find a list of
positions in files.  For example, |:vimgrep| finds pattern matches.  You can
use the positions in a script with the |getqflist()| function.  Thus you can
do a lot more than the edit/compile/fix cycle!

QuickFixって言葉の意味は分かってきました。編集しながら、早くコンパイルする、つまり、早くプログラムを直す目的からきてるんですね。
:vimgrepの結果もQuickfix Listに格納されてて、getqflist()関数でリストが取得可能なようです。

使ってみます。

/tmp $ for i in {1..5};do echo HELLO$i>test_$i.txt;done
/tmp $ vim
:vimgrep HELLO *.txt

:echo getqflist()


たくさん情報が載ってますね。

コメント

タイトルとURLをコピーしました