treewide: format all files (#57)

Run `nix fmt` at the root of the repository to format all files. I've
done this on my fork and this will help me merge your changes later
without having to deal with un-formatted files.
This commit is contained in:
Wael Nasreddine 2024-11-26 00:47:49 -08:00 committed by GitHub
parent 70f8b2360f
commit 0f42b0eebb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 369 additions and 164 deletions

View file

@ -6,8 +6,15 @@
files."ftdetect/terraformft.lua".autoCmd = [ files."ftdetect/terraformft.lua".autoCmd = [
{ {
group = "filetypes"; group = "filetypes";
event = ["BufRead" "BufNewFile"]; event = [
pattern = ["*.tf" " *.tfvars" " *.hcl"]; "BufRead"
"BufNewFile"
];
pattern = [
"*.tf"
" *.tfvars"
" *.hcl"
];
command = "set ft=terraform"; command = "set ft=terraform";
} }
]; ];
@ -15,8 +22,14 @@
files."ftdetect/bicepft.lua".autoCmd = [ files."ftdetect/bicepft.lua".autoCmd = [
{ {
group = "filetypes"; group = "filetypes";
event = ["BufRead" "BufNewFile"]; event = [
pattern = ["*.bicep" "*.bicepparam"]; "BufRead"
"BufNewFile"
];
pattern = [
"*.bicep"
"*.bicepparam"
];
command = "set ft=bicep"; command = "set ft=bicep";
} }
]; ];

View file

@ -3,7 +3,10 @@
keymaps = [ keymaps = [
{ {
mode = ["n" "x"]; mode = [
"n"
"x"
];
key = "j"; key = "j";
action = "v:count == 0 ? 'gj' : 'j'"; action = "v:count == 0 ? 'gj' : 'j'";
options = { options = {
@ -12,7 +15,10 @@
}; };
} }
{ {
mode = ["n" "x"]; mode = [
"n"
"x"
];
key = "<Down>"; key = "<Down>";
action = "v:count == 0 ? 'gj' : 'j'"; action = "v:count == 0 ? 'gj' : 'j'";
options = { options = {
@ -21,7 +27,10 @@
}; };
} }
{ {
mode = ["n" "x"]; mode = [
"n"
"x"
];
key = "k"; key = "k";
action = "v:count == 0 ? 'gk' : 'k'"; action = "v:count == 0 ? 'gk' : 'k'";
options = { options = {
@ -30,7 +39,10 @@
}; };
} }
{ {
mode = ["n" "x"]; mode = [
"n"
"x"
];
key = "<Up>"; key = "<Up>";
action = "v:count == 0 ? 'gk' : 'k'"; action = "v:count == 0 ? 'gk' : 'k'";
options = { options = {
@ -78,61 +90,81 @@
mode = "n"; mode = "n";
key = "<C-Up>"; key = "<C-Up>";
action = "<cmd>resize +2<cr>"; action = "<cmd>resize +2<cr>";
options = {desc = "Increase Window Height";}; options = {
desc = "Increase Window Height";
};
} }
{ {
mode = "n"; mode = "n";
key = "<C-Down>"; key = "<C-Down>";
action = "<cmd>resize -2<cr>"; action = "<cmd>resize -2<cr>";
options = {desc = "Decrease Window Height";}; options = {
desc = "Decrease Window Height";
};
} }
{ {
mode = "n"; mode = "n";
key = "<C-Left>"; key = "<C-Left>";
action = "<cmd>vertical resize -2<cr>"; action = "<cmd>vertical resize -2<cr>";
options = {desc = "Decrease Window Width";}; options = {
desc = "Decrease Window Width";
};
} }
{ {
mode = "n"; mode = "n";
key = "<C-Right>"; key = "<C-Right>";
action = "<cmd>vertical resize +2<cr>"; action = "<cmd>vertical resize +2<cr>";
options = {desc = "Increase Window Width";}; options = {
desc = "Increase Window Width";
};
} }
{ {
mode = "n"; mode = "n";
key = "<A-j>"; key = "<A-j>";
action = "<cmd>m .+1<cr>=="; action = "<cmd>m .+1<cr>==";
options = {desc = "Move Down";}; options = {
desc = "Move Down";
};
} }
{ {
mode = "n"; mode = "n";
key = "<A-k>"; key = "<A-k>";
action = "<cmd>m .-2<cr>=="; action = "<cmd>m .-2<cr>==";
options = {desc = "Move Up";}; options = {
desc = "Move Up";
};
} }
{ {
mode = "i"; mode = "i";
key = "<A-j>"; key = "<A-j>";
action = "<esc><cmd>m .+1<cr>==gi"; action = "<esc><cmd>m .+1<cr>==gi";
options = {desc = "Move Down";}; options = {
desc = "Move Down";
};
} }
{ {
mode = "i"; mode = "i";
key = "<A-k>"; key = "<A-k>";
action = "<esc><cmd>m .-2<cr>==gi"; action = "<esc><cmd>m .-2<cr>==gi";
options = {desc = "Move Up";}; options = {
desc = "Move Up";
};
} }
{ {
mode = "v"; mode = "v";
key = "<A-j>"; key = "<A-j>";
action = ":m '>+1<cr>gv=gv"; action = ":m '>+1<cr>gv=gv";
options = {desc = "Move Down";}; options = {
desc = "Move Down";
};
} }
{ {
mode = "v"; mode = "v";
key = "<A-k>"; key = "<A-k>";
action = ":m '<-2<cr>gv=gv"; action = ":m '<-2<cr>gv=gv";
options = {desc = "Move Up";}; options = {
desc = "Move Up";
};
} }
{ {
mode = "i"; mode = "i";
@ -150,22 +182,36 @@
action = ";<c-g>u"; action = ";<c-g>u";
} }
{ {
mode = ["i" "x" "n" "s"]; mode = [
"i"
"x"
"n"
"s"
];
key = "<C-s>"; key = "<C-s>";
action = "<cmd>w<cr><esc>"; action = "<cmd>w<cr><esc>";
options = {desc = "Save File";}; options = {
desc = "Save File";
};
} }
{ {
mode = ["i" "n"]; mode = [
"i"
"n"
];
key = "<esc>"; key = "<esc>";
action = "<cmd>noh<cr><esc>"; action = "<cmd>noh<cr><esc>";
options = {desc = "Escape and Clear hlsearch";}; options = {
desc = "Escape and Clear hlsearch";
};
} }
{ {
mode = "n"; mode = "n";
key = "<leader>ur"; key = "<leader>ur";
action = "<Cmd>nohlsearch<Bar>diffupdate<Bar>normal! <C-L><CR>"; action = "<Cmd>nohlsearch<Bar>diffupdate<Bar>normal! <C-L><CR>";
options = {desc = "Redraw / Clear hlsearch / Diff Update";}; options = {
desc = "Redraw / Clear hlsearch / Diff Update";
};
} }
{ {
mode = "n"; mode = "n";
@ -225,91 +271,121 @@
mode = "n"; mode = "n";
key = "<leader>cd"; key = "<leader>cd";
action = "vim.diagnostic.open_float"; action = "vim.diagnostic.open_float";
options = {desc = "Line Diagnostics";}; options = {
desc = "Line Diagnostics";
};
} }
{ {
mode = "n"; mode = "n";
key = "]d"; key = "]d";
action = "diagnostic_goto(true)"; action = "diagnostic_goto(true)";
options = {desc = "Next Diagnostic";}; options = {
desc = "Next Diagnostic";
};
} }
{ {
mode = "n"; mode = "n";
key = "[d"; key = "[d";
action = "diagnostic_goto(false)"; action = "diagnostic_goto(false)";
options = {desc = "Prev Diagnostic";}; options = {
desc = "Prev Diagnostic";
};
} }
{ {
mode = "n"; mode = "n";
key = "]e"; key = "]e";
action = "diagnostic_goto(true 'ERROR')"; action = "diagnostic_goto(true 'ERROR')";
options = {desc = "Next Error";}; options = {
desc = "Next Error";
};
} }
{ {
mode = "n"; mode = "n";
key = "[e"; key = "[e";
action = "diagnostic_goto(false 'ERROR')"; action = "diagnostic_goto(false 'ERROR')";
options = {desc = "Prev Error";}; options = {
desc = "Prev Error";
};
} }
{ {
mode = "n"; mode = "n";
key = "]w"; key = "]w";
action = "diagnostic_goto(true 'WARN')"; action = "diagnostic_goto(true 'WARN')";
options = {desc = "Next Warning";}; options = {
desc = "Next Warning";
};
} }
{ {
mode = "n"; mode = "n";
key = "[w"; key = "[w";
action = "diagnostic_goto(false 'WARN')"; action = "diagnostic_goto(false 'WARN')";
options = {desc = "Prev Warning";}; options = {
desc = "Prev Warning";
};
} }
{ {
mode = "n"; mode = "n";
key = "<leader>qq"; key = "<leader>qq";
action = "<cmd>qa<cr>"; action = "<cmd>qa<cr>";
options = {desc = "Quit All";}; options = {
desc = "Quit All";
};
} }
{ {
mode = "n"; mode = "n";
key = "<leader>ui"; key = "<leader>ui";
action = "vim.show_pos"; action = "vim.show_pos";
options = {desc = "Inspect Pos";}; options = {
desc = "Inspect Pos";
};
} }
{ {
mode = "t"; mode = "t";
key = "<esc><esc>"; key = "<esc><esc>";
action = "<c-\\><c-n>"; action = "<c-\\><c-n>";
options = {desc = "Enter Normal Mode";}; options = {
desc = "Enter Normal Mode";
};
} }
{ {
mode = "t"; mode = "t";
key = "<C-h>"; key = "<C-h>";
action = "<cmd>wincmd h<cr>"; action = "<cmd>wincmd h<cr>";
options = {desc = "Go to Left Window";}; options = {
desc = "Go to Left Window";
};
} }
{ {
mode = "t"; mode = "t";
key = "<C-j>"; key = "<C-j>";
action = "<cmd>wincmd j<cr>"; action = "<cmd>wincmd j<cr>";
options = {desc = "Go to Lower Window";}; options = {
desc = "Go to Lower Window";
};
} }
{ {
mode = "t"; mode = "t";
key = "<C-k>"; key = "<C-k>";
action = "<cmd>wincmd k<cr>"; action = "<cmd>wincmd k<cr>";
options = {desc = "Go to Upper Window";}; options = {
desc = "Go to Upper Window";
};
} }
{ {
mode = "t"; mode = "t";
key = "<C-l>"; key = "<C-l>";
action = "<cmd>wincmd l<cr>"; action = "<cmd>wincmd l<cr>";
options = {desc = "Go to Right Window";}; options = {
desc = "Go to Right Window";
};
} }
{ {
mode = "t"; mode = "t";
key = "<C-/>"; key = "<C-/>";
action = "<cmd>close<cr>"; action = "<cmd>close<cr>";
options = {desc = "Hide Terminal";}; options = {
desc = "Hide Terminal";
};
} }
{ {
mode = "n"; mode = "n";
@ -369,37 +445,49 @@
mode = "n"; mode = "n";
key = "<leader><tab>l"; key = "<leader><tab>l";
action = "<cmd>tablast<cr>"; action = "<cmd>tablast<cr>";
options = {desc = "Last Tab";}; options = {
desc = "Last Tab";
};
} }
{ {
mode = "n"; mode = "n";
key = "<leader><tab>f"; key = "<leader><tab>f";
action = "<cmd>tabfirst<cr>"; action = "<cmd>tabfirst<cr>";
options = {desc = "First Tab";}; options = {
desc = "First Tab";
};
} }
{ {
mode = "n"; mode = "n";
key = "<leader><tab><tab>"; key = "<leader><tab><tab>";
action = "<cmd>tabnew<cr>"; action = "<cmd>tabnew<cr>";
options = {desc = "New Tab";}; options = {
desc = "New Tab";
};
} }
{ {
mode = "n"; mode = "n";
key = "<leader><tab>]"; key = "<leader><tab>]";
action = "<cmd>tabnext<cr>"; action = "<cmd>tabnext<cr>";
options = {desc = "Next Tab";}; options = {
desc = "Next Tab";
};
} }
{ {
mode = "n"; mode = "n";
key = "<leader><tab>d"; key = "<leader><tab>d";
action = "<cmd>tabclose<cr>"; action = "<cmd>tabclose<cr>";
options = {desc = "Close Tab";}; options = {
desc = "Close Tab";
};
} }
{ {
mode = "n"; mode = "n";
key = "<leader><tab>["; key = "<leader><tab>[";
action = "<cmd>tabprevious<cr>"; action = "<cmd>tabprevious<cr>";
options = {desc = "Previous Tab";}; options = {
desc = "Previous Tab";
};
} }
]; ];
} }

View file

@ -2,7 +2,10 @@
plugins.nvim-autopairs = { plugins.nvim-autopairs = {
enable = true; enable = true;
settings = { settings = {
disable_filetype = ["TelescopePrompt" "vim"]; disable_filetype = [
"TelescopePrompt"
"vim"
];
}; };
}; };
} }

View file

@ -4,8 +4,12 @@
}; };
plugins.copilot-lua = { plugins.copilot-lua = {
enable = true; enable = true;
suggestion = {enabled = false;}; suggestion = {
panel = {enabled = false;}; enabled = false;
};
panel = {
enabled = false;
};
}; };
extraConfigLua = '' extraConfigLua = ''

View file

@ -1,18 +1,30 @@
{ {
plugins = { plugins = {
cmp-emoji = {enable = true;}; cmp-emoji = {
enable = true;
};
cmp = { cmp = {
enable = true; enable = true;
settings = { settings = {
autoEnableSources = true; autoEnableSources = true;
experimental = {ghost_text = false;}; experimental = {
ghost_text = false;
};
performance = { performance = {
debounce = 60; debounce = 60;
fetchingTimeout = 200; fetchingTimeout = 200;
maxViewEntries = 30; maxViewEntries = 30;
}; };
snippet = {expand = "luasnip";}; snippet = {
formatting = {fields = ["kind" "abbr" "menu"];}; expand = "luasnip";
};
formatting = {
fields = [
"kind"
"abbr"
"menu"
];
};
sources = [ sources = [
{ name = "git"; } { name = "git"; }
{ name = "nvim_lsp"; } { name = "nvim_lsp"; }
@ -34,8 +46,12 @@
]; ];
window = { window = {
completion = {border = "solid";}; completion = {
documentation = {border = "solid";}; border = "solid";
};
documentation = {
border = "solid";
};
}; };
mapping = { mapping = {
@ -51,11 +67,21 @@
}; };
}; };
}; };
cmp-nvim-lsp = {enable = true;}; # lsp cmp-nvim-lsp = {
cmp-buffer = {enable = true;}; enable = true;
cmp-path = {enable = true;}; # file system paths }; # lsp
cmp_luasnip = {enable = true;}; # snippets cmp-buffer = {
cmp-cmdline = {enable = false;}; # autocomplete for cmdline enable = true;
};
cmp-path = {
enable = true;
}; # file system paths
cmp_luasnip = {
enable = true;
}; # snippets
cmp-cmdline = {
enable = false;
}; # autocomplete for cmdline
}; };
extraConfigLua = '' extraConfigLua = ''
luasnip = require("luasnip") luasnip = require("luasnip")

View file

@ -1,7 +1,12 @@
{ {
plugins.neo-tree = { plugins.neo-tree = {
enable = true; enable = true;
sources = ["filesystem" "buffers" "git_status" "document_symbols"]; sources = [
"filesystem"
"buffers"
"git_status"
"document_symbols"
];
addBlankLineAtTop = false; addBlankLineAtTop = false;
filesystem = { filesystem = {
@ -40,7 +45,9 @@
mode = [ "n" ]; mode = [ "n" ];
key = "<leader>e"; key = "<leader>e";
action = "<cmd>Neotree toggle<cr>"; action = "<cmd>Neotree toggle<cr>";
options = {desc = "Open/Close Neotree";}; options = {
desc = "Open/Close Neotree";
};
} }
]; ];
} }

View file

@ -3,11 +3,28 @@ _: {
enable = true; enable = true;
settings = { settings = {
colors = { colors = {
error = ["DiagnosticError" "ErrorMsg" "#ED8796"]; error = [
warning = ["DiagnosticWarn" "WarningMsg" "#EED49F"]; "DiagnosticError"
info = ["DiagnosticInfo" "#EED49F"]; "ErrorMsg"
default = ["Identifier" "#F5A97F"]; "#ED8796"
test = ["Identifier" "#8AADF4"]; ];
warning = [
"DiagnosticWarn"
"WarningMsg"
"#EED49F"
];
info = [
"DiagnosticInfo"
"#EED49F"
];
default = [
"Identifier"
"#F5A97F"
];
test = [
"Identifier"
"#8AADF4"
];
}; };
}; };
}; };

View file

@ -1,4 +1,5 @@
{pkgs, ...}: { { pkgs, ... }:
{
plugins.treesitter = { plugins.treesitter = {
enable = true; enable = true;
settings = { settings = {

View file

@ -1,4 +1,5 @@
{pkgs, ...}: { { pkgs, ... }:
{
extraPlugins = with pkgs.vimPlugins; [ extraPlugins = with pkgs.vimPlugins; [
lazygit-nvim lazygit-nvim
]; ];

View file

@ -2,7 +2,8 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }:
{
config = { config = {
extraConfigLuaPre = extraConfigLuaPre =
# lua # lua

View file

@ -3,7 +3,7 @@
enable = true; enable = true;
logger = { logger = {
level = "warn"; # “off”, “error”, “warn”, “info”, “debug”, “trace” level = "warn"; # “off”, “error”, “warn”, “info”, “debug”, “trace”
floatPrecision = 0.01; # Limit the number of decimals displayed for floats floatPrecision = 1.0e-2; # Limit the number of decimals displayed for floats
}; };
progress = { progress = {
pollRate = 0; # How and when to poll for progress messages pollRate = 0; # How and when to poll for progress messages

View file

@ -1,22 +1,49 @@
{pkgs, ...}: { { pkgs, ... }:
{
plugins = { plugins = {
lsp-lines = {enable = true;}; lsp-lines = {
lsp-format = {enable = true;}; enable = true;
helm = {enable = true;}; };
lsp-format = {
enable = true;
};
helm = {
enable = true;
};
lsp = { lsp = {
enable = true; enable = true;
inlayHints = true; inlayHints = true;
servers = { servers = {
html = {enable = true;}; html = {
lua_ls = {enable = true;}; enable = true;
nil_ls = {enable = true;}; };
ts_ls = {enable = true;}; lua_ls = {
marksman = {enable = true;}; enable = true;
pyright = {enable = true;}; };
gopls = {enable = true;}; nil_ls = {
terraformls = {enable = true;}; enable = true;
ansiblels = {enable = true;}; };
jsonls = {enable = true;}; ts_ls = {
enable = true;
};
marksman = {
enable = true;
};
pyright = {
enable = true;
};
gopls = {
enable = true;
};
terraformls = {
enable = true;
};
ansiblels = {
enable = true;
};
jsonls = {
enable = true;
};
helm_ls = { helm_ls = {
enable = true; enable = true;
extraOptions = { extraOptions = {

View file

@ -9,7 +9,10 @@ _: {
"neo-tree" "neo-tree"
]; ];
disabledFiletypes = { disabledFiletypes = {
statusline = ["startup" "alpha"]; statusline = [
"startup"
"alpha"
];
}; };
theme = "catppuccin"; theme = "catppuccin";
}; };

View file

@ -74,7 +74,10 @@
}; };
options = { options = {
paddings = [1 3]; paddings = [
1
3
];
}; };
parts = [ parts = [

View file

@ -1,4 +1,7 @@
{pkgs, ...}: { { pkgs, ... }:
extraPlugins = with pkgs.vimPlugins; [ {
extraPlugins =
with pkgs.vimPlugins;
[
]; ];
} }

View file

@ -12,7 +12,8 @@
}; };
}; };
outputs = { outputs =
{
nixpkgs, nixpkgs,
nixvim, nixvim,
flake-parts, flake-parts,
@ -20,21 +21,29 @@
... ...
}@inputs: }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } { flake-parts.lib.mkFlake { inherit inputs; } {
systems = ["aarch64-linux" "x86_64-linux" "aarch64-darwin" "x86_64-darwin"]; systems = [
"aarch64-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
perSystem = { perSystem =
{
system, system,
pkgs, pkgs,
self', self',
lib, lib,
... ...
}: let }:
let
nixvim' = nixvim.legacyPackages.${system}; nixvim' = nixvim.legacyPackages.${system};
nvim = nixvim'.makeNixvimWithModule { nvim = nixvim'.makeNixvimWithModule {
inherit pkgs; inherit pkgs;
module = ./config; module = ./config;
}; };
in { in
{
checks = { checks = {
default = pkgs.nixvimLib.check.mkTestDerivationFromNvim { default = pkgs.nixvimLib.check.mkTestDerivationFromNvim {
inherit nvim; inherit nvim;
@ -54,8 +63,7 @@
packages.default = nvim; packages.default = nvim;
devShells = { devShells = {
default = with pkgs; default = with pkgs; mkShell { inherit (self'.checks.pre-commit-check) shellHook; };
mkShell {inherit (self'.checks.pre-commit-check) shellHook;};
}; };
}; };
}; };