From 90a9302a0a028b9359a3c49e56841bff58c72ab6 Mon Sep 17 00:00:00 2001 From: xinyangli Date: Mon, 14 Oct 2024 11:56:12 +0800 Subject: [PATCH] fix: conform-nvim option change --- README.md | 21 +++++---------------- config/lsp/conform.nix | 23 +++++++++++++++-------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index bff36b7..58b7a33 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,6 @@ -# Nixvim template +# Nixvim -This template gives you a good starting point for configuring nixvim standalone. - -## Configuring - -To start configuring, just add or modify the nix files in `./config`. -If you add a new configuration file, remember to add it to the -[`config/default.nix`](./config/default.nix) file - -## Testing your new configuration - -To test your configuration simply run the following command - -``` -nix run . -``` +## TODO +[ ] Open last active buffer after :bd +[ ] Code action +[ ] DAP support diff --git a/config/lsp/conform.nix b/config/lsp/conform.nix index 4a459b6..c54bb5f 100644 --- a/config/lsp/conform.nix +++ b/config/lsp/conform.nix @@ -1,14 +1,21 @@ -{ helpers, pkgs, ... }: { +{ helpers, pkgs, ... }: +{ plugins.conform-nvim = { enable = true; - formatAfterSave = '' - { - format_after_save = { - lsp_format = "fallback", - }, - } + format_after_save = '' + function(bufnr) + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + + if not slow_format_filetypes[vim.bo[bufnr].filetype] then + return + end + + return { lsp_fallback = true } + end ''; - formattersByFt = { + formatters_by_ft = { python = [ "black" ]; c = [ "clang-format" ]; cpp = [ "clang-format" ];