add ssh config for work gitlab

improve neovim config with autocomplete
This commit is contained in:
Pim Kunis 2023-10-07 12:50:20 +02:00
parent 32e044df70
commit 159f5dfe75
2 changed files with 86 additions and 23 deletions

View file

@ -31,6 +31,7 @@ in
libreoffice libreoffice
nodePackages.pyright nodePackages.pyright
neofetch neofetch
gopls
]; ];
}; };
@ -56,6 +57,10 @@ in
vim-commentary vim-commentary
vim-sleuth vim-sleuth
gitsigns-nvim gitsigns-nvim
nvim-cmp
cmp-nvim-lsp
friendly-snippets
neodev-nvim
]; ];
extraLuaConfig = builtins.readFile ./neovim.lua; extraLuaConfig = builtins.readFile ./neovim.lua;
}; };
@ -72,7 +77,7 @@ in
id = 0; id = 0;
isDefault = true; isDefault = true;
settings = firefoxSettings; settings = firefoxSettings;
extensions = firefox-addons.default; # TODO: recursive extensions = firefox-addons.default;
}; };
sue = { sue = {
id = 1; id = 1;
@ -124,30 +129,35 @@ in
extraConfig = "User root"; extraConfig = "User root";
matchBlocks = { matchBlocks = {
"github.com" = lib.hm.dag.entryBefore [ "*" ] { gitlab-sue = lib.hm.dag.entryBefore [ "*" ] {
hostname = "gitlab.com";
identityFile = "~/.ssh/sue_ed25519";
identitiesOnly = true;
};
github = lib.hm.dag.entryBefore [ "*" ] {
hostname = "github.com"; hostname = "github.com";
user = "pizzapim"; user = "pizzapim";
identitiesOnly = true; identitiesOnly = true;
}; };
"lewis" = lib.hm.dag.entryBefore [ "*" ] { lewis = lib.hm.dag.entryBefore [ "*" ] {
hostname = "lewis.hyp"; hostname = "lewis.hyp";
}; };
"atlas" = lib.hm.dag.entryBefore [ "*" ] { atlas = lib.hm.dag.entryBefore [ "*" ] {
hostname = "atlas.hyp"; hostname = "atlas.hyp";
}; };
"jefke" = lib.hm.dag.entryBefore [ "*" ] { jefke = lib.hm.dag.entryBefore [ "*" ] {
hostname = "jefke.hyp"; hostname = "jefke.hyp";
}; };
"hermes" = lib.hm.dag.entryBefore [ "*" ] { hermes = lib.hm.dag.entryBefore [ "*" ] {
hostname = "hermes.dmz"; hostname = "hermes.dmz";
}; };
"maestro" = lib.hm.dag.entryBefore [ "*" ] { maestro = lib.hm.dag.entryBefore [ "*" ] {
hostname = "maestro.dmz"; hostname = "maestro.dmz";
}; };
"bancomart" = lib.hm.dag.entryBefore [ "*" ] { bancomart = lib.hm.dag.entryBefore [ "*" ] {
hostname = "bancomart.dmz"; hostname = "bancomart.dmz";
}; };
"handjecontantje" = lib.hm.dag.entryBefore [ "*" ] { handjecontantje = lib.hm.dag.entryBefore [ "*" ] {
hostname = "handjecontantje.dmz"; hostname = "handjecontantje.dmz";
}; };
}; };

View file

@ -10,22 +10,38 @@ vim.wo.cursorline = true
--[ LSPCONFIG ]-- --[ LSPCONFIG ]--
local opts = { noremap=true, silent=true } local on_attach = function(_, bufnr)
local on_attach = function(client, bufnr)
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') local bufmap = function(keys, func)
local bufopts = { noremap=true, silent=true, buffer=bufnr } vim.keymap.set('n', keys, func, { buffer = bufnr })
vim.keymap.set('n', '<leader>D', vim.lsp.buf.declaration, bufopts)
vim.keymap.set('n', '<leader>d', vim.lsp.buf.definition, bufopts)
vim.keymap.set('n', '<leader>h', vim.lsp.buf.hover, bufopts)
vim.keymap.set('n', '<leader>i', vim.lsp.buf.implementation, bufopts)
vim.keymap.set('n', '<leader>s', vim.lsp.buf.signature_help, bufopts)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
vim.keymap.set('n', '<leader>c', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', '<leader>fmt', function() vim.lsp.buf.format { async = true } end, bufopts)
end end
require'lspconfig'.nil_ls.setup{ on_attach = on_attach } bufmap('<leader>r', vim.lsp.buf.rename)
require'lspconfig'.pyright.setup{} bufmap('<leader>a', vim.lsp.buf.code_action)
bufmap('gd', vim.lsp.buf.definition)
bufmap('gD', vim.lsp.buf.declaration)
bufmap('gI', vim.lsp.buf.implementation)
bufmap('<leader>D', vim.lsp.buf.type_definition)
bufmap('gr', require('telescope.builtin').lsp_references)
bufmap('<leader>s', require('telescope.builtin').lsp_document_symbols)
bufmap('<leader>S', require('telescope.builtin').lsp_dynamic_workspace_symbols)
bufmap('K', vim.lsp.buf.hover)
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
vim.lsp.buf.format()
end, {})
end
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
require('neodev').setup()
require'lspconfig'.nil_ls.setup{ on_attach = on_attach, capabilities = capabilities }
require'lspconfig'.pyright.setup{ on_attach = on_attach, capabilities = capabilities }
require'lspconfig'.gopls.setup{ on_attach = on_attach, capabilities = capabilities }
--[ LEAP ]-- --[ LEAP ]--
@ -69,3 +85,40 @@ vim.cmd([[autocmd FileType nix setlocal commentstring=#\ %s]])
--[ GITSIGNS ]-- --[ GITSIGNS ]--
require("gitsigns").setup() require("gitsigns").setup()
--[ CMP ]--
-- For snippets: look at https://github.com/vimjoyer/nvim-nix-video/blob/main/nvim/plugin/cmp.lua
local cmp = require('cmp')
cmp.setup {
mapping = cmp.mapping.preset.insert {
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete {},
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end, { 'i', 's' }),
},
sources = {
{ name = 'nvim_lsp' },
},
}