feat: add customizable tab, indent, and scope characters

This commit is contained in:
2024-09-16 13:48:59 -04:00
parent f1edd2aba0
commit 16d98a918c
4 changed files with 91 additions and 37 deletions
+16
View File
@@ -127,6 +127,22 @@ vim.g.disable_transparency = true ---@type boolean Options: <true|false>
-- Set colorcolumn
vim.opt.colorcolumn = "120" ---@type string|table Options: [column]
-- ━━━━━━━━━━━━━━━━━━━━━━━━━ Tabs and Indentation ━━━━━━━━━━━━━━━━━━━━━━━━
-- Define a character to be used in the whitespace to represent tabs/indents.
-- Tab character
-- vim.g.tab_char = "󰌒" ---@type string Options: [tab char]
-- -- Indent character
-- vim.g.indent_char = "¶" ---@type string Options: [indent char]
-- Scope character
-- vim.g.scope_char = "|" ---@type string Options: [scope char]
-- Alternatively, specify a character/table from the presets
-- Tab characters
vim.g.tab_char_name = "fancy" ---@type string Options: [tab char]
-- Indent characters
vim.g.indent_char_name = "fancy" ---@type string Options: [indent char]
-- Scope characters
vim.g.scope_char_name = "scope" ---@type string Options: [scope char]
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Completion ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
-- Cmp Window Border
vim.g.completion_borders = "rounded" ---@type string Options: [round|sharp|flat]
+54 -34
View File
@@ -723,7 +723,44 @@ M.highlights = {
--- Indent characters
M.ibl = {
indent_char = {
char = {
none = { " " },
light_vert = { "" },
scope = { "" },
fancy_vert = { "" },
strong_vert = { "" },
zigzag = { "" },
basic = { "" },
simple = { "" },
arrow = { "" },
tab = { "󰌒" },
mini = { "" },
light_arrow = { "" },
block = { "" },
block_75 = { "" },
block_50 = { "" },
block_25 = { "" },
block_0 = { " " },
baric = { "󰇘" },
fish = { "" },
dot = { "" },
dots = { "" },
circle = { "" },
dot_circle = { "󱥸" },
dot_square = { "󱗽" },
dot_hex = { "󱗿" },
dot_tri = { "󱗾" },
dot_grid = { "󱗼" },
solid = {
"",
"",
"",
"",
"",
"",
"",
"",
},
fancy = {
"󰎤",
"󰎧",
@@ -736,31 +773,7 @@ M.ibl = {
"󰎼",
"󰽽",
},
solid = {
"",
"",
"",
"",
"",
"",
"",
"",
},
none = { " " },
baric = { "󰇘" },
},
scope_char = {
light = { "" },
hard = { "" },
none = { " " },
fancy = { "" },
strong = { "" },
basic = { "" },
arrow = { "" },
tab = { "󰌒" },
},
tab_char = {
fancy = {
funky = {
"󰌒",
"󰌓",
"󰌔",
@@ -772,19 +785,26 @@ M.ibl = {
"󰌚",
"󰌛",
},
none = { " " },
basic = { "" },
simple = { "" },
arrow = { "" },
tab = { "󰌒" },
mini = { "" },
},
}
--- Mini.Indentscope configuration options
M.miniindentscope = {
symbol = M.ibl.scope_char.hard[1],
options = { try_as_border = true, border = "both" },
opts = {
options = { try_as_border = true, border = "both" },
},
init = function()
-- Set default scope char
local scope_char
if vim.g.scope_char then
scope_char = vim.g.scope_char
elseif vim.g.scope_char_name then
scope_char = M.ibl.char[vim.g.scope_char_name][1]
else
scope_char = M.ibl.char.scope[1]
end
M.miniindentscope.opts.symbol = scope_char
end,
}
--- Navic Icons
+2 -1
View File
@@ -17,7 +17,8 @@ return {
},
{ -- Mini Indentscope
"echasnovski/mini.indentscope",
opts = data.types.miniindentscope,
opts = data.types.miniindentscope.opts,
init = data.types.miniindentscope.init,
},
{ -- mini.align
"echasnovski/mini.align",
+19 -2
View File
@@ -70,11 +70,28 @@ function M.setup_indent_highlight()
end)
end
-- Define characters for indent-blankline
local tab_char, indent_char
if vim.g.tab_char then
tab_char = vim.g.tab_char
elseif vim.g.tab_char_name then
tab_char = data.types.ibl.char[vim.g.tab_char_name]
else
tab_char = data.types.ibl.char.none
end
if vim.g.indent_char then
indent_char = vim.g.indent_char
elseif vim.g.indent_char_name then
indent_char = data.types.ibl.char[vim.g.indent_char_name]
else
indent_char = data.types.ibl.char.none
end
-- Configure the indent-blankline plugin
require("ibl").setup({
indent = {
char = vim.g.indent_char or data.types.ibl.indent_char.none,
tab_char = vim.g.tab_char or data.types.ibl.tab_char.simple,
char = indent_char,
tab_char = tab_char,
highlight = {
"IndentBlanklineIndent",
},