2024-02-08 11:40:29 +01:00
|
|
|
{ inputs, pkgs, config, lib, theme, ... }: {
|
2024-02-08 03:17:11 +01:00
|
|
|
imports = [
|
|
|
|
inputs.nixvim.homeManagerModules.nixvim
|
2024-02-08 11:44:03 +01:00
|
|
|
] ++ lib.optional (builtins.isString theme) ../../../stylix/${theme}/home-manager.nix;
|
2024-02-08 03:17:11 +01:00
|
|
|
|
|
|
|
programs.nixvim = {
|
|
|
|
enable = true;
|
2024-02-08 05:49:29 +01:00
|
|
|
viAlias = true;
|
|
|
|
vimAlias = true;
|
2024-02-08 06:23:38 +01:00
|
|
|
|
|
|
|
globals.mapleader = " ";
|
|
|
|
globals.maplocalleader = " ";
|
2024-02-08 06:23:59 +01:00
|
|
|
|
2024-02-08 06:32:46 +01:00
|
|
|
keymaps = let
|
|
|
|
map = mode: key: action: { mode = mode; key = key; action = action; };
|
|
|
|
nmap = key: action: map [ "n" ] key action;
|
|
|
|
nvmap = key: action: map [ "n" "v" ] key action;
|
|
|
|
imap = key: action: map [ "i" ] key action;
|
|
|
|
desc = d: { options.desc = d; };
|
|
|
|
silent = { options.silent = true; };
|
|
|
|
expr = { options.expr = true; };
|
2024-02-08 11:08:43 +01:00
|
|
|
in [
|
2024-02-08 06:32:46 +01:00
|
|
|
# Unmap keys that aren't useful, or that we want to use for different things
|
|
|
|
(nvmap "<Space>" "<Nop>" // silent)
|
|
|
|
(nvmap "<Cr>" "<Nop>" // silent)
|
|
|
|
(nvmap "s" "<Nop>" // silent)
|
|
|
|
# Leave insert mode by pressing j and k simultaneously
|
|
|
|
(imap "jk" "<Esc>")
|
|
|
|
(imap "kj" "<Esc>")
|
|
|
|
# Redo
|
|
|
|
(nmap "R" "<C-r>")
|
|
|
|
# Copy and paste
|
|
|
|
(nvmap "<leader>y" "\"+y" // desc "Cop[y] to clipboard")
|
|
|
|
(nvmap "<leader>p" "\"+p" // desc "[P]aste from clipboard")
|
|
|
|
# Jump to start/end of line
|
|
|
|
(nvmap "H" "0")
|
|
|
|
(nvmap "L" "$")
|
|
|
|
# Navigate up and down word wrapped text as if it were not word wrapped
|
|
|
|
(nmap "k" "v:count == 0 ? 'gk' : 'k'" // silent // expr)
|
|
|
|
(nmap "j" "v:count == 0 ? 'gj' : 'j'" // silent // expr)
|
|
|
|
# Center cursor when jumping foward or back
|
|
|
|
(nmap "<C-o>" "<C-o>zz")
|
|
|
|
(nmap "<C-i>" "<C-i>zz")
|
|
|
|
];
|
|
|
|
|
2024-02-08 03:17:11 +01:00
|
|
|
options = {
|
|
|
|
number = true;
|
|
|
|
shiftwidth = 2;
|
2024-02-08 06:26:53 +01:00
|
|
|
# Indent wrapped text.
|
|
|
|
breakindent = true;
|
|
|
|
colorcolumn = "100";
|
|
|
|
# This is the default value. `:help cot` to see the available options.
|
|
|
|
completeopt = "menu,preview";
|
|
|
|
cursorline = true;
|
2024-02-08 03:17:11 +01:00
|
|
|
};
|
2024-02-08 03:42:16 +01:00
|
|
|
plugins = {
|
|
|
|
treesitter.enable = true;
|
2024-02-08 05:17:04 +01:00
|
|
|
lualine.enable = true;
|
2024-02-08 03:42:16 +01:00
|
|
|
luasnip.enable = true;
|
2024-02-08 04:04:30 +01:00
|
|
|
nix.enable = true;
|
|
|
|
nix-develop.enable = true;
|
|
|
|
bufferline.enable = true;
|
2024-02-08 04:07:55 +01:00
|
|
|
which-key.enable = true;
|
2024-02-08 11:08:43 +01:00
|
|
|
intellitab.enable = true;
|
|
|
|
illuminate.enable = true;
|
2024-02-08 05:33:32 +01:00
|
|
|
neo-tree.enable = true;
|
2024-02-08 04:35:00 +01:00
|
|
|
gitsigns.enable = true;
|
|
|
|
toggleterm.enable = true;
|
2024-02-08 05:33:32 +01:00
|
|
|
rainbow-delimiters.enable = true;
|
2024-02-08 11:08:43 +01:00
|
|
|
fidget.enable = true;
|
|
|
|
|
|
|
|
git-worktree = {
|
|
|
|
enable = true;
|
|
|
|
enableTelescope = true;
|
|
|
|
};
|
2024-02-08 06:06:13 +01:00
|
|
|
|
|
|
|
telescope = {
|
|
|
|
enable = true;
|
2024-02-08 06:32:46 +01:00
|
|
|
extensions.frecency.enable = true;
|
|
|
|
extensions.fzf-native.enable = true;
|
|
|
|
keymaps = {
|
|
|
|
"<leader><leader>" = {
|
|
|
|
action = "find_files";
|
|
|
|
desc = "Search files by name";
|
|
|
|
};
|
2024-02-08 11:40:29 +01:00
|
|
|
"<leader>s" = {
|
2024-02-08 06:32:46 +01:00
|
|
|
action = "live_grep";
|
|
|
|
desc = "[S]earch by live grep";
|
|
|
|
};
|
2024-02-08 11:40:29 +01:00
|
|
|
"<leader>b" = {
|
2024-02-08 06:32:46 +01:00
|
|
|
action = "buffers";
|
|
|
|
desc = "[S]earch open [B]uffers by file name";
|
|
|
|
};
|
2024-02-08 11:40:29 +01:00
|
|
|
"<leader>h" = {
|
2024-02-08 06:32:46 +01:00
|
|
|
action = "help_tags";
|
|
|
|
desc = "[S]earch [H]elp";
|
|
|
|
};
|
2024-02-08 11:40:29 +01:00
|
|
|
"<leader>w" = {
|
2024-02-08 06:32:46 +01:00
|
|
|
action = "grep_string";
|
|
|
|
desc = "[S]earch for [W]ord under cursor";
|
|
|
|
};
|
2024-02-08 11:40:29 +01:00
|
|
|
"<leader>g" = {
|
2024-02-08 06:32:46 +01:00
|
|
|
action = "buffers";
|
|
|
|
desc = "[S]earch [G]it files";
|
|
|
|
};
|
2024-02-08 11:40:29 +01:00
|
|
|
"<leader>r" = {
|
2024-02-08 06:32:46 +01:00
|
|
|
action = "oldfiles";
|
|
|
|
desc = "[S]earch [R]ecently opened files by name";
|
|
|
|
};
|
2024-02-08 06:06:13 +01:00
|
|
|
};
|
|
|
|
};
|
2024-02-08 03:42:16 +01:00
|
|
|
|
|
|
|
lsp = {
|
|
|
|
enable = true;
|
|
|
|
servers = {
|
2024-02-08 03:44:30 +01:00
|
|
|
rust-analyzer = {
|
|
|
|
enable = true;
|
|
|
|
installCargo = true;
|
|
|
|
installRustc = true;
|
|
|
|
};
|
2024-02-08 04:04:30 +01:00
|
|
|
nixd.enable = true;
|
|
|
|
pylsp.enable = true;
|
|
|
|
html.enable = true;
|
|
|
|
cssls.enable = true;
|
|
|
|
bashls.enable = true;
|
2024-02-08 03:42:16 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
nvim-cmp = {
|
|
|
|
enable = true;
|
|
|
|
autoEnableSources = true;
|
|
|
|
sources = [
|
|
|
|
{ name = "nvim_lsp"; }
|
|
|
|
{ name = "path"; }
|
|
|
|
{ name = "buffer"; }
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
2024-02-08 04:20:38 +01:00
|
|
|
|
2024-02-08 06:06:13 +01:00
|
|
|
# TODO: Add this to stylix configs
|
2024-02-08 11:40:29 +01:00
|
|
|
# colorscheme = lib.mkForce "everforest";
|
|
|
|
colorscheme = lib.mkForce "catpuccin-mocha";
|
2024-02-08 06:06:13 +01:00
|
|
|
|
2024-02-08 03:17:11 +01:00
|
|
|
colorschemes = {
|
2024-02-08 06:06:13 +01:00
|
|
|
tokyonight.enable = true;
|
|
|
|
gruvbox.enable = true;
|
|
|
|
oxocarbon.enable = true;
|
|
|
|
nord.enable = true;
|
|
|
|
catppuccin.enable = true;
|
|
|
|
base16.enable = true;
|
|
|
|
kanagawa.enable = true;
|
|
|
|
dracula.enable = true;
|
2024-02-08 04:18:12 +01:00
|
|
|
|
2024-02-08 03:17:11 +01:00
|
|
|
};
|
2024-02-08 03:24:24 +01:00
|
|
|
extraPlugins = with pkgs.vimPlugins; [
|
2024-02-08 03:17:11 +01:00
|
|
|
everforest
|
|
|
|
];
|
|
|
|
};
|
2024-02-08 11:08:43 +01:00
|
|
|
}
|