feat: add neovim configuration by nixvim

This commit is contained in:
Youwen Wu 2024-08-17 04:49:37 -07:00
parent 16ca570751
commit fee4623629
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
4 changed files with 557 additions and 7 deletions

View file

@ -91,6 +91,27 @@
"type": "github"
}
},
"devshell": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1722113426,
"narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=",
"owner": "numtide",
"repo": "devshell",
"rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-compat": {
"locked": {
"lastModified": 1688025799,
@ -122,6 +143,20 @@
"type": "github"
}
},
"flake-compat_3": {
"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-parts": {
"inputs": {
"nixpkgs-lib": [
@ -143,6 +178,27 @@
"type": "github"
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
},
"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-utils": {
"inputs": {
"systems": "systems"
@ -197,6 +253,24 @@
"type": "github"
}
},
"flake-utils_4": {
"inputs": {
"systems": "systems_4"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flakey-profile": {
"locked": {
"lastModified": 1712898590,
@ -212,6 +286,36 @@
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": [
"nixvim",
"flake-compat"
],
"gitignore": "gitignore_2",
"nixpkgs": [
"nixvim",
"nixpkgs"
],
"nixpkgs-stable": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1723202784,
"narHash": "sha256-qbhjc/NEGaDbyy0ucycubq4N3//gDFFH3DOmp1D3u1Q=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "c7012d0c18567c889b948781bc74a501e92275d1",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
@ -234,6 +338,28 @@
"type": "github"
}
},
"gitignore_2": {
"inputs": {
"nixpkgs": [
"nixvim",
"git-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": [
@ -254,6 +380,27 @@
"type": "github"
}
},
"home-manager_2": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1723399884,
"narHash": "sha256-97wn0ihhGqfMb8WcUgzzkM/TuAxce2Gd20A8oiruju4=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "086f619dd991a4d355c07837448244029fc2d9ab",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"homebrew-cask": {
"flake": false,
"locked": {
@ -386,6 +533,27 @@
"type": "github"
}
},
"nix-darwin_3": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1722924007,
"narHash": "sha256-+CQDamNwqO33REJLft8c26NbUi2Td083hq6SvAm2xkU=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "91010a5613ffd7ee23ee9263213157a1c422b705",
"type": "github"
},
"original": {
"owner": "lnl7",
"repo": "nix-darwin",
"type": "github"
}
},
"nix-homebrew": {
"inputs": {
"brew-src": "brew-src",
@ -468,6 +636,56 @@
"type": "github"
}
},
"nixvim": {
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat_3",
"flake-parts": "flake-parts_2",
"git-hooks": "git-hooks",
"home-manager": "home-manager_2",
"nix-darwin": "nix-darwin_3",
"nixpkgs": [
"nixpkgs"
],
"nuschtosSearch": "nuschtosSearch",
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1723816538,
"narHash": "sha256-h37ltjdifkd7iLtMtBXSBBeYSTuBEKMW6ClFoC7nReQ=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "00f32f0430f82c74919c72af84bc95bf5ae434e4",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixvim",
"type": "github"
}
},
"nuschtosSearch": {
"inputs": {
"flake-utils": "flake-utils_4",
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1723367906,
"narHash": "sha256-v1qA4WBGDI2uH/TVqRwuXSBP341W681psbzYJ8zrjog=",
"owner": "NuschtOS",
"repo": "search",
"rev": "6ca2c3ae05a915c160512bd41f6810f456c9b30d",
"type": "github"
},
"original": {
"owner": "NuschtOS",
"repo": "search",
"type": "github"
}
},
"pre-commit-hooks-nix": {
"inputs": {
"flake-compat": [
@ -508,6 +726,7 @@
"nix-darwin": "nix-darwin",
"nix-homebrew": "nix-homebrew",
"nixpkgs": "nixpkgs_3",
"nixvim": "nixvim",
"stablepkgs": "stablepkgs"
}
},
@ -612,6 +831,42 @@
"repo": "default",
"type": "github"
}
},
"systems_4": {
"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": 1723454642,
"narHash": "sha256-S0Gvsenh0II7EAaoc9158ZB4vYyuycvMGKGxIbERNAM=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "349de7bc435bdff37785c2466f054ed1766173be",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},
"root": "root",

View file

@ -35,6 +35,10 @@
url = "github:tpwrules/nixos-apple-silicon";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
@ -79,8 +83,10 @@
./users/youwen/linux/packages/x86_64
./users/youwen/linux/programs
./users/youwen/common/neofetch
./users/youwen/common/neovim
./users/youwen/common
inputs.catppuccin.homeManagerModules.catppuccin
inputs.nixvim.homeManagerModules.nixvim
];
};
}
@ -111,8 +117,10 @@
./users/youwen/common/neofetch/asahi-only.nix
./users/youwen/linux/laptop
./users/youwen/linux/packages/aarch-64
./users/youwen/common/neovim
inputs.catppuccin.homeManagerModules.catppuccin
inputs.nixvim.homeManagerModules.nixvim
];
};
}
@ -151,10 +159,12 @@
./users/youwen/linux/laptop
./users/youwen/linux/packages/x86_64
./users/youwen/linux/programs
./users/youwen/common/neovim
./users/youwen/common
./users/youwen/common/neofetch
./hosts/adrastea/home-manager-overrides.nix
inputs.catppuccin.homeManagerModules.catppuccin
inputs.nixvim.homeManagerModules.nixvim
];
};
}
@ -177,6 +187,7 @@
./users/youwen/darwin/darwin-home.nix
./users/youwen/common/core.nix
./users/youwen/common/neofetch
./users/youwen/common/neovim
];
home-manager.backupFileExtension = "backup";

View file

@ -147,11 +147,4 @@
enableFishIntegration = true;
enableBashIntegration = true;
};
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
};
}

View file

@ -0,0 +1,291 @@
{pkgs, ...}: {
programs.nixvim = {
enable = true;
viAlias = true;
vimAlias = true;
withNodeJs = true;
withRuby = true;
extraPackages = with pkgs; [alejandra black stylua codespell];
luaLoader.enable = true;
colorschemes.gruvbox.enable = true;
opts = {
showmode = false;
};
globals = {
mapleader = " ";
};
keymaps = [
{
# Unmap space (leader)
action = "<nop>";
key = "<Leader>";
options = {
noremap = true;
silent = true;
};
mode = "n";
}
{
action = "<cmd>sp<CR>";
key = "<Leader>-";
options.silent = true;
options.desc = "Split window horizontally";
}
{
action = "<cmd>vsp<CR>";
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 = "<cmd>lua require'conform'.format({ bufnr = args.bf })<CR>";
# key = "<Leader>cf";
# options = {
# silent = true;
# noremap = true;
# desc = "Format buffer";
# };
# }
];
plugins = {
lualine = {
enable = true;
globalstatus = true;
};
lsp = {
enable = true;
inlayHints = true;
servers = {
bashls.enable = true;
clangd.enable = true;
hls.enable = true;
pyright.enable = true;
nixd.enable = true;
nushell.enable = true;
svelte.enable = true;
tailwindcss.enable = true;
typst-lsp.enable = true;
rust-analyzer = {
enable = true;
installCargo = true;
installRustc = true;
};
marksman.enable = true;
};
};
presence-nvim = {
enable = true;
editingText = "Hacking %s";
workspaceText = "The One True Text Editor";
buttons = [
{
label = "GitHub";
url = "https://github.com/youwen5";
}
{
label = "Code Forge";
url = "https://code.youwen.dev/";
}
];
};
treesitter = {
enable = true;
settings = {
highlight.enable = true;
indent.enable = true;
};
};
wakatime.enable = true;
lazygit.enable = true;
intellitab.enable = true;
guess-indent.enable = true;
indent-blankline.enable = true;
which-key.enable = true;
zen-mode.enable = true;
markdown-preview.enable = true;
yanky = {
enable = true;
enableTelescope = true;
};
telescope = {
enable = true;
};
mini = {
enable = true;
modules = {
surround = {};
pairs = {};
ai = {};
hipatterns = {};
notify = {};
tabline = {};
trailspace = {};
comment = {};
};
};
trouble.enable = true;
direnv.enable = true;
cmp = {
enable = true;
settings = {
mapping = {
"<C-Space>" = "cmp.mapping.complete()";
"<C-b>" = "cmp.mapping.scroll_docs(-4)";
"<C-e>" = "cmp.mapping.close()";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<C-p>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
"<C-n>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
"<Tab>" = "cmp.mapping.confirm({ select = true })";
};
completion.autocomplete = [
"require('cmp.types').cmp.TriggerEvent.TextChanged"
];
};
};
cmp-async-path.enable = true;
cmp-buffer.enable = true;
cmp-conventionalcommits.enable = true;
cmp-git.enable = true;
cmp-nvim-lsp.enable = true;
crates-nvim.enable = true;
conform-nvim = {
enable = true;
formatOnSave = {
timeoutMs = 500;
lspFallback = true;
};
formattersByFt = {
lua = ["stylua"];
python = ["black"];
nix = ["alejandra"];
"*" = ["codespell"];
"_" = ["trim_whitespace"];
};
};
};
};
}