mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 22:59:15 +00:00
nvim: small refactor
This commit is contained in:
parent
841d371dd0
commit
eda821bf5e
1 changed files with 4 additions and 5 deletions
|
|
@ -16,24 +16,23 @@ vim.api.nvim_create_autocmd("OptionSet", {
|
||||||
for _ = c:len(), vim.o.shiftwidth + 1 do
|
for _ = c:len(), vim.o.shiftwidth + 1 do
|
||||||
c = c .. " "
|
c = c .. " "
|
||||||
end
|
end
|
||||||
return vim.opt.lcs:append("leadmultispace:" .. c)
|
vim.opt.listchars:append("leadmultispace:" .. c)
|
||||||
else
|
|
||||||
return nil
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
local auto_colorcolumn = vim.api.nvim_create_augroup("auto_colorcolumn", {})
|
local auto_colorcolumn = vim.api.nvim_create_augroup("auto_colorcolumn", {})
|
||||||
|
local set_colorcolumn_from_textwidth = function() vim.wo.colorcolumn = tostring(vim.bo.textwidth) end
|
||||||
vim.api.nvim_create_autocmd("OptionSet", {
|
vim.api.nvim_create_autocmd("OptionSet", {
|
||||||
group = auto_colorcolumn,
|
group = auto_colorcolumn,
|
||||||
pattern = "textwidth",
|
pattern = "textwidth",
|
||||||
callback = function() vim.wo.colorcolumn = tostring(vim.bo.textwidth) end,
|
callback = set_colorcolumn_from_textwidth,
|
||||||
})
|
})
|
||||||
vim.api.nvim_create_autocmd("BufEnter", {
|
vim.api.nvim_create_autocmd("BufEnter", {
|
||||||
group = auto_colorcolumn,
|
group = auto_colorcolumn,
|
||||||
callback = function()
|
callback = function()
|
||||||
if vim.bo.textwidth then
|
if vim.bo.textwidth then
|
||||||
vim.wo.colorcolumn = tostring(vim.bo.textwidth)
|
set_colorcolumn_from_textwidth()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue