diff --git a/common/.config/nvim/after/ftplugin/rust.lua b/common/.config/nvim/after/ftplugin/rust.lua new file mode 100644 index 0000000..3a878c8 --- /dev/null +++ b/common/.config/nvim/after/ftplugin/rust.lua @@ -0,0 +1,23 @@ +-- TODO: Map all native Nvim 0.11 LSP commands to corresponding rustaceanvim ones +-- grn -> Rename +-- grr -> References +-- gri -> Implementation +-- gO -> document_symbol +-- gra -> code_action +-- Mine +-- F2 -> Rename +-- gD -> Go to definition +-- cr -> References +-- co -> document_symbol + +if pcall(require, "rustaceanvim") then + local bufnr = vim.api.nvim_get_current_buf() + + vim.keymap.set("n", "", function() + vim.cmd.RustLsp("codeAction") + end, { silent = true, buffer = bufnr }) + + vim.keymap.set("n", "K", function() + vim.cmd.RustLsp({ "hover", "actions" }) + end, { silent = true, buffer = bufnr }) +end diff --git a/common/.config/nvim/lsp/rust_analyzer.lua b/common/.config/nvim/lsp/rust_analyzer.lua deleted file mode 100644 index a564707..0000000 --- a/common/.config/nvim/lsp/rust_analyzer.lua +++ /dev/null @@ -1 +0,0 @@ -return {} diff --git a/common/.config/nvim/lua/core/lsp.lua b/common/.config/nvim/lua/core/lsp.lua index 96254da..20be883 100644 --- a/common/.config/nvim/lua/core/lsp.lua +++ b/common/.config/nvim/lua/core/lsp.lua @@ -1,3 +1,7 @@ +-- TIP: +-- Step 1: Install the LSP through either of the following: +-- OS Installer > Brew-linux > Mason NeoVim Plugin +-- Step 2: Append the LSP server name in the below array vim.lsp.enable({ "bashls", "cssls", @@ -6,38 +10,58 @@ vim.lsp.enable({ "html", "jsonls", "lua_ls", - "omnisharp", "pylsp", - "rust_analyzer", "sqlls", "ts_ls", - -- TODO: Enable inlay_hints for all of them }) -- TIP: On new systems, install these through Mason +-- They aren't usually found on either OS installer or brew-linux ---@diagnostic disable-next-line: unused-local local to_installed = vim.tbl_keys({ - "black", -- Python formatter - "csharpier", -- C# formatter - "djlint", -- Handlebar Formatter - "markdown-toc", - "markdownlint", - "netcoredbg", -- C# Debugger - "prettier", - "prettierd", - "shellharden", - "shfmt", - "stylua", - "trivy", -- Vulnerability Linter - "yamlfmt", + "codelldb", + "css-lsp", + "docker-compose-language-service", + "html-lsp", + "json-lsp", + "sqlls", }) +-- Setup native diagnostic +vim.diagnostic.config({ + underline = true, + update_in_insert = false, + severity_sort = true, + float = { + border = "rounded", + source = true, + }, + virtual_text = { + enabled = true, + severity = { min = vim.diagnostic.severity.ERROR }, + }, + virtual_lines = { + current_line = true, + severity = { min = vim.diagnostic.severity.INFO }, + }, +}) + +-- Change diagnostic symbols in the sign column (gutter) +if vim.g.have_nerd_font then + local signs = require("config.util").icons.diagnostics + local diagnostic_signs = {} + for type, icon in pairs(signs) do + diagnostic_signs[vim.diagnostic.severity[type]] = icon + end + vim.diagnostic.config({ signs = { text = diagnostic_signs } }) +end + vim.api.nvim_create_autocmd("LspAttach", { group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }), callback = function(event) local client = vim.lsp.get_client_by_id(event.data.client_id) - -- Setup LSP completion + -- Setup native LSP completion -- This is already done by blink, but better prefer the builtin one if client:supports_method("textDocument/completion") then vim.opt.completeopt = { "menu", "menuone", "noinsert", "fuzzy", "popup" } diff --git a/common/.config/nvim/lua/plugins/code-lsp.lua b/common/.config/nvim/lua/plugins/code-lsp.lua index 20e31dd..946be03 100644 --- a/common/.config/nvim/lua/plugins/code-lsp.lua +++ b/common/.config/nvim/lua/plugins/code-lsp.lua @@ -57,4 +57,28 @@ return { }, }, }, + + -- Rust + { + "mrcjkb/rustaceanvim", + version = "^6", + config = function() + vim.g.rusteceanvim = { + dap = { + adapter = { + type = "executable", + command = "codelldb", + name = "codelldb", + }, + }, + } + end, + }, + { + "saecki/crates.nvim", + tag = "stable", + config = function() + require("crates").setup() + end, + }, } diff --git a/common/.config/nvim/lua/plugins/lang-rust.lua b/common/.config/nvim/lua/plugins/lang-rust.lua deleted file mode 100644 index 0801793..0000000 --- a/common/.config/nvim/lua/plugins/lang-rust.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - { - "saecki/crates.nvim", - tag = "stable", - config = function() - require("crates").setup() - end, - }, -} diff --git a/scripts/package-list-brew b/scripts/package-list-brew index d1432bd..7dc480b 100644 --- a/scripts/package-list-brew +++ b/scripts/package-list-brew @@ -3,6 +3,7 @@ bat bats-core dnscrypt-proxy +dockerfile-language-server fd fzf gitleaks @@ -13,20 +14,31 @@ kondo lazydocker lazygit lua -luajit lua-language-server +luajit +markdown-toc +markdownlint-cli +marksman n neovim +prettier prettierd +python-lsp-server python@3.12 rclone sccache shellcheck +shellharden shodan speedtest-cli sqlite +stylua +taplo tlrc tokei tree-sitter +typescript-language-server +vue-language-server +yamlfmt yt-dlp zoxide diff --git a/scripts/package-list-os b/scripts/package-list-os index 27413ab..d6cf0a2 100644 --- a/scripts/package-list-os +++ b/scripts/package-list-os @@ -10,6 +10,7 @@ libavcodec-extra akmod-nvidia dnf-plugins-core libva-nvidia-driver +nodejs-bash-language-server xorg-x11-drv-nvidia-cuda # Common @@ -17,7 +18,6 @@ aspnetcore-runtime-8.0 bash bat bleachbit -brave-browser btop cmake code @@ -29,8 +29,6 @@ docker-ce-cli docker-compose-plugin dolphin dolphin-plugins -dotnet-runtime-8.0 -dotnet-sdk-8.0 evolution-ews evolution-mapi fd-find @@ -72,7 +70,7 @@ qbittorrent rclone ripgrep sccache -ShellCheck +shellcheck simplescreenrecorder smplayer software-properties-common @@ -81,6 +79,7 @@ syncthing tmux tokei tree-sitter-cli +trivy ufw ulauncher vim @@ -94,7 +93,6 @@ zsh # FreeBSD packages codespell -dotnet html fusefs-lkl firefox-esr