使用git grep时自动换行

Zac*_*Zac 6 linux git terminal

我试图从终端运行git grep(使用Titanium).结果没有包裹并在窗口被切断,所以我什么都看不懂.我尝试搞乱配置,但无法得到任何东西.如何将这些grep结果包装好?

Osc*_*orz 6

你有没有core.pager进入你的.gitconfig?如果您正在使用less,可以通过按键盘上的右箭头键来查看额外的字符.

编辑:即使我取消设置core.pager,git grep似乎less -S默认调用.

编辑2:哎呀,正如Keith Thompson指出的那样less默认包装线.从手册页:

   -S or --chop-long-lines
          Causes lines longer than the screen width to be  chopped  rather
          than  folded.  That is, the portion of a long line that does not
          fit in the screen width is not shown.  The default  is  to  fold
          long lines; that is, display the remainder on the next line.
Run Code Online (Sandbox Code Playgroud)

  • 在`less`中,`-S`在包装和截断之间切换. (2认同)