From 130eede87d4dee6aee31157417f90f7bacb1525f Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Thu, 1 Feb 2024 14:38:24 -0600 Subject: feat: add rust support --- lua/plugins/autocompletion.lua | 4 +++- lua/plugins/crates.lua | 9 +++++++++ lua/plugins/lspconfig.lua | 5 +++++ lua/plugins/rust.lua | 10 ++++++++++ lua/plugins/treesitter.lua | 1 + 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 lua/plugins/crates.lua create mode 100644 lua/plugins/rust.lua diff --git a/lua/plugins/autocompletion.lua b/lua/plugins/autocompletion.lua index 85bdbcc..ead5e69 100644 --- a/lua/plugins/autocompletion.lua +++ b/lua/plugins/autocompletion.lua @@ -8,7 +8,8 @@ return { 'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-nvim-lua', -- Snippet Engine & its associated nvim-cmp source - { 'L3MON4D3/LuaSnip', + { + 'L3MON4D3/LuaSnip', version = "v2.*", dependencies = 'rafamadriz/friendly-snippets', build = "make install_jsregexp", @@ -62,6 +63,7 @@ return { { name = 'nvim_lua' }, { name = 'path' }, { name = 'buffer' }, + { name = 'crates' }, }), }) end, diff --git a/lua/plugins/crates.lua b/lua/plugins/crates.lua new file mode 100644 index 0000000..e0c46be --- /dev/null +++ b/lua/plugins/crates.lua @@ -0,0 +1,9 @@ +return { + 'Saecki/crates.nvim', + ft = { 'rust', 'toml' }, + config = function(_, opts) + local crates = require('crates') + crates.setup(opts) + crates.show() + end +} diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua index c01e575..d4526f3 100644 --- a/lua/plugins/lspconfig.lua +++ b/lua/plugins/lspconfig.lua @@ -10,6 +10,11 @@ local servers = { gofumpt = true }, }, + rust_analyzer = { + cargo = { + allFeatures = true, + }, + }, -- jedi_language_server = {}, pyright = {}, lua_ls = { diff --git a/lua/plugins/rust.lua b/lua/plugins/rust.lua new file mode 100644 index 0000000..e4bc53f --- /dev/null +++ b/lua/plugins/rust.lua @@ -0,0 +1,10 @@ +return { + -- For debugging capabilities, need to change the config + -- from lspconfig into it's own thing, for more: + -- https://www.youtube.com/watch?v=mh_EJhH49Ms + 'rust-lang/rust.vim', + ft = 'rust', + init = function() + vim.g.rustfmt_autosave = 1 + end +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 3d7a48e..a942921 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -24,6 +24,7 @@ return { 'sql', 'gdscript', 'godot_resource', + 'rust', }, auto_install = false, highlight = { enable = true }, -- cgit v1.2.3-70-g09d2