summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCryxtalix <fgx8p9t@protonmail.com>2025-02-28 18:01:35 +0800
committerCryxtalix <fgx8p9t@protonmail.com>2025-02-28 18:01:35 +0800
commit0bbdf294023176d7f2689fb6386e37c22eca7e43 (patch)
tree4fd82bd8ffe3a789e07797b449305616030bc648
parent6be3160d680848f706c0a966a225dc98c6e093e0 (diff)
Made neovim lsp warnings appear in a box rather than inline
-rw-r--r--.bashrc10
-rw-r--r--.config/nvim/init.lua17
-rw-r--r--.config/nvim/lua/plugins/lsp.lua35
3 files changed, 50 insertions, 12 deletions
diff --git a/.bashrc b/.bashrc
index 262a7c7..7bfa651 100644
--- a/.bashrc
+++ b/.bashrc
@@ -12,9 +12,9 @@ fi
export PATH
# Rust
-if [ -d "$HOME/.cargo" ]; then
- . "$HOME/.cargo/env"
-fi
+#if [ -d "$HOME/.cargo" ]; then
+# . "$HOME/.cargo/env"
+#fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
@@ -34,8 +34,8 @@ PS1='\[\e[1m\][ \[\e[96m\]\w \[\e[39m\]]\\$ \[\e[0m\]'
HISTCONTROL=ignoredups:erasedups
shopt -s histappend
shopt -s checkwinsize
-export HISTFILESIZE=1000
-export HISTSIZE=500
+export HISTFILESIZE=10000
+export HISTSIZE=50
export VISUAL=nvim
export EDITOR="$VISUAL"
alias ls="ls -F --color";
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
index 112ca25..a23bed7 100644
--- a/.config/nvim/init.lua
+++ b/.config/nvim/init.lua
@@ -27,6 +27,23 @@ vim.api.nvim_set_keymap('v', '<C-c>', '"+y', { noremap = true, silent = true })
-- end
--})
+vim.diagnostic.config({
+ virtual_text = false, -- Disable inline text diagnostics
+ signs = true, -- Keep signs in the sign column
+ update_in_insert = false,
+ underline = true,
+ severity_sort = true,
+})
+
+-- Show diagnostics on hover
+vim.o.updatetime = 250 -- Faster update time for hover
+vim.api.nvim_create_autocmd("CursorHold", {
+ pattern = "*",
+ callback = function()
+ vim.diagnostic.open_float(nil, { focus = false, scope = "cursor" })
+ end,
+})
+
-- Install Lazy.vim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua
index 4e9ef07..5080622 100644
--- a/.config/nvim/lua/plugins/lsp.lua
+++ b/.config/nvim/lua/plugins/lsp.lua
@@ -12,13 +12,13 @@ return {
},
{
- "williamboman/mason-lspconfig.nvim",
- config = function()
- require("mason-lspconfig").setup {
- ensure_installed = { "bashls", "lua_ls", "clangd", "marksman", "pyright", "rust_analyzer" },
- automatic_installation = true,
- }
- end
+ "williamboman/mason-lspconfig.nvim",
+ config = function()
+ require("mason-lspconfig").setup {
+ ensure_installed = { "bashls", "lua_ls", "clangd", "marksman", "pyright", "rust_analyzer" },
+ automatic_installation = true,
+ }
+ end
},
{
@@ -44,6 +44,27 @@ return {
})
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