Switch nix formatter again to nixfmt-rfc-style
This commit is contained in:
@@ -36,9 +36,6 @@
|
|||||||
# Your custom packages
|
# Your custom packages
|
||||||
# Accessible through 'nix build', 'nix shell', etc
|
# Accessible through 'nix build', 'nix shell', etc
|
||||||
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
|
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
|
||||||
# Formatter for your nix files, available through 'nix fmt'
|
|
||||||
# Other options beside 'alejandra' include 'nixpkgs-fmt'
|
|
||||||
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt);
|
|
||||||
|
|
||||||
# Your custom packages and modifications, exported as overlays
|
# Your custom packages and modifications, exported as overlays
|
||||||
overlays = import ./overlays {inherit inputs;};
|
overlays = import ./overlays {inherit inputs;};
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
imports = [
|
imports = [
|
||||||
./cmp.nix
|
./cmp.nix
|
||||||
./lsp.nix
|
./lsp.nix
|
||||||
|
./fmt.nix
|
||||||
./treesitter.nix
|
./treesitter.nix
|
||||||
./lualine.nix
|
./lualine.nix
|
||||||
./nvim-autopairs.nix
|
./nvim-autopairs.nix
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
stylua
|
||||||
|
nixfmt-rfc-style
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.nixvim = {
|
||||||
|
opts.formatexpr = "v:lua.require'conform'.formatexpr()";
|
||||||
|
|
||||||
|
plugins.conform-nvim = {
|
||||||
|
enable = true;
|
||||||
|
lazyLoad.enable = true;
|
||||||
|
lazyLoad.settings = {
|
||||||
|
event = "BufWritePre";
|
||||||
|
cmd = "ConformInfo";
|
||||||
|
keys = [
|
||||||
|
{
|
||||||
|
__unkeyed-1 = "<leader>f";
|
||||||
|
__unkeyed-2.__raw = ''
|
||||||
|
function() require 'conform'.format { async = true } end
|
||||||
|
'';
|
||||||
|
desc = "Format Buffer";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
settings = {
|
||||||
|
default_format_opts.lsp_format = "fallback";
|
||||||
|
format_on_save = ''
|
||||||
|
function(bufnr)
|
||||||
|
local disable_filetypes = { c = true, cpp = true }
|
||||||
|
local lsp_format_opt
|
||||||
|
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||||
|
lsp_format_opt = 'never'
|
||||||
|
else
|
||||||
|
lsp_format_opt = 'fallback'
|
||||||
|
end
|
||||||
|
return {
|
||||||
|
timeout_ms = 500,
|
||||||
|
lsp_format = lsp_format_opt,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
|
formatters_by_ft = {
|
||||||
|
lua = [ "stylua" ];
|
||||||
|
python = [ "black" ];
|
||||||
|
nix = [ "nixfmt" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -23,9 +23,6 @@
|
|||||||
pyright.enable = true;
|
pyright.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
lsp-format = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user