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

@ -1,15 +1,15 @@
{
autoGroups = {
highlight_yank = {};
vim_enter = {};
indentscope = {};
restore_cursor = {};
highlight_yank = { };
vim_enter = { };
indentscope = { };
restore_cursor = { };
};
autoCmd = [
{
group = "highlight_yank";
event = ["TextYankPost"];
event = [ "TextYankPost" ];
pattern = "*";
callback = {
__raw = ''
@ -21,7 +21,7 @@
}
{
group = "vim_enter";
event = ["VimEnter"];
event = [ "VimEnter" ];
pattern = "*";
callback = {
__raw = ''
@ -33,7 +33,7 @@
}
{
group = "indentscope";
event = ["FileType"];
event = [ "FileType" ];
pattern = [
"help"
"Startup"
@ -54,7 +54,7 @@
## from NVChad https://nvchad.com/docs/recipes (this autocmd will restore the cursor position when opening a file)
{
group = "restore_cursor";
event = ["BufReadPost"];
event = [ "BufReadPost" ];
pattern = "*";
callback = {
__raw = ''

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
{
plugins = {
indent-blankline = {
enable = true;
};
enable = true;
};
};
}

View file

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

View file

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

View file

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

View file

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

View file

@ -2,7 +2,8 @@
lib,
pkgs,
...
}: {
}:
{
config = {
extraConfigLuaPre =
# lua
@ -105,8 +106,8 @@
"black"
"isort"
];
lua = ["stylua"];
nix = ["nixfmt-rfc-style"];
lua = [ "stylua" ];
nix = [ "nixfmt-rfc-style" ];
markdown = [
[
"prettierd"
@ -119,15 +120,15 @@
"prettier"
]
];
terraform = ["terraform_fmt"];
bicep = ["bicep"];
terraform = [ "terraform_fmt" ];
bicep = [ "bicep" ];
bash = [
"shellcheck"
"shellharden"
"shfmt"
];
json = ["jq"];
"_" = ["trim_whitespace"];
json = [ "jq" ];
"_" = [ "trim_whitespace" ];
};
formatters = {

View file

@ -3,7 +3,7 @@
enable = true;
logger = {
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 = {
pollRate = 0; # How and when to poll for progress messages
@ -23,7 +23,7 @@
''
function(msg) return msg.lsp_client.name end
'';
ignore = []; # List of LSP servers to ignore
ignore = [ ]; # List of LSP servers to ignore
lsp = {
progressRingbufSize = 0; # Configure the nvim's LSP progress ring buffer size
};

View file

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

View file

@ -47,17 +47,17 @@
background = true;
};
virtual_text = {
errors = ["italic"];
hints = ["italic"];
information = ["italic"];
warnings = ["italic"];
ok = ["italic"];
errors = [ "italic" ];
hints = [ "italic" ];
information = [ "italic" ];
warnings = [ "italic" ];
ok = [ "italic" ];
};
underlines = {
errors = ["underline"];
hints = ["underline"];
information = ["underline"];
warnings = ["underline"];
errors = [ "underline" ];
hints = [ "underline" ];
information = [ "underline" ];
warnings = [ "underline" ];
};
};
};

View file

@ -9,7 +9,10 @@ _: {
"neo-tree"
];
disabledFiletypes = {
statusline = ["startup" "alpha"];
statusline = [
"startup"
"alpha"
];
};
theme = "catppuccin";
};
@ -37,7 +40,7 @@ _: {
lualine_c = [
{
__unkeyed-1 = "diagnostics";
sources = ["nvim_lsp"];
sources = [ "nvim_lsp" ];
symbols = {
error = " ";
warn = " ";

View file

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

View file

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

View file

@ -9,7 +9,7 @@
try_as_border = true;
};
};
surround = {};
surround = { };
};
};
}

View file

@ -12,7 +12,7 @@
subdir = "templates";
dateFormat = "%Y-%m-%d";
timeFormat = "%H:%M";
substitutions = {};
substitutions = { };
};
dailyNotes = {

View file

@ -12,51 +12,59 @@
};
};
outputs = {
nixpkgs,
nixvim,
flake-parts,
pre-commit-hooks,
...
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["aarch64-linux" "x86_64-linux" "aarch64-darwin" "x86_64-darwin"];
outputs =
{
nixpkgs,
nixvim,
flake-parts,
pre-commit-hooks,
...
}@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"aarch64-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
perSystem = {
system,
pkgs,
self',
lib,
...
}: let
nixvim' = nixvim.legacyPackages.${system};
nvim = nixvim'.makeNixvimWithModule {
inherit pkgs;
module = ./config;
};
in {
checks = {
default = pkgs.nixvimLib.check.mkTestDerivationFromNvim {
inherit nvim;
name = "A nixvim configuration";
perSystem =
{
system,
pkgs,
self',
lib,
...
}:
let
nixvim' = nixvim.legacyPackages.${system};
nvim = nixvim'.makeNixvimWithModule {
inherit pkgs;
module = ./config;
};
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
statix.enable = true;
nixfmt-rfc-style.enable = true;
in
{
checks = {
default = pkgs.nixvimLib.check.mkTestDerivationFromNvim {
inherit nvim;
name = "A nixvim configuration";
};
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
statix.enable = true;
nixfmt-rfc-style.enable = true;
};
};
};
formatter = pkgs.nixfmt-rfc-style;
packages.default = nvim;
devShells = {
default = with pkgs; mkShell { inherit (self'.checks.pre-commit-check) shellHook; };
};
};
formatter = pkgs.nixfmt-rfc-style;
packages.default = nvim;
devShells = {
default = with pkgs;
mkShell {inherit (self'.checks.pre-commit-check) shellHook;};
};
};
};
}