fix(nvim): defer vim calls
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-12-22 12:42:29 -05:00
parent 57e1f9a17c
commit ae8e828514
11 changed files with 39 additions and 20 deletions

Binary file not shown.

BIN
flake.nix

Binary file not shown.

View file

@ -29,8 +29,9 @@ in {
if (devShells['c-lang'] == nil) then if (devShells['c-lang'] == nil) then
devShells['c-lang'] = 1; devShells['c-lang'] = 1;
require('nix-develop').nix_develop({'${flakeEnv}#c-lang'}); require('nix-develop').nix_develop({'${flakeEnv}#c-lang'}, vim.schedule_wrap(function()
vim.cmd[[LspStart]]; vim.cmd[[LspStart]];
end));
end end
end, end,
}); });

View file

@ -70,11 +70,10 @@ in {
if (devShells['csharp'] == nil) then if (devShells['csharp'] == nil) then
devShells['csharp'] = 1; devShells['csharp'] = 1;
require('nix-develop').nix_develop({'${flakeEnv}#csharp'}); require('nix-develop').nix_develop({'${flakeEnv}#csharp'}, vim.schedule_wrap(function()
startRoslyn(); startRoslyn();
os.execute('sleep 1')
vim.cmd[[e]]; -- reload to attach on current file vim.cmd[[e]]; -- reload to attach on current file
end));
end end
end, end,
}); });

View file

@ -4,6 +4,9 @@ self: {
pkgs, pkgs,
... ...
}: let }: let
inherit (self.inputs) nix-develop-nvim-src;
inherit (self.lib.${pkgs.system}) mkVersion;
inherit (lib) fileContents mkBefore mkIf; inherit (lib) fileContents mkBefore mkIf;
cfg = config.programs.neovim; cfg = config.programs.neovim;
@ -63,7 +66,6 @@ in {
# lsp plugins # lsp plugins
nvim-lspconfig nvim-lspconfig
lsp-status-nvim lsp-status-nvim
nix-develop-nvim
# completion plugins # completion plugins
cmp-buffer cmp-buffer
cmp-nvim-lsp cmp-nvim-lsp
@ -73,6 +75,12 @@ in {
; ;
}) })
++ [ ++ [
# FIXME: defer inside plugin instead
(pkgs.vimPlugins.nix-develop-nvim.overrideAttrs (o: {
name = "vimplugin-${o.pname}-${mkVersion nix-develop-nvim-src}";
src = nix-develop-nvim-src;
}))
{ {
plugin = pkgs.vimPlugins.nvim-cmp; plugin = pkgs.vimPlugins.nvim-cmp;
type = "lua"; type = "lua";

View file

@ -23,8 +23,9 @@ in {
if (devShells['json'] == nil) then if (devShells['json'] == nil) then
devShells['json'] = 1; devShells['json'] = 1;
require('nix-develop').nix_develop({'${flakeEnv}#json'}); require('nix-develop').nix_develop({'${flakeEnv}#json'}, vim.schedule_wrap(function()
vim.cmd[[LspStart]]; vim.cmd[[LspStart]];
end));
end end
end, end,
}); });

View file

@ -31,8 +31,9 @@ in {
if (devShells['lua'] == nil) then if (devShells['lua'] == nil) then
devShells['lua'] = 1; devShells['lua'] = 1;
require('nix-develop').nix_develop({'${flakeEnv}#lua'}); require('nix-develop').nix_develop({'${flakeEnv}#lua'}, vim.schedule_wrap(function()
vim.cmd[[LspStart]]; vim.cmd[[LspStart]];
end));
end end
end, end,
}); });

View file

@ -35,8 +35,9 @@ in {
if (devShells['markdown'] == nil) then if (devShells['markdown'] == nil) then
devShells['markdown'] = 1; devShells['markdown'] = 1;
require('nix-develop').nix_develop({'${flakeEnv}#markdown'}); require('nix-develop').nix_develop({'${flakeEnv}#markdown'}, vim.schedule_wrap(function()
vim.cmd[[LspStart]]; vim.cmd[[LspStart]];
end));
end end
end, end,
}); });

View file

@ -23,8 +23,9 @@ in {
if (devShells['rust'] == nil) then if (devShells['rust'] == nil) then
devShells['rust'] = 1; devShells['rust'] = 1;
require('nix-develop').nix_develop({'${flakeEnv}#rust'}); require('nix-develop').nix_develop({'${flakeEnv}#rust'}, vim.schedule_wrap(function()
vim.cmd[[LspStart]]; vim.cmd[[LspStart]];
end));
end end
end, end,
}); });

View file

@ -29,8 +29,9 @@ in {
if (devShells['web'] == nil) then if (devShells['web'] == nil) then
devShells['web'] = 1; devShells['web'] = 1;
require('nix-develop').nix_develop({'${flakeEnv}#web'}); require('nix-develop').nix_develop({'${flakeEnv}#web'}, vim.schedule_wrap(function()
vim.cmd[[LspStart]]; vim.cmd[[LspStart]];
end));
end end
end, end,
}); });
@ -44,8 +45,9 @@ in {
if (devShells['web'] == nil) then if (devShells['web'] == nil) then
devShells['web'] = 1; devShells['web'] = 1;
require('nix-develop').nix_develop({'${flakeEnv}#web'}); require('nix-develop').nix_develop({'${flakeEnv}#web'}, vim.schedule_wrap(function()
vim.cmd[[LspStart]]; vim.cmd[[LspStart]];
end));
end end
end, end,
}); });

View file

@ -281,6 +281,11 @@ let
owner = "seblj"; owner = "seblj";
repo = "roslyn.nvim"; repo = "roslyn.nvim";
} }
{
name = "nix-develop-nvim-src";
owner = "matt1432";
repo = "nix-develop.nvim";
}
# Overlays & packages # Overlays & packages
{ {