nix/home-manager/common/software/cli/nixvim/base.nix

271 lines
7.1 KiB
Nix
Raw Normal View History

2024-02-16 07:39:00 +01:00
{ inputs, pkgs, lib, theme, ... }: {
imports = [
2024-02-19 14:21:29 +01:00
./alpha.nix
2024-04-02 11:23:07 +02:00
./keymaps.nix
inputs.nixvim.homeManagerModules.nixvim
2024-03-18 03:45:39 +01:00
] ++ lib.optional (builtins.isString theme) ../../../../../stylix/themes/${theme}/home-manager/nixvim.nix;
2024-02-15 02:43:27 +01:00
# https://github.com/nix-community/nixvim
2024-02-15 11:34:17 +01:00
# Docs:
# https://nix-community.github.io/nixvim/
programs.nixvim = {
enable = true;
viAlias = true;
vimAlias = true;
2024-02-15 02:43:27 +01:00
globals.mapleader = " ";
globals.maplocalleader = " ";
2024-02-15 02:43:27 +01:00
options = {
number = true;
2024-02-18 13:41:10 +01:00
wrap = false;
2024-02-19 06:51:48 +01:00
cursorline = true;
cursorcolumn = true;
shiftwidth = 2;
breakindent = true;
2024-02-18 13:41:10 +01:00
colorcolumn = "100";
showmode = false;
2024-04-02 11:23:07 +02:00
termguicolors = true;
};
2024-02-16 07:39:00 +01:00
plugins = {
2024-04-01 06:20:09 +02:00
2024-04-01 05:38:00 +02:00
# Git related
# Gutter information for git modifications
gitsigns.enable = true;
# git plugin for vim
fugitive.enable = true;
# pretty stuff
# Rainbow matching {} [] () 's
rainbow-delimiters.enable = true;
# Colorize hex colors inline
nvim-colorizer.enable = true;
2024-04-02 14:09:00 +02:00
# Fancy popups, etc for vim
noice = {
enable = true;
popupmenu.enabled = true;
};
notify = {
enable = true;
topDown = true;
fps = 60;
stages = "slide";
};
2024-04-01 05:38:00 +02:00
# Nix related
# Nix language syntax highlighting / file type associations
nix.enable = true;
# Run nix develop / shell without exiting vim
nix-develop.enable = true;
# Efficiency
2024-02-16 11:13:19 +01:00
# Multicursor support
multicursors.enable = true;
# auto bracket completion
nvim-autopairs.enable = true;
2024-04-01 05:38:00 +02:00
# Indentation guides
indent-blankline.enable = true;
# Surround text blocks
surround.enable = true;
# Automatic indent
intellitab.enable = true;
# Code navigation
navbuddy.enable = true;
navbuddy.lsp.autoAttach = true;
# Layout Related
# winbar that uses nvim-navic in order to get LSP context from your language server.
barbecue.enable = true;
# tab bar like Firefox or Chrome
bufferline.enable = true;
# sidebar file browser
nvim-tree.enable = true;
# Terminal in vim
toggleterm.enable = true;
2024-04-01 05:38:00 +02:00
# Alerts / CodeActions
trouble.enable = true;
2024-04-01 05:38:00 +02:00
# Code Related
# Parser generator tool
treesitter.enable = true;
# Snippet engine for neovim
luasnip.enable = true;
cmp_luasnip.enable = true;
# CMP Addons
2024-04-02 04:19:43 +02:00
# cmp-buffer.enable = true;
# cmp-path.enable = true;
2024-04-01 15:22:06 +02:00
# cmp-nvim-lsp.enable = true;
2024-04-02 01:13:08 +02:00
# cmp-nvim-lsp-document-symbol.enable = true;
# cmp-nvim-lsp-signature-help.enable = true;
2024-04-01 05:38:00 +02:00
2024-02-17 09:46:00 +01:00
# List of linters for nixvim
lint = {
enable = true;
lintersByFt = {
text = ["vale"];
json = ["jsonlint"];
markdown = ["vale"];
rst = ["vale"];
ruby = ["ruby"];
janet = ["janet"];
inko = ["inko"];
clojure = ["clj-kondo"];
dockerfile = ["hadolint"];
terraform = ["tflint"];
yaml = ["yamllint"];
nix = ["nix"];
};
};
2024-02-16 10:56:48 +01:00
# Popup to show shortcuts
which-key = {
enable = true;
registrations = {
"<leader>b" = "Manage buffers...";
"<leader>c" = "Colorscheme...";
"<leader>g" = "Git Options...";
"<leader>l" = "LSP Options...";
2024-04-01 06:20:09 +02:00
"<leader>n" = "NvimTree / Noice...";
"<leader>t" = "Trouble...";
"<leader>T" = "ToggleTerm...";
"<leader>w" = "Manage Windows...";
"<leader>wo" = "Open New...";
"<leader>wr" = "Resize...";
2024-02-16 11:54:13 +01:00
"<leader>m" = "Multicursor...";
};
};
2024-02-15 02:43:27 +01:00
# Airline / Powerline alternative
lualine = {
enable = true;
componentSeparators = {
2024-02-16 08:58:28 +01:00
right = "«";
left = "»";
};
2024-02-19 04:17:22 +01:00
sectionSeparators = {
right = "";
left = "";
};
};
2024-02-15 02:43:27 +01:00
telescope = {
enable = true;
extensions.fzf-native.enable = true;
keymaps = {
"<leader><leader>" = {
action = "find_files";
desc = "Search files by name";
};
"<leader>s" = {
action = "live_grep";
desc = "Search by live grep";
};
"<leader>bl" = {
action = "buffers";
desc = "[L]list open [B]uffers";
};
"<leader>h" = {
action = "help_tags";
desc = "Search [H]elp";
};
"<leader>W" = {
action = "grep_string";
desc = "Search for [W]ord under cursor";
};
"<leader>gs" = {
action = "git_status";
desc = "Search [G]it [S]tatus";
};
"<leader>gl" = {
action = "git_commits";
desc = "View [G]it [L]ogs";
};
"<leader>r" = {
action = "oldfiles";
desc = "Search [R]ecently opened files by name";
};
"<leader>cs" = {
action = "colorscheme";
desc = "Change [C]olor[s]cheme";
};
2024-02-15 02:43:27 +01:00
};
};
2024-02-15 02:43:27 +01:00
nvim-cmp = {
enable = true;
autoEnableSources = true;
mapping = {
"<C-Space>" = "cmp.mapping.complete()";
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
"<C-e>" = "cmp.mapping.close()";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<CR>" = "cmp.mapping.confirm({ select = true })";
"<S-Tab>" = {
action = "cmp.mapping.select_prev_item()";
modes = [
"i"
"s"
];
};
"<Tab>" = {
action = "cmp.mapping.select_next_item()";
modes = [
"i"
"s"
];
};
2024-02-15 02:43:27 +01:00
};
sources = [
2024-04-02 04:19:43 +02:00
# { name = "nvim_lua"; }
2024-04-01 05:38:00 +02:00
{ name = "nvim_lsp"; }
{ name = "nvim_lsp_signature_help"; }
{ name = "calc"; }
{ name = "path"; }
{ name = "buffer"; }
{ name = "luasnip"; }
2024-02-15 02:43:27 +01:00
];
2024-04-01 05:38:00 +02:00
snippet.expand = "luasnip";
window = {
completion.border = "rounded";
documentation.border = "rounded";
};
formatting = {
fields = [ "menu" "abbr" "kind" ];
# https://rsdlt.github.io/posts/rust-nvim-ide-guide-walkthrough-development-debug/
format = ''
function(entry, item)
2024-04-02 04:19:43 +02:00
local menu_icon = {
2024-04-01 05:38:00 +02:00
nvim_lsp = 'λ',
luasnip = '',
buffer = 'Ω',
path = '🖫',
}
item.menu = menu_icon[entry.source.name]
return item
end,
'';
};
};
};
colorschemes = {
tokyonight.enable = true;
gruvbox.enable = true;
catppuccin.enable = true;
dracula.enable = true;
oxocarbon.enable = true;
2024-04-02 11:23:07 +02:00
ayu.enable = true;
kanagawa.enable = true;
2024-02-15 02:43:27 +01:00
};
2024-03-30 07:27:21 +01:00
extraPlugins = with pkgs.vimPlugins; [
everforest
2024-04-02 11:23:07 +02:00
onedark-nvim
rose-pine
];
};
2024-02-15 02:43:27 +01:00
}