Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rlychrisg/truncateline.nvim

Show the start of long lines when scrolling way off to the right.
https://github.com/rlychrisg/truncateline.nvim

neovim neovim-plugin

Last synced: 6 days ago
JSON representation

Show the start of long lines when scrolling way off to the right.

Awesome Lists containing this project

README

        

# ✂️ truncateline.nvim

A customisable way to avoid getting lost by truncating long lines.

https://github.com/user-attachments/assets/0ae6a88e-0ae5-47f5-90d0-b2455b652938

## ✨ Features

+ Have the option to turn it on or off at startup.
+ A toggle function, a key can also be bound to temporarily toggle between on and off.
+ Character count, truncation string, temporary toggle duration and highlight groups can also be configured.

## 📦 Installation

For a default configuration:

```lua
{
"rlychrisg/truncateline.nvim",
-- NOTE: these keybinds are not set by default and will need to be set
-- either here, or wherever you set your keybinds.
keys = {
{
"l", ":TemporaryToggle",
{ noremap = true, silent = true, desc = "TruncateLine temporary toggle" },
},

{
"sl", ":ToggleTruncate",
{ noremap = true, silent = true, desc = "TruncateLine toggle" },
},
},
opts = {
enabled_on_start = true,

-- this will be appended to the virtual text to distinguish it from the actual text
-- to disable this behaviour, set truncate_str to ""
truncate_str = "...",

-- how many characters from the start of the line should be displayed
-- Note: you might want the total of this setting,
-- along with truncate_str, to be less than your sidescrolloff
-- setting, to prevent obscuring text.
line_start_length = 8,

-- time for in ms for a temporary toggle
temporary_toggle_dur = 2000,

-- which highlight group should be used for virtual text.
-- "Comment", or "Normal" are good choices, but anything in
-- :highlight can be used. you can also create your own and
-- set the colour in your colour scheme's config.
hilight_group = "Comment",
},
},
```

> [!NOTE]
> Contributions and suggestions are welcome but I'm a bit of a beginner in both Lua and Git, so please be patient and err on the side of patronising when explaining stuff.