From a50368a51d9576d302ce13c0c67c21b1defa4aa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B7=E9=85=94=E9=96=91=E5=90=9F?= <50296129+Jint-lzxy@users.noreply.github.com> Date: Sun, 7 May 2023 12:24:48 +0800 Subject: [PATCH] fix(icons)!: update icon codepoints (#447) --- dots.tutor | 4 +- init.lua | 19 +- lua/core/settings.lua | 8 +- lua/modules/configs/completion/lsp.lua | 2 +- lua/modules/configs/tool/nvim-tree.lua | 338 ++++++++++++------------- lua/modules/configs/ui/lualine.lua | 129 +++++----- lua/modules/utils/icons.lua | 117 ++++----- 7 files changed, 314 insertions(+), 303 deletions(-) diff --git a/dots.tutor b/dots.tutor index 3f899cc2f..3e14150f7 100644 --- a/dots.tutor +++ b/dots.tutor @@ -48,9 +48,9 @@ Back to the left window, the status line is showed at the bottom of the window. You will see different content under different conditions. It will looks like this if you switch to the right window and move cursor to the second line. ------------------------------------------------------------------------------- -|Normal|main|  autocmd |~/.config/nvim|utf-8|LF|1%|2:1| +|Normal|main| 󰅩 autocmd |~/.config/nvim|utf-8|LF|1%|2:1| ------------------------------------------------------------------------------- -" autocmd" indicates this line has a variable named "autocmd". So this part of +"󰅩 autocmd" indicates this line has a variable named "autocmd". So this part of status line will show you the context of your cursor position. This feature is based on lsp, so it is disabled if corresponding lsp is not attach to current buffer. diff --git a/init.lua b/init.lua index c5964e8fa..66fc38337 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,20 @@ if not vim.g.vscode then - require("core") + require("core") + + -- Release note + vim.schedule(function() + vim.notify_once( + [[ +We've released version v3.0.0! +Visit https://github.com/ayamir/nvimdots/releases to see the release notes. +If you have icons that can't be rendered correctly (e.g., 𑨩 and � ) or icons with incorrect size, be sure to read this! + +To silence this message, remove it from `init.lua` at the config's root directory. + +To check the glyphs size, make sure the following icons are very close to the crosses but there is no overlap: +XXXXXXXXX +]], + vim.log.levels.WARN + ) + end) end diff --git a/lua/core/settings.lua b/lua/core/settings.lua index 4615f1580..4f28047e0 100644 --- a/lua/core/settings.lua +++ b/lua/core/settings.lua @@ -9,6 +9,10 @@ settings["use_ssh"] = true ---@type boolean settings["format_on_save"] = true +-- Set it to false if diagnostics virtual text is annoying for you +---@type boolean +settings["diagnostics_virtual_text"] = true + -- Set the format disabled directories here, files under these dirs won't be formatted on save. ---@type string[] settings["format_disabled_dirs"] = { @@ -98,8 +102,4 @@ settings["null_ls_deps"] = { -- "markdownlint", } --- Set the inline_diagnostic_virtual_text to false if they are annoying for you ----@type boolean -settings["inline_diagnostic_virtual_text"] = true - return settings diff --git a/lua/modules/configs/completion/lsp.lua b/lua/modules/configs/completion/lsp.lua index a4575ac6c..32b78d150 100644 --- a/lua/modules/configs/completion/lsp.lua +++ b/lua/modules/configs/completion/lsp.lua @@ -40,7 +40,7 @@ return function() vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { signs = true, underline = true, - virtual_text = require("core.settings").inline_diagnostic_virtual_text, + virtual_text = require("core.settings").diagnostics_virtual_text, -- set update_in_insert to false bacause it was enabled by lspsaga update_in_insert = false, }) diff --git a/lua/modules/configs/tool/nvim-tree.lua b/lua/modules/configs/tool/nvim-tree.lua index 72a3163c4..57e738f96 100644 --- a/lua/modules/configs/tool/nvim-tree.lua +++ b/lua/modules/configs/tool/nvim-tree.lua @@ -6,173 +6,173 @@ return function() ui = require("modules.utils.icons").get("ui"), } - require("nvim-tree").setup({ - auto_reload_on_write = true, - create_in_closed_folder = false, - disable_netrw = false, - hijack_cursor = true, - hijack_netrw = true, - hijack_unnamed_buffer_when_opening = true, - open_on_tab = false, - respect_buf_cwd = false, - sort_by = "name", - sync_root_with_cwd = true, - view = { - adaptive_size = false, - centralize_selection = false, - width = 30, - side = "left", - preserve_window_proportions = false, - number = false, - relativenumber = false, - signcolumn = "yes", - float = { - enable = false, - open_win_config = { - relative = "editor", - border = "rounded", - width = 30, - height = 30, - row = 1, - col = 1, - }, - }, - }, - renderer = { - add_trailing = false, - group_empty = true, - highlight_git = false, - full_name = false, - highlight_opened_files = "none", - special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md", "CMakeLists.txt" }, - symlink_destination = true, - indent_markers = { - enable = true, - icons = { - corner = "└ ", - edge = "│ ", - item = "│ ", - none = " ", - }, - }, - root_folder_label = ":.:s?.*?/..?", - icons = { - webdev_colors = true, - git_placement = "before", - show = { - file = true, - folder = true, - folder_arrow = false, - git = true, - }, - padding = " ", - symlink_arrow = "  ", - glyphs = { - default = icons.documents.Default, -- - symlink = icons.documents.Symlink, -- - bookmark = icons.ui.Bookmark, - git = { - unstaged = icons.git.Mod_alt, - staged = icons.git.Add, -- - unmerged = icons.git.Unmerged, - renamed = icons.git.Rename, -- - untracked = icons.git.Untracked, -- "ﲉ" - deleted = icons.git.Remove, -- - ignored = icons.git.Ignore, --◌ - }, - folder = { - -- arrow_open = "", - -- arrow_closed = "", - arrow_open = "", - arrow_closed = "", - default = icons.ui.Folder, - open = icons.ui.FolderOpen, - empty = icons.ui.EmptyFolder, - empty_open = icons.ui.EmptyFolderOpen, - symlink = icons.ui.SymlinkFolder, - symlink_open = icons.ui.FolderOpen, - }, - }, - }, - }, - hijack_directories = { - enable = true, - auto_open = true, - }, - update_focused_file = { - enable = true, - update_root = true, - ignore_list = {}, - }, - filters = { - dotfiles = false, - custom = { ".DS_Store" }, - exclude = {}, - }, - actions = { - use_system_clipboard = true, - change_dir = { - enable = true, - global = false, - }, - open_file = { - quit_on_open = false, - resize_window = false, - window_picker = { - enable = true, - chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", - exclude = { - filetype = { "notify", "qf", "diff", "fugitive", "fugitiveblame" }, - buftype = { "terminal", "help" }, - }, - }, - }, - remove_file = { - close_window = true, - }, - }, - diagnostics = { - enable = false, - show_on_dirs = false, - debounce_delay = 50, - icons = { - hint = icons.diagnostics.Hint_alt, - info = icons.diagnostics.Information_alt, - warning = icons.diagnostics.Warning_alt, - error = icons.diagnostics.Error_alt, - }, - }, - filesystem_watchers = { - enable = true, - debounce_delay = 50, - }, - git = { - enable = true, - ignore = true, - show_on_dirs = true, - timeout = 400, - }, - trash = { - cmd = "gio trash", - require_confirm = true, - }, - live_filter = { - prefix = "[FILTER]: ", - always_show_folders = true, - }, - log = { - enable = false, - truncate = false, - types = { - all = false, - config = false, - copy_paste = false, - dev = false, - diagnostics = false, - git = false, - profile = false, - watcher = false, - }, - }, - }) + require("nvim-tree").setup({ + auto_reload_on_write = true, + create_in_closed_folder = false, + disable_netrw = false, + hijack_cursor = true, + hijack_netrw = true, + hijack_unnamed_buffer_when_opening = true, + open_on_tab = false, + respect_buf_cwd = false, + sort_by = "name", + sync_root_with_cwd = true, + view = { + adaptive_size = false, + centralize_selection = false, + width = 30, + side = "left", + preserve_window_proportions = false, + number = false, + relativenumber = false, + signcolumn = "yes", + float = { + enable = false, + open_win_config = { + relative = "editor", + border = "rounded", + width = 30, + height = 30, + row = 1, + col = 1, + }, + }, + }, + renderer = { + add_trailing = false, + group_empty = true, + highlight_git = false, + full_name = false, + highlight_opened_files = "none", + special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md", "CMakeLists.txt" }, + symlink_destination = true, + indent_markers = { + enable = true, + icons = { + corner = "└ ", + edge = "│ ", + item = "│ ", + none = " ", + }, + }, + root_folder_label = ":.:s?.*?/..?", + icons = { + webdev_colors = true, + git_placement = "before", + show = { + file = true, + folder = true, + folder_arrow = false, + git = true, + }, + padding = " ", + symlink_arrow = " 󰁔 ", + glyphs = { + default = icons.documents.Default, -- + symlink = icons.documents.Symlink, -- + bookmark = icons.ui.Bookmark, + git = { + unstaged = icons.git.Mod_alt, + staged = icons.git.Add, --󰄬 + unmerged = icons.git.Unmerged, + renamed = icons.git.Rename, --󰁔 + untracked = icons.git.Untracked, -- "󰞋" + deleted = icons.git.Remove, -- + ignored = icons.git.Ignore, --◌ + }, + folder = { + -- arrow_open = "", + -- arrow_closed = "", + arrow_open = "", + arrow_closed = "", + default = icons.ui.Folder, + open = icons.ui.FolderOpen, + empty = icons.ui.EmptyFolder, + empty_open = icons.ui.EmptyFolderOpen, + symlink = icons.ui.SymlinkFolder, + symlink_open = icons.ui.FolderOpen, + }, + }, + }, + }, + hijack_directories = { + enable = true, + auto_open = true, + }, + update_focused_file = { + enable = true, + update_root = true, + ignore_list = {}, + }, + filters = { + dotfiles = false, + custom = { ".DS_Store" }, + exclude = {}, + }, + actions = { + use_system_clipboard = true, + change_dir = { + enable = true, + global = false, + }, + open_file = { + quit_on_open = false, + resize_window = false, + window_picker = { + enable = true, + chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", + exclude = { + filetype = { "notify", "qf", "diff", "fugitive", "fugitiveblame" }, + buftype = { "terminal", "help" }, + }, + }, + }, + remove_file = { + close_window = true, + }, + }, + diagnostics = { + enable = false, + show_on_dirs = false, + debounce_delay = 50, + icons = { + hint = icons.diagnostics.Hint_alt, + info = icons.diagnostics.Information_alt, + warning = icons.diagnostics.Warning_alt, + error = icons.diagnostics.Error_alt, + }, + }, + filesystem_watchers = { + enable = true, + debounce_delay = 50, + }, + git = { + enable = true, + ignore = true, + show_on_dirs = true, + timeout = 400, + }, + trash = { + cmd = "gio trash", + require_confirm = true, + }, + live_filter = { + prefix = "[FILTER]: ", + always_show_folders = true, + }, + log = { + enable = false, + truncate = false, + types = { + all = false, + config = false, + copy_paste = false, + dev = false, + diagnostics = false, + git = false, + profile = false, + watcher = false, + }, + }, + }) end diff --git a/lua/modules/configs/ui/lualine.lua b/lua/modules/configs/ui/lualine.lua index 609a75716..eae7e4921 100644 --- a/lua/modules/configs/ui/lualine.lua +++ b/lua/modules/configs/ui/lualine.lua @@ -101,74 +101,67 @@ return function() return "" end - require("lualine").setup({ - options = { - icons_enabled = true, - theme = "catppuccin", - disabled_filetypes = {}, - component_separators = { left = "", right = "" }, - section_separators = { left = "", right = "" }, - ignore_focus = {}, - always_divide_middle = true, - globalstatus = false, - refresh = { - statusline = 1000, - tabline = 1000, - winbar = 1000, - }, - }, - sections = { - lualine_a = { { "mode" } }, - lualine_b = { { "branch" }, { "diff", source = diff_source } }, - lualine_c = { lspsaga_symbols }, - lualine_x = { - { escape_status }, - { - "diagnostics", - sources = { "nvim_diagnostic" }, - symbols = { - error = icons.diagnostics.Error, - warn = icons.diagnostics.Warning, - info = icons.diagnostics.Information, - }, - }, - { get_cwd }, - }, - lualine_y = { - { "filetype", colored = true, icon_only = true }, - { python_venv }, - { "encoding" }, - { - "fileformat", - icons_enabled = true, - symbols = { - unix = "LF", - dos = "CRLF", - mac = "CR", - }, - }, - }, - lualine_z = { "progress", "location" }, - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = { "filename" }, - lualine_x = { "location" }, - lualine_y = {}, - lualine_z = {}, - }, - tabline = {}, - extensions = { - "quickfix", - "nvim-tree", - "nvim-dap-ui", - "toggleterm", - "fugitive", - outline, - diffview, - }, - }) + require("lualine").setup({ + options = { + icons_enabled = true, + theme = "catppuccin", + disabled_filetypes = {}, + component_separators = "|", + section_separators = { left = "", right = "" }, + }, + sections = { + lualine_a = { { "mode" } }, + lualine_b = { { "branch" }, { "diff", source = diff_source } }, + lualine_c = { lspsaga_symbols }, + lualine_x = { + { escape_status }, + { + "diagnostics", + sources = { "nvim_diagnostic" }, + symbols = { + error = icons.diagnostics.Error, + warn = icons.diagnostics.Warning, + info = icons.diagnostics.Information, + hint = icons.diagnostics.Hint_alt, + }, + }, + { get_cwd }, + }, + lualine_y = { + { "filetype", colored = true, icon_only = true }, + { python_venv }, + { "encoding" }, + { + "fileformat", + icons_enabled = true, + symbols = { + unix = "LF", + dos = "CRLF", + mac = "CR", + }, + }, + }, + lualine_z = { "progress", "location" }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { "filename" }, + lualine_x = { "location" }, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + extensions = { + "quickfix", + "nvim-tree", + "nvim-dap-ui", + "toggleterm", + "fugitive", + outline, + diffview, + }, + }) -- Properly set background color for lspsaga local winbar_bg = require("modules.utils").hl_to_rgb("StatusLine", true, colors.mantle) diff --git a/lua/modules/utils/icons.lua b/lua/modules/utils/icons.lua index 370027574..06a229da0 100644 --- a/lua/modules/utils/icons.lua +++ b/lua/modules/utils/icons.lua @@ -2,34 +2,34 @@ local icons = {} local data = { kind = { - Class = "ﴯ", - Color = "", - Constant = "", + Class = "󰠱", + Color = "󰏘", + Constant = "󰏿", Constructor = "", Enum = "", EnumMember = "", Event = "", - Field = "", - File = "", - Folder = "", - Function = "", + Field = "󰇽", + File = "󰈙", + Folder = "󰉋", + Function = "󰊕", Interface = "", - Keyword = "", - Method = "", + Keyword = "󰌋", + Method = "󰆧", Module = "", - Namespace = "", + Namespace = "󰌗", Number = "", - Operator = "", + Operator = "󰆕", Package = "", - Property = "ﰠ", + Property = "󰜢", Reference = "", Snippet = "", Struct = "", - Text = "", - TypeParameter = "", - Unit = "", + Text = "󰉿", + TypeParameter = "󰅲", Undefined = "", - Value = "", + Unit = "", + Value = "󰎠", Variable = "", -- ccls-specific icons. TypeAlias = "", @@ -38,18 +38,18 @@ local data = { Macro = "", }, type = { - Array = "", + Array = "󰅪", Boolean = "", - Null = "ﳠ", + Null = "󰟢", Number = "", - Object = "", - String = "", + Object = "󰅩", + String = "󰉿", }, documents = { Default = "", File = "", Files = "", - FileTree = "פּ", + FileTree = "󰙅", Import = "", Symlink = "", }, @@ -57,15 +57,15 @@ local data = { Add = "", Branch = "", Diff = "", - Git = "", + Git = "󰊢", Ignore = "", Mod = "M", Mod_alt = "", Remove = "", Rename = "", Repo = "", - Unmerged = "שׂ", - Untracked = "ﲉ", + Unmerged = "󰘬", + Untracked = "󰞋", Unstaged = "", Staged = "", Conflict = "", @@ -75,55 +75,55 @@ local data = { ArrowOpen = "", BigCircle = "", BigUnfilledCircle = "", - BookMark = "", + BookMark = "󰃃", Bug = "", Calendar = "", - Check = "", + Check = "󰄳", ChevronRight = "", Circle = "", - Close = "", + Close = "󰅖", Close_alt = "", CloudDownload = "", - Comment = "", - CodeAction = "", + Comment = "󰅺", + CodeAction = "󰌵", Dashboard = "", - Emoji = "", + Emoji = "󰱫", EmptyFolder = "", EmptyFolderOpen = "", - File = "", + File = "󰈤", Fire = "", Folder = "", FolderOpen = "", Gear = "", - History = "", - Incoming = "", + History = "󰄉", + Incoming = "󰏷", Indicator = "", Keyboard = "", Left = "", List = "", Square = "", SymlinkFolder = "", - Lock = "", + Lock = "󰍁", Modified = "✥", Modified_alt = "", NewFile = "", Newspaper = "", - Note = "", - Outgoing = "", + Note = "󰍨", + Outgoing = "󰏻", Package = "", - Pencil = "", - Perf = "", + Pencil = "󰏫", + Perf = "󰅒", Play = "", Project = "", Right = "", RootFolderOpened = "", - Search = "", + Search = "󰍉", Separator = "", - DoubleSeparator = "", + DoubleSeparator = "󰄾", SignIn = "", SignOut = "", Sort = "", - Spell = "暈", + Spell = "󰓆", Symlink = "", Table = "", Telescope = "", @@ -133,21 +133,21 @@ local data = { Warning = "", Information = "", Question = "", - Hint = "", + Hint = "󰌵", -- Holo version - Error_alt = "", - Warning_alt = "", + Error_alt = "󰅚", + Warning_alt = "󰀪", Information_alt = "", Question_alt = "", - Hint_alt = "", + Hint_alt = "󰌶", }, misc = { - Campass = "", + Campass = "󰀹", Code = "", - EscapeST = "✺", + EscapeST = "", Gavel = "", - Glass = "", - PyEnv = "", + Glass = "󰂖", + PyEnv = "󰌠", Squirrel = "", Tag = "", Tree = "", @@ -156,7 +156,7 @@ local data = { Vbar = "│", Add = "+", Added = "", - Ghost = "", + Ghost = "󰊠", ManUp = "", Vim = "", }, @@ -164,6 +164,7 @@ local data = { Codeium = "", TabNine = "", Copilot = "", + Copilot_alt = "", -- Add source-specific icons here buffer = "", cmp_tabnine = "", @@ -171,30 +172,30 @@ local data = { copilot = "", copilot_alt = "", latex_symbols = "", - luasnip = "", + luasnip = "󰃐", nvim_lsp = "", nvim_lua = "", orgmode = "", path = "", - spell = "暈", + spell = "󰓆", tmux = "", treesitter = "", undefined = "", }, dap = { - Breakpoint = "", - BreakpointCondition = "ﳁ", + Breakpoint = "󰝥", + BreakpointCondition = "󰟃", BreakpointRejected = "", LogPoint = "", Pause = "", Play = "", RunLast = "↻", StepBack = "", - StepInto = "", - StepOut = "", - StepOver = "", + StepInto = "󰆹", + StepOut = "󰆸", + StepOver = "󰆷", Stopped = "", - Terminate = "ﱢ", + Terminate = "󰝤", }, }