fix: neovim

This commit is contained in:
DACHXY 2025-01-02 22:17:54 +08:00
parent 08451237fe
commit e63917ca85
11 changed files with 104 additions and 89 deletions

78
home/user/neovim.nix Normal file
View file

@ -0,0 +1,78 @@
{ pkgs, ... }:
let
treesitterWithGrammars = (pkgs.vimPlugins.nvim-treesitter.withPlugins (p: [
p.bash
p.comment
p.css
p.dockerfile
p.fish
p.gitattributes
p.gitignore
p.go
p.gomod
p.gowork
p.hcl
p.javascript
p.jq
p.json5
p.json
p.lua
p.make
p.markdown
p.nix
p.python
p.rust
p.toml
p.typescript
p.vue
p.yaml
]));
treesitter-parsers = pkgs.symlinkJoin {
name = "treesitter-parsers";
paths = treesitterWithGrammars.dependencies;
};
configDir = ../config;
in
{
home.packages = with pkgs; [
ripgrep
fd
lua-language-server
black
nodejs_22
gh
];
programs.neovim = {
enable = true;
vimAlias = true;
coc.enable = false;
withNodeJs = true;
plugins = [
treesitterWithGrammars
];
extraPackages = [ pkgs.imagemagick ];
extraLuaPackages = ps: with ps; [ magick ];
};
home.file."./.config/nvim" = {
source = "${configDir}/nvim";
recursive = true;
};
home.file."./.config/nvim/init.lua".text = ''
require("config.lazy")
vim.opt.runtimepath:append("${treesitter-parsers}")
'';
# Treesitter is configured as a locally developed module in lazy.nvim
# we hardcode a symlink here so that we can refer to it in our lazy config
home.file."./.local/share/nvim/nix/extras/" = {
recursive = true;
source = treesitterWithGrammars;
};
}