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.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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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'),
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,7 @@ 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 = {
|
||||||
|
|
||||||
root_dir = null_ls_utils.root_pattern('.null-ls-root', 'Makefile', '.git'),
|
|
||||||
timeout = 10000,
|
|
||||||
debounce = 250,
|
|
||||||
update_in_insert = false,
|
|
||||||
sources = {
|
|
||||||
formatting.gofumpt.with({ extra_args = { "-extra" } }),
|
formatting.gofumpt.with({ extra_args = { "-extra" } }),
|
||||||
formatting.goimports.with({ args = { "-local", "", "-w", "$FILENAME" } }),
|
formatting.goimports.with({ args = { "-local", "", "-w", "$FILENAME" } }),
|
||||||
diagnostics.golangci_lint.with({
|
diagnostics.golangci_lint.with({
|
||||||
|
|
@ -45,7 +39,14 @@ function M.setup()
|
||||||
},
|
},
|
||||||
formatting.shfmt.with { extra_args = { '-i', '2', '-ci', '-bn' } },
|
formatting.shfmt.with { extra_args = { '-i', '2', '-ci', '-bn' } },
|
||||||
formatting.sqlfluff.with { extra_args = { '--dialect', 'tsql' } },
|
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
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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()
|
|
||||||
-- 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 = {
|
|
||||||
'bash', 'c', 'cpp', 'diff', 'html', 'lua', 'luadoc',
|
'bash', 'c', 'cpp', 'diff', 'html', 'lua', 'luadoc',
|
||||||
'markdown', 'markdown_inline', 'python', 'rust',
|
'markdown', 'markdown_inline', 'python', 'rust',
|
||||||
'javascript', 'typescript', 'json', 'yaml', 'query',
|
'javascript', 'typescript', 'tsx', 'json', 'yaml', 'query',
|
||||||
'vim', 'vimdoc', 'comment', 'regex'
|
'vim', 'vimdoc', 'comment', 'regex', 'go', 'gomod', 'gosum',
|
||||||
},
|
}
|
||||||
-- 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
|
|
||||||
|
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,
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
indent = {
|
{
|
||||||
enable = true,
|
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||||
disable = { 'ruby', 'yaml' }
|
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