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.
Use your favourite plugin manager to install.
For lazy.nvim:
{
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
---@module "ibl"
---@type ibl.config
opts = {},
}
For pckr.nvim:
use "lukas-reineke/indent-blankline.nvim"
To initialize and configure indent-blankline, run the setup
function.
require("ibl").setup()
Optionally, you can pass a configuration table to the setup function. For all
available options, take a look at :help ibl.config
.
require("ibl").setup()
![Screenshot](https://private-user-images.githubusercontent.com/12900252/265403571-69ca7bb2-e294-4437-818b-8b47e63244b3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5NzkxNjAsIm5iZiI6MTcyMzk3ODg2MCwicGF0aCI6Ii8xMjkwMDI1Mi8yNjU0MDM1NzEtNjljYTdiYjItZTI5NC00NDM3LTgxOGItOGI0N2U2MzI0NGIzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDExMDEwMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE3N2Q4ZWEyNDI3MDhiYWRhNjU0NzM5NThiMTkyN2VjNjA2MzM5ZDg2NWFjMTI4ZmM2NTdjODU4OTk5YTI2NzImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ahwLdFhm5HdZvLs3YZUtEv_wg0CJAV7wUFrAy2hg6eg)
Scope requires treesitter to be set up.
require("ibl").setup()
![Screenshot](https://private-user-images.githubusercontent.com/12900252/265403827-a9d2426f-56a4-44bd-8bb5-2a3c5f5ca384.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5NzkxNjAsIm5iZiI6MTcyMzk3ODg2MCwicGF0aCI6Ii8xMjkwMDI1Mi8yNjU0MDM4MjctYTlkMjQyNmYtNTZhNC00NGJkLThiYjUtMmEzYzVmNWNhMzg0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDExMDEwMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMyYjE2ZTFlYjQ2ZWIzZGYzMmZlNTI5ZDFhZWIxZWIxZGQxNWQ1MjFkMjcwZDc4ZmI5YWY0NjQ2ZTQ3MGEwNDcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.RmVcaq7kOc3Uav6kaZ3wlH4C9fnt48MJSWZb2h1zHgA)
The scope is not the current indentation level! Instead, it is the
indentation level where variables or functions are accessible, as in Wikipedia Scope (Computer Science). This depends
on the language you are writing. For more information, see :help ibl.config.scope
.
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
require("ibl").setup()
![Screenshot](https://private-user-images.githubusercontent.com/12900252/265404807-64a1a3c6-74e6-4183-901d-ad94c1edc59c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5NzkxNjAsIm5iZiI6MTcyMzk3ODg2MCwicGF0aCI6Ii8xMjkwMDI1Mi8yNjU0MDQ4MDctNjRhMWEzYzYtNzRlNi00MTgzLTkwMWQtYWQ5NGMxZWRjNTljLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDExMDEwMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTVmNjQ1YjU0NmM3NjMwZWI4NDZlNmQ1N2U1ZjM5OGRmYjU3MDQyOTU4M2YxNmU4YTY3YzlhOWJlZmY2NDRiNDgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.oVPa8jXWeK4y0b6Zc7Ns7CpoW43u6UpVEqGm-uZeehs)
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 } }
![Screenshot](https://private-user-images.githubusercontent.com/12900252/265404414-78fd962a-67fa-4ddf-8924-780256dfd118.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5NzkxNjAsIm5iZiI6MTcyMzk3ODg2MCwicGF0aCI6Ii8xMjkwMDI1Mi8yNjU0MDQ0MTQtNzhmZDk2MmEtNjdmYS00ZGRmLTg5MjQtNzgwMjU2ZGZkMTE4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDExMDEwMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNkNjc2OWU2NmFhNmQ3MTE2OGRkODYxMDZkMmY1OTdhYzY2YTU3ODlmZGJhMmRlYzlmYTFjZjAxYzY0ZGY4YTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.0k8ddepts_eCSnlv8MFXsEKYx357OU6OjYR2Q34YX7U)
local highlight = {
"CursorColumn",
"Whitespace",
}
require("ibl").setup {
indent = { highlight = highlight, char = "" },
whitespace = {
highlight = highlight,
remove_blankline_trail = false,
},
scope = { enabled = false },
}
![Screenshot](https://private-user-images.githubusercontent.com/12900252/265404984-35d70992-4482-4577-b1e1-28fda23b2b2d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5NzkxNjAsIm5iZiI6MTcyMzk3ODg2MCwicGF0aCI6Ii8xMjkwMDI1Mi8yNjU0MDQ5ODQtMzVkNzA5OTItNDQ4Mi00NTc3LWIxZTEtMjhmZGEyM2IyYjJkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDExMDEwMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRjN2FmNGY2YzFiZGE4MzVkNDJjNjZlMzM4ODQwMGE1YWExODQ3MGIxMDA4MWYzNzgyMjNiMjk1MTE2MWQxMGImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.FyZ-Z1NLDZsRn2dVKOedcZuLcva4k6dcEDOUJ2kRTDA)
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)
![Screenshot](https://private-user-images.githubusercontent.com/12900252/265403990-67707d8e-57d3-411c-8418-77908d8babd9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5NzkxNjAsIm5iZiI6MTcyMzk3ODg2MCwicGF0aCI6Ii8xMjkwMDI1Mi8yNjU0MDM5OTAtNjc3MDdkOGUtNTdkMy00MTFjLTg0MTgtNzc5MDhkOGJhYmQ5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDExMDEwMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTllOTNiM2U3NTU1MDkyMzEwMjA4MDMxODhiNjY5YjNmOTAyZDkwZjA5ZGJhMzA1MGYzYWMyMmJlYTY2M2I2MDgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.xxrk1VkrpttJr7Zp9HAMokW2BLtpHVcyUtE1hIJPxXA)