From cc2d585348553f521f896e04faab1713be8397be Mon Sep 17 00:00:00 2001 From: Uttarayan Mondal Date: Sat, 9 Jul 2022 11:32:27 +0530 Subject: [PATCH] [update] Update nvim plugins --- config/nvim/init.lua | 61 ++-- config/nvim/lua/keymaps.lua | 40 ++- config/nvim/lua/lsp/init.lua | 4 +- config/nvim/lua/lsp/lua-language-server.lua | 52 ++-- config/nvim/lua/lsp/rust-analyzer.lua | 15 +- config/nvim/lua/plugins.lua | 294 ++++++++++---------- config/nvim/lua/setup/dashboard.lua | 28 ++ config/nvim/lua/setup/nvim-cmp.lua | 47 ---- config/nvim/lua/setup/rust-tools.lua | 196 +++++++++++++ 9 files changed, 451 insertions(+), 286 deletions(-) create mode 100644 config/nvim/lua/setup/dashboard.lua delete mode 100644 config/nvim/lua/setup/nvim-cmp.lua create mode 100644 config/nvim/lua/setup/rust-tools.lua diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 7c335d25..3798bea7 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -59,17 +59,17 @@ vim.g.dashboard_default_executive = 'fzf' vim.g.python_highlight_all = 1 -vim.g.test = { - default = { - default = { - complete_items = { 'lsp', 'snippet' }, - mode = 'file', - }, - comment = {}, - string = { complete_items = { 'path' } }, - }, - rust = { { complete_items = { 'ts' } } }, -} +-- vim.g.test = { +-- default = { +-- default = { +-- complete_items = { 'lsp', 'snippet' }, +-- mode = 'file', +-- }, +-- comment = {}, +-- string = { complete_items = { 'path' } }, +-- }, +-- rust = { { complete_items = { 'ts' } } }, +-- } vim.o.completeopt = 'menuone,noselect' @@ -81,36 +81,29 @@ vim.g.coq_settings = { }, clients = { lsp = { - weight_adjust = 1 + weight_adjust = 2 }, - buffers = { - weight_adjust = -0.5 - }, - snippets = { - weight_adjust = -0.1 - } + -- buffers = { + -- -- weight_adjust = -0.5 + -- }, + -- snippets = { + -- -- weight_adjust = -0.1 + -- } } } -vim.g.rooter_manual_only = 1 - +-- vim.g.rooter_manual_only = 1 +vim.g.copilot_node_command = "~/.local/share/nvm/v16.0.0/bin/node" require('plugins') require('keymaps') require 'nvim-treesitter.configs'.setup { - ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages - highlight = { - enable = true, -- false will disable the whole extension - additional_vim_regex_highlighting = false, - }, + -- ensure_installed = "all", + ensure_installed = { "c", "rust", "toml", "lua", "json", "python", "cmake", "make", "typescript", "bash", "cpp", + "comment", "css", "fish", "http", "html", "vim", "yaml" }, + highlight = { + enable = true, -- false will disable the whole extension + additional_vim_regex_highlighting = false, + }, } - --- require "nvim-treesitter.parsers".get_parser_configs().Solidity = { --- install_info = { --- url = "https://github.com/JoranHonig/tree-sitter-solidity", --- files = {"src/parser.c"}, --- requires_generate_from_grammar = true, --- }, --- filetype = 'solidity' --- } diff --git a/config/nvim/lua/keymaps.lua b/config/nvim/lua/keymaps.lua index 02bb8032..2502bc48 100644 --- a/config/nvim/lua/keymaps.lua +++ b/config/nvim/lua/keymaps.lua @@ -1,4 +1,4 @@ -vim.api.nvim_set_keymap('', '', '', { noremap = true, silent=true}) +vim.api.nvim_set_keymap('', '', '', { noremap = true, silent = true }) vim.g.mapleader = " " vim.g.maplocalleader = " " @@ -14,15 +14,15 @@ local normal_mode_maps = { { key = 'q', map = [[bw]] }, { key = 'v', map = [[CHADopen]] }, - -- fzf - { key = ';', map = [[Buffers]] }, - { key = 'ff', map = [[Files]] }, - { key = 'fb', map = [[Marks]] }, - { key = 'fh', map = [[History]] }, - { key = 'fa', map = [[History]] }, - - { key = 'tc', map = [[Colors]] }, - { key = 'g', map = [[Rg]] }, + -- " Find files using Telescope command-line sugar. + { key = 'ff', map = [[lua require('telescope.builtin').find_files()]] }, + { key = 'gg', map = [[lua require('telescope.builtin').live_grep()]] }, + { key = ';', map = [[lua require('telescope.builtin').buffers()]] }, + { key = 'fh', map = [[lua require('telescope.builtin').help_tags()]] }, + { key = 'gB', map = [[Git blame]] }, + + { key = 'rd', map = [[RustDebuggables]] }, + { key = 'rr', map = [[RustRunnables]] }, -- Session { key = 'ss', map = [[SessionSave]] }, @@ -39,6 +39,7 @@ local normal_mode_maps = { { key = 'F', map = [[lua vim.lsp.buf.formatting()]] }, { key = 'T', map = [[lua require'lsp_extensions'.inlay_hints()]] }, + -- { key = '', map = [[vsplit]] }, -- Other { key = 'm', map = [[silent !mpcfzf]] }, @@ -48,32 +49,25 @@ local normal_mode_maps = { local insert_mode_maps = { { key = '', map = '' }, + { key = "", map = 'copilot#Accept("")', options = { silent = true, expr = true } }, + { key = "", map = 'copilot#Accept("")', options = { silent = true, expr = true } }, } for idx = 1, #normal_mode_maps do if normal_mode_maps[idx].options then local options = normal_mode_maps[idx].options - vim.api.nvim_set_keymap('n', normal_mode_maps[idx].key, normal_mode_maps[idx].map ,options) + vim.api.nvim_set_keymap('n', normal_mode_maps[idx].key, normal_mode_maps[idx].map, options) else - vim.api.nvim_set_keymap('n', normal_mode_maps[idx].key, normal_mode_maps[idx].map ,options) + vim.api.nvim_set_keymap('n', normal_mode_maps[idx].key, normal_mode_maps[idx].map, options) end end for idx = 1, #insert_mode_maps do if insert_mode_maps[idx].options then local options = insert_mode_maps[idx].options - vim.api.nvim_set_keymap('i', insert_mode_maps[idx].key, insert_mode_maps[idx].map ,options) + vim.api.nvim_set_keymap('i', insert_mode_maps[idx].key, insert_mode_maps[idx].map, options) else - vim.api.nvim_set_keymap('i', insert_mode_maps[idx].key, insert_mode_maps[idx].map ,options) + vim.api.nvim_set_keymap('i', insert_mode_maps[idx].key, insert_mode_maps[idx].map, options) end end - - - - --- local ff = { --- { 'this', 'and this' }, --- { 'that', 'and that' }, --- } --- print(ff[1][2]) diff --git a/config/nvim/lua/lsp/init.lua b/config/nvim/lua/lsp/init.lua index bf542572..2da6919a 100644 --- a/config/nvim/lua/lsp/init.lua +++ b/config/nvim/lua/lsp/init.lua @@ -1,7 +1,7 @@ -- local lspstatus = require('lsp-status') -- lspstatus.register_progress() -require("lsp.rust-analyzer") +-- require("lsp.rust-analyzer") require("lsp.lua-language-server") require("lsp.tsserver") require("lsp.clangd") @@ -9,7 +9,7 @@ require("lsp.pyright") -- Set completeopt to have a better completion experience -- vim.o.completeopt= "menuone,noinsert,noselect" -vim.o.completeopt= "menuone,noselect" +vim.o.completeopt = "menuone,noselect" -- vim.api.nvim_command [[autocmd CursorHold lua vim.lsp.buf.document_highlight()]] -- vim.api.nvim_command [[autocmd CursorHoldI lua vim.lsp.buf.document_highlight()]] diff --git a/config/nvim/lua/lsp/lua-language-server.lua b/config/nvim/lua/lsp/lua-language-server.lua index 26e6faf7..5b8ca72e 100644 --- a/config/nvim/lua/lsp/lua-language-server.lua +++ b/config/nvim/lua/lsp/lua-language-server.lua @@ -1,26 +1,26 @@ -local lspconfig = require 'lspconfig' -local lspstatus = require('lsp-status') -local coq = require 'coq' - -lspconfig.sumneko_lua.setup { - cmd = { "lua-language-server" }, - on_attach = function(client) lspstatus.on_attach(client) end, - capabilities = coq.lsp_ensure_capabilities(lspstatus.capabilities), - filetypes = { "lua" }, - log_level = 2, - settings = { - Lua = { - diagnostics = { - globals = { 'vim' }, - }, - telemetry = { - enable = false, - }, - formatting = { - end_of_line = 'lf', - }, - } - } -} --- lspconfig.sumenko_lua.setup(coq.lsp_ensure_capabilities()) --- require'lspconfig'.sumneko_lua.setup{coq.lsp_ensure_capabilities()} +local lspconfig = require 'lspconfig' +local lspstatus = require('lsp-status') +local coq = require 'coq' + +lspconfig.sumneko_lua.setup { + cmd = { "lua-language-server" }, + on_attach = function(client) lspstatus.on_attach(client) end, + capabilities = coq.lsp_ensure_capabilities(lspstatus.capabilities), + filetypes = { "lua" }, + log_level = 2, + settings = { + Lua = { + diagnostics = { + globals = { 'vim' }, + }, + telemetry = { + enable = false, + }, + formatting = { + end_of_line = 'lf', + }, + } + } +} +-- lspconfig.sumenko_lua.setup(coq.lsp_ensure_capabilities()) +-- require'lspconfig'.sumneko_lua.setup{coq.lsp_ensure_capabilities()} diff --git a/config/nvim/lua/lsp/rust-analyzer.lua b/config/nvim/lua/lsp/rust-analyzer.lua index e5d8dfe6..4b156d91 100644 --- a/config/nvim/lua/lsp/rust-analyzer.lua +++ b/config/nvim/lua/lsp/rust-analyzer.lua @@ -13,7 +13,7 @@ lspconfig.rust_analyzer.setup{ lruCapacity = 64, assist = { importGranularity = "module", - importPrefix = "by_self", + importPrefix = "by_crate", }, procMacro = { enable = true, @@ -24,8 +24,19 @@ lspconfig.rust_analyzer.setup{ }, cargo = { loadOutDirsFromCheck = true, - allFeatures = true, + -- allFeatures = true, + }, + completion = { + autoimport = { + enable = true, + } + }, + diagnostics = { + disabled = { + "unresolved-macro-call" + } } + } }, } diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index 3b7af4c9..6b6593ff 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -1,152 +1,142 @@ -local vim = vim -local execute = vim.api.nvim_command -local fn = vim.fn - -local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' - -if fn.empty(fn.glob(install_path)) > 0 then - fn.system({ 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path }) - execute 'packadd packer.nvim' -end - - -return require('packer').startup(function() - -- Packer can manage itself - use 'wbthomason/packer.nvim' - - use 'christianrondeau/vim-base64' - - use { - 'NTBBloodbath/galaxyline.nvim', branch = 'main', - config = function() require('statusline') end, - requires = { 'kyazdani42/nvim-web-devicons' } - } - - use { - 'sainnhe/sonokai', - config = function() require('colorscheme') end, - } - - use { - 'folke/which-key.nvim', - config = function() require("which-key").setup() end, - } - - use 'yuttie/comfortable-motion.vim' - - use 'ruanyl/vim-gh-line' - - use { - 'junegunn/fzf', - requires = { 'junegunn/fzf.vim' } - } - - use { - 'tpope/vim-surround', - 'tpope/vim-vinegar', - 'tpope/vim-repeat', - 'tpope/vim-speeddating', - 'tpope/vim-commentary', - 'tpope/vim-fugitive', - } - - use { 'norcalli/nvim-colorizer.lua', config = function() require 'colorizer'.setup() end, } - - -- lsp - -- use { 'onsails/lspkind-nvim', config = function() require'lspkind'.init() end, } - use { 'folke/lsp-trouble.nvim', config = function() require("trouble").setup() end, } - - use { 'neovim/nvim-lspconfig', config = function() require("lsp") end, } - use { 'williamboman/nvim-lsp-installer' } - use { 'nvim-lua/lsp-status.nvim' } - - - - -- use { 'ray-x/cmp-treesitter' } - -- use { 'andersevenrud/cmp-tmux' } - -- use { 'hrsh7th/cmp-vsnip' } - -- use { 'hrsh7th/vim-vsnip' } - -- use { 'hrsh7th/cmp-nvim-lsp' } - -- use { 'hrsh7th/cmp-buffer' } - -- use { 'hrsh7th/cmp-path' } - -- use { 'hrsh7th/cmp-cmdline' } - -- use { 'hrsh7th/nvim-cmp', - -- config = function() - -- local cmp = require("cmp") - -- cmp.setup({ - -- snippet = { - -- -- REQUIRED - you must specify a snippet engine - -- expand = function(args) - -- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. - -- -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. - -- -- require('snippy').expand_snippet(args.body) -- For `snippy` users. - -- -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. - -- end, - -- }, - -- mapping = { - -- [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), - -- [''] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), - -- [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), - -- [''] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. - -- [''] = cmp.mapping({ - -- i = cmp.mapping.abort(), - -- c = cmp.mapping.close(), - -- }), - -- [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - -- }, - -- sources = cmp.config.sources({ - -- { name = 'nvim_lsp' }, - -- { name = 'vsnip' }, -- For vsnip users. - -- }, { - -- { name = 'buffer' }, - -- { name = 'tmux' }, - -- { name = 'treesitter' }, - -- -- { name = 'snippy' }, -- For snippy users. - -- }) - -- }) - -- end, - -- } - - - - use { 'ms-jpq/coq_nvim', requires = { 'ms-jpq/coq.artifacts' } } - - -- use { 'folke/lsp-colors.nvim', - -- config = function() require("lsp-colors").setup({ - -- Error = "#db4b4b", - -- Warning = "#e0af68", - -- Information = "#0db9d7", - -- Hint = "#10B981" - -- }) end, - -- } - -- use 'nvim-lua/lsp_extensions.nvim' - -- config = function() vim.cmd([[autocmd BufEnter,BufWinEnter,TabEnter *.rs :lua require'lsp_extensions'.inlay_hints()]]) end, - -- - -- Qol - use { 'sindrets/diffview.nvim', requires = 'nvim-lua/plenary.nvim' } - -- use { 'justinmk/vim-sneak' } - use { - 'akinsho/nvim-toggleterm.lua', - config = function() require 'setup.toggleterm' end, - } - - -- use 'airblade/vim-rooter' - use 'glepnir/dashboard-nvim' - - use { - 'nvim-treesitter/nvim-treesitter', - run = ':TSUpdate' - } - - - use { - -- 'rust-lang/rust.vim', - 'mhinz/vim-crates', - -- 'cespare/vim-toml', - } - - use 'ms-jpq/chadtree' - -- use 'tomlion/vim-solidity' - use 'ellisonleao/glow.nvim' - -end); +local vim = vim +local execute = vim.api.nvim_command +local fn = vim.fn +local use = require('packer').use + +local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' + +if fn.empty(fn.glob(install_path)) > 0 then + fn.system({ 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path }) + execute 'packadd packer.nvim' +end + + +return require('packer').startup(function() + -- Packer can manage itself + use 'wbthomason/packer.nvim' + use 'christianrondeau/vim-base64' + use { + 'NTBBloodbath/galaxyline.nvim', branch = 'main', + config = function() require('statusline') end, + requires = { 'kyazdani42/nvim-web-devicons' } + } + use { 'sainnhe/sonokai', config = function() require('colorscheme') end } + use { 'folke/which-key.nvim', config = function() require("which-key").setup() end } + use 'yuttie/comfortable-motion.vim' + use 'ruanyl/vim-gh-line' + use { 'nvim-telescope/telescope.nvim', requires = { { 'nvim-lua/plenary.nvim' } } } + use { + 'nvim-telescope/telescope-fzf-native.nvim', + run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build', + config = function() + require('telescope').setup { + defaults = { + initial_mode = 'insert', + }, + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + } + } + } + require('telescope').load_extension('fzf') + end, + } + + use { 'nvim-telescope/telescope-ui-select.nvim', + config = function() + require("telescope").load_extension("ui-select") + end + } + + + use { + 'tpope/vim-commentary', + 'tpope/vim-fugitive', + 'tpope/vim-repeat', + 'tpope/vim-speeddating', + 'tpope/vim-surround', + 'tpope/vim-vinegar', + } + + use { 'norcalli/nvim-colorizer.lua', config = function() require 'colorizer'.setup() end, } + + -- lsp + -- use { 'onsails/lspkind-nvim', config = function() require'lspkind'.init() end, } + use { + 'folke/trouble.nvim', + config = function() + -- local actions = require("telescope.actions") + require("trouble").setup() + local trouble = require("trouble.providers.telescope") + local telescope = require("telescope") + telescope.setup { + defaults = { + mappings = { + i = { [""] = trouble.open_with_trouble }, + n = { [""] = trouble.open_with_trouble }, + }, + }, + } + + end, } + + use { 'neovim/nvim-lspconfig', config = function() require("lsp") end, } + use { 'williamboman/nvim-lsp-installer' } + use { 'nvim-lua/lsp-status.nvim' } + + + + + + + use { 'ms-jpq/coq_nvim', requires = { 'ms-jpq/coq.artifacts' } } + + use 'airblade/vim-rooter' + use { 'sindrets/diffview.nvim', requires = 'nvim-lua/plenary.nvim' } + use { + 'akinsho/toggleterm.nvim', + config = function() require 'setup.toggleterm' end, + } + + use { + 'glepnir/dashboard-nvim', + config = function() require 'setup.dashboard' end, + } + use 'github/copilot.vim' + + use { + 'nvim-treesitter/nvim-treesitter', + run = ':TSUpdate' + } + + use 'samoshkin/vim-mergetool' + + + use { + 'saecki/crates.nvim', + tag = 'v0.2.1', + requires = { 'nvim-lua/plenary.nvim' }, + config = function() + require('crates').setup { + src = { + coq = { + enabled = true, + name = "crates.nvim", + }, + }, + } + end, + } + use { 'simrat39/rust-tools.nvim', config = function() require 'setup.rust-tools' end } + + use 'ms-jpq/chadtree' + use 'ellisonleao/glow.nvim' + + use { "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } } + + +end); diff --git a/config/nvim/lua/setup/dashboard.lua b/config/nvim/lua/setup/dashboard.lua new file mode 100644 index 00000000..d8ecd06c --- /dev/null +++ b/config/nvim/lua/setup/dashboard.lua @@ -0,0 +1,28 @@ +local home = os.getenv('HOME') +local db = require('dashboard') +db.custom_center = { + { icon = ' ', + desc = 'Recently laset session ', + shortcut = 'SPC s l', + action = 'SessionLoad' }, + { icon = ' ', + desc = 'Recently opened files ', + action = 'DashboardFindHistory', + shortcut = 'SPC f h' }, + { icon = ' ', + desc = 'Find File ', + action = 'Telescope find_files find_command=rg,--hidden,--files', + shortcut = 'SPC f f' }, + { icon = ' ', + desc = 'File Browser ', + action = 'Telescope file_browser', + shortcut = 'SPC f b' }, + { icon = ' ', + desc = 'Find word ', + aciton = 'DashboardFindWord', + shortcut = 'SPC f w' }, + { icon = ' ', + desc = 'Open Personal dotfiles ', + action = 'Telescope dotfiles path=' .. home .. '/.dotfiles', + shortcut = 'SPC f d' }, +} diff --git a/config/nvim/lua/setup/nvim-cmp.lua b/config/nvim/lua/setup/nvim-cmp.lua deleted file mode 100644 index e63592fd..00000000 --- a/config/nvim/lua/setup/nvim-cmp.lua +++ /dev/null @@ -1,47 +0,0 @@ - -- luasnip setup -local luasnip = require'luasnip' - - -- nvim-cmp setup -local cmp = require'cmp' - cmp.setup { - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) - end, - }, - mapping = { - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, - [''] = function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, - [''] = function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, - }, - sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - }, - } - diff --git a/config/nvim/lua/setup/rust-tools.lua b/config/nvim/lua/setup/rust-tools.lua new file mode 100644 index 00000000..8479ee77 --- /dev/null +++ b/config/nvim/lua/setup/rust-tools.lua @@ -0,0 +1,196 @@ +-- Update this path +-- local extension_path = vim.env.HOME .. '/.vscode/extensions/vadimcn.vscode-lldb-1.7.0' +-- local codelldb_path = extension_path .. 'adapter/codelldb' +-- local liblldb_path = extension_path .. 'lldb/lib/liblldb.dylib' +local codelldb_path = '/Users/fs0c131y/.vscode/extensions/vadimcn.vscode-lldb-1.6.9/adapter/codelldb' +local liblldb_path = '/Users/fs0c131y/.vscode/extensions/vadimcn.vscode-lldb-1.6.9/lldb/lib/liblldb.dylib' + +local opts = { + tools = { -- rust-tools options + -- automatically set inlay hints (type hints) + -- There is an issue due to which the hints are not applied on the first + -- opened file. For now, write to the file to trigger a reapplication of + -- the hints or just run :RustSetInlayHints. + -- default: true + autoSetHints = true, + + -- whether to show hover actions inside the hover window + -- this overrides the default hover handler so something like lspsaga.nvim's hover would be overriden by this + -- default: true + hover_with_actions = true, + + -- how to execute terminal commands + -- options right now: termopen / quickfix + executor = require("rust-tools/executors").termopen, + + -- callback to execute once rust-analyzer is done initializing the workspace + -- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error" + on_initialized = nil, + + -- These apply to the default RustSetInlayHints command + inlay_hints = { + + -- Only show inlay hints for the current line + only_current_line = false, + + -- Event which triggers a refersh of the inlay hints. + -- You can make this "CursorMoved" or "CursorMoved,CursorMovedI" but + -- not that this may cause higher CPU usage. + -- This option is only respected when only_current_line and + -- autoSetHints both are true. + only_current_line_autocmd = "CursorHold", + + -- whether to show parameter hints with the inlay hints or not + -- default: true + show_parameter_hints = true, + + -- whether to show variable name before type hints with the inlay hints or not + -- default: false + show_variable_name = false, + + -- prefix for parameter hints + -- default: "<-" + parameter_hints_prefix = "<- ", + + -- prefix for all the other hints (type, chaining) + -- default: "=>" + other_hints_prefix = "=> ", + + -- whether to align to the lenght of the longest line in the file + max_len_align = false, + + -- padding from the left if max_len_align is true + max_len_align_padding = 1, + + -- whether to align to the extreme right or not + right_align = false, + + -- padding from the right if right_align is true + right_align_padding = 7, + + -- The color of the hints + highlight = "Comment", + }, + + -- options same as lsp hover / vim.lsp.util.open_floating_preview() + hover_actions = { + -- the border that is used for the hover window + -- see vim.api.nvim_open_win() + border = { + { "╭", "FloatBorder" }, + { "─", "FloatBorder" }, + { "╮", "FloatBorder" }, + { "│", "FloatBorder" }, + { "╯", "FloatBorder" }, + { "─", "FloatBorder" }, + { "╰", "FloatBorder" }, + { "│", "FloatBorder" }, + }, + + -- whether the hover action window gets automatically focused + -- default: false + auto_focus = false, + }, + + -- settings for showing the crate graph based on graphviz and the dot + -- command + crate_graph = { + -- Backend used for displaying the graph + -- see: https://graphviz.org/docs/outputs/ + -- default: x11 + backend = "x11", + -- where to store the output, nil for no output stored (relative + -- path from pwd) + -- default: nil + output = nil, + -- true for all crates.io and external crates, false only the local + -- crates + -- default: true + full = true, + + -- List of backends found on: https://graphviz.org/docs/outputs/ + -- Is used for input validation and autocompletion + -- Last updated: 2021-08-26 + enabled_graphviz_backends = { + "bmp", + "cgimage", + "canon", + "dot", + "gv", + "xdot", + "xdot1.2", + "xdot1.4", + "eps", + "exr", + "fig", + "gd", + "gd2", + "gif", + "gtk", + "ico", + "cmap", + "ismap", + "imap", + "cmapx", + "imap_np", + "cmapx_np", + "jpg", + "jpeg", + "jpe", + "jp2", + "json", + "json0", + "dot_json", + "xdot_json", + "pdf", + "pic", + "pct", + "pict", + "plain", + "plain-ext", + "png", + "pov", + "ps", + "ps2", + "psd", + "sgi", + "svg", + "svgz", + "tga", + "tiff", + "tif", + "tk", + "vml", + "vmlz", + "wbmp", + "webp", + "xlib", + "x11", + }, + }, + }, + + -- 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/doc/server_configurations.md#rust_analyzer + server = { + -- standalone file support + -- setting it to false may improve startup time + standalone = true, + }, -- rust-analyer options + + -- debugging stuff + + dap = { + -- adapter = { + -- type = "executable", + -- command = "lldb-vscode", + -- name = "rt_lldb", + -- }, + adapter = require('rust-tools.dap').get_codelldb_adapter( + codelldb_path, liblldb_path) + }, +} + +-- vim.cmd([[autocmd BufEnter,BufWinEnter,TabEnter *.rs :lua require('rust-tools.inlay_hints').set_inlay_hints()]]) +require('rust-tools').setup(opts)