Created
April 29, 2021 12:54
-
-
Save p1xelHer0/f0a9fe496410845864eeb03d2bd2f5c8 to your computer and use it in GitHub Desktop.
rust-lsp.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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