Find a file (via recursive directory search) in Vim

后端 未结 15 1211
感情败类
感情败类 2020-12-22 18:42

Is there any way to search a directory recursively for a file (using wildcards when needed) in Vim? If not natively, is there a plugin that can handle this?

15条回答
  •  无人及你
    2020-12-22 18:58

    ag tool and corresponding Ag vim plugin solves this problem perfectly:

    To find a file using some pattern use:

    AgFile! pattern
    

    It will open quickfix window with results where you can choose.

    You can add vim keybinding to call this command using selected word as a pattern.

    nnoremap   :AgFile! ''
    vnoremap   y :AgFile! '"'
    

提交回复
热议问题