42

This drives me crazy, I do

:set ft=text

To see something, otherwise all the links disappear in markdown and quotes in JSON.

How do disable this once and for all?

3
  • 2
    Can you post a screenshot of what you mean? Also, while editing a markdown file, do :redir > foo, :hi (browse through all the highlight groups pressing space), :redir end, and add the contents of the newly created foo file here.
    – muru
    Commented Apr 8, 2016 at 9:25
  • 1
    "# _this_ **that**" will display as "# this that"
    – masukomi
    Commented Jan 30, 2017 at 16:40
  • 2
    @masukomi, use the shorthand version :set cole=0 to turn off concealing of markdown bold ** and italic * marks as well as the replacement of # Title to § Title (more in nobe4's answer below). Commented Oct 29, 2021 at 8:22

9 Answers 9

47

(guessing here, please provide a screenshot/more information)

You may want to change your conceallevel setup:

: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.
6
  • 1
    Oh yeah, just set it to zero in config and that seems to fix it. Interesting that it is 0 by default, I guess some plugins change the settings.
    – firedev
    Commented Apr 14, 2016 at 2:22
  • 1
    It seems that conceallevel is reset every time you open a file. Any way to make it always stick with 0?
    – yktoo
    Commented Apr 14, 2017 at 12:05
  • In your vimrc? set conceallevel=2
    – nobe4
    Commented Apr 14, 2017 at 12:06
  • 8
    To answer my own question and maybe help anyone facing the same issue: I have the indentLine plugin installed, which forces conceallevel to be set to 2 by default for every file. This can be disabled with: let g:indentLine_setConceal = 0
    – yktoo
    Commented Sep 26, 2017 at 8:01
  • 12
    g:indentLine_setConceal = 0 essentially makes it so the indentline plugin no longer works. I found let g:indentLine_fileTypeExclude = ['json'] worked better for me.
    – Matt Greer
    Commented Nov 24, 2017 at 18:20
15

If you are using the 'indentLine' plugin or other plugins that can change 'conceal' features in vim. It is because these plugin enables the Vim 'conceal' feature which automatically hides stretches of text based on syntax highlighting. This setting will apply to all syntax items. Specifically, in 'indentLine' plugin, it will overwrite "concealcursor" and "conceallevel" to:

let g:indentLine_concealcursor = 'inc'
let g:indentLine_conceallevel = 2

So, I change it to the following value in my .vimrc file:

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 = ""

Another option is to let g:indentLine_concealcursor = "nc" which makes the hidden texts surrounding around your cursor only show in 'insert' mode and 'visual' mode.

0
10

If you are using indentLine and want to keep it working but want to prevent Vim from hiding things in JSON and Markdown, the solution is to ask your syntax highlighting to not use the conceal feature.

For the JSON and Markdown syntax files included in vim-polyglot, that's accomplished using the following three lines:

let g:vim_json_syntax_conceal = 0
let g:vim_markdown_conceal = 0
let g:vim_markdown_conceal_code_blocks = 0
5
  • @thiagowfx I've rejected your edit; if you want an answer to incorporate additional code, consider leaving a comment with a request, or adding your own answer.
    – D. Ben Knoble
    Commented Aug 3, 2020 at 16:21
  • @D.BenKnoble Actually, at the time I wrote that, I was under the impression that g:vim_markdown_conceal functioned as a master kill switch, so the edit brought it more in line with my intent.
    – ssokolow
    Commented Aug 4, 2020 at 3:39
  • 1
    fair enough—but reviewers can’t know that if there’s no indication :) that’s why commenting is so effective to help improve answers when it comes to code, IMO
    – D. Ben Knoble
    Commented Aug 4, 2020 at 12:39
  • *chuckle* "fair enough" is my response. Now how am I supposed to acknowledge your point without sounding repetitive? Either way, I'll admit that "ask your syntax highlighting to not use the conceal feature" is a bit too subtle a cue that I'd intended it to disable all use.
    – ssokolow
    Commented Aug 5, 2020 at 5:11
  • > so the edit brought it more in line with my intent | Indeed that's what I thought. Thanks for clarifying.
    – thiagowfx
    Commented Aug 9, 2020 at 19:54
5

If you are using plasticboy/vim-markdown plugin, put in your .vimrc:

let g:vim_markdown_conceal = 0
let g:vim_markdown_conceal_code_blocks = 0
1

I met the same problems (issues/512) when using plasticboy/vim-markdowd plugin.

I have removed all other plugins and grep conceal in .vim folder, it's confirmed there is no conceal related settings except in .vim/bundle/vim-markdowd.

The answer from @Karlo Guidoni Martins seems didn't work for me. I add the 2 lines into the start and into the end of vimrc file.

1
  • 3
    Are you answering or stating that no solution worked (ie you have a question)?
    – D. Ben Knoble
    Commented Sep 11, 2020 at 13:20
1

To disable conceal for JSON and Markdown without disabling indentLine plugin, add these lines to your .vimrc :

let g:vim_json_conceal=0
let g:markdown_syntax_conceal=0

Source : official indentLine documentation

3
  • The information in your answer appears to be covered by existing answers which have been around for a while. Repeating someone else's answer—even if you came up with it independently!—isn't really a goal of the site.
    – D. Ben Knoble
    Commented Dec 5, 2022 at 16:09
  • Nobody proposed my answer. Official doc recommends exactly these two lines. I tried other answers...it didn't work. Commented Dec 5, 2022 at 16:12
  • Ah, apologies; I misread an answer which had almost the same two variables :)
    – D. Ben Knoble
    Commented Dec 5, 2022 at 19:03
0

Thanks to Matt Greer for sharing his solution for disabling the indentLine plugin for a (list of) file types.

Another option is to enable the indentLine plugin only for specific file types. Add the following line to your vimrc to enable the indentLine plugin for yaml only. It will then be disabled for any other file type.(e.g markdown ...).

let g:indentLine_fileType = ['yaml']
3
  • 1
    Welcome to vi.se :) I could be wrong but I think this indexLine plugin you are talking about is not built-in or shipped with vim, right? If it's an external plugin it would be useful to add a link to its repository. EDIT Actually I just saw that other answers are about this plugin, it would be useful to explain how your approach is different and why it would be better (or not) to use it.
    – statox
    Commented Apr 23, 2021 at 13:06
  • hi @statox - thanks for the notice. Matt Greer posted the solution to disable filetypes for the indentLine plugin. I think it's more convenient to only enable the indentLine plugin for the filetypes where it's actually needed for (e.g yaml or python) - so it can not interfere with any other file type.(e.g markdown ...). I should have mentioned that in first place. Commented Apr 27, 2021 at 18:27
  • That's definitely worth mentioning in your answer. You can use the edit button to change it.
    – statox
    Commented Apr 28, 2021 at 8:05
0

It happened to be because of indentLine plugin builtin conceallevel , and simply altering the conceallevel back to 0 -via the default conceallevel option or from the plugin itself- would make the plugin incapable of showing the indentation indicators .
The optimal option for me right now is adding the elzr/vim-json plugin with let g:vim_json_syntax_conceal = 0 option derived from this answer

-1

I also met the same problem and it was related to conceallevel.

Fortunately, bellowing two lines solve my problem.

let g:vim_markdown_conceal = 0
let g:vim_markdown_conceal_code_blocks = 0
1
  • Welcome to Vi and Vim! I didn't downvote, so I can't say for sure, but I suspect the downvote is because the information in your answer is covered by existing answers which have been around for a while. Repeating someone else's answer—even if you came up with it independently!—isn't really a goal of the site.
    – D. Ben Knoble
    Commented Mar 24, 2021 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.