mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-15 04:15:59 +01:00
Merge branch 'main' into no-vimrc
This commit is contained in:
commit
2a3c52488b
4 changed files with 67 additions and 73 deletions
|
@ -44,6 +44,11 @@ This comes with a few breaking changes:
|
|||
longer filtered and thus should be used instead.
|
||||
- Add dap-go for better dap configurations
|
||||
- Make noice.nvim customizable
|
||||
- Switch from [rust-tools.nvim](https://github.com/simrat39/rust-tools.nvim)
|
||||
to the more feature-packed [rustacean.nvim](https://github.com/mrcjkb/rustaceanvim.
|
||||
This switch entails a whole bunch of new features and options, so you are
|
||||
recommended to go through rustacean.nvim's README to take a closer look at
|
||||
its features and usage.
|
||||
|
||||
[jacekpoz](https://github.com/jacekpoz):
|
||||
|
||||
|
|
24
flake.lock
24
flake.lock
|
@ -129,11 +129,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1720571246,
|
||||
"narHash": "sha256-nkUXwunTck+hNMt2wZuYRN+jf2ySRjKTzI0fo5TDH78=",
|
||||
"lastModified": 1721016451,
|
||||
"narHash": "sha256-Cypl9ORr5UjtBsbjXMTJRepTe362yNVrPrntUvHiTaw=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "16e401f01842c5bb2499e78c1fe227f939c0c474",
|
||||
"rev": "a14c5d651cee9ed70f9cd9e83f323f1e531002db",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1484,19 +1484,19 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-rust-tools": {
|
||||
"plugin-rustaceanvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1704259376,
|
||||
"narHash": "sha256-kFane5ze7VDiOzF7jdmXkr50XQsNvdb+a9HQtybEVE0=",
|
||||
"owner": "simrat39",
|
||||
"repo": "rust-tools.nvim",
|
||||
"rev": "676187908a1ce35ffcd727c654ed68d851299d3e",
|
||||
"lastModified": 1720595685,
|
||||
"narHash": "sha256-Mx8pB9ECjFpbfmZPuXfpwoE5pUZ363M53f27ht7MBmA=",
|
||||
"owner": "mrcjkb",
|
||||
"repo": "rustaceanvim",
|
||||
"rev": "047f9c9d8cd2861745eb9de6c1570ee0875aa795",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "simrat39",
|
||||
"repo": "rust-tools.nvim",
|
||||
"owner": "mrcjkb",
|
||||
"repo": "rustaceanvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
|
@ -1896,7 +1896,7 @@
|
|||
"plugin-project-nvim": "plugin-project-nvim",
|
||||
"plugin-registers": "plugin-registers",
|
||||
"plugin-rose-pine": "plugin-rose-pine",
|
||||
"plugin-rust-tools": "plugin-rust-tools",
|
||||
"plugin-rustaceanvim": "plugin-rustaceanvim",
|
||||
"plugin-scrollbar-nvim": "plugin-scrollbar-nvim",
|
||||
"plugin-smartcolumn": "plugin-smartcolumn",
|
||||
"plugin-sqls-nvim": "plugin-sqls-nvim",
|
||||
|
|
|
@ -164,8 +164,8 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
plugin-rust-tools = {
|
||||
url = "github:simrat39/rust-tools.nvim";
|
||||
plugin-rustaceanvim = {
|
||||
url = "github:mrcjkb/rustaceanvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
|
|
|
@ -125,72 +125,61 @@ in {
|
|||
|
||||
(mkIf (cfg.lsp.enable || cfg.dap.enable) {
|
||||
vim = {
|
||||
startPlugins = ["rust-tools"] ++ optionals cfg.dap.enable [cfg.dap.package];
|
||||
startPlugins = ["rustaceanvim"];
|
||||
|
||||
lsp.lspconfig = {
|
||||
enable = true;
|
||||
sources.rust-lsp = ''
|
||||
local rt = require('rust-tools')
|
||||
rust_on_attach = function(client, bufnr)
|
||||
default_on_attach(client, bufnr)
|
||||
local opts = { noremap=true, silent=true, buffer = bufnr }
|
||||
vim.keymap.set("n", "<leader>ris", rt.inlay_hints.set, opts)
|
||||
vim.keymap.set("n", "<leader>riu", rt.inlay_hints.unset, opts)
|
||||
vim.keymap.set("n", "<leader>rr", rt.runnables.runnables, opts)
|
||||
vim.keymap.set("n", "<leader>rp", rt.parent_module.parent_module, opts)
|
||||
vim.keymap.set("n", "<leader>rm", rt.expand_macro.expand_macro, opts)
|
||||
vim.keymap.set("n", "<leader>rc", rt.open_cargo_toml.open_cargo_toml, opts)
|
||||
vim.keymap.set("n", "<leader>rg", function() rt.crate_graph.view_crate_graph("x11", nil) end, opts)
|
||||
${optionalString cfg.dap.enable ''
|
||||
vim.keymap.set("n", "<leader>rd", ":RustDebuggables<cr>", opts)
|
||||
vim.keymap.set(
|
||||
"n", "${config.vim.debugger.nvim-dap.mappings.continue}",
|
||||
function()
|
||||
local dap = require("dap")
|
||||
if dap.status() == "" then
|
||||
vim.cmd "RustDebuggables"
|
||||
else
|
||||
dap.continue()
|
||||
end
|
||||
end,
|
||||
opts
|
||||
)
|
||||
''}
|
||||
end
|
||||
local rustopts = {
|
||||
tools = {
|
||||
autoSetHints = true,
|
||||
hover_with_actions = false,
|
||||
inlay_hints = {
|
||||
only_current_line = false,
|
||||
}
|
||||
luaConfigRC.rustaceanvim = entryAnywhere ''
|
||||
vim.g.rustaceanvim = {
|
||||
${optionalString cfg.lsp.enable ''
|
||||
-- LSP
|
||||
tools = {
|
||||
hover_actions = {
|
||||
replace_builtin_hover = false
|
||||
},
|
||||
server = {
|
||||
capabilities = capabilities,
|
||||
on_attach = rust_on_attach,
|
||||
cmd = ${
|
||||
},
|
||||
server = {
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
|
||||
},
|
||||
settings = {
|
||||
${cfg.lsp.opts}
|
||||
}
|
||||
},
|
||||
|
||||
${optionalString cfg.dap.enable ''
|
||||
dap = {
|
||||
adapter = {
|
||||
type = "executable",
|
||||
command = "${cfg.dap.package}/bin/lldb-vscode",
|
||||
name = "rt_lldb",
|
||||
},
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
default_on_attach(client, bufnr)
|
||||
local opts = { noremap=true, silent=true, buffer = bufnr }
|
||||
vim.keymap.set("n", "<leader>rr", ":RustLsp runnables<CR>", opts)
|
||||
vim.keymap.set("n", "<leader>rp", ":RustLsp parentModule<CR>", opts)
|
||||
vim.keymap.set("n", "<leader>rm", ":RustLsp expandMacro<CR>", opts)
|
||||
vim.keymap.set("n", "<leader>rc", ":RustLsp openCargo", opts)
|
||||
vim.keymap.set("n", "<leader>rg", ":RustLsp crateGraph x11", opts)
|
||||
${optionalString cfg.dap.enable ''
|
||||
vim.keymap.set("n", "<leader>rd", ":RustLsp debuggables<cr>", opts)
|
||||
vim.keymap.set(
|
||||
"n", "${config.vim.debugger.nvim-dap.mappings.continue}",
|
||||
function()
|
||||
local dap = require("dap")
|
||||
if dap.status() == "" then
|
||||
vim.cmd "RustLsp debuggables"
|
||||
else
|
||||
dap.continue()
|
||||
end
|
||||
end,
|
||||
opts
|
||||
)
|
||||
''}
|
||||
}
|
||||
rt.setup(rustopts)
|
||||
'';
|
||||
};
|
||||
end
|
||||
},
|
||||
''}
|
||||
|
||||
${optionalString cfg.dap.enable ''
|
||||
dap = {
|
||||
adapter = {
|
||||
type = "executable",
|
||||
command = "${cfg.dap.package}/bin/lldb-vscode",
|
||||
name = "rustacean_lldb",
|
||||
},
|
||||
},
|
||||
''}
|
||||
}
|
||||
'';
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
Loading…
Reference in a new issue