chore(nvim): add Rust formatting and setup

This commit is contained in:
Stefan Imhoff
2022-08-05 17:35:43 +02:00
parent 0d8af82dd5
commit b19616ab49
4 changed files with 10 additions and 2 deletions

View File

@@ -14,7 +14,7 @@ local servers = {
"html", "html",
"jsonls", "jsonls",
"pyright", "pyright",
-- "remark_ls", "rust_analyzer",
"sourcery", "sourcery",
"stylelint_lsp", "stylelint_lsp",
"sumneko_lua", "sumneko_lua",
@@ -22,6 +22,7 @@ local servers = {
"theme_check", "theme_check",
"tsserver", "tsserver",
"vuels", "vuels",
-- "remark_ls",
} }
lsp_installer.settings({ lsp_installer.settings({

View File

@@ -126,6 +126,11 @@ M.on_attach = function(client, bufnr)
client.resolved_capabilities.document_range_formatting = false client.resolved_capabilities.document_range_formatting = false
end end
-- Rust
if client.name == "rust_analyzer" then
client.resolved_capabilities.document_formatting = false
end
lsp_keymaps(bufnr) lsp_keymaps(bufnr)
lsp_highlight_document(client) lsp_highlight_document(client)
end end

View File

@@ -44,6 +44,7 @@ null_ls.setup({
formatting.stylua, -- Lua formatting.stylua, -- Lua
formatting.trim_newlines, formatting.trim_newlines,
formatting.trim_whitespace, formatting.trim_whitespace,
formatting.rustfmt,
hover.dictionary, hover.dictionary,
}, },
}) })

View File

@@ -32,7 +32,7 @@ end
-- Have packer use a popup window -- Have packer use a popup window
packer.init({ packer.init({
max_jobs= 8, max_jobs = 8,
display = { display = {
open_fn = function() open_fn = function()
return require("packer.util").float({ return require("packer.util").float({
@@ -142,6 +142,7 @@ return packer.startup(function(use)
use("rstacruz/vim-xtract") -- Extract code into new file use("rstacruz/vim-xtract") -- Extract code into new file
use("tpope/vim-repeat") -- Repeat plugins use("tpope/vim-repeat") -- Repeat plugins
use("tpope/vim-surround") -- Replace, add, remove surroundings use("tpope/vim-surround") -- Replace, add, remove surroundings
use("mfussenegger/nvim-dap") -- Debug Adapter Protocol
-- Custom Text Objects -- Custom Text Objects
use("christoomey/vim-titlecase") use("christoomey/vim-titlecase")