summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.nix2
-rw-r--r--lua/config/plugins/formatting.lua30
2 files changed, 18 insertions, 14 deletions
diff --git a/flake.nix b/flake.nix
index 762ae78..25c6e92 100644
--- a/flake.nix
+++ b/flake.nix
@@ -107,7 +107,7 @@
# this includes LSPs
lspsAndRuntimeDeps = {
general = with pkgs; {
- lua = [ lua-language-server ];
+ lua = [ lua-language-server stylua ];
nix = [ nix-doc nixd ];
};
};
diff --git a/lua/config/plugins/formatting.lua b/lua/config/plugins/formatting.lua
index 3291ea5..a451870 100644
--- a/lua/config/plugins/formatting.lua
+++ b/lua/config/plugins/formatting.lua
@@ -1,16 +1,20 @@
return {
- {
- "conform.nvim",
- event = "DeferredUIEnter",
- after = function(_)
- require("conform").setup()
+ {
+ "conform.nvim",
+ event = "DeferredUIEnter",
+ after = function(_)
+ require("conform").setup({
+ formatters_by_ft = {
+ lua = { "stylua" },
+ },
+ })
- vim.api.nvim_create_autocmd("BufWritePre", {
- pattern = "*",
- callback = function(args)
- require("conform").format({ bufnr = args.buf })
- end,
- })
- end,
- },
+ vim.api.nvim_create_autocmd("BufWritePre", {
+ pattern = "*",
+ callback = function(args)
+ require("conform").format({ bufnr = args.buf })
+ end,
+ })
+ end,
+ },
}