Skip to content

Instantly share code, notes, and snippets.

@JSchrtke
Last active February 3, 2022 11:32
Show Gist options
  • Save JSchrtke/8eafc64a1a245d35f986adb3459f8c1c to your computer and use it in GitHub Desktop.
Save JSchrtke/8eafc64a1a245d35f986adb3459f8c1c to your computer and use it in GitHub Desktop.
nvim rust-tools + lsp-installer setup
call plug#begin('~/.vim/plugged')
Plug 'neovim/nvim-lspconfig', { 'commit': '06e54cdfa38c2129bc555b6ee77d4086c3a74e5c' }
Plug 'williamboman/nvim-lsp-installer', { 'commit': '57398ee78d055b3fc566092c1a09ca8df9df1d71' }
Plug 'simrat39/rust-tools.nvim', { 'commit': '7b4d155dd47e211ee661cbb4c7969b245f768edb' }
call plug#end()
lua << EOF
local lsp_installer = require("nvim-lsp-installer")
lsp_installer.on_server_ready(function(server)
local opts = {}
if server.name == "rust_analyzer" then
local rust_opts = {
tools = {
autoSetHints = true,
hover_with_actions = true,
executor = require("rust-tools/executors").termopen,
runnables = {
use_telescope = true
},
inlay_hints = {
show_parameter_hints = true,
parameter_hints_prefix = "<- ",
other_hints_prefix = "=> ",
max_len_align = false,
max_len_align_padding = 1,
right_align = false,
right_align_padding = 7
},
hover_actions = {
border = "single",
auto_focus = false
}
},
server = vim.tbl_deep_extend("force", server:get_default_options(), {
settings = {
["rust-analyzer"] = {
checkOnSave = {
command = "clippy"
}
}
}
})
}
require("rust-tools").setup(rust_opts)
server:attach_buffers()
else
server:setup(opts)
vim.cmd([[do User LspAttachBuffers]])
end
end)
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment