Mr-LLLLL/cool-chunk.nvim

github github
formattingindent
stars 24
issues 0
subscribers 0
forks 2
CREATED

2024-04-06

UPDATED

6 months ago


What can this plugin do

Forked from hlchunk. Indent has been removed (but if you want to use it, try indent-blankline). Chunk, context and line_num have been retained. It is simple, fast and cool.

Show Gif

Screencasts

Brief introduction

This plugin now has some functions, which include:

  1. chunk
  2. line_num (support highlight context and chunk range)
  3. context
  4. textobject (support context textobject and chunk textobject)
  5. jump (support jump to context start and end)

Requirements

neovim version >= 0.9.0

Installation

With Lazy

{
    "Mr-LLLLL/cool-chunk.nvim",
    event = { "CursorHold", "CursorHoldI" },
    dependencies = {
        "nvim-treesitter/nvim-treesitter",
    },
    config = function()
        require("cool-chunk").setup({})
    end
},

Setup

The script comes with the following defaults:

{
    chunk = {
        notify = true,
        support_filetypes = ft.support_filetypes, -- ft = require("cool-chunk.utils.filetype").support_filetypes
        exclude_filetypes = ft.exclude_filetypes,
        hl_group = {
            chunk = "CursorLineNr",
            error = "Error",
        },
        chars = {
            horizontal_line = "─",
            vertical_line = "│",
            left_top = "╭",
            left_bottom = "╰",
            left_arrow = "<",
            bottom_arrow = "v",
            right_arrow = ">",
        },
        textobject = "ah",
        animate_duration = 200, -- if don't want to animation, set to 0.
        fire_event = { "CursorHold", "CursorHoldI" },
    },
    context = {
        notify = true,
        chars = {
            "│",
        },
        hl_group = {
            context = "LineNr",
        },
        exclude_filetypes = ft.exclude_filetypes,
        support_filetypes = ft.support_filetypes,
        textobject = "ih",
        jump_support_filetypes = { "lua", "python" },
        jump_start = "[{",
        jump_end = "]}",
        fire_event = { "CursorHold", "CursorHoldI" },
    },
    line_num = {
        notify = true,
        hl_group = {
            chunk = "CursorLineNr",
            context = "LineNr",
            error = "Error",
        },
        support_filetypes = ft.support_filetypes,
        exclude_filetypes = ft.exclude_filetypes,
        fire_event = { "CursorHold", "CursorHoldI" },
    }
}

command

This plugin provides some commands to switch plugin status, which are listed below:

  • EnableCC
  • DisableCC
  • EnableCCChunk
  • DisableCCChunk
  • EnableCCContext
  • DisableCCContext
  • EnableCCLineNum
  • DisableCCLineNum