lcheylus
overlength.nvim
Lua

A small Neovim plugin to highlight too long lines

Last updated Apr 7, 2026
51
Stars
2
Forks
0
Issues
0
Stars/day
Attention Score
39
Language breakdown
No language data available.
โ–ธ Files click to expand
README

overlength.nvim

overlength.nvim is a small plugin for Neovim to highlight the part of a line that doesn't fit into textwidth (or really, whatever width you like).

Screenshot of the overlength.nvim plugin

This plugin is inspired by the Vim plugin overlength.vim developed by TJ DeVries (@tjdevries). And it also uses some tips from "Vim Tips Wiki" article "Highlight long lines".

Installation

Neovim version >= 0.7.0 is necessary to use this plugin.

Install this plugin using your favorite plugin manager:

use 'lcheylus/overlength.nvim'
{ 'lcheylus/overlength.nvim' }

To get started with the default configuration, add:

require('overlength').setup()

Configuration

While the defaults should work for most users out of the box, the following options can be configured as such:

require('overlength').setup({
   -- Overlength highlighting enabled by default
  enabled = true,

-- Colors for OverLength highlight group colors = { ctermfg = nil, ctermbg = 'darkgrey', fg = nil, bg = '#8B0000', }

-- Mode to use textwidth local options -- 0: Don't use textwidth at all, always use config.default_overlength. -- 1: Use textwidth, unless it's 0, then use config.default_overlength. -- 2: Always use textwidth. There will be no highlighting where -- textwidth == 0, unless added explicitly textwidth_mode = 2, -- Default overlength with no filetype default_overlength = 80, -- How many spaces past your overlength to start highlighting grace_length = 1, -- Highlight only the column or until the end of the line highlighttoeol = true,

-- List of filetypes to disable overlength highlighting disable_ft = { &#39;qf&#39;, &#39;help&#39;, &#39;man&#39;, &#39;checkhealth&#39;, &#39;lazy&#39;, &#39;packer&#39;, &#39;NvimTree&#39;, &#39;Telescope&#39;, &#39;TelescopePrompt&#39;, &#39;TelescopeResults&#39;, &#39;WhichKey&#39; }, })</code></pre>

You could change the colors used to highlight too long lines:

<pre><code class="lang-lua">require(&#39;overlength&#39;).setup({ colors = { bg=&#39;#592929&#39; } })</code></pre>

Usage

The plugin creates 3 user-commands:

  • OverlengthEnable : enable highlights for too long lines
  • OverlengthDisable : disable highlights for too long lines
  • OverlengthToggle : turn on/off highlights for too long lines
You can change overlength used for a specific filetype with set_overlength function:

<pre><code class="lang-lua">:lua require(&#39;overlength&#39;).set_overlength(python, 100)</code></pre>

If you want disable overlength highlight for a specific filetype, set overlength to 0 (or add it to disable_ft` option in setup):

:lua require('overlength').set_overlength(markdown, 0)
๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท lcheylus/overlength.nvim ยท Updated daily from GitHub