Skip to content

Commit

Permalink
Don't enable the mapping for netrw buffers
Browse files Browse the repository at this point in the history
This fixes #3.
  • Loading branch information
yorickpeterse committed Apr 24, 2024
1 parent 5859b79 commit b92141b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lua/tree-pairs/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ local PAIRS = {
['`'] = true,
}

-- File types for which to _not_ enable the plugin.
local DISABLE_FT = {
netrw = true,
}

local function jump_to_node(node, jump_to_end)
local start_row, start_col, end_row, end_col = node:range(false)

Expand Down Expand Up @@ -150,6 +155,11 @@ function M.setup()
desc = 'Sets up tree-pairs for a buffer',
callback = function()
local buf = api.nvim_get_current_buf()

if DISABLE_FT[vim.bo[buf].ft] then
return
end

local opts = {
desc = 'Jump to the opposite end of the current Tree-sitter node',
buffer = buf,
Expand Down

0 comments on commit b92141b

Please sign in to comment.