Coder Social home page Coder Social logo

indent-blankline.nvim's Introduction

Indent Blankline

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

It uses Neovim's 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.

For lazy.nvim:

{ "lukas-reineke/indent-blankline.nvim" },

For packer.nvim:

use "lukas-reineke/indent-blankline.nvim"

For vim-plug:

Plug 'lukas-reineke/indent-blankline.nvim'

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 {
    -- for example, context is off by default, use this to turn it on
    show_current_context = true,
    show_current_context_start = true,
}

Please see :help indent_blankline.txt for 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,
}

Screenshot

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 = " ",
}

Screenshot

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",
    },
}

Screenshot

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,
}

Screenshot

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,
    show_current_context_start = true,
}

Screenshot

show_current_context_start 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

Thanks

Special thanks to Yggdroot/indentLine

indent-blankline.nvim's People

Contributors

lukas-reineke avatar jbarap avatar rhino1998 avatar daxtorim avatar cooperuser avatar mesalilac avatar zeertzjq avatar utilyre avatar goncalves-diogo avatar etiamnullam avatar wincent avatar ggustafsson avatar jpfender avatar crivotz avatar prince213 avatar goolord avatar crumbtoo avatar ek234 avatar kil0meters avatar ryota2357 avatar steven-omaha avatar yamatsum avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.