From 77b1ef7a072954eb9b902b556e76e287dd58e119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sat, 18 Feb 2023 17:14:56 +0100 Subject: [PATCH] nvim: add formatters --- modules/programs/nvim/default.nix | 9 ++++++++- modules/programs/nvim/init.lua | 19 ++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/modules/programs/nvim/default.nix b/modules/programs/nvim/default.nix index 6a400f1..8a14ebc 100644 --- a/modules/programs/nvim/default.nix +++ b/modules/programs/nvim/default.nix @@ -42,9 +42,16 @@ in withPython3 = true; extraLuaConfig = builtins.readFile ./init.lua; extraPackages = with pkgs; [ - sumneko-lua-language-server + black + isort nil + nixpkgs-fmt + rustfmt + shfmt stylua + sumneko-lua-language-server + taplo + yamlfmt ]; plugins = with pkgs.vimPlugins; [ catppuccin-nvim diff --git a/modules/programs/nvim/init.lua b/modules/programs/nvim/init.lua index e4b557a..631cf51 100644 --- a/modules/programs/nvim/init.lua +++ b/modules/programs/nvim/init.lua @@ -192,7 +192,24 @@ require("formatter").setup({ -- "lua" filetype require("formatter.filetypes.lua").stylua, }, - + nix = { + require("formatter.filetypes.nix").nixpkgs_fmt, + }, + python = { + require("formatter.filetypes.python").black, + }, + rust = { + require("formatter.filetypes.rust").rustfmt, + }, + sh = { + require("formatter.filetypes.sh").shfmt, + }, + toml = { + require("formatter.filetypes.toml").taplo, + }, + yaml = { + require("formatter.filetypes.yaml").yamlfmt, + }, -- Use the special "*" filetype for defining formatter configurations on -- any filetype ["*"] = {