You've already forked dotfiles
Moving all the nvim files to a subdirectory and updated the deploy script.
This commit is contained in:
95
nvim/lua/plugins/mason.lua
Normal file
95
nvim/lua/plugins/mason.lua
Normal file
@@ -0,0 +1,95 @@
|
||||
return {
|
||||
'williamboman/mason.nvim',
|
||||
config = function()
|
||||
require('mason').setup()
|
||||
|
||||
local mason_lspconfig = require('mason-lspconfig')
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
-- All functions and keymaps contained here are universal to LSPs
|
||||
local on_attach = function(client, bufnr)
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Keyboard Mappings
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set('n', '<c-[>', vim.diagnostic.goto_prev, bufopts)
|
||||
vim.keymap.set('n', '<c-]>', vim.diagnostic.goto_next, bufopts)
|
||||
-- vim.keymap.set('n', 'gl', vim.diagnostic.open_float, bufopts)
|
||||
vim.keymap.set('n', 'ga', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', 'gs', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
|
||||
-- vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<leader><leader>f', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
|
||||
-- DAP debug
|
||||
-- if dap then
|
||||
-- vim.keymap.set('n', '<F5>', function() dap.continue() end, bufopts)
|
||||
-- vim.keymap.set('n', '<F10>', function() dap.step_over() end, bufopts)
|
||||
-- vim.keymap.set('n', '<F11>', function() dap.step_into() end, bufopts)
|
||||
-- vim.keymap.set('n', '<F12>', function() dap.step_out() end, bufopts)
|
||||
-- vim.keymap.set('n', '<leader>b', function() dap.toggle_breakpoint() end, bufopts)
|
||||
-- end
|
||||
end
|
||||
|
||||
mason_lspconfig.setup {
|
||||
automatic_installation = true,
|
||||
}
|
||||
|
||||
local lspconfig = require('lspconfig')
|
||||
|
||||
mason_lspconfig.setup_handlers {
|
||||
function(server_name)
|
||||
lspconfig[server_name].setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach
|
||||
}
|
||||
end,
|
||||
|
||||
['rust_analyzer'] = function()
|
||||
lspconfig.rust_analyzer.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
['rust-analyzer'] = {
|
||||
checkOnSave = true,
|
||||
check = {
|
||||
command = 'clippy',
|
||||
extraArgs = { '--', '-Dclippy::all', '-Wclippy::pedantic' },
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
experimental = {
|
||||
enable = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end,
|
||||
|
||||
['lua_ls'] = function()
|
||||
lspconfig.lua_ls.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end,
|
||||
}
|
||||
end,
|
||||
dependencies = {
|
||||
'williamboman/mason-lspconfig.nvim'
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user