Compare commits

...

7 commits

24 changed files with 653 additions and 598 deletions

View file

@ -1,20 +1,30 @@
# Neovim Configuration Flake
This is the Neovim configuration I use as a [home-manager](https://nix-community.github.io/home-manager/) module
for all my NixOS and home-manager enabled systems (such as with nix-darwin on macOS).
This is the Neovim configuration for all my NixOS and Nix enabled systems (such as with nix-darwin on macOS).
It aims to be minimal and utilitarian; it forgoes many blingful features like status lines, sidebars, or fancy UI enhancements
in favor of native (neo)Vim, while still having everything useful you'd expect, like LSPs, file explorer (`yazi`), completions,
advanced language tools, and QoL enhancements.
It uses the [Nixvim](https://nix-community.github.io/nixvim/) project under the hood to declaratively
configure Neovim and its plugins, and installs some LSPs and other tools needed by it (like `yazi`, `fd`, etc).
It can be consumed directly in your configuration but as it contains many heavily opinionated and
personalized configuration options, you should probably just use it as inspiration or as an example
for your own config.
It simply outputs a package which provides the binary `nvim`. It can be called just like the regular `nvim` binary, except it bundles
all of my custom configuration and their dependencies with the power of Nix. An entirely self-contained, reproducible, purely functional text editor. Amazing.
Feel free to fork or copy the config to use yourself. It's free in the [public domain.](./LICENSE).
Feel free to fork or copy the config to use yourself. It's free in the [public domain](./LICENSE).
Thanks to [this gist](https://gist.github.com/siph/288b7c6b5f68a1902d28aebc95fde4c5) for showing me how to
build a Nixvim configuration as a standalone Nix package.
## Usage
Add it to your flake inputs, and import `homeManagerModules.default` as a home-manager module:
You can test drive my config in just one line (if you have Nix, of course):
```sh
nix run 'github:youwen5/neovim-flake' --extra-experimental-features flakes --extra-experimental-features nix-command
```
If for some reason, you want to install it permanently, add it to your flake inputs,
and install the package in the usual way:
```nix
# flake.nix
@ -23,10 +33,8 @@ Add it to your flake inputs, and import `homeManagerModules.default` as a home-m
inputs = {
# -- snip --
neovim-config = {
url = "github:youwen5/neovim-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
custom-neovim.url = "github:youwen5/neovim-flake";
};
# -- snip --
};
# -- snip --
@ -34,13 +42,19 @@ Add it to your flake inputs, and import `homeManagerModules.default` as a home-m
```
```nix
# Wherever you're setting up your home-manager modules:
# Wherever you install packages for your system or user:
home-manager.users.<your-username> = {
imports = [
# -- snip --
inputs.neovim-config.homeManagerModules.default
# -- snip --
{inputs, system, ...}:
{
environment.systemPackages = [
inputs.custom-neovim.packages.${system}.default
# supported systems: x86_64-linux, aarch64-linux, x86_64-darwin, aarch64-darwin
];
};
}
```
> [!WARNING]
> This package will add the symlinks `vim -> nvim` and `vi -> nvim` so it will conflict with
> `pkgs.vim` and any programs installing binaries called `vim` or `vi`. You must remove existing
> Neovim and Vim packages to install this.

13
config/default.nix Normal file
View file

@ -0,0 +1,13 @@
{pkgs, ...}: {
imports = [./plugins ./keymaps.nix ./init.nix];
viAlias = true;
vimAlias = true;
withNodeJs = true;
withRuby = true;
luaLoader.enable = true;
performance = {
combinePlugins.enable = true;
byteCompileLua.enable = true;
};
}

10
config/init.nix Normal file
View file

@ -0,0 +1,10 @@
# Basic housekeeping stuff that might run in a typical `init.lua` file.
{
colorschemes.rose-pine.enable = true;
opts = {
laststatus = 3;
relativenumber = true;
number = true;
};
}

358
config/keymaps.nix Normal file
View file

@ -0,0 +1,358 @@
{
globals = {
mapleader = " ";
};
keymaps = [
{
# Unmap space (leader)
action = "<nop>";
key = "<Leader>";
options = {
noremap = true;
silent = true;
};
mode = "n";
}
{
action = "<cmd>sp<CR><C-w>j";
key = "<Leader>-";
options.silent = true;
options.desc = "Split window horizontally";
}
{
action = "<cmd>vsp<CR><c-w>l";
key = "<Leader>\\";
options.silent = true;
options.desc = "Split window vertically";
}
{
action = "<cmd>ZenMode<CR>";
key = "<Space>wz";
options = {
silent = true;
noremap = true;
desc = "Zen mode";
};
}
{
action = "<C-w>h";
key = "<C-h>";
options = {
silent = true;
noremap = true;
desc = "Move to left window";
};
}
{
action = "<C-w>j";
key = "<C-j>";
options = {
silent = true;
noremap = true;
desc = "Move to lower window";
};
}
{
action = "<C-w>k";
key = "<C-k>";
options = {
silent = true;
noremap = true;
desc = "Move to upper window";
};
}
{
action = "<C-w>l";
key = "<C-l>";
options = {
silent = true;
noremap = true;
desc = "Move to right window";
};
}
{
action = "<cmd>close<CR>";
key = "<Leader>wd";
options = {
silent = true;
noremap = true;
desc = "Close current window";
};
}
{
action = "<cmd>Telescope find_files<CR>";
key = "<Leader>ff";
options = {
silent = true;
noremap = true;
desc = "Find files";
};
}
{
action = "<cmd>Telescope live_grep<CR>";
key = "<Leader>/";
options = {
silent = true;
noremap = true;
desc = "Live grep";
};
}
{
action = "<cmd>Telescope buffers<CR>";
key = "<Leader>fb";
options = {
silent = true;
noremap = true;
desc = "List buffers";
};
}
{
action = "<cmd>Telescope help_tags<CR>";
key = "<Leader>fh";
options = {
silent = true;
noremap = true;
desc = "Help tags";
};
}
{
action = "<cmd>lua require'telescope.builtin'.lsp_definitions{}<CR>";
key = "gd";
options = {
silent = true;
noremap = true;
desc = "Go to definition";
};
}
{
action = "<cmd>lua require'telescope.builtin'.git_files{}<CR>";
key = "<Leader> ";
options = {
silent = true;
noremap = true;
desc = "List Git files";
};
}
{
action = "<cmd>lua require'telescope.builtin'.find_files{}<CR>";
key = "<Leader>ff";
options = {
silent = true;
noremap = true;
desc = "List all files";
};
}
{
action = "<C-\\><C-n>";
key = "<C-Esc>";
options = {
silent = true;
noremap = true;
desc = "Go to normal mode in built-in terminal.";
};
mode = "t";
}
{
action = ":resize +4<CR>";
key = "<Leader>w=";
options = {
silent = true;
noremap = true;
desc = "Increase window height.";
};
}
{
action = ":resize -4<CR>";
key = "<Leader>w-";
options = {
silent = true;
noremap = true;
desc = "Decrease window height.";
};
}
{
action = ":vertical resize +4<CR>";
key = "<Leader>w]";
options = {
silent = true;
noremap = true;
desc = "Increase window width.";
};
}
{
action = ":vertical resize -4<CR>";
key = "<Leader>w[";
options = {
silent = true;
noremap = true;
desc = "Decrease window width.";
};
}
{
action = ":Bdelete!<CR>";
key = "<Leader>bd";
options = {
silent = true;
noremap = true;
desc = "Close buffer";
};
}
{
action = ":bprev<CR>";
key = "H";
options = {
silent = true;
noremap = true;
desc = "Move to the previous buffer.";
};
}
{
action = ":bnext<CR>";
key = "L";
options = {
silent = true;
noremap = true;
desc = "Move to the next buffer.";
};
}
{
action = ":LazyGit<CR>";
key = "<Leader>gg";
options = {
silent = true;
noremap = true;
desc = "Open LazyGit";
};
}
{
action = ":split | wincmd j | resize 15 | term<CR>";
key = "<Leader>tt";
options = {
silent = true;
noremap = true;
desc = "Open a half-size horizontal terminal split";
};
mode = "n";
}
{
action = ":split | wincmd j | term<CR>";
key = "<Leader>te";
options = {
silent = true;
noremap = true;
desc = "Open a horizontal terminal split";
};
mode = "n";
}
{
action = ":vsplit | wincmd l | term<CR>";
key = "<Leader>tv";
options = {
silent = true;
noremap = true;
desc = "Open a vertical terminal split";
};
mode = "n";
}
{
action = ":Trouble diagnostics<CR>";
key = "<Leader>xx";
options = {
silent = true;
noremap = true;
desc = "View trouble diagnostics";
};
mode = "n";
}
{
action = ":Trouble symbols<CR>";
key = "<Leader>xs";
options = {
silent = true;
noremap = true;
desc = "View symbols";
};
mode = "n";
}
{
action = "<Plug>(YankyPutAfter)";
key = "p";
mode = ["n" "x"];
}
{
action = "<Plug>(YankyPutBefore)";
key = "P";
mode = ["n" "x"];
}
{
action = "<Plug>(YankyGPutAfter)";
key = "gp";
mode = ["n" "x"];
}
{
action = "<Plug>(YankyGPutBefore)";
key = "gP";
mode = ["n" "x"];
}
{
action = ":Telescope yank_history<CR>";
key = "<Leader>p";
mode = "n";
}
{
action = '':lua require("yazi").yazi()<CR>'';
key = "<Leader>mm";
options = {
desc = "Open Yazi current nvim working directory";
noremap = true;
silent = true;
};
}
{
action = '':lua vim.lsp.buf.code_action()<CR>'';
key = "<Leader>ca";
options = {
desc = "View available code actions";
noremap = true;
silent = true;
};
}
{
action = '':lua vim.lsp.buf.rename()<CR>'';
key = "<Leader>cr";
options = {
desc = "Rename symbol";
noremap = true;
silent = true;
};
}
{
action = '':lua require("lsp_lines").toggle()<CR>'';
key = "<Leader>cd";
options = {
desc = "Toggle lsp lines";
noremap = true;
silent = true;
};
}
# {
# action = ":Yazi<CR>";
# key = "<Leader>mf";
# options = {
# desc = "Open Yazi at current file";
# noremap = true;
# silent = true;
# };
# }
# {
# action = "<cmd>lua require'conform'.format({ bufnr = args.bf })<CR>";
# key = "<Leader>cf";
# options = {
# silent = true;
# noremap = true;
# desc = "Format buffer";
# };
# }
];
}

View file

@ -1,5 +1,5 @@
{
programs.nixvim.plugins = {
plugins = {
cmp-async-path.enable = true;
cmp = {
enable = true;

View file

@ -0,0 +1,45 @@
# Code formatters
{pkgs, ...}: {
extraPackages = with pkgs; [
# TS/JS
nodePackages.prettier
# Rust
rustfmt
# Nix
alejandra
# Python
black
# Lua
stylua
# Haskell
haskellPackages.fourmolu
# Misc
codespell
];
plugins.conform-nvim = {
enable = true;
settings = {
format_on_save = {
timeoutMs = 500;
lspFallback = true;
};
formatters_by_ft = {
lua = ["stylua"];
python = ["black"];
nix = ["alejandra"];
svelte = ["prettier"];
rust = ["rustfmt"];
haskell = ["fourmolu"];
"*" = ["codespell"];
"_" = ["trim_whitespace"];
};
};
};
}

47
config/plugins/lsps.nix Normal file
View file

@ -0,0 +1,47 @@
# LSP setup
{pkgs, ...}: {
extraPackages = with pkgs; [
rust-analyzer
lua-language-server
];
plugins.lsp = {
enable = true;
inlayHints = true;
servers = {
bashls.enable = true;
clangd.enable = true;
pyright.enable = true;
nixd.enable = true;
nushell.enable = true;
svelte.enable = true;
tailwindcss.enable = true;
# typst-lsp.enable = true;
marksman.enable = true;
};
};
plugins = {
typescript-tools.enable = true;
};
plugins.lsp-lines.enable = true;
extraPlugins = [
(pkgs.vimUtils.buildVimPlugin {
name = "haskell-tools-nvim";
src = pkgs.fetchFromGitHub {
owner = "mrcjkb";
repo = "haskell-tools.nvim";
rev = "959eac0fadbdd27442904a8cb363f39afb528027";
hash = "sha256-5CS5kvUSqQJe7iFFpicinBjCQXgFPL0ElGgnrZHTT+Y=";
};
})
(pkgs.vimUtils.buildVimPlugin {
name = "rustaceanvim";
src = pkgs.fetchFromGitHub {
owner = "mrcjkb";
repo = "rustaceanvim";
rev = "7cba8e599deca98d4b44cac1bcbd720c62937d90";
hash = "sha256-OYfeJuo4FZUBdW9wGGCT0lZGYr/ur1uy8frcyUJMF3k=";
};
})
];
}

View file

@ -1,6 +1,6 @@
# All the mini.nvim stuff
{
programs.nixvim.plugins.mini = {
plugins.mini = {
enable = true;
modules = {
surround = {};

View file

@ -1,6 +1,6 @@
# Misc stuff
{
programs.nixvim.plugins = {
plugins = {
# Extra (stuff that doesn't affect editing)
wakatime.enable = true;
presence-nvim = {

View file

@ -1,6 +1,6 @@
# Getting around REALLY FAST
{
programs.nixvim.plugins = {
plugins = {
telescope = {
enable = true;
extensions = {

50
config/plugins/qol.nix Normal file
View file

@ -0,0 +1,50 @@
# Quality of life plugins
{pkgs, ...}: {
extraPackages = with pkgs; [
ripgrep
yazi
fd
];
plugins = {
zen-mode.enable = true;
direnv.enable = true;
intellitab.enable = true;
guess-indent.enable = true;
vim-bbye.enable = true;
indent-blankline.enable = true;
which-key.enable = true;
nvim-autopairs.enable = true;
yanky = {
enable = true;
enableTelescope = true;
};
trouble.enable = true;
crates-nvim.enable = true;
# git stuff
lazygit.enable = true;
gitsigns.enable = true;
# Language specific tools
markdown-preview.enable = true;
};
extraPlugins = [
(pkgs.vimUtils.buildVimPlugin {
name = "satellite.nvim";
src = pkgs.fetchFromGitHub {
owner = "lewis6991";
repo = "satellite.nvim";
rev = "777ed56e1ef45ec808df701730b6597fc4fb0fbc";
hash = "sha256-04Js+9SB4VuCq/ACbNh5BZcolu8i8vlGU72qo5xxfpk=";
};
})
(pkgs.vimUtils.buildVimPlugin {
name = "render-markdown.nvim";
src = pkgs.fetchFromGitHub {
owner = "MeanderingProgrammer";
repo = "render-markdown.nvim";
rev = "7986be47531d652e950776536987e01dd5b55b94";
hash = "sha256-lc++IrXzEA3M2iUFZACAZOcH2EwVqX4p0fhET+en37o=";
};
})
];
}

7
config/plugins/setup.nix Normal file
View file

@ -0,0 +1,7 @@
# Manual setup for some plugins
{
extraConfigLua = ''
require("telescope").load_extension("yank_history")
vim.diagnostic.config({ virtual_lines = false });
'';
}

View file

@ -0,0 +1,13 @@
{
plugins = {
treesitter = {
enable = true;
settings = {
highlight.enable = true;
indent.enable = true;
folding.enable = true;
};
};
treesitter-context.enable = true;
};
}

View file

@ -36,6 +36,24 @@
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1722555600,
"narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
@ -170,24 +188,37 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1724558323,
"narHash": "sha256-uPXidysk1BXSayGzpxDW8JUgGvLWS+L1CTlBV3xcQB4=",
"owner": "NixOS",
"lastModified": 1724224976,
"narHash": "sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh+aRKoCdaAv5fiO0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "ba0c72cea47a45556ccd5bc566433bd1242a0f93",
"rev": "c374d94f1536013ca8e92341b540eba4c22f9c62",
"type": "github"
},
"original": {
"owner": "NixOS",
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1722555339,
"narHash": "sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz"
}
},
"nixvim": {
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"flake-parts": "flake-parts_2",
"git-hooks": "git-hooks",
"home-manager": "home-manager",
"nix-darwin": "nix-darwin",
@ -235,6 +266,7 @@
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs",
"nixvim": "nixvim"
}

View file

@ -2,20 +2,46 @@
description = "Personal Neovim configuration.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixvim.url = "github:nix-community/nixvim";
nixvim.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
};
outputs = {
nixvim,
nixpkgs,
flake-parts,
...
}: {
homeManagerModules.default = {
imports = [nixvim.homeManagerModules.nixvim ./homeManagerModule];
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
perSystem = {
pkgs,
system,
...
}: let
nixvimLib = nixvim.lib.${system};
nixvim' = nixvim.legacyPackages.${system};
nixvimModule = {
inherit pkgs;
module = import ./config;
};
nvim = nixvim'.makeNixvimWithModule nixvimModule;
in {
formatter = pkgs.alejandra;
checks = {
default = nixvimLib.check.mkTestDerivationFromNixvimModule nixvimModule;
};
packages = {
default = nvim;
};
};
};
};
}

View file

@ -1,16 +0,0 @@
{pkgs, ...}: {
imports = [./plugins ./keymaps.nix ./init.nix];
programs.nixvim = {
enable = true;
viAlias = true;
vimAlias = true;
withNodeJs = true;
withRuby = true;
luaLoader.enable = true;
performance = {
combinePlugins.enable = true;
byteCompileLua.enable = true;
};
};
}

View file

@ -1,12 +0,0 @@
# Basic housekeeping stuff that might run in a typical `init.lua` file.
{
programs.nixvim = {
colorschemes.rose-pine.enable = true;
opts = {
laststatus = 3;
relativenumber = true;
number = true;
};
};
}

View file

@ -1,360 +0,0 @@
{
programs.nixvim = {
globals = {
mapleader = " ";
};
keymaps = [
{
# Unmap space (leader)
action = "<nop>";
key = "<Leader>";
options = {
noremap = true;
silent = true;
};
mode = "n";
}
{
action = "<cmd>sp<CR><C-w>j";
key = "<Leader>-";
options.silent = true;
options.desc = "Split window horizontally";
}
{
action = "<cmd>vsp<CR><c-w>l";
key = "<Leader>\\";
options.silent = true;
options.desc = "Split window vertically";
}
{
action = "<cmd>ZenMode<CR>";
key = "<Space>wz";
options = {
silent = true;
noremap = true;
desc = "Zen mode";
};
}
{
action = "<C-w>h";
key = "<C-h>";
options = {
silent = true;
noremap = true;
desc = "Move to left window";
};
}
{
action = "<C-w>j";
key = "<C-j>";
options = {
silent = true;
noremap = true;
desc = "Move to lower window";
};
}
{
action = "<C-w>k";
key = "<C-k>";
options = {
silent = true;
noremap = true;
desc = "Move to upper window";
};
}
{
action = "<C-w>l";
key = "<C-l>";
options = {
silent = true;
noremap = true;
desc = "Move to right window";
};
}
{
action = "<cmd>close<CR>";
key = "<Leader>wd";
options = {
silent = true;
noremap = true;
desc = "Close current window";
};
}
{
action = "<cmd>Telescope find_files<CR>";
key = "<Leader>ff";
options = {
silent = true;
noremap = true;
desc = "Find files";
};
}
{
action = "<cmd>Telescope live_grep<CR>";
key = "<Leader>/";
options = {
silent = true;
noremap = true;
desc = "Live grep";
};
}
{
action = "<cmd>Telescope buffers<CR>";
key = "<Leader>fb";
options = {
silent = true;
noremap = true;
desc = "List buffers";
};
}
{
action = "<cmd>Telescope help_tags<CR>";
key = "<Leader>fh";
options = {
silent = true;
noremap = true;
desc = "Help tags";
};
}
{
action = "<cmd>lua require'telescope.builtin'.lsp_definitions{}<CR>";
key = "gd";
options = {
silent = true;
noremap = true;
desc = "Go to definition";
};
}
{
action = "<cmd>lua require'telescope.builtin'.git_files{}<CR>";
key = "<Leader> ";
options = {
silent = true;
noremap = true;
desc = "List Git files";
};
}
{
action = "<cmd>lua require'telescope.builtin'.find_files{}<CR>";
key = "<Leader>ff";
options = {
silent = true;
noremap = true;
desc = "List all files";
};
}
{
action = "<C-\\><C-n>";
key = "<C-Esc>";
options = {
silent = true;
noremap = true;
desc = "Go to normal mode in built-in terminal.";
};
mode = "t";
}
{
action = ":resize +4<CR>";
key = "<Leader>w=";
options = {
silent = true;
noremap = true;
desc = "Increase window height.";
};
}
{
action = ":resize -4<CR>";
key = "<Leader>w-";
options = {
silent = true;
noremap = true;
desc = "Decrease window height.";
};
}
{
action = ":vertical resize +4<CR>";
key = "<Leader>w]";
options = {
silent = true;
noremap = true;
desc = "Increase window width.";
};
}
{
action = ":vertical resize -4<CR>";
key = "<Leader>w[";
options = {
silent = true;
noremap = true;
desc = "Decrease window width.";
};
}
{
action = ":Bdelete!<CR>";
key = "<Leader>bd";
options = {
silent = true;
noremap = true;
desc = "Close buffer";
};
}
{
action = ":bprev<CR>";
key = "H";
options = {
silent = true;
noremap = true;
desc = "Move to the previous buffer.";
};
}
{
action = ":bnext<CR>";
key = "L";
options = {
silent = true;
noremap = true;
desc = "Move to the next buffer.";
};
}
{
action = ":LazyGit<CR>";
key = "<Leader>gg";
options = {
silent = true;
noremap = true;
desc = "Open LazyGit";
};
}
{
action = ":split | wincmd j | resize 15 | term<CR>";
key = "<Leader>tt";
options = {
silent = true;
noremap = true;
desc = "Open a half-size horizontal terminal split";
};
mode = "n";
}
{
action = ":split | wincmd j | term<CR>";
key = "<Leader>te";
options = {
silent = true;
noremap = true;
desc = "Open a horizontal terminal split";
};
mode = "n";
}
{
action = ":vsplit | wincmd l | term<CR>";
key = "<Leader>tv";
options = {
silent = true;
noremap = true;
desc = "Open a vertical terminal split";
};
mode = "n";
}
{
action = ":Trouble diagnostics<CR>";
key = "<Leader>xx";
options = {
silent = true;
noremap = true;
desc = "View trouble diagnostics";
};
mode = "n";
}
{
action = ":Trouble symbols<CR>";
key = "<Leader>xs";
options = {
silent = true;
noremap = true;
desc = "View symbols";
};
mode = "n";
}
{
action = "<Plug>(YankyPutAfter)";
key = "p";
mode = ["n" "x"];
}
{
action = "<Plug>(YankyPutBefore)";
key = "P";
mode = ["n" "x"];
}
{
action = "<Plug>(YankyGPutAfter)";
key = "gp";
mode = ["n" "x"];
}
{
action = "<Plug>(YankyGPutBefore)";
key = "gP";
mode = ["n" "x"];
}
{
action = ":Telescope yank_history<CR>";
key = "<Leader>p";
mode = "n";
}
{
action = '':lua require("yazi").yazi()<CR>'';
key = "<Leader>mm";
options = {
desc = "Open Yazi current nvim working directory";
noremap = true;
silent = true;
};
}
{
action = '':lua vim.lsp.buf.code_action()<CR>'';
key = "<Leader>ca";
options = {
desc = "View available code actions";
noremap = true;
silent = true;
};
}
{
action = '':lua vim.lsp.buf.rename()<CR>'';
key = "<Leader>cr";
options = {
desc = "Rename symbol";
noremap = true;
silent = true;
};
}
{
action = '':lua require("lsp_lines").toggle()<CR>'';
key = "<Leader>cd";
options = {
desc = "Toggle lsp lines";
noremap = true;
silent = true;
};
}
# {
# action = ":Yazi<CR>";
# key = "<Leader>mf";
# options = {
# desc = "Open Yazi at current file";
# noremap = true;
# silent = true;
# };
# }
# {
# action = "<cmd>lua require'conform'.format({ bufnr = args.bf })<CR>";
# key = "<Leader>cf";
# options = {
# silent = true;
# noremap = true;
# desc = "Format buffer";
# };
# }
];
};
}

View file

@ -1,47 +0,0 @@
# Code formatters
{pkgs, ...}: {
programs.nixvim = {
extraPackages = with pkgs; [
# TS/JS
nodePackages.prettier
# Rust
rustfmt
# Nix
alejandra
# Python
black
# Lua
stylua
# Haskell
haskellPackages.fourmolu
# Misc
codespell
];
plugins.conform-nvim = {
enable = true;
settings = {
format_on_save = {
timeoutMs = 500;
lspFallback = true;
};
formatters_by_ft = {
lua = ["stylua"];
python = ["black"];
nix = ["alejandra"];
svelte = ["prettier"];
rust = ["rustfmt"];
haskell = ["fourmolu"];
"*" = ["codespell"];
"_" = ["trim_whitespace"];
};
};
};
};
}

View file

@ -1,49 +0,0 @@
# LSP setup
{pkgs, ...}: {
programs.nixvim = {
extraPackages = with pkgs; [
rust-analyzer
lua-language-server
];
plugins.lsp = {
enable = true;
inlayHints = true;
servers = {
bashls.enable = true;
clangd.enable = true;
pyright.enable = true;
nixd.enable = true;
nushell.enable = true;
svelte.enable = true;
tailwindcss.enable = true;
typst-lsp.enable = true;
marksman.enable = true;
};
};
plugins = {
typescript-tools.enable = true;
};
plugins.lsp-lines.enable = true;
extraPlugins = [
(pkgs.vimUtils.buildVimPlugin {
name = "haskell-tools-nvim";
src = pkgs.fetchFromGitHub {
owner = "mrcjkb";
repo = "haskell-tools.nvim";
rev = "959eac0fadbdd27442904a8cb363f39afb528027";
hash = "sha256-5CS5kvUSqQJe7iFFpicinBjCQXgFPL0ElGgnrZHTT+Y=";
};
})
(pkgs.vimUtils.buildVimPlugin {
name = "rustaceanvim";
src = pkgs.fetchFromGitHub {
owner = "mrcjkb";
repo = "rustaceanvim";
rev = "7cba8e599deca98d4b44cac1bcbd720c62937d90";
hash = "sha256-OYfeJuo4FZUBdW9wGGCT0lZGYr/ur1uy8frcyUJMF3k=";
};
})
];
};
}

View file

@ -1,52 +0,0 @@
# Quality of life plugins
{pkgs, ...}: {
programs.nixvim = {
extraPackages = with pkgs; [
ripgrep
yazi
fd
];
plugins = {
zen-mode.enable = true;
direnv.enable = true;
intellitab.enable = true;
guess-indent.enable = true;
vim-bbye.enable = true;
indent-blankline.enable = true;
which-key.enable = true;
nvim-autopairs.enable = true;
yanky = {
enable = true;
enableTelescope = true;
};
trouble.enable = true;
crates-nvim.enable = true;
# git stuff
lazygit.enable = true;
gitsigns.enable = true;
# Language specific tools
markdown-preview.enable = true;
};
extraPlugins = [
(pkgs.vimUtils.buildVimPlugin {
name = "satellite.nvim";
src = pkgs.fetchFromGitHub {
owner = "lewis6991";
repo = "satellite.nvim";
rev = "777ed56e1ef45ec808df701730b6597fc4fb0fbc";
hash = "sha256-04Js+9SB4VuCq/ACbNh5BZcolu8i8vlGU72qo5xxfpk=";
};
})
(pkgs.vimUtils.buildVimPlugin {
name = "render-markdown.nvim";
src = pkgs.fetchFromGitHub {
owner = "MeanderingProgrammer";
repo = "render-markdown.nvim";
rev = "7986be47531d652e950776536987e01dd5b55b94";
hash = "sha256-lc++IrXzEA3M2iUFZACAZOcH2EwVqX4p0fhET+en37o=";
};
})
];
};
}

View file

@ -1,9 +0,0 @@
# Manual setup for some plugins
{
programs.nixvim = {
extraConfigLua = ''
require("telescope").load_extension("yank_history")
vim.diagnostic.config({ virtual_lines = false });
'';
};
}

View file

@ -1,15 +0,0 @@
{
programs.nixvim = {
plugins = {
treesitter = {
enable = true;
settings = {
highlight.enable = true;
indent.enable = true;
folding.enable = true;
};
};
treesitter-context.enable = true;
};
};
}