In Neovim (and Vim), conceallevel is a window-local option that controls how (and whether) text marked with the conceal syntax attribute is hidden or replaced. It’s most often used in Markdown, LaTeX, JSON or other filetypes where you might want to hide delimiters (**, ~~, etc.) or show prettier symbols in their place.
The four conceal levels
| Value | Behavior |
|---|
| 0 | No concealing. All text—including anything marked conceal—is shown. |
| 1 | Conceal, but show one placeholder. Hidden text is replaced by the first character of the syntax match. |
| 2 | Conceal completely. Hidden text is replaced by the cchar (conceal character) if set, otherwise by a single space. |
| 3 | Full conceal, no placeholder. Hidden text is removed entirely—no placeholder. |
How to set it
In init.vim (Vimscript):
" Window-local
setlocal conceallevel=2
" or globally for all new windows
autocmd FileType markdown setlocal conceallevel=2
In init.lua (Lua):
-- window-local (current window)
vim.wo.conceallevel = 2
-- for all markdown buffers
vim.api.nvim_create_autocmd("FileType", {
pattern = "markdown",
callback = function() vim.wo.conceallevel = 2 end,
})
You can also use the more flexible vim.opt_local:
vim.api.nvim_buf_create_user_command(0, "MyConcealOn", function()
vim.opt_local.conceallevel = 2
end, {})
Example in Markdown
Consider the Markdown line:
This is **bold** and this is `inline code`.
With conceallevel:
-
0:
This is bold and this is inline code.
-
1 (default in many setups):
This is bold and this is `.
(Bold delimiters replaced by *, code backticks still visible.)
-
2:
This is bold and this is inline code.
(All delimiters hidden; code text still shown.)
-
3:
This is bold and this is inline code.
(Same as 2, but even the placeholder space is gone.)
Related settings
-
concealcursor — controls in which modes concealed text is hidden.
e.g.
set concealcursor=n " only conceal in Normal mode
set concealcursor=nc " Normal & Command-line
-
Syntax or Treesitter must mark regions with the conceal attribute. Many filetype plugins do this by default for Markdown (e.g. hiding **, ~~, etc.).
Quick tip
To quickly toggle conceal on/off in the current window, you could map:
" init.vim
nnoremap <leader>c :setlocal conceallevel=&conceallevel==0?2:0<CR>
-- init.lua
vim.keymap.set("n", "<leader>c", function()
vim.wo.conceallevel = (vim.wo.conceallevel == 0) and 2 or 0
end, { desc = "Toggle conceallevel" })
That’s basically what vim.wo.conceallevel does: it lets you hide or replace “concealed” text in a window, giving you a cleaner or more semantic view of things like markup or code delimiters.