From dd8de0ecd58263649290cd11e74dbbb7950a4e44 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Wed, 7 Dec 2022 12:06:58 +0300 Subject: feat(nvim): use rust-tools and fidget new plugins make us go microsoft code --- .config/nvim/lua/plugin_settings.lua | 51 +++++++++++++++++++++++++++++++++++- .config/nvim/lua/plugins.lua | 19 ++++++++++---- 2 files changed, 64 insertions(+), 6 deletions(-) (limited to '.config/nvim/lua') diff --git a/.config/nvim/lua/plugin_settings.lua b/.config/nvim/lua/plugin_settings.lua index fbd54ad..7ca473f 100644 --- a/.config/nvim/lua/plugin_settings.lua +++ b/.config/nvim/lua/plugin_settings.lua @@ -363,7 +363,7 @@ end -- bring in cmp_nvim_lsp local capabilities = require('cmp_nvim_lsp').default_capabilities() -local servers = { 'rust_analyzer', 'jedi_language_server', 'texlab', 'clangd', 'ltex' } +local servers = { 'jedi_language_server', 'texlab', 'clangd', 'ltex' } for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup { on_attach = on_attach, @@ -377,6 +377,44 @@ nvim_lsp['efm'].setup{ capabilities = capabilities } +-- Configure LSP through rust-tools.nvim plugin. +-- rust-tools will configure and enable certain LSP features for us. +-- See https://github.com/simrat39/rust-tools.nvim#configuration +local rust_opts = { + tools = { + runnables = { + use_telescope = true, + }, + inlay_hints = { + auto = true, + show_parameter_hints = false, + parameter_hints_prefix = "", + other_hints_prefix = "", + }, + }, + + -- all the opts to send to nvim-lspconfig + -- these override the defaults set by rust-tools.nvim + -- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer + server = { + -- on_attach is a callback called when the language server attachs to the buffer + on_attach = on_attach, + settings = { + -- to enable rust-analyzer settings visit: + -- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc + ["rust-analyzer"] = { + -- enable clippy on save + checkOnSave = { + command = "clippy", + }, + }, + }, + }, +} + +require('rust-tools').setup(rust_opts) + + -- }}} nvim-lsp -- -- vista {{{ -- @@ -587,3 +625,14 @@ require('leap').setup { } -- }}} leap.nvim -- + +-- fidget.nvim {{{ -- +require("fidget").setup{ +-- https://github.com/j-hui/fidget.nvim/blob/main/doc/fidget.md + text = { + spinner = "triangle" + } + +} +-- }}} fidget.nvim -- + diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index f0aaa3a..1a36ce9 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -5,7 +5,7 @@ -- │▌ ▘▝▀▘▗▄▘▀▘▘ ▘▀▀ │ -- └───────────────────┘ -return require('packer').startup(function() +return require('packer').startup(function(use) -- packer can manage itself use 'wbthomason/packer.nvim' @@ -24,6 +24,11 @@ return require('packer').startup(function() } -- quickstart lsp config use 'neovim/nvim-lspconfig' + -- visualize lsp progress + use 'j-hui/fidget.nvim' + -- extra rust-analyzer functionality + use 'simrat39/rust-tools.nvim' + -- annotation generator use { @@ -42,10 +47,14 @@ return require('packer').startup(function() -- completion suite use 'hrsh7th/nvim-cmp' - use 'hrsh7th/cmp-nvim-lsp' - use 'hrsh7th/cmp-buffer' - use 'hrsh7th/cmp-path' - use 'quangnguyen30192/cmp-nvim-ultisnips' + use ({ + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'quangnguyen30192/cmp-nvim-ultisnips', + after = { 'hrsh7th/nvim-cmp' }, + requires = { 'hrsh7th/nvim-cmp' }, + }) -- find, filter, preview, pick use { -- cgit v1.2.3-70-g09d2