dotfiles/config/nix/hm/vim.nix
Geoffrey Frogeye f16367105d
nix: More vim plugins
With broken things.
But debugging this with a half system, and not a very quick way of
rebuilding is not neat.
So let's postpone the fixes to after everything I could import easily is
imported, and maybe once I have a home-manager test env.
2023-10-29 19:37:02 +01:00

109 lines
3.5 KiB
Nix

{ pkgs, lib, ... }:
let
nixvim = import (builtins.fetchGit {
url = "https://github.com/nix-community/nixvim";
ref = "nixos-23.05";
});
in
{
imports = [
nixvim.homeManagerModules.nixvim
];
programs.nixvim = {
enable = true;
colorschemes.base16 = {
# FIXME Dynamic... or use stylix
enable = true;
colorscheme = "solarized-light";
};
plugins = {
# Catches attention when cursor changed position
# TODO Unmapped, do I still want to use it?
specs = {
enable = true;
min_jump = 5;
};
# Tabline
barbar.enable = true;
# Go to whatever
telescope = {
enable = true;
# FIXME Crashes nvim on startup, complaining about some keymap
# keymaps = {
# gF = "find_files";
# gf = "git_files";
# gB = "buffers";
# gl = "current_buffer_fuzzy_find";
# gL = "live_grep";
# gT = "tags";
# gt = "treesitter";
# gm = "marks";
# gh = "oldfiles";
# gH = "command_history";
# gS = "search_history";
# gC = "commands";
# gr = "lsp_references";
# ga = "lsp_code_actions";
# ge = "lsp_document_diagnostics";
# gE = "lsp_workspace_diagnostics";
# gd = "lsp_definitions";
# gs = "lsp_document_symbols";
# };
defaults = {
vimgrep_arguments = [
"${pkgs.ripgrep}/bin/rg"
"--color=never"
"--no-heading"
"--with-filename"
"--line-number"
"--column"
"--smart-case"
];
};
extensions.fzf-native = {
enable = true;
caseMode = "smart_case";
fuzzy = true;
overrideFileSorter = true;
overrideGenericSorter = true;
};
};
};
extraPlugins = with pkgs.vimPlugins; [
nvim-scrollview
# Status line
feline-nvim # TODO Abandonned. Maybe use lualine?
];
extraConfigLua = "${builtins.readFile ./vim/feline.lua}";
# 23.11: Use keymaps, seems better
maps = {
# barbar
normal."<C-H>" = { action = "<Cmd>BufferPrevious<CR>"; silent = true; };
normal."<C-L>" = { action = "<Cmd>BufferNext<CR>"; silent = true; };
# TODO https://www.reddit.com/r/neovim/comments/mbj8m5/how_to_setup_ctrlshiftkey_mappings_in_neovim_and/
normal."<Space><C-H>" = { action = "<Cmd>BufferMovePrevious<CR>"; silent = true; };
normal."<Space><C-L>" = { action = "<Cmd>BufferMoveNext<CR>"; silent = true; };
# TODO gotos don't work
normal."<C-1>" = { action = "<Cmd>BufferGoto 1<CR>"; silent = true; };
normal."<C-2>" = { action = "<Cmd>BufferGoto 2<CR>"; silent = true; };
normal."<C-3>" = { action = "<Cmd>BufferGoto 3<CR>"; silent = true; };
normal."<C-4>" = { action = "<Cmd>BufferGoto 4<CR>"; silent = true; };
normal."<C-5>" = { action = "<Cmd>BufferGoto 5<CR>"; silent = true; };
normal."<C-6>" = { action = "<Cmd>BufferGoto 6<CR>"; silent = true; };
normal."<C-7>" = { action = "<Cmd>BufferGoto 7<CR>"; silent = true; };
normal."<C-8>" = { action = "<Cmd>BufferGoto 8<CR>"; silent = true; };
normal."<C-9>" = { action = "<Cmd>BufferGoto 9<CR>"; silent = true; };
normal."<C-0>" = { action = "<Cmd>BufferLast<CR>"; silent = true; };
normal."gb" = { action = "<Cmd>BufferPick<CR>"; silent = true; };
# TODO Other useful options?
};
};
}