1

この記事の次の vim マクロでは、著者が説明しています。一部は理解できますが、すべてではありません。

:qccwcommand<Esc>:w<Ctl-W>jj<Enter>q

このマクロ (レコードの開始/停止を含む) は、現在の 'path_to_command' ワードを 'command' に変更し、ファイルをディスクに書き込み、ウィンドウ分割を grep 検索結果に変更し、1 行下に移動します。結果で、その結果の場所に移動します。

Q1. ここで何をccwしていますか?それは(言葉を変えて)何か関係がありますcwが、よくわかりません。

Q2. :w 書く必要がありますよね?.

Q3. ここで何を<Ctrl-W>jjしていますか?以下はその内容:h CTRL-W_Jですが、正しいヘルプを調べているのか、このコンテキストでのヘルプの意味を調べているのかわかりません。

                                        *CTRL-W_J*
CTRL-W J    Move the current window to be at the very bottom, using the
    full width of the screen.  This works like closing the current
    window and then creating another one with ":botright split",
    except that the current window contents is used for the new
    window.
4

1 に答える 1

5

ccwコマンドのシーケンスを文字どおりに解釈しても意味がないため、混乱しています。

最初のqc意味は、「レジスタ c でマクロの記録を開始する」ことです。

次に、次cwは単語を変更することを意味します (たとえば、次の単語を削除し、エディターを挿入モードのままにします)。

また、最後のコマンドが : であることに注意してqください。これは、マクロの記録を終了することを意味します。マクロは、何度も繰り返す必要がある場合に非常に便利です!!1 --> http://vim.wikia.com/wiki/Macros


次に、ブログ投稿での彼の説明には、Q2 と Q3 への回答が含まれています。

This macro (which includes the record start / stop, if you’re wondering)
will change the current ‘path_to_command’ word to ‘command’, write the file
out to disk, change window splits to the grep search results, move down one
line in the results and navigate to that result’s location. I ran the macro
by hitting @c and then verifying the line selected was one that I wanted to
change. For a few instances where I did not want to change the line, I
manually navigated to the next search result and then re-ran the @c macro.

Q2 - はい、ファイルを保存するには: " write the file out to disk"

Q3 - これは vimgrepからクイックフィックス ウィンドウの次のエントリに移動するため<Ctl-W>jj<Enter>の一連の Vim キー コマンドです。write the file out to disk, change window splits to the grep search results, move down one line in the results and navigate to that result’s location.

于 2014-01-05T09:37:54.570 に答える