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

254 lines
6.5 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
2024-04-03 13:07:58 +02:00
./cmp.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
2024-06-12 12:15:32 +02:00
opts = {
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
2024-04-04 14:22:50 +02:00
extraConfigLuaPost = ''
vim.opt.shell = '/run/current-system/sw/bin/bash'
'';
plugins = {
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
2024-04-03 09:27:54 +02:00
# Fancify markdown et al
2024-06-12 12:15:32 +02:00
headlines.enable = true;
2024-04-01 05:38:00 +02:00
# 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;
2024-04-03 13:07:58 +02:00
popupmenu.enabled = false;
2024-04-03 09:27:54 +02:00
lsp.hover.enabled = false;
2024-04-03 13:41:32 +02:00
presets = {
2024-04-03 15:12:09 +02:00
bottom_search = true;
command_palette = true;
2024-04-03 13:41:32 +02:00
long_message_to_split = false;
inc_rename = false;
lsp_doc_border = true;
};
2024-04-02 14:09:00 +02:00
};
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
2024-04-03 01:28:13 +02:00
bufferline = {
enable = true;
2024-04-03 09:27:54 +02:00
hover.enabled = true;
separatorStyle = "slant";
2024-04-03 01:28:13 +02:00
offsets = [{
filetype = "NvimTree";
text = "File Explorer";
highlight = "EcovimNvimTreeTitle";
text_align = "center";
separator = true;
}];
};
# sidebar file browser
2024-04-03 01:28:13 +02:00
nvim-tree = {
enable = true;
diagnostics.enable = true;
2024-04-03 09:27:54 +02:00
tab.sync.close = true;
2024-04-03 01:28:13 +02:00
renderer = {
highlightModified = "icon";
highlightOpenedFiles = "all";
indentMarkers.enable = true;
};
};
# Terminal in vim
toggleterm.enable = true;
2024-04-01 05:38:00 +02:00
# Alerts / CodeActions
2024-04-03 01:28:13 +02:00
trouble = {
enable = true;
# TODO Re-enable on 24.05
# settings = {
# auto_close = true;
# auto_open = true;
# cycle_results = false;
# height = 14;
# win_config = {
# border = "rounded";
# };
# };
};
2024-04-01 05:38:00 +02:00
# Code Related
# Parser generator tool
treesitter.enable = true;
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;
2024-04-03 01:28:13 +02:00
window.border = "rounded";
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";
2024-06-12 12:15:32 +02:00
options.desc = "Search files by name";
};
"<leader>s" = {
action = "live_grep";
2024-06-12 12:15:32 +02:00
options.desc = "Search by live grep";
};
"<leader>bl" = {
action = "buffers";
2024-06-12 12:15:32 +02:00
options.desc = "[L]list open [B]uffers";
};
"<leader>h" = {
action = "help_tags";
2024-06-12 12:15:32 +02:00
options.desc = "Search [H]elp";
};
"<leader>W" = {
action = "grep_string";
2024-06-12 12:15:32 +02:00
options.desc = "Search for [W]ord under cursor";
};
"<leader>gs" = {
action = "git_status";
2024-06-12 12:15:32 +02:00
options.desc = "Search [G]it [S]tatus";
};
"<leader>gl" = {
action = "git_commits";
2024-06-12 12:15:32 +02:00
options.desc = "View [G]it [L]ogs";
};
"<leader>r" = {
action = "oldfiles";
2024-06-12 12:15:32 +02:00
options.desc = "Search [R]ecently opened files by name";
};
"<leader>cs" = {
action = "colorscheme";
2024-06-12 12:15:32 +02:00
options.desc = "Change [C]olor[s]cheme";
};
2024-02-15 02:43:27 +01:00
};
};
2024-04-03 13:07:58 +02:00
};
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-04-04 14:22:50 +02:00
rust-vim
];
};
2024-02-15 02:43:27 +01:00
}