今天升级了我的Vim插件,发现打开neovim后不能正常使用了,查看帮助信息发现,是因为自动缩进插件indent-blankline升级到了v3.0, 升级后按官方说法只适用于最新的neovim,于是将其仓库克隆后把README.md贴到此处方便参考。
Indent Blankline
This plugin adds indentation guides to Neovim.
It uses Neovim’s virtual text feature and no conceal
To start using indent-blankline, call the ibl.setup() function.
This plugin requires the latest stable version of Neovim.
Install
Use your favourite plugin manager to install.
For
lazy.nvim
:
1
| { "lukas-reineke/indent-blankline.nvim", opts = {} },
|
For
pckr.nvim
:
1
| use "lukas-reineke/indent-blankline.nvim"
|
Setup
To initialize and configure indent-blankline, run the setup function.
Optionally, you can pass a configuration table to the setup function. For all
available options, take a look at :help ibl.config.
Screenshots
Simple

Scope
Scope requires treesitter to be setup.

The start and end of scope uses underline, so to achieve the best result you
might need to tweak the underline position. In Kitty terminal for example you
can do that with
modify_font
Mixed indentation

Multiple indent colors
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| local highlight = {
"RainbowRed",
"RainbowYellow",
"RainbowBlue",
"RainbowOrange",
"RainbowGreen",
"RainbowViolet",
"RainbowCyan",
}
local hooks = require "ibl.hooks"
-- create the highlight groups in the highlight setup hook, so they are reset
-- every time the colorscheme changes
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
end)
require("ibl").setup { indent = { highlight = highlight } }
|

Background color indentation guides
1
2
3
4
5
6
7
8
9
10
11
12
| local highlight = {
"CursorColumn",
"Whitespace",
}
require("ibl").setup {
indent = { highlight = highlight, char = "" },
whitespace = {
highlight = highlight,
remove_blankline_trail = false,
},
scope = { enabled = false },
}
|

rainbow-delimiters.nvim integration
rainbow-delimiters.nvim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| local highlight = {
"RainbowRed",
"RainbowYellow",
"RainbowBlue",
"RainbowOrange",
"RainbowGreen",
"RainbowViolet",
"RainbowCyan",
}
local hooks = require "ibl.hooks"
-- create the highlight groups in the highlight setup hook, so they are reset
-- every time the colorscheme changes
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
end)
vim.g.rainbow_delimiters = { highlight = highlight }
require("ibl").setup { scope = { highlight = highlight } }
hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)
|
