commit 9ea84758b3cfc19a46c78e52641492b26fd052a4
parent 92ed4bd7ca83026714f03a090c05f39cc359b7f9
Author: Alex Balgavy <alexander.balgavy@spaceapplications.com>
Date: Sat, 14 Dec 2024 15:45:36 +0100
nvim: settings
Diffstat:
4 files changed, 107 insertions(+), 52 deletions(-)
diff --git a/nvim/lua/config/mason-lspconfig.lua b/nvim/lua/config/mason-lspconfig.lua
@@ -4,6 +4,40 @@ local mason_lspconfig = require 'mason-lspconfig'
-- https://github.com/williamboman/mason-lspconfig.nvim/blob/main/doc/server-mapping.md
-- Add any additional override configuration in the following tables. They will be passed to
-- the `settings` field of the server config. You must look up that documentation yourself.
+local rust_clippy = {
+ command = "clippy",
+ workspace = true,
+ extraArgs = {
+ "--no-deps",
+ "--",
+ "-D", "clippy::pedantic",
+ "-D", "clippy::nursery",
+ "-D", "clippy::restriction",
+ "-A", "clippy::blanket_clippy_restriction_lints",
+ "-A", "clippy::missing_docs_in_private_items",
+ "-A", "clippy::implicit_return",
+ "-A", "clippy::question_mark_used",
+ "-A", "clippy::min_ident_chars",
+ "-A", "clippy::pattern_type_mismatch",
+ "-A", "clippy::single_call_fn",
+ "-A", "clippy::as_conversions",
+ "-A", "clippy::pub_with_shorthand",
+ "-A", "clippy::shadow_reuse",
+ "-A", "clippy::separated_literal_suffix",
+ "-A", "clippy::float_arithmetic",
+ "-A", "clippy::pub_use",
+ "-A", "clippy::single_char_lifetime_names",
+ "-A", "clippy::missing_trait_methods",
+ -- "-A", "clippy::multiple_unsafe_ops_per_block", -- broken on 0.1.74
+ "-A", "clippy::mod_module_files",
+ "-A", "clippy::std_instead_of_alloc",
+ "-A", "clippy::integer_division_remainder_used",
+ "-D", "rust_2018_idioms",
+ "-D", "missing_docs",
+ "-D", "warnings",
+ "-A", "clippy::too_many_lines"
+ },
+}
local servers = {
ansiblels = {},
lua_ls = {
@@ -34,60 +68,13 @@ local servers = {
rust_analyzer = {
['rust-analyzer'] = {
cargo = {
- allFeatures = true,
- loadOutDirsFromCheck = true,
- runBuildScripts = true,
+ features = "all",
-- extraEnv = {
-- RUSTFLAGS = "--cfg tokio_unstable",
-- },
},
-- Add clippy lints for Rust.
- checkOnSave = {
- allFeatures = true,
- command = "clippy",
- extraArgs = {
- -- "--no-deps",
- "--",
- "-D", "clippy::pedantic",
- "-D", "clippy::nursery",
- "-D", "clippy::restriction",
- "-A", "clippy::blanket_clippy_restriction_lints",
- "-A", "clippy::missing_docs_in_private_items",
- "-A", "clippy::implicit_return",
- "-A", "clippy::question_mark_used",
- "-A", "clippy::min_ident_chars",
- "-A", "clippy::pattern_type_mismatch",
- "-A", "clippy::single_call_fn",
- "-A", "clippy::as_conversions",
- "-A", "clippy::pub_with_shorthand",
- "-A", "clippy::shadow_reuse",
- "-A", "clippy::separated_literal_suffix",
- "-A", "clippy::float_arithmetic",
- "-A", "clippy::pub_use",
- "-A", "clippy::single_char_lifetime_names",
- "-A", "clippy::missing_trait_methods",
- "-A", "clippy::multiple_unsafe_ops_per_block", -- broken on 0.1.74
- "-A", "clippy::mod_module_files",
- "-A", "clippy::std_instead_of_alloc",
- "-A", "clippy::integer_division_remainder_used",
- "-D", "rust_2018_idioms",
- "-D", "missing_docs",
- "-D", "warnings",
- "-A", "clippy::too_many_lines"
- },
- --[[
- command = "check",
- ]]
- -- extraArgs = { "--no-deps" },
- },
- procMacro = {
- enable = true,
- ignored = {
- ["async-trait"] = { "async_trait" },
- ["napi-derive"] = { "napi" },
- ["async-recursion"] = { "async_recursion" },
- },
- },
+ check = rust_clippy,
},
},
pyright = {},
diff --git a/nvim/lua/config/telescope.lua b/nvim/lua/config/telescope.lua
@@ -26,6 +26,8 @@ vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { de
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').lsp_references, { desc = '[S]earch [R]eferences' })
vim.keymap.set('n', '<leader>s<', require('telescope.builtin').lsp_incoming_calls, { desc = '[S]earch [I]ncoming calls' })
vim.keymap.set('n', '<leader>s>', require('telescope.builtin').lsp_outgoing_calls, { desc = '[S]earch [O]utgoing calls' })
+vim.keymap.set('n', '<leader>st', require('telescope.builtin').current_buffer_fuzzy_find,
+ { desc = '[Search] [T]his buffer' })
vim.keymap.set('n', '<leader>sI', require('telescope.builtin').lsp_implementations,
{ desc = '[S]earch [i]mplementations' })
vim.keymap.set('n', '<leader>ss', function()
diff --git a/nvim/lua/netrw_target.lua b/nvim/lua/netrw_target.lua
@@ -0,0 +1,25 @@
+function TargetDir()
+ local target = vim.api.nvim_call_function('netrw#Expose', { 'netrwmftgt' })
+ if target == 'n/a' then
+ return 'No target set'
+ else
+ target = target:gsub("^" .. vim.loop.os_homedir(), "~")
+ return 'Target: ' .. target .. ' '
+ end
+end
+
+vim.api.nvim_create_augroup('netrw_target', { clear = true })
+vim.api.nvim_create_autocmd('FileType', {
+ group = 'netrw_target',
+ pattern = 'netrw',
+ callback = function()
+ vim.opt_local.winbar = '%!v:lua.WinBarNetRW()'
+ end
+})
+
+WinBarNetRW = function()
+ return table.concat {
+ '%#StatusLineNC#',
+ TargetDir(),
+ }
+end
diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua
@@ -15,6 +15,20 @@ return {
'williamboman/mason-lspconfig.nvim',
config = function()
require 'config.mason-lspconfig'
+
+ -- Workaround: https://github.com/neovim/neovim/issues/30985
+ if vim.fn.has('nvim-0.11.0-dev') ~= 1 then
+ error("Check if you still need this LSP workaround")
+ end
+ for _, method in ipairs({ 'textDocument/diagnostic', 'workspace/diagnostic' }) do
+ local default_diagnostic_handler = vim.lsp.handlers[method]
+ vim.lsp.handlers[method] = function(err, result, context, config)
+ if err ~= nil and err.code == -32802 then
+ return
+ end
+ return default_diagnostic_handler(err, result, context, config)
+ end
+ end
end,
},
@@ -358,6 +372,32 @@ return {
event = "VeryLazy",
},
{
+ "echasnovski/mini.animate",
+ config = function()
+ local animate = require('mini.animate')
+ animate.setup({
+ cursor = {
+ enable = false,
+ },
+ scroll = {
+ enable = false,
+ timing = animate.gen_timing.linear({ duration = 50, unit = 'total' }),
+ },
+ resize = {
+ enable = false,
+ timing = animate.gen_timing.linear({ duration = 50, unit = 'total' }),
+ },
+ open = {
+ enable = false,
+ },
+ close = {
+ enable = false,
+ },
+ })
+ end,
+ version = false,
+ },
+ {
"m00qek/baleia.nvim",
version = "*",
config = function()
@@ -408,14 +448,15 @@ return {
}
end,
formatters = {
- ruff = {
- prepend_args = { "--config", "~/Documents/cdmi/automation/meta-files/ruff.toml" },
+ ruff_format = {
+ inherit = true,
+ append_args = { "--config", "~/Documents/cdmi/automation/meta-files/ruff.toml" },
},
},
formatters_by_ft = {
rust = { "rustfmt", lsp_format = "fallback" },
- python = { "ruff", lsp_format = "fallback" },
ruby = { "rubyfmt", lsp_format = "fallback" },
+ python = { "ruff_format", "ruff_organize_imports", lsp_format = "fallback" },
-- python = { "black", lsp_format = "fallback" },
-- -- lua = { 'stylua' },
-- -- Conform can also run multiple formatters sequentially