Git Product home page Git Product logo

indent-blankline.nvim's Introduction

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:

{ "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {} }

For pckr.nvim:

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

Setup

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.

Screenshots

Simple

require("ibl").setup()
Screenshot

Scope

Scope requires treesitter to be set up.

require("ibl").setup()
Screenshot

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

Mixed indentation

require("ibl").setup()
Screenshot

Multiple indent colors

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

Background color indentation guides

local highlight = {
    "CursorColumn",
    "Whitespace",
}
require("ibl").setup {
    indent = { highlight = highlight, char = "" },
    whitespace = {
        highlight = highlight,
        remove_blankline_trail = false,
    },
    scope = { enabled = false },
}
Screenshot

rainbow-delimiters.nvim integration

rainbow-delimiters.nvim

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

indent-blankline.nvim's People

Contributors

lukas-reineke avatar jbarap avatar danielkonge avatar rhino1998 avatar daxtorim avatar mehalter avatar ynhhoj avatar clydog avatar cooperuser avatar mesalilac avatar zeertzjq avatar 0xadk avatar utilyre avatar chrboesch avatar goncalves-diogo avatar etiamnullam avatar wincent avatar ggustafsson avatar heavyjoost avatar jpfender avatar jrwrigh avatar applejag avatar luukvbaal avatar crivotz avatar griwes avatar ramojus avatar prince213 avatar tradiff avatar goolord avatar crumbtoo 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.