diff options
Diffstat (limited to 'nvim/lua/plugins/format.lua')
| -rw-r--r-- | nvim/lua/plugins/format.lua | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/nvim/lua/plugins/format.lua b/nvim/lua/plugins/format.lua index 2d6a55c..9010657 100644 --- a/nvim/lua/plugins/format.lua +++ b/nvim/lua/plugins/format.lua | |||
| @@ -1,12 +1,24 @@ | |||
| 1 | return { | 1 | return { |
| 2 | "stevearc/conform.nvim", | 2 | "stevearc/conform.nvim", |
| 3 | event = { "BufReadPre", "BufNewFile" }, | 3 | event = { "BufReadPre", "BufNewFile" }, |
| 4 | keys = { | ||
| 5 | { | ||
| 6 | "<leader>cf", | ||
| 7 | function() | ||
| 8 | require("conform").format({ | ||
| 9 | async = true, | ||
| 10 | lsp_fallback = true, | ||
| 11 | }) | ||
| 12 | end, | ||
| 13 | desc = "Format file", | ||
| 14 | }, | ||
| 15 | }, | ||
| 4 | opts = { | 16 | opts = { |
| 5 | formatters_by_ft = { | 17 | formatters_by_ft = { |
| 6 | sh = { "shfmt" }, -- brew install, pkg install shfmt | 18 | sh = { "shfmt" }, -- brew install, pkg install shfmt |
| 7 | bash = { "shfmt" }, | 19 | bash = { "shfmt" }, |
| 8 | python = { "ruff_format", "black" }, -- brew install ruff, pkg install ruff | 20 | python = { "ruff_format", "black" }, -- brew install ruff, pkg install ruff |
| 9 | lua = { "stylua" }, -- brew install stylua, pkg install stylua | 21 | lua = { "stylua" }, -- brew install stylua, pkg install stylua |
| 10 | typescript = { "prettierd", "prettier" }, | 22 | typescript = { "prettierd", "prettier" }, |
| 11 | javascript = { "prettierd", "prettier" }, | 23 | javascript = { "prettierd", "prettier" }, |
| 12 | json = { "jq" }, -- brew install jq, pkg install jq | 24 | json = { "jq" }, -- brew install jq, pkg install jq |
