在 git bash 中如何增加less的屏幕宽度? [英] In git bash how to increase less's screen width?

查看:67
本文介绍了在 git bash 中如何增加less的屏幕宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows 10 上使用 git bash 2.32.

I am using git bash 2.32 on Windows 10.

在更新到 2.32 后的 git bash 中,我看到用于显示日志的命令的奇怪行为:

In git bash after updating to 2.32 I see strange behavior of the command I used for displaying log:

git -c core.pager='less -S -F' log --all --decorate --oneline --graph

如您所见,我尝试使用一只狗"带有 less 分页器的命令配置为在 EOF 时退出并剪切长度超过当前屏幕宽度的行.但是在我更新到 2.32 后,输出似乎在 80 个符号后被截断,这通常远小于实际屏幕宽度(如下图所示).

As you can see I try to use "a dog" command with less pager configured to quit on EOF and to cut lines whose length exceed the current screen width. But after I updated to 2.32 the output appears to be truncated after 80 symbols which is usually much less than the actual screen width (as shown on the image below).

我试图了解如何增加该限制,以便 less 截断长度超过 160 个符号的行,或者只是不适合当前屏幕的行.

I am trying to understand how to increase that limit so that less truncates lines that are longer than say 160 symbols or rather the lines that just don't fit the current screen.

注意:我将宽度更改为 160,现在 echo $COLUMNS 返回 160,但这没有一点帮助.

Note: I changed the width to 160 and now echo $COLUMNS returns 160 but that didn't help a bit.

注意:我还为当前会话启用了 checkwinsize 选项.也没有运气.

Note: I also enabled checkwinsize option for the current session. Also no luck.

推荐答案

这是一个相对较新的 Git-for-Windows 错误,包含讨论和补丁 此处 在 Git 邮件列表的档案中.这个 GitHub 问题中有很多进一步的讨论.该错误将在 Git-for-Windows 的下一次更新中修复.

This is a relatively recent Git-for-Windows bug, with discussion and patches found here in the archives for the Git mailing list. There is a lot of further discussion in this GitHub issue. The bug is to be fixed in the next update of Git-for-Windows.

与此同时,请考虑 KalleOlaviNiemitalo 的这种解决方法:

git config --global core.pager "env -u COLUMNS less"

这篇关于在 git bash 中如何增加less的屏幕宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆