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 12:55:26 +01:00
|
|
|
] ++ lib.optional (builtins.isString theme) ../../../../stylix/${theme}/home-manager/nixvim.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 12:56:57 +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; };
|
|
|
|
in [
|
|
|
|
# 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";
|
2024-02-08 12:54:42 +01:00
|
|
|
showmode = false;
|
2024-02-08 03:17:11 +01:00
|
|
|
};
|
2024-02-08 03:42:16 +01:00
|
|
|
plugins = {
|
2024-02-08 12:43:21 +01:00
|
|
|
treesitter.enable = true;
|
|
|
|
lualine.enable = true;
|
2024-02-08 12:55:16 +01:00
|
|
|
luasnip.enable = true;
|
2024-02-08 12:43:21 +01:00
|
|
|
nix.enable = true;
|
|
|
|
nix-develop.enable = true;
|
|
|
|
bufferline.enable = true;
|
|
|
|
which-key.enable = true;
|
|
|
|
intellitab.enable = true;
|
2024-02-08 12:55:16 +01:00
|
|
|
illuminate.enable = true;
|
2024-02-08 12:43:21 +01:00
|
|
|
neo-tree.enable = true;
|
|
|
|
gitsigns.enable = true;
|
|
|
|
toggleterm.enable = true;
|
|
|
|
rainbow-delimiters.enable = true;
|
2024-02-08 06:06:13 +01:00
|
|
|
|
|
|
|
telescope = {
|
|
|
|
enable = true;
|
2024-02-08 06:32:46 +01:00
|
|
|
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";
|
2024-02-08 12:08:01 +01:00
|
|
|
desc = "Search by live grep";
|
2024-02-08 06:32:46 +01:00
|
|
|
};
|
2024-02-08 11:40:29 +01:00
|
|
|
"<leader>b" = {
|
2024-02-08 06:32:46 +01:00
|
|
|
action = "buffers";
|
2024-02-08 12:08:01 +01:00
|
|
|
desc = "Search open [B]uffers by file name";
|
2024-02-08 06:32:46 +01:00
|
|
|
};
|
2024-02-08 11:40:29 +01:00
|
|
|
"<leader>h" = {
|
2024-02-08 06:32:46 +01:00
|
|
|
action = "help_tags";
|
2024-02-08 12:08:01 +01:00
|
|
|
desc = "Search [H]elp";
|
2024-02-08 06:32:46 +01:00
|
|
|
};
|
2024-02-08 11:40:29 +01:00
|
|
|
"<leader>w" = {
|
2024-02-08 06:32:46 +01:00
|
|
|
action = "grep_string";
|
2024-02-08 12:08:01 +01:00
|
|
|
desc = "Search for [W]ord under cursor";
|
2024-02-08 06:32:46 +01:00
|
|
|
};
|
2024-02-08 11:40:29 +01:00
|
|
|
"<leader>g" = {
|
2024-02-08 06:32:46 +01:00
|
|
|
action = "buffers";
|
2024-02-08 12:08:01 +01:00
|
|
|
desc = "Search [G]it files";
|
2024-02-08 06:32:46 +01:00
|
|
|
};
|
2024-02-08 11:40:29 +01:00
|
|
|
"<leader>r" = {
|
2024-02-08 06:32:46 +01:00
|
|
|
action = "oldfiles";
|
2024-02-08 12:08:01 +01:00
|
|
|
desc = "Search [R]ecently opened files by name";
|
2024-02-08 06:32:46 +01:00
|
|
|
};
|
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
|
|
|
};
|
|
|
|
};
|
2024-02-08 12:51:55 +01:00
|
|
|
|
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 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;
|
|
|
|
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
|
|
|
}
|