V2EX hugulas
 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 等):请参考其各自的文档或设置菜单,查找类似的选项以禁止制表符转换为空格。

希望这些方法能够帮助你在终端中保留制表符的原始格式。
echarts 好用,plotly 我用过,感觉还是 echarts 更加易用
关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2978 人在线   最高记录 6679       Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 13ms UTC 12:39 PVG 20:39 LAX 05:39 JFK 08:39
Do have faith in what you're doing.
ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86