hugulas 最近的时间轴更新
hugulas

hugulas

V2EX 第 426094 号会员,加入于 2019-07-01 23:00:27 +08:00
hugulas 最近回复了
gpt 答案: 我验证了 less -R, 你试试

-R or --RAW-CONTROL-CHARS
Like -r, but only ANSI "color" escape sequences and OSC 8 hyperlink sequences are output in "raw" form. Unlike -r, the screen appearance is maintained correctly, provided that there are no escape sequences in the file other than
these types of escape sequences. Color escape sequences are only supported when the color is changed within one line, not across lines. In other words, the beginning of each line is assumed to be normal (non-colored),
regardless of any escape sequences in previous lines. For the purpose of keeping track of screen appearance, these escape sequences are assumed to not move the cursor.

OSC 8 hyperlinks are sequences of the form:

ESC ] 8 ; ... \7

The terminating sequence may be either a BEL character (\7) or the two-character sequence "ESC \".

ANSI color escape sequences are sequences of the form:

ESC [ ... m

where the "..." is zero or more color specification characters. You can make less think that characters other than "m" can end ANSI color escape sequences by setting the environment variable LESSANSIENDCHARS to the list of
characters which can end a color escape sequence. And you can make less think that characters other than the standard ones may appear between the ESC and the m by setting the environment variable LESSANSIMIDCHARS to the list of
characters which can appear.


这个问题可能是由终端软件的显示设置引起的,而不是由具体的命令本身引起的。许多终端软件默认将制表符( Tab )转换为空格以实现对齐的效果。

不过,你可以尝试按照下面的方法进行调整,使终端软件不对制表符进行转换:

对于 less 命令,你可以尝试在终端中使用 -R 或 --RAW-CONTROL-CHARS 选项来显示控制字符,包括制表符。示例命令如下:
less -R <file>
对于 vim ,你可以编辑其配置文件 ~/.vimrc (如果不存在,可以创建一个),将下面的内容添加到文件中:
set paste
然后保存并退出,并重新启动 vim ,它将开启“粘贴模式”,在此模式下粘贴的文本将保留制表符。

无论是 less 还是 vim ,它们的行为都受到终端软件的限制。所以,你还可以尝试以下方法来修改终端软件的显示设置:

对于 GNOME Terminal:打开终端后,点击菜单栏的“编辑”选项,然后选择“首选项”。在“首选项”对话框中,导航到“选项”选项卡,取消勾选“将制表符转换为空格”选项。然后点击“关闭”按钮保存更改。

对于其他终端软件(例如 Konsole 、Terminator 等):请参考其各自的文档或设置菜单,查找类似的选项以禁止制表符转换为空格。

希望这些方法能够帮助你在终端中保留制表符的原始格式。
2019-09-20 11:31:34 +08:00
回复了 istill 创建的主题 Python pyecharts 和 Plotly 哪个好呢,准备选一个 Python 可视化的库学习
echarts 好用,plotly 我用过,感觉还是 echarts 更加易用
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1088 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 11ms · UTC 22:59 · PVG 06:59 · LAX 14:59 · JFK 17:59
Developed with CodeLauncher
♥ Do have faith in what you're doing.