Update to (somewhat?) dendritic pattern
Heavily inspired by https://github.com/Doc-Steve/dendritic-design-with-flake-parts. > Atomic commits? Never heard of them!
This commit is contained in:
19
modules/programs/nixvim/_nixvim-config/default.nix
Normal file
19
modules/programs/nixvim/_nixvim-config/default.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{ ... }: {
|
||||
imports = [
|
||||
./keymaps.nix
|
||||
./options.nix
|
||||
./plugins
|
||||
];
|
||||
|
||||
clipboard.register = "unnamedplus";
|
||||
|
||||
colorschemes.catppuccin = {
|
||||
enable = true;
|
||||
settings.flavour = "mocha";
|
||||
settings.integrations = {
|
||||
gitsigns = true;
|
||||
treesitter = true;
|
||||
cmp = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
25
modules/programs/nixvim/_nixvim-config/keymaps.nix
Normal file
25
modules/programs/nixvim/_nixvim-config/keymaps.nix
Normal file
@@ -0,0 +1,25 @@
|
||||
{ ... }: {
|
||||
globals.mapleader = " ";
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
key = "<esc>";
|
||||
action = ":noh<CR>";
|
||||
mode = "n";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Clear search highlight";
|
||||
};
|
||||
}
|
||||
{
|
||||
key = "j";
|
||||
action = "gj";
|
||||
mode = "n";
|
||||
}
|
||||
{
|
||||
key = "k";
|
||||
action = "gk";
|
||||
mode = "n";
|
||||
}
|
||||
];
|
||||
}
|
||||
50
modules/programs/nixvim/_nixvim-config/options.nix
Normal file
50
modules/programs/nixvim/_nixvim-config/options.nix
Normal file
@@ -0,0 +1,50 @@
|
||||
{ ... }: {
|
||||
opts = {
|
||||
# Expand tabs to 4 spaces
|
||||
shiftwidth = 4;
|
||||
softtabstop = 4;
|
||||
expandtab = true;
|
||||
|
||||
signcolumn = "yes:3";
|
||||
|
||||
# automatically indent and try to be smart about it
|
||||
autoindent = true;
|
||||
smartindent = true;
|
||||
|
||||
# Relative line numbers
|
||||
number = true;
|
||||
relativenumber = true;
|
||||
|
||||
# See search result as you type
|
||||
inccommand = "split";
|
||||
|
||||
# Visualize whitespace
|
||||
list = true;
|
||||
listchars = {
|
||||
tab = "» ";
|
||||
trail = "·";
|
||||
nbsp = "␣";
|
||||
};
|
||||
|
||||
# Show which line the cursor is on
|
||||
cursorline = true;
|
||||
|
||||
# Keep the cursor somewhat centered on the screen
|
||||
scrolloff = 25;
|
||||
|
||||
# Ask if operations would fail due to unsaved buffers
|
||||
confirm = true;
|
||||
|
||||
# ignore case in search unless multiple capital case letter have been typed
|
||||
smartcase = true;
|
||||
ignorecase = true;
|
||||
|
||||
completeopt = "menu,menuone,noselect";
|
||||
|
||||
# Persistent undos :)
|
||||
undofile = true;
|
||||
|
||||
# enable resize by mouse
|
||||
mouse = "n";
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
{ ... }: {
|
||||
imports = [
|
||||
./keymaps.nix
|
||||
];
|
||||
|
||||
plugins = {
|
||||
lspkind.enable = true;
|
||||
|
||||
cmp-nvim-lsp-signature-help.enable = true;
|
||||
|
||||
cmp = {
|
||||
enable = true;
|
||||
autoEnableSources = true;
|
||||
autoLoad = true;
|
||||
|
||||
settings.sources = [
|
||||
{ name = "nvim_lsp"; }
|
||||
{ name = "nvim_lsp_signature_help"; }
|
||||
{ name = "path"; }
|
||||
];
|
||||
|
||||
settings.mapping = {
|
||||
"<Tab>" = "cmp.mapping.select_next_item()";
|
||||
"<S-Tab>" = "cmp.mapping.select_prev_item()";
|
||||
"<C-Space>" = "cmp.mapping.complete()";
|
||||
"<C-S-Space>" = "cmp.mapping.close()";
|
||||
"<CR>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })";
|
||||
};
|
||||
};
|
||||
|
||||
lsp-format.enable = true;
|
||||
|
||||
none-ls = {
|
||||
enable = true;
|
||||
enableLspFormat = true;
|
||||
sources.formatting = {
|
||||
alejandra.enable = true;
|
||||
nixpkgs_fmt.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{ ... }: {
|
||||
keymaps = [
|
||||
{
|
||||
key = "grd";
|
||||
action = "<cmd>Telescope lsp_definitions<CR>";
|
||||
mode = "n";
|
||||
options.desc = "LSP: [G]oto [D]efinition";
|
||||
}
|
||||
{
|
||||
key = "gri";
|
||||
action = "<cmd>Telescope lsp_implementations<CR>";
|
||||
mode = "n";
|
||||
options.desc = "LSP: [G]oto [I]mplementations";
|
||||
}
|
||||
];
|
||||
}
|
||||
24
modules/programs/nixvim/_nixvim-config/plugins/default.nix
Normal file
24
modules/programs/nixvim/_nixvim-config/plugins/default.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
{ ... }: {
|
||||
imports = [
|
||||
./lsp.nix
|
||||
./telescope
|
||||
./cmp
|
||||
];
|
||||
|
||||
plugins = {
|
||||
lualine.enable = true;
|
||||
|
||||
web-devicons.enable = true;
|
||||
|
||||
treesitter = {
|
||||
enable = true;
|
||||
autoLoad = true;
|
||||
};
|
||||
|
||||
gitsigns.enable = true;
|
||||
|
||||
which-key.enable = true;
|
||||
|
||||
glow.enable = true;
|
||||
};
|
||||
}
|
||||
36
modules/programs/nixvim/_nixvim-config/plugins/lsp.nix
Normal file
36
modules/programs/nixvim/_nixvim-config/plugins/lsp.nix
Normal file
@@ -0,0 +1,36 @@
|
||||
{ ... }: {
|
||||
dependencies.rust-analyzer.enable = true;
|
||||
|
||||
lsp = {
|
||||
inlayHints.enable = true;
|
||||
servers = {
|
||||
"*" = {
|
||||
config.capabilities.textDocument.semanticTokens.multilineTokenSupport = true;
|
||||
config.root_markers = [
|
||||
".git"
|
||||
];
|
||||
};
|
||||
clangd = {
|
||||
enable = true;
|
||||
config.root_markers = [
|
||||
"compile_commands.json"
|
||||
];
|
||||
};
|
||||
rust_analyzer = {
|
||||
enable = true;
|
||||
};
|
||||
rnix.enable = true;
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
key = "<leader>e";
|
||||
action = "<cmd>lua vim.diagnostic.open_float()<CR>";
|
||||
options.desc = "Open Diagnostics";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
plugins.lspconfig.enable = true;
|
||||
plugins.clangd-extensions.enable = true;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{ ... }: {
|
||||
imports = [
|
||||
./keymaps.nix
|
||||
];
|
||||
dependencies.ripgrep.enable = true;
|
||||
|
||||
plugins.telescope = {
|
||||
enable = true;
|
||||
extensions.file-browser = {
|
||||
enable = true;
|
||||
settings = {
|
||||
git_status = true;
|
||||
hijack_netrw = true;
|
||||
respect_gitignore = true;
|
||||
fzf-native.enable = true;
|
||||
fzf-native.settings.case_mode = "ignore_case";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{ ... }: {
|
||||
keymaps = [
|
||||
{
|
||||
key = "<leader>sf";
|
||||
action = "<cmd>Telescope find_files<CR>";
|
||||
options.desc = "[S]earch [F]iles";
|
||||
}
|
||||
{
|
||||
key = "<leader>sg";
|
||||
action = "<cmd>Telescope live_grep<CR>";
|
||||
options.desc = "[S]earch by [G]rep";
|
||||
}
|
||||
{
|
||||
key = "<leader>sw";
|
||||
action = "<cmd>Telescope grep_string<CR>";
|
||||
options.desc = "[S]earch current [W]ord";
|
||||
}
|
||||
{
|
||||
key = "<leader>q";
|
||||
action = "<cmd>Telescope diagnostics<CR>";
|
||||
options.desc = "Lsp Diagnostics";
|
||||
}
|
||||
];
|
||||
}
|
||||
19
modules/programs/nixvim/nixvim.nix
Normal file
19
modules/programs/nixvim/nixvim.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{ inputs, ... }: {
|
||||
flake-file.inputs = {
|
||||
nixvim.url = "github:nix-community/nixvim/nixos-25.11";
|
||||
nixvim.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
flake.modules.homeManager.nixvim = {
|
||||
imports = [
|
||||
inputs.nixvim.homeModules.nixvim
|
||||
];
|
||||
|
||||
programs.nixvim = {
|
||||
enable = true;
|
||||
imports = [ ./_nixvim-config ];
|
||||
};
|
||||
|
||||
home.sessionVariables.EDITOR = "nvim";
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user