Easily configure and toggle listchars
In order to display listchars
by default,
you must enable them somewhere in your init.lua
before loading the plugin.
vim.opt.list = true
If you simply want to display listchars
when needed,
you can toggle them ON/OFF with the command :ListcharsToggle
.
{ "fraso-dev/nvim-listchars", config = true }
use {
"fraso-dev/nvim-listchars",
config = function()
require("nvim-listchars").setup()
end
}
{
save_state = true, -- If enabled, save toggled state in a cache file. Will overwrite current `vim.opt.list` value.
listchars = { -- `listchars` to be displayed. See available options by running `:help listchars`
tab = "> ",
trail = "-",
nbsp = "+",
},
exclude_filetypes = {}, -- List of filetypes where `listchars` is disabled
lighten_step = 5, -- Amount to add/remove from base color
}
{
"fraso-dev/nvim-listchars",
config = function()
require("nvim-listchars").setup({
save_state = false,
listchars = {
trail = "-",
eol = "↲",
tab = "» ",
},
exclude_filetypes = {
"markdown"
},
lighten_step = 10,
})
end,
}
You can find the complete list of available chars by running :help listchars
:ListcharsStatus
:ListcharsToggle
:ListcharsDisable
:ListcharsEnable
:ListcharsClearCache
:ListcharsLightenColors
:ListcharsDarkenColors
If you want to enable tab
chars you must disable expandtab
:
vim.opt.expandtab = false