some further fixes and modifications

This commit is contained in:
Adam Poniatowski 2026-07-04 14:26:18 +02:00
parent e408a53858
commit 78fc3d5aea
No known key found for this signature in database
GPG Key ID: E08510DAEC63C586
9 changed files with 102 additions and 159 deletions

View File

@ -24,14 +24,12 @@ M.session_keymaps = plugins.session
M.scratch_keymaps = plugins.scratch M.scratch_keymaps = plugins.scratch
M.snacks_keymaps = plugins.snacks M.snacks_keymaps = plugins.snacks
M.leap_keymaps = plugins.leap M.leap_keymaps = plugins.leap
M.elixir_keymaps = plugins.elixir
M.mini_surround_keymaps = plugins.mini_surround M.mini_surround_keymaps = plugins.mini_surround
-- Setup functions -- Setup functions
M.setup_gitsigns_keymaps = git.setup M.setup_gitsigns_keymaps = git.setup
M.setup_dadbod_keymaps = plugins.setup_dadbod M.setup_dadbod_keymaps = plugins.setup_dadbod
M.setup_session_keymaps = plugins.setup_session M.setup_session_keymaps = plugins.setup_session
M.setup_elixir_keymaps = plugins.setup_elixir
M.setup_leap_keymaps = plugins.setup_leap M.setup_leap_keymaps = plugins.setup_leap
-- Default on_attach for LSP (used by lsp/setup.lua) -- Default on_attach for LSP (used by lsp/setup.lua)
@ -107,7 +105,6 @@ local function init_keymaps()
plugins.setup_dadbod() plugins.setup_dadbod()
plugins.setup_session() plugins.setup_session()
plugins.setup_leap() plugins.setup_leap()
plugins.setup_elixir()
git.setup() git.setup()
-- Tab navigation -- Tab navigation

View File

@ -1,5 +1,5 @@
---@diagnostic disable: undefined-global ---@diagnostic disable: undefined-global
-- Plugin keymaps (dadbod, session, scratch, snacks, leap, elixir, mini-surround) -- Plugin keymaps (dadbod, session, scratch, snacks, leap, mini-surround)
local M = {} local M = {}
@ -58,13 +58,6 @@ M.leap = {
end, opts = { desc = 'Leap: Search across windows' } }, end, opts = { desc = 'Leap: Search across windows' } },
} }
-- Elixir keymaps
M.elixir = {
{ mode = 'n', lhs = '<leader>xt', rhs = function() require('elixir').run_test_file() end, opts = { desc = 'Elixir: Test file' } },
{ mode = 'n', lhs = '<leader>xn', rhs = function() require('elixir').run_nearest_test() end, opts = { desc = 'Elixir: Test nearest' } },
{ mode = 'n', lhs = '<leader>xm', rhs = function() vim.cmd('Telescope elixir mix') end, opts = { desc = 'Elixir: Mix tasks' } },
}
-- Mini-surround keymaps (used by mini.surround config) -- Mini-surround keymaps (used by mini.surround config)
M.mini_surround = { M.mini_surround = {
add = 'sa', add = 'sa',
@ -111,10 +104,4 @@ function M.setup_leap()
end end
end end
function M.setup_elixir()
for _, mapping in ipairs(M.elixir) do
vim.keymap.set(mapping.mode, mapping.lhs, mapping.rhs, mapping.opts)
end
end
return M return M

View File

@ -4,5 +4,4 @@ return {
require('plugins.coding.zig'), require('plugins.coding.zig'),
require('plugins.coding.clangd'), require('plugins.coding.clangd'),
require('plugins.coding.dap'), require('plugins.coding.dap'),
require('plugins.coding.elixir'),
} }

View File

@ -1,38 +0,0 @@
return {
{
'elixir-tools/elixir-tools.nvim',
version = '*',
ft = { 'ex', 'exs', 'heex', 'eex', 'elixir' },
dependencies = {
'neovim/nvim-lspconfig',
'nvim-lua/plenary.nvim',
},
config = function()
local elixir = require('elixir')
-- Configure elixir-tools with LSP disabled (handled by lspconfig)
elixir.setup({
-- Disable the built-in LSP client to avoid conflicts
elixirls = { enable = false },
-- Enable non-LSP features
credo = { enable = true },
projectionist = { enable = true },
-- Configure the test runner
test_runner = {
enabled = true,
runner = 'exunit', -- or 'exunit_individual' for individual test runs
},
-- Enable mix integration
mix = {
enabled = true,
format_on_save = false, -- Disabled to prevent file changed warnings
},
})
-- Keymaps are now in core/keymaps.lua with <leader>lx prefix
end,
},
}

View File

@ -8,6 +8,17 @@ local gopls_build_flags = go_flags ~= '' and { '-tags=' .. go_flags } or {}
return { return {
-- Python -- Python
pyright = {}, pyright = {},
-- Bash/Shell
bashls = {
filetypes = { 'sh', 'bash', 'zsh' },
settings = {
bashIde = {
globPattern = '*@(.sh|.inc|.bash|.command)',
shellcheckPath = 'shellcheck',
},
},
},
-- Go -- Go
gopls = { gopls = {
settings = { settings = {
@ -131,17 +142,4 @@ return {
}, },
}, },
}, },
-- Elixir
elixirls = {
cmd = { 'elixir-ls' },
settings = {
elixirLS = {
dialyzerEnabled = true,
fetchDeps = true,
enableTestLenses = true,
suggestSpecs = true,
}
}
}
} }

View File

@ -63,11 +63,8 @@ function M.setup()
M.default_on_attach = function(client, bufnr) M.default_on_attach = function(client, bufnr)
require('core.keymaps').setup_lsp_keymaps(bufnr) require('core.keymaps').setup_lsp_keymaps(bufnr)
-- Only attach navic if: -- Attach navic if client supports document symbols
-- 1. The client supports document symbols if client.server_capabilities.documentSymbolProvider then
-- 2. The client isn't elixirls (handled by elixir-tools.nvim)
if client.server_capabilities.documentSymbolProvider
and client.name ~= 'elixirls' then
local status_ok, _ = pcall(require, 'nvim-navic') local status_ok, _ = pcall(require, 'nvim-navic')
if status_ok then if status_ok then
require('nvim-navic').attach(client, bufnr) require('nvim-navic').attach(client, bufnr)

View File

@ -8,44 +8,45 @@ function M.setup()
local formatting = null_ls.builtins.formatting local formatting = null_ls.builtins.formatting
local diagnostics = null_ls.builtins.diagnostics local diagnostics = null_ls.builtins.diagnostics
null_ls.setup { local sources = {
formatting.gofumpt.with({ extra_args = { "-extra" } }),
formatting.goimports.with({ args = { "-local", "", "-w", "$FILENAME" } }),
diagnostics.golangci_lint.with({
diagnostics_format = '#{m}',
extra_args = {
'--fast',
'--max-issues-per-linter', '30',
'--max-same-issues', '4',
'--max-same-issues-per-linter', '0',
'--fix=false',
'--tests=false',
'--print-issued-lines=false',
'--timeout=10s',
'--out-format=json',
},
method = null_ls.methods.DIAGNOSTICS_ON_SAVE,
timeout = 10000,
}),
formatting.prettier.with {
filetypes = { 'css', 'scss', 'html', 'markdown', 'yaml', 'yml' },
extra_args = {
'--bracket-same-line',
'--trailing-comma', 'all',
'--tab-width', '2',
'--semi',
'--single-quote',
},
},
formatting.shfmt.with { extra_args = { '-i', '2', '-ci', '-bn' } },
formatting.sqlfluff.with { extra_args = { '--dialect', 'tsql' } },
}
null_ls.setup {
root_dir = null_ls_utils.root_pattern('.null-ls-root', 'Makefile', '.git'), root_dir = null_ls_utils.root_pattern('.null-ls-root', 'Makefile', '.git'),
timeout = 10000, timeout = 10000,
debounce = 250, debounce = 250,
update_in_insert = false, update_in_insert = false,
sources = { sources = sources,
formatting.gofumpt.with({ extra_args = { "-extra" } }),
formatting.goimports.with({ args = { "-local", "", "-w", "$FILENAME" } }),
diagnostics.golangci_lint.with({
diagnostics_format = '#{m}',
extra_args = {
'--fast',
'--max-issues-per-linter', '30',
'--max-same-issues', '4',
'--max-same-issues-per-linter', '0',
'--fix=false',
'--tests=false',
'--print-issued-lines=false',
'--timeout=10s',
'--out-format=json',
},
method = null_ls.methods.DIAGNOSTICS_ON_SAVE,
timeout = 10000,
}),
formatting.prettier.with {
filetypes = { 'css', 'scss', 'html', 'markdown', 'yaml', 'yml' },
extra_args = {
'--bracket-same-line',
'--trailing-comma', 'all',
'--tab-width', '2',
'--semi',
'--single-quote',
},
},
formatting.shfmt.with { extra_args = { '-i', '2', '-ci', '-bn' } },
formatting.sqlfluff.with { extra_args = { '--dialect', 'tsql' } },
},
} }
end end

View File

@ -44,6 +44,7 @@ return {
require('mason-tool-installer').setup { require('mason-tool-installer').setup {
ensure_installed = { ensure_installed = {
'lua-language-server', 'lua-language-server',
'stylua', -- Lua formatter
'marksman', 'marksman',
-- Go tools -- Go tools
'gopls', -- Go LSP 'gopls', -- Go LSP
@ -64,8 +65,10 @@ return {
'debugpy', -- Python debugger 'debugpy', -- Python debugger
-- SQL tools -- SQL tools
'sqls', -- Advanced SQL LSP 'sqls', -- Advanced SQL LSP
-- Elixir -- Shell tools
'elixir-ls' -- Elixir LSP 'bash-language-server', -- Bash LSP
'shellcheck', -- Shell linter
'shfmt', -- Shell formatter
}, },
auto_update = true, auto_update = true,
run_on_start = true, run_on_start = true,

View File

@ -1,54 +1,53 @@
return { return {
-- Highlight, edit, and navigate code {
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
dependencies = { branch = 'main',
'nvim-treesitter/nvim-treesitter-textobjects', lazy = false,
}, build = ':TSUpdate',
build = function() config = function()
local ts_update = require('nvim-treesitter.install').update({ with_sync = true }) local parsers = {
ts_update() 'bash', 'c', 'cpp', 'diff', 'html', 'lua', 'luadoc',
-- Install C++ parser explicitly to avoid tarball issues 'markdown', 'markdown_inline', 'python', 'rust',
vim.cmd('silent! TSInstall cpp') 'javascript', 'typescript', 'tsx', 'json', 'yaml', 'query',
end, 'vim', 'vimdoc', 'comment', 'regex', 'go', 'gomod', 'gosum',
main = 'nvim-treesitter.configs', -- Sets main module to use for opts }
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
opts = {
-- List of languages to ensure are installed
ensure_installed = {
'bash', 'c', 'cpp', 'diff', 'html', 'lua', 'luadoc',
'markdown', 'markdown_inline', 'python', 'rust',
'javascript', 'typescript', 'json', 'yaml', 'query',
'vim', 'vimdoc', 'comment', 'regex'
},
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
auto_install = true,
-- List of parsers to ignore installing (for "all")
ignore_install = { 'phpdoc' },
highlight = { local nts = require('nvim-treesitter')
enable = true, local installed = nts.get_installed and nts.get_installed('parsers') or {}
-- Additional filetypes to enable highlighting for local have = {}
additional_vim_regex_highlighting = { 'ruby' }, for _, p in ipairs(installed) do have[p] = true end
-- Disable for large files local missing = {}
disable = function(_, buf) for _, p in ipairs(parsers) do
local max_filesize = 100 * 1024 -- 100 KB if not have[p] then table.insert(missing, p) end
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) end
if ok and stats and stats.size > max_filesize then if #missing > 0 then nts.install(missing) end
return true
end local max_filesize = 100 * 1024
end, vim.api.nvim_create_autocmd('FileType', {
}, callback = function(args)
indent = { local buf = args.buf
enable = true, local lang = vim.treesitter.language.get_lang(vim.bo[buf].filetype)
disable = { 'ruby', 'yaml' } if not lang then return end
}, local ok_p = pcall(vim.treesitter.language.add, lang)
if not ok_p then return end
local fname = vim.api.nvim_buf_get_name(buf)
local ok, stats = pcall(vim.loop.fs_stat, fname)
if ok and stats and stats.size > max_filesize then return end
pcall(vim.treesitter.start, buf, lang)
if lang ~= 'yaml' then
vim.bo[buf].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end
end,
})
end,
},
{
'nvim-treesitter/nvim-treesitter-textobjects',
branch = 'main',
dependencies = { 'nvim-treesitter/nvim-treesitter' },
event = 'VeryLazy',
}, },
-- There are additional nvim-treesitter modules that you can use to interact
-- with nvim-treesitter. You should go explore a few and see what interests you:
--
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
} }