Compare commits

..

No commits in common. "59db46498709e2c7e7cc36fc6a3d734b00eecb7b" and "dfc8d68495eb73cddd3ec791a173756fa0cb3369" have entirely different histories.

2 changed files with 142 additions and 146 deletions

View file

@ -14,10 +14,9 @@
else else
( (
cd "${r.path}" cd "${r.path}"
${pkgs.git}/bin/git --no-optional-locks diff --quiet || echo "Repository is dirty!" ${pkgs.git}/bin/git diff --quiet || echo "Repository is dirty!"
${pkgs.git}/bin/git pull || true ${pkgs.git}/bin/git pull || true
# Only push if there's something to push. Also prevents from trying to push on repos where we don't have rights. ${pkgs.git}/bin/git push || true
(${pkgs.git}/bin/git --no-optional-locks status --porcelain -b --ignore-submodules | grep ' \[ahead [0-9]\+\]' && ${pkgs.git}/bin/git push) || true
) )
fi fi
'') '')

View file

@ -1,157 +1,154 @@
{ pkgs, lib, config, ... }: { pkgs, lib, config, ... }:
{ {
config = { config = {
programs = { programs.nixvim = {
# https://www.reddit.com/r/neovim/comments/mbj8m5/how_to_setup_ctrlshiftkey_mappings_in_neovim_and/ autoCmd = [
alacritty.settings.key_bindings = [ # Turn off relativenumber only for insert mode
{ key = "H"; mods = "Control|Shift"; chars = "\\x1b[72;5u"; } { event = "InsertEnter"; pattern = "*"; command = "set norelativenumber"; }
{ key = "L"; mods = "Control|Shift"; chars = "\\x1b[76;5u"; } { event = "InsertLeave"; pattern = "*"; command = "set relativenumber"; }
] ++ (map ];
(n: { key = "Key${builtins.toString n}"; mods = "Control"; chars = "\\x1b[${builtins.toString (48+n)};5u"; }) extraPlugins = with pkgs.vimPlugins; [
(lib.lists.range 0 9)); nvim-scrollview # Scroll bar
# Ctrl+<number> doesn't get interpreted, but Ctrl+Shift+<number> does, so let's use that ];
nixvim = { keymaps = [
autoCmd = [ # barbar
# Turn off relativenumber only for insert mode { key = "<C-H>"; action = "<Cmd>BufferPrevious<CR>"; options = { silent = true; }; }
{ event = "InsertEnter"; pattern = "*"; command = "set norelativenumber"; } { key = "<C-L>"; action = "<Cmd>BufferNext<CR>"; options = { silent = true; }; }
{ event = "InsertLeave"; pattern = "*"; command = "set relativenumber"; } # TODO https://www.reddit.com/r/neovim/comments/mbj8m5/how_to_setup_ctrlshiftkey_mappings_in_neovim_and/
]; { key = "<Space><C-H>"; action = "<Cmd>BufferMovePrevious<CR>"; options = { silent = true; }; }
extraPlugins = with pkgs.vimPlugins; [ { key = "<Space><C-L>"; action = "<Cmd>BufferMoveNext<CR>"; options = { silent = true; }; }
nvim-scrollview # Scroll bar # TODO gotos don't work
]; { key = "<C-1>"; action = "<Cmd>BufferGoto 1<CR>"; options = { silent = true; }; }
keymaps = { key = "<C-2>"; action = "<Cmd>BufferGoto 2<CR>"; options = { silent = true; }; }
let { key = "<C-3>"; action = "<Cmd>BufferGoto 3<CR>"; options = { silent = true; }; }
options = { silent = true; }; { key = "<C-4>"; action = "<Cmd>BufferGoto 4<CR>"; options = { silent = true; }; }
in { key = "<C-5>"; action = "<Cmd>BufferGoto 5<CR>"; options = { silent = true; }; }
[ { key = "<C-6>"; action = "<Cmd>BufferGoto 6<CR>"; options = { silent = true; }; }
# barbar { key = "<C-7>"; action = "<Cmd>BufferGoto 7<CR>"; options = { silent = true; }; }
{ key = "gb"; action = "<Cmd>BufferPick<CR>"; inherit options; } { key = "<C-8>"; action = "<Cmd>BufferGoto 8<CR>"; options = { silent = true; }; }
{ key = "<C-H>"; action = "<Cmd>BufferPrevious<CR>"; inherit options; } { key = "<C-9>"; action = "<Cmd>BufferGoto 9<CR>"; options = { silent = true; }; }
{ key = "<C-L>"; action = "<Cmd>BufferNext<CR>"; inherit options; } { key = "<C-0>"; action = "<Cmd>BufferLast<CR>"; options = { silent = true; }; }
{ key = "<C-S-H>"; action = "<Cmd>BufferMovePrevious<CR>"; inherit options; } { key = "gb"; action = "<Cmd>BufferPick<CR>"; options = { silent = true; }; }
{ key = "<C-S-L>"; action = "<Cmd>BufferMoveNext<CR>"; inherit options; } # TODO Other useful options?
{ key = "<C-0>"; action = "<Cmd>BufferLast<CR>"; inherit options; } ];
] ++ (map options = {
(n: { key = "<C-${builtins.toString n}>"; action = "<Cmd>BufferGoto ${builtins.toString n}<CR>"; inherit options; }) showmode = false;
(lib.lists.range 1 9)); number = true;
options = { relativenumber = true;
showmode = false; title = true;
number = true; };
relativenumber = true; plugins = {
title = true; # Tabline
}; barbar.enable = true;
plugins = { # TODO Investigate bufferline?
# Tabline # Status line
barbar.enable = true; lualine = with config.lib.stylix.colors.withHashtag; let
# Status line normal = { fg = base05; bg = base01; };
lualine = with config.lib.stylix.colors.withHashtag; let inverted = { fg = base00; bg = base03; };
normal = { fg = base05; bg = base01; }; normal_ina = { fg = base02; bg = base01; };
inverted = { fg = base00; bg = base03; }; inverted_ina = { fg = base00; bg = base02; };
normal_ina = { fg = base02; bg = base01; }; in
inverted_ina = { fg = base00; bg = base02; }; rec {
in enable = true;
rec { inactiveSections = sections;
enable = true; sections = {
inactiveSections = sections; lualine_a = [{
sections = { name = ''string.format('%d', vim.fn.line('$'))'';
lualine_a = [{ }];
name = ''string.format('%d', vim.fn.line('$'))''; lualine_b = [
}]; "mode"
lualine_b = [ ];
"mode" lualine_c = [{
]; name = "filename";
lualine_c = [{ color = {
name = "filename"; __raw = ''
color = { function(section)
__raw = '' return { fg = vim.bo.modified and '${base08}' or '${normal.fg}' }
function(section) end
return { fg = vim.bo.modified and '${base08}' or '${normal.fg}' } '';
end };
''; extraConfig = {
path = 1; # Relative path
symbols = {
modified = "";
newfile = "󰻭";
readonly = "󰏯";
unnamed = "󱀶";
}; };
};
}
"location"];
lualine_x = [{
name = ''(next(vim.lsp.buf_get_clients()) == nil) and "󰒲 " or ""'';
extraConfig.separator = { left = ""; right = ""; };
}] ++ (lib.mapAttrsToList
(diag_name: diag_color: {
name = "diagnostics";
extraConfig = { extraConfig = {
path = 1; # Relative path color.bg = diag_color;
symbols = { colored = false;
modified = ""; separator = { left = ""; right = ""; };
newfile = "󰻭"; sections = [ diag_name ];
readonly = "󰏯";
unnamed = "󱀶";
};
}; };
}
"location"];
lualine_x = [{
name = ''(next(vim.lsp.buf_get_clients()) == nil) and "󰒲 " or ""'';
extraConfig.separator = { left = ""; right = ""; };
}] ++ (lib.mapAttrsToList
(diag_name: diag_color: {
name = "diagnostics";
extraConfig = {
color.bg = diag_color;
colored = false;
separator = { left = ""; right = ""; };
sections = [ diag_name ];
};
})
{
error = base08;
warn = base0A;
hint = base0C;
info = base0B;
});
lualine_y = [{
name = "diff";
extraConfig = {
diff_color = {
added.fg = base0B;
modified.fg = base0A;
removed.fg = base08;
};
symbols = {
added = " ";
modified = " ";
removed = " ";
};
};
}
"branch"];
lualine_z = [
"filetype"
"fileformat"
"encoding"
];
};
theme = (lib.mapAttrs
(mode_name: mode_color: {
a = inverted;
b = inverted // { bg = mode_color; gui = "bold"; };
c = normal;
x = inverted;
y = normal;
z = inverted // { bg = mode_color; };
}) })
{ {
normal = base0D; error = base08;
insert = base0B; warn = base0A;
visual = base0F; hint = base0C;
replace = base08; info = base0B;
command = base0E; });
}) // { lualine_y = [{
inactive = { name = "diff";
a = inverted_ina; extraConfig = {
b = normal_ina // { bg = base00; gui = "bold"; }; diff_color = {
c = normal_ina; added.fg = base0B;
x = inverted_ina; modified.fg = base0A;
y = normal_ina; removed.fg = base08;
z = normal_ina // { bg = base00; }; };
symbols = {
added = " ";
modified = " ";
removed = " ";
};
}; };
}
"branch"];
lualine_z = [
"filetype"
"fileformat"
"encoding"
];
};
theme = (lib.mapAttrs
(mode_name: mode_color: {
a = inverted;
b = inverted // { bg = mode_color; gui = "bold"; };
c = normal;
x = inverted;
y = normal;
z = inverted // { bg = mode_color; };
})
{
normal = base0D;
insert = base0B;
visual = base0F;
replace = base08;
command = base0E;
}) // {
inactive = {
a = inverted_ina;
b = normal_ina // { bg = base00; gui = "bold"; };
c = normal_ina;
x = inverted_ina;
y = normal_ina;
z = normal_ina // { bg = base00; };
}; };
}; };
# Show context on top if scrolled out };
treesitter-context = { # Show context on top if scrolled out
enable = true; treesitter-context = {
maxLines = 5; enable = true;
}; maxLines = 5;
}; };
}; };
}; };