lukas-reineke/indent-blankline.nvim

github github
indent plugin
star 834
stars
alert-circle 15
open issues
users 11
subscribers
git-branch 33
forks
CREATED

2020-04-11

UPDATED

41 minutes ago

packer

require('packer').startup(function()
  use 'lukas-reineke/indent-blankline.nvim'
end)

paq

require "paq" { 
  'lukas-reineke/indent-blankline.nvim'
}

Indent Blankline

This plugin adds indentation guides to all lines (including empty lines).

It uses Neovims virtual text feature and no conceal

This plugin requires Neovim 0.5 or higher. It makes use of Neovim only features so it will not work in Vim. There is a legacy version of the plugin that supports Neovim 0.4 under the branch version-1

Install

Use your favourite plugin manager to install.

Example with Packer

wbthomason/packer.nvim

-- init.lua
require("packer").startup(
    function()
        use "lukas-reineke/indent-blankline.nvim"
    end
)

Example with Plug

junegunn/vim-plug

" init.vim
call plug#begin('~/.vim/plugged')
Plug 'lukas-reineke/indent-blankline.nvim'
call plug#end()

Setup

To configure indent-blankline, either run the setup function, or set variables manually. The setup function has a single table as argument, keys of the table match the :help indent-blankline-variables without the indent_blankline_ part.

require("indent_blankline").setup {
    char = "|",
    buftype_exclude = {"terminal"}
}

Please see :help indent_blankline.txtfor more details and all possible values.

A lot of Yggdroot/indentLine options should work out of the box.

Screenshots

All screenshots use my custom onedark color scheme.

Simple

vim.opt.list = true
vim.opt.listchars:append("eol:↴")

require("indent_blankline").setup {
    show_end_of_line = true,
}

With custom listchars and g:indent_blankline_space_char_blankline

vim.opt.list = true
vim.opt.listchars:append("space:⋅")
vim.opt.listchars:append("eol:↴")

require("indent_blankline").setup {
    show_end_of_line = true,
    space_char_blankline = " ",
}

With custom g:indent_blankline_char_highlight_list

vim.opt.termguicolors = true
vim.cmd [[highlight IndentBlanklineIndent1 guifg=#E06C75 gui=nocombine]]
vim.cmd [[highlight IndentBlanklineIndent2 guifg=#E5C07B gui=nocombine]]
vim.cmd [[highlight IndentBlanklineIndent3 guifg=#98C379 gui=nocombine]]
vim.cmd [[highlight IndentBlanklineIndent4 guifg=#56B6C2 gui=nocombine]]
vim.cmd [[highlight IndentBlanklineIndent5 guifg=#61AFEF gui=nocombine]]
vim.cmd [[highlight IndentBlanklineIndent6 guifg=#C678DD gui=nocombine]]

vim.opt.list = true
vim.opt.listchars:append("space:⋅")
vim.opt.listchars:append("eol:↴")

require("indent_blankline").setup {
    space_char_blankline = " ",
    char_highlight_list = {
        "IndentBlanklineIndent1",
        "IndentBlanklineIndent2",
        "IndentBlanklineIndent3",
        "IndentBlanklineIndent4",
        "IndentBlanklineIndent5",
        "IndentBlanklineIndent6",
    },
}

With custom background highlight

vim.opt.termguicolors = true
vim.cmd [[highlight IndentBlanklineIndent1 guibg=#1f1f1f gui=nocombine]]
vim.cmd [[highlight IndentBlanklineIndent2 guibg=#1a1a1a gui=nocombine]]

require("indent_blankline").setup {
    char = " ",
    char_highlight_list = {
        "IndentBlanklineIndent1",
        "IndentBlanklineIndent2",
    },
    space_char_highlight_list = {
        "IndentBlanklineIndent1",
        "IndentBlanklineIndent2",
    },
    show_trailing_blankline_indent = false,
}

With context indent highlighted by treesitter

vim.opt.list = true
vim.opt.listchars:append("space:⋅")
vim.opt.listchars:append("eol:↴")

require("indent_blankline").setup {
    space_char_blankline = " ",
    show_current_context = true,
}

Thanks

Special thanks to Yggdroot/indentLine