commit
1c12503ebf
15 changed files with 1434 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
result
|
||||||
20
LICENSE
Normal file
20
LICENSE
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
Copyright (c) 2024 Nicolas Goudry
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
5
README.md
Normal file
5
README.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
# NixVim config
|
||||||
|
|
||||||
|
**PERSONAL** configuration for [Neovim](https://neovim.io/) using [Nixvim](https://nix-community.github.io/nixvim/). Heavily inspired by [AstroNvim](https://astronvim.com/).
|
||||||
|
|
||||||
|
🚧 **This is a work in progress** 🚧
|
||||||
13
config/colorscheme.nix
Normal file
13
config/colorscheme.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Use catppuccin mocha variant
|
||||||
|
{
|
||||||
|
catppuccin = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
flavour = "mocha";
|
||||||
|
|
||||||
|
# Needed to keep terminal transparency, if any
|
||||||
|
transparent_background = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
33
config/keymaps.nix
Normal file
33
config/keymaps.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
let
|
||||||
|
forceWrite = {
|
||||||
|
action = "<cmd>silent! update! | redraw<cr>";
|
||||||
|
options.desc = "Force write";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
[
|
||||||
|
{
|
||||||
|
key = "<leader>n";
|
||||||
|
action = "<cmd>enew<cr>";
|
||||||
|
options.desc = "New file";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
inherit (forceWrite) action options;
|
||||||
|
key = "<c-s>";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
inherit (forceWrite) options;
|
||||||
|
mode = [ "i" "x" ];
|
||||||
|
key = "<c-s>";
|
||||||
|
action = "<esc>${forceWrite.action}";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "|";
|
||||||
|
action = "<cmd>vsplit<cr>";
|
||||||
|
options.desc = "Split vertically";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "\\";
|
||||||
|
action = "<cmd>split<cr>";
|
||||||
|
options.desc = "Split horizontally";
|
||||||
|
}
|
||||||
|
]
|
||||||
103
config/options.nix
Normal file
103
config/options.nix
Normal file
|
|
@ -0,0 +1,103 @@
|
||||||
|
# Neovim options
|
||||||
|
# Use :options to get the list of all options
|
||||||
|
# Use :h <option> to load help for given <option>
|
||||||
|
{
|
||||||
|
# Hide command line unless needed
|
||||||
|
cmdheight = 0;
|
||||||
|
|
||||||
|
# Insert mode completion options
|
||||||
|
completeopt = [ "menu" "menuone" "noselect" ];
|
||||||
|
|
||||||
|
# Copy previous indentation on autoindenting
|
||||||
|
copyindent = true;
|
||||||
|
|
||||||
|
# Highlight current line
|
||||||
|
cursorline = true;
|
||||||
|
|
||||||
|
# Expand <Tab> to spaces
|
||||||
|
expandtab = true;
|
||||||
|
|
||||||
|
# Enable fold with all code unfolded
|
||||||
|
foldcolumn = "1";
|
||||||
|
foldenable = true;
|
||||||
|
foldlevel = 99;
|
||||||
|
foldlevelstart = 99;
|
||||||
|
|
||||||
|
# Ignore case in search patterns
|
||||||
|
ignorecase = true;
|
||||||
|
|
||||||
|
# Show substitution preview in split window
|
||||||
|
inccommand = "split";
|
||||||
|
|
||||||
|
# Infer casing on word completion
|
||||||
|
infercase = true;
|
||||||
|
|
||||||
|
# Enable list mode
|
||||||
|
list = true;
|
||||||
|
|
||||||
|
# Set custom strings for list mode
|
||||||
|
# - tabulations are shown as ‒▶
|
||||||
|
# - trailing spaces are shown as ·
|
||||||
|
# - multiple non-leading consecutive spaces are shown as bullets (·)
|
||||||
|
# - non-breakable spaces are shown as ⎕
|
||||||
|
listchars = "tab:‒▶,trail:·,multispace:·,lead: ,nbsp:⎕";
|
||||||
|
|
||||||
|
# Show line numbers
|
||||||
|
number = true;
|
||||||
|
|
||||||
|
# Preserve indentation as much as possible
|
||||||
|
preserveindent = true;
|
||||||
|
|
||||||
|
# Height of the popup menu
|
||||||
|
pumheight = 10;
|
||||||
|
|
||||||
|
# Display line numbers relative to current line
|
||||||
|
relativenumber = true;
|
||||||
|
|
||||||
|
# Minimal number of lines to keep around the cursor
|
||||||
|
# This has the effect to move the view along with current line
|
||||||
|
#scrolloff = 999;
|
||||||
|
|
||||||
|
# Number of spaces to use for indentation
|
||||||
|
shiftwidth = 2;
|
||||||
|
|
||||||
|
# Always show tabline (TODO: use with heirline?)
|
||||||
|
#showtabline = 2;
|
||||||
|
|
||||||
|
# Show signs instead of number in gutter
|
||||||
|
signcolumn = "number";
|
||||||
|
|
||||||
|
# Override ignorecase if search pattern contains uppercase characters
|
||||||
|
smartcase = true;
|
||||||
|
|
||||||
|
# Number of spaces input on <Tab>
|
||||||
|
softtabstop = 2;
|
||||||
|
|
||||||
|
# Open horizontal split below (:split)
|
||||||
|
splitbelow = true;
|
||||||
|
|
||||||
|
# Open vertical split to the right (:vsplit)
|
||||||
|
splitright = true;
|
||||||
|
|
||||||
|
# Number of spaces to represent a <Tab>
|
||||||
|
tabstop = 2;
|
||||||
|
|
||||||
|
# Enables 24-bit RGB color
|
||||||
|
termguicolors = true;
|
||||||
|
|
||||||
|
# Shorter timeout duration
|
||||||
|
timeoutlen = 500;
|
||||||
|
|
||||||
|
# Set window title to the filename
|
||||||
|
title = true;
|
||||||
|
|
||||||
|
# Save undo history to undo file (in $XDG_STATE_HOME/nvim/undo)
|
||||||
|
undofile = true;
|
||||||
|
|
||||||
|
# Enable virtual edit in visual block mode
|
||||||
|
# This has the effect of selecting empty cells beyond lines boundaries
|
||||||
|
virtualedit = "block";
|
||||||
|
|
||||||
|
# Disable line wrapping
|
||||||
|
wrap = false;
|
||||||
|
}
|
||||||
30
default.nix
Normal file
30
default.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ./plugins ];
|
||||||
|
|
||||||
|
config = {
|
||||||
|
colorschemes = import ./config/colorscheme.nix;
|
||||||
|
keymaps = import ./config/keymaps.nix;
|
||||||
|
opts = import ./config/options.nix;
|
||||||
|
|
||||||
|
# Needed for telescope live grep
|
||||||
|
extraPackages = [ pkgs.ripgrep ];
|
||||||
|
|
||||||
|
# Use <Space> as leader key
|
||||||
|
globals.mapleader = " ";
|
||||||
|
|
||||||
|
# Set 'vi' and 'vim' aliases to nixvim
|
||||||
|
viAlias = true;
|
||||||
|
vimAlias = true;
|
||||||
|
|
||||||
|
# Setup clipboard support
|
||||||
|
clipboard = {
|
||||||
|
# Use xsel as clipboard provider
|
||||||
|
providers.xsel.enable = true;
|
||||||
|
|
||||||
|
# Sync system clipboard
|
||||||
|
register = "unnamedplus";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
344
flake.lock
generated
Normal file
344
flake.lock
generated
Normal file
|
|
@ -0,0 +1,344 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"devshell": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixvim",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1713532798,
|
||||||
|
"narHash": "sha256-wtBhsdMJA3Wa32Wtm1eeo84GejtI43pMrFrmwLXrsEc=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "devshell",
|
||||||
|
"rev": "12e914740a25ea1891ec619bb53cf5e6ca922e40",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "devshell",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-compat": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1696426674,
|
||||||
|
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||||
|
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||||
|
"revCount": 57,
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-compat_2": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1696426674,
|
||||||
|
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-parts": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs-lib": [
|
||||||
|
"nixvim",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1715865404,
|
||||||
|
"narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-root": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1713493429,
|
||||||
|
"narHash": "sha256-ztz8JQkI08tjKnsTpfLqzWoKFQF4JGu2LRz8bkdnYUk=",
|
||||||
|
"owner": "srid",
|
||||||
|
"repo": "flake-root",
|
||||||
|
"rev": "bc748b93b86ee76e2032eecda33440ceb2532fcd",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "srid",
|
||||||
|
"repo": "flake-root",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1701680307,
|
||||||
|
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gitignore": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixvim",
|
||||||
|
"pre-commit-hooks",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1709087332,
|
||||||
|
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"home-manager": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixvim",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1716457508,
|
||||||
|
"narHash": "sha256-ZxzffLuWRyuMrkVVq7wastNUqeO0HJL9xqfY1QsYaqo=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"rev": "850cb322046ef1a268449cf1ceda5fd24d930b05",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nix-darwin": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixvim",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1716511055,
|
||||||
|
"narHash": "sha256-5Fe/DGgvMhPEMl9VdVxv3zvwRcwNDmW5eRJ0gk72w7U=",
|
||||||
|
"owner": "lnl7",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"rev": "0bea8222f6e83247dd13b055d83e64bce02ee532",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "lnl7",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nix-formatter-pack": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"nmd": "nmd",
|
||||||
|
"nmt": "nmt"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1715807870,
|
||||||
|
"narHash": "sha256-lutvG1LFGSpXsGA7U4TWfdfq6p71WdSlhw3vM4W/Opk=",
|
||||||
|
"owner": "Gerschtli",
|
||||||
|
"repo": "nix-formatter-pack",
|
||||||
|
"rev": "ab5feb867e5d074918852de6134500a82a09dc48",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "Gerschtli",
|
||||||
|
"repo": "nix-formatter-pack",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1716509168,
|
||||||
|
"narHash": "sha256-4zSIhSRRIoEBwjbPm3YiGtbd8HDWzFxJjw5DYSDy1n8=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "bfb7a882678e518398ce9a31a881538679f6f092",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixvim": {
|
||||||
|
"inputs": {
|
||||||
|
"devshell": "devshell",
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"flake-parts": "flake-parts",
|
||||||
|
"flake-root": "flake-root",
|
||||||
|
"home-manager": "home-manager",
|
||||||
|
"nix-darwin": "nix-darwin",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"pre-commit-hooks": "pre-commit-hooks",
|
||||||
|
"treefmt-nix": "treefmt-nix"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1716759197,
|
||||||
|
"narHash": "sha256-I4r9krPVUl1b70VbC8j8xDQ2mDBoGCx8tH9CExiJMd8=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixvim",
|
||||||
|
"rev": "ba293d36403c39c22dbb9a928f9af4d0df54b79f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixvim",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nmd": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1666190571,
|
||||||
|
"narHash": "sha256-Z1hc7M9X6L+H83o9vOprijpzhTfOBjd0KmUTnpHAVjA=",
|
||||||
|
"owner": "rycee",
|
||||||
|
"repo": "nmd",
|
||||||
|
"rev": "b75d312b4f33bd3294cd8ae5c2ca8c6da2afc169",
|
||||||
|
"type": "gitlab"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "rycee",
|
||||||
|
"repo": "nmd",
|
||||||
|
"type": "gitlab"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nmt": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1648075362,
|
||||||
|
"narHash": "sha256-u36WgzoA84dMVsGXzml4wZ5ckGgfnvS0ryzo/3zn/Pc=",
|
||||||
|
"owner": "rycee",
|
||||||
|
"repo": "nmt",
|
||||||
|
"rev": "d83601002c99b78c89ea80e5e6ba21addcfe12ae",
|
||||||
|
"type": "gitlab"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "rycee",
|
||||||
|
"repo": "nmt",
|
||||||
|
"type": "gitlab"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pre-commit-hooks": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat_2",
|
||||||
|
"gitignore": "gitignore",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixvim",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"nixpkgs-stable": [
|
||||||
|
"nixvim",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1716213921,
|
||||||
|
"narHash": "sha256-xrsYFST8ij4QWaV6HEokCUNIZLjjLP1bYC60K8XiBVA=",
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "pre-commit-hooks.nix",
|
||||||
|
"rev": "0e8fcc54b842ad8428c9e705cb5994eaf05c26a0",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "pre-commit-hooks.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nix-formatter-pack": "nix-formatter-pack",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"nixvim": "nixvim"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"treefmt-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixvim",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1715940852,
|
||||||
|
"narHash": "sha256-wJqHMg/K6X3JGAE9YLM0LsuKrKb4XiBeVaoeMNlReZg=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"rev": "2fba33a182602b9d49f0b2440513e5ee091d838b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
70
flake.nix
Normal file
70
flake.nix
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
{
|
||||||
|
description = "NixVim config heavily inspired by AstroNvim";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
|
# Nix formatting pack
|
||||||
|
# https://gerschtli.github.io/nix-formatter-pack/nix-formatter-pack-options.html
|
||||||
|
nix-formatter-pack = {
|
||||||
|
url = "github:Gerschtli/nix-formatter-pack";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
nixvim = {
|
||||||
|
url = "github:nix-community/nixvim";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{ nixpkgs
|
||||||
|
, nixvim
|
||||||
|
, nix-formatter-pack
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
forAllSystems = nixpkgs.lib.genAttrs [
|
||||||
|
"aarch64-linux"
|
||||||
|
"i686-linux"
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-darwin"
|
||||||
|
"x86_64-darwin"
|
||||||
|
];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
formatter = forAllSystems (system:
|
||||||
|
nix-formatter-pack.lib.mkFormatter {
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
|
||||||
|
config.tools = {
|
||||||
|
deadnix.enable = true;
|
||||||
|
nixpkgs-fmt.enable = true;
|
||||||
|
statix.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
packages = forAllSystems (system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
mkNixvim = specialArgs:
|
||||||
|
nixvim.legacyPackages.${system}.makeNixvimWithModule {
|
||||||
|
inherit pkgs;
|
||||||
|
|
||||||
|
module = ./.;
|
||||||
|
|
||||||
|
extraSpecialArgs = specialArgs // {
|
||||||
|
inherit pkgs;
|
||||||
|
|
||||||
|
libn = nixvim.lib.${system};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
default = mkNixvim { };
|
||||||
|
lite = mkNixvim { withLSP = false; };
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
192
plugins/alpha.nix
Normal file
192
plugins/alpha.nix
Normal file
|
|
@ -0,0 +1,192 @@
|
||||||
|
# homepage: https://github.com/goolord/alpha-nvim
|
||||||
|
# nixvim doc: https://nix-community.github.io/nixvim/plugins/alpha/index.html
|
||||||
|
{ libn, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
header = {
|
||||||
|
type = "text";
|
||||||
|
|
||||||
|
# Use color defined by catppuccin
|
||||||
|
opts = {
|
||||||
|
hl = "AlphaHeader";
|
||||||
|
position = "center";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Generated from https://www.asciiart.eu/text-to-ascii-art
|
||||||
|
# Font used: Graffiti
|
||||||
|
val = [
|
||||||
|
" ________ ____ ____.___ _____ "
|
||||||
|
" / _____/ \\ \\ / /| | / \\ "
|
||||||
|
"/ \\ ___ \\ Y / | |/ \\ / \\ "
|
||||||
|
"\\ \\_\\ \\ \\ / | / Y \\"
|
||||||
|
" \\______ / /\\ \\___/ |___\\____|__ /"
|
||||||
|
" \\/ \\/ \\/ "
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
buttons = {
|
||||||
|
type = "group";
|
||||||
|
opts.spacing = 1;
|
||||||
|
|
||||||
|
# Use function defined in lua config (see below) to generate buttons
|
||||||
|
val = [
|
||||||
|
{ __raw = "alpha_button('LDR n ', ' New File')"; }
|
||||||
|
{ __raw = "alpha_button('LDR e ', ' Explorer')"; }
|
||||||
|
{ __raw = "alpha_button('LDR f f', ' Find File')"; }
|
||||||
|
{ __raw = "alpha_button('LDR f o', ' Recents')"; }
|
||||||
|
{ __raw = "alpha_button('LDR f g', ' Live Grep')"; }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Show random fortune as footer
|
||||||
|
footer = {
|
||||||
|
type = "text";
|
||||||
|
|
||||||
|
# Defined by Alpha
|
||||||
|
# https://github.com/goolord/alpha-nvim/blob/main/lua/alpha/fortune.lua
|
||||||
|
val.__raw = "require('alpha.fortune')()";
|
||||||
|
|
||||||
|
# Use color defined by catppuccin
|
||||||
|
opts = {
|
||||||
|
hl = "AlphaFooter";
|
||||||
|
position = "center";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
layout = [
|
||||||
|
# Padding size depending on window height (taken from AstroNvim)
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/alpha.lua#L141
|
||||||
|
{
|
||||||
|
type = "padding";
|
||||||
|
val.__raw = "vim.fn.max { 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) }";
|
||||||
|
}
|
||||||
|
header
|
||||||
|
{ type = "padding"; val = 5; }
|
||||||
|
buttons
|
||||||
|
{ type = "padding"; val = 3; }
|
||||||
|
footer
|
||||||
|
];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
extra = {
|
||||||
|
packages = with pkgs.vimPlugins; [
|
||||||
|
alpha-nvim
|
||||||
|
nvim-web-devicons
|
||||||
|
];
|
||||||
|
|
||||||
|
# Based on Alpha dashboard theme with tweaks from AstroNvim
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/alpha.lua#L86-L112
|
||||||
|
# https://github.com/goolord/alpha-nvim/blob/main/lua/alpha/themes/dashboard.lua#L46-L73
|
||||||
|
config = ''
|
||||||
|
local alpha_leader = "LDR"
|
||||||
|
|
||||||
|
function alpha_button(shortcut, desc, keybind, keybind_opts)
|
||||||
|
local sc = shortcut:gsub("%s", ""):gsub(alpha_leader, "<leader>")
|
||||||
|
|
||||||
|
local real_leader = vim.g.mapleader
|
||||||
|
if real_leader == " " then real_leader = "SPC" end
|
||||||
|
|
||||||
|
local opts = {
|
||||||
|
position = "center",
|
||||||
|
shortcut = shortcut:gsub(alpha_leader, real_leader),
|
||||||
|
cursor = -2,
|
||||||
|
width = 36,
|
||||||
|
align_shortcut = "right",
|
||||||
|
hl = "AlphaButtons",
|
||||||
|
hl_shortcut = "AlphaShortcut",
|
||||||
|
}
|
||||||
|
|
||||||
|
if keybind then
|
||||||
|
keybind_opts = if_nil(keybind_opts, { noremap = true, silent = true, nowait = true, desc = desc })
|
||||||
|
opts.keymap = { "n", sc, keybind, keybind_opts }
|
||||||
|
end
|
||||||
|
|
||||||
|
local function on_press()
|
||||||
|
local key = vim.api.nvim_replace_termcodes(keybind or sc .. "<ignore>", true, false, true)
|
||||||
|
vim.api.nvim_feedkeys(key, "t", false)
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
type = "button",
|
||||||
|
val = desc,
|
||||||
|
on_press = on_press,
|
||||||
|
opts = opts,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
require("alpha").setup({
|
||||||
|
layout = ${libn.helpers.toLuaObject layout},
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts = {
|
||||||
|
autoGroups.alpha = { };
|
||||||
|
|
||||||
|
# Custom autocommand (taken from AstroNvim)
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/alpha.lua#L19-L43
|
||||||
|
autoCmd = [
|
||||||
|
{
|
||||||
|
desc = "Disable status, tablines and cmdheight for alpha";
|
||||||
|
event = [ "User" "BufWinEnter" ];
|
||||||
|
group = "alpha";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function(event)
|
||||||
|
if
|
||||||
|
(
|
||||||
|
(event.event == "User" and event.file == "AlphaReady")
|
||||||
|
or (event.event == "BufWinEnter" and vim.bo[event.buf].filetype == "alpha")
|
||||||
|
) and not vim.g.before_alpha
|
||||||
|
then
|
||||||
|
vim.g.before_alpha = {
|
||||||
|
showtabline = vim.opt.showtabline:get(),
|
||||||
|
laststatus = vim.opt.laststatus:get(),
|
||||||
|
cmdheight = vim.opt.cmdheight:get(),
|
||||||
|
}
|
||||||
|
vim.opt.showtabline, vim.opt.laststatus, vim.opt.cmdheight = 0, 0, 0
|
||||||
|
elseif vim.g.before_alpha and event.event == "BufWinEnter" and vim.bo[event.buf].buftype ~= "nofile" then
|
||||||
|
vim.opt.laststatus, vim.opt.showtabline, vim.opt.cmdheight =
|
||||||
|
vim.g.before_alpha.laststatus, vim.g.before_alpha.showtabline, vim.g.before_alpha.cmdheight
|
||||||
|
vim.g.before_alpha = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
colorschemes.catppuccin.settings = {
|
||||||
|
# Enable catppuccin colors
|
||||||
|
# https://github.com/catppuccin/nvim/blob/main/lua/catppuccin/groups/integrations/alpha.lua
|
||||||
|
integrations.alpha = true;
|
||||||
|
|
||||||
|
# Override default catppuccin header color
|
||||||
|
custom_highlights = ''
|
||||||
|
function(colors)
|
||||||
|
return {
|
||||||
|
AlphaHeader = { fg = colors.red },
|
||||||
|
}
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
key = "<leader>h";
|
||||||
|
options.desc = "Home screen";
|
||||||
|
|
||||||
|
# Open alpha in a non neo-tree window (taken from AstroNvim)
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/alpha.lua#L10-L16
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
local wins = vim.api.nvim_tabpage_list_wins(0)
|
||||||
|
if #wins > 1 and vim.bo[vim.api.nvim_win_get_buf(wins[1])].filetype == "neo-tree" then
|
||||||
|
vim.fn.win_gotoid(wins[2])
|
||||||
|
end
|
||||||
|
require("alpha").start(false)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
62
plugins/default.nix
Normal file
62
plugins/default.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
# This file will load all plugins defined in the current directory (plugins)
|
||||||
|
# and load their content in the 'plugins' nixvim attribute.
|
||||||
|
|
||||||
|
# Each plugin file must export a lambda, which is called with an attrset
|
||||||
|
# containing nixpkgs library as 'lib'. Plugins may or may not use it.
|
||||||
|
|
||||||
|
# For plugins natively supported by nixvim, the plugin file must have the same
|
||||||
|
# name as the plugin attribute name expected by nixvim (ie. 'telescope.nix' for
|
||||||
|
# 'plugins.telescope'). The plugin lambda must return an attrset with at least
|
||||||
|
# the 'opts' attribute, this attribute is the plugin options as expected by
|
||||||
|
# nixvim.
|
||||||
|
|
||||||
|
# For plugins not supported by nixvim, the plugin file can have any name. The
|
||||||
|
# plugin lambda must return an attrset with the 'extra' attribute which is also
|
||||||
|
# an attrset with two attributes: 'package' and 'config'. The 'package'
|
||||||
|
# attribute is the plugin package in nixpkgs (ie. vimPlugins.<plugin>). The
|
||||||
|
# 'config' attribute is the plugin configuration in Lua format.
|
||||||
|
|
||||||
|
# Additionally, a 'rootOpts' can be returned alongside other attributes, this
|
||||||
|
# attribute will be used to set extra options to the root nixvim options. For
|
||||||
|
# example, this allows to set keymaps for plugins that do not have an internal
|
||||||
|
# option to set keymaps.
|
||||||
|
|
||||||
|
{ lib, ... }@args:
|
||||||
|
|
||||||
|
let
|
||||||
|
# Flag to enable LSP plugin with servers
|
||||||
|
# Given as an extra special arg when building nixvim module
|
||||||
|
withLSP = args.withLSP or true;
|
||||||
|
|
||||||
|
# Load plugins filenames in list
|
||||||
|
definitions = lib.attrNames (
|
||||||
|
lib.filterAttrs
|
||||||
|
(filename: kind:
|
||||||
|
filename != "default.nix"
|
||||||
|
&& (kind == "regular" || kind == "directory")
|
||||||
|
# If file is an LSP plugin, respect withLSP flag
|
||||||
|
&& (if filename == "lsp.nix" then withLSP else true)
|
||||||
|
)
|
||||||
|
(builtins.readDir ./.)
|
||||||
|
);
|
||||||
|
in
|
||||||
|
lib.mkMerge (
|
||||||
|
map
|
||||||
|
(file:
|
||||||
|
let
|
||||||
|
pluginName = lib.elemAt (lib.splitString "." file) 0;
|
||||||
|
plugin = import ./${file} args;
|
||||||
|
in
|
||||||
|
lib.mkMerge [
|
||||||
|
(lib.optionalAttrs (plugin ? opts) {
|
||||||
|
plugins.${pluginName} = plugin.opts;
|
||||||
|
})
|
||||||
|
(lib.optionalAttrs (plugin ? extra) {
|
||||||
|
extraConfigLua = plugin.extra.config or "";
|
||||||
|
extraPlugins = plugin.extra.packages;
|
||||||
|
})
|
||||||
|
(plugin.rootOpts or { })
|
||||||
|
]
|
||||||
|
)
|
||||||
|
definitions
|
||||||
|
)
|
||||||
266
plugins/neo-tree.nix
Normal file
266
plugins/neo-tree.nix
Normal file
|
|
@ -0,0 +1,266 @@
|
||||||
|
# homepage: https://github.com/nvim-neo-tree/neo-tree.nvim
|
||||||
|
# nixvim doc: https://nix-community.github.io/nixvim/plugins/neo-tree/index.html
|
||||||
|
_:
|
||||||
|
|
||||||
|
{
|
||||||
|
opts = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# Automatically clean up broken neo-tree buffers saved in sessions
|
||||||
|
autoCleanAfterSessionRestore = true;
|
||||||
|
|
||||||
|
# Close Neo-tree if it is the last window left in the tab
|
||||||
|
closeIfLastWindow = true;
|
||||||
|
|
||||||
|
# Disable fold column (gutter)
|
||||||
|
eventHandlers = {
|
||||||
|
neo_tree_buffer_enter = ''
|
||||||
|
function(_)
|
||||||
|
vim.opt_local.signcolumn = "auto"
|
||||||
|
vim.opt_local.foldcolumn = "0"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Extra options not exposed by the plugin
|
||||||
|
extraOptions = {
|
||||||
|
# Custom functions (taken from AstroNvim)
|
||||||
|
commands = {
|
||||||
|
# Focus first directory child item or open directory
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/neo-tree.lua#L120-L135
|
||||||
|
child_or_open.__raw = ''
|
||||||
|
function(state)
|
||||||
|
local node = state.tree:get_node()
|
||||||
|
if node:has_children() then
|
||||||
|
if not node:is_expanded() then -- if unexpanded, expand
|
||||||
|
state.commands.toggle_node(state)
|
||||||
|
else -- if expanded and has children, select the next child
|
||||||
|
if node.type == "file" then
|
||||||
|
state.commands.open(state)
|
||||||
|
else
|
||||||
|
require("neo-tree.ui.renderer").focus_node(state, node:get_child_ids()[1])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else -- if has no children
|
||||||
|
state.commands.open(state)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Copy various path format of currently focused item
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/neo-tree.lua#L136-L168
|
||||||
|
copy_selector.__raw = ''
|
||||||
|
function(state)
|
||||||
|
local node = state.tree:get_node()
|
||||||
|
local filepath = node:get_id()
|
||||||
|
local filename = node.name
|
||||||
|
local modify = vim.fn.fnamemodify
|
||||||
|
|
||||||
|
local vals = {
|
||||||
|
["BASENAME"] = modify(filename, ":r"),
|
||||||
|
["EXTENSION"] = modify(filename, ":e"),
|
||||||
|
["FILENAME"] = filename,
|
||||||
|
["PATH (CWD)"] = modify(filepath, ":."),
|
||||||
|
["PATH (HOME)"] = modify(filepath, ":~"),
|
||||||
|
["PATH"] = filepath,
|
||||||
|
["URI"] = vim.uri_from_fname(filepath),
|
||||||
|
}
|
||||||
|
|
||||||
|
local options = vim.tbl_filter(function(val) return vals[val] ~= "" end, vim.tbl_keys(vals))
|
||||||
|
if vim.tbl_isempty(options) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
table.sort(options)
|
||||||
|
vim.ui.select(options, {
|
||||||
|
prompt = "Choose to copy to clipboard:",
|
||||||
|
format_item = function(item) return ("%s: %s"):format(item, vals[item]) end,
|
||||||
|
}, function(choice)
|
||||||
|
local result = vals[choice]
|
||||||
|
if result then
|
||||||
|
vim.fn.setreg("+", result)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Find file in currently focused item if it is a directory, or its closest parent directory
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/neo-tree.lua#L205-L209
|
||||||
|
find_file_in_dir.__raw = ''
|
||||||
|
function(state)
|
||||||
|
local node = state.tree:get_node()
|
||||||
|
local path = node.type == "file" and node:get_parent_id() or node:get_id()
|
||||||
|
TelescopeWithTheme('find_files', { cwd = path })
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Live grep in currently focused item if it is a directory, or its closest parent directory
|
||||||
|
grep_in_dir.__raw = ''
|
||||||
|
function(state)
|
||||||
|
local node = state.tree:get_node()
|
||||||
|
local path = node.type == "file" and node:get_parent_id() or node:get_id()
|
||||||
|
TelescopeWithTheme('live_grep', { cwd = path })
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Focus parent directory of currently focused item or close directory
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/neo-tree.lua#L112-L119
|
||||||
|
parent_or_close.__raw = ''
|
||||||
|
function(state)
|
||||||
|
local node = state.tree:get_node()
|
||||||
|
if node:has_children() and node:is_expanded() then
|
||||||
|
state.commands.toggle_node(state)
|
||||||
|
else
|
||||||
|
require("neo-tree.ui.renderer").focus_node(state, node:get_parent_id())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
window = {
|
||||||
|
# Keymaps for filter popup window in fuzzy finder mode (ie. "/")
|
||||||
|
fuzzy_finder_mappings = {
|
||||||
|
"<C-J>" = "move_cursor_down";
|
||||||
|
"<C-K>" = "move_cursor_up";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Keymaps when neotree window is focused
|
||||||
|
mappings = {
|
||||||
|
"[b" = "prev_source";
|
||||||
|
"]b" = "next_source";
|
||||||
|
|
||||||
|
# Disable default behavior to toggle node on Space keypress
|
||||||
|
"<Space>".__raw = "false";
|
||||||
|
|
||||||
|
# See extraOptions.commands for details on following keymaps
|
||||||
|
h = "parent_or_close";
|
||||||
|
l = "child_or_open";
|
||||||
|
F = "find_file_in_dir";
|
||||||
|
W = "grep_in_dir";
|
||||||
|
Y = "copy_selector";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultComponentConfigs = {
|
||||||
|
gitStatus.symbols = {
|
||||||
|
added = "";
|
||||||
|
conflict = "";
|
||||||
|
deleted = "";
|
||||||
|
ignored = "◌";
|
||||||
|
modified = "";
|
||||||
|
renamed = "";
|
||||||
|
staged = "";
|
||||||
|
unstaged = "";
|
||||||
|
untracked = "★";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
filesystem = {
|
||||||
|
# Find and focus file in active buffer
|
||||||
|
followCurrentFile.enabled = true;
|
||||||
|
|
||||||
|
# Open neotree "fullscreen" when opening a directory
|
||||||
|
hijackNetrwBehavior = "open_current";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Sources tabs
|
||||||
|
sourceSelector = {
|
||||||
|
# Label position
|
||||||
|
contentLayout.__raw = "'center'";
|
||||||
|
|
||||||
|
# No tabs separator
|
||||||
|
separator = "";
|
||||||
|
|
||||||
|
# Show tabs on winbar
|
||||||
|
winbar = true;
|
||||||
|
|
||||||
|
# Sources to show and their labels
|
||||||
|
sources = [
|
||||||
|
{
|
||||||
|
displayName = " Files";
|
||||||
|
source = "filesystem";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
displayName = " Bufs";
|
||||||
|
source = "buffers";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
displayName = " Git";
|
||||||
|
source = "git_status";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts = {
|
||||||
|
# Enable catppuccin colors
|
||||||
|
# https://github.com/catppuccin/nvim/blob/main/lua/catppuccin/groups/integrations/neotree.lua
|
||||||
|
colorschemes.catppuccin.settings.integrations.neotree = true;
|
||||||
|
autoGroups.neotree = { };
|
||||||
|
|
||||||
|
# Custom autocommands (taken from AstroNvim)
|
||||||
|
autoCmd = [
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/neo-tree.lua#L21-L37
|
||||||
|
{
|
||||||
|
desc = "Open explorer on startup with directory";
|
||||||
|
event = "BufEnter";
|
||||||
|
group = "neotree";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function()
|
||||||
|
if package.loaded["neo-tree"] then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
local stats = vim.loop.fs_stat(vim.api.nvim_buf_get_name(0))
|
||||||
|
if stats and stats.type == "directory" then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/neo-tree.lua#L25-L35
|
||||||
|
{
|
||||||
|
desc = "Refresh explorer sources when closing lazygit";
|
||||||
|
event = "TermClose";
|
||||||
|
group = "neotree";
|
||||||
|
pattern = "*lazygit*";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function()
|
||||||
|
local manager_avail, manager = pcall(require, "neo-tree.sources.manager")
|
||||||
|
if manager_avail then
|
||||||
|
for _, source in ipairs { "filesystem", "git_status", "document_symbols" } do
|
||||||
|
local module = "neo-tree.sources." .. source
|
||||||
|
if package.loaded[module] then manager.refresh(require(module).name) end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
key = "<leader>e";
|
||||||
|
action = "<cmd>Neotree toggle<cr>";
|
||||||
|
options.desc = "Toggle explorer";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>o";
|
||||||
|
options.desc = "Toggle explorer focus";
|
||||||
|
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/neo-tree.lua#L12-L18
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
if vim.bo.filetype == "neo-tree" then
|
||||||
|
vim.cmd.wincmd "p"
|
||||||
|
else
|
||||||
|
vim.cmd.Neotree "focus"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
132
plugins/telescope.nix
Normal file
132
plugins/telescope.nix
Normal file
|
|
@ -0,0 +1,132 @@
|
||||||
|
# homepage: https://github.com/nvim-telescope/telescope.nvim
|
||||||
|
# nixvim doc: https://nix-community.github.io/nixvim/plugins/telescope/index.html
|
||||||
|
{ libn, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
opts = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts = {
|
||||||
|
# Enable catppuccin colors
|
||||||
|
# https://github.com/catppuccin/nvim/blob/main/lua/catppuccin/groups/integrations/telescope.lua
|
||||||
|
colorschemes.catppuccin.settings.integrations.telescope.enabled = true;
|
||||||
|
|
||||||
|
# Set custom behavior for dropdown theme:
|
||||||
|
# - use 80% of window width
|
||||||
|
# - use all window height
|
||||||
|
# - display preview at bottom
|
||||||
|
# ┌──────────────────────────────────────────────────┐
|
||||||
|
# │ ┌────────────────────────────────────────┐ │
|
||||||
|
# │ │ Prompt │ │
|
||||||
|
# │ ├────────────────────────────────────────┤ │
|
||||||
|
# │ │ Result │ │
|
||||||
|
# │ │ Result │ │
|
||||||
|
# │ └────────────────────────────────────────┘ │
|
||||||
|
# │ ┌────────────────────────────────────────┐ │
|
||||||
|
# │ │ Preview │ │
|
||||||
|
# │ │ Preview │ │
|
||||||
|
# │ │ Preview │ │
|
||||||
|
# │ │ Preview │ │
|
||||||
|
# │ │ Preview │ │
|
||||||
|
# │ │ Preview │ │
|
||||||
|
# │ └────────────────────────────────────────┘ │
|
||||||
|
# └──────────────────────────────────────────────────┘
|
||||||
|
extraConfigLuaPre = ''
|
||||||
|
local TelescopeWithTheme = function(fn, args)
|
||||||
|
args.layout_config = {
|
||||||
|
anchor = "N",
|
||||||
|
mirror = true,
|
||||||
|
width = 0.8,
|
||||||
|
}
|
||||||
|
|
||||||
|
if fn == "keymaps" or fn == "registers" then args.layout_config.height = function(_, _, max_lines) return max_lines end end
|
||||||
|
|
||||||
|
require("telescope.builtin")[fn](require("telescope.themes").get_dropdown(args))
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Use root keymaps to allow usage of custom TelescopeWithTheme function
|
||||||
|
keymaps =
|
||||||
|
let
|
||||||
|
mkTelescopeKeymap =
|
||||||
|
{ key
|
||||||
|
, mode ? "n"
|
||||||
|
, fn
|
||||||
|
, args ? { __empty = true; }
|
||||||
|
, desc ? ""
|
||||||
|
}: {
|
||||||
|
inherit key mode;
|
||||||
|
|
||||||
|
action.__raw = "function() TelescopeWithTheme('${fn}', ${libn.helpers.toLuaObject args}) end";
|
||||||
|
options = { inherit desc; };
|
||||||
|
};
|
||||||
|
in
|
||||||
|
map mkTelescopeKeymap [
|
||||||
|
{
|
||||||
|
desc = "Resume previous search";
|
||||||
|
key = "<leader>f<cr>";
|
||||||
|
fn = "resume";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Find words in current buffer";
|
||||||
|
key = "<leader>f/";
|
||||||
|
fn = "current_buffer_fuzzy_find";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Find buffers";
|
||||||
|
key = "<leader>fb";
|
||||||
|
fn = "buffers";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Find files";
|
||||||
|
key = "<leader>ff";
|
||||||
|
fn = "find_files";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Find all files";
|
||||||
|
key = "<leader>fF";
|
||||||
|
fn = "find_files";
|
||||||
|
args = {
|
||||||
|
hidden = true;
|
||||||
|
no_ignore = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Find words";
|
||||||
|
key = "<leader>fg";
|
||||||
|
fn = "live_grep";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Find help tags";
|
||||||
|
key = "<leader>fh";
|
||||||
|
fn = "help_tags";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Find keymaps";
|
||||||
|
key = "<leader>fk";
|
||||||
|
fn = "keymaps";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Find history";
|
||||||
|
key = "<leader>fo";
|
||||||
|
fn = "oldfiles";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Find registers";
|
||||||
|
key = "<leader>fr";
|
||||||
|
fn = "registers";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Find word under cursor";
|
||||||
|
key = "<leader>fw";
|
||||||
|
fn = "grep_string";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Search references";
|
||||||
|
key = "gr";
|
||||||
|
fn = "lsp_references";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
142
plugins/treesitter.nix
Normal file
142
plugins/treesitter.nix
Normal file
|
|
@ -0,0 +1,142 @@
|
||||||
|
# homepage: https://github.com/nvim-treesitter/nvim-treesitter
|
||||||
|
# nixvim doc: https://nix-community.github.io/nixvim/plugins/treesitter/index.html
|
||||||
|
_:
|
||||||
|
|
||||||
|
{
|
||||||
|
opts = {
|
||||||
|
# Enable treesitter syntax highlighting
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# Enable treesitter based indentation (use '=' to auto-indent)
|
||||||
|
indent = true;
|
||||||
|
|
||||||
|
# Enable incremental selection
|
||||||
|
# Keymaps are defined as global nixvim keymaps
|
||||||
|
incrementalSelection.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts = {
|
||||||
|
# Enable catppuccin colors
|
||||||
|
# https://github.com/catppuccin/nvim/blob/main/lua/catppuccin/groups/integrations/treesitter.lua
|
||||||
|
colorschemes.catppuccin.settings.integrations.treesitter = true;
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
mode = [ "n" "x" "o" ];
|
||||||
|
key = ",";
|
||||||
|
action.__raw = "function() require('nvim-treesitter.textobjects.repeatable_move').repeat_last_move() end";
|
||||||
|
options.desc = "Repeat last move";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = [ "n" "x" "o" ];
|
||||||
|
key = ";";
|
||||||
|
action.__raw = "function() require('nvim-treesitter.textobjects.repeatable_move').repeat_last_move_opposite() end";
|
||||||
|
options.desc = "Repeat last move in the opposite direction";
|
||||||
|
}
|
||||||
|
# Workaround for setting descriptions to treesitter incremental selection keymaps
|
||||||
|
# See https://github.com/nix-community/nixvim/issues/1506
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>ss";
|
||||||
|
action.__raw = "function() require('nvim-treesitter.incremental_selection').init_selection() end";
|
||||||
|
options.desc = "Start incremental selection";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "v";
|
||||||
|
key = "<leader>sd";
|
||||||
|
action.__raw = "function() require('nvim-treesitter.incremental_selection').node_decremental() end";
|
||||||
|
options.desc = "Decrement selection";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "v";
|
||||||
|
key = "<leader>si";
|
||||||
|
action.__raw = "function() require('nvim-treesitter.incremental_selection').node_incremental() end";
|
||||||
|
options.desc = "Increment selection by node";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "v";
|
||||||
|
key = "<leader>sc";
|
||||||
|
action.__raw = "function() require('nvim-treesitter.incremental_selection').scope_incremental() end";
|
||||||
|
options.desc = "Increment selection by scope";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
# Treesitter textobjects configuration
|
||||||
|
plugins.treesitter-textobjects = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# Jump across text objects
|
||||||
|
move = {
|
||||||
|
enable = true;
|
||||||
|
setJumps = true;
|
||||||
|
|
||||||
|
gotoNextStart = {
|
||||||
|
"]k" = { query = "@block.outer"; desc = "Next block start"; };
|
||||||
|
"]f" = { query = "@function.outer"; desc = "Next function start"; };
|
||||||
|
"]a" = { query = "@parameter.inner"; desc = "Next argument start"; };
|
||||||
|
};
|
||||||
|
|
||||||
|
gotoNextEnd = {
|
||||||
|
"]K" = { query = "@block.outer"; desc = "Next block end"; };
|
||||||
|
"]F" = { query = "@function.outer"; desc = "Next function end"; };
|
||||||
|
"]A" = { query = "@parameter.inner"; desc = "Next argument end"; };
|
||||||
|
};
|
||||||
|
|
||||||
|
gotoPreviousStart = {
|
||||||
|
"[k" = { query = "@block.outer"; desc = "Previous block start"; };
|
||||||
|
"[f" = { query = "@function.outer"; desc = "Previous function start"; };
|
||||||
|
"[a" = { query = "@parameter.inner"; desc = "Previous argument start"; };
|
||||||
|
};
|
||||||
|
|
||||||
|
gotoPreviousEnd = {
|
||||||
|
"[K" = { query = "@block.outer"; desc = "Previous block end"; };
|
||||||
|
"[F" = { query = "@function.outer"; desc = "Previous function end"; };
|
||||||
|
"[A" = { query = "@parameter.inner"; desc = "Previous argument end"; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Select text objects
|
||||||
|
select = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# Automatically jump to next textobjects, ie. if a keymap is pressed
|
||||||
|
# while the cursor is not under a textobject, the next relevant
|
||||||
|
# textobject will be used as "source", similar to the default nvim
|
||||||
|
# behavior
|
||||||
|
lookahead = true;
|
||||||
|
|
||||||
|
keymaps = {
|
||||||
|
ak = { query = "@block.outer"; desc = "around block"; };
|
||||||
|
ik = { query = "@block.inner"; desc = "inside block"; };
|
||||||
|
ac = { query = "@class.outer"; desc = "around class"; };
|
||||||
|
ic = { query = "@class.inner"; desc = "inside class"; };
|
||||||
|
"a?" = { query = "@conditional.outer"; desc = "around conditional"; };
|
||||||
|
"i?" = { query = "@conditional.inner"; desc = "inside conditional"; };
|
||||||
|
af = { query = "@function.outer"; desc = "around function"; };
|
||||||
|
"if" = { query = "@function.inner"; desc = "inside function"; };
|
||||||
|
ao = { query = "@loop.outer"; desc = "around loop"; };
|
||||||
|
io = { query = "@loop.inner"; desc = "inside loop"; };
|
||||||
|
aa = { query = "@parameter.outer"; desc = "around argument"; };
|
||||||
|
ia = { query = "@parameter.inner"; desc = "inside argument"; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Swap nodes with next/previous one
|
||||||
|
swap = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
swapNext = {
|
||||||
|
">K" = { query = "@block.outer"; desc = "Swap next block"; };
|
||||||
|
">F" = { query = "@function.outer"; desc = "Swap next function"; };
|
||||||
|
">A" = { query = "@parameter.inner"; desc = "Swap next argument"; };
|
||||||
|
};
|
||||||
|
|
||||||
|
swapPrevious = {
|
||||||
|
"<K" = { query = "@block.outer"; desc = "Swap previous block"; };
|
||||||
|
"<F" = { query = "@function.outer"; desc = "Swap previous function"; };
|
||||||
|
"<A" = { query = "@parameter.inner"; desc = "Swap previous argument"; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
21
plugins/which-key.nix
Normal file
21
plugins/which-key.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
# homepage: https://github.com/folke/which-key.nvim
|
||||||
|
# nixvim doc: https://nix-community.github.io/nixvim/plugins/which-key/index.html
|
||||||
|
_:
|
||||||
|
|
||||||
|
{
|
||||||
|
opts = {
|
||||||
|
enable = true;
|
||||||
|
window.border = "single";
|
||||||
|
|
||||||
|
# Disable which-key when in neo-tree or telescope
|
||||||
|
disable.filetypes = [
|
||||||
|
"TelescopePrompt"
|
||||||
|
"neo-tree"
|
||||||
|
"neo-tree-popup"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable catppuccin colors
|
||||||
|
# https://github.com/catppuccin/nvim/blob/main/lua/catppuccin/groups/integrations/which_key.lua
|
||||||
|
rootOpts.colorschemes.catppuccin.settings.integrations.which_key = true;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue