1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Merge pull request #84 from jdhao/indentline

update indent-blankline conf
This commit is contained in:
jdhao 2022-08-28 14:56:35 +08:00 committed by GitHub
commit 208b190a65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,6 @@
local api = vim.api
local exclude_ft = { "help", "git", "markdown", "snippets", "text", "gitconfig", "alpha" }
require("indent_blankline").setup({ require("indent_blankline").setup({
-- U+2502 may also be a good choice, it will be on the middle of cursor. -- U+2502 may also be a good choice, it will be on the middle of cursor.
-- U+250A is also a good choice -- U+250A is also a good choice
@ -5,19 +8,22 @@ require("indent_blankline").setup({
show_end_of_line = false, show_end_of_line = false,
disable_with_nolist = true, disable_with_nolist = true,
buftype_exclude = { "terminal" }, buftype_exclude = { "terminal" },
filetype_exclude = { "help", "git", "markdown", "snippets", "text", "gitconfig", "alpha" }, filetype_exclude = exclude_ft,
}) })
vim.cmd([[ local gid = api.nvim_create_augroup("indent_blankline", { clear = true })
function! Should_activate_indentblankline() abort api.nvim_create_autocmd("InsertEnter", {
if index(g:indent_blankline_filetype_exclude, &filetype) == -1 pattern = "*",
IndentBlanklineEnable group = gid,
endif command = "IndentBlanklineDisable"
endfunction })
augroup indent_blankline api.nvim_create_autocmd("InsertLeave", {
autocmd! pattern = "*",
autocmd InsertEnter * IndentBlanklineDisable group = gid,
autocmd InsertLeave * call Should_activate_indentblankline() callback = function()
augroup END if not vim.tbl_contains(exclude_ft, vim.bo.filetype) then
]]) vim.cmd [[IndentBlanklineEnable]]
end
end
})