2024-11-22 02:48:41 -05:00
|
|
|
self: {
|
2024-12-21 23:34:10 -05:00
|
|
|
config,
|
2024-05-08 23:04:16 -04:00
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
2024-12-22 12:42:29 -05:00
|
|
|
inherit (self.inputs) nix-develop-nvim-src;
|
|
|
|
inherit (self.lib.${pkgs.system}) mkVersion;
|
|
|
|
|
2024-12-21 23:34:10 -05:00
|
|
|
inherit (lib) fileContents mkBefore mkIf;
|
|
|
|
|
|
|
|
cfg = config.programs.neovim;
|
2024-05-08 23:04:16 -04:00
|
|
|
in {
|
2024-05-07 22:49:00 -04:00
|
|
|
imports = [
|
2024-12-21 21:49:59 -05:00
|
|
|
./bash
|
|
|
|
./c-lang
|
|
|
|
./hyprlang
|
|
|
|
./java
|
|
|
|
./json
|
|
|
|
./lua
|
|
|
|
./python
|
|
|
|
./rust
|
2024-12-16 17:44:17 -05:00
|
|
|
|
2024-12-21 21:49:59 -05:00
|
|
|
(import ./csharp self)
|
|
|
|
(import ./markdown self)
|
|
|
|
(import ./nix-lang self)
|
|
|
|
(import ./web self)
|
2024-05-07 22:49:00 -04:00
|
|
|
];
|
2024-05-08 23:04:16 -04:00
|
|
|
|
2024-12-21 23:34:10 -05:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
programs.neovim = {
|
2024-05-10 14:18:50 -04:00
|
|
|
extraLuaConfig =
|
2024-08-31 19:16:06 -04:00
|
|
|
mkBefore
|
2024-06-09 22:49:30 -04:00
|
|
|
# lua
|
2024-05-08 23:04:16 -04:00
|
|
|
''
|
2024-12-22 03:12:45 -05:00
|
|
|
-- Init object to keep track of loaded devShells
|
|
|
|
local devShells = {};
|
|
|
|
|
2024-05-08 23:04:16 -04:00
|
|
|
-- Add formatting cmd
|
|
|
|
vim.api.nvim_create_user_command(
|
|
|
|
'Format',
|
|
|
|
function()
|
|
|
|
vim.lsp.buf.format({ async = true });
|
|
|
|
end,
|
|
|
|
{}
|
|
|
|
);
|
|
|
|
|
2024-05-08 23:56:56 -04:00
|
|
|
-- LSP-Status setup
|
|
|
|
local lsp_status = require('lsp-status');
|
|
|
|
lsp_status.register_progress();
|
|
|
|
|
2024-05-08 23:04:16 -04:00
|
|
|
-- Remove LSP highlighting to use Treesitter
|
2024-07-28 02:54:34 -04:00
|
|
|
vim.api.nvim_create_autocmd('LspAttach', {
|
2024-05-08 23:04:16 -04:00
|
|
|
callback = function(args)
|
2024-05-08 23:56:56 -04:00
|
|
|
local client = vim.lsp.get_client_by_id(args.data.client_id);
|
|
|
|
client.server_capabilities.semanticTokensProvider = nil;
|
|
|
|
lsp_status.on_attach(client);
|
2024-05-08 23:04:16 -04:00
|
|
|
end,
|
|
|
|
});
|
|
|
|
'';
|
2024-05-11 15:07:24 -04:00
|
|
|
|
2024-07-28 02:54:34 -04:00
|
|
|
plugins =
|
2024-08-31 19:16:06 -04:00
|
|
|
(builtins.attrValues {
|
|
|
|
inherit
|
|
|
|
(pkgs.vimPlugins)
|
2024-12-21 22:30:38 -05:00
|
|
|
# lsp plugins
|
2024-08-31 19:16:06 -04:00
|
|
|
nvim-lspconfig
|
|
|
|
lsp-status-nvim
|
2024-12-21 22:30:38 -05:00
|
|
|
# completion plugins
|
2024-08-31 19:16:06 -04:00
|
|
|
cmp-buffer
|
|
|
|
cmp-nvim-lsp
|
|
|
|
cmp-path
|
|
|
|
cmp-spell
|
|
|
|
vim-vsnip
|
|
|
|
;
|
|
|
|
})
|
2024-07-28 02:54:34 -04:00
|
|
|
++ [
|
2024-12-22 12:42:29 -05:00
|
|
|
(pkgs.vimPlugins.nix-develop-nvim.overrideAttrs (o: {
|
|
|
|
name = "vimplugin-${o.pname}-${mkVersion nix-develop-nvim-src}";
|
|
|
|
src = nix-develop-nvim-src;
|
|
|
|
}))
|
|
|
|
|
2024-07-28 02:54:34 -04:00
|
|
|
{
|
2024-08-31 19:16:06 -04:00
|
|
|
plugin = pkgs.vimPlugins.nvim-cmp;
|
2024-07-28 02:54:34 -04:00
|
|
|
type = "lua";
|
2024-12-21 21:49:59 -05:00
|
|
|
config = fileContents ./config/cmp.lua;
|
2024-07-28 02:54:34 -04:00
|
|
|
}
|
2024-05-11 15:07:24 -04:00
|
|
|
|
2024-07-28 02:54:34 -04:00
|
|
|
{
|
2024-08-31 19:16:06 -04:00
|
|
|
plugin = pkgs.vimPlugins.nvim-autopairs;
|
2024-07-28 02:54:34 -04:00
|
|
|
type = "lua";
|
|
|
|
config =
|
|
|
|
# lua
|
2024-08-31 19:16:06 -04:00
|
|
|
''
|
|
|
|
require('nvim-autopairs').setup({});
|
|
|
|
'';
|
2024-07-28 02:54:34 -04:00
|
|
|
}
|
2024-12-21 22:30:38 -05:00
|
|
|
|
|
|
|
{
|
|
|
|
plugin = pkgs.vimPlugins.lsp_lines-nvim;
|
|
|
|
type = "lua";
|
|
|
|
config =
|
|
|
|
# lua
|
|
|
|
''
|
|
|
|
-- Disable virtual_text since it's redundant due to lsp_lines.
|
|
|
|
vim.diagnostic.config({
|
|
|
|
virtual_text = false,
|
|
|
|
});
|
|
|
|
|
|
|
|
require('lsp_lines').setup();
|
|
|
|
'';
|
|
|
|
}
|
2024-07-28 02:54:34 -04:00
|
|
|
];
|
2024-05-08 23:04:16 -04:00
|
|
|
};
|
|
|
|
};
|
2024-11-22 02:48:41 -05:00
|
|
|
|
|
|
|
# For accurate stack trace
|
|
|
|
_file = ./default.nix;
|
2024-05-07 22:49:00 -04:00
|
|
|
}
|