From 9a49ecbff3f6bb4593ab626b709c2336c1b74a20 Mon Sep 17 00:00:00 2001 From: Luke Else Date: Wed, 15 Mar 2023 22:49:53 +0000 Subject: [PATCH] Add rust tools to nvim --- nvim/after/plugin/rt.lua | 45 +++++++++++++++++++++++++++++++++++ nvim/lua/luke-else/packer.lua | 9 ++++++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 nvim/after/plugin/rt.lua diff --git a/nvim/after/plugin/rt.lua b/nvim/after/plugin/rt.lua new file mode 100644 index 0000000..d13b47b --- /dev/null +++ b/nvim/after/plugin/rt.lua @@ -0,0 +1,45 @@ +local opts = { + tools = { -- rust-tools options + -- automatically call RustReloadWorkspace when writing to a Cargo.toml file. + reload_workspace_from_cargo_toml = true, + + -- These apply to the default RustSetInlayHints command + inlay_hints = { + -- automatically set inlay hints (type hints) + -- default: true + auto = true, + + -- Only show inlay hints for the current line + only_current_line = false, + + -- whether to show parameter hints with the inlay hints or not + -- default: true + show_parameter_hints = true, + + -- 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 length 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", + }, + }, + } + + require('rust-tools').setup(opts) \ No newline at end of file diff --git a/nvim/lua/luke-else/packer.lua b/nvim/lua/luke-else/packer.lua index 18912f7..be2c27c 100644 --- a/nvim/lua/luke-else/packer.lua +++ b/nvim/lua/luke-else/packer.lua @@ -4,13 +4,15 @@ return require('packer').startup(function(use) -- Packer can manage itself use 'wbthomason/packer.nvim' + -- Fuzzy Finding use { 'nvim-telescope/telescope.nvim', tag = '0.1.0', -- or , branch = '0.1.x', requires = { {'nvim-lua/plenary.nvim'} } } - use { -- Theme inspired by Atom + -- Color Scheme + use { 'navarasu/onedark.nvim', priority = 1000, config = function() @@ -18,11 +20,13 @@ return require('packer').startup(function(use) end } + -- Ease of use Plugins use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'}) use('theprimeagen/harpoon') use('mbbill/undotree') use('tpope/vim-fugitive') + -- Bracket Autocompletion use { 'windwp/nvim-autopairs', config = function() require('nvim-autopairs').setup {} end @@ -51,6 +55,9 @@ return require('packer').startup(function(use) } } + -- Rust tools + use 'simrat39/rust-tools.nvim' + -- Debugger use 'nvim-lua/plenary.nvim' use { 'rcarriga/nvim-dap-ui', requires = {'mfussenegger/nvim-dap'} }