parent
8cd000fb6b
commit
3a687ae95c
19 changed files with 64 additions and 11 deletions
homeManagerModules/neovim/langs/golang
|
@ -1,27 +1,42 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
|
||||
cfg = config.programs.neovim;
|
||||
flakeEnv = config.programs.bash.sessionVariables.FLAKE;
|
||||
in {
|
||||
config = mkIf (cfg.enable && cfg.ideConfig.enableGolang) {
|
||||
config = mkIf cfg.enable {
|
||||
programs = {
|
||||
neovim = {
|
||||
extraPackages = with pkgs; [go gopls];
|
||||
|
||||
extraLuaConfig =
|
||||
# lua
|
||||
''
|
||||
--
|
||||
local lsp = require('lspconfig');
|
||||
local default_capabilities = require('cmp_nvim_lsp').default_capabilities();
|
||||
|
||||
lsp.gopls.setup({
|
||||
cmd = { '${pkgs.gopls}/bin/gopls' },
|
||||
capabilities = default_capabilities,
|
||||
autostart = false,
|
||||
});
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'FileType', 'BufEnter' }, {
|
||||
pattern = { 'go', 'gomod', 'gowork', 'gotmpl' },
|
||||
|
||||
callback = function()
|
||||
vim.cmd[[setlocal ts=4 sw=4 sts=0 expandtab]];
|
||||
|
||||
if (devShells['golang'] == nil) then
|
||||
devShells['golang'] = 1;
|
||||
|
||||
require('nix-develop').nix_develop_extend({'${flakeEnv}#golang'}, function()
|
||||
vim.cmd[[LspStart]];
|
||||
end);
|
||||
end
|
||||
end,
|
||||
});
|
||||
'';
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue