Skip to content

Instantly share code, notes, and snippets.

@pascalpoitras
Last active August 10, 2023 16:12
Show Gist options
  • Save pascalpoitras/da8038f33350193086a84dfbdc9b9265 to your computer and use it in GitHub Desktop.
Save pascalpoitras/da8038f33350193086a84dfbdc9b9265 to your computer and use it in GitHub Desktop.
made for someone on IRC

WeeChat Screenshot

Aliases

/alias add cycle_build /mute /unset plugins.var.buffer_cycle;/mute /set plugins.var.buffer_cycle_cond $*;/allbuf /eval /${if:${eval_cond:${plugins.var.buffer_cycle_cond}}!=?mute /set plugins.var.buffer_cycle ${plugins.var.buffer_cycle} ${buffer.name}}
/alias add cycle_cond /cycle_build $*;/eval /mute /buffer cycle ${plugins.var.buffer_cycle}

Examples

/cycle_cond ${channel} =~ l

will cycle between any channel with l in their name.

Note: the previous command will also match servers and queries since they also defined the channel variable. To search only for channels with 'l' in their names:

/cycle_cond ${channel} =~ l && ${type} == channel    

Notes

/cycle_cond }

cycle all buffers since } is true

Everything is truthy except 0 and no value:

/eval -n ${eval_cond:}
/eval -n ${eval_cond:0}

There is just one thing to note, if you want to match ${ literally, you will have to escape it, otherwise weechat will wait for a closing brace

/buffer add test${
/cycle_cond ${buffer.name} =* *\${

A little bit harder for a regex since you must disable the eval meaning of ${ and the regex meaning of $ and {

/cycle_cond ${buffer.name} =~ \\$\{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment