### Install Blink Indent with lazy.nvim Source: https://context7.com/saghen/blink.indent/llms.txt Installs the Blink Indent plugin using the lazy.nvim package manager. Configuration options for static and scope guides are passed through the `opts` table for automatic setup. ```lua -- lazy.nvim installation { 'saghen/blink.indent', --- @module 'blink.indent' --- @type blink.indent.Config opts = { static = { enabled = true }, scope = { enabled = true }, }, } ``` -------------------------------- ### Install Blink Indent with vim.pack Source: https://context7.com/saghen/blink.indent/llms.txt Installs the Blink Indent plugin using Neovim's built-in `vim.pack` manager. It also shows how to manually call the `setup()` function with custom configurations. ```lua -- vim.pack installation vim.pack.add({ 'https://github.com/saghen/blink.indent' }) -- Optional: manually call setup with custom configuration require('blink.indent').setup({ static = { enabled = true }, scope = { enabled = true }, }) ``` -------------------------------- ### Create a toggle keymap Source: https://github.com/saghen/blink.indent/blob/main/doc/blink-indent.txt Example of how to bind a key in Neovim to toggle indent guides for the current buffer. ```lua vim.keymap.set('n', 'ti', function() local indent = require('blink.indent') indent.enable(not indent.is_enabled({ bufnr = 0 }), { bufnr = 0 }) end, { desc = 'Toggle buffer indent guides' }) ``` -------------------------------- ### Buffer-Local Toggle Indent Guides (Lua) Source: https://context7.com/saghen/blink.indent/llms.txt Overrides global indent guide settings for specific buffers using `vim.b[bufnr].indent_guide`. Useful for disabling guides in certain files. Includes an example keymap for per-buffer toggling. ```lua -- Disable for current buffer vim.b[0].indent_guide = false -- Disable for specific buffer local bufnr = vim.api.nvim_get_current_buf() vim.b[bufnr].indent_guide = false -- Re-enable for current buffer (resets to global behavior) vim.b[0].indent_guide = nil -- Create a keymap to toggle per-buffer local indent = require('blink.indent') vim.keymap.set('n', 'tI', function() indent.enable(not indent.is_enabled({ bufnr = 0 }), { bufnr = 0 }) end, { desc = 'Toggle buffer indent guides' }) ``` -------------------------------- ### Enable and Toggle Indent Guides Source: https://github.com/saghen/blink.indent/blob/main/doc/blink-indent.txt Shows how to enable or disable indent guides globally or per-buffer, and how to create a keymap to toggle the feature. ```lua -- Global toggle vim.g.indent_guide = false -- Toggle with keymap local indent = require('blink.indent') vim.keymap.set('n', 'ti', function() indent.enable(not indent.is_enabled()) end, { desc = 'Toggle indent guides' }) -- Buffer-local toggle vim.b[bufnr].indent_guide = false ``` -------------------------------- ### Globally Toggle Indent Guides (Lua) Source: https://context7.com/saghen/blink.indent/llms.txt Allows enabling or disabling indent guides for all buffers using the global variable `vim.g.indent_guide`. Includes an example of creating a keymap to toggle this setting. ```lua -- Disable indent guides globally vim.g.indent_guide = false -- Re-enable indent guides globally vim.g.indent_guide = true -- Create a keymap to toggle globally vim.keymap.set('n', 'ti', function() vim.g.indent_guide = not vim.g.indent_guide require('blink.indent').draw_all(true) end, { desc = 'Toggle indent guides' }) ``` -------------------------------- ### Install blink.indent using lazy.nvim and vim.pack Source: https://github.com/saghen/blink.indent/blob/main/README.md This snippet demonstrates how to install the blink.indent plugin using two common Neovim package managers: lazy.nvim and vim.pack. For lazy.nvim, it's added as a plugin specification. For vim.pack, it uses vim.pack.add and includes a commented-out setup call. ```lua -- lazy.nvim { 'saghen/blink.indent', --- @module 'blink.indent' --- @type blink.indent.Config -- opts = {}, } -- vim.pack vim.pack.add({ 'https://github.com/saghen/blink.indent' }) -- require('blink.indent').setup({}) ``` -------------------------------- ### Block Indent Guides by Filetype and Buftype Source: https://context7.com/saghen/blink.indent/llms.txt Configures specific buffer types and filetypes where indent guides should be disabled. Supports extending default exclusions or replacing them entirely. ```lua require('blink.indent').setup({ blocked = { buftypes = { include_defaults = true, 'acwrite', }, filetypes = { include_defaults = true, 'neo-tree', 'NvimTree', 'lazy', 'mason', 'trouble', }, }, }) -- Or replace defaults entirely require('blink.indent').setup({ blocked = { buftypes = { include_defaults = false, 'terminal', 'quickfix', }, filetypes = { include_defaults = false, 'help', 'dashboard', }, }, }) ``` -------------------------------- ### Configure Rainbow Indent Guides Source: https://context7.com/saghen/blink.indent/llms.txt Enables cycling through multiple highlight groups for static and scope indent guides to create a rainbow effect. Requires pre-defined highlight groups. ```lua require('blink.indent').setup({ static = { enabled = true, char = '▎', highlights = { 'BlinkIndentRed', 'BlinkIndentOrange', 'BlinkIndentYellow', 'BlinkIndentGreen', 'BlinkIndentViolet', 'BlinkIndentCyan', }, }, scope = { enabled = true, char = '▎', highlights = { 'BlinkIndentOrange', 'BlinkIndentViolet', 'BlinkIndentBlue', }, underline = { enabled = true, highlights = { 'BlinkIndentOrangeUnderline', 'BlinkIndentVioletUnderline', 'BlinkIndentBlueUnderline', }, }, }, }) ``` -------------------------------- ### Enable/Disable Blink Indent Guides Source: https://context7.com/saghen/blink.indent/llms.txt Controls the visibility of indent guides globally or for a specific buffer. The `enable()` function accepts a boolean to turn guides on or off, and an optional filter table to specify the target buffer. It also provides examples for toggling the visibility. ```lua local indent = require('blink.indent') -- Enable globally (default behavior) indent.enable(true) -- Disable globally indent.enable(false) -- Enable for current buffer only indent.enable(true, { bufnr = 0 }) -- Disable for specific buffer indent.enable(false, { bufnr = 5 }) -- Toggle global visibility indent.enable(not indent.is_enabled()) -- Toggle for current buffer indent.enable(not indent.is_enabled({ bufnr = 0 }), { bufnr = 0 }) ``` -------------------------------- ### Configure blink.indent plugin Source: https://github.com/saghen/blink.indent/blob/main/doc/blink-indent.txt Initializes the plugin with custom settings. While optional, this allows users to enable static or scope-specific indent guides. ```lua require('blink.indent').setup({ static = { enabled = true }, scope = { enabled = true }, }) ``` -------------------------------- ### Render Indent Guides for a Window (Lua) Source: https://context7.com/saghen/blink.indent/llms.txt Manually draws indent guides for a specified window and buffer. This function can be called to force a redraw, optionally ignoring the cache for a complete re-render. ```lua local indent = require('blink.indent') -- Get current window and buffer local winnr = vim.api.nvim_get_current_win() local bufnr = vim.api.nvim_get_current_buf() -- Draw with cache (skips if unchanged) indent.draw(winnr, bufnr) -- Force redraw (ignores cache) indent.draw(winnr, bufnr, true) ``` -------------------------------- ### Install blink.indent via Plugin Managers Source: https://github.com/saghen/blink.indent/blob/main/doc/blink-indent.txt Demonstrates how to add blink.indent to common Neovim plugin managers like lazy.nvim or vim.pack. ```lua -- lazy.nvim { 'saghen/blink.indent', --- @module 'blink.indent' --- @type blink.indent.Config -- opts = {}, } -- vim.pack vim.pack.add({ 'saghen/blink.indent' }) -- require('blink.indent').setup({}) ``` -------------------------------- ### Render Indent Guides for All Windows (Lua) Source: https://context7.com/saghen/blink.indent/llms.txt Redraws indent guides across all visible windows. This is useful after configuration changes or programmatic modifications to indent guide settings. It can force a redraw ignoring the cache. ```lua local indent = require('blink.indent') -- Redraw all windows using cache indent.draw_all() -- Force redraw all windows (ignores cache) indent.draw_all(true) -- Example: Update configuration and redraw require('blink.indent.config').setup({ scope = { char = '│' } }) indent.draw_all(true) ``` -------------------------------- ### Configure Custom Highlight Groups for Indent Guides Source: https://context7.com/saghen/blink.indent/llms.txt Uses Neovim's highlight API to define custom colors for static and scope indent guides. This allows for full control over the visual theme of the indentation markers. ```lua -- Set custom color for static indent guides vim.api.nvim_set_hl(0, 'BlinkIndent', { fg = '#3b4261' }) -- Set custom color for scope highlight vim.api.nvim_set_hl(0, 'BlinkIndentScope', { fg = '#7aa2f7' }) -- Example: Custom rainbow colors matching your colorscheme vim.api.nvim_set_hl(0, 'BlinkIndentRed', { fg = '#f7768e' }) vim.api.nvim_set_hl(0, 'BlinkIndentOrange', { fg = '#ff9e64' }) vim.api.nvim_set_hl(0, 'BlinkIndentYellow', { fg = '#e0af68' }) vim.api.nvim_set_hl(0, 'BlinkIndentGreen', { fg = '#9ece6a' }) vim.api.nvim_set_hl(0, 'BlinkIndentBlue', { fg = '#7aa2f7' }) vim.api.nvim_set_hl(0, 'BlinkIndentViolet', { fg = '#bb9af7' }) ``` -------------------------------- ### Configure Blink Indent Plugin Source: https://context7.com/saghen/blink.indent/llms.txt Initializes blink.indent with custom configuration options. This function allows deep merging with defaults, enabling users to specify only the values they wish to change. Options include blocking guides for specific buffer types/filetypes, defining keymappings for textobjects and motions, and customizing static and scope indent guides. ```lua require('blink.indent').setup({ -- Block indent guides for specific buffer types and filetypes blocked = { -- default: 'terminal', 'quickfix', 'nofile', 'prompt' buftypes = { include_defaults = true }, -- default: 'lspinfo', 'packer', 'checkhealth', 'help', 'man', 'gitcommit', 'dashboard', '' filetypes = { include_defaults = true }, }, -- Keymappings for textobjects and motions mappings = { -- Which lines around scope are included for 'ai': 'top', 'bottom', 'both', or 'none' border = 'both', -- Textobjects (e.g., `y2ii` to yank current and outer scope) object_scope = 'ii', object_scope_with_border = 'ai', -- Motions for jumping to scope boundaries goto_top = '[i', goto_bottom = ']i', }, -- Static indent guides (always visible) static = { enabled = true, char = '▎', -- Inherits from vim.opt.listchars:get().space when nil whitespace_char = nil, priority = 1, -- Single highlight for uniform color highlights = { 'BlinkIndent' }, -- Or use multiple for rainbow-style guides: -- highlights = { 'BlinkIndentRed', 'BlinkIndentOrange', 'BlinkIndentYellow', -- 'BlinkIndentGreen', 'BlinkIndentViolet', 'BlinkIndentCyan' }, }, -- Scope guides (highlights current indent level) scope = { enabled = true, char = '▎', priority = 1000, -- Rainbow colors for nested scopes highlights = { 'BlinkIndentOrange', 'BlinkIndentViolet', 'BlinkIndentBlue' }, -- Underline the line above current scope underline = { enabled = false, highlights = { 'BlinkIndentOrangeUnderline', 'BlinkIndentVioletUnderline', 'BlinkIndentBlueUnderline' }, }, }, }) ``` -------------------------------- ### Customize Indent Guide Characters Source: https://context7.com/saghen/blink.indent/llms.txt Defines the specific characters used for static and scope indent guides, as well as the whitespace character used between markers. ```lua require('blink.indent').setup({ static = { enabled = true, char = '│', whitespace_char = '·', }, scope = { enabled = true, char = '▎', }, }) -- Example: Dotted lines for static, solid for scope require('blink.indent').setup({ static = { char = '┊' }, scope = { char = '│' }, }) ``` -------------------------------- ### Check Indent Guide Status (Lua) Source: https://context7.com/saghen/blink.indent/llms.txt Checks if indent guides are enabled for the global configuration, a specific buffer, or the current buffer. It prioritizes buffer-local settings over global ones. ```lua local indent = require('blink.indent') -- Check global status if indent.is_enabled() then print('Indent guides are enabled globally') end -- Check current buffer status (accounts for buffer-local overrides) if indent.is_enabled({ bufnr = 0 }) then print('Indent guides are enabled for this buffer') end -- Check specific buffer local bufnr = vim.api.nvim_get_current_buf() if indent.is_enabled({ bufnr = bufnr }) then print('Buffer ' .. bufnr .. ' has indent guides enabled') end ``` -------------------------------- ### Indent Scope Textobject Mappings (Lua) Source: https://context7.com/saghen/blink.indent/llms.txt Defines textobjects `ii` (inner scope) and `ai` (scope with border) for selecting indented code blocks. Supports counts for selecting outer scopes and can be configured via `setup`. ```lua -- Default textobject mappings (configured in setup): -- ii - Select inner scope (lines within current indentation) -- ai - Select scope with border (includes lines above/below based on 'border' setting) -- Usage in normal mode: -- vii - Visual select current indent scope -- vai - Visual select scope with borders -- yii - Yank current indent scope -- dii - Delete current indent scope -- cii - Change current indent scope -- y2ii - Yank current scope and one outer scope -- d3ii - Delete three nested indent scopes -- Custom textobject mappings require('blink.indent').setup({ mappings = { object_scope = 'ii', -- Inner scope object_scope_with_border = 'ai', -- Scope with border lines border = 'both', -- Include 'top', 'bottom', 'both', or 'none' }, }) ``` -------------------------------- ### Configure blink.indent Settings Source: https://github.com/saghen/blink.indent/blob/main/doc/blink-indent.txt Configures the plugin behavior including blocked filetypes, custom key mappings for motions, and visual styling for static and scope-based indent guides. ```lua require('blink.indent').setup({ blocked = { buftypes = { include_defaults = true }, filetypes = { include_defaults = true }, }, mappings = { border = 'both', object_scope = 'ii', object_scope_with_border = 'ai', goto_top = '[i', goto_bottom = ']i', }, static = { enabled = true, char = '▎', highlights = { 'BlinkIndent' }, }, scope = { enabled = true, char = '▎', highlights = { 'BlinkIndentOrange', 'BlinkIndentViolet', 'BlinkIndentBlue' }, underline = { enabled = false, highlights = { 'BlinkIndentOrangeUnderline', 'BlinkIndentVioletUnderline', 'BlinkIndentBlueUnderline' }, }, }, }) ``` -------------------------------- ### Customize indent guide highlights Source: https://github.com/saghen/blink.indent/blob/main/doc/blink-indent.txt Methods to override the default appearance of indent guides using Neovim's highlight system. Supports both Vimscript and Lua configurations. ```vim highlight BlinkIndent guifg="#3b4261" ``` ```lua vim.api.nvim_set_hl(0, 'BlinkIndent', { fg = '#3b4261' }) ``` -------------------------------- ### Manage indent guide state Source: https://github.com/saghen/blink.indent/blob/main/doc/blink-indent.txt Functions to enable, disable, or check the status of indent guides globally or for specific buffers. Useful for creating keybindings to toggle visibility. ```lua local indent = require('blink.indent') -- Toggle globally indent.enable(not indent.is_enabled()) -- Toggle for current buffer indent.enable(not indent.is_enabled({ bufnr = 0 }), { bufnr = 0 }) -- Check status if indent.is_enabled({ bufnr = 0 }) then print('Indent guides are enabled for this buffer') end ``` -------------------------------- ### Configure blink.indent with custom options Source: https://github.com/saghen/blink.indent/blob/main/README.md This Lua code configures the blink.indent plugin with various options. It shows how to disable the plugin for specific buffer types and filetypes, customize indent guide characters and highlights, and define keymaps for toggling indent guides and navigating scope. ```lua local indent = require('blink.indent') vim.keymap.set('n', 'some-key', function() indent.enable(not indent.is_enabled()) end, { desc = 'Toggle indent guides' }) require('blink.indent').setup({ blocked = { -- default: 'terminal', 'quickfix', 'nofile', 'prompt' buftypes = { include_defaults = true }, -- default: 'lspinfo', 'packer', 'checkhealth', 'help', 'man', 'gitcommit', 'dashboard', '' filetypes = { include_defaults = true }, }, mappings = { -- which lines around the scope are included for 'ai': 'top', 'bottom', 'both', or 'none' border = 'both', -- set to '' to disable -- textobjects (e.g. `y2ii` to yank current and outer scope) object_scope = 'ii', object_scope_with_border = 'ai', -- motions goto_top = '[i', goto_bottom = ']i', }, static = { enabled = true, char = '▎', whitespace_char = nil, -- inherits from `vim.opt.listchars:get().space` when `nil` (see `:h listchars`) priority = 1, -- specify multiple highlights here for rainbow-style indent guides -- highlights = { 'BlinkIndentRed', 'BlinkIndentOrange', 'BlinkIndentYellow', 'BlinkIndentGreen', 'BlinkIndentViolet', 'BlinkIndentCyan' }, highlights = { 'BlinkIndent' }, }, scope = { enabled = true, char = '▎', priority = 1000, -- set this to a single highlight, such as 'BlinkIndent' to disable rainbow-style indent guides -- highlights = { 'BlinkIndentScope' }, -- optionally add: 'BlinkIndentRed', 'BlinkIndentCyan', 'BlinkIndentYellow', 'BlinkIndentGreen' highlights = { 'BlinkIndentOrange', 'BlinkIndentViolet', 'BlinkIndentBlue' }, -- enable to show underlines on the line above the current scope underline = { enabled = false, -- optionally add: 'BlinkIndentRedUnderline', 'BlinkIndentCyanUnderline', 'BlinkIndentYellowUnderline', 'BlinkIndentGreenUnderline' highlights = { 'BlinkIndentOrangeUnderline', 'BlinkIndentVioletUnderline', 'BlinkIndentBlueUnderline' }, }, }, }) ``` -------------------------------- ### Indent Scope Motion Mappings (Lua) Source: https://context7.com/saghen/blink.indent/llms.txt Provides motion mappings `[i` and `]i` to jump to the top or bottom of the current indent scope, respectively. Supports counts for navigating multiple scope levels and adds to the jump list. ```lua -- Default motion mappings (configured in setup): -- [i - Jump to top of current indent scope -- ]i - Jump to bottom of current indent scope -- Usage: -- [i - Jump to start of current scope -- ]i - Jump to end of current scope -- 2[i - Jump to start of current scope, then to parent scope start -- 3]i - Jump through three scope boundaries downward -- Custom motion mappings require('blink.indent').setup({ mappings = { goto_top = '[i', goto_bottom = ']i', }, }) -- Disable specific mappings by setting to empty string require('blink.indent').setup({ mappings = { goto_top = '', -- Disable [i mapping goto_bottom = '', -- Disable ]i mapping }, }) ``` -------------------------------- ### Measure blink.indent and indent-blankline.nvim performance Source: https://github.com/saghen/blink.indent/blob/main/README.md This Lua code snippet benchmarks the rendering performance of blink.indent and indent-blankline.nvim. It achieves this by monkey-patching their respective draw/refresh functions to measure execution time and print the results in milliseconds, allowing for direct comparison. ```lua local refresh = require('ibl').refresh require('ibl').refresh = function(...) local start_time = vim.loop.hrtime() refresh(...) local end_time = vim.loop.hrtime() print(string.format('indent-blankline.nvim: %.2fms', (end_time - start_time) / 1e6)) end local draw = require('blink.indent').draw require('blink.indent').draw = function(...) local start_time = vim.loop.hrtime() draw(...) local end_time = vim.loop.hrtime() print(string.format('blink.indent: %.2fms', (end_time - start_time) / 1e6)) end ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.