Awesome Open Source
Awesome Open Source


Lightweight alternative to context.vim implemented with nvim-treesitter.


Neovim >= v0.7.x

Note: if you need support for Neovim 0.6.x please use the tag compat/0.6.


via vim-plug

Plug 'nvim-treesitter/nvim-treesitter'
Plug 'nvim-treesitter/nvim-treesitter-context'

via packer

use 'nvim-treesitter/nvim-treesitter'
use 'nvim-treesitter/nvim-treesitter-context'




This plugins uses the new neovim WinScrolled event when available to update its context window. Make sure to have a recent neovim build to get this behavior. The fallback behavior is to update its content on CursorMoved.


(Default values are shown below)

    enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
    max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
    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 = {
            -- 'for', -- These won't appear in the context
            -- '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,

    -- [!] The options below are exposed but shouldn't require your attention,
    --     you can safely ignore them.

    zindex = 20, -- The Z-index of the context window


TSContextEnable, TSContextDisable and TSContextToggle.


Use the highlight group TreesitterContext to change the colors of the context. Per default it links to NormalFloat.

Use the highlight group TreesitterContextLineNumber to change the colors of the context line numbers if line_numbers is set. Per default it links to LineNr.

Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Vim (18,654
Neovim (3,939
Vim Plugin (2,485
Neovim Plugin (617