vimtricks.wiki Concise Vim tricks, one at a time.

How do I keep concealed text hidden while navigating but automatically reveal it when my cursor enters insert mode?

Answer

:set concealcursor=nv

Explanation

The 'concealcursor' option controls in which modes concealed text is revealed on the cursor line. Setting it to nv hides the raw markup in Normal and Visual mode (so your Markdown or LaTeX stays rendered-looking), but automatically reveals the underlying syntax when you switch to Insert mode — exactly when you need to see and edit the actual characters.

How it works

  • 'concealcursor' accepts a string of mode letters: n (Normal), v (Visual), i (Insert), c (Command-line)
  • The characters listed are the modes in which the concealment is kept on the cursor line
  • nv — kept in Normal and Visual, but revealed in Insert and Command-line
  • The default is "" (empty), which reveals on the cursor line in all modes
  • The alternative nvi keeps it hidden even in Insert mode — useful for distraction-free writing but makes editing markup harder

Example

In a Markdown file with conceallevel=2:

:set conceallevel=2
:set concealcursor=nv

With the cursor on **bold** in Normal mode: you see the rendered bold indicator. As soon as you press i to enter Insert mode, the ** markers become visible so you can edit them precisely.

Tips

  • Requires conceallevel >= 1 to have any visible effect (conceallevel=0 disables concealment entirely)
  • Pair with concealcursor=nvc to also keep hidden during command-line mode (e.g., when typing /)
  • Many Markdown and LaTeX plugins set their own concealcursor value via FileType autocmds; use :verbose set concealcursor? to see where it was set

Next

How do I open the directory containing the current file in netrw from within Vim?