migrate to rustaceanvim from rust-tools

This commit is contained in:
krolxon 2024-08-30 23:10:25 +05:30
parent f1c9d44970
commit 8ae44cd732
5 changed files with 73 additions and 130 deletions

View File

@ -18,7 +18,6 @@
"lualine.nvim": { "branch": "master", "commit": "e99d733e0213ceb8f548ae6551b04ae32e590c80" },
"markdown.nvim": { "branch": "main", "commit": "4ab835985de62b46b6785ae160f5f709b77a0f92" },
"mason.nvim": { "branch": "main", "commit": "4546dec8b56bc56bc1d81e717e4a935bc7cd6477" },
"mini.nvim": { "branch": "main", "commit": "f20d8cd3a116ef65f022797de064a044b217ff53" },
"nvim-autopairs": { "branch": "master", "commit": "78a4507bb9ffc9b00f11ae0ac48243d00cb9194d" },
"nvim-cmp": { "branch": "main", "commit": "8202df9561b90102b41dbc1ad71945534ef4ea39" },
"nvim-colorizer.lua": { "branch": "master", "commit": "760e27df4dd966607e8fb7fd8b6b93e3c7d2e193" },
@ -28,7 +27,7 @@
"nvim-tree.lua": { "branch": "master", "commit": "78a9ca5ed6557f29cd0ce203df44213e54bfabb9" },
"nvim-treesitter": { "branch": "master", "commit": "5a8e9644c49f992f47bacd7900f4404df6fd9d38" },
"plenary.nvim": { "branch": "master", "commit": "9a0d3bf7b832818c042aaf30f692b081ddd58bd9" },
"rust-tools.nvim": { "branch": "master", "commit": "bd1aa99ffb911a1cf99b3fcf3b44c0391c57e3ef" },
"rustaceanvim": { "branch": "master", "commit": "d3a8b145f0b3db4de9a08fcbc604659f52ee4fbc" },
"telescope.nvim": { "branch": "master", "commit": "74ce793a60759e3db0d265174f137fb627430355" },
"todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" },
"tokyonight.nvim": { "branch": "main", "commit": "e89caa3ad6d8da9d0dd981ec74a82c55adc61ffd" },

View File

@ -12,6 +12,7 @@ autocmd("TextYankPost", {
end,
})
-- Remove trailing whitespaces on :w
autocmd({ "BufWritePre" }, {
group = KrolyxonGroup,
@ -42,7 +43,9 @@ vim.cmd([[
-- Run C/C++ fil
vim.api.nvim_buf_set_keymap(0, 'n', '<F5>', ':w<CR>:!gcc -o %:t:r % && ./%:t:r<CR>', { silent = true })
vim.api.nvim_buf_set_keymap(0, 'n', '<F6>', ':w<CR>:!g++ -o %:t:r % && ./%:t:r<CR>', { silent = true })
vim.api.nvim_buf_set_keymap(0, 'n', '<F7>', ':w<CR>:lua require("kterm.terminal").send("cp -f " .. vim.fn.expand("%") .. " /tmp; javac -d /tmp " .. vim.fn.expand("%") .. "; java -cp /tmp " .. vim.fn.expand("%:t:r"), "float")<CR>', {silent = true})
vim.api.nvim_buf_set_keymap(0, 'n', '<F7>',
':w<CR>:lua require("kterm.terminal").send("cp -f " .. vim.fn.expand("%") .. " /tmp; javac -d /tmp " .. vim.fn.expand("%") .. "; java -cp /tmp " .. vim.fn.expand("%:t:r"), "float")<CR>',
{ silent = true })
-- vim.api.nvim_buf_set_keymap(0, 'n', '<F5>', ":w<CR>:new | term . '!gcc %:p:h && ./a.out'<CR>:startinsert<CR>", {silent = true})
--
@ -55,6 +58,7 @@ local build_commands = {
-- tex = "pdflatex %",
tex = "VimtexCompile",
javascript = "",
java = "!jrun %"
}
local debug_build_commands = {
@ -118,3 +122,6 @@ vim.api.nvim_create_user_command("Ha", function()
end, {})
vim.api.nvim_create_user_command("Config", function() vim.cmd([[cd ~/.config/nvim]]) end, {})
vim.cmd [[ autocmd BufRead,BufNewFile *.slint set filetype=slint ]]

View File

@ -1,8 +1,7 @@
local M = {}
M.general = {
n = {
["<ESC>"] = { "<cmd> noh <CR>", "no highlight" },
n = { ["<ESC>"] = { "<cmd> noh <CR>", "no highlight" },
-- switch between windows
-- ["<C-h>"] = { "<C-w>h", "window left" },
@ -344,10 +343,7 @@ M.rust = {
plugin = true,
n = {
["<leader>rr"] = { "<cmd> RustRun<CR>", "RustRun" },
["<leader>rd"] = { "<cmd> RustDebuggables <CR>", "RustDebuggables" },
["<leader>ra"] = { "<cmd> RustHoverActions <CR>", "RustHoverActions" },
["<leader>roc"] = { "<cmd> RustOpenCargo <CR>", "RustOpenCargo" },
["<leader>rcg"] = { "<cmd> RustViewCrateGraph <CR>", "RustViewCrateGraph" },
["<leader>roc"] = { "<cmd> RustOpenCargo <CR>", "RustLsp openCargo" },
},
}

View File

@ -1,62 +0,0 @@
local present, rust = pcall(require, "rust-tools")
if not present then
return
end
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
local options = {
tools = {
executor = require("rust-tools/executors").termopen,
-- automatically call RustReloadWorkspace when writing to a Cargo.toml file.
reload_workspace_from_cargo_toml = true,
inlay_hints = {
auto = true,
only_current_line = false,
show_parameter_hints = true,
},
hover_actions = {
auto_focus = true,
border = "rounded",
},
on_initialized = function()
-- ih.set_all()
vim.api.nvim_create_autocmd({
"BufEnter",
"BufReadPre",
"BufReadPost",
"BufWritePost",
"CursorHold",
"InsertLeave",
"InsertEnter",
"BufAdd",
}, {
pattern = { "*.rs" },
callback = function()
local _, _ = pcall(vim.lsp.codelens.refresh)
end,
})
end,
},
server = {
on_attach = require("plugins.configs.lspconfig").on_attach,
standalone = true,
},
settings = {
["rust-analyzer"] = {
checkOnSave = {
-- command = "check",
lens = {
enable = true,
},
command = "clippy",
}
}
}
}
rust.setup(options)

View File

@ -145,23 +145,26 @@ local plugins = {
},
{
"simrat39/rust-tools.nvim",
-- after = "nvim-lspconfig",
-- event = "BufEnter *.rs",
ft = { "rust" },
event = { "InsertEnter", "BufReadPre", "BufAdd", "BufNew" },
dependencies = "neovim/nvim-lspconfig",
'mrcjkb/rustaceanvim',
version = '^5', -- Recommended
lazy = false, -- This plugin is already lazy
["rust-analyzer"] = {
cargo = {
allFeatures = true,
},
},
config = function()
require("plugins.configs.rust-tools")
require("core.utils").load_mappings "rust"
end,
vim.g.rustaceanvim = {
tools = {
float_win_config = {
border = 'rounded'
}
},
-- { 'mrcjkb/rustaceanvim',
-- version = '^4', -- Recommended
-- lazy = false, -- This plugin is already lazy
-- },
}
end
},
{
"Saecki/crates.nvim",