是否可以为moreandless命令设置制表位(每个制表符的空格数)?在 vi 中,我已将此行添加到.vimrc
set tabstop=4
Run Code Online (Sandbox Code Playgroud)
但是,当我使用more它阅读文件时,每个选项卡仍然使用 8 个空格
$ more style.css
div {
width: 100%;
}
Run Code Online (Sandbox Code Playgroud)
这是我可以在.bashrc或类似文件中配置的内容吗?
来自man less:
-xn,... or --tabs=n,...
Sets tab stops. If only one n is specified, tab stops are set at
multiples of n. If multiple values separated by commas are specified,
tab stops are set at those positions, and then continue with the same
spacing as the last two. For example, -x9,17 will set tabs at positions
9, 17, 25, 33, etc. The default for n is 8.
Run Code Online (Sandbox Code Playgroud)
手册页还描述了如何使用 setenv 或 export 为 less 设置默认选项。添加LESS="-x4";export LESS到您的 ~/.bashrc 应该可以解决问题