pretty nice nvim

This commit is contained in:
Gabriel Fontes
2021-11-08 04:14:22 -03:00
parent ad954b7d5a
commit e77abff29c
8 changed files with 131 additions and 306 deletions
+3
View File
@@ -127,6 +127,9 @@ in
Defaults timestamp_type=global
'';
};
environment.systemPackages = with pkgs; [
amdgpu-clocks
];
environment.etc = {
"default/amdgpu-custom-state.card0".text = ''
OD_SCLK:
+6
View File
@@ -21,6 +21,12 @@
inherit (final.gnome) zenity;
};
vimPlugins = prev.vimPlugins // {
nvim-base16 = prev.vimPlugins.nvim-base16.overrideAttrs (oldAttrs: rec {
patches = (oldAttrs.patches or [ ]) ++ [ ./nvim-base16-more-highlights.patch ];
});
};
pass-wofi = prev.callPackage ../pkgs/pass-wofi {
pass = final.pass.withExtensions (exts: [ exts.pass-otp ]);
};
@@ -0,0 +1,67 @@
diff --git a/lua/base16-colorscheme.lua b/lua/base16-colorscheme.lua
index 5f4cc44..9d8723e 100644
--- a/lua/base16-colorscheme.lua
+++ b/lua/base16-colorscheme.lua
@@ -97,19 +97,20 @@ function M.setup(colors)
hi.NonText = { guifg = M.colors.base03, guibg = nil, gui = nil, guisp = nil }
hi.LineNr = { guifg = M.colors.base04, guibg = M.colors.base00, gui = nil, guisp = nil }
hi.SignColumn = { guifg = M.colors.base04, guibg = M.colors.base00, gui = nil, guisp = nil }
- hi.StatusLine = { guifg = M.colors.base04, guibg = M.colors.base02, gui = 'none', guisp = nil }
+ hi.StatusLine = { guifg = M.colors.base0B, guibg = M.colors.base02, gui = 'none', guisp = nil }
hi.StatusLineNC = { guifg = M.colors.base03, guibg = M.colors.base01, gui = 'none', guisp = nil }
- hi.VertSplit = { guifg = M.colors.base05, guibg = M.colors.base00, gui = 'none', guisp = nil }
+ hi.VertSplit = { guifg = M.colors.base01, guibg = M.colors.base00, gui = 'none', guisp = nil }
hi.ColorColumn = { guifg = nil, guibg = M.colors.base01, gui = 'none', guisp = nil }
hi.CursorColumn = { guifg = nil, guibg = M.colors.base01, gui = 'none', guisp = nil }
- hi.CursorLine = { guifg = nil, guibg = M.colors.base01, gui = 'none', guisp = nil }
- hi.CursorLineNr = { guifg = M.colors.base04, guibg = M.colors.base01, gui = nil, guisp = nil }
+ hi.CursorLine = { guifg = nil, guibg = M.colors.base02, gui = 'none', guisp = nil }
+ hi.CursorLineNr = { guifg = M.colors.base0B, guibg = M.colors.base01, gui = nil, guisp = nil }
hi.QuickFixLine = { guifg = nil, guibg = M.colors.base01, gui = 'none', guisp = nil }
hi.PMenu = { guifg = M.colors.base05, guibg = M.colors.base01, gui = 'none', guisp = nil }
hi.PMenuSel = { guifg = M.colors.base01, guibg = M.colors.base05, gui = nil, guisp = nil }
hi.TabLine = { guifg = M.colors.base03, guibg = M.colors.base01, gui = 'none', guisp = nil }
- hi.TabLineFill = { guifg = M.colors.base03, guibg = M.colors.base01, gui = 'none', guisp = nil }
+ hi.TabLineFill = { guifg = M.colors.base03, guibg = M.colors.base02, gui = 'none', guisp = nil }
hi.TabLineSel = { guifg = M.colors.base0B, guibg = M.colors.base01, gui = 'none', guisp = nil }
+ hi.EndOfBuffer = { guifg = M.colors.base00, guibg = nil, gui = nil, guisp = nil }
-- Standard syntax highlighting
hi.Boolean = { guifg = M.colors.base09, guibg = nil, gui = nil, guisp = nil }
@@ -259,6 +260,36 @@ function M.setup(colors)
hi.TSDefinitionUsage = { guifg = nil, guibg = nil, gui = 'underline', guisp = M.colors.base04 }
hi.TSCurrentScope = { guifg = nil, guibg = nil, gui = 'bold', guisp = nil }
+ -- Completion (nvim-cmp.lua)
+ hi.CmpItemAbbr = { guifg = M.colors.base05, guibg = 'none', gui = 'none', guisp = nil }
+ hi.CmpItemAbbrDeprecated = { guifg = M.colors.base03, guibg = 'none', gui = 'none', guisp = nil }
+ hi.CmpItemAbbrMatch = { guifg = M.colors.base05, guibg = 'none', gui = 'none', guisp = nil }
+ hi.CmpItemAbbrMatchFuzzy = { guifg = M.colors.base05, guibg = 'none', gui = 'none', guisp = nil }
+ hi.CmpItemKind = { guifg = M.colors.base0C, guibg = 'none', gui = nil, guisp = nil }
+ hi.CmpItemMenu = { guifg = M.colors.base05, guibg = 'none', gui = 'none', guisp = nil }
+
+ -- BufferLine (barbar.nvim)
+ hi.BufferCurrent = { guifg = M.colors.base0B, guibg = M.colors.base00, gui = nil, guisp = nil }
+ hi.BufferCurrentIndex = { guifg = M.colors.base0B, guibg = M.colors.base00, gui = nil, guisp = nil }
+ hi.BufferCurrentMod = { guifg = M.colors.base0E, guibg = M.colors.base00, gui = nil, guisp = nil }
+ hi.BufferCurrentSign = { guifg = M.colors.base0B, guibg = M.colors.base00, gui = nil, guisp = nil }
+ hi.BufferCurrentTarget = { guifg = M.colors.base08, guibg = M.colors.base00, gui = nil, guisp = nil }
+ hi.BufferCurrentIcon = { guifg = nil, guibg = M.colors.base00, gui = nil, guisp = nil }
+ hi.BufferVisible = { guifg = M.colors.base0A, guibg = M.colors.base01, gui = nil, guisp = nil }
+ hi.BufferVisibleIndex = { guifg = M.colors.base0A, guibg = M.colors.base01, gui = nil, guisp = nil }
+ hi.BufferVisibleMod = { guifg = M.colors.base0E, guibg = M.colors.base01, gui = nil, guisp = nil }
+ hi.BufferVisibleSign = { guifg = M.colors.base0A, guibg = M.colors.base01, gui = nil, guisp = nil }
+ hi.BufferVisibleTarget = { guifg = M.colors.base08, guibg = M.colors.base01, gui = nil, guisp = nil }
+ hi.BufferVisibleIcon = { guifg = nil, guibg = M.colors.base01, gui = nil, guisp = nil }
+ hi.BufferInactive = { guifg = M.colors.base04, guibg = M.colors.base02, gui = nil, guisp = nil }
+ hi.BufferInactiveIndex = { guifg = M.colors.base05, guibg = M.colors.base02, gui = nil, guisp = nil }
+ hi.BufferInactiveMod = { guifg = M.colors.base0E, guibg = M.colors.base02, gui = nil, guisp = nil }
+ hi.BufferInactiveSign = { guifg = M.colors.base05, guibg = M.colors.base02, gui = nil, guisp = nil }
+ hi.BufferInactiveTarget = { guifg = M.colors.base08, guibg = M.colors.base02, gui = nil, guisp = nil }
+ hi.BufferInactiveIcon = { guifg = nil, guibg = M.colors.base02, gui = nil, guisp = nil }
+ hi.BufferTabpages = { guifg = M.colors.base03, guibg = M.colors.base02, gui = nil, guisp = nil }
+ hi.BufferTabpageFill = { guifg = M.colors.base03, guibg = M.colors.base02, gui = nil, guisp = nil }
+
hi.NvimInternalError = { guifg = M.colors.base00, guibg = M.colors.base08, gui = 'none', guisp = nil }
hi.NormalFloat = { guifg = M.colors.base05, guibg = M.colors.base00, gui = nil, guisp = nil }
-4
View File
@@ -12,7 +12,6 @@
vim = "nvim";
m = "neomutt";
mutt = "neomutt";
xhost-root = "xhost si:localuser:root";
};
shellAliases = {
miningclock = "sudo USER_STATES_PATH=/etc/default/amdgpu-custom-state amdgpu-clocks";
@@ -23,9 +22,6 @@
getip = "curl ifconfig.me";
# Clear screen and scrollbackbuffer
clear = "clear && printf '\\033[2J\\033[3J\\033[1;1H'";
# I have no ideia why neofetch --config argument must be a relative path, but oh well
minifetch =
"neofetch --config (realpath --relative-to=(pwd) ${config.xdg.configHome}/neofetch/config_small.conf)";
};
functions = {
fish_greeting = "${pkgs.fortune}/bin/fortune -s";
+4 -3
View File
@@ -5,6 +5,7 @@
./ui.nix
./lsp.nix
./syntax.nix
./theme.nix
];
programs.neovim = {
@@ -48,13 +49,13 @@
plugins = with pkgs.vimPlugins; [
# QOL
editorconfig-vim
vim-fugitive
vim-illuminate
vim-matchup
vim-numbertoggle
vim-surround
vim-matchup
vim-fugitive
{ plugin = nvim-autopairs; config = "lua require('nvim-autopairs').setup{}"; }
{ plugin = better-escape-nvim; config = "lua require('better_escape').setup()"; }
{ plugin = bufdelete-nvim; config = "nmap <C-q> :Bdelete<CR>"; }
];
};
@@ -0,0 +1,36 @@
# Stuff i use to dynamically theme neovim without relying on notermguicolors
{ pkgs, config, ... }:
let
slug = config.colorscheme.slug;
c = config.colorscheme.colors;
nvim-scheme = pkgs.writeTextDir "colors/nix-${slug}.vim" ''
let g:colors_name = 'nix-${slug}'
lua << EOF
require("base16-colorscheme").setup({
base00 = "#${c.base00}"; base01 = "#${c.base01}"; base02 = "#${c.base02}"; base03 = "#${c.base03}";
base04 = "#${c.base04}"; base05 = "#${c.base05}"; base06 = "#${c.base06}"; base07 = "#${c.base07}";
base08 = "#${c.base08}"; base09 = "#${c.base09}"; base0A = "#${c.base0A}"; base0B = "#${c.base0B}";
base0C = "#${c.base0C}"; base0D = "#${c.base0D}"; base0E = "#${c.base0E}"; base0F = "#${c.base0F}";
})
EOF
'';
in {
programs.neovim.plugins = [
pkgs.vimPlugins.nvim-base16
{ plugin = nvim-scheme; config = "colorscheme nix-${slug}"; }
];
# When configuration is written, reapply scheme
xdg.configFile."nvim/init.vim".onChange =
let
nvr = "${pkgs.neovim-remote}/bin/nvr";
in
''
path=$(< ~/.config/nvim/init.vim head -1 | cut -d '=' -f2 )
${nvr} --serverlist | \
while read server; do
${nvr} --nostart -cc ":set packpath^=$path | :set runtimepath^=$path | :colorscheme nix-${slug}" --servername $server & \
done
'';
}
+12 -296
View File
@@ -1,49 +1,22 @@
# Stuff i use to dynamically theme neovim without relying on notermguicolors
{ pkgs, config, ... }:
let
c = config.colorscheme.colors;
# Base16 lua colorscheme command
nvim-scheme = ''
require("base16-colorscheme").setup({
base00 = "#${c.base00}"; base01 = "#${c.base01}"; base02 = "#${c.base02}"; base03 = "#${c.base03}";
base04 = "#${c.base04}"; base05 = "#${c.base05}"; base06 = "#${c.base06}"; base07 = "#${c.base07}";
base08 = "#${c.base08}"; base09 = "#${c.base09}"; base0A = "#${c.base0A}"; base0B = "#${c.base0B}";
base0C = "#${c.base0C}"; base0D = "#${c.base0D}"; base0E = "#${c.base0E}"; base0F = "#${c.base0F}";
})
'';
bufferline-theme = ''
'';
in
{ pkgs, ... }:
{
# When configuration is written, reapply scheme
xdg.configFile."nvim/init.vim".onChange =
let
nvr = "${pkgs.neovim-remote}/bin/nvr";
in
''
${nvr} --serverlist | \
while read server; do
${nvr} --nostart -cc ':lua ${nvim-scheme}' --servername $server & \
done
'';
programs.neovim.plugins = with pkgs.vimPlugins; [
{ plugin = nvim-web-devicons; config = "lua require('nvim-web-devicons').setup{}"; }
{ plugin = nvim-colorizer-lua; config = "lua require('colorizer').setup()"; }
{ plugin = gitsigns-nvim; config = "lua require('gitsigns').setup()"; }
{
plugin = nvim-base16;
# Write scheme to configuration file
plugin = barbar-nvim;
config = ''
lua << EOF
${nvim-scheme}
EOF
let bufferline = get(g:, 'bufferline', {})
let bufferline.animation = v:true
nmap <C-h> :BufferPrevious<CR>
nmap <C-l> :BufferNext<CR>
nmap <C-q> :BufferClose<CR>
nmap <C-a> :BufferPick<CR>
'';
}
{ plugin = nvim-web-devicons; config = "lua require('nvim-web-devicons').setup{}"; }
{ plugin = nvim-colorizer-lua; config = "lua require('colorizer').setup()"; }
{ plugin = gitsigns-nvim; config = "lua require('gitsigns').setup()"; }
{
plugin = nvim-tree-lua;
config = ''
@@ -51,262 +24,5 @@ in
nmap <C-p> :NvimTreeToggle<CR>
'';
}
{
plugin = feline-nvim;
config = ''
lua << EOF
local components = {
active = {
{{
provider = ' ',
hl = 'Normal',
}},
{{
provider = 'irineu'
}},
},
inactive = {
{{
provider = 'irineu'
}},
{{
provider = 'irineu'
}},
},
}
require('feline').setup({components = components})
EOF
'';
}
{
plugin = bufferline-nvim;
config = ''
nmap <C-h> :BufferLineCyclePrev<CR>
nmap <C-l> :BufferLineCycleNext<CR>
lua << EOF
require('bufferline').setup{
fill = {
guifg = comment_fg,
guibg = separator_background_color,
},
group_separator = {
guifg = comment_fg,
guibg = separator_background_color,
},
group_label = {
guibg = comment_fg,
guifg = separator_background_color,
},
tab = {
guifg = comment_fg,
guibg = background_color,
},
tab_selected = {
guifg = tabline_sel_bg,
guibg = normal_bg,
},
tab_close = {
guifg = comment_fg,
guibg = background_color,
},
close_button = {
guifg = comment_fg,
guibg = background_color,
},
close_button_visible = {
guifg = comment_fg,
guibg = visible_bg,
},
close_button_selected = {
guifg = normal_fg,
guibg = normal_bg,
},
background = {
guifg = comment_fg,
guibg = background_color,
},
buffer = {
guifg = comment_fg,
guibg = background_color,
},
buffer_visible = {
guifg = comment_fg,
guibg = visible_bg,
},
buffer_selected = {
guifg = normal_fg,
guibg = normal_bg,
gui = "bold,italic",
},
diagnostic = {
guifg = comment_diagnostic_fg,
guibg = background_color,
},
diagnostic_visible = {
guifg = comment_diagnostic_fg,
guibg = visible_bg,
},
diagnostic_selected = {
guifg = normal_diagnostic_fg,
guibg = normal_bg,
gui = "bold,italic",
},
info = {
guifg = comment_fg,
guisp = info_fg,
guibg = background_color,
},
info_visible = {
guifg = comment_fg,
guibg = visible_bg,
},
info_selected = {
guifg = info_fg,
guibg = normal_bg,
gui = "bold,italic",
guisp = info_fg,
},
info_diagnostic = {
guifg = comment_diagnostic_fg,
guisp = info_diagnostic_fg,
guibg = background_color,
},
info_diagnostic_visible = {
guifg = comment_diagnostic_fg,
guibg = visible_bg,
},
info_diagnostic_selected = {
guifg = info_diagnostic_fg,
guibg = normal_bg,
gui = "bold,italic",
guisp = info_diagnostic_fg,
},
warning = {
guifg = comment_fg,
guisp = warning_fg,
guibg = background_color,
},
warning_visible = {
guifg = comment_fg,
guibg = visible_bg,
},
warning_selected = {
guifg = warning_fg,
guibg = normal_bg,
gui = "bold,italic",
guisp = warning_fg,
},
warning_diagnostic = {
guifg = comment_diagnostic_fg,
guisp = warning_diagnostic_fg,
guibg = background_color,
},
warning_diagnostic_visible = {
guifg = comment_diagnostic_fg,
guibg = visible_bg,
},
warning_diagnostic_selected = {
guifg = warning_diagnostic_fg,
guibg = normal_bg,
gui = "bold,italic",
guisp = warning_diagnostic_fg,
},
error = {
guifg = comment_fg,
guibg = background_color,
guisp = error_fg,
},
error_visible = {
guifg = comment_fg,
guibg = visible_bg,
},
error_selected = {
guifg = error_fg,
guibg = normal_bg,
gui = "bold,italic",
guisp = error_fg,
},
error_diagnostic = {
guifg = comment_diagnostic_fg,
guibg = background_color,
guisp = error_diagnostic_fg,
},
error_diagnostic_visible = {
guifg = comment_diagnostic_fg,
guibg = visible_bg,
},
error_diagnostic_selected = {
guifg = error_diagnostic_fg,
guibg = normal_bg,
gui = "bold,italic",
guisp = error_diagnostic_fg,
},
modified = {
guifg = string_fg,
guibg = background_color,
},
modified_visible = {
guifg = string_fg,
guibg = visible_bg,
},
modified_selected = {
guifg = string_fg,
guibg = normal_bg,
},
duplicate_selected = {
guifg = duplicate_color,
gui = "italic",
guibg = normal_bg,
},
duplicate_visible = {
guifg = duplicate_color,
gui = "italic",
guibg = visible_bg,
},
duplicate = {
guifg = duplicate_color,
gui = "italic",
guibg = background_color,
},
separator_selected = {
guifg = separator_background_color,
guibg = normal_bg,
},
separator_visible = {
guifg = separator_background_color,
guibg = visible_bg,
},
separator = {
guifg = separator_background_color,
guibg = background_color,
},
indicator_selected = {
guifg = tabline_sel_bg,
guibg = normal_bg,
},
pick_selected = {
guifg = error_fg,
guibg = normal_bg,
gui = "bold,italic",
},
pick_visible = {
guifg = error_fg,
guibg = visible_bg,
gui = "bold,italic",
},
pick = {
guifg = error_fg,
guibg = background_color,
gui = "bold,italic",
},
}
}
EOF
'';
}
];
}
+3 -3
View File
@@ -3,9 +3,9 @@
with nix-colors.lib { inherit pkgs; };
let
currentScheme = "spaceduck";
currentWallpaper = null;
currentMode = null;
currentScheme = import ./current-scheme.nix;
currentWallpaper = import ./current-wallpaper.nix;
currentMode = import ./current-mode.nix;
in {
imports = [ nix-colors.homeManagerModule ];
home.packages = with pkgs; [