summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bashrc2
-rw-r--r--.config/nvim/ftplugin/rust.lua19
-rw-r--r--.config/nvim/init.lua14
-rw-r--r--.config/nvim/lazy-lock.json1
-rw-r--r--.config/nvim/lua/plugins/lsp.lua24
5 files changed, 24 insertions, 36 deletions
diff --git a/.bashrc b/.bashrc
index 7bfa651..d4e80b2 100644
--- a/.bashrc
+++ b/.bashrc
@@ -43,5 +43,7 @@ alias ll="ls -AlF --color";
alias la="ls -AF --color";
alias c="clear";
alias x="exit";
+alias t="tmux";
alias v="nvim";
+alias vro="nvim -RM" # Neovim read-only
alias nv-watch="watch -n1 nvidia-smi";
diff --git a/.config/nvim/ftplugin/rust.lua b/.config/nvim/ftplugin/rust.lua
index 3fbcec4..029f0da 100644
--- a/.config/nvim/ftplugin/rust.lua
+++ b/.config/nvim/ftplugin/rust.lua
@@ -9,4 +9,23 @@ else
settings = settings .. " expandtab"
end
+local bufnr = vim.api.nvim_get_current_buf()
+vim.keymap.set(
+ "n",
+ "<leader>a",
+ function()
+ vim.cmd.RustLsp('codeAction') -- supports rust-analyzer's grouping
+ -- or vim.lsp.buf.codeAction() if you don't want grouping.
+ end,
+ { silent = true, buffer = bufnr }
+)
+vim.keymap.set(
+ "n",
+ "K", -- Override Neovim's built-in hover keymap with rustaceanvim's hover actions
+ function()
+ vim.cmd.RustLsp({'hover', 'actions'})
+ end,
+ { silent = true, buffer = bufnr }
+)
+
vim.cmd(settings)
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
index a23bed7..db40749 100644
--- a/.config/nvim/init.lua
+++ b/.config/nvim/init.lua
@@ -7,6 +7,8 @@ vim.opt.relativenumber = true
vim.opt.laststatus = 2
vim.opt.hlsearch = true
vim.opt.incsearch = true
+-- Directory for swap files
+vim.opt.directory = vim.fn.expand("~/.local/share/nvim/swap//")
-- Search into subfolders
-- Provides tab completion for file related tasks
vim.opt.path:append '**'
@@ -15,18 +17,6 @@ vim.opt.wildmenu = true
vim.cmd("filetype plugin on")
vim.api.nvim_set_keymap('v', '<C-c>', '"+y', { noremap = true, silent = true })
--- Neovim builtin autocompletion
---vim.api.nvim_create_autocmd({ "VimEnter" }, {
--- callback = function()
--- local clients = vim.lsp.get_clients()
--- for _, client in ipairs(clients) do
--- local id = client.id
--- vim.lsp.completion.enable(true, id, 1, { autotrigger = true })
--- return
--- end
--- end
---})
-
vim.diagnostic.config({
virtual_text = false, -- Disable inline text diagnostics
signs = true, -- Keep signs in the sign column
diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json
index 4833389..a0ecc11 100644
--- a/.config/nvim/lazy-lock.json
+++ b/.config/nvim/lazy-lock.json
@@ -19,6 +19,7 @@
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
"render-markdown.nvim": { "branch": "main", "commit": "ad055861d17afe058bd835e82292e14a64b51b1d" },
"ripgrep": { "branch": "master", "commit": "d6b59feff890f038acde7d5e151995d8aec1e107" },
+ "rustaceanvim": { "branch": "master", "commit": "66398662c07d265b226897500ed50eafba3dffb4" },
"telescope-dap.nvim": { "branch": "master", "commit": "783366bd6c1e7fa0a5c59c07db37f49c805a28df" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }
diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua
index 5080622..640ed2b 100644
--- a/.config/nvim/lua/plugins/lsp.lua
+++ b/.config/nvim/lua/plugins/lsp.lua
@@ -42,30 +42,6 @@ return {
lspconfig.pyright.setup({
capabilities = capabilities
})
- lspconfig.rust_analyzer.setup({
- capabilities = capabilities,
- settings = {
- ['rust-analyzer'] = {
- assist = {
- importEnforceGranularity = true,
- importPrefix = 'crate',
- },
- cargo = {
- allFeatures = true,
- },
- checkOnSave = {
- command = 'clippy',
- },
- inlayHints = { locationLinks = false },
- diagnostics = {
- enable = true,
- experimental = {
- enable = true,
- },
- },
- },
- },
- })
-- Key mapping
-- Hover for definition