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)
|
|
|
|
# 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-10 02:13:46 +01:00
|
|
|
|
2024-02-09 13:19:35 +01:00
|
|
|
# Insert Mode
|
2024-02-10 02:13:46 +01:00
|
|
|
|
2024-02-12 04:54:48 +01:00
|
|
|
# Normal Mode
|
2024-02-13 03:01:32 +01:00
|
|
|
(nmap "<leader>ns" ":Neotree selector<C-r>"// desc "[S]elect neotree")
|
|
|
|
(nmap "<leader>nt" ":Neotree toggle<C-r>" // desc "[T]oggle neotree")
|
|
|
|
(nmap "<leader>nc" ":Neotree close<C-r>" // desc "[C]lose neotree")
|
|
|
|
(nmap "<leader>nb" ":Neotree buffers<C-r>" // desc "Open [b]uffers")
|
2024-02-08 12:56:57 +01:00
|
|
|
];
|
|
|
|
|
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-13 03:01:32 +01:00
|
|
|
# Parser generator tool
|
2024-02-08 12:43:21 +01:00
|
|
|
treesitter.enable = true;
|
2024-02-13 03:01:32 +01:00
|
|
|
# Airline / Powerline alternative
|
2024-02-08 12:43:21 +01:00
|
|
|
lualine.enable = true;
|
2024-02-13 03:01:32 +01:00
|
|
|
# Snippet engine for neovim
|
2024-02-08 12:55:16 +01:00
|
|
|
luasnip.enable = true;
|
2024-02-13 03:01:32 +01:00
|
|
|
# Nix language syntax highlighting / file type associations
|
2024-02-08 12:43:21 +01:00
|
|
|
nix.enable = true;
|
2024-02-13 03:01:32 +01:00
|
|
|
# Run nix develop / shell without exiting vim
|
2024-02-08 12:43:21 +01:00
|
|
|
nix-develop.enable = true;
|
2024-02-13 03:01:32 +01:00
|
|
|
# tab bar like Firefox or Chrome
|
2024-02-08 12:43:21 +01:00
|
|
|
bufferline.enable = true;
|
2024-02-13 03:01:32 +01:00
|
|
|
# Popup to show shortcuts
|
2024-02-08 12:43:21 +01:00
|
|
|
which-key.enable = true;
|
2024-02-13 03:01:32 +01:00
|
|
|
# Automatic indent
|
2024-02-08 12:43:21 +01:00
|
|
|
intellitab.enable = true;
|
2024-02-13 03:01:32 +01:00
|
|
|
# Highlight all entries of the currently selected word
|
2024-02-08 12:55:16 +01:00
|
|
|
illuminate.enable = true;
|
2024-02-13 03:01:32 +01:00
|
|
|
# sidebar file browser
|
|
|
|
nvim-tree.enable = true;
|
|
|
|
# Gutter information for git modifications
|
2024-02-08 12:43:21 +01:00
|
|
|
gitsigns.enable = true;
|
2024-02-13 03:01:32 +01:00
|
|
|
# Terminal in vim
|
2024-02-08 12:43:21 +01:00
|
|
|
toggleterm.enable = true;
|
2024-02-13 03:01:32 +01:00
|
|
|
# Rainbow matching {} [] () 's
|
2024-02-08 12:43:21 +01:00
|
|
|
rainbow-delimiters.enable = true;
|
2024-02-13 03:01:32 +01:00
|
|
|
# Colorize hex colors inline
|
|
|
|
nvim-colorizer.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 = [
|
2024-02-09 13:19:35 +01:00
|
|
|
{ name = "nvim_lua"; }
|
2024-02-08 03:42:16 +01:00
|
|
|
{ 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
|
|
|
}
|