diff --git a/plugins/common/colorscheme.nix b/plugins/common/colorscheme.nix index 0cc9043..ce575b9 100644 --- a/plugins/common/colorscheme.nix +++ b/plugins/common/colorscheme.nix @@ -2,7 +2,7 @@ { colorschemes = { catppuccin = { - enable = true; + enable = false; settings = { integrations.native_lsp = { enabled = true; @@ -23,7 +23,7 @@ }; colorschemes.tokyonight = { - enable = false; + enable = true; settings = { style = "night"; transparent = config.myvim.transparent; diff --git a/plugins/lsp/conform.nix b/plugins/lsp/conform.nix index 7c0fb4a..2ec836e 100644 --- a/plugins/lsp/conform.nix +++ b/plugins/lsp/conform.nix @@ -8,13 +8,39 @@ default_format_opts.lsp_format = "prefer"; notify_on_error = true; - format_on_save = { - lsp_format = "prefer"; - }; + format_on_save = '' + function(bufnr) + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end - format_after_save = { - lsp_format = "prefer"; - }; + if slow_format_filetypes[vim.bo[bufnr].filetype] then + return + end + + local function on_format(err) + if err and err:match("timeout$") then + slow_format_filetypes[vim.bo[bufnr].filetype] = true + end + end + + return { timeout_ms = 200, lsp_fallback = true }, on_format + end + ''; + + 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 + ''; formatters_by_ft = { "_" = [