Configure lsp client and Rust's lsp server
This commit is contained in:
parent
0076f8b800
commit
b25bd71619
@ -1,32 +1,52 @@
|
||||
local function manage_plugins()
|
||||
local plugins = {
|
||||
["https://github.com/faerryn/plogins.nvim.git"] = {},
|
||||
["https://github.com/tpope/vim-sensible"] = {},
|
||||
}
|
||||
["https://github.com/tpope/vim-sensible"] = {},
|
||||
["https://github.com/neovim/nvim-lspconfig"] = {},
|
||||
["https://github.com/simrat39/rust-tools.nvim"] = {
|
||||
packadd_after = { ["https://github.com/neovim/nvim-lspconfig"] = true },
|
||||
packadd_hook = function()
|
||||
local rt = require("rust-tools")
|
||||
|
||||
local manager = require("plogins").manage(plugins)
|
||||
rt.setup({
|
||||
server = {
|
||||
on_attach = function(_, bufnr)
|
||||
-- Hover actions
|
||||
vim.keymap.set("n", "<C-space>",
|
||||
rt.hover_actions.hover_actions, { buffer = bufnr })
|
||||
-- Code action groups
|
||||
vim.keymap.set("n", "<Leader>a",
|
||||
rt.code_action_group.code_action_group, { buffer = bufnr })
|
||||
end,
|
||||
},
|
||||
})
|
||||
end
|
||||
},
|
||||
}
|
||||
|
||||
local manager = require("plogins").manage(plugins)
|
||||
|
||||
vim.api.nvim_create_user_command("PloginsUpgrade",
|
||||
manager.upgrade, {})
|
||||
manager.upgrade, {})
|
||||
vim.api.nvim_create_user_command("PloginsAutoremove",
|
||||
manager.autoremove, {})
|
||||
manager.autoremove, {})
|
||||
end
|
||||
|
||||
local plogins_source = "https://github.com/faerryn/plogins.nvim.git"
|
||||
local plogins_name = plogins_source:gsub("/", "%%")
|
||||
local plogins_dir =
|
||||
("%s/site/pack/plogins/opt/%s"):format((vim.fn.stdpath("data")),
|
||||
plogins_name)
|
||||
("%s/site/pack/plogins/opt/%s"):format((vim.fn.stdpath("data")),
|
||||
plogins_name)
|
||||
|
||||
if not vim.loop.fs_stat(plogins_dir) then
|
||||
vim.loop.spawn("git",
|
||||
{ args = { "clone", "--depth", "1", plogins_source, plogins_dir } },
|
||||
function(code, signal)
|
||||
vim.defer_fn(function()
|
||||
vim.cmd(("packadd %s"):format(vim.fn.fnameescape(plogins_name)))
|
||||
manage_plugins()
|
||||
end, 0)
|
||||
end)
|
||||
{ args = { "clone", "--depth", "1", plogins_source, plogins_dir } },
|
||||
function(code, signal)
|
||||
vim.defer_fn(function()
|
||||
vim.cmd(("packadd %s"):format(vim.fn.fnameescape(plogins_name)))
|
||||
manage_plugins()
|
||||
end, 0)
|
||||
end)
|
||||
else
|
||||
vim.cmd(("packadd %s"):format(vim.fn.fnameescape(plogins_name)))
|
||||
manage_plugins()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user