feat(nvim): optimize for rust
parent
3c483aeb89
commit
b50bd9964c
|
@ -72,7 +72,7 @@ Plug('folke/trouble.nvim') -- File-grouped workspace diagnostics
|
||||||
Plug('tpope/vim-dispatch') -- Allows quick build/compile/test vim commands
|
Plug('tpope/vim-dispatch') -- Allows quick build/compile/test vim commands
|
||||||
Plug('clojure-vim/vim-jack-in') -- Clojure: ":Boot", ":Clj", ":Lein"
|
Plug('clojure-vim/vim-jack-in') -- Clojure: ":Boot", ":Clj", ":Lein"
|
||||||
Plug('radenling/vim-dispatch-neovim') -- Add support for neovim's terminal emulator
|
Plug('radenling/vim-dispatch-neovim') -- Add support for neovim's terminal emulator
|
||||||
Plug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs)
|
-- Plug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs)
|
||||||
Plug('gennaro-tedesco/nvim-jqx') -- JSON formatter (use :Jqx*)
|
Plug('gennaro-tedesco/nvim-jqx') -- JSON formatter (use :Jqx*)
|
||||||
Plug('kylechui/nvim-surround') -- surrounds with tags/parenthesis
|
Plug('kylechui/nvim-surround') -- surrounds with tags/parenthesis
|
||||||
Plug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integration
|
Plug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integration
|
||||||
|
@ -127,7 +127,6 @@ vim.api.nvim_create_autocmd({ "VimEnter" }, {
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
vim.g.gruvbox_contrast_dark = "soft";
|
vim.g.gruvbox_contrast_dark = "soft";
|
||||||
vim.g.gruvbox_contrast_light = "soft";
|
vim.g.gruvbox_contrast_light = "soft";
|
||||||
vim.opt.ignorecase = true;
|
vim.opt.ignorecase = true;
|
||||||
|
@ -152,8 +151,8 @@ vim.opt.background = "dark";
|
||||||
vim.api.nvim_create_user_command('Dark', function(opts)
|
vim.api.nvim_create_user_command('Dark', function(opts)
|
||||||
-- opts: {name, args: str, fargs: Splited<str>, range, ...}
|
-- opts: {name, args: str, fargs: Splited<str>, range, ...}
|
||||||
---@type string
|
---@type string
|
||||||
local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_light;
|
local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_dark;
|
||||||
= contrast;
|
vim.g.gruvbox_contrast_dark = contrast;
|
||||||
vim.opt.background = "dark";
|
vim.opt.background = "dark";
|
||||||
end,
|
end,
|
||||||
{ nargs = "?", })
|
{ nargs = "?", })
|
||||||
|
@ -161,7 +160,7 @@ vim.api.nvim_create_user_command('Dark', function(opts)
|
||||||
vim.api.nvim_create_user_command('Light', function(opts)
|
vim.api.nvim_create_user_command('Light', function(opts)
|
||||||
-- opts: {name, args: str, fargs: Splited<str>, range, ...}
|
-- opts: {name, args: str, fargs: Splited<str>, range, ...}
|
||||||
---@type string
|
---@type string
|
||||||
local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_dark;
|
local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_light;
|
||||||
vim.g.gruvbox_contrast_light = contrast;
|
vim.g.gruvbox_contrast_light = contrast;
|
||||||
vim.opt.background = "light";
|
vim.opt.background = "light";
|
||||||
end,
|
end,
|
||||||
|
@ -201,6 +200,7 @@ vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float) -- opens diag in box
|
||||||
-- vim.keymap.set('n', '<leader>wq', vim.diagnostic.setqflist) -- workspace diags
|
-- vim.keymap.set('n', '<leader>wq', vim.diagnostic.setqflist) -- workspace diags
|
||||||
vim.keymap.set('n', '<leader>q', '<cmd>TroubleToggle loclist<cr>')
|
vim.keymap.set('n', '<leader>q', '<cmd>TroubleToggle loclist<cr>')
|
||||||
vim.keymap.set('n', '<leader>wq', '<cmd>TroubleToggle workspace_diagnostics<cr>')
|
vim.keymap.set('n', '<leader>wq', '<cmd>TroubleToggle workspace_diagnostics<cr>')
|
||||||
|
vim.keymap.set('n', '<leader>g', '<cmd>GuessIndent<cr>')
|
||||||
|
|
||||||
-- color, highlighting, UI stuffs
|
-- color, highlighting, UI stuffs
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
|
@ -412,18 +412,18 @@ parser_config.astro.filetype_to_parsername = { "javascript", "typescript.tsx", "
|
||||||
|
|
||||||
|
|
||||||
require('guess-indent').setup {
|
require('guess-indent').setup {
|
||||||
auto_cmd = true, -- Set to false to disable automatic execution
|
auto_cmd = true,
|
||||||
filetype_exclude = { -- A list of filetypes for which the auto command gets disabled
|
filetype_exclude = { -- A list of filetypes for which the auto command gets disabled
|
||||||
"netrw",
|
"netrw",
|
||||||
"tutor",
|
"tutor",
|
||||||
},
|
},
|
||||||
|
|
||||||
buftype_exclude = { -- A list of buffer types for which the auto command gets disabled
|
-- buftype_exclude = { -- A list of buffer types for which the auto command gets disabled
|
||||||
"help",
|
-- "help",
|
||||||
"nofile",
|
-- "nofile",
|
||||||
"terminal",
|
-- "terminal",
|
||||||
-- "prompt",
|
-- -- "prompt",
|
||||||
},
|
-- },
|
||||||
}
|
}
|
||||||
|
|
||||||
-- harpoon: O(1) buffer/terminal switching
|
-- harpoon: O(1) buffer/terminal switching
|
||||||
|
@ -585,7 +585,7 @@ cmp.setup {
|
||||||
{ name = 'luasnip' },
|
{ name = 'luasnip' },
|
||||||
{ name = 'buffer' },
|
{ name = 'buffer' },
|
||||||
{ name = 'path' },
|
{ name = 'path' },
|
||||||
{ name = "conjure" },
|
-- { name = "conjure" },
|
||||||
-- { name = 'cmp_tabnine' },
|
-- { name = 'cmp_tabnine' },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -775,6 +775,7 @@ require("rust-tools").setup {
|
||||||
-- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error"
|
-- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error"
|
||||||
on_initialized = function()
|
on_initialized = function()
|
||||||
require('inlay-hints').set_all()
|
require('inlay-hints').set_all()
|
||||||
|
|
||||||
end,
|
end,
|
||||||
-- automatically call RustReloadWorkspace when writing to a Cargo.toml file.
|
-- automatically call RustReloadWorkspace when writing to a Cargo.toml file.
|
||||||
reload_workspace_from_cargo_toml = true,
|
reload_workspace_from_cargo_toml = true,
|
||||||
|
@ -916,15 +917,28 @@ require("rust-tools").setup {
|
||||||
vim.keymap.set('n', keys, func, { noremap = true, buffer = bufnr, desc = desc })
|
vim.keymap.set('n', keys, func, { noremap = true, buffer = bufnr, desc = desc })
|
||||||
end
|
end
|
||||||
on_attach(client, bufnr)
|
on_attach(client, bufnr)
|
||||||
require('inlay-hints').on_attach(client, bufnr)
|
|
||||||
nmap('K', require 'rust-tools'.hover_actions.hover_actions, 'Hover Documentation')
|
nmap('K', require 'rust-tools'.hover_actions.hover_actions, 'Hover Documentation')
|
||||||
end,
|
end,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
|
cmd = {"rust-analyzer"},
|
||||||
settings = {
|
settings = {
|
||||||
|
["rust-analyzer"] = {
|
||||||
|
-- enable clippy on save
|
||||||
checkOnSave = {
|
checkOnSave = {
|
||||||
command = "clippy",
|
command = "clippy",
|
||||||
}
|
extraArgs = { "--all", "--", "-W", "clippy::all" },
|
||||||
}
|
},
|
||||||
|
rustfmt = {
|
||||||
|
extraArgs = { "+nightly" },
|
||||||
|
},
|
||||||
|
cargo = {
|
||||||
|
loadOutDirsFromCheck = true,
|
||||||
|
},
|
||||||
|
procMacro = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}, -- rust-analyzer options
|
}, -- rust-analyzer options
|
||||||
|
|
||||||
-- debugging stuff
|
-- debugging stuff
|
||||||
|
|
Loading…
Reference in New Issue