-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f237a71
commit d4b3c01
Showing
2 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
local api = vim.api | ||
local overlength_active = false | ||
local config = { | ||
column_length = 120, -- Default column length | ||
terminal_background = "darkgrey", -- Default background color for terminal | ||
gui_background = "#592929", -- Default background color for GUI | ||
} | ||
|
||
local function enable_overlength_mode() | ||
vim.cmd(string.format("highlight OverLength ctermbg=%s guibg=%s", config.terminal_background, config.gui_background)) | ||
vim.opt.colorcolumn = tostring(config.column_length) | ||
vim.fn.matchadd("OverLength", string.format("\\%%%dv.\\+", config.column_length + 1)) | ||
overlength_active = false | ||
end | ||
|
||
local function disable_overlength_mode() | ||
vim.cmd("highlight clear OverLength") | ||
vim.opt.colorcolumn = "0" | ||
overlength_active = true | ||
end | ||
|
||
local function configure() | ||
api.nvim_create_user_command("OverlengthEnable", enable_overlength_mode, {}) | ||
api.nvim_create_user_command("OverlengthDisable", disable_overlength_mode, {}) | ||
end | ||
|
||
return { | ||
"prototypes/overlength", | ||
config = configure, | ||
dev = true, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters