aboutsummaryrefslogtreecommitdiff
path: root/lua/config
diff options
context:
space:
mode:
authorjdhao <jdhao@hotmail.com>2021-11-06 23:10:24 +0800
committerjdhao <jdhao@hotmail.com>2021-11-06 23:10:24 +0800
commit62b62265203a9c2949ec80ae205b350c37fd2fc8 (patch)
tree52646d268a2ad266b54aa53dbc588337a31dbfe1 /lua/config
parentbd92419bf9867d30d61b5dc9968ebc5a6595f2c7 (diff)
fix indent-blankline activation bug
When InsertLeave is triggered, we should check if we need to start indent-blankline before enabling it.
Diffstat (limited to 'lua/config')
-rw-r--r--lua/config/indent-blankline.lua22
1 files changed, 14 insertions, 8 deletions
diff --git a/lua/config/indent-blankline.lua b/lua/config/indent-blankline.lua
index 6b133e5..7efca86 100644
--- a/lua/config/indent-blankline.lua
+++ b/lua/config/indent-blankline.lua
@@ -1,17 +1,23 @@
require("indent_blankline").setup({
- -- U+2502 may also be a good choice, it will be on the middle of cursor.
- -- U+250A is also a good choice
- char = "▏",
- show_end_of_line = false,
- disable_with_nolist = true,
- buftype_exclude = { "terminal" },
- filetype_exclude = { "help", "git", "markdown", "snippets", "text", "gitconfig" },
+ -- U+2502 may also be a good choice, it will be on the middle of cursor.
+ -- U+250A is also a good choice
+ char = "▏",
+ show_end_of_line = false,
+ disable_with_nolist = true,
+ buftype_exclude = { "terminal" },
+ filetype_exclude = { "help", "git", "markdown", "snippets","text", "gitconfig" },
})
vim.cmd([[
+function! Should_activate_indentblankline() abort
+ if index(g:indent_blankline_filetype_exclude, &filetype) == -1
+ IndentBlanklineEnable
+ endif
+endfunction
+
augroup indent_blankline
autocmd!
autocmd InsertEnter * IndentBlanklineDisable
- autocmd InsertLeave * IndentBlanklineEnable
+ autocmd InsertLeave * call Should_activate_indentblankline()
augroup END
]])