Reformat all Nix files
This commit is contained in:
parent
9e0c1102a9
commit
355b63cf73
81 changed files with 2293 additions and 1153 deletions
|
@ -1,4 +1,9 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
# UPST
|
||||
vim-shot-f = pkgs.vimUtils.buildVimPlugin {
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
config = {
|
||||
# Completion
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
{ pkgs, lib, config, nixvimLib, ... }:
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
nixvimLib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
nv = nixvimLib.nixvim;
|
||||
in
|
||||
|
@ -6,37 +12,86 @@ in
|
|||
config = {
|
||||
programs = {
|
||||
# https://www.reddit.com/r/neovim/comments/mbj8m5/how_to_setup_ctrlshiftkey_mappings_in_neovim_and/
|
||||
alacritty.settings.keyboard.bindings = [
|
||||
{ key = "H"; mods = "Control|Shift"; chars = "\\u001b[72;5u"; }
|
||||
{ key = "L"; mods = "Control|Shift"; chars = "\\u001b[76;5u"; }
|
||||
] ++ (map
|
||||
(n: { key = "Key${builtins.toString n}"; mods = "Control"; chars = "\\u001b[${builtins.toString (48+n)};5u"; })
|
||||
(lib.lists.range 0 9));
|
||||
alacritty.settings.keyboard.bindings =
|
||||
[
|
||||
{
|
||||
key = "H";
|
||||
mods = "Control|Shift";
|
||||
chars = "\\u001b[72;5u";
|
||||
}
|
||||
{
|
||||
key = "L";
|
||||
mods = "Control|Shift";
|
||||
chars = "\\u001b[76;5u";
|
||||
}
|
||||
]
|
||||
++ (map (n: {
|
||||
key = "Key${builtins.toString n}";
|
||||
mods = "Control";
|
||||
chars = "\\u001b[${builtins.toString (48 + n)};5u";
|
||||
}) (lib.lists.range 0 9));
|
||||
# Ctrl+<number> doesn't get interpreted, but Ctrl+Shift+<number> does, so let's use that
|
||||
nixvim = {
|
||||
autoCmd = [
|
||||
# Turn off relativenumber only for insert mode
|
||||
{ event = "InsertEnter"; pattern = "*"; command = "set norelativenumber"; }
|
||||
{ event = "InsertLeave"; pattern = "*"; command = "set relativenumber"; }
|
||||
{
|
||||
event = "InsertEnter";
|
||||
pattern = "*";
|
||||
command = "set norelativenumber";
|
||||
}
|
||||
{
|
||||
event = "InsertLeave";
|
||||
pattern = "*";
|
||||
command = "set relativenumber";
|
||||
}
|
||||
];
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
nvim-scrollview # Scroll bar
|
||||
];
|
||||
keymaps =
|
||||
let
|
||||
options = { silent = true; };
|
||||
options = {
|
||||
silent = true;
|
||||
};
|
||||
in
|
||||
[
|
||||
# barbar
|
||||
{ key = "gb"; action = "<Cmd>BufferPick<CR>"; inherit options; }
|
||||
{ key = "<C-H>"; action = "<Cmd>BufferPrevious<CR>"; inherit options; }
|
||||
{ key = "<C-L>"; action = "<Cmd>BufferNext<CR>"; inherit options; }
|
||||
{ key = "<C-S-H>"; action = "<Cmd>BufferMovePrevious<CR>"; inherit options; }
|
||||
{ key = "<C-S-L>"; action = "<Cmd>BufferMoveNext<CR>"; inherit options; }
|
||||
{ key = "<C-0>"; action = "<Cmd>BufferLast<CR>"; inherit options; }
|
||||
] ++ (map
|
||||
(n: { key = "<C-${builtins.toString n}>"; action = "<Cmd>BufferGoto ${builtins.toString n}<CR>"; inherit options; })
|
||||
(lib.lists.range 1 9));
|
||||
{
|
||||
key = "gb";
|
||||
action = "<Cmd>BufferPick<CR>";
|
||||
inherit options;
|
||||
}
|
||||
{
|
||||
key = "<C-H>";
|
||||
action = "<Cmd>BufferPrevious<CR>";
|
||||
inherit options;
|
||||
}
|
||||
{
|
||||
key = "<C-L>";
|
||||
action = "<Cmd>BufferNext<CR>";
|
||||
inherit options;
|
||||
}
|
||||
{
|
||||
key = "<C-S-H>";
|
||||
action = "<Cmd>BufferMovePrevious<CR>";
|
||||
inherit options;
|
||||
}
|
||||
{
|
||||
key = "<C-S-L>";
|
||||
action = "<Cmd>BufferMoveNext<CR>";
|
||||
inherit options;
|
||||
}
|
||||
{
|
||||
key = "<C-0>";
|
||||
action = "<Cmd>BufferLast<CR>";
|
||||
inherit options;
|
||||
}
|
||||
]
|
||||
++ (map (n: {
|
||||
key = "<C-${builtins.toString n}>";
|
||||
action = "<Cmd>BufferGoto ${builtins.toString n}<CR>";
|
||||
inherit options;
|
||||
}) (lib.lists.range 1 9));
|
||||
opts = {
|
||||
showmode = false;
|
||||
number = true;
|
||||
|
@ -48,103 +103,154 @@ in
|
|||
barbar.enable = true;
|
||||
# TODO Reload make it use the preset colorscheme
|
||||
# Status line
|
||||
lualine = with config.lib.stylix.colors.withHashtag; let
|
||||
normal = { fg = base05; bg = base01; };
|
||||
inverted = { fg = base00; bg = base03; };
|
||||
normal_ina = { fg = base02; bg = base01; };
|
||||
inverted_ina = { fg = base00; bg = base02; };
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
settings = rec {
|
||||
inactive_sections = sections;
|
||||
sections = {
|
||||
lualine_a = [
|
||||
(nv.listToUnkeyedAttrs [ "string.format('%d', vim.fn.line('$'))" ])
|
||||
];
|
||||
lualine_b = [ "mode" ];
|
||||
lualine_c = [
|
||||
((nv.listToUnkeyedAttrs [ "filename" ]) // {
|
||||
color = nv.mkRaw ''
|
||||
function(section)
|
||||
return { fg = vim.bo.modified and '${base08}' or '${normal.fg}' }
|
||||
end
|
||||
'';
|
||||
path = 1; # Relative path
|
||||
symbols = {
|
||||
modified = "●";
|
||||
newfile = "";
|
||||
readonly = "";
|
||||
unnamed = "";
|
||||
};
|
||||
})
|
||||
"location"
|
||||
];
|
||||
lualine_x = [
|
||||
((nv.listToUnkeyedAttrs [ ''(next(vim.lsp.buf_get_clients()) == nil) and " " or ""'' ]) // {
|
||||
separator = { left = ""; right = ""; };
|
||||
})
|
||||
] ++ (lib.mapAttrsToList
|
||||
(diag_name: diag_color: ((nv.listToUnkeyedAttrs [ "diagnostics" ]) // {
|
||||
color.bg = diag_color;
|
||||
colored = false;
|
||||
separator = { left = ""; right = ""; };
|
||||
sections = [ diag_name ];
|
||||
}))
|
||||
{
|
||||
error = base08;
|
||||
warn = base0A;
|
||||
hint = base0C;
|
||||
info = base0B;
|
||||
});
|
||||
lualine_y = [
|
||||
((nv.listToUnkeyedAttrs [ "diff" ]) // {
|
||||
diff_color = {
|
||||
added.fg = base0B;
|
||||
modified.fg = base0A;
|
||||
removed.fg = base08;
|
||||
};
|
||||
symbols = {
|
||||
added = " ";
|
||||
modified = " ";
|
||||
removed = " ";
|
||||
};
|
||||
})
|
||||
"branch"
|
||||
];
|
||||
lualine_z = [
|
||||
"filetype"
|
||||
"fileformat"
|
||||
"encoding"
|
||||
];
|
||||
lualine =
|
||||
with config.lib.stylix.colors.withHashtag;
|
||||
let
|
||||
normal = {
|
||||
fg = base05;
|
||||
bg = base01;
|
||||
};
|
||||
options.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; };
|
||||
inverted = {
|
||||
fg = base00;
|
||||
bg = base03;
|
||||
};
|
||||
normal_ina = {
|
||||
fg = base02;
|
||||
bg = base01;
|
||||
};
|
||||
inverted_ina = {
|
||||
fg = base00;
|
||||
bg = base02;
|
||||
};
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
settings = rec {
|
||||
inactive_sections = sections;
|
||||
sections = {
|
||||
lualine_a = [
|
||||
(nv.listToUnkeyedAttrs [ "string.format('%d', vim.fn.line('$'))" ])
|
||||
];
|
||||
lualine_b = [ "mode" ];
|
||||
lualine_c = [
|
||||
(
|
||||
(nv.listToUnkeyedAttrs [ "filename" ])
|
||||
// {
|
||||
color = nv.mkRaw ''
|
||||
function(section)
|
||||
return { fg = vim.bo.modified and '${base08}' or '${normal.fg}' }
|
||||
end
|
||||
'';
|
||||
path = 1; # Relative path
|
||||
symbols = {
|
||||
modified = "●";
|
||||
newfile = "";
|
||||
readonly = "";
|
||||
unnamed = "";
|
||||
};
|
||||
}
|
||||
)
|
||||
"location"
|
||||
];
|
||||
lualine_x =
|
||||
[
|
||||
(
|
||||
(nv.listToUnkeyedAttrs [ ''(next(vim.lsp.buf_get_clients()) == nil) and " " or ""'' ])
|
||||
// {
|
||||
separator = {
|
||||
left = "";
|
||||
right = "";
|
||||
};
|
||||
}
|
||||
)
|
||||
]
|
||||
++ (lib.mapAttrsToList
|
||||
(
|
||||
diag_name: diag_color:
|
||||
(
|
||||
(nv.listToUnkeyedAttrs [ "diagnostics" ])
|
||||
// {
|
||||
color.bg = diag_color;
|
||||
colored = false;
|
||||
separator = {
|
||||
left = "";
|
||||
right = "";
|
||||
};
|
||||
sections = [ diag_name ];
|
||||
}
|
||||
)
|
||||
)
|
||||
{
|
||||
error = base08;
|
||||
warn = base0A;
|
||||
hint = base0C;
|
||||
info = base0B;
|
||||
}
|
||||
);
|
||||
lualine_y = [
|
||||
(
|
||||
(nv.listToUnkeyedAttrs [ "diff" ])
|
||||
// {
|
||||
diff_color = {
|
||||
added.fg = base0B;
|
||||
modified.fg = base0A;
|
||||
removed.fg = base08;
|
||||
};
|
||||
symbols = {
|
||||
added = " ";
|
||||
modified = " ";
|
||||
removed = " ";
|
||||
};
|
||||
}
|
||||
)
|
||||
"branch"
|
||||
];
|
||||
lualine_z = [
|
||||
"filetype"
|
||||
"fileformat"
|
||||
"encoding"
|
||||
];
|
||||
};
|
||||
options.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 = {
|
||||
enable = true;
|
||||
|
|
|
@ -1,12 +1,20 @@
|
|||
{ pkgs, lib, config, nixvim, ... }:
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
nixvim,
|
||||
...
|
||||
}:
|
||||
{
|
||||
# config = lib.mkIf config.programs.nixvim.enable { # Somehow this is infinite recursion?
|
||||
config = {
|
||||
home.sessionVariables = {
|
||||
EDITOR = "nvim";
|
||||
} // lib.optionalAttrs config.frogeye.desktop.xorg {
|
||||
VISUAL = "nvim";
|
||||
};
|
||||
home.sessionVariables =
|
||||
{
|
||||
EDITOR = "nvim";
|
||||
}
|
||||
// lib.optionalAttrs config.frogeye.desktop.xorg {
|
||||
VISUAL = "nvim";
|
||||
};
|
||||
programs.bash.shellAliases = {
|
||||
vi = "nvim";
|
||||
vim = "nvim";
|
||||
|
@ -84,20 +92,23 @@
|
|||
undotree.enable = true; # Navigate edition history
|
||||
|
||||
};
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
# Search/replace
|
||||
vim-abolish # Regex for words, with case in mind
|
||||
vim-easy-align # Aligning lines around a certain character
|
||||
extraPlugins =
|
||||
with pkgs.vimPlugins;
|
||||
[
|
||||
# Search/replace
|
||||
vim-abolish # Regex for words, with case in mind
|
||||
vim-easy-align # Aligning lines around a certain character
|
||||
|
||||
# Surrounding pairs
|
||||
targets-vim # Better interaction with surrounding pairs
|
||||
# Surrounding pairs
|
||||
targets-vim # Better interaction with surrounding pairs
|
||||
|
||||
# Language-specific
|
||||
tcomment_vim # Language-aware (un)commenting
|
||||
] ++ lib.optionals config.frogeye.dev.ansible [
|
||||
ansible-vim
|
||||
# Doesn't generate snippets, but those are for UltiSnip anyways
|
||||
];
|
||||
# Language-specific
|
||||
tcomment_vim # Language-aware (un)commenting
|
||||
]
|
||||
++ lib.optionals config.frogeye.dev.ansible [
|
||||
ansible-vim
|
||||
# Doesn't generate snippets, but those are for UltiSnip anyways
|
||||
];
|
||||
extraConfigLuaPre = lib.mkBefore ''
|
||||
-- If terminal is detected to be light, background will be changed after base16 theme is applied.
|
||||
-- Setting manually early to prevent hightlights having weird colors.
|
||||
|
@ -110,7 +121,9 @@
|
|||
'';
|
||||
|
||||
userCommands = {
|
||||
Reload = { command = "source ${config.xdg.configHome}/nvim/init.lua"; };
|
||||
Reload = {
|
||||
command = "source ${config.xdg.configHome}/nvim/init.lua";
|
||||
};
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
|
@ -118,24 +131,54 @@
|
|||
|
||||
# Allow saving of files as sudo when I forgot to start vim using sudo.
|
||||
# From https://stackoverflow.com/a/7078429
|
||||
{ mode = "c"; key = "w!!"; action = "w !sudo tee > /dev/null %"; }
|
||||
{
|
||||
mode = "c";
|
||||
key = "w!!";
|
||||
action = "w !sudo tee > /dev/null %";
|
||||
}
|
||||
|
||||
{ mode = "i"; key = "jk"; action = "<Esc>"; }
|
||||
{ mode = "v"; key = "<Enter>"; action = "<Esc>"; }
|
||||
{ key = "<Enter>"; action = "o<Esc>"; }
|
||||
{
|
||||
mode = "i";
|
||||
key = "jk";
|
||||
action = "<Esc>";
|
||||
}
|
||||
{
|
||||
mode = "v";
|
||||
key = "<Enter>";
|
||||
action = "<Esc>";
|
||||
}
|
||||
{
|
||||
key = "<Enter>";
|
||||
action = "o<Esc>";
|
||||
}
|
||||
|
||||
# { key = "<C-H>"; action = ":bp<CR>"; }
|
||||
# { key = "<C-L>"; action = ":bn<CR>"; }
|
||||
{ key = "<C-K>"; action = "kkkkkkkkkkkkkkkkkkkkk"; }
|
||||
{ key = "<C-J>"; action = "jjjjjjjjjjjjjjjjjjjjj"; }
|
||||
{
|
||||
key = "<C-K>";
|
||||
action = "kkkkkkkkkkkkkkkkkkkkk";
|
||||
}
|
||||
{
|
||||
key = "<C-J>";
|
||||
action = "jjjjjjjjjjjjjjjjjjjjj";
|
||||
}
|
||||
|
||||
# \s to replace globally the word under the cursor
|
||||
{ key = "<Leader>s"; action = ":%s/\\<<C-r><C-w>\\>/"; }
|
||||
{
|
||||
key = "<Leader>s";
|
||||
action = ":%s/\\<<C-r><C-w>\\>/";
|
||||
}
|
||||
|
||||
# PLUGINS
|
||||
|
||||
# undotree
|
||||
{ key = "<Space>u"; action = "<Cmd>UndotreeToggle<CR>"; options = { silent = true; }; }
|
||||
{
|
||||
key = "<Space>u";
|
||||
action = "<Cmd>UndotreeToggle<CR>";
|
||||
options = {
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
|
||||
];
|
||||
};
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
config = {
|
||||
programs.nixvim = {
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
config = {
|
||||
programs.nixvim = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue