mirror of
https://github.com/vale981/tridactyl
synced 2025-03-06 01:51:40 -05:00
add autocmd! to remove specific autocmds
This commit is contained in:
parent
b026462dd4
commit
06a8e1db53
2 changed files with 13 additions and 0 deletions
|
@ -161,6 +161,8 @@ const DEFAULTS = o({
|
||||||
exaliases: o({
|
exaliases: o({
|
||||||
alias: "command",
|
alias: "command",
|
||||||
au: "autocmd",
|
au: "autocmd",
|
||||||
|
"au!": "rmautocmd",
|
||||||
|
"autocmd!": "rmautocmd",
|
||||||
b: "buffer",
|
b: "buffer",
|
||||||
o: "open",
|
o: "open",
|
||||||
w: "winopen",
|
w: "winopen",
|
||||||
|
|
|
@ -2352,6 +2352,17 @@ export function autocmd(event: string, url: string, ...excmd: string[]) {
|
||||||
config.set("autocmds", event, url, excmd.join(" "))
|
config.set("autocmds", event, url, excmd.join(" "))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Remove autocmds
|
||||||
|
@param event Curently, 'TriStart', 'DocStart', 'DocEnd', 'TabEnter' and 'TabLeft' are supported.
|
||||||
|
|
||||||
|
@param url For DocStart, DocEnd, TabEnter, and TabLeft: a fragment of the URL on which the events will trigger, or a JavaScript regex (e.g, `/www\.amazon\.co.*\/`)
|
||||||
|
*/
|
||||||
|
//#background
|
||||||
|
export function rmautocmd(event: string, url: string) {
|
||||||
|
if (!["DocStart", "DocEnd", "TriStart", "TabEnter", "TabLeft"].includes(event)) throw event + " is not a supported event."
|
||||||
|
config.unset("autocmds", event, url)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to put Tridactyl into ignore mode on the provided URL.
|
* Helper function to put Tridactyl into ignore mode on the provided URL.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue