File tree Expand file tree Collapse file tree 3 files changed +7
-1
lines changed
Expand file tree Collapse file tree 3 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 4646
4747``` lua
4848{
49+ enabled = function (bufnr ) return true end , -- control if auto-pairs should be enabled when attaching to a buffer
4950 disable_filetype = { " TelescopePrompt" , " spectre_panel" },
5051 disable_in_macro = true , -- disable when recording or executing a macro
5152 disable_in_visualblock = false , -- disable when insert after visual block mode
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ DEFAULT VALUES *nvim-autopairs-default-values*
5959
6060>
6161 {
62+ enabled = function(bufnr) return true end, -- control if auto-pairs should be enabled when attaching to a buffer
6263 disable_filetype = { "TelescopePrompt", "spectre_panel" }
6364 disable_in_macro = true -- disable when recording or executing a macro
6465 disable_in_visualblock = false -- disable when insert after visual block mode
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ local default = {
1616 map_c_h = false ,
1717 map_c_w = false ,
1818 map_cr = true ,
19+ enabled = nil ,
1920 disable_filetype = { ' TelescopePrompt' , ' spectre_panel' },
2021 disable_in_macro = true ,
2122 disable_in_visualblock = false ,
@@ -194,7 +195,10 @@ local function is_disable()
194195 return true
195196 end
196197
197- if utils .check_filetype (M .config .disable_filetype , vim .bo .filetype ) then
198+ if
199+ utils .check_filetype (M .config .disable_filetype , vim .bo .filetype )
200+ or (M .config .enabled and not M .config .enabled (api .nvim_get_current_buf ()))
201+ then
198202 del_keymaps ()
199203 M .set_buf_rule ({}, 0 )
200204 return true
You can’t perform that action at this time.
0 commit comments