Skip to content

Commit

Permalink
new functions: ua.enable(), ua.disable(), ua.toggle()
Browse files Browse the repository at this point in the history
  • Loading branch information
altermo committed Jun 24, 2023
1 parent 547a7ba commit 638d2fe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
5 changes: 4 additions & 1 deletion doc/tags
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ ultimate-autopair-config-type-default ultimate-autopair.txt /*ultimate-autopair-
ultimate-autopair-config-type-map ultimate-autopair.txt /*ultimate-autopair-config-type-map*
ultimate-autopair-config-type-raw ultimate-autopair.txt /*ultimate-autopair-config-type-raw*
ultimate-autopair-debug ultimate-autopair.txt /*ultimate-autopair-debug*
ultimate-autopair-disable-maps ultimate-autopair.txt /*ultimate-autopair-disable-maps*
ultimate-autopair-disable ultimate-autopair.txt /*ultimate-autopair-disable*
ultimate-autopair-enable ultimate-autopair.txt /*ultimate-autopair-enable*
ultimate-autopair-experimental ultimate-autopair.txt /*ultimate-autopair-experimental*
ultimate-autopair-ext-alpha ultimate-autopair.txt /*ultimate-autopair-ext-alpha*
ultimate-autopair-ext-cmdtype ultimate-autopair.txt /*ultimate-autopair-ext-cmdtype*
Expand All @@ -31,6 +32,7 @@ ultimate-autopair-map ultimate-autopair.txt /*ultimate-autopair-map*
ultimate-autopair-map-backspace ultimate-autopair.txt /*ultimate-autopair-map-backspace*
ultimate-autopair-map-backspace-config ultimate-autopair.txt /*ultimate-autopair-map-backspace-config*
ultimate-autopair-map-fastwarp-config ultimate-autopair.txt /*ultimate-autopair-map-fastwarp-config*
ultimate-autopair-map-multi-config ultimate-autopair.txt /*ultimate-autopair-map-multi-config*
ultimate-autopair-map-newline ultimate-autopair.txt /*ultimate-autopair-map-newline*
ultimate-autopair-map-newline-config ultimate-autopair.txt /*ultimate-autopair-map-newline-config*
ultimate-autopair-map-space-config ultimate-autopair.txt /*ultimate-autopair-map-space-config*
Expand All @@ -45,6 +47,7 @@ ultimate-autopair-rfastwarp ultimate-autopair.txt /*ultimate-autopair-rfastwarp*
ultimate-autopair-space ultimate-autopair.txt /*ultimate-autopair-space*
ultimate-autopair-space2 ultimate-autopair.txt /*ultimate-autopair-space2*
ultimate-autopair-test ultimate-autopair.txt /*ultimate-autopair-test*
ultimate-autopair-toggle ultimate-autopair.txt /*ultimate-autopair-toggle*
ultimate-autopair-writing-config-types ultimate-autopair.txt /*ultimate-autopair-writing-config-types*
ultimate-autopair-writing-extensions ultimate-autopair.txt /*ultimate-autopair-writing-extensions*
ultimate-autopair.nvim ultimate-autopair.txt /*ultimate-autopair.nvim*
10 changes: 8 additions & 2 deletions doc/ultimate-autopair.txt
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,13 @@ The root directory `notes` contains notes and scribbles about the plugin.
ultimate-autopair-experimental *ultimate-autopair-experimental*
`experimental` directory contains experimental features.
------------------------------------------------------------------------------
ultimate-autopair-disable-maps *ultimate-autopair-disable-maps*
To disable mappings, use `require'ultimate-autopair.core'.disable=true`.
ultimate-autopair-disable *ultimate-autopair-disable*
To disable ultimate-autopair, use `require'ultimate-autopair'.disable()`.
------------------------------------------------------------------------------
ultimate-autopair-enable *ultimate-autopair-enable*
To enable ultimate-autopair, use `require'ultimate-autopair'.enable()`.
------------------------------------------------------------------------------
ultimate-autopair-toggle *ultimate-autopair-toggle*
To toggle ultimate-autopair, use `require'ultimate-autopair'.toggle()`.

vim:ft=help:
8 changes: 4 additions & 4 deletions lua/ultimate-autopair/init.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
local config=require'ultimate-autopair.config'
local debug=require'ultimate-autopair.debug'
local default=require'ultimate-autopair.default'
local core=require'ultimate-autopair.core'
local M={}
function M._extend_with_pair_opt(pair)
vim.tbl_extend('error',pair,{fly=true,dosuround=true,newline=true,space=true,fastwarp=true})
end
function M.toggle() core.disable=not core.disable end
function M.enable() core.disable=false end
function M.disable() core.disable=true end
function M._list()
local core=require'ultimate-autopair.core'
vim.ui.select(core.mem,{format_item=function (item)
if item.pair then
return item.pair..' '..(item.doc or '')
Expand Down

0 comments on commit 638d2fe

Please sign in to comment.