feat(nvim): add Rust LSP support
This commit is contained in:
@@ -6,6 +6,31 @@ require("nord").setup({
|
||||
})
|
||||
vim.cmd.colorscheme("nord")
|
||||
|
||||
-- Keep floating windows distinct from the current line highlight.
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#2e3440" })
|
||||
vim.api.nvim_set_hl(0, "FloatBorder", { fg = "#88c0d0", bg = "#2e3440" })
|
||||
|
||||
local open_floating_preview = vim.lsp.util.open_floating_preview
|
||||
vim.lsp.util.open_floating_preview = function(contents, syntax, opts, ...)
|
||||
opts = opts or {}
|
||||
opts.border = opts.border or "rounded"
|
||||
return open_floating_preview(contents, syntax, opts, ...)
|
||||
end
|
||||
|
||||
-- Format Rust buffers before writing them.
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*.rs",
|
||||
callback = function(args)
|
||||
vim.lsp.buf.format({
|
||||
bufnr = args.buf,
|
||||
timeout_ms = 2000,
|
||||
filter = function(client)
|
||||
return client.name == "rust_analyzer"
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Conceal markdown syntax in markdown buffers.
|
||||
-- conceallevel is window-local, so it is set with opt_local when the filetype
|
||||
-- is applied to the buffer's window.
|
||||
|
||||
Reference in New Issue
Block a user