From b765de7e3ffb82c1f9ef8a2532a8fcdb514a9dc0 Mon Sep 17 00:00:00 2001 From: ray Date: Sun, 24 Jul 2022 16:12:06 +0100 Subject: [PATCH] rust-tools --- init.plugins.vim | 4 ++++ lua/init-lsp.lua | 24 ++++++++++++++++++++++-- lua/init-plugins.lua | 18 ++++++++---------- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/init.plugins.vim b/init.plugins.vim index 2c40dec..ba0c85e 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -6,6 +6,10 @@ if empty(glob('~/.config/nvim/autoload/plug.vim'))" endif call plug#begin('~/.config/nvim/bundle') +" evaluating +" https://github.com/simrat39/rust-tools.nvim +Plug 'simrat39/rust-tools.nvim' + " colorscheme (temporary) Plug 'https://github.com/marko-cerovac/material.nvim', { 'branch': 'main' } let g:material_style = 'lighter' diff --git a/lua/init-lsp.lua b/lua/init-lsp.lua index 6392621..e9ba36a 100644 --- a/lua/init-lsp.lua +++ b/lua/init-lsp.lua @@ -30,9 +30,10 @@ local servers = { -- no formatting support 'vimls', -- vue -- use vetur - 'yamlls', -- no formatting support + 'yamlls' -- no formatting support + -- is now automatically started/configured by rust-tools -- sudo pacman -Syu rust-analyzer - 'rust_analyzer' + -- 'rust_analyzer' } -- Use an on_attach function to only map the following keys @@ -158,6 +159,25 @@ require'lspconfig'.taplo.setup { cmd = {"taplo", "lsp", "stdio"} } +-- rust-tools +-- evaluating +require('rust-tools').setup({ + server = { + on_attach = on_attach, + capabilities = capabilities, + flags = {debounce_text_changes = 150}, + + settings = {["rust-analyzer"] = {checkOnSave = {command = "clippy"}}} + } +}) +-- set inlay hints +require('rust-tools.inlay_hints').set_inlay_hints() +-- disable inlay hints +require('rust-tools.inlay_hints').disable_inlay_hints() +-- toggle inlay hints +require('rust-tools.inlay_hints').toggle_inlay_hints() +------ + -- null-ls local null_ls = require("null-ls") diff --git a/lua/init-plugins.lua b/lua/init-plugins.lua index 6e92327..40a6538 100644 --- a/lua/init-plugins.lua +++ b/lua/init-plugins.lua @@ -1,15 +1,13 @@ -- nvim-autopairs -require('nvim-autopairs').setup{} +require('nvim-autopairs').setup {} -- you need setup cmp first put this after cmp.setup() require("cmp").setup({ - map_cr = false, -- map on insert mode - map_complete = false, -- it will auto insert `(` after select function or method item - auto_select = true -- automatically select the first item + map_cr = false, -- map on insert mode + map_complete = false, -- it will auto insert `(` after select function or method item + auto_select = true -- automatically select the first item }) +------ ---nvim-ts-autotag -require'nvim-treesitter.configs'.setup { - autotag = { - enable = true, - } -} +-- nvim-ts-autotag +require'nvim-treesitter.configs'.setup {autotag = {enable = true}} +------