Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added disabled_when config option #65

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ The available options in `keys`:
- `disabled_filetypes`: Table of filetypes where the specific key should not be autoclosed.
- `enabled_filetypes`: Only autoclose the key under these filetypes. This option takes precedence over `disabled_filetypes`.
- `disable_command_mode`: If set to true, the character will be disabled in command-line mode.
- `disabled_when`: Function returning true when pair should be disabled.

Example: Add a `$$` pair.
```Lua
Expand Down
4 changes: 4 additions & 0 deletions lua/autoclose.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ local function is_pair(pair)
end

local function is_disabled(info)
if info.disabled_when and info.disabled_when() then
return true
end

if config.disabled then
return true
end
Expand Down