Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/folke/twilight.nvim
🌅 Twilight is a Lua plugin for Neovim 0.5 that dims inactive portions of the code you're editing using TreeSitter.
https://github.com/folke/twilight.nvim
neovim neovim-plugin tree-sitter treesitter
Last synced: about 1 month ago
JSON representation
🌅 Twilight is a Lua plugin for Neovim 0.5 that dims inactive portions of the code you're editing using TreeSitter.
- Host: GitHub
- URL: https://github.com/folke/twilight.nvim
- Owner: folke
- License: apache-2.0
- Created: 2021-07-12T07:37:37.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-22T13:04:08.000Z (4 months ago)
- Last Synced: 2024-09-27T10:41:13.046Z (about 1 month ago)
- Topics: neovim, neovim-plugin, tree-sitter, treesitter
- Language: Lua
- Homepage:
- Size: 60.5 KB
- Stars: 1,268
- Watchers: 5
- Forks: 22
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- my-neovim-pluginlist - folke/twilight.nvim - commit/folke/twilight.nvim) ![](https://img.shields.io/github/commit-activity/y/folke/twilight.nvim) (View / Highlight current function)
- awesome-neovim - folke/twilight.nvim - Dim inactive portions of the code you're editing using Tree-sitter. (Color / PHP)
README
# 🌅 Twilight
**Twilight** is a Lua plugin for Neovim 0.5 that dims inactive portions of the code you're editing.
The plugin was heavily inspired by [Limelight](https://github.com/junegunn/limelight.vim),
but uses [TreeSitter](https://github.com/nvim-treesitter/nvim-treesitter) for better dimming.Pairs well with [zen-mode](https://github.com/folke/zen-mode.nvim).
![image](https://user-images.githubusercontent.com/292349/125419804-051321c2-d040-41c8-93fc-834b5f1098e3.png)
## ⚡️ Requirements
- Neovim >= 0.5.0
## 📦 Installation
Install the plugin with your preferred package manager:
### [lazy.nvim](https://github.com/folke/lazy.nvim)
```lua
-- Lua
{
"folke/twilight.nvim",
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
```## ⚙️ Configuration
Twilight comes with the following defaults:
```lua
{
dimming = {
alpha = 0.25, -- amount of dimming
-- we try to get the foreground from the highlight groups or fallback color
color = { "Normal", "#ffffff" },
term_bg = "#000000", -- if guibg=NONE, this will be used to calculate text color
inactive = false, -- when true, other windows will be fully dimmed (unless they contain the same buffer)
},
context = 10, -- amount of lines we will try to show around the current line
treesitter = true, -- use treesitter when available for the filetype
-- treesitter is used to automatically expand the visible text,
-- but you can further control the types of nodes that should always be fully expanded
expand = { -- for treesitter, we we always try to expand to the top-most ancestor with these types
"function",
"method",
"table",
"if_statement",
},
exclude = {}, -- exclude these filetypes
}
```## 🚀 Usage
You can manually trigger **Twilight** using the commands:
- `Twilight`: toggle twilight
- `TwilightEnable`: enable twilight
- `TwilightDisable`: disable twilight## 🧘 Zen Mode Integration
If you have [zen-mode](https://github.com/folke/zen-mode.nvim) installed, then **Twilight**
is activated automatically. Refer to the Zen Mode documentation to disable.