If you want to show a git grep results into vim tabs, here is how to do so:
//-p to open tabs, -O to open in split windows, -n No swap file, use memory only,
$ or ` means subshell, -l is the same as --name-only
//search for a string and show all files in tabs
vim -pn $(git grep -l searchme )
vim -pn `git grep -l .searchme `
vim -On `git grep -l .searchme `
//
search for a string and show all files in tabs and show the search
vim
+/.searchme
-nO `git grep -l .searchme * `
you can also write a bash function:
//method 2
# open files found by git grep
function vgr(){
vim -p "
+:silent /$1
" `git grep --name-only $*`
}
//method 3 with xargs
git grep -l .searchme
| xargs sh -c '
vim中显示git grep内容
最新推荐文章于 2021-11-19 15:07:47 发布