nvim/lua/custom/plugins/context.lua
Jeremie Fraeys 02e26b00b7
Some checks are pending
Check Lua Formatting in MyRepo / Stylua Check (push) Waiting to run
chore(nvim): reinitialize with working config
2026-02-07 21:06:45 -05:00

28 lines
809 B
Lua

return {
'nvim-treesitter/nvim-treesitter-context',
event = 'BufReadPost',
config = function()
require('treesitter-context').setup({
max_lines = 3,
multiwindow = false,
multiline_threshold = 1,
trim_scope = 'inner',
mode = 'cursor', -- faster than 'cursor'
separator = '',
on_attach = function(buf)
-- disable for large files
if vim.api.nvim_buf_line_count(buf) > 3000 then
return false
end
-- disable for specific filetypes
local disabled = { 'markdown', 'text', 'help', 'json', 'yaml' }
if vim.tbl_contains(disabled, vim.bo[buf].filetype) then
return false
end
return true
end,
})
vim.keymap.set('n', '<leader>uc', '<cmd>TSContext toggle<cr>')
end,
}