home/nvim: migrate more config to nixvim

This commit is contained in:
chayleaf 2024-10-10 03:58:53 +07:00
parent 4361c9e694
commit 5575582b6d
Signed by: chayleaf
GPG key ID: 78171AD46227E68E

View file

@ -76,9 +76,20 @@
{ plugin = ps.vim-svelte; } { plugin = ps.vim-svelte; }
# vim-nix isn't necessary for syntax highlighting, but it improves overall editing experience # vim-nix isn't necessary for syntax highlighting, but it improves overall editing experience
{ plugin = ps.vim-nix; } { plugin = ps.vim-nix; }
{ settings.colorschemes.vscode = { # the latest version of vscode-nvim has breaking changes and i'm too lazy to migrate
enable = true; # FIXME: migrate
settings = { { plugin = pkgs.vimUtils.buildVimPlugin {
pname = "vscode-nvim";
version = "2023-02-10";
src = pkgs.fetchFromGitHub {
owner = "Mofiqul";
repo = "vscode.nvim";
rev = "db9ee339b5556aa832ca58871fd18f9467a18520";
sha256 = "sha256-X2IgIjO5NNq7vJdl09hBY1TFqHlsfF1xfllKr4osILI=";
};
};
config = [
((REQ "vscode").setup {
transparent = true; transparent = true;
color_overrides = { color_overrides = {
vscGray = "#745b5f"; vscGray = "#745b5f";
@ -95,21 +106,17 @@
vscYellow = "#${config.colors.yellow}"; vscYellow = "#${config.colors.yellow}";
vscPink = "#cf83c4"; vscPink = "#cf83c4";
}; };
}; })
};
config = [
(vim.api.nvim_set_hl 0 "NormalFloat" { (vim.api.nvim_set_hl 0 "NormalFloat" {
bg = "NONE"; bg = "NONE";
}) })
]; } ]; }
{ plugin = ps.nvim-web-devicons; { settings.plugins.web-devicons.enable = true; }
config = ((REQ "nvim-web-devicons").setup { }); } { settings.plugins.nvim-tree.enable = true;
{ plugin = ps.nvim-tree-lua; settings.globalOpts.termguicolors = true;
settings.globals.loaded_netrw = 1;
settings.globals.loaded_netrwPlugin = 1;
config = (LET (REQ "nvim-tree") (REQ "nvim-tree.api") (nvim-tree: nvim-tree-api: [ config = (LET (REQ "nvim-tree") (REQ "nvim-tree.api") (nvim-tree: nvim-tree-api: [
(SET (vimg "loaded_netrw") 1)
(SET (vimg "loaded_netrwPlugin") 1)
(SET vim.o.termguicolors true)
(nvim-tree.setup { }) # :help nvim-tree-setup
(kmSetNs { (kmSetNs {
"<C-N>" = { "<C-N>" = {
rhs = nvim-tree-api.tree.toggle; rhs = nvim-tree-api.tree.toggle;
@ -117,9 +124,10 @@
}; };
}) })
])); } ])); }
{ plugin = ps.vim-sleuth; } { settings.plugins.sleuth.enable = true; }
{ plugin = ps.luasnip; } { settings.plugins.luasnip.enable = true; }
{ plugin = ps.nvim-cmp; { plugin = ps.nvim-cmp;
settings.plugins.cmp.enable = false;
config = let config = let
border = (name: [ border = (name: [
[ "" name ] [ "" name ]
@ -193,10 +201,11 @@
]; ];
} }
)); } )); }
{ plugin = ps.lspkind-nvim; } { settings.plugins.lspkind.enable = true; }
{ plugin = ps.cmp_luasnip; } { settings.plugins.cmp_luasnip.enable = true; }
{ plugin = ps.cmp-nvim-lsp; } { settings.plugins.cmp-nvim-lsp.enable = true; }
{ plugin = ps.nvim-autopairs; { plugin = ps.nvim-autopairs;
settings.plugins.nvim-autopairs.enable = false;
config = (LET config = (LET
(REQ "cmp") (REQ "nvim-autopairs.completion.cmp") (REQ "nvim-autopairs") (REQ "cmp") (REQ "nvim-autopairs.completion.cmp") (REQ "nvim-autopairs")
(cmp: cmp-autopairs: nvim-autopairs: (cmp: cmp-autopairs: nvim-autopairs:
@ -206,9 +215,9 @@
}) })
(cmp.event.on cmp.event "confirm_done" (cmp-autopairs.on_confirm_done { })) (cmp.event.on cmp.event "confirm_done" (cmp-autopairs.on_confirm_done { }))
])); } ])); }
{ plugin = ps.comment-nvim; { settings.plugins.comment.enable = true;
config = [ config = [
((REQ "Comment").setup { }) # ((REQ "Comment").setup { })
(kmSetNs { (kmSetNs {
"<space>/" = { "<space>/" = {
# metatables...... # metatables......
@ -224,6 +233,7 @@
}) })
]; } ]; }
{ plugin = ps.nvim-lspconfig; { plugin = ps.nvim-lspconfig;
settings.plugins.lsp.enable = false;
config = ( config = (
let lsp = name: builtins.seq let lsp = name: builtins.seq
# ensure an lsp exists (otherwise lspconfig will still create an empty config for some reason) # ensure an lsp exists (otherwise lspconfig will still create an empty config for some reason)
@ -367,12 +377,9 @@
]) # END ]) # END
)) # END )) # END
]); } ]); }
{ plugin = ps.which-key-nvim; { settings.plugins.which-key.enable = true;
config = [ settings.globalOpts.timeout = true;
(SET vim.o.timeout true) settings.globalOpts.timeoutlen = 500; }
(SET vim.o.timeoutlen 500)
(which-key.setup { })
]; }
]; ];
in lib.mkMerge ((builtins.concatLists (map (x: lib.toList (x.settings or [ ])) plugins)) ++ lib.toList { in lib.mkMerge ((builtins.concatLists (map (x: lib.toList (x.settings or [ ])) plugins)) ++ lib.toList {
enable = true; enable = true;