nicks-nix-config/modules/neovim.nix

145 lines
3.2 KiB
Nix
Raw Normal View History

2023-07-29 12:48:45 -07:00
{ pkgs, lib, ... }:
let
in
{
2023-08-05 09:30:37 -07:00
home.packages = with pkgs; [
# Required clipboard provider
xclip
];
2023-07-29 12:48:45 -07:00
programs.nixvim = {
enable = true;
2023-07-29 12:48:45 -07:00
viAlias = true;
vimAlias = true;
2023-07-29 16:01:53 -07:00
globals = {
mapleader = " ";
};
options = {
autoindent = true;
expandtab = true;
foldlevel=20;
guifont = "MesloLGS\ NF\ 10";
number = true;
shiftwidth = 4;
tabstop = 4;
};
# https://github.com/pupbrained/nix-config/blob/29af4835f21940af51b86313c451fb572a29874a/pkgs/nixvim.nix#L8
2023-08-05 08:47:54 -07:00
maps.normal = {
"<leader>ot" = "<cmd>vs | te<cr>";
2023-08-11 21:32:38 -07:00
"<leader>op" = "<cmd>NvimTreeToggle<cr>";
2023-08-05 08:47:54 -07:00
"<leader>o." = "<cmd>Telescope file_browser<cr>";
2023-08-11 10:12:15 -07:00
"<leader>." = "<cmd>Telescope find_files<cr>"; # cwd full sub-dir fuzzy find
2023-08-11 09:08:09 -07:00
"<leader>of" = "<cmd>Telescope live_grep<cr>"; # cwd search file
2023-08-20 17:46:12 -07:00
# keep cursor centered while navigating
"<C-d>" = "<C-d>zz";
"<C-u>" = "<C-u>zz";
"n" = "nzzzv";
"N" = "Nzzzv";
# yank to system clipboard
"<leader>y" = "\"+y";
"<leader>Y" = "\"+Y";
# perma-delete without putting on any clipboard
"<leader>d" = "\"_d";
};
maps.visual = {
# moves visual selection up and down lines
"J" = ":m '>+1<CR>gv=gv";
"K" = ":m '<-2<CR>gv=gv";
# copy to system clipboard
"<leader>y" = "\"+y";
# perma-delete without putting on any clipboard
"<leader>d" = "\"_d";
};
maps.visualOnly = {
"<leader>p" = "\"_dP"; # leader+p deletes the selection to null, then pastes
2023-08-05 08:47:54 -07:00
};
2023-07-29 16:01:53 -07:00
plugins = {
2023-08-11 09:08:09 -07:00
2023-08-05 08:47:54 -07:00
nvim-tree = {
enable = true;
openOnSetup = true;
};
2023-08-11 09:08:09 -07:00
nvim-autopairs = {
2023-08-05 08:47:54 -07:00
enable = true;
2023-08-11 09:08:09 -07:00
checkTs = true;
2023-08-05 08:47:54 -07:00
};
2023-07-29 16:01:53 -07:00
treesitter = {
enable = true;
folding = true;
indent = true;
ensureInstalled = [
"rust"
"toml"
"lua"
];
};
2023-09-09 18:26:47 -07:00
rainbow-delimiters.enable = true;
2023-07-29 16:01:53 -07:00
treesitter-refactor = {
enable = true;
#highlightCurrentScope.enable = true;
navigation.enable = true;
smartRename.enable = true;
};
comment-nvim = {
enable = true;
toggler = {
line = "<C-/>";
block = "<C-'>";
};
};
floaterm = {
enable = true;
position = "auto";
keymaps = {
toggle = "<leader>t";
};
};
2023-08-11 09:08:09 -07:00
telescope.enable = true;
2023-07-29 16:01:53 -07:00
rust-tools.enable = true;
nvim-cmp.enable = true;
cmp-nvim-lsp.enable = true;
# Read settings here: https://github.com/mfussenegger/nvim-dap#Usage
# See :help dap.txt, :help dap-mapping and :help dap-api.
cmp-dap.enable = true;
cmp-buffer.enable = true;
cmp-nvim-lsp-signature-help.enable = true;
cmp-nvim-lua.enable = true;
cmp-path.enable = true;
2023-08-11 09:08:09 -07:00
presence-nvim.enable = true;
2023-07-29 16:01:53 -07:00
nix.enable = true;
airline = {
enable = true;
powerline = true;
};
};
extraConfigLua = builtins.readFile ./../rsrcs/nvim.lua;
2023-07-29 12:48:45 -07:00
extraPlugins = with pkgs.vimPlugins;
2023-07-29 21:45:26 -07:00
[
2023-08-05 08:47:54 -07:00
telescope-file-browser-nvim
2023-07-29 21:45:26 -07:00
monokai-pro-nvim
2023-07-29 16:01:53 -07:00
nvim-lspconfig
2023-08-11 10:12:15 -07:00
vim-vsnip
2023-07-29 16:01:53 -07:00
hop-nvim
2023-07-29 21:45:26 -07:00
];
};
2023-07-29 12:48:45 -07:00
}