chore: switch to nixfmt-rfc-style

This commit is contained in:
Youwen Wu 2024-09-02 18:28:53 -07:00
parent 93a8dac2f2
commit 59189d88db
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
9 changed files with 113 additions and 65 deletions

View file

@ -1,5 +1,10 @@
{pkgs, ...}: { { pkgs, ... }:
imports = [./plugins ./keymaps.nix ./init.nix]; {
imports = [
./plugins
./keymaps.nix
./init.nix
];
viAlias = true; viAlias = true;
vimAlias = true; vimAlias = true;
withNodeJs = true; withNodeJs = true;

View file

@ -278,22 +278,34 @@
{ {
action = "<Plug>(YankyPutAfter)"; action = "<Plug>(YankyPutAfter)";
key = "p"; key = "p";
mode = ["n" "x"]; mode = [
"n"
"x"
];
} }
{ {
action = "<Plug>(YankyPutBefore)"; action = "<Plug>(YankyPutBefore)";
key = "P"; key = "P";
mode = ["n" "x"]; mode = [
"n"
"x"
];
} }
{ {
action = "<Plug>(YankyGPutAfter)"; action = "<Plug>(YankyGPutAfter)";
key = "gp"; key = "gp";
mode = ["n" "x"]; mode = [
"n"
"x"
];
} }
{ {
action = "<Plug>(YankyGPutBefore)"; action = "<Plug>(YankyGPutBefore)";
key = "gP"; key = "gP";
mode = ["n" "x"]; mode = [
"n"
"x"
];
} }
{ {
action = ":Telescope yank_history<CR>"; action = ":Telescope yank_history<CR>";

View file

@ -5,17 +5,27 @@
enable = true; enable = true;
settings = { settings = {
autoEnableSources = true; autoEnableSources = true;
experimental = {ghost_text = true;}; experimental = {
ghost_text = true;
};
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 = "nvim_lsp";} { name = "nvim_lsp"; }
{name = "emoji";} { name = "emoji"; }
{ {
name = "buffer"; # text within current buffer name = "buffer"; # text within current buffer
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
@ -33,8 +43,12 @@
]; ];
window = { window = {
completion = {border = "solid";}; completion = {
documentation = {border = "solid";}; border = "solid";
};
documentation = {
border = "solid";
};
}; };
mapping = { mapping = {

View file

@ -1,3 +1,13 @@
{ {
imports = [./lsps.nix ./setup.nix ./formatters.nix ./cmp.nix ./qol.nix ./mini.nix ./misc.nix ./navigation.nix ./treesitter.nix]; imports = [
./lsps.nix
./setup.nix
./formatters.nix
./cmp.nix
./qol.nix
./mini.nix
./misc.nix
./navigation.nix
./treesitter.nix
];
} }

View file

@ -1,5 +1,6 @@
# Code formatters # Code formatters
{pkgs, ...}: { { pkgs, ... }:
{
extraPackages = with pkgs; [ extraPackages = with pkgs; [
# TS/JS, Markdown, TOML, JSON, etc # TS/JS, Markdown, TOML, JSON, etc
nodePackages.prettier nodePackages.prettier
@ -31,21 +32,21 @@
lspFallback = true; lspFallback = true;
}; };
formatters_by_ft = { formatters_by_ft = {
lua = ["stylua"]; lua = [ "stylua" ];
python = ["black"]; python = [ "black" ];
nix = ["nixfmt"]; nix = [ "nixfmt" ];
svelte = ["prettier"]; svelte = [ "prettier" ];
rust = ["rustfmt"]; rust = [ "rustfmt" ];
haskell = ["fourmolu"]; haskell = [ "fourmolu" ];
toml = ["prettier"]; toml = [ "prettier" ];
json = ["prettier"]; json = [ "prettier" ];
markdown = ["prettier"]; markdown = [ "prettier" ];
yaml = ["prettier"]; yaml = [ "prettier" ];
html = ["prettier"]; html = [ "prettier" ];
javascript = ["prettier"]; javascript = [ "prettier" ];
typescript = ["prettier"]; typescript = [ "prettier" ];
# "*" = ["codespell"]; # "*" = ["codespell"];
"_" = ["trim_whitespace"]; "_" = [ "trim_whitespace" ];
}; };
}; };
}; };

View file

@ -1,5 +1,6 @@
# LSP setup # LSP setup
{pkgs, ...}: { { pkgs, ... }:
{
extraPackages = with pkgs; [ extraPackages = with pkgs; [
rust-analyzer rust-analyzer
lua-language-server lua-language-server

View file

@ -3,14 +3,14 @@
plugins.mini = { plugins.mini = {
enable = true; enable = true;
modules = { modules = {
surround = {}; surround = { };
ai = {}; ai = { };
hipatterns = {}; hipatterns = { };
notify = {}; notify = { };
tabline = {}; tabline = { };
trailspace = {}; trailspace = { };
cursorword = {}; cursorword = { };
bracketed = {}; bracketed = { };
}; };
}; };
} }

View file

@ -1,5 +1,6 @@
# Quality of life plugins # Quality of life plugins
{pkgs, ...}: { { pkgs, ... }:
{
extraPackages = with pkgs; [ extraPackages = with pkgs; [
ripgrep ripgrep
yazi yazi

View file

@ -8,12 +8,13 @@
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
}; };
outputs = { outputs =
{
nixvim, nixvim,
flake-parts, flake-parts,
... ...
} @ inputs: }@inputs:
flake-parts.lib.mkFlake {inherit inputs;} { flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ systems = [
"x86_64-linux" "x86_64-linux"
"aarch64-linux" "aarch64-linux"
@ -21,11 +22,13 @@
"aarch64-darwin" "aarch64-darwin"
]; ];
perSystem = { perSystem =
{
pkgs, pkgs,
system, system,
... ...
}: let }:
let
nixvimLib = nixvim.lib.${system}; nixvimLib = nixvim.lib.${system};
nixvim' = nixvim.legacyPackages.${system}; nixvim' = nixvim.legacyPackages.${system};
nixvimModule = { nixvimModule = {
@ -33,8 +36,9 @@
module = import ./config; module = import ./config;
}; };
nvim = nixvim'.makeNixvimWithModule nixvimModule; nvim = nixvim'.makeNixvimWithModule nixvimModule;
in { in
formatter = pkgs.alejandra; {
formatter = pkgs.nixfmt-rfc-style;
checks = { checks = {
default = nixvimLib.check.mkTestDerivationFromNixvimModule nixvimModule; default = nixvimLib.check.mkTestDerivationFromNixvimModule nixvimModule;
}; };