Giter VIP home page Giter VIP logo

hlchunk.nvim's Introduction

hlchunk.nvim

English | 简体中文

notice!!!

There have been many recent changes. If you encounter any bugs, please feel free to raise an issue. I will improve the code clarity and documentation in the future.

What can this plugin do

Similar to indent-blankline, this plugin can highlight the indent line, and highlight the code chunk according to the current cursor position.

Brief introduction

This plugin now have four parts

  1. chunk
  2. indent
  3. line_num
  4. blank

One picture to understand what these mods do

more details about each mod

NOTICE: you can click the picture to get more information about how to configure like this

chunk

image

indent

image image image

line_num

image

blank

image

Requirements

neovim version >= 0.9.0

Installation (with lazy.nvim)

{
  "shellRaining/hlchunk.nvim",
  event = { "BufReadPre", "BufNewFile" },
  config = function()
    require("hlchunk").setup({})
  end
},

Setup

This plugin is composed of multiple mods, so they have some common configuration items as follows:

local default_conf = {
    enable = false,
    style = {},
    notify = false,
    priority = 0,
    exclude_filetypes = {
        aerial = true,
        dashboard = true,
        -- some other filetypes
    }
}
  1. enable: control whether a certain mod is enabled
  2. style: used to control the style of the mod, different mods will have different style configuration methods, you can check their respective documentation for details
  3. notify: used to control whether a certain mod displays notification messages (through the notify function)
  4. priority: used to control the rendering priority of a certain mod, the higher the priority, the higher the priority of display, by default chunk > indent > blank > line_num
  5. exclude_filetypes: used to control that a certain mod is not enabled for certain file types

The specific configuration methods for each mod can be found in their respective documentation, the links are as follows:

You can config the whole plugin by using setup function:

require('hlchunk').setup({
    chunk = {
        enable = true
        -- ...
    },
    indent = {
        enable = true
        -- ...
    }
})

Require the specific mod alone also work

local indent = require('hlchunk.mods.indent')
indent({
    style = {
        -- ...
    }
}):enable() -- don't forget call enable method

notice

Because this plugin use shiftwidth function to get the indent width, so for files that do not set the indent width manually, there may be inaccurate situations, you can set the indent width manually:

vim.bo.shiftwidth = xxx

If you feel boring to set the indent width manually, you can use autoindent.nvim or indent-o-matic to guess indent automatically.

command

Sometimes (e.g., for performance reasons), you may want to manually disable a certain mod, you can follow the rules below: enter DisableHLxxxx, replacing xxxx with the name of the mod you want to disable, for example, to disable chunk, you can enter DisableHLchunk.

Similarly, to enable a mod, enter EnableHLxxxx.

However, for mods with enable set to false, the plugin itself will not create a user command (because there is no need).

hlchunk.nvim's People

Contributors

shellraining avatar nyngwang avatar miversen33 avatar happyori avatar juanzoran avatar kevintraver avatar crivotz avatar pauldesmondparker avatar postcyberpunk avatar soifou avatar amlanjlahkar avatar hinell avatar itepechi avatar kang8 avatar yuguorui avatar xiao-m0 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.