From d98afc2ee55c89102cd9f2a252776da0cd0a3ab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Sat, 2 Mar 2024 21:27:50 +0100 Subject: [PATCH] feat(nvim): Replace formatter with conform --- nvim/default.nix | 20 -------------------- nvim/mappings.nix | 7 +++++++ 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/nvim/default.nix b/nvim/default.nix index f3f6175..a7c550c 100644 --- a/nvim/default.nix +++ b/nvim/default.nix @@ -52,7 +52,6 @@ in nvim-web-devicons FTerm-nvim cmp-cmdline - formatter-nvim ]); # Formatting extraPackages = with pkgs; [ @@ -96,25 +95,6 @@ in -- require("dressing").setup() end - do -- Setup formatter.nvim - -- local util = require "formatter.util" - require("formatter").setup { - logging = true, - log_level = vim.log.levels.WARN, - ["*"] = { require("formatter.filetypes.any").remove_trailing_whitespace }, - -- Filetype Formatting - c = { require("formatter.filetypes.c").clangformat }, - sh = { require("formatter.filetypes.sh").shfmt }, - cpp = { require("formatter.filetypes.cpp").clangformat }, - lua = { require("formatter.filetypes.lua").stylua }, - nix = { require("formatter.filetypes.nix").nixpkgs_fmt }, - zig = { require("formatter.filetypes.zig").zigfmt }, - rust = { require("formatter.filetypes.rust").rustfmt }, - toml = { require("formatter.filetypes.toml").taplo }, - yaml = { require("formatter.filetypes.yaml").yamlfmt }, - } - end - do -- Setup idris2-nvim require("idris2").setup { } end diff --git a/nvim/mappings.nix b/nvim/mappings.nix index 1c1f4b1..ce92fe0 100644 --- a/nvim/mappings.nix +++ b/nvim/mappings.nix @@ -144,4 +144,11 @@ lua = true; options.desc = "Find Quickfix"; } + { + mode = "n"; + key = "w"; + action = "require'conform'.format"; + lua = true; + options.desc = "Format buffer"; + } ]