Skip to content

Instantly share code, notes, and snippets.

@p1xelHer0
Created April 29, 2021 12:54
Show Gist options
  • Save p1xelHer0/f0a9fe496410845864eeb03d2bd2f5c8 to your computer and use it in GitHub Desktop.
Save p1xelHer0/f0a9fe496410845864eeb03d2bd2f5c8 to your computer and use it in GitHub Desktop.
rust-lsp.lua
local nvim_lsp = require("lspconfig")
local function on_attach(client, bufnr)
require("completion").on_attach(client)
local function buf_set_keymap(...)
vim.api.nvim_buf_set_keymap(bufnr, ...)
end
local function buf_set_option(...)
vim.api.nvim_buf_set_option(bufnr, ...)
end
-- autocomplete
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
-- goto def
local opts = {noremap = true, silent = true}
buf_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
end
local settings = {
["rust-analyzer"] = {
inlayHints = {
typeHints = false
},
diagnostics = {
enable = false
}
}
}
nvim_lsp.rust_analyzer.setup(
{
on_attach = on_attach,
settings = settings
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment