-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Depends on neovim 0.10. Ideas taken from https://youtu.be/DYaTzkw3zqQ and LazyVim/LazyVim@01c7eee. Closes #1.
- Loading branch information
1 parent
a8b2c09
commit 23442b5
Showing
2 changed files
with
109 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,104 +1,73 @@ | ||
return { | ||
{ | ||
"simrat39/rust-tools.nvim", | ||
event = { "BufReadPre", "BufNewFile" }, | ||
lazy = true, | ||
opts = { | ||
on_initialized = function() | ||
vim.cmd([[ | ||
augroup RustLSP | ||
autocmd CursorHold *.rs silent! lua vim.lsp.buf.document_highlight() | ||
autocmd CursorMoved,InsertEnter *.rs silent! lua vim.lsp.buf.clear_references() | ||
autocmd BufEnter,CursorHold,InsertLeave *.rs silent! lua vim.lsp.codelens.refresh() | ||
augroup END | ||
]]) | ||
end, | ||
"nvim-neotest/neotest", | ||
dependencies = { | ||
{ | ||
"rouge8/neotest-rust", | ||
dependencies = { | ||
"nvim-lua/plenary.nvim", | ||
"nvim-treesitter/nvim-treesitter", | ||
"antoinemadec/FixCursorHold.nvim", | ||
}, | ||
}, | ||
config = function() | ||
local rt = require("rust-tools") | ||
rt.setup({ | ||
server = { | ||
on_attach = function(_, bufnr) | ||
-- Hover actions | ||
vim.keymap.set("n", "K", "<CMD>RustHoverActions<CR>", { buffer = bufnr, desc = "Hover Documentation" }) | ||
-- Code action groups | ||
vim.keymap.set("n", "<leader>ca", "<CMD>RustCodeAction<CR>", { buffer = bufnr, desc = "Code [A]ction" }) | ||
end, | ||
}, | ||
}) | ||
end, | ||
}, | ||
{ | ||
"nvim-neotest/neotest", | ||
dependencies = { | ||
{ | ||
"rouge8/neotest-rust", | ||
dependencies = { | ||
"nvim-lua/plenary.nvim", | ||
"nvim-treesitter/nvim-treesitter", | ||
"antoinemadec/FixCursorHold.nvim", | ||
}, | ||
config = function() | ||
require("neotest").setup({ | ||
status = { virtual_text = true }, | ||
output = { open_on_run = true }, | ||
adapters = { | ||
require("neotest-rust"), | ||
}, | ||
}) | ||
end, | ||
keys = { | ||
{ | ||
"<leader>tt", | ||
function() | ||
require("neotest").run.run(vim.fn.expand("%")) | ||
end, | ||
desc = "Run File", | ||
}, | ||
config = function() | ||
require("neotest").setup({ | ||
status = { virtual_text = true }, | ||
output = { open_on_run = true }, | ||
adapters = { | ||
require("neotest-rust"), | ||
}, | ||
}) | ||
end, | ||
keys = { | ||
{ | ||
"<leader>tt", | ||
function() | ||
require("neotest").run.run(vim.fn.expand("%")) | ||
end, | ||
desc = "Run File", | ||
}, | ||
{ | ||
"<leader>tT", | ||
function() | ||
require("neotest").run.run(vim.loop.cwd()) | ||
end, | ||
desc = "Run All Test Files", | ||
}, | ||
{ | ||
"<leader>tr", | ||
function() | ||
require("neotest").run.run() | ||
end, | ||
desc = "Run Nearest", | ||
}, | ||
{ | ||
"<leader>ts", | ||
function() | ||
require("neotest").summary.toggle() | ||
end, | ||
desc = "Toggle Summary", | ||
}, | ||
{ | ||
"<leader>to", | ||
function() | ||
require("neotest").output.open({ enter = true, auto_close = true }) | ||
end, | ||
desc = "Show Output", | ||
}, | ||
{ | ||
"<leader>tO", | ||
function() | ||
require("neotest").output_panel.toggle() | ||
end, | ||
desc = "Toggle Output Panel", | ||
}, | ||
{ | ||
"<leader>tS", | ||
function() | ||
require("neotest").run.stop() | ||
end, | ||
desc = "Stop", | ||
}, | ||
{ | ||
"<leader>tT", | ||
function() | ||
require("neotest").run.run(vim.loop.cwd()) | ||
end, | ||
desc = "Run All Test Files", | ||
}, | ||
{ | ||
"<leader>tr", | ||
function() | ||
require("neotest").run.run() | ||
end, | ||
desc = "Run Nearest", | ||
}, | ||
{ | ||
"<leader>ts", | ||
function() | ||
require("neotest").summary.toggle() | ||
end, | ||
desc = "Toggle Summary", | ||
}, | ||
{ | ||
"<leader>to", | ||
function() | ||
require("neotest").output.open({ enter = true, auto_close = true }) | ||
end, | ||
desc = "Show Output", | ||
}, | ||
{ | ||
"<leader>tO", | ||
function() | ||
require("neotest").output_panel.toggle() | ||
end, | ||
desc = "Toggle Output Panel", | ||
}, | ||
{ | ||
"<leader>tS", | ||
function() | ||
require("neotest").run.stop() | ||
end, | ||
desc = "Stop", | ||
}, | ||
}, | ||
} |