indentLine icon indicating copy to clipboard operation
indentLine copied to clipboard

Disable Indentline for dashboard

Open jcmunozo opened this issue 2 years ago • 4 comments

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

jcmunozo avatar Jan 12 '23 23:01 jcmunozo

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

NeumoNeumo avatar Mar 03 '23 15:03 NeumoNeumo

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?

jcmunozo avatar Mar 03 '23 21:03 jcmunozo

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

NeumoNeumo avatar Mar 04 '23 02:03 NeumoNeumo

thanks, I will implement it, :)

jcmunozo avatar Mar 04 '23 03:03 jcmunozo