feat: add attribute set of named icons

This commit is contained in:
Nicolas Goudry 2024-06-02 10:27:38 +02:00
parent e5f2726ffd
commit 4ea6e5d4bf
No known key found for this signature in database
GPG key ID: 5FC434D9FFD1DF44
4 changed files with 82 additions and 19 deletions

View file

@ -58,6 +58,7 @@
inherit pkgs; inherit pkgs;
libn = nixvim.lib.${system}; libn = nixvim.lib.${system};
icons = import ./utils/icons.nix;
}; };
}; };
in in

View file

@ -1,6 +1,6 @@
# homepage: https://github.com/goolord/alpha-nvim # homepage: https://github.com/goolord/alpha-nvim
# nixvim doc: https://nix-community.github.io/nixvim/plugins/alpha/index.html # nixvim doc: https://nix-community.github.io/nixvim/plugins/alpha/index.html
{ libn, pkgs, ... }: { icons, libn, pkgs, ... }:
let let
header = { header = {
@ -30,11 +30,11 @@ let
# Use function defined in lua config (see below) to generate buttons # Use function defined in lua config (see below) to generate buttons
val = [ val = [
{ __raw = "alpha_button('LDR n ', ' New File')"; } { __raw = "alpha_button('LDR n ', '${icons.FileNew} New File')"; }
{ __raw = "alpha_button('LDR e ', ' Explorer')"; } { __raw = "alpha_button('LDR e ', '${icons.FolderOpen} Explorer')"; }
{ __raw = "alpha_button('LDR f f', ' Find File')"; } { __raw = "alpha_button('LDR f f', '${icons.Search} Find File')"; }
{ __raw = "alpha_button('LDR f o', '󰈙 Recents')"; } { __raw = "alpha_button('LDR f o', '${icons.DefaultFile} Recents')"; }
{ __raw = "alpha_button('LDR f g', '󰈭 Live Grep')"; } { __raw = "alpha_button('LDR f g', '${icons.WordFile} Live Grep')"; }
]; ];
}; };

View file

@ -1,6 +1,6 @@
# homepage: https://github.com/nvim-neo-tree/neo-tree.nvim # homepage: https://github.com/nvim-neo-tree/neo-tree.nvim
# nixvim doc: https://nix-community.github.io/nixvim/plugins/neo-tree/index.html # nixvim doc: https://nix-community.github.io/nixvim/plugins/neo-tree/index.html
_: { icons, ... }:
{ {
opts = { opts = {
@ -143,15 +143,15 @@ _:
defaultComponentConfigs = { defaultComponentConfigs = {
gitStatus.symbols = { gitStatus.symbols = {
added = ""; added = icons.GitAdd;
conflict = ""; conflict = icons.GitConflict;
deleted = ""; deleted = icons.GitDelete;
ignored = ""; ignored = icons.GitIgnored;
modified = ""; modified = icons.GitChange;
renamed = ""; renamed = icons.GitRenamed;
staged = ""; staged = icons.GitStaged;
unstaged = ""; unstaged = icons.GitUnstaged;
untracked = ""; untracked = icons.GitUntracked;
}; };
}; };
@ -177,15 +177,15 @@ _:
# Sources to show and their labels # Sources to show and their labels
sources = [ sources = [
{ {
displayName = " Files"; displayName = "${icons.FolderClosed} Files";
source = "filesystem"; source = "filesystem";
} }
{ {
displayName = "󰈙 Bufs"; displayName = "${icons.DefaultFile} Bufs";
source = "buffers"; source = "buffers";
} }
{ {
displayName = "󰊢 Git"; displayName = "${icons.Git} Git";
source = "git_status"; source = "git_status";
} }
]; ];

62
utils/icons.nix Normal file
View file

@ -0,0 +1,62 @@
# Taken from AstroNvim
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astroui.lua#L7-L66
{
ActiveLSP = "";
ActiveTS = "";
ArrowLeft = "";
ArrowRight = "";
Bookmarks = "";
BufferClose = "󰅖";
DapBreakpoint = "";
DapBreakpointCondition = "";
DapBreakpointRejected = "";
DapLogPoint = "󰛿";
DapStopped = "󰁕";
Debugger = "";
DefaultFile = "󰈙";
Diagnostic = "󰒡";
DiagnosticError = "";
DiagnosticHint = "󰌵";
DiagnosticInfo = "󰋼";
DiagnosticWarn = "";
Ellipsis = "";
Environment = "";
FileNew = "";
FileModified = "";
FileReadOnly = "";
FoldClosed = "";
FoldOpened = "";
FoldSeparator = " ";
FolderClosed = "";
FolderEmpty = "";
FolderOpen = "";
Git = "󰊢";
GitAdd = "";
GitBranch = "";
GitChange = "";
GitConflict = "";
GitDelete = "";
GitIgnored = "";
GitRenamed = "";
GitSign = "";
GitStaged = "";
GitUnstaged = "";
GitUntracked = "";
LSPLoading1 = "";
LSPLoading2 = "󰀚";
LSPLoading3 = "";
MacroRecording = "";
Package = "󰏖";
Paste = "󰅌";
Refresh = "";
Search = "";
Selected = "";
Session = "󱂬";
Sort = "󰒺";
Spellcheck = "󰓆";
Tab = "󰓩";
TabClose = "󰅙";
Terminal = "";
Window = "";
WordFile = "󰈭";
}