Skip to content

Commit e72f0bc

Browse files
committed
highlight "shellpad: " modelines without a matcher, this is faster
1 parent 680dba9 commit e72f0bc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lua/shellpad/init.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ local genericStart = function(opts)
7777
vim.api.nvim_buf_set_lines(bufnr, -2, -1, false, lines)
7878

7979
local number_of_lines = vim.api.nvim_buf_line_count(bufnr)
80-
if fd == 2 then
81-
for i,_ in ipairs(lines) do
80+
for i,_ in ipairs(lines) do
81+
if fd == 2 then
8282
vim.api.nvim_buf_add_highlight(bufnr, -1, "shellpad_stderr", number_of_lines - #lines + i - 1, 0, -1)
83+
elseif string.match(lines[i], "^shellpad: ") then
84+
vim.api.nvim_buf_add_highlight(bufnr, -1, "shellpad_modeline", number_of_lines - #lines + i - 1, 0, -1)
8385
end
8486
end
8587

@@ -374,6 +376,7 @@ M.hl_clear_matchers = function(bufnr, prefix)
374376
-- Add the default highlights
375377
vim.api.nvim_buf_call(bufnr, function()
376378
vim.api.nvim_set_hl(0, "shellpad_stderr", { bg = "#382828" })
379+
vim.api.nvim_set_hl(0, "shellpad_modeline", { bg = "NONE", fg = "#666666" })
377380
vim.api.nvim_set_hl(0, 'shellpad_commandline', { bg = "#282c34", fg = "#61afef", bold = true })
378381
end)
379382
end

0 commit comments

Comments
 (0)