From 7df25e8ce3e98e4cb56c5eb47c6ada1f414e083c Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Sat, 20 May 2023 00:08:22 +0200 Subject: Add icons file --- fnl/plugins/core/lazy.fnl | 37 ++++++++++++++++++++---------------- fnl/plugins/editor/gitsigns.fnl | 12 +++++++----- fnl/plugins/editor/telescope.fnl | 8 +++++--- fnl/plugins/editor/trouble.fnl | 17 +++++++++++------ fnl/plugins/editor/which-key.fnl | 6 +++++- fnl/plugins/icons.fnl | 41 ++++++++++++++++++++++++++++++++++++++++ fnl/plugins/lsp/diagnostics.fnl | 10 ++++++---- fnl/plugins/lsp/mason.fnl | 8 +++++--- fnl/plugins/ui/alpha.fnl | 18 +++++++++--------- fnl/plugins/ui/lualine.fnl | 7 +++++-- 10 files changed, 115 insertions(+), 49 deletions(-) create mode 100644 fnl/plugins/icons.fnl diff --git a/fnl/plugins/core/lazy.fnl b/fnl/plugins/core/lazy.fnl index 8c86de4..797edd3 100644 --- a/fnl/plugins/core/lazy.fnl +++ b/fnl/plugins/core/lazy.fnl @@ -1,5 +1,7 @@ ;; Lazy opts. +(local icons (require :plugins.icons)) + (local opts {:install {:colorscheme [:no-clown-fiesta]} :performance {:cache {:enabled true} :rtp {:disabled_plugins [:gzip @@ -10,22 +12,25 @@ :tutor :zipPlugin]}} :ui {:border :single - :icons {:cmd " " - :config " " - :event " " - :ft " " - :init " " - :import " " - :keys " " - :lazy "鈴 " - :loaded "● " - :not_loaded "○ " - :plugin " " - :runtime " " - :source " " - :start " " - :task " " - :list ["● " " " " " "‒ "]}}}) + :icons {:cmd (.. (. icons :cmd) " ") + :config (.. (. icons :cog) " ") + :event (.. (. icons :lightning) " ") + :ft (.. (. icons :document) " ") + :init (.. (. icons :cog) " ") + :import (.. (. icons :import) " ") + :keys (.. (. icons :keyboard) " ") + :lazy (.. (. icons :sleep) " ") + :loaded (.. (. icons :filled-orb) " ") + :not_loaded (.. (. icons :orb) " ") + :plugin (.. (. icons :package) " ") + :runtime (.. (. icons :vim) " ") + :source (.. (. icons :code) " ") + :start (.. (. icons :play) " ") + :task (.. (. icons :checkmark) " ") + :list [(.. (. icons :filled-orb) " ") + (.. (. icons :right-arrow) " ") + (.. (. icons :star) " ") + (.. (. icons :line) " ")]}}}) (fn setup [plugins] (let [lazy (require :lazy)] diff --git a/fnl/plugins/editor/gitsigns.fnl b/fnl/plugins/editor/gitsigns.fnl index e0551e6..0634138 100644 --- a/fnl/plugins/editor/gitsigns.fnl +++ b/fnl/plugins/editor/gitsigns.fnl @@ -51,24 +51,26 @@ [mode key cmd desc] (vim.keymap.set mode key cmd (vim.tbl_extend :force {:buffer bufnr} desc))))) +(local icons (require :plugins.icons)) + (local signs {:add {:hl :GitSignsAdd - :text "|" + :text (. icons :git-add) :numhl :GitSignsAddNr :linehl :GitSignsAddLn} :change {:hl :GitSignsChange - :text "|" + :text (. icons :git-add) :numhl :GitSignsChangeNr :linehl :GitSignsChangeLn} :delete {:hl :GitSignsDelete - :text "_" + :text (. icons :git-delete) :numhl :GitSignsDeleteNr :linehl :GitSignsDeleteLn} :topdelete {:hl :GitSignsDelete - :text "‾" + :text (. icons :git-top-delete) :numhl :GitSignsDeleteNr :linehl :GitSignsDeleteLn} :changedelete {:hl :GitSignsChange - :text "~" + :text (. icons :git-change-delete) :numhl :GitSignsChangeNr :linehl :GitSignsChangeLn}}) diff --git a/fnl/plugins/editor/telescope.fnl b/fnl/plugins/editor/telescope.fnl index 9c17aeb..d662b87 100644 --- a/fnl/plugins/editor/telescope.fnl +++ b/fnl/plugins/editor/telescope.fnl @@ -59,9 +59,11 @@ (fn setup [] (let [telescope (require :telescope) - actions (require :telescope.actions)] - (telescope.setup {:defaults {:prompt_prefix "  " - :selection_caret "> " + actions (require :telescope.actions) + icons (require :plugins.icons)] + (telescope.setup {:defaults {:prompt_prefix (.. " " (. icons :telescope) + " ") + :selection_caret (.. (. icons :caret) " ") :path_display [:smart] :color_devicons false :pickers {:find_files {:theme :dropdown}} diff --git a/fnl/plugins/editor/trouble.fnl b/fnl/plugins/editor/trouble.fnl index 5c989de..7136787 100644 --- a/fnl/plugins/editor/trouble.fnl +++ b/fnl/plugins/editor/trouble.fnl @@ -1,5 +1,7 @@ ;; Pretty diagnostics. +(local icons (require :plugins.icons)) + (local opts {:position :bottom ;; position of the list can be: bottom, top, left, right :height 10 @@ -69,15 +71,18 @@ :auto_jump [:lsp_definitions] ;; for the given modes, automatically jump if there is only a single result :signs {;; icons / text used for a diagnostic - :error "" - :warning "" - :hint "" - :information "" - :other "﫠"} + :error (. icons :error) + :warning (. icons :warn) + :hint (. icons :hint) + :information (. icons :info) + :other (. icons :other)} :use_diagnostic_signs false ;; enabling this will use the signs defined in your lsp client }) {1 :folke/trouble.nvim - :keys [{1 :jt 2 :TroubleToggle :desc :Trouble}] + :cmd [:Trouble :TroubleToggle] + :keys [{1 :jt + 2 "TroubleToggle workspace_diagnostics" + :desc :Trouble}] : opts} diff --git a/fnl/plugins/editor/which-key.fnl b/fnl/plugins/editor/which-key.fnl index 9ea8ff8..76f6e47 100644 --- a/fnl/plugins/editor/which-key.fnl +++ b/fnl/plugins/editor/which-key.fnl @@ -1,5 +1,7 @@ ;; Which-key provides a pop-up menu for some key mappings. +(local icons (require :plugins.icons)) + (local opts {:plugins {:marks true :registers true :spelling {:enabled true :suggestions 20} @@ -10,7 +12,9 @@ :nav true :z true :g true}} - :icons {:breadcrumb "»" :separator " " :group "+"} + :icons {:breadcrumb (. icons :guillemet) + :separator (.. (. icons :small-right-arrow) " ") + :group "+"} :popup_mappings {:scroll_down : :scroll_up :} :window {:border :rounded :position :bottom :winblend 0} :layout {:height {:min 4 :max 25} diff --git a/fnl/plugins/icons.fnl b/fnl/plugins/icons.fnl new file mode 100644 index 0000000..86eec76 --- /dev/null +++ b/fnl/plugins/icons.fnl @@ -0,0 +1,41 @@ +;; Icons. + +{:error "" + :warn "" + :hint "" + :info "" + :other "﫠 " + :git " " + :search "" + :text "" + :notebook "" + :clock "" + :cog "" + :cabinet "󰪶" + :org "" + :checkmark "" + :right-arrow "" + :small-right-arrow "" + :guillemet "»" + :close "" + :git-add "|" + :git-delete "_" + :git-top-delete "‾" + :git-change-delete "~" + :telescope "" + :caret ">" + :cmd "" + :lightning "" + :document "" + :import "" + :keyboard "" + :sleep "鈴" + :filled-orb "●" + :orb "○" + :package "" + :vim "" + :code "" + :play "" + :star "" + :line "‒" +} diff --git a/fnl/plugins/lsp/diagnostics.fnl b/fnl/plugins/lsp/diagnostics.fnl index e9eca47..8676924 100644 --- a/fnl/plugins/lsp/diagnostics.fnl +++ b/fnl/plugins/lsp/diagnostics.fnl @@ -1,9 +1,11 @@ ;; Handlers for the requests and responses from and to the lsp server. -(local signs [{:name :DiagnosticSignError :text ""} - {:name :DiagnosticSignWarn :text ""} - {:name :DiagnosticSignHint :text ""} - {:name :DiagnosticSignInfo :text ""}]) +(local icons (require :plugins.icons)) + +(local signs [{:name :DiagnosticSignError :text (. icons :error)} + {:name :DiagnosticSignWarn :text (. icons :warn)} + {:name :DiagnosticSignHint :text (. icons :hint)} + {:name :DiagnosticSignInfo :text (. icons :info)}]) (fn apply-signs [] (each [_ sign (ipairs signs)] diff --git a/fnl/plugins/lsp/mason.fnl b/fnl/plugins/lsp/mason.fnl index bc63e23..f94f328 100644 --- a/fnl/plugins/lsp/mason.fnl +++ b/fnl/plugins/lsp/mason.fnl @@ -1,9 +1,11 @@ ;; Mason manages external tooling, e.g. lsp, formatters, and linters. +(local icons (require :plugins.icons)) + (local opts {:ui {:border :single - :icons {:package_installed " " - :package_pending " " - :package_uninstalled " "}} + :icons {:package_installed (.. (. icons :checkmark) " ") + :package_pending (.. (. icons :right-arrow) " ") + :package_uninstalled (.. (. icons :close) " ")}} :max_concurrent_installers 10}) {1 :williamboman/mason.nvim diff --git a/fnl/plugins/ui/alpha.fnl b/fnl/plugins/ui/alpha.fnl index 38c9606..55a962b 100644 --- a/fnl/plugins/ui/alpha.fnl +++ b/fnl/plugins/ui/alpha.fnl @@ -1,5 +1,7 @@ ;; A customizable greeter. +(local icons (require :plugins.icons)) + (local ascii-art [" ##############..... ############## " " ##############......############## " " ##########..........########## " @@ -24,20 +26,18 @@ (let [dashboard (require :alpha.themes.dashboard)] (set dashboard.section.header.val ascii-art) (set dashboard.section.buttons.val - [(dashboard.button :e " New file" ":ene startinsert ") - (dashboard.button :f " Find file" + [(dashboard.button :f (.. (. icons :search) " Find file") ":Telescope find_files theme=dropdown") - (dashboard.button :g " Find text" + (dashboard.button :g (.. (. icons :text) " Find text") ":Telescope live_grep theme=dropdown") - (dashboard.button :p " Find project" + (dashboard.button :p (.. (. icons :notebook) " Find project") ":Telescope projects theme=dropdown") - (dashboard.button :r " Recently used files" + (dashboard.button :r (.. (. icons :clock) " Recently used files") ":Telescope oldfiles theme=dropdown") - (dashboard.button :t " Configuration" + (dashboard.button :t (.. (. icons :cog) " Configuration") ":e ~/.config/nvim/init.lua ") - (dashboard.button :o " Org" - ":Telescope find_files theme=dropdown cwd=~/.local/share/org") - (dashboard.button :q " Quit Neovim" ":qa")]) + (dashboard.button :o (.. (. icons :org) " Org") + ":Telescope find_files theme=dropdown cwd=~/.local/share/org")]) (set dashboard.section.header.opts.hl :AlphaHeader) (set dashboard.section.buttons.opts.hl :AlphaButtons) (set dashboard.opts.opts.noautocmd true) diff --git a/fnl/plugins/ui/lualine.fnl b/fnl/plugins/ui/lualine.fnl index 170e8a9..e2b533b 100644 --- a/fnl/plugins/ui/lualine.fnl +++ b/fnl/plugins/ui/lualine.fnl @@ -1,5 +1,7 @@ ;; Statusbar. +(local icons (require :plugins.icons)) + (local disable [:neogitstatus :netrw :lir @@ -27,7 +29,8 @@ (local diagnostics {1 :diagnostics :sources [:nvim_diagnostic] :sections [:error :warn] - :symbols {:error " " :warn " "} + :symbols {:error (.. (. icons :error) " ") + :warn (.. (. icons :warn) " ")} :colored false :disabled_buftypes [:nvim-tree] :padding 0 @@ -40,7 +43,7 @@ :cond hide-in-width}) (local branch {1 "b:gitsigns_head" - :icon " " + :icon (. icons :git) :disabled_buftypes [:nvim-tree] :cond hide-in-width}) -- cgit v1.2.3-70-g09d2