From 63cc96656f71a2f8a0e02605ad8545bc93a44559 Mon Sep 17 00:00:00 2001 From: moons-14 Date: Wed, 11 Mar 2026 19:54:09 +0900 Subject: [PATCH] nixvim: show active formatter in lualine, prefer biome when available Co-Authored-By: Claude Sonnet 4.6 --- .../home/nixvim/plugins/editor/conform.nix | 10 ++++---- modules/home/nixvim/plugins/ui/lualine.nix | 24 ++++++++++++++++++- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/modules/home/nixvim/plugins/editor/conform.nix b/modules/home/nixvim/plugins/editor/conform.nix index e451b4b..16f6e1e 100644 --- a/modules/home/nixvim/plugins/editor/conform.nix +++ b/modules/home/nixvim/plugins/editor/conform.nix @@ -3,11 +3,11 @@ enable = true; settings = { formatters_by_ft = { - javascript.__raw = ''{ "prettierd", "prettier", stop_after_first = true }''; - javascriptreact.__raw = ''{ "prettierd", "prettier", stop_after_first = true }''; - typescript.__raw = ''{ "prettierd", "prettier", stop_after_first = true }''; - typescriptreact.__raw = ''{ "prettierd", "prettier", stop_after_first = true }''; - json.__raw = ''{ "prettierd", "prettier", stop_after_first = true }''; + javascript.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; + javascriptreact.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; + typescript.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; + typescriptreact.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; + json.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; yaml.__raw = ''{ "prettierd", "prettier", stop_after_first = true }''; markdown.__raw = ''{ "prettierd", "prettier", stop_after_first = true }''; lua = ["stylua"]; diff --git a/modules/home/nixvim/plugins/ui/lualine.nix b/modules/home/nixvim/plugins/ui/lualine.nix index 35e7be2..328f3cf 100644 --- a/modules/home/nixvim/plugins/ui/lualine.nix +++ b/modules/home/nixvim/plugins/ui/lualine.nix @@ -1,3 +1,25 @@ {...}: { - programs.nixvim.plugins.lualine.enable = true; + programs.nixvim.plugins.lualine = { + enable = true; + settings.sections.lualine_x = [ + { + __raw = '' + function() + local ok, conform = pcall(require, "conform") + if not ok then return "" end + local formatters = conform.list_formatters(0) + for _, f in ipairs(formatters) do + if f.available then + return "󰛖 " .. f.name + end + end + return "" + end + ''; + } + "encoding" + "fileformat" + "filetype" + ]; + }; }