是否有方法在vim航空公司状态栏中显示主机名信息?
我尝试过将let g:airline_section_a = '%{hostname -s}'添加到我的.vimrc中,但这不起作用--我得到了E121: Undefined variable: hostname。
编辑:这两行/几乎/工作,但我在我的状态行中得到文本calculon^@ --如何去掉多余的两个字符,只显示calculon
let hostname=system('hostname -s')
let g:airline_section_a = '%{hostname}'发布于 2016-04-08 23:23:47
^@是从hostname -s打印出来的换行符,您可以使用tr -d '\n'删除它:
let hostname=system('hostname -s | tr -d "\n"')
let g:airline_section_a = '%{hostname}'还可以在主机名函数中使用构建:
let g:airline_section_a = '%{hostname()}'但必须有一个更优雅的解决方案
https://stackoverflow.com/questions/36510797
复制相似问题