Answers:
(在这里猜测,请提供屏幕截图/更多信息)
您可能要更改conceallevel
设置:
:h 'conceallevel'
'conceallevel' 'cole' *'conceallevel'* *'cole'*
number (default 0)
local to window
{not in Vi}
{not available when compiled without the |+conceal|
feature}
Determine how text with the "conceal" syntax attribute |:syn-conceal|
is shown:
Value Effect ~
0 Text is shown normally
1 Each block of concealed text is replaced with one
character. If the syntax item does not have a custom
replacement character defined (see |:syn-cchar|) the
character defined in 'listchars' is used (default is a
space).
It is highlighted with the "Conceal" highlight group.
2 Concealed text is completely hidden unless it has a
custom replacement character defined (see
|:syn-cchar|).
3 Concealed text is completely hidden.
conceallevel
每次打开文件时都会重置。有什么办法让它始终保持为0?
set conceallevel=2
conceallevel
默认将每个文件的默认值设置为2。可以通过以下方式禁用它:let g:indentLine_setConceal = 0
g:indentLine_setConceal = 0
本质上做到了,因此缩进插件不再起作用。我发现let g:indentLine_fileTypeExclude = ['json']
对我来说效果更好。
如果您使用'indentLine'插件或其他可以更改vim中'隐藏'功能的插件。这是因为这些插件启用了Vim的“隐藏”功能,该功能会根据语法高亮自动隐藏一段文本。此设置将应用于所有语法项目。具体来说,在“ indentLine”插件中,它将“ concealcursor”和“ conceallevel”覆盖为:
let g:indentLine_concealcursor = 'inc'
let g:indentLine_conceallevel = 2
因此,我将其更改为.vimrc文件中的以下值:
let g:indentLine_setConceal = 2
" default ''.
" n for Normal mode
" v for Visual mode
" i for Insert mode
" c for Command line editing, for 'incsearch'
let g:indentLine_concealcursor = ""
另一种设置是let g:indentLine_concealcursor = "nv"
使隐藏的文本环绕光标,仅在“插入”模式和“可视”模式下显示。希望能对您有所帮助。
如果您正在使用indentLine并希望使其保持工作状态,但又希望防止Vim在JSON和Markdown中隐藏内容,则解决方案是要求语法突出显示不使用隐蔽功能。
对于vim-polyglot中包含的JSON和Markdown语法文件,使用以下两行来完成:
let g:vim_json_syntax_conceal = 0
let g:vim_markdown_conceal = 0
如果您使用的是plasticboy / vim-markdown插件,请输入.vimrc
:
let g:vim_markdown_conceal = 0
let g:vim_markdown_conceal_code_blocks = 0
:redir > foo
,:hi
(按空格浏览所有高亮组):redir end
,,然后在foo
此处添加新创建文件的内容。