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
devShells['c-lang'] = 1;
require('nix-develop').nix_develop({'${flakeEnv}#c-lang'});
vim.cmd[[LspStart]];
require('nix-develop').nix_develop({'${flakeEnv}#c-lang'}, vim.schedule_wrap(function()
vim.cmd[[LspStart]];
end));
end
end,
});

View file

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

View file

@ -4,6 +4,9 @@ self: {
pkgs,
...
}: let
inherit (self.inputs) nix-develop-nvim-src;
inherit (self.lib.${pkgs.system}) mkVersion;
inherit (lib) fileContents mkBefore mkIf;
cfg = config.programs.neovim;
@ -63,7 +66,6 @@ in {
# lsp plugins
nvim-lspconfig
lsp-status-nvim
nix-develop-nvim
# completion plugins
cmp-buffer
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;
type = "lua";

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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