一次編譯u-boot時有個錯誤做不到nand_readd.o,本來應該找nand_read.o才對的,我用find -iname "nand_readd.*" 沒有找到這個文件我想應該是關鍵此錯誤我就找,文件太多找不到,我在網上一查用了這個指令:
grep -r --include=*.h -o --include=*.cpp -o --include=*.c <key_words_to_search> <path_to_search>
其中-R, -r, --recursive
Read all files under each directory, recursively; this is equivalent to the -d
recurse option.
結合實際:
grep -r --include=*.* nand_readd ~/u-boot/
很快就找到了
或者:
全文搜索
:vimgrep(正常模式下使用命令) 全文搜索,功能同grep命令,但是支持在vim進行多文件跳轉定位。
使用方法:vimgrep 正則表達式 文件。文件支持通配符,例如*.c代表所有的.c文件。如果希望遞歸搜索,可以使用**/*,表示搜索所有的文件。
:cl 列舉結果
:cc(正常模式下使用命令) 當前結果
:cn(正常模式下使用命令) 下一個結果
:cp(正常模式下使用命令) 上一個結果
:cw(正常模式下使用命令) 重新打開搜索結果窗口