parent
e4c9f45ab2
commit
3e2cac125b
15 changed files with 342 additions and 395 deletions
homeManagerModules/neovim/langs/golang
|
@ -6,7 +6,6 @@
|
|||
inherit (lib) mkIf;
|
||||
|
||||
cfg = config.programs.neovim;
|
||||
flakeEnv = config.programs.bash.sessionVariables.FLAKE;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
programs = {
|
||||
|
@ -15,28 +14,19 @@ in {
|
|||
# lua
|
||||
''
|
||||
--
|
||||
local lsp = require('lspconfig');
|
||||
local default_capabilities = require('cmp_nvim_lsp').default_capabilities();
|
||||
|
||||
lsp.gopls.setup({
|
||||
capabilities = default_capabilities,
|
||||
autostart = false,
|
||||
});
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'FileType', 'BufEnter' }, {
|
||||
loadDevShell({
|
||||
name = 'golang',
|
||||
pattern = { 'go', 'gomod', 'gowork', 'gotmpl' },
|
||||
|
||||
callback = function()
|
||||
pre_shell_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,
|
||||
language_servers = {
|
||||
gopls = function()
|
||||
vim.lsp.start(vim.tbl_deep_extend('force', vim.lsp.config['gopls'], {
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||
}));
|
||||
end,
|
||||
},
|
||||
});
|
||||
'';
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue