nixvim: add diffview, gitsigns, which-key. re-enable treesitter. document some keymaps
All checks were successful
Flake check / flake-check (pull_request) Successful in 23s
Build tests / build-hosts (pull_request) Successful in 32s

This commit is contained in:
sid 2026-05-05 20:26:46 +02:00
parent bb811f4f16
commit b950eb138e
4 changed files with 162 additions and 143 deletions

View file

@ -3,14 +3,17 @@
{
imports = [
./cmp.nix
./diffview.nix
./lsp.nix
./gitsigns.nix
./lualine.nix
./telescope.nix
# ./treesitter.nix # HOTFIX: does not build
./treesitter.nix
./trouble.nix
];
config.programs.nixvim.plugins = {
which-key.enable = lib.mkDefault true;
markdown-preview.enable = lib.mkDefault true;
# warning: Nixvim: `plugins.web-devicons` was enabled automatically because the following plugins are enabled. This behaviour is deprecated. Please explicitly define `plugins.web-devicons.enable`
web-devicons.enable = true;

View file

@ -0,0 +1,59 @@
{ config, lib, ... }:
let
cfg = config.programs.nixvim;
plugin = cfg.plugins.diffview;
inherit (lib) mkDefault mkIf;
in
{
config = {
programs.nixvim = {
plugins.diffview = {
enable = mkDefault true;
};
# highlight = mkIf plugin.enable {
# DiffAdd = {
# bg = "#2d4a2d";
# fg = "NONE";
# };
# DiffDelete = {
# bg = "#4a2d2d";
# fg = "NONE";
# };
# DiffChange = {
# bg = "#2d3a4a";
# fg = "NONE";
# };
# DiffText = {
# bg = "#1a5a1a";
# fg = "NONE";
# };
# };
keymaps = mkIf plugin.enable [
{
mode = "n";
key = "<leader>gd";
action.__raw = ''
function()
local lib = require("diffview.lib")
local view = lib.get_current_view()
if view then
vim.cmd("DiffviewClose")
else
vim.cmd("DiffviewOpen")
end
end
'';
options = {
noremap = true;
silent = true;
desc = "toggle git diff";
};
}
];
};
};
}

View file

@ -0,0 +1,48 @@
{ config, lib, ... }:
let
cfg = config.programs.nixvim;
plugin = cfg.plugins.fugitive;
inherit (lib) mkDefault mkIf;
in
{
config = {
programs.nixvim = {
plugins.gitsigns = {
enable = mkDefault true;
settings = {
current_line_blame = mkDefault false;
current_line_blame_opts = mkDefault {
virt_text = mkDefault true;
virt_text_pos = mkDefault "eol";
};
signcolumn = mkDefault true;
signs = {
add = {
text = mkDefault "+";
};
change = {
text = mkDefault "";
};
changedelete = {
text = mkDefault "~";
};
delete = {
text = mkDefault "-";
};
topdelete = {
text = mkDefault "-";
};
untracked = {
text = mkDefault "?";
};
};
watch_gitdir = {
follow_files = mkDefault true;
};
};
};
};
};
}