some further fixes and modifications
This commit is contained in:
parent
e408a53858
commit
78fc3d5aea
|
|
@ -24,14 +24,12 @@ M.session_keymaps = plugins.session
|
|||
M.scratch_keymaps = plugins.scratch
|
||||
M.snacks_keymaps = plugins.snacks
|
||||
M.leap_keymaps = plugins.leap
|
||||
M.elixir_keymaps = plugins.elixir
|
||||
M.mini_surround_keymaps = plugins.mini_surround
|
||||
|
||||
-- Setup functions
|
||||
M.setup_gitsigns_keymaps = git.setup
|
||||
M.setup_dadbod_keymaps = plugins.setup_dadbod
|
||||
M.setup_session_keymaps = plugins.setup_session
|
||||
M.setup_elixir_keymaps = plugins.setup_elixir
|
||||
M.setup_leap_keymaps = plugins.setup_leap
|
||||
|
||||
-- Default on_attach for LSP (used by lsp/setup.lua)
|
||||
|
|
@ -107,7 +105,6 @@ local function init_keymaps()
|
|||
plugins.setup_dadbod()
|
||||
plugins.setup_session()
|
||||
plugins.setup_leap()
|
||||
plugins.setup_elixir()
|
||||
git.setup()
|
||||
|
||||
-- Tab navigation
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
---@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 = {}
|
||||
|
||||
|
|
@ -58,13 +58,6 @@ M.leap = {
|
|||
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)
|
||||
M.mini_surround = {
|
||||
add = 'sa',
|
||||
|
|
@ -111,10 +104,4 @@ function M.setup_leap()
|
|||
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
|
||||
|
|
|
|||
|
|
@ -4,5 +4,4 @@ return {
|
|||
require('plugins.coding.zig'),
|
||||
require('plugins.coding.clangd'),
|
||||
require('plugins.coding.dap'),
|
||||
require('plugins.coding.elixir'),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
}
|
||||
|
|
@ -8,6 +8,17 @@ local gopls_build_flags = go_flags ~= '' and { '-tags=' .. go_flags } or {}
|
|||
return {
|
||||
-- Python
|
||||
pyright = {},
|
||||
|
||||
-- Bash/Shell
|
||||
bashls = {
|
||||
filetypes = { 'sh', 'bash', 'zsh' },
|
||||
settings = {
|
||||
bashIde = {
|
||||
globPattern = '*@(.sh|.inc|.bash|.command)',
|
||||
shellcheckPath = 'shellcheck',
|
||||
},
|
||||
},
|
||||
},
|
||||
-- Go
|
||||
gopls = {
|
||||
settings = {
|
||||
|
|
@ -131,17 +142,4 @@ return {
|
|||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Elixir
|
||||
elixirls = {
|
||||
cmd = { 'elixir-ls' },
|
||||
settings = {
|
||||
elixirLS = {
|
||||
dialyzerEnabled = true,
|
||||
fetchDeps = true,
|
||||
enableTestLenses = true,
|
||||
suggestSpecs = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,11 +63,8 @@ function M.setup()
|
|||
M.default_on_attach = function(client, bufnr)
|
||||
require('core.keymaps').setup_lsp_keymaps(bufnr)
|
||||
|
||||
-- Only attach navic if:
|
||||
-- 1. The client supports document symbols
|
||||
-- 2. The client isn't elixirls (handled by elixir-tools.nvim)
|
||||
if client.server_capabilities.documentSymbolProvider
|
||||
and client.name ~= 'elixirls' then
|
||||
-- Attach navic if client supports document symbols
|
||||
if client.server_capabilities.documentSymbolProvider then
|
||||
local status_ok, _ = pcall(require, 'nvim-navic')
|
||||
if status_ok then
|
||||
require('nvim-navic').attach(client, bufnr)
|
||||
|
|
|
|||
|
|
@ -8,13 +8,7 @@ function M.setup()
|
|||
local formatting = null_ls.builtins.formatting
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
|
||||
null_ls.setup {
|
||||
|
||||
root_dir = null_ls_utils.root_pattern('.null-ls-root', 'Makefile', '.git'),
|
||||
timeout = 10000,
|
||||
debounce = 250,
|
||||
update_in_insert = false,
|
||||
sources = {
|
||||
local sources = {
|
||||
formatting.gofumpt.with({ extra_args = { "-extra" } }),
|
||||
formatting.goimports.with({ args = { "-local", "", "-w", "$FILENAME" } }),
|
||||
diagnostics.golangci_lint.with({
|
||||
|
|
@ -45,7 +39,14 @@ function M.setup()
|
|||
},
|
||||
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'),
|
||||
timeout = 10000,
|
||||
debounce = 250,
|
||||
update_in_insert = false,
|
||||
sources = sources,
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ return {
|
|||
require('mason-tool-installer').setup {
|
||||
ensure_installed = {
|
||||
'lua-language-server',
|
||||
'stylua', -- Lua formatter
|
||||
'marksman',
|
||||
-- Go tools
|
||||
'gopls', -- Go LSP
|
||||
|
|
@ -64,8 +65,10 @@ return {
|
|||
'debugpy', -- Python debugger
|
||||
-- SQL tools
|
||||
'sqls', -- Advanced SQL LSP
|
||||
-- Elixir
|
||||
'elixir-ls' -- Elixir LSP
|
||||
-- Shell tools
|
||||
'bash-language-server', -- Bash LSP
|
||||
'shellcheck', -- Shell linter
|
||||
'shfmt', -- Shell formatter
|
||||
},
|
||||
auto_update = true,
|
||||
run_on_start = true,
|
||||
|
|
|
|||
|
|
@ -1,54 +1,53 @@
|
|||
return {
|
||||
-- Highlight, edit, and navigate code
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
},
|
||||
build = function()
|
||||
local ts_update = require('nvim-treesitter.install').update({ with_sync = true })
|
||||
ts_update()
|
||||
-- Install C++ parser explicitly to avoid tarball issues
|
||||
vim.cmd('silent! TSInstall cpp')
|
||||
end,
|
||||
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 = {
|
||||
branch = 'main',
|
||||
lazy = false,
|
||||
build = ':TSUpdate',
|
||||
config = function()
|
||||
local parsers = {
|
||||
'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' },
|
||||
'javascript', 'typescript', 'tsx', 'json', 'yaml', 'query',
|
||||
'vim', 'vimdoc', 'comment', 'regex', 'go', 'gomod', 'gosum',
|
||||
}
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
-- Additional filetypes to enable highlighting for
|
||||
additional_vim_regex_highlighting = { 'ruby' },
|
||||
-- Disable for large files
|
||||
disable = function(_, buf)
|
||||
local max_filesize = 100 * 1024 -- 100 KB
|
||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
if ok and stats and stats.size > max_filesize then
|
||||
return true
|
||||
local nts = require('nvim-treesitter')
|
||||
local installed = nts.get_installed and nts.get_installed('parsers') or {}
|
||||
local have = {}
|
||||
for _, p in ipairs(installed) do have[p] = true end
|
||||
local missing = {}
|
||||
for _, p in ipairs(parsers) do
|
||||
if not have[p] then table.insert(missing, p) end
|
||||
end
|
||||
if #missing > 0 then nts.install(missing) end
|
||||
|
||||
local max_filesize = 100 * 1024
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
callback = function(args)
|
||||
local buf = args.buf
|
||||
local lang = vim.treesitter.language.get_lang(vim.bo[buf].filetype)
|
||||
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,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
disable = { 'ruby', 'yaml' }
|
||||
{
|
||||
'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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue