return { 'romgrk/nvim-treesitter-context', dependencies = 'nvim-treesitter/nvim-treesitter', config = function() -- " Configuration for context.vim -- "" Disable context.vim on json files vim.g.context_filetype_blacklist = {"json", "log"} require('treesitter-context').setup{ enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) throttle = true, -- Throttles plugin updates (may improve performance) max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. mode = 'topline', patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries. -- For all filetypes -- Note that setting an entry here replaces all other patterns for this entry. -- By setting the 'default' entry below, you can control which nodes you want to -- appear in the context window. default = { 'class', 'function', 'method', 'for', 'while', 'if', 'switch', -- 'case', }, -- Example for a specific filetype. -- If a pattern is missing, *open a PR* so everyone can benefit. rust = { 'impl_item', }, }, exact_patterns = { -- Example for a specific filetype with Lua patterns -- Treat patterns.rust as a Lua pattern (i.e "^impl_item$" will -- exactly match "impl_item" only) rust = true, }, on_attach = function(buf) local max_filesize = 100 * 1024 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 false end return true end } end }