| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
English | 简体中文
Similar to indent-blankline, this plugin can highlight the indent line, and highlight the code chunk according to the current cursor position.
Using profile.nvim for performance analysis, all experiments were conducted on macOS with alacritty, Neovim window height was 66 lines, the code file was typescript.js, starting from the first line to the five hundredth line. The average rendering time per render was 0.7ms.
I did a lot of work to minimize rendering time as much as possible
Asynchronous rendering to reduce stuttering
Using C functions to speed up some function calls
Caching extmarks for each line as much as possible to reduce indentation calculations
Using throttle functions to batch the rendering process as much as possible
If you want to reduce the sudden stuttering when scrolling the window, maybe you will like hlchunk.nvim~
For detailed optimization work, you can see my blog (written in Chinese): https://www.shellraining.top/docs/tools/hlchunk/profile.html
This plugin now have four parts
One picture to understand what these mods do
NOTICE: you can click the picture to get more information about how to configure like this
neovim version >= 0.10.0
{
"shellRaining/hlchunk.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
require("hlchunk").setup({})
end
},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
}
}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 methodBecause 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 = xxxIf you feel boring to set the indent width manually, you can use autoindent.nvim or indent-o-matic to guess indent automatically.
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).
Contributions are welcome. The repo ships a lightweight pre-commit hook that runs selene and stylua --check on staged Lua files. Enable it once per clone:
git config core.hooksPath .githooksBefore opening a PR, run make selene && make stylua && make test locally. See AGENTS.md for the project map and ARCHITECTURE.md for the module layout.
| Back | FazBrowse Home | New Git URL |