Yggdroot / indentLine

A vim plugin to display the indention levels with thin vertical lines
MIT License
4.13k stars 227 forks source link

Disable Indentline for dashboard #383

Open jcmunozo opened 1 year ago

jcmunozo commented 1 year ago

There is any way to disable for filestype? the indent lines is render on my dashboard :(

NeumoNeumo commented 1 year ago

Yes. You may use the following vimscript to disable indentline on your dashboard buffer.

augroup disableIndentlineDb
  autocmd!
  au FileType dashboard let b:indentLine_enabled = 0
augroup END

Check :help ft, :help au for more information

jcmunozo commented 1 year ago

thank you for your reply, i am using Lua, so in the end I used this vim.cmd([[ autocmd User AlphaReady :IndentLinesDisable ]]) in the "goolord/apha-nvm" configuration. What do you think about it? is it a bad practice?

NeumoNeumo commented 1 year ago

You'd better use

vim.cmd[[
augroup disableIndentlineDb
  autocmd! -- clear cmds in this group first to avoid duplication
  au FileType dashboard let b:indentLine_enabled = 0
augroup END
]]

Every time you source your configuration. autocmd will register a new autocommand which may result in conflicts and performance degradation as mentioned in :h au:

:autocmd adds to the list of autocommands regardless of whether they are already present. When your .vimrc file is sourced twice, the autocommands will appear twice. To avoid this, define your autocommands in a group.

Besides, if you are preferable to a lua-style configuration for autocommands, please refer to :h nvim_create_autocmd

jcmunozo commented 1 year ago

thanks, I will implement it, :)