add ssh config for work gitlab
improve neovim config with autocomplete
This commit is contained in:
parent
32e044df70
commit
159f5dfe75
2 changed files with 86 additions and 23 deletions
28
home.nix
28
home.nix
|
@ -31,6 +31,7 @@ in
|
|||
libreoffice
|
||||
nodePackages.pyright
|
||||
neofetch
|
||||
gopls
|
||||
];
|
||||
};
|
||||
|
||||
|
@ -56,6 +57,10 @@ in
|
|||
vim-commentary
|
||||
vim-sleuth
|
||||
gitsigns-nvim
|
||||
nvim-cmp
|
||||
cmp-nvim-lsp
|
||||
friendly-snippets
|
||||
neodev-nvim
|
||||
];
|
||||
extraLuaConfig = builtins.readFile ./neovim.lua;
|
||||
};
|
||||
|
@ -72,7 +77,7 @@ in
|
|||
id = 0;
|
||||
isDefault = true;
|
||||
settings = firefoxSettings;
|
||||
extensions = firefox-addons.default; # TODO: recursive
|
||||
extensions = firefox-addons.default;
|
||||
};
|
||||
sue = {
|
||||
id = 1;
|
||||
|
@ -124,30 +129,35 @@ in
|
|||
extraConfig = "User root";
|
||||
|
||||
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";
|
||||
user = "pizzapim";
|
||||
identitiesOnly = true;
|
||||
};
|
||||
"lewis" = lib.hm.dag.entryBefore [ "*" ] {
|
||||
lewis = lib.hm.dag.entryBefore [ "*" ] {
|
||||
hostname = "lewis.hyp";
|
||||
};
|
||||
"atlas" = lib.hm.dag.entryBefore [ "*" ] {
|
||||
atlas = lib.hm.dag.entryBefore [ "*" ] {
|
||||
hostname = "atlas.hyp";
|
||||
};
|
||||
"jefke" = lib.hm.dag.entryBefore [ "*" ] {
|
||||
jefke = lib.hm.dag.entryBefore [ "*" ] {
|
||||
hostname = "jefke.hyp";
|
||||
};
|
||||
"hermes" = lib.hm.dag.entryBefore [ "*" ] {
|
||||
hermes = lib.hm.dag.entryBefore [ "*" ] {
|
||||
hostname = "hermes.dmz";
|
||||
};
|
||||
"maestro" = lib.hm.dag.entryBefore [ "*" ] {
|
||||
maestro = lib.hm.dag.entryBefore [ "*" ] {
|
||||
hostname = "maestro.dmz";
|
||||
};
|
||||
"bancomart" = lib.hm.dag.entryBefore [ "*" ] {
|
||||
bancomart = lib.hm.dag.entryBefore [ "*" ] {
|
||||
hostname = "bancomart.dmz";
|
||||
};
|
||||
"handjecontantje" = lib.hm.dag.entryBefore [ "*" ] {
|
||||
handjecontantje = lib.hm.dag.entryBefore [ "*" ] {
|
||||
hostname = "handjecontantje.dmz";
|
||||
};
|
||||
};
|
||||
|
|
81
neovim.lua
81
neovim.lua
|
@ -10,22 +10,38 @@ vim.wo.cursorline = true
|
|||
|
||||
--[ LSPCONFIG ]--
|
||||
|
||||
local opts = { noremap=true, silent=true }
|
||||
local on_attach = function(client, bufnr)
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
local bufopts = { noremap=true, silent=true, 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)
|
||||
local on_attach = function(_, bufnr)
|
||||
|
||||
local bufmap = function(keys, func)
|
||||
vim.keymap.set('n', keys, func, { buffer = bufnr })
|
||||
end
|
||||
|
||||
bufmap('<leader>r', vim.lsp.buf.rename)
|
||||
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
|
||||
|
||||
require'lspconfig'.nil_ls.setup{ on_attach = on_attach }
|
||||
require'lspconfig'.pyright.setup{}
|
||||
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 ]--
|
||||
|
||||
|
@ -69,3 +85,40 @@ vim.cmd([[autocmd FileType nix setlocal commentstring=#\ %s]])
|
|||
|
||||
--[ GITSIGNS ]--
|
||||
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' },
|
||||
},
|
||||
}
|
||||
|
|
Reference in a new issue