0

vim内で開いたファイルのディレクトリにのみ存在するファイルを検索できるようにしたい。

Ack のドキュメンタリーは次のように述べています。

:Ack[!] [options] {pattern n} [{directory}]                               *:Ack*

Search recursively in {directory} (which defaults to the current
directory) for the {pattern}.  Behaves just like the |:grep| command, but
will open the |Quickfix| window for you. If [!] is not given the first
occurrence is jumped to.

VimFandomで、ファイルの現在のディレクトリを取得できることがわかりましたが、 これecho expand('%:p:h')を Ack コマンドで評価するにはどうすればよいですか?

次のようなものが必要です。

:Ack searchpattern expand('%:p:h')

4

4 に答える 4