From 80a3ba49ef19028d3e68f6e4d6ebabe0b8c317f7 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Sun, 21 Jul 2024 21:30:16 +0200 Subject: [PATCH] nvim: use icons consistently --- config/nvim/lua/fschauen/diagnostic.lua | 4 +-- config/nvim/lua/fschauen/keymap.lua | 26 +++++++++---------- config/nvim/lua/fschauen/plugins/comment.lua | 8 +++--- .../nvim/lua/fschauen/plugins/completion.lua | 4 +-- config/nvim/lua/fschauen/plugins/dial.lua | 17 +++++++----- .../nvim/lua/fschauen/plugins/formatter.lua | 8 +++--- config/nvim/lua/fschauen/plugins/fugitive.lua | 6 +++-- .../lua/fschauen/plugins/git-messenger.lua | 3 ++- .../nvim/lua/fschauen/plugins/gitlinker.lua | 12 +++++---- .../lua/fschauen/plugins/indent-blankline.lua | 10 +++---- config/nvim/lua/fschauen/plugins/lualine.lua | 14 +++++----- .../lua/fschauen/plugins/markdown-preview.lua | 11 +++++--- config/nvim/lua/fschauen/plugins/neogit.lua | 16 ++++++------ .../nvim/lua/fschauen/plugins/nvim-lint.lua | 4 ++- .../nvim/lua/fschauen/plugins/nvim-tree.lua | 6 +++-- .../nvim/lua/fschauen/plugins/openbrowser.lua | 4 ++- .../fschauen/plugins/plantuml-previewer.lua | 9 ++++++- .../nvim/lua/fschauen/plugins/telescope.lua | 13 +++++----- .../nvim/lua/fschauen/plugins/text-case.lua | 4 ++- .../nvim/lua/fschauen/plugins/treesitter.lua | 8 +++--- config/nvim/lua/fschauen/plugins/trouble.lua | 7 ++--- config/nvim/lua/fschauen/plugins/undotree.lua | 4 ++- .../nvim/lua/fschauen/plugins/virt-column.lua | 6 ++--- .../nvim/lua/fschauen/plugins/whitespace.lua | 12 ++++++--- config/nvim/lua/fschauen/util/icons.lua | 18 ++++++++++++- 25 files changed, 145 insertions(+), 89 deletions(-) diff --git a/config/nvim/lua/fschauen/diagnostic.lua b/config/nvim/lua/fschauen/diagnostic.lua index eba65bb..9f60acf 100644 --- a/config/nvim/lua/fschauen/diagnostic.lua +++ b/config/nvim/lua/fschauen/diagnostic.lua @@ -1,7 +1,5 @@ local M = {} -local icons = require("fschauen.util.icons") - -- Show/navigate warning and errors by default. M.severity = vim.diagnostic.severity.WARN @@ -77,6 +75,8 @@ M.select_virtual_text_severity = function() ) end +local icons = require("fschauen.util.icons") + ---Customize nvim's diagnostics display. M.setup = function() vim.diagnostic.config { diff --git a/config/nvim/lua/fschauen/keymap.lua b/config/nvim/lua/fschauen/keymap.lua index 6c7fa59..ce63660 100644 --- a/config/nvim/lua/fschauen/keymap.lua +++ b/config/nvim/lua/fschauen/keymap.lua @@ -88,12 +88,12 @@ M.setup = function() local ui = require("fschauen.util.icons").ui -- navigate diagnostics - map("n", "", diagnostic.goto_next, { desc = ui.Diagnostic .. " [d]iagnostic [n]ext" }) - map("n", "", diagnostic.goto_prev, { desc = ui.Diagnostic .. " [d]iagnostic [p]revious" }) - map("n", "dd", diagnostic.toggle, { desc = ui.Diagnostic .. " [d]iagnostic enable/[d]isable" }) - map("n", "do", diagnostic.open_float, { desc = ui.Diagnostic .. " [d]iagnostic [o]pen" }) - map("n", "dh", diagnostic.hide, { desc = ui.Diagnostic .. " [d]iagnostic [h]ide" }) - map("n", "ds", diagnostic.select_virtual_text_severity, { desc = ui.Diagnostic .. " [d]iagnostic [s]everity" }) + map("n", "", diagnostic.goto_next, { desc = ui.Diagnostic.." [d]iagnostic [n]ext" }) + map("n", "", diagnostic.goto_prev, { desc = ui.Diagnostic.." [d]iagnostic [p]revious" }) + map("n", "dd", diagnostic.toggle, { desc = ui.Diagnostic.." [d]iagnostic enable/[d]isable" }) + map("n", "do", diagnostic.open_float, { desc = ui.Diagnostic.." [d]iagnostic [o]pen" }) + map("n", "dh", diagnostic.hide, { desc = ui.Diagnostic.." [d]iagnostic [h]ide" }) + map("n", "ds", diagnostic.select_virtual_text_severity, { desc = ui.Diagnostic.." [d]iagnostic [s]everity" }) -- disable highlight until next search map("n", "h", "nohlsearch") @@ -105,17 +105,17 @@ M.setup = function() map("n", "k", "lpreviouszz") -- toggle quickfix and loclist - map("n", "ll", window.toggle_quickfix, { desc = ui.Toggle .. " toggle quickfix" }) - map("n", "ll", window.toggle_loclist, { desc = ui.Toggle .. " toggle loclist" }) + map("n", "ll", window.toggle_quickfix, { desc = ui.Toggle.." toggle quickfix" }) + map("n", "ll", window.toggle_loclist, { desc = ui.Toggle.." toggle loclist" }) local options = require("fschauen.util.options") -- toggle options - map("n", "sn", options.toggle_number, { desc = ui.Toggle .. " toggle 'number'" }) - map("n", "sr", options.toggle_relativenumber, { desc = ui.Toggle .. " toggle 'relativenumber'" }) - map("n", "sl", options.toggle_list, { desc = ui.Toggle .. " toggle 'list'" }) - map("n", "sw", options.toggle_wrap, { desc = ui.Toggle .. " toggle 'wrap'" }) - map("n", "ss", options.toggle_spell, { desc = ui.Toggle .. " toggle 'spell'" }) + map("n", "sn", options.toggle_number, { desc = ui.Toggle.." toggle 'number'" }) + map("n", "sr", options.toggle_relativenumber, { desc = ui.Toggle.." toggle 'relativenumber'" }) + map("n", "sl", options.toggle_list, { desc = ui.Toggle.." toggle 'list'" }) + map("n", "sw", options.toggle_wrap, { desc = ui.Toggle.." toggle 'wrap'" }) + map("n", "ss", options.toggle_spell, { desc = ui.Toggle.." toggle 'spell'" }) end -- stylua: ignore end diff --git a/config/nvim/lua/fschauen/plugins/comment.lua b/config/nvim/lua/fschauen/plugins/comment.lua index 6bfcdd4..09b5a8b 100644 --- a/config/nvim/lua/fschauen/plugins/comment.lua +++ b/config/nvim/lua/fschauen/plugins/comment.lua @@ -1,3 +1,5 @@ +local icon = require("fschauen.util.icons").ui.Comment + return { "tpope/vim-commentary", @@ -5,9 +7,9 @@ return { keys = { -- stylua: ignore start - { "gc", "Commentary", mode = {"n", "x", "o"}, desc = "Comment in/out" }, - { "gcc", "CommentaryLine", desc = "Comment in/out line" }, - { "gcu", "CommentaryCommentary", desc = "Undo comment in/out" }, + { "gc", "Commentary", mode = {"n", "x", "o"}, desc = icon.." Comment in/out" }, + { "gcc", "CommentaryLine", desc = icon.." Comment in/out line" }, + { "gcu", "CommentaryCommentary", desc = icon.." Undo comment in/out" }, -- stylua: ignore end }, } diff --git a/config/nvim/lua/fschauen/plugins/completion.lua b/config/nvim/lua/fschauen/plugins/completion.lua index d6bea98..056dc03 100644 --- a/config/nvim/lua/fschauen/plugins/completion.lua +++ b/config/nvim/lua/fschauen/plugins/completion.lua @@ -1,5 +1,3 @@ -local icons = require("fschauen.util.icons") - local make_keymap = function(cmp) local if_visible = function(yes, no) no = no or function(fallback) @@ -90,7 +88,7 @@ return { formatting = { format = require("lspkind").cmp_format { mode = "symbol_text", - symbol_map = icons.kind, + symbol_map = require("fschauen.util.icons").kind, menu = { buffer = "buf", nvim_lsp = "LSP", diff --git a/config/nvim/lua/fschauen/plugins/dial.lua b/config/nvim/lua/fschauen/plugins/dial.lua index b7cac02..e23b279 100644 --- a/config/nvim/lua/fschauen/plugins/dial.lua +++ b/config/nvim/lua/fschauen/plugins/dial.lua @@ -9,7 +9,7 @@ local dial_cmd = function(cmd, suffix) end end ----Make a new augent that cycles over the given elements. +---Make a new augend that cycles over the given elements. ---@param elements string[]: the elements to cycle. ---@return table: @see `dial.types.Augend` local cyclic_augend = function(elements) @@ -34,19 +34,22 @@ local weekdays_short = vim.tbl_map(function(s) return s:sub(1, 3) end, weekdays) +local ui = require("fschauen.util.icons").ui +local inc, dec = ui.Increment, ui.Decrement + return { "monaqa/dial.nvim", keys = { -- stylua: ignore start - { "", dial_cmd("inc_normal"), expr = true, desc = " Increment" }, - { "", dial_cmd("dec_normal"), expr = true, desc = " Decrement" }, + { "", dial_cmd("inc_normal"), expr = true, desc = inc.." Increment" }, + { "", dial_cmd("dec_normal"), expr = true, desc = dec.." Decrement" }, - { "", dial_cmd("inc_visual", "gv"), expr = true, desc = " Increment", mode = "v" }, - { "", dial_cmd("dec_visual", "gv"), expr = true, desc = " Decrement", mode = "v" }, + { "", dial_cmd("inc_visual", "gv"), expr = true, desc = inc.." Increment", mode = "v" }, + { "", dial_cmd("dec_visual", "gv"), expr = true, desc = dec.." Decrement", mode = "v" }, - { "g", dial_cmd("inc_gvisual", "gv"), expr = true, desc = " Increment", mode = "v" }, - { "g", dial_cmd("dec_gvisual", "gv"), expr = true, desc = " Decrement", mode = "v" }, + { "g", dial_cmd("inc_gvisual", "gv"), expr = true, desc = inc.." Increment", mode = "v" }, + { "g", dial_cmd("dec_gvisual", "gv"), expr = true, desc = dec.." Decrement", mode = "v" }, -- stylua: ignore end }, diff --git a/config/nvim/lua/fschauen/plugins/formatter.lua b/config/nvim/lua/fschauen/plugins/formatter.lua index 5f50483..8de783e 100644 --- a/config/nvim/lua/fschauen/plugins/formatter.lua +++ b/config/nvim/lua/fschauen/plugins/formatter.lua @@ -41,6 +41,8 @@ local toggle_format_on_write = (function() end end)() +local icon = require("fschauen.util.icons").ui.Format + return { "mhartington/formatter.nvim", @@ -53,9 +55,9 @@ return { keys = { -- stylua: ignore start - { "FT", toggle_format_on_write, desc = "󰉼 [F]ormat on write [T]oggle" }, - { "FF", "Format", desc = "󰉼 [F]ormat [F]ile" }, - { "", "Format", mode = "i", desc = "󰉼 [f]ormat file" }, + { "FT", toggle_format_on_write, desc = icon.." [F]ormat on write [T]oggle" }, + { "FF", "Format", desc = icon.." [F]ormat [F]ile" }, + { "", "Format", mode = "i", desc = icon.." [f]ormat file" }, -- stylua: ignore end }, diff --git a/config/nvim/lua/fschauen/plugins/fugitive.lua b/config/nvim/lua/fschauen/plugins/fugitive.lua index fca2609..2eaa3ce 100644 --- a/config/nvim/lua/fschauen/plugins/fugitive.lua +++ b/config/nvim/lua/fschauen/plugins/fugitive.lua @@ -1,3 +1,5 @@ +local icon = require("fschauen.util.icons").ui.Git + return { "tpope/vim-fugitive", @@ -5,8 +7,8 @@ return { keys = { -- stylua: ignore start - { "gS", "tab Git", desc = " [S]status with fugitive" }, - { "gb", "Git blame", desc = " [b]lame" }, + { "gS", "tab Git", desc = icon.." [S]status (fugitive)" }, + { "gb", "Git blame", desc = icon.." [b]lame (fugitive)" }, -- stylua: ignore end }, } diff --git a/config/nvim/lua/fschauen/plugins/git-messenger.lua b/config/nvim/lua/fschauen/plugins/git-messenger.lua index 589bcd4..b70cb27 100644 --- a/config/nvim/lua/fschauen/plugins/git-messenger.lua +++ b/config/nvim/lua/fschauen/plugins/git-messenger.lua @@ -1,3 +1,4 @@ +local icon = require("fschauen.util.icons").ui.Git return { "rhysd/git-messenger.vim", @@ -5,7 +6,7 @@ return { keys = { -- stylua: ignore start - { "gm", "GitMessenger", desc = " open [m]essenger" }, + { "gm", "GitMessenger", desc = icon.." [g]it [m]essenger" }, -- stylua: ignore end }, diff --git a/config/nvim/lua/fschauen/plugins/gitlinker.lua b/config/nvim/lua/fschauen/plugins/gitlinker.lua index 1301c26..dc8e095 100644 --- a/config/nvim/lua/fschauen/plugins/gitlinker.lua +++ b/config/nvim/lua/fschauen/plugins/gitlinker.lua @@ -20,6 +20,8 @@ local clipboard = function(mode) end end +local icon = require("fschauen.util.icons").ui.Git + return { "ruifm/gitlinker.nvim", @@ -27,11 +29,11 @@ return { keys = { -- stylua: ignore start - { "gr", open_repo, desc = " open [r]epository in browser" }, - { "gl", clipboard("n"), desc = " copy perma[l]ink to clipboard" }, - { "gl", clipboard("v"), desc = " copy perma[l]ink to clipboard", mode = "v" }, - { "gL", browser("n"), desc = " open perma[L]ink in browser" }, - { "gL", browser("v"), desc = " open perma[L]ink in browser", mode = "v" }, + { "gr", open_repo, desc = icon.." open [r]epository in browser" }, + { "gl", clipboard("n"), desc = icon.." copy perma[l]ink to clipboard" }, + { "gl", clipboard("v"), desc = icon.." copy perma[l]ink to clipboard", mode = "v" }, + { "gL", browser("n"), desc = icon.." open perma[L]ink in browser" }, + { "gL", browser("v"), desc = icon.." open perma[L]ink in browser", mode = "v" }, -- stylua: ignore end }, diff --git a/config/nvim/lua/fschauen/plugins/indent-blankline.lua b/config/nvim/lua/fschauen/plugins/indent-blankline.lua index ce6968d..6def074 100644 --- a/config/nvim/lua/fschauen/plugins/indent-blankline.lua +++ b/config/nvim/lua/fschauen/plugins/indent-blankline.lua @@ -1,4 +1,4 @@ -local icons = require("fschauen.util.icons") +local ui = require("fschauen.util.icons").ui return { "lukas-reineke/indent-blankline.nvim", @@ -14,8 +14,8 @@ return { keys = { -- stylua: ignore start - { "si", "IBLToggle", desc = icons.ui.Toggle .. " toggle indent lines" }, - { "so", "IBLToggleScope", desc = icons.ui.Toggle .. " toggle indent line scope" }, + { "si", "IBLToggle", desc = ui.Toggle.." toggle indent lines" }, + { "so", "IBLToggleScope", desc = ui.Toggle.." toggle indent line scope" }, -- stylua: ignore end }, @@ -24,9 +24,9 @@ return { opts = function(_, opts) return vim.tbl_deep_extend("force", opts or {}, { enabled = false, - indent = { char = icons.ui.LineLeft }, + indent = { char = ui.LineLeft }, scope = { - char = icons.ui.LineLeftBold, + char = ui.LineLeftBold, enabled = false, show_start = false, show_end = false, diff --git a/config/nvim/lua/fschauen/plugins/lualine.lua b/config/nvim/lua/fschauen/plugins/lualine.lua index 52411bc..9bbaaeb 100644 --- a/config/nvim/lua/fschauen/plugins/lualine.lua +++ b/config/nvim/lua/fschauen/plugins/lualine.lua @@ -1,6 +1,8 @@ local M = { 'nvim-lualine/lualine.nvim' } local icons = require('fschauen.util.icons') +local ui = icons.ui + local orange = '#d65d0e' local bright = '#ffffff' -- alternative: '#f9f5d7' @@ -70,7 +72,7 @@ M.config = function(--[[plugin]]_, --[[opts]]_) } function C:update_status(is_focused) - if not is_focused then return ' ' .. icons.ui.Sleep end + if not is_focused then return ' ' .. ui.Sleep end local code = vim.api.nvim_get_mode().mode:lower() local symbol = C.map[code:sub(1, 2)] or C.map[code:sub(1, 1)] or code @@ -101,7 +103,7 @@ M.config = function(--[[plugin]]_, --[[opts]]_) if next(count) == nil then return '' end local denominator = count.total > count.maxcount and '' or string.format('%d', count.total) - return string.format(icons.ui.Search .. '%d/%s', count.current, denominator) + return string.format(ui.Search .. '%d/%s', count.current, denominator) end return C @@ -141,7 +143,7 @@ M.config = function(--[[plugin]]_, --[[opts]]_) local lineno = vim.fn.search(trailing, 'nwc') if lineno == 0 then return '' end - local result = icons.ui.Attention .. lineno + local result = ui.Attention .. lineno local total = vim.fn.searchcount({ pattern = trailing }).total if total > 1 then result = result .. string.format(' (%d total)', total) end @@ -157,7 +159,7 @@ M.config = function(--[[plugin]]_, --[[opts]]_) } local paste = { - colored_if_focused(function(has_focus) return has_focus and icons.ui.Paste or ' ' end), + colored_if_focused(function(has_focus) return has_focus and ui.Paste or ' ' end), color = { bg = orange, }, @@ -167,8 +169,8 @@ M.config = function(--[[plugin]]_, --[[opts]]_) local status = { colored_if_focused(function(_) local status = '' - if vim.bo.modified then status = status .. icons.ui.Modified end - if vim.bo.readonly or not vim.bo.modifiable then status = status .. icons.ui.ReadOnly end + if vim.bo.modified then status = status .. ui.Modified end + if vim.bo.readonly or not vim.bo.modifiable then status = status .. ui.ReadOnly end return status end), color = { diff --git a/config/nvim/lua/fschauen/plugins/markdown-preview.lua b/config/nvim/lua/fschauen/plugins/markdown-preview.lua index 1f7ca1f..ff4a96a 100644 --- a/config/nvim/lua/fschauen/plugins/markdown-preview.lua +++ b/config/nvim/lua/fschauen/plugins/markdown-preview.lua @@ -24,13 +24,18 @@ return { end, config = function() - local group = vim.api.nvim_create_augroup("fschauen.markdown", { clear = true }) + local icon = require("fschauen.util.icons").ui.Markdown vim.api.nvim_create_autocmd("FileType", { desc = "Create key map to toggle markdown preview.", - group = group, + group = vim.api.nvim_create_augroup("fschauen.markdown", { clear = true }), pattern = "markdown", callback = function() - vim.keymap.set("n", "P", "MarkdownPreviewToggle", { buffer = true }) + vim.keymap.set( + "n", + "P", + "MarkdownPreviewToggle", + { buffer = true, desc = icon .. " toggle [P]review" } + ) end, }) end, diff --git a/config/nvim/lua/fschauen/plugins/neogit.lua b/config/nvim/lua/fschauen/plugins/neogit.lua index 42279f9..55ed78e 100644 --- a/config/nvim/lua/fschauen/plugins/neogit.lua +++ b/config/nvim/lua/fschauen/plugins/neogit.lua @@ -1,4 +1,4 @@ -local icons = require("fschauen.util.icons") +local ui = require("fschauen.util.icons").ui return { "NeogitOrg/neogit", @@ -8,7 +8,7 @@ return { dependencies = "nvim-lua/plenary.nvim", keys = { - { "gs", "Neogit", desc = " [s]tatus with neogit" }, + { "gs", "Neogit", desc = ui.Git .. " [s]tatus (Neogit)" }, }, opts = function(_, opts) @@ -17,16 +17,16 @@ return { disable_hint = true, signs = { section = { - icons.ui.Folder, - icons.ui.EmptyFolderOpen, + ui.Folder, + ui.EmptyFolderOpen, }, item = { - icons.ui.ChevronRight, - icons.ui.ChevronDown, + ui.ChevronRight, + ui.ChevronDown, }, hunk = { - icons.ui.ChevronSmallRight, - icons.ui.ChevronSmallDown, + ui.ChevronSmallRight, + ui.ChevronSmallDown, }, }, mappings = { diff --git a/config/nvim/lua/fschauen/plugins/nvim-lint.lua b/config/nvim/lua/fschauen/plugins/nvim-lint.lua index c9b2285..a14409c 100644 --- a/config/nvim/lua/fschauen/plugins/nvim-lint.lua +++ b/config/nvim/lua/fschauen/plugins/nvim-lint.lua @@ -1,3 +1,5 @@ +local icon = require("fschauen.util.icons").ui.Lint + return { "mfussenegger/nvim-lint", @@ -7,7 +9,7 @@ return { function() require("lint").try_lint() end, - desc = " [L]int file", + desc = icon .. " [L]int file", }, }, diff --git a/config/nvim/lua/fschauen/plugins/nvim-tree.lua b/config/nvim/lua/fschauen/plugins/nvim-tree.lua index 524a3d4..189d884 100644 --- a/config/nvim/lua/fschauen/plugins/nvim-tree.lua +++ b/config/nvim/lua/fschauen/plugins/nvim-tree.lua @@ -22,6 +22,8 @@ local on_attach = function(buffer) -- stylua: ignore end end +local icon = require("fschauen.util.icons").ui.FileTree + return { "nvim-tree/nvim-tree.lua", @@ -29,8 +31,8 @@ return { keys = { -- stylua: ignore start - { "tt", "NvimTreeToggle", desc = "󰙅 [t]oggle [t]ree" }, - { "tf", "NvimTreeFindFile", desc = "󰙅 Open [t]ree to current [f]ile " }, + { "tt", "NvimTreeToggle", desc = icon.." [t]oggle [t]ree" }, + { "tf", "NvimTreeFindFile", desc = icon.." Open [t]ree to current [f]ile " }, -- stylua: ignore end }, diff --git a/config/nvim/lua/fschauen/plugins/openbrowser.lua b/config/nvim/lua/fschauen/plugins/openbrowser.lua index e1ae31e..396b9f2 100644 --- a/config/nvim/lua/fschauen/plugins/openbrowser.lua +++ b/config/nvim/lua/fschauen/plugins/openbrowser.lua @@ -1,3 +1,5 @@ +local icon = require("fschauen.util.icons").ui.Web + return { "tyru/open-browser.vim", @@ -11,7 +13,7 @@ return { { "o", "(openbrowser-smart-search)", - desc = "󰖟 [o]pen URL under cursor or search the web", + desc = icon .. " [o]pen URL under cursor or search the web", mode = { "n", "v" }, }, }, diff --git a/config/nvim/lua/fschauen/plugins/plantuml-previewer.lua b/config/nvim/lua/fschauen/plugins/plantuml-previewer.lua index 2551e76..35703e1 100644 --- a/config/nvim/lua/fschauen/plugins/plantuml-previewer.lua +++ b/config/nvim/lua/fschauen/plugins/plantuml-previewer.lua @@ -1,3 +1,5 @@ +local icon = require("fschauen.util.icons").ui.Graph + return { "weirongxu/plantuml-previewer.vim", @@ -31,7 +33,12 @@ return { group = group, pattern = "plantuml", callback = function() - vim.keymap.set("n", "P", "PlantumlToggle", { buffer = true }) + vim.keymap.set( + "n", + "P", + "PlantumlToggle", + { buffer = true, desc = icon .. " toggle PlantUML [P]review" } + ) end, }) end, diff --git a/config/nvim/lua/fschauen/plugins/telescope.lua b/config/nvim/lua/fschauen/plugins/telescope.lua index 331308c..72d9289 100644 --- a/config/nvim/lua/fschauen/plugins/telescope.lua +++ b/config/nvim/lua/fschauen/plugins/telescope.lua @@ -1,5 +1,4 @@ -local util = require("fschauen.util") -local icons = require("fschauen.util.icons") +local ui = require("fschauen.util.icons").ui ---Create the left hand side for a Telescope keymap. local lhs = function(keys) @@ -8,7 +7,7 @@ end ---Create the description for a Telescope keymap. local desc = function(text) - return icons.ui.Telescope .. " Telescope " .. text + return ui.Telescope .. " Telescope " .. text end local builtin_picker = function(name, opts) @@ -33,7 +32,7 @@ local pickers = setmetatable({ dotfiles = builtin_picker("find_files", { cwd = "~/.dotfiles", hidden = true }), selection = function(title) return function() - local text = util.get_selected_text() + local text = require("fschauen.util").get_selected_text() return require("telescope.builtin").grep_string { prompt_title = string.format(title .. ": %s ", text), search = text, @@ -146,10 +145,10 @@ return { defaults = { mappings = { i = mappings, n = mappings }, - prompt_prefix = " " .. icons.ui.Telescope .. " ", - selection_caret = icons.ui.Play .. " ", + prompt_prefix = " " .. ui.Telescope .. " ", + selection_caret = ui.Play .. " ", - multi_icon = icons.ui.Checkbox .. " ", + multi_icon = ui.Checkbox .. " ", scroll_strategy = "limit", -- Don't wrap around in results. dynamic_preview_title = true, diff --git a/config/nvim/lua/fschauen/plugins/text-case.lua b/config/nvim/lua/fschauen/plugins/text-case.lua index fca7c94..4ebb23e 100644 --- a/config/nvim/lua/fschauen/plugins/text-case.lua +++ b/config/nvim/lua/fschauen/plugins/text-case.lua @@ -1,4 +1,6 @@ -local description = "󰬴 [c]hange text [c]ase" +local icon = require("fschauen.util.icons").ui.Text +local description = icon .." [c]hange text [c]ase" + local theme = function() return require("telescope.themes").get_cursor() end diff --git a/config/nvim/lua/fschauen/plugins/treesitter.lua b/config/nvim/lua/fschauen/plugins/treesitter.lua index 0744f68..826ee42 100644 --- a/config/nvim/lua/fschauen/plugins/treesitter.lua +++ b/config/nvim/lua/fschauen/plugins/treesitter.lua @@ -1,3 +1,5 @@ +local icon = require("fschauen.util.icons").ui.Tree + return { "nvim-treesitter/nvim-treesitter", @@ -15,9 +17,9 @@ return { keys = { -- stylua: ignore start - { "Tp", "TSPlaygroundToggle", desc = " [T]reesitter [p]layground (toggle)" }, - { "Th", "TSHighlightCapturesUnderCursor", desc = " [T]reesitter [h]ighlights" }, - { "Tn", "TSNodeUnderCursor", desc = " [T]reesitter [n]ode under cursor" }, + { "Tp", "TSPlaygroundToggle", desc = icon.." [T]reesitter [p]layground (toggle)" }, + { "Th", "TSHighlightCapturesUnderCursor", desc = icon.." [T]reesitter [h]ighlights" }, + { "Tn", "TSNodeUnderCursor", desc = icon.." [T]reesitter [n]ode under cursor" }, -- stylua: ignore end }, diff --git a/config/nvim/lua/fschauen/plugins/trouble.lua b/config/nvim/lua/fschauen/plugins/trouble.lua index 1c9fb5b..4ac4e58 100644 --- a/config/nvim/lua/fschauen/plugins/trouble.lua +++ b/config/nvim/lua/fschauen/plugins/trouble.lua @@ -1,3 +1,4 @@ +local icon = require("fschauen.util.icons").ui.TrafficLight return { "folke/trouble.nvim", @@ -5,9 +6,9 @@ return { keys = { -- stylua: ignore start - { "lt", "TroubleToggle", desc = "󱠪 trouble [t]toggle" }, - { "lw", "TroubleToggle workspace_diagnostics", desc = "󱠪 trouble [w]orkspace" }, - { "ld", "TroubleToggle document_diagnostics", desc = "󱠪 trouble [d]ocument" }, + { "lt", "TroubleToggle", desc = icon.." trouble [t]toggle" }, + { "lw", "TroubleToggle workspace_diagnostics", desc = icon.." trouble [w]orkspace" }, + { "ld", "TroubleToggle document_diagnostics", desc = icon.." trouble [d]ocument" }, -- stylua: ignore end }, diff --git a/config/nvim/lua/fschauen/plugins/undotree.lua b/config/nvim/lua/fschauen/plugins/undotree.lua index 5b40bea..eaae20a 100644 --- a/config/nvim/lua/fschauen/plugins/undotree.lua +++ b/config/nvim/lua/fschauen/plugins/undotree.lua @@ -1,3 +1,5 @@ +local icon = require("fschauen.util.icons").ui.Undo + return { "mbbill/undotree", @@ -12,6 +14,6 @@ return { end, keys = { - { "u", "UndotreeToggle" }, + { "u", "UndotreeToggle", desc = icon .. " toggle [u]ndo tree" }, }, } diff --git a/config/nvim/lua/fschauen/plugins/virt-column.lua b/config/nvim/lua/fschauen/plugins/virt-column.lua index f213342..438a39d 100644 --- a/config/nvim/lua/fschauen/plugins/virt-column.lua +++ b/config/nvim/lua/fschauen/plugins/virt-column.lua @@ -6,7 +6,7 @@ local toggle_colorcolumn = function() end end -local icons = require("fschauen.util.icons") +local ui = require("fschauen.util.icons").ui return { "lukas-reineke/virt-column.nvim", @@ -14,12 +14,12 @@ return { event = { "BufReadPost", "BufNewFile" }, keys = { - { "sc", toggle_colorcolumn, desc = icons.ui.Toggle .. " toggle virtual colunn" }, + { "sc", toggle_colorcolumn, desc = ui.Toggle .. " toggle virtual colunn" }, }, opts = function(_, opts) return vim.tbl_deep_extend("force", opts or {}, { - char = icons.ui.LineMiddle, + char = ui.LineMiddle, }) end, } diff --git a/config/nvim/lua/fschauen/plugins/whitespace.lua b/config/nvim/lua/fschauen/plugins/whitespace.lua index b139e8f..b2b9494 100644 --- a/config/nvim/lua/fschauen/plugins/whitespace.lua +++ b/config/nvim/lua/fschauen/plugins/whitespace.lua @@ -1,3 +1,5 @@ +local icon = require("fschauen.util.icons").ui.Whitespace + return { "ntpeters/vim-better-whitespace", @@ -14,9 +16,11 @@ return { end, keys = { - { "ww", "ToggleWhitespace" }, - { "wj", "NextTrailingWhitespace" }, - { "wk", "PrevTrailingWhitespace" }, - { "W", "StripWhitespace" }, + -- stylua: ignore start + { "ww", "ToggleWhitespace", desc = icon.." toggle whitespace" }, + { "wj", "NextTrailingWhitespace", desc = icon.." next whitespace" }, + { "wk", "PrevTrailingWhitespace", desc = icon.." previous whitespace" }, + { "W", "StripWhitespace", desc = icon.." strip whitespace" }, + -- stylua: ignore end }, } diff --git a/config/nvim/lua/fschauen/util/icons.lua b/config/nvim/lua/fschauen/util/icons.lua index 737dd71..cd71556 100644 --- a/config/nvim/lua/fschauen/util/icons.lua +++ b/config/nvim/lua/fschauen/util/icons.lua @@ -99,27 +99,37 @@ M.ui = { ChevronDown = "", --  ChevronLeft = "", --  ChevronRight = "", --  - ChevronUp = "", --  ChevronSmallDown = "", ChevronSmallLeft = "", ChevronSmallRight = "", ChevronSmallUp = "", + ChevronUp = "", --  Circle = "●", + Comment = "", + Comments = "", + Decrement = "", Diagnostic = "", EmptyFolder = "", EmptyFolderOpen = "", File = "", --  FileSymlink = "", --  + FileTree = "󰙅", Files = "", Fire = "", --  Folder = "󰉋", FolderOpen = "", FolderSymlink = "", + Format = "󰉼", Gauge = "󰓅", --  + Git = " ", + Graph = "󱁊", + Increment = "", LineLeft = "▏", LineLeftBold = "▎", LineMiddle = "│", LineMiddleBold = "┃", + Lint = "", + Markdown = "", Modified = "", Note = "", --  Paste = "", @@ -129,8 +139,14 @@ M.ui = { Sleep = "󰒲", Telescope = "", TestTube = "󰙨", -- 󰤑 + Text = "󰬴", Toggle = "󰨚", + TrafficLight = "󱠪", + Tree = "", + Undo = "󰕌", Warning = "", + Web = "󰖟", + Whitespace = "󱁐", } -- stylua: ignore end