如何突出显示标尺格式
How to highlight rulerformat
我想要 hi在我的 .vimrc
.
中突出显示 rulerformat
我有
set ruler
set rulerformat=%55(%{strftime('%a\ %b\ %e\ %I:%M\ %p')}\ %5l,%-6(%c%V%)\ %P%)
我随后尝试了以下所有方法:
hi rulerformat ctermbg=1
hi rulerformat ctermbg=red
hi Group1 ctermbg=red "if you modify the rulerformat slightly you can try to access group 1
我不一定希望它是红色的,但我认为那会最突出;无论如何,我只是无法让它工作,而且我并没有真正在网上找到任何东西(有点松散的搜索没有产生太多)。那么,如何 hi 突出 rulerformat?
-- 编辑--
我想我完全错过了你问题的重点。
您似乎想要的不是在 vimrc
中突出显示 'rulerformat'
的值的方法(因为您反复强调 rulerformat,您的title and your introductory sentence imply) but your actual ruler
, at the bottom of the window.
如果您按照 :help 'statusline'
:
中的说明进行操作,这很容易实现
hi User1 ctermfg=1 guifg=#80000
set ruler
:set rulerformat=%55(%1*%{strftime('%a\ %b\ %e\ %I:%M\ %p')}\ %5l,%-6(%c%V%)\ %P%)%*
但如果你愿意阅读,你已经有了解决方案:
:help 'ruler'
:help 'rulerformat'
:help 'statusline'
:help hl-User1
-- 结束编辑 --
'rulerformat'
的值默认高亮,但不是整体高亮:每个字符根据$VIMRUNTIME/syntax/vim.vim
.
中定义的规则单独高亮
如果您想用一种颜色突出显示整个值,您需要将自己的规则添加到 vimrc
:
hi RulerFormat ctermbg=1
augroup RulerFormat
autocmd!
autocmd WinEnter,BufEnter vimrc call matchadd('RulerFormat', 'rulerformat=\zs.\+', -1)
augroup END
我想要 hi在我的 .vimrc
.
我有
set ruler
set rulerformat=%55(%{strftime('%a\ %b\ %e\ %I:%M\ %p')}\ %5l,%-6(%c%V%)\ %P%)
我随后尝试了以下所有方法:
hi rulerformat ctermbg=1
hi rulerformat ctermbg=red
hi Group1 ctermbg=red "if you modify the rulerformat slightly you can try to access group 1
我不一定希望它是红色的,但我认为那会最突出;无论如何,我只是无法让它工作,而且我并没有真正在网上找到任何东西(有点松散的搜索没有产生太多)。那么,如何 hi 突出 rulerformat?
-- 编辑--
我想我完全错过了你问题的重点。
您似乎想要的不是在 vimrc
中突出显示 'rulerformat'
的值的方法(因为您反复强调 rulerformat,您的title and your introductory sentence imply) but your actual ruler
, at the bottom of the window.
如果您按照 :help 'statusline'
:
hi User1 ctermfg=1 guifg=#80000
set ruler
:set rulerformat=%55(%1*%{strftime('%a\ %b\ %e\ %I:%M\ %p')}\ %5l,%-6(%c%V%)\ %P%)%*
但如果你愿意阅读,你已经有了解决方案:
:help 'ruler'
:help 'rulerformat'
:help 'statusline'
:help hl-User1
-- 结束编辑 --
'rulerformat'
的值默认高亮,但不是整体高亮:每个字符根据$VIMRUNTIME/syntax/vim.vim
.
如果您想用一种颜色突出显示整个值,您需要将自己的规则添加到 vimrc
:
hi RulerFormat ctermbg=1
augroup RulerFormat
autocmd!
autocmd WinEnter,BufEnter vimrc call matchadd('RulerFormat', 'rulerformat=\zs.\+', -1)
augroup END