vim: move most icons to a dedicated file

This commit is contained in:
Fernando Schauenburg 2024-02-11 18:29:39 +01:00
parent 04acdd05a1
commit f5e1ac20eb
10 changed files with 197 additions and 107 deletions

View file

@ -1,5 +1,7 @@
local M = {}
local icons = require('fschauen.icons')
-- Show/navigate warning and errors by default.
M.severity = vim.diagnostic.severity.WARN
@ -80,7 +82,7 @@ M.setup = function()
underline = false,
virtual_text = {
spacing = 6,
prefix = '',
prefix = icons.ui.Circle,
severity = {
min = M.severity,
}
@ -91,14 +93,7 @@ M.setup = function()
severity_sort = true,
}
local signs = {
Error = '',
Warn = '',
Info = '',
Hint = '',
}
for type, icon in pairs(signs) do
for type, icon in pairs(icons.diagnostics) do
local hl = 'DiagnosticSign' .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end

View file

@ -0,0 +1,122 @@
local M = {}
M.diagnostics = {
Debug = '',
Error = '',
Hint = '',
Info = '',
Trace = '',
Warn = '',
}
M.git = {
Branch = '󰘬', -- 
file = {
Deleted = '', -- 
Ignored = '',
Renamed = '', -- 
Staged = '', -- S
Unmerged = '', -- 
Unstaged = '', -- 
Untracked = '', -- U
}
}
-- Custom mix of lspkind defaults and VS Code codicons :)
M.kind = {
Array = '',
Boolean = '',
Class = '',
Color = '',
Constant = '󰏿 ', -- 
Constructor = '',
Copilot = '',
Enum = '', -- 
EnumMember = '', -- 
Event = '',
Field = '',
File = '',
Folder = '', -- 󰉋
Function = '󰊕 ', -- 
Interface = '',
Key = '',
Keyword = '',
Method = '',
Module = '',
Namespace = '',
Null = '', -- 󰟢
Number = '',
Object = '',
Operator = '',
Package = '',
Property = '',
Reference = '', -- 
Snippet = '',
String = '',
Struct = '',
Text = '',
TypeParameter = '',
Unit = '',
Value = '󰎠 ',
Variable = '󰀫 ', -- 
}
M.modes = {
Normal = '', -- 'Normal ' 'n'
OperatorPending = '', -- 'O-Pend ' 'no'
NormalI = '', -- 'Normal ' 'ni' (normal via i_CTRL-O)
Visual = '󰒉', -- 'Visual ' 'v'
VisualBlock = '󰩭', -- 'V-Block' ''
Select = '󰒉', -- 'Select ' 's'
SelectBlock = '󰩭', -- 'S-Block' ''
Insert = '', -- 'Insert ' 'i'
Replace = '󰄾', -- 'Replace' 'r'
VirtualReplace = '󰶻', -- 'V-Repl ' 'rv'
Command = '', -- 'Command' 'c'
Ex = '', -- ' Ex ' 'cv'
modeore = '', -- ' modeore 'rm' (modeORE)
Confirm = '󰭚', -- 'Confirm' 'r?' (:confirm)
Shell = '', -- ' Shell ' '!' (external command executing)
Terminal = '', -- ' Term ' 't'
}
M.ui = {
Attention = '',
Bug = '', -- 
Checkmark = '', --  󰄬 󰄬 
ChevronDown = '', -- 
ChevronLeft = '', -- 
ChevronRight = '', -- 
ChevronUp = '', -- 
ChevronSmallDown = '',
ChevronSmallLeft = '',
ChevronSmallRight = '',
ChevronSmallUp = '',
Circle = '',
EmptyFolder = '',
EmptyFolderOpen = '',
File = '', -- 
FileSymlink = '', -- 
Files = '',
Fire = '', -- 
Folder = '󰉋 ',
FolderOpen = '',
FolderSymlink = '',
Gauge = '󰓅 ', -- 
LineLeft = '',
LineLeftBold = '',
LineMiddle = '',
LineMiddleBold = '',
Modified = '',
Note = '', -- 
Paste = '',
Play = '',
ReadOnly = '', -- 'RO',
Search = '', -- 
Sleep = '󰒲 ',
TestTube = '󰙨 ', -- 󰤑
Warning = '',
}
return M

View file

@ -89,44 +89,7 @@ M.config = function()
path = '',
},
-- Custom mix of lspkind defaults and VS Code codicons :)
symbol_map = {
Array = '',
Boolean = '',
Class = '',
Color = '',
Constant = '󰏿',
Constructor = '',
Copilot = '',
Enum = '',
EnumMember = '',
Event = '',
Field = '',
File = '',
Folder = '',
Function = '󰊕',
Interface = '',
Key = '',
Keyword = '',
Method = '',
Module = '',
Namespace = '',
Null = '',
Number = '',
Object = '',
Operator = '',
Package = '',
Property = '',
Reference = '',
Snippet = '',
String = '',
Struct = '',
Text = '',
TypeParameter = '',
Unit = '',
Value = '󰎠',
Variable = '󰀫',
},
symbol_map = require('fschauen.icons').kind,
},
},

View file

@ -1,13 +1,15 @@
local M = { 'lukas-reineke/indent-blankline.nvim' }
local icons = require('fschauen.icons')
M.config = function()
require('ibl').setup {
enabled = false,
indent = {
char = '',
char = icons.ui.LineLeft,
},
scope = {
char = '',
char = icons.ui.LineLeftBold,
enabled = false,
show_start = false,
show_end = false,

View file

@ -1,8 +1,9 @@
local M = { 'nvim-lualine/lualine.nvim' }
local icons = require('fschauen.icons')
local orange = '#d65d0e'
local bright = '#ffffff' -- alternative: '#f9f5d7'
local M = { 'nvim-lualine/lualine.nvim' }
M.dependencies = {
'nvim-tree/nvim-web-devicons',
}
@ -52,26 +53,26 @@ M.config = function()
local C = require('lualine.component'):extend()
C.map = {
['n'] = '', -- 'Normal ', -- Normal
['no'] = '', -- 'O-Pend ', -- Operator-pending
['ni'] = '', -- 'Normal ', -- Normal via i_CTRL-O
['v'] = '󰒉', -- 'Visual ', -- Visual by character
[''] = '󰩭', -- 'V-Block', -- Visual blockwise
['s'] = '󰒉', -- 'Select ', -- Select by character
[''] = '󰩭', -- 'S-Block', -- Select blockwise
['i'] = '', -- 'Insert ', -- Insert
['r'] = '󰄾', -- 'Replace', -- Replace
['rv'] = '󰶻', -- 'V-Repl ', -- Virtual Replace
['c'] = '', -- 'Command', -- Command-line
['cv'] = '', -- ' Ex ', -- Ex mode
['rm'] = '', -- ' modeore ', -- -- modeORE --
['r?'] = '󰭚', -- 'Confirm', -- :confirm
['!'] = '', -- ' Shell ', -- External command executing
['t'] = '', -- ' Term ', -- Terminal
['n'] = icons.modes.Normal, -- 'Normal ', -- Normal
['no'] = icons.modes.OperatorPending, -- 'O-Pend ', -- Operator-pending
['ni'] = icons.modes.NormalI, -- 'Normal ', -- Normal via i_CTRL-O
['v'] = icons.modes.Visual, -- 'Visual ', -- Visual by character
[''] = icons.modes.VisualBlock, -- 'V-Block', -- Visual blockwise
['s'] = icons.modes.Select, -- 'Select ', -- Select by character
[''] = icons.modes.SelectBlock, -- 'S-Block', -- Select blockwise
['i'] = icons.modes.Insert, -- 'Insert ', -- Insert
['r'] = icons.modes.Replace, -- 'Replace', -- Replace
['rv'] = icons.modes.VirtualReplace, -- 'V-Repl ', -- Virtual Replace
['c'] = icons.modes.Command, -- 'Command', -- Command-line
['cv'] = icons.modes.Ex, -- ' Ex ', -- Ex mode
['rm'] = icons.modes.modeore, -- ' modeore ', -- -- modeORE --
['r?'] = icons.modes.Cofirm, -- 'Confirm', -- :confirm
['!'] = icons.modes.Shell, -- ' Shell ', -- External command executing
['t'] = icons.modes.Term, -- ' Term ', -- Terminal
}
function C:update_status(is_focused)
if not is_focused then return ' 󰒲 ' end
if not is_focused then return ' ' .. icons.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
@ -102,7 +103,7 @@ M.config = function()
if next(count) == nil then return '' end
local denominator = count.total > count.maxcount and '' or string.format('%d', count.total)
return string.format('%d/%s', count.current, denominator)
return string.format(icons.ui.Search .. '%d/%s', count.current, denominator)
end
return C
@ -142,7 +143,7 @@ M.config = function()
local lineno = vim.fn.search(trailing, 'nwc')
if lineno == 0 then return '' end
local result = '' .. lineno
local result = icons.ui.Attention .. lineno
local total = vim.fn.searchcount({ pattern = trailing }).total
if total > 1 then result = result .. string.format(' (%d total)', total) end
@ -157,9 +158,8 @@ M.config = function()
end,
}
local paste = {
colored_if_focused(function(has_focus) return has_focus and '' or ' ' end),
colored_if_focused(function(has_focus) return has_focus and icons.ui.Paste or ' ' end),
color = {
bg = orange,
},
@ -169,8 +169,8 @@ M.config = function()
local status = {
colored_if_focused(function(_)
local status = ''
if vim.bo.modified then status = status .. '' end
if vim.bo.readonly or not vim.bo.modifiable then status = status .. 'RO' end
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
return status
end),
color = {
@ -184,7 +184,7 @@ M.config = function()
mode
},
lualine_b = {
{ 'branch', icon = '󰘬', cond = window.is_medium },
{ 'branch', icon = icons.git.Branch, cond = window.is_medium },
},
lualine_c = {
filename,

View file

@ -9,12 +9,14 @@ M.keys = {
}
M.config = function()
local icons = require('fschauen.icons')
require('neogit').setup {
disable_hint = true,
signs = {
section = { '', '' },
item = { '', '' },
hunk = { '', '' },
section = { icons.ui.Folder, icons.ui.EmptyFolderOpen },
item = { icons.ui.ChevronRight, icons.ui.ChevronDown },
hunk = { icons.ui.ChevronSmallRight, icons.ui.ChevronSmallDown },
},
mappings = {
status = {

View file

@ -11,6 +11,8 @@ M.keys = {
}
M.config = function()
local icons = require('fschauen.icons')
require('nvim-tree').setup {
disable_netrw = true, -- replace netrw with nvim-tree
hijack_cursor = true, -- keep the cursor on begin of the filename
@ -50,27 +52,27 @@ M.config = function()
webdev_colors = false, -- highlight icons with NvimTreeFileIcon
git_placement = 'signcolumn',
glyphs = {
default = '',
symlink = '',
modified = '',
default = icons.ui.File,
symlink = icons.ui.FileSymlink,
modified = icons.ui.Circle,
folder = {
arrow_closed = '', --   
arrow_open = '', --   
default = '', --  
open = '', --  
empty = '',
empty_open = '',
symlink = '',
symlink_open = '',
arrow_closed = icons.ui.ChevronSmallRight,
arrow_open = icons.ui.ChevronSmallDown,
default = icons.ui.Folder,
open = icons.ui.FolderOpen,
empty = icons.ui.EmptyFolder,
empty_open = icons.ui.EmptyFolderOpen,
symlink = icons.ui.FolderSymlink,
symlink_open = icons.ui.FolderSymlink,
},
git = {
untracked = '',
unstaged = '',
staged = '',
deleted = '',
unmerged = '',
renamed = '',
ignored = '',
untracked = icons.git.file.Untracked,
unstaged = icons.git.file.Unstaged,
staged = icons.git.file.Staged,
deleted = icons.git.file.Deleted,
unmerged = icons.git.file.Unmerged,
renamed = icons.git.file.Renamed,
ignored = icons.git.file.Ignored,
},
},
},

View file

@ -118,6 +118,8 @@ M.keys = {
{ '<leader>f<leader>', pickers.resume '󰐎 Resume' , desc = ' Telescope Resume ' },
}
local icons = require('fschauen.icons')
M.config = function()
local actions = require('telescope.actions')
local layout = require('telescope.actions.layout')
@ -143,10 +145,10 @@ M.config = function()
n = mappings,
},
prompt_prefix = '', -- Alternatives: 
selection_caret = '', -- Alternatives:  ➔ 
prompt_prefix = '',
selection_caret = icons.ui.Play,
multi_icon = '󰄬 ', -- Alternatives: 󰄬  
multi_icon = icons.ui.Checkmark,
scroll_strategy = 'limit', -- Don't wrap around in results.
dynamic_preview_title = true,

View file

@ -14,16 +14,18 @@ M.keys = {
{ '<leader>ft', '<cmd>TodoTelescope<cr>' },
}
local icons = require('fschauen.icons')
M.config = function()
require('todo-comments').setup {
keywords = {
TODO = { icon = '󰄬 ' },
FIX = { icon = '' },
HACK = { icon = '' },
WARN = { icon = '' },
PERF = { icon = '󰓅 ' },
NOTE = { icon = '' },
TEST = { icon = '󰙨 ' },
TODO = { icon = icons.ui.Checkmark },
FIX = { icon = icons.ui.Bug },
HACK = { icon = icons.ui.Fire },
WARN = { icon = icons.ui.Warning },
PERF = { icon = icons.ui.Gauge },
NOTE = { icon = icons.ui.Note },
TEST = { icon = icons.ui.TestTube },
},
}
end

View file

@ -19,7 +19,7 @@ M.keys = {
M.config = function()
require('virt-column').setup {
char = '',
char = require('fschauen.icons').ui.LineMiddle,
}
end