diff --git a/nvim/lua/config.lua b/nvim/lua/config.lua index b7e9a664..aa6552a4 100644 --- a/nvim/lua/config.lua +++ b/nvim/lua/config.lua @@ -13,7 +13,7 @@ require('nvim-autopairs').setup{} require('gitsigns').setup() -- nvim-treesiter configuration: -- setup with all defaults require'nvim-treesitter.configs'.setup{ - ensure_installed = {"bash", "c", "c_sharp", "cmake", "cpp", "css", "dockerfile", "go", "html", "http", "java", "javascript", "json", "json5", "jsonc", "lua", "make", "markdown", "perl", "php", "pug", "python", "regex", "ruby", "toml", "tsx", "typescript", "vim", "vue", "wgsl", "yaml",}, + ensure_installed = {"bash", "c", "c_sharp", "cmake", "cpp", "css", "dockerfile", "go", "html", "http", "java", "javascript", "json", "json5", "jsonc", "lua", "make", "markdown", "perl", "php", "pug", "python", "regex", "ruby", "toml", "tsx", "typescript", "rust", "vim", "vue", "wgsl", "yaml",}, highlight = { enable = 'true' } } @@ -90,8 +90,36 @@ end) local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) -- Replace with each lsp server you've enabled. local lspconfig =require'lspconfig' + +local on_attach = function(client) + require'completion'.on_attach(client) +end + +-- Enable rust-analyzer +lspconfig.rust_analyzer.setup({ + on_attach=on_attach, + settings = { + ["rust_analyzer"] = { + imports = { + granularity = { + group = "module", + }, + prefix = "self", + }, + cargo = { + buildScripts = { + enable = true, + }, + }, + procMacro = { + enable = true + } + } + } +}) + -- Enable some language servers with the additional completion capabilities offered by nvim-cmp -local servers = { 'dockerls', 'grammarly', 'html', 'sqls', 'rome', 'sumneko_lua', 'pyright', 'bashls', 'clangd', 'volar', 'zk', 'html' } +local servers = { 'dockerls', 'grammarly', 'html', 'sqls', 'rome', 'sumneko_lua', 'pyright', 'bashls', 'clangd', 'rust_analyzer', 'volar', 'zk', } for _, lsp in ipairs(servers) do lspconfig[lsp].setup { capabilities = capabilities, @@ -257,6 +285,8 @@ vim.opt.number = true vim.opt.cursorcolumn = true -- vim.opt.cursor = true +-- +-- vim.opt.mouse = 'a' vim.opt.autoindent = true vim.opt.smarttab = true diff --git a/updates.txt b/updates.txt index 72092271..588c88ba 100644 --- a/updates.txt +++ b/updates.txt @@ -83,3 +83,13 @@ cp ~/Documents/notes/xinitrc.txt ~/.xinitrc Copy your base.yml to your espanso/match config directory cp ~/Documents/notes/espanso/base.yml ~/.config/espanso/match/ + +Install rust_analyzer lsp server for nvim + +:LspInstallInfo + +Choose rust_analyzer + +Copy new confug.lua file to ~/.config/nvim/lua/: + +cp ~/Documents/notes/nvim/lua/config.lua ~/.config/nvim/lua