Automated update
This commit is contained in:
@@ -157,6 +157,7 @@ packer.startup(function(use)
|
||||
run = ':TSUpdate',
|
||||
config = function()
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = { "go", "lua", "python", "rust" }, -- add Go and any other languages you need
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
@@ -184,6 +185,22 @@ end)
|
||||
|
||||
-- LSP settings
|
||||
local lspconfig = require('lspconfig')
|
||||
-- Set up 'gopls' and other language servers
|
||||
lspconfig.gopls.setup {
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
gopls = {
|
||||
analyses = {
|
||||
unusedparams = true,
|
||||
shadow = true,
|
||||
},
|
||||
staticcheck = true,
|
||||
},
|
||||
},
|
||||
init_options = {
|
||||
verboseOutput = true,
|
||||
}
|
||||
}
|
||||
local on_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
@@ -212,7 +229,7 @@ local on_attach = function(client, bufnr)
|
||||
end
|
||||
|
||||
-- Enable the following language servers
|
||||
local servers = { 'pyright', 'tsserver', 'gopls', 'rust_analyzer' }
|
||||
local servers = { 'pyright', 'ts_ls', 'gopls', 'rust_analyzer' }
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
@@ -263,6 +280,33 @@ local associations = {
|
||||
{ '*.ino' , { arduino } },
|
||||
}
|
||||
|
||||
-- Create an augroup for Rust-specific settings
|
||||
vim.api.nvim_create_augroup('RustGroup', { clear = true })
|
||||
|
||||
-- Define autocmds that apply only for Rust files
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
group = 'RustGroup',
|
||||
pattern = 'rust',
|
||||
callback = function()
|
||||
-- Keybinding for running rustfmt (formatting)
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', '<leader>rf', ':lua vim.lsp.buf.format()<CR>', { noremap = true, silent = true })
|
||||
|
||||
-- Keybinding for running Clippy (linting)
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', '<leader>rc', ':!cargo clippy<CR>', { noremap = true, silent = true })
|
||||
|
||||
-- Keybinding to build Rust project
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', '<leader>rb', ':!cargo build<CR>', { noremap = true, silent = true })
|
||||
|
||||
-- Keybinding to run Rust project
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', '<leader>rr', ':!cargo run<CR>', { noremap = true, silent = true })
|
||||
|
||||
-- Show diagnostics (errors/warnings) in Rust
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', '<leader>rd', ':lua vim.diagnostic.open_float()<CR>', { noremap = true, silent = true })
|
||||
|
||||
print("Rust-specific keybindings loaded!")
|
||||
end
|
||||
})
|
||||
|
||||
for _, assoc in ipairs(associations) do
|
||||
local pattern = assoc[1]
|
||||
local callbacks = assoc[2]
|
||||
|
||||
Reference in New Issue
Block a user