我将rxvt-unicode
, version9.22
用作终端模拟器,并使用文件~/.Xresources
.
当我修改配置文件时,为了立即查看效果,我执行命令:
xrdb ~/.Xresources
Run Code Online (Sandbox Code Playgroud)
来自man xrdb
:
以感叹号 (!) 开头的行将被忽略并可用作注释。
在我的机器上,使用xrdb
version 1.1.0
,当注释行包含奇数个单引号时,例如! it's a comment
,会xrdb
报错,例如:
/home/user/.Xresources:1:5: warning: missing terminating ' character
! it's a comment
^
Run Code Online (Sandbox Code Playgroud)
目前,我将单引号加倍以避免此错误:
! it''s a comment
Run Code Online (Sandbox Code Playgroud)
我想我也可以使用/* */
, 而不是!
,因为它是 Vim 默认使用的注释字符串(在 中定义$VIMRUNTIME/ftplugin/xdefaults.vim
)。但我更喜欢使用!
,因为我发现用它来评论更具可读性。
有没有办法要求xrdb
忽略注释行内的单引号~/.Xresources
?
这似乎是由于 GNU 的默认行为发生了变化cpp
,它xrdb
用作其默认预处理器。具体来说,根据The C Preprocessor: 10.1 传统词法分析:
一般而言,在传统模式中,开头引用不需要匹配的结尾引用。
但是cpp
提供了一个命令行选项以在传统模式下运行:
-traditional
-traditional-cpp
Try to imitate the behavior of pre-standard C preprocessors, as opposed to ISO
C preprocessors. See Traditional Mode.
Run Code Online (Sandbox Code Playgroud)
whilexrdb
允许在其命令行上显式定义预处理器:
-cpp filename
This option specifies the pathname of the C preprocessor pro?
gram to be used. Although xrdb was designed to use CPP, any
program that acts as a filter and accepts the -D, -I, and -U
options may be used.
Run Code Online (Sandbox Code Playgroud)
因此应该可以通过使用来抑制警告
xrdb -cpp "/usr/bin/cpp -traditional-cpp" ~/.Xresources
Run Code Online (Sandbox Code Playgroud)
或者
xrdb -cpp "/usr/bin/cpp -traditional" ~/.Xresources
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
493 次 |
最近记录: |