When you paste multiples commands, be sure to paste them on a buffer with input_multiline set to 0, the weechat core buffer is an example of such a buffer
/mouse enable
/secure passphrase <pass>
/secure set liberachatpass <pass>
/secure set defaultnicks <nicks-csv>
/secure set defaultsasluser <username>
/set irc.server_default.sasl_mechanism PLAIN
/set irc.server_default.sasl_username ${sec.data.defaultsasluser}
/set irc.server_default.nicks ${sec.data.defaultnicks}
/set irc.server_default.capabilities "*"
/set irc.server_default.autojoin_dynamic on
/server add libera irc.libera.chat/6697 -autoconnect
/set irc.server.libera.sasl_password ${sec.data.liberachatpass}
/server add oftc irc.oftc.net/6697 -autoconnect
/set irc.server.oftc.tls_cert "%h/ssl/nick.pem"
/set irc.server.oftc.command_delay 5
/connect -auto
/set weechat.plugin.autoload "*,!guile,!javascript,!lua,!php,!tcl,!perl,!ruby,!fifo,!xfer,!relay"
this will load all modules except guile, javascript, lua, php, tcl, perl, ruby, fifo, xfer and relay
/set spell.check.default_dict en,fr
/set spell.check.suggestions 3
/set spell.color.suggestion *green
/spell enable
/set logger.level.irc 4
/set logger.mask.irc %Y/$server/$channel.%m-%d.log
≥ WeeChat 3.0 for fset.look.auto_refresh
/set fset.color.line_selected_bg1 default
/set fset.color.name_changed 229
/set fset.color.name_changed_selected *229
/set fset.color.type 121
/set fset.color.type_selected *121
/set fset.color.value 31
/set fset.color.value_changed 229
/set fset.color.value_changed_selected *229
/set fset.color.value_selected *31
/set fset.look.auto_refresh "*,!weechat.bar.buflist.size,!plugins.var.buflist.section.*"
/set fset.format.option1 "${if:${selected_line}?${color:*white}>>: } ${marked} ${name} ${type} ${value2}"
/set weechat.bar.fset.conditions "${buffer.full_name} == fset.fset && ${window.win_height} > 7"
/set script.scripts.download_enabled on
/script install autosort.py buffer_autoset.py cmd_help.py
/autosort helpers set monitors_buffers_first ${if:${buffer.full_name}!~^core\.(chan|high|news)mon$}
/autosort rules insert 3 ${monitors_buffers_first}
monitors buffers (chanmon, highmon and newsmon) will appears before other core buffers (except core.weechat)
/buffer_autoset add core.weechat notify 3
/buffer_autoset add irc.server.* notify 3
/set plugins.var.python.cmd_help.color_delimiters "*white"
/set plugins.var.python.cmd_help.color_arguments "121"
/set plugins.var.python.cmd_help.color_list "121"
/set plugins.var.python.cmd_help.start_on_load "on"
/set plugins.var.python.cmd_help.stop_on_enter "off"
/cmd_help
syntax: /group_tools_item set <group> <namespace> <section>,[<section>...] <option>,[<option>...] <value>
add <group> <item> "[<option>,[<option>...]]" "[<value>]" ["[<value>]"...]
del <group> <item> [<item>...]
you need:
- WeeChat 3.4 for ${define:...}
/trigger addreplace group_tools_item command "group_tools_item;manage the items of a group;set <group> <namespace> <section>,[<section>...] <option>,[<option>...] <value> || add <group> <item> ${\x22}[<option>,[<option>...]]${\x22} ${\x22}[<value>]${\x22} [${\x22}[<value>]${\x22}...] || del <group> <item> [<item>...]; set: change the value of one or more options of one or more sections${\n} add: add a new item${\n} del: delete one or more items${\n} group: a group${\n}namespace: a namespace${\n} section: a section${\n} option: an option${\n} value: a value for an option${\n} item: name of an item${\n}${\n}Add or replace an item named nick in the chanmon group:${\n}${\n} /${tg_trigger_name} add chanmon nick ${\x22}${\x22} ${\x22}5${\x22} ${\x22}5${\x22} ${\x22}white${\x22} ${\x22}24${\x22} ${\x22}black${\x22} ${\x22}${raw:${tg_tag_nick}}${\x22}${\n}${\n}The first 5 will end up in the option named 1, the second 5 will end up in the option named 2 and so on. These names of options are not really useful, to give them a name:${\n}${\n} /${tg_trigger_name} del chanmon nick${\n} /${tg_trigger_name} add chanmon nick ${\x22}min_length,max_length,fg,bg,separator,content${\x22} ${\x22}5${\x22} ${\x22}5${\x22} ${\x22}white${\x22} ${\x22}24${\x22} ${\x22}black${\x22} ${\x22}${raw:${tg_tag_nick}}${\x22}${\n}${\n}now the first 5 will end up in min_length, the second 5 will end up in max_length and so on. It's tedious to repeat the options names everytime. You can give the defaults name just once:${\n}${\n} /${tg_trigger_name} del chanmon nick${\n} /${tg_trigger_name} set chanmon all general defaults_options min_length,max_length,fg,bg,separator,content${\n} /${tg_trigger_name} add chanmon nick ${\x22}${\x22} ${\x22}5${\x22} ${\x22}5${\x22} ${\x22}white${\x22} ${\x22}24${\x22} ${\x22}black${\x22} ${\x22}${raw:${tg_tag_nick}}${\x22};set|add|del"
/trigger set group_tools_item conditions "${define:my_regex,[abcdefghijklmnopqrstuvwxyz0-9_]+}${tg_argv_eol1} =~ (?-i)^set +${my_regex} +${my_regex} +(${my_regex},?)+ +(${my_regex},?)+ . || ${tg_argv_eol1} =~ (?-i)^add +${my_regex} +${my_regex} . && ${tg_shell_argc} > 5 || ${tg_argv_eol1} =~ (?-i)^del +${my_regex} +(${my_regex} *)+$"
/trigger set group_tools_item regex "/.*/${tg_argv1}/my_action /.*/${tg_argv2}/my_group /.*/${if:${my_action}==set?${tg_argv3}}/my_namespace /.*/plugins.var.group_tools.${my_group}/my_opt_prefix /.*/${if:${my_action}==add?${tg_argv3}:${if:${my_action}==del?${tg_argv_eol3}}}/my_items / +/,/my_items /.*/${if:${my_action}==set?${tg_argv4}}/my_sections /[^,]$/${re:0},/my_sections /.*/${if:${my_action}==set?${tg_argv5}}/my_options /[^,]$/${re:0},/my_options /.*/${if:${my_action}==set?${split:count,,strip_right,${my_sections}}}/my_number_of_sections /.*/${if:${my_action}==set?${split:count,,strip_right,${my_options}}}/my_number_of_options /[^,]+,/${repeat:${my_number_of_options},${re:0}}/my_sections /.+/${repeat:${my_number_of_sections},${re:0}}/my_options ===([^,]+),===${define:my_option,${split:${re:repl_index},,,${my_options}}}/mute -core /set ${my_opt_prefix}.${my_namespace}.${re:1}.${my_option} \${base_decode:16,${base_encode:16,${tg_argv_eol6}}};===my_sections /$/${my_sections}/my_cmds_to_run /.*/${if:${my_action}==add?${repeat:${calc:${tg_shell_argc}-5},,}}/my_add_cmds ===,===${define:my_option,${if:${split:${re:repl_index},,,${tg_shell_argv4}}=~^[abcdefghijklmnopqrstuvwxyz0-9_]+$?${split:${re:repl_index},,,${tg_shell_argv4}}:${if:${split:${re:repl_index},,,${${my_opt_prefix}.all.general.defaults_options}}=~^[abcdefghijklmnopqrstuvwxyz0-9_]+$?${split:${re:repl_index},,,${${my_opt_prefix}.all.general.defaults_options}}:${re:repl_index}}}}/mute -core /set ${my_opt_prefix}.item.${my_items}.${my_option} '\${base_decode:16,${base_encode:16,${tg_shell_argv${calc:4+${re:repl_index}}}}}';===my_add_cmds /$/${my_add_cmds}/my_cmds_to_run /.*/${if:${my_action}==del?${my_items}}/my_del_cmds ===([^,]+),?===/mute -core /unset -mask ${my_opt_prefix}.item.${re:1}.*;===my_del_cmds /$/${my_del_cmds}/my_cmds_to_run"
/trigger set group_tools_item command "/command -buffer core.weechat * /eval -s ${my_cmds_to_run}"
this trigger create the group_tools_item command which is used to manage the items of a group. Lots of code in this configuration require this command so I highly recommended to take this trigger
syntax: /group_tools_list clear <group> <list>
content|push|push_if_not|remove <group> <list> <item> [<item>...]
you need:
- WeeChat 3.4 for ${define:...}
/trigger addreplace group_tools_list command "group_tools_list;manage the list of a group;clear <group> || push|push_if_not|remove|content <group> <item> [<item>...]; clear: clear a list${\n} push: put one or more items at the end of a list${\n}push_if_not: put one or more items at the end of a list if not already in the list${\n} remove: remove one or more items in a list${\n} content: replace a list${\n} group: a group${\n} item: name of an item${\n}${\n}Push an item at the end of the list only if this item is not already part of the list:${\n}${\n} /${tg_trigger_name} push_if_not chanmon nick${\n}${\n}Push two items at the end of the list even if they might already be present:${\n}${\n} /${tg_trigger_name} push chanmon chan nick;content|clear|push|push_if_not|remove"
/trigger set group_tools_list conditions "${tg_argv_eol1} =~ (?-i)^clear +[abcdefghijklmnopqrstuvwxyz0-9_]+ +[abcdefghijklmnopqrstuvwxyz0-9_]+$ || ${tg_argv_eol1} =~ (?-i)^(content|push|push_if_not|remove) +[abcdefghijklmnopqrstuvwxyz0-9_]+ +[abcdefghijklmnopqrstuvwxyz0-9_]+ +([abcdefghijklmnopqrstuvwxyz0-9_]+ *)+$"
/trigger set group_tools_list regex "/.*/${tg_argv1}/my_action /.*/${tg_argv2}/my_group /.*/${tg_argv3}/my_list_name /.*/plugins.var.group_tools.${my_group}/my_opt_prefix /.*/${${my_opt_prefix}.list.${my_list_name}.list}/my_list /[^,]+/${if:${re:0}=~^[abcdefghijklmnopqrstuvwxyz0-9_]+$?${re:0}}/my_list /.*/${tg_argv_eol4}/my_items / +/,/my_items /.*/${if:${my_action}==push_if_not?${my_items}}/my_push_if_not_items /[^,]+/${if:,${my_list},!-,${re:0},&&,${split:${calc:${re:repl_index}+1},,keep_eol,${my_items}},!-,${re:0},?${re:0}}/my_push_if_not_items /.*/${if:${my_action}==remove?${my_list}}/my_remove_items /[^,]+/${if:,${my_items},!-,${re:0},?${re:0}}/my_remove_items /.*/${if:${my_action}==push_if_not?${my_push_if_not_items}:${if:${my_action}==remove?${my_remove_items}:${re:0}}}/my_items /,+/,/my_items /^,|,$//my_items /.*/${if:${my_action}=~^(content|remove)$?${my_items}:${if:${my_action}=~^push?${re:0},${my_items}}}/my_list /,+/,/my_list /^,|,$//my_list ===$===/mute -core /set ${my_opt_prefix}.list.${my_list_name}.list '${my_list}';===my_cmds_to_run"
/trigger set group_tools_list command "/command -buffer core.weechat * /eval -s ${my_cmds_to_run}"
this trigger create the group_tools_list command which is used to manage the lists of a group. Lots of code in this configuration require this command so I highly recommended to take this trigger
syntax: /group_tools set <group>,[<group>...] <namespace> <section>,[<section>...] <option>,[<option>...] <value>
add <group>,[<group>...] <item> "[<option>,[<option>...]]" "[<value>]" ["[<value>]"...]
del <group>,[<group>...] <item> [<item>...]
clear <group>,[<group>...] <list>,[<list>...]
content|push|push_if_not|remove <group>,[<group>...] <list>,[<list>...] <item> [<item>...]
you need:
- WeeChat 3.4 for ${define:...}
- the group_tools_item and group_tools_list triggers
/trigger addreplace group_tools command "group_tools;manage groups of options;set <group>,[<group>...] <namespace> <section>,[<section>...] <option>,[<option>...] <value> || add <group>,[<group>...] <item> ${\x22}[<option>,[<option>...]]${\x22} ${\x22}[<value>]${\x22} [${\x22}[<value>]${\x22}...] || del <group>,[<group>...] <item> [<item>...] || clear <group>,[<group>...] <list>,[<list>...] || push|push_if_not|remove|content <group>,[<group>...] <list>,[<list>...] <item> [<item>...]; set: change the value of one or more options of one or more sections${\n} add: add a new item${\n} del: delete one or more items${\n} clear: clear a list${\n} push: put one or more items at the end of a list${\n}push_if_not: put one or more items at the end of a list if not already in the list${\n} remove: remove one or more items in a list${\n} content: replace a list${\n} group: a group${\n} namespace: a namespace${\n} section: a section${\n} option: an option${\n} value: a value for an option${\n} item: name of an item${\n} list: a list${\n}${\n}Create or update an item named nick in the chanmon group and put the item at the end of the header list:${\n}${\n} /${tg_trigger_name} add chanmon nick ${\x22}${\x22} ${\x22}5${\x22} ${\x22}5${\x22} ${\x22}white${\x22} ${\x22}24${\x22} ${\x22}black${\x22} ${\x22}${raw:${tg_tag_nick}}${\x22}${\n}${\n}The first 5 will end up in the option named 1, the second 5 will end up in the option named 2 and so on. These names of options are not really useful, to give them a name:${\n}${\n} /${tg_trigger_name} clear chanmon header${\n} /${tg_trigger_name} add chanmon header nick min_length,max_length,fg,bg,separator,content 5 5 white 24 black ${raw:${tg_tag_nick}}${\n}${\n}now the first 5 will end up in min_length, the second 5 will end up in max_length and so on. It's tedious to repeat the options names everytime. You can give the defaults name just once:${\n}${\n} /${tg_trigger_name} clear chanmon header${\n} /${tg_trigger_name} set chanmon all general defaults_options min_length,max_length,fg,bg,separator,content${\n} /${tg_trigger_name} add chanmon header nick push ${\x22}${\x22} 5 5 white 24 black ${raw:${tg_tag_nick}};set|add|del|clear|push|push_if_not|remove|content"
/trigger set group_tools conditions "${define:my_regex,[abcdefghijklmnopqrstuvwxyz0-9_]+}${tg_argv_eol1} =~ (?-i)^set +(${my_regex},?)+ +${my_regex} +(${my_regex},?)+ +(${my_regex},?)+ . || ${tg_argv_eol1} =~ (?-i)^add +(${my_regex},?)+ +${my_regex} . && ${tg_shell_argc} > 5 || ${tg_argv_eol1} =~ (?-i)^del +(${my_regex},?)+ +(${my_regex} *)+$ || ${tg_argv_eol1} =~ (?-i)^clear +(${my_regex},?)+ +(${my_regex},?)+$ || ${tg_argv_eol1} =~ (?-i)^(content|push|push_if_not|remove) +(${my_regex},?)+ +(${my_regex},?)+ +(${my_regex} *)+$"
/trigger set group_tools regex "/.*/${tg_argv1}/my_action /.*/${if:${my_action}=~^(add|del|set)$?item:list}/my_action_type /.*/${tg_argv2}/my_groups /.*/${if:${my_action_type}==list?${tg_argv3}}/my_lists /.*/${if:${my_action_type}==item?${my_groups},}/my_group_tools_item_cmds ===([^,]+),===${define:my_group,${re:1}}/group_tools_item ${my_action} ${my_group} \${base_decode:16,${base_encode:16,${tg_argv_eol3}}};===my_group_tools_item_cmds /$/${my_group_tools_item_cmds}/my_cmds_to_run /.*/${if:${my_action_type}==list?${my_groups},}/my_group_tools_list_cmds /.*/${if:${my_action_type}==list?${my_lists},}/my_lists /.*/${if:${my_action_type}==list?${split:count,,strip_right,${my_groups}}}/my_number_of_groups /.*/${if:${my_action_type}==list?${split:count,,strip_right,${my_lists}}}/my_number_of_lists /[^,]+,/${repeat:${my_number_of_lists},${re:0}}/my_group_tools_list_cmds /.+/${repeat:${my_number_of_groups},${re:0}}/my_lists ===([^,]+),===${define:my_group,${re:1}}${define:my_list,${split:${re:repl_index},,,${my_lists}}}/group_tools_list ${my_action} ${my_group} ${my_list} ${tg_argv_eol4};===my_group_tools_list_cmds /$/${my_group_tools_list_cmds}/my_cmds_to_run"
/trigger set group_tools command "/command -buffer core.weechat * /eval -s ${my_cmds_to_run}"
this trigger create the group_tools command which is used to manage the items and the lists of one or more group. Lots of code in this configuration require this command so I highly recommended to take this trigger
you need:
- WeeChat 3.6 for /item
- the group_tools_item and group_tools_list triggers
- psutil python library
/item addreplace sys_usage "" "${base_decode:16,${plugins.var.group_tools.sys_usage.all.general.bar_item_base16_encoded_content}}"
create a bar item
/trigger addreplace sys_usage_item_rebuild timer "1000;0;0"
/trigger set sys_usage_item_rebuild regex "/.*/${plugins.var.group_tools.sys_usage.list.sys_usage.list}/my_content /[^,]+/${if:${re:0}=~^[abcdefghijklmnopqrstuvwxyz0-9_]+$?${re:0}}/my_content /,+/,/my_content /^,|,$//my_content /([^,]+),?/${eval:${color:bar_delim}${plugins.var.group_tools.sys_usage.all.general.separator} ${color:reset}${plugins.var.group_tools.sys_usage.item.${re:1}.display} ${color:reset}${plugins.var.group_tools.sys_usage.item.${re:1}.content}}\n/my_content /.*/${base_encode:16,${my_content}}/my_item"
/trigger set sys_usage_item_rebuild command "/mute -core /set plugins.var.group_tools.sys_usage.all.general.bar_item_base16_encoded_content '${my_item}';/item refresh sys_usage"
this trigger create a timer to refresh the sys item
/group_tools_item set sys_usage all general separator
/group_tools_item set sys_usage all general defaults_options display,content
/group_tools_item add sys_usage cpu "" "${color:24}▣" "${define:my_cpu_percent,${info:python_eval,import psutil;print(psutil.cpu_percent(interval=0.0,percpu=False))}}${if:${length:${my_cpu_percent}}==3? }${my_cpu_percent}${color:246}%"
/group_tools_item add sys_usage mem "" "${color:24}▬▬" "${define:my_mem_percent,${info:python_eval,import psutil;print(psutil.virtual_memory().percent)}}${if:${length:${my_mem_percent}}==3? }${my_mem_percent}${color:246}%"
/group_tools_item add sys_usage swap "" "${color:24}⎘" "${define:my_swap_percent,${info:python_eval,import psutil;print(psutil.swap_memory().percent)}}${if:${length:${my_swap_percent}}==3? }${my_swap_percent}${color:246}%"
/group_tools_list content sys_usage sys_usage cpu mem swap
the command above create three items (cpu, ram and swap) and enable all three
≥ WeeChat 4.1.0 for ${info:buffer,...}
the buflist should now be a lot faster thanks to ${define:...} but remains slow nonetheless since the whole buflist is refresh on each hotlist_changed signals (which is why all buflists are slow no matter how they are configured, but mine is worse than most since the format options are complex and that I am using all three buflist items instead of just one.)
Here are some tips if you want to make the buflist faster
- If you don't use the tab bars (called the control_buffers bars), set buflist.look.use_items to 1
- If you don't mind low messages (join/part/quit...) set the default notify level to something higher
- By collapsing servers buffers
/bar set buflist priority 2000
/set irc.look.server_buffer independent
Note: show channels and privates buffers under their respective server instead of mixing them all.
/trigger addreplace buflist_tools command "buflist_tools;manage pascalpoitras's custom buflist (https://gist.github.com/pascalpoitras/8406501);resize <buflist_size> <left_size>|? [<right_size>] || hide|show|itoggle|showonly|hideonly <item>|-all [<item>|-all...] || enable|disable|toggle <feature> [<feature>...]; resize: resize the buflist size and the two sections${\n} hide: hide one or more item(s)${\n} show: show one or more item(s)${\n} itoggle: toggle one or more item(s)${\n} showonly: hide all items except...${\n} hideonly: show all items except...${\n} enable: enable a feature that change the behavior of the buflist${\n} disable: disable a feature that change the behavior of the buflist${\n} toggle: toggle a feature that change the behavior of the buflist${\n} buflist_size: new size for the buflist${\n} left_size: size of left section${\n} right_size: size of right section${\n} item: an item (buffer_number, fold, indent, nick_prefix, buffer_name, lag, filter, relay_count, extra, hotlist)${\n} -all: do action on all items${\n} feature: a feature (indent_tree, real_net_name, show_hidden_buffers)${\n}${\n}The buflist is composed of two sections. The left section is composed of nine items. The buffer number, the fold symbol (servers only), the indentation, the nick prefix (channels only), the buffer name, the lag (servers only), the filter (on some buffer like fset, scripts...), the relay count (for the relay buffer) and extra infos about a buffer. The right section is only composed of hotlist. The two sections can be resized independently.${\n}${\n}Exemples:${\n} Resize the bar to 20 with the size 15 for left section and 5 for right section:${\n} /buflist_tools resize 20 15;resize 20 15 || show|hide|itoggle|hideonly|showonly buffer_number|fold|indent|nick_prefix|buffer_name|lag|filter|relay_count|extra|hotlist|-all|%* || enable|disable|toggle indent_tree|real_net_name|show_hidden_buffers|%*"
/trigger set buflist_tools conditions "${tg_argv_eol1} =~ ^resize +[0-9]+ +([0-9]+( +[0-9]+)?|\? +[0-9]+)$ || ${tg_argv_eol1} =~ ^(hide|show|itoggle|showonly|hideonly) +(([[:alnum:]_]+|-all)( +|$))+$ || ${tg_argv_eol1} =~ ^(enable|disable|toggle) +([[:alnum:]_]+( +|$))+$"
/trigger set buflist_tools regex "/.*/${tg_argv1}/my_action /.*/${if:${my_action}==resize?${tg_argv_eol2}}/my_resize_cmds ===^([^ ]+) +([^ ]+)( +([^ ]+))?$===${define:my_buflist_size,${re:1}}${define:my_left_size,${re:2}}${define:my_right_size,${re:4}}/mute /set plugins.var.buflist.section.left.size ${if:${my_left_size}=~[0-9]+?${my_left_size}:${calc:${my_buflist_size}-${my_right_size}}};/mute /set plugins.var.buflist.section.right.size ${if:${my_right_size}=~[0-9]+?${my_right_size}:${calc:${my_buflist_size}-${my_left_size}}};/bar set buflist size ${my_buflist_size}===my_resize_cmds /.*/${if:${my_action}=~^(hide|show|itoggle|showonly|hideonly)$?${tg_argv_eol2}}/my_item_cmds /.*/buffer_number fold indent nick_prefix buffer_name lag filter relay_count extra hotlist/my_items /-all/${my_items}/my_item_cmds /.*/${if:${my_action}=~^(hide|show)only$?${my_items}}/my_hide_or_show_everything ===[^ ]+===/mute /set plugins.var.buflist.item.${re:0} ${if:${my_action}==hideonly};===my_hide_or_show_everything ===[^ ]+===/mute /set plugins.var.buflist.item.${re:0} ${if:${my_action}=~^hide?0:${if:${my_action}=~^show?1:\x5c${if:\x5c${plugins.var.buflist.item.${re:0}${\x5cx7d}?0:1${\x5cx7d}}};===my_item_cmds /.*/${my_hide_or_show_everything}${re:0}/my_item_cmds /.*/${if:${my_action}=~^(enable|disable|toggle)$?${tg_argv_eol2}}/my_look_cmds ===[^ ]+===/mute /set plugins.var.buflist.look.${re:0} ${if:${my_action}==disable?0:${if:${my_action}==enable?1:${if:${plugins.var.buflist.look.${re:0}}!=?0:1}}};===my_look_cmds /.*/${my_resize_cmds}${my_item_cmds}${my_look_cmds}/my_cmds_to_run"
/trigger set buflist_tools command "/command -buffer core.weechat * /eval -s ${my_cmds_to_run}"
This trigger create the command buflist_tools. With this command you can resize the buflist and the sections and show or hide items. Type /help buflist_tools for more.
/buflist_tools resize 20 15
The buflist will be resized to 20. 15 columns for the left section and 5 columns for the right section
/buflist_tools hideonly extra nick_prefix lag
/buflist_tools enable indent_tree real_net_name
I want to show all the items except extra, nick_prefix and lag. I want to display real network name (not the one used in /server add). Instead of spaces for the indent item, I want tree symbols.
/bar add control_buffers window top 1 1 buflist2
/bar set control_buffers priority 499
/bar set control_buffers conditions ${window.number} == ${if:${plugins.var.control_buffers_window}?${plugins.var.control_buffers_window}:2}
/bar add control_buffers2 window top 1 1 buflist3
/bar set control_buffers2 priority 499
/bar set control_buffers2 conditions ${window.number} == ${if:${plugins.var.control_buffers2_window}?${plugins.var.control_buffers2_window}:3} && ${layout[gui_layout_current].name} == main-control-control2
Create the control_buffers bar with buflist2 for items and display this bar only on the window with the same number as the number in the option plugins.var.control_buffers_window (or 2 if this options doesn't exist). Same for control_buffers2 bar
/set buflist.format.hotlist_highlight "${color:163}"
/set buflist.format.hotlist_message "${color:229}"
/set buflist.format.hotlist_private "${color:121}"
/set buflist.format.buffer "${if:${bar_item.name}==buflist?${define:my_left_section_contents,${format_number}${eval:${plugins.var.buflist.format.fold}}${indent}${format_nick_prefix}${format_name}${format_lag}${eval:${plugins.var.buflist.format.filter}${plugins.var.buflist.format.relay_count}${plugins.var.buflist.format.extra}}}${define:my_left_section_contents_length,${lengthscr:${my_left_section_contents}}}${define:my_right_section_contents,${format_hotlist}}${define:my_right_section_contents_length,${lengthscr:${my_right_section_contents}}}${if:${type}==server?${color:,31}:${color:default}}${if:${my_left_section_contents_length} > ${plugins.var.buflist.section.left.size}?${cutscr:+${plugins.var.buflist.section.left.size},${if:${type}==server?${color:white}:${color:${weechat.color.chat_prefix_more}}}${weechat.look.prefix_align_more},${my_left_section_contents}}:${my_left_section_contents}${repeat:${calc:${plugins.var.buflist.section.left.size} - ${my_left_section_contents_length}}, }}${if:${my_right_section_contents_length} > ${plugins.var.buflist.section.right.size}?${cutscr:+${plugins.var.buflist.section.right.size},${if:${type}==server?${color:white}:${color:${weechat.color.chat_prefix_more}}}${weechat.look.prefix_align_more},${my_right_section_contents}}:${repeat:${calc:${plugins.var.buflist.section.right.size} - ${my_right_section_contents_length}}, }${my_right_section_contents}}:${define:my_remaining_space,${calc:7-${lengthscr:${name}}}}${define:my_name,${cutscr:7,${\u2026},${name}${repeat:${my_remaining_space}, }}}${if:${window.buffer}==${buffer}?${color:31}${\ue0be}${color:white,31} ${my_name} ${color:reset}${color:31}${\ue0bc}:${color:24}${\ue0be}${color:darkgray,24} ${my_name} ${color:reset}${color:24}${\ue0bc}}}"
/set buflist.format.buffer_current "${format_buffer}"
/set buflist.format.number "${if:${plugins.var.buflist.item.buffer_number}!=?${if:${current_buffer}?${color:*white}${hide:>,${number}} :${if:${type}==server?${color:black}:${color:239}}${number}${if:${number_displayed}?.: }}}"
/set buflist.format.indent "${if:${plugins.var.buflist.item.indent}!=?${if:${plugins.var.buflist.look.indent_tree}!=?${color:31}├─: }}"
/set buflist.format.name "${if:${plugins.var.buflist.item.buffer_name}!=?${define:my_name,${if:${type}==server?${if:${plugins.var.buflist.look.real_net_name}!=&&${info:irc_server_isupport_value,${name},NETWORK}!=?${info:irc_server_isupport_value,${name},NETWORK}:${name}}:${name}}}${define:my_name_length,${lengthscr:${my_name}}}${if:${type}==server?${color:white}:${eval:${color_hotlist}}}${if:${buffer.local_variables.start_at}!=?${revscr:${cutscr:+${calc:${my_name_length}-${buffer.local_variables.start_at}},…,${revscr:${my_name}}}}:${my_name}}}"
/set buflist.format.hotlist "${if:${plugins.var.buflist.item.hotlist}!=?${if:${plugins.var.buflist.section.right.size}==1? :${hotlist}}}"
/set buflist.format.nick_prefix "${if:${plugins.var.buflist.item.nick_prefix}!=&&${buflist.look.nick_prefix}!=?${color:31}${nick_prefix}}"
/set buflist.format.lag "${if:${plugins.var.buflist.item.lag}!=?${color:white} [${lag}]}"
/set plugins.var.buflist.format.fold "${if:${plugins.var.buflist.item.fold}!=&&${type}==server?${color:black}${if:${buffer.local_variables.fold}==?▼:▲} }"
/set plugins.var.buflist.format.filter "${if:${plugins.var.buflist.item.filter}!=&&${buffer.local_variables.filter}!=? ${if:${type}==server?${color:black}:${color:31}}${buffer.local_variables.filter}}"
/set plugins.var.buflist.format.relay_count "${if:${plugins.var.buflist.item.relay_count}!=&&${buffer.full_name}==relay.relay.list&&${info:relay_client_count,*,connected}!=? ${color:31}Total${\x3A}${info:relay_client_count,*,connected} IRC${\x3A}${info:relay_client_count,irc,connected} WeeChat${\x3A}${info:relay_client_count,weechat,connected}}"
/set plugins.var.buflist.format.extra "${if:${plugins.var.buflist.item.extra}!=&&${buffer.local_variables.extra}!=? ${if:${type}==server?${color:black}:${color:31}}${buffer.local_variables.extra}}"
This was the format options which changed the look of each buflist items
/set buflist.look.use_items 3
Use all three buflist items
/set buflist.look.signals_refresh "irc_server_connected,relay_client_connected,relay_client_disconnected"
Add additionnals signals to refresh the buflist
/set buflist.look.display_conditions "${bar_item.name} == buflist && (${buffer.hidden} == || ${plugins.var.buflist.look.show_hidden_buffers} !=) && (${type} !~ ^(channel|private)$ || ${type} =~ ^(channel|private)$ && ${buffer[${info:search_server_buffer_ptr,${buffer}}].local_variables.fold}==) || ${bar_item.name} == buflist2 && ${buffer.local_variables.control_buffers} != || ${bar_item.name} == buflist3 && ${buffer.local_variables.control_buffers2} !="
The conditions to display a buffer in the buflist items.
/trigger addreplace buflist_refresh_options config "weechat.bar.buflist.size*;plugins.var.buflist.*"
/trigger set buflist_refresh_options command "/buflist refresh"
when the buflist is resized, the buflist is refresh. Same for all the plugins.var.buflist.* options
/trigger addreplace control_buffers_change_control_window config "plugins.var.control_buffers_window;plugins.var.control_buffers2_window"
/trigger set control_buffers_change_control_window command "/window refresh"
Refresh window when options plugins.var.control_buffers_window and plugins.var.control_buffers2_window are changed
/trigger add utils_search_server_buffer_ptr info "search_server_buffer_ptr"
/trigger set utils_search_server_buffer_ptr conditions "${tg_arguments} != && (${buffer[${tg_arguments}].local_variables.script_name} =~ ^(matrix|slack)$ || ${buffer[${tg_arguments}].local_variables.plugin} =~ ^(irc|matrix))$"
/trigger set utils_search_server_buffer_ptr regex "/.*/${buffer[${tg_arguments}].local_variables.plugin}/my_plugin /.*/${buffer[${tg_arguments}].local_variables.script_name}/my_script /.*/${buffer[${tg_arguments}].local_variables.server}/my_server /.*/${info:buffer,${if:${my_plugin}=~^(irc|matrix)$||${my_script}==matrix?${my_plugin}.server.${my_server}:${my_plugin}.${my_server}}}/tg_info"
This trigger is needed if you want to be able to expand/collapse servers
/key bindctxt mouse @item(buflist*)>bar(control_buffers*):button1* /toggle_bufautoset localvar_set_${_bar_name2} ${full_name}
/key bindctxt mouse @chat(*)>bar(control_buffers*):button1* /toggle_bufautoset localvar_set_${_bar_name2} ${_buffer_full_name}
/key bindctxt mouse @bar(control_buffers*)>chat(*):button1* /mute /set plugins.var.${_bar_name}_window ${_window_number2}
/key bindctxt mouse @bar(buflist):alt-wheel* hsignal:buflist_resize
/key bindctxt mouse @bar(buflist):ctrl-alt-wheel* hsignal:buflist_buffer_scroll
/key bindctxt mouse @item(buflist2):button1* /mute /set plugins.var.control_buffers_previous_active_window ${window.number};/window ${_window_number};hsignal:buflist_mouse;/window ${plugins.var.control_buffers_previous_active_window}
/key bindctxt mouse @item(buflist3):button1* /mute /set plugins.var.control_buffers2_previous_active_window ${window.number};/window ${_window_number};hsignal:buflist_mouse;/window ${plugins.var.control_buffers2_previous_active_window}
/key bindctxt cursor @item(buflist*):c /toggle_bufautoset localvar_set_control_buffers ${full_name};/cursor stop
/key bindctxt cursor @item(buflist*):C /toggle_bufautoset localvar_set_control_buffers2 ${full_name};/cursor stop
/key bindctxt cursor @item(buflist*):f /toggle_bufautoset localvar_set_fold ${plugin}.${if:${plugin}==irc||${buffer[${pointer}].local_variables.script_name}==matrix||${plugin}==matrix?server.}${localvar_server};/cursor stop
/key bindctxt cursor @item(buflist*):r /server raw c:\${${if:${localvar_type}==private?nick:${localvar_type}}}==${localvar_channel};/cursor stop
/key bindctxt cursor @item(buflist*):o /fset c:\${name}=*buffer_autoset.buffer.${full_name}.* ${if:${localvar_type}==server?|| \${name${\x7D}=*${full_name}.*};/cursor stop
/key bindctxt cursor @item(buflist*):n /toggle_bufautoset localvar_set_no_chanmon_like ${full_name};/cursor stop
/key bindctxt cursor @item(buflist*):h /toggle_bufautoset hidden ${full_name};/cursor stop
/key bindctxt cursor @item(buflist):H /buflist_tools toggle show_hidden_buffers;/cursor stop
/trigger addreplace toggle_bufautoset command "toggle_bufautoset;toggle bufautoset options;<buffer_property> <buffer_fullname>;buffer_property: name of the property${\n}buffer_fullname: name of the buffer${\n}${\n}The buffer_autoset.py script has no toggle mechanism so this command bring this functionality. Also, the script does not reset a property or localvar after deleting them. For example, if you type /buffer_autoset add irc.libera.#weechat localvar_set_something 1, and then, /buffer_autoset del irc.libera.#weechat.localvar_set_something, the localvar will still appears in /buffer localvar until you close and reoppen the buffer. This command will remove the localvar and hidden property upon deletion. You should use this command only for properties that take 0 or 1 as value or localvar that take 0 or 1.;;"
/trigger set toggle_bufautoset conditions "${tg_argv2} !="
/trigger set toggle_bufautoset regex "/.*/${tg_argv1}/my_property /.*/${tg_argv2}/my_full_name /.*/${if:${buffer_autoset.buffer.${my_full_name}.${my_property}}!=?del:add}/my_action /.*/${if:${my_action}==add? ${my_full_name} ${my_property} 1: ${my_full_name}.${my_property}}/my_params"
/trigger set toggle_bufautoset command "/mute /buffer_autoset ${my_action} ${my_params};/command -buffer ${my_full_name} * /buffer set ${my_property} ${if:${my_action}==add?1:0}"
/trigger addreplace buflist_resize hsignal buflist_resize
/trigger set buflist_resize conditions "${_key}=~down || ${_key}=~up && (${_bar_item_col} < ${plugins.var.buflist.section.left.size} && ${plugins.var.buflist.section.left.size} > 1 || ${_bar_item_col} >= ${plugins.var.buflist.section.left.size} && ${plugins.var.buflist.section.right.size} > 1)"
/trigger set buflist_resize regex "/.*/${if:${_key}=~up$?-:+}/my_action /.*/${if:${_bar_item_col}<${plugins.var.buflist.section.left.size}?left:right}/my_modified_section /.*/${calc:${plugins.var.buflist.section.${my_modified_section}.size} ${my_action} 1}/my_modified_section_size /.*/${if:${weechat.bar.${_bar_name}.size}!=?${calc:${weechat.bar.${_bar_name}.size} ${my_action} 1}:0}/my_new_bar_size"
/trigger set buflist_resize command "/mute /set plugins.var.buflist.section.${my_modified_section}.size ${my_modified_section_size};/bar set ${_bar_name} size ${my_new_bar_size}"
/trigger addreplace buflist_buffer_scroll hsignal buflist_buffer_scroll
/trigger set buflist_buffer_scroll conditions "${_key} =~ -wheeldown$ || ${buffer[${pointer}].local_variables.start_at} !="
/trigger set buflist_buffer_scroll regex "/.*/${if:${buffer[${pointer}].local_variables.start_at}==?0:${buffer[${pointer}].local_variables.start_at}}/my_start_at /.*/${calc:${my_start_at}${if:${_key}=~up&&${my_start_at}!=?-:+}1}/my_start_at"
/trigger set buflist_buffer_scroll command "/mute /buffer_autoset add ${full_name} localvar_set_start_at ${my_start_at}"
/trigger addreplace buflist_fold_symbol_click hsignal 1001|buflist_mouse
/trigger set buflist_fold_symbol_click conditions "${localvar_type} == server && ${plugins.var.buflist.item.fold} != && (${plugins.var.buflist.item.buffer_number} != && ${_bar_item_col} == ${lengthscr:${buffer[last_gui_buffer].number}.} || ${plugins.var.buflist.item.buffer_number} == && ${_bar_item_col} == 0)"
/trigger set buflist_fold_symbol_click command "/toggle_bufautoset localvar_set_fold ${full_name}"
/trigger set buflist_fold_symbol_click return_code "ok_eat"
- This bind allow drag and drop from any buflist items to the bar control_buffers. This will add or del the buffer to the control_buffers bar.
- This bind allow drag and drop from a chat area to the control_buffers and control_buffers2 bar. This will add or del the buffer to the control_buffers or control_buffers2 bar.
- This bind allows drag and drop from the control_buffers and control_buffers2 bar to a chat area. This will move the control_buffers or control_buffers2 bar to another window.
- This bind allows you to resize the buflist bar by pressing alt and using the wheel at the same time.
- This bind allows you to scroll the buffer name by pression ctrl, alt and the wheel at the same time.
- This bind will switch to the control window and display the buffer you clicked on and then switch back to the previous window.
- This bind will switch to the control2 window and display the buffer you clicked on and then switch back to the previous window.
- This bind allow you to press 'c' in cursor mode on any buflist items to add or del the buffer to the control_buffers bar.
- This bind allow you to press 'C' in cursor mode on any buflist items to add or del the buffer to the control_buffers2 bar.
- This bind will hide the channels and private buffer of a network.
- This bind will show server raw messages for server/channel/private depending on the buffer.
- This bind will show options, in fset, related to the buffer.
- This bind allow you to press 'n' in cursor mode on any buflist items to add or remove buffer in chanmon
- This bind allow you to press 'h' in cursor mode on any buflist items to hide a buffer
- This bind allow you to press 'H' in cursor mode on the buflist items to toggle the option show_hidden_buffers (when this option is set, the hidden buffers are displayed in the buflist, this is useful to unhide them with 'h')
The last trigger need WeeChat 2.9 for this: only return trigger's return code when condition evaluates to true
/set plugins.var.control_buffers_window 2
/set plugins.var.control_buffers2_window 3
/buffer_autoset add core.chanmon localvar_set_control_buffers 1
/buffer_autoset add core.highmon localvar_set_control_buffers 1
/buffer_autoset add core.newsmon localvar_set_control_buffers 1
/buffer_autoset add core.chanmon localvar_set_control_buffers2 1
/buffer_autoset add core.highmon localvar_set_control_buffers2 1
/buffer_autoset add core.newsmon localvar_set_control_buffers2 1
set window number 2 as the control window (the window with the control_buffers bar) and set window number 3 as the control2 window (the window with the control_buffers2 bar).
/bar del title
/bar add titlenosep window top 1 0 #window_number ,buffer_title,spacer,newsmon_interest
/bar set titlenosep priority 500
/bar set titlenosep conditions ${window.number} == ${if:${plugins.var.control_buffers_window}!=?${plugins.var.control_buffers_window}:2} || ${window.number} == ${if:${plugins.var.control_buffers2_window}!=?${plugins.var.control_buffers2_window}:3} && ${layout[gui_layout_current].name} == main-control-control2
/bar set titlenosep color_fg white
/bar set titlenosep color_delim white
/bar set titlenosep color_bg 31
/bar set titlenosep color_bg_inactive 31
A window bar to display the title, with no separator. Used on the window with the number corresponding to the option plugins.var.control_buffers_window and on the window with the number corresponding to the option plugins.var.control_buffers2_window
/bar add titlesep window top 1 1 #window_number ,buffer_title,spacer,newsmon_interest
/bar set titlesep priority 500
/bar set titlesep conditions ${window.number} != ${if:${plugins.var.control_buffers_window}!=?${plugins.var.control_buffers_window}:2} && (${window.number} != ${if:${plugins.var.control_buffers2_window}!=?${plugins.var.control_buffers2_window}:3} || ${window.number} == ${if:${plugins.var.control_buffers2_window}!=?${plugins.var.control_buffers2_window}:3} && ${layout[gui_layout_current].name} != main-control-control2)
/bar set titlesep color_fg white
/bar set titlesep color_delim white
/bar set titlesep color_bg 31
/bar set titlesep color_bg_inactive 31
A window bar to display the title with a separator. All window except those with a number corresponding to the options plugins.var.control_buffers_window and plugins.var.control_buffers2_window
/bar del status
/bar add status root bottom 1 1 time ,buffer_last_number ,buffer_plugin ,buffer_number+:+buffer_name+(buffer_modes)+{buffer_nicklist_count}+buffer_zoom+buffer_filter,,scroll ,lag ,typing ,completion ,spacer,sys_usage
/bar set status priority 500
/bar set status color_fg white
/bar set status color_delim 31
/bar set status color_bg 234
/bar add rootinput root bottom 0 0 [input_prompt]+(away),[input_search],[input_paste],input_text
/bar set rootinput priority 1000
/bar del input
/bar set rootinput name input
/bar set nicklist color_fg 229
/bar set nicklist separator 1
/bar set nicklist conditions ${nicklist} && ${window.number} == 1 && ${buffer.full_name} != ${if:${plugins.var.group_tools.newsmon.all.general.buffer_full_name}!=?${plugins.var.group_tools.newsmon.all.general.buffer_full_name}:irc.libera.##news} && ${buffer.full_name} != core.newsmon
/bar set nicklist size_max 14
/bar set nicklist size 14
you need:
- WeeChat 3.4 for ${define:...}
- the group_tools_item and group_tools_list triggers
/trigger addreplace chanmon_monitor print "*;irc_privmsg,matrix_message,matrix_text"
/trigger set chanmon_monitor conditions "${buffer.local_variables.type} == channel && ${buffer.local_variables.no_chanmon_like} == && (${plugins.var.group_tools.chanmon.all.general.allow_filtered_lines} != || ${tg_displayed} !=) && (${plugins.var.group_tools.chanmon.all.general.allow_hidden_channels} != || ${buffer.hidden} ==)"
/trigger set chanmon_monitor regex "/.*/${split:1,_,,${tg_trigger_name}}/my_monitor /.*/${plugins.var.group_tools.${my_monitor}.list.header.list}/my_list /[^,]+/${if:${re:0}=~^[abcdefghijklmnopqrstuvwxyz0-9_]+$?${re:0}}/my_list /[^,]+/plugins.var.group_tools.${my_monitor}.item.${re:0}/my_list /[^,]+/${if:${length:${${re:0}.conditions}}==||${eval_cond:${${re:0}.conditions}}?${re:0}}/my_list /,+/,/my_list /^,|,$//my_list /.*/${my_list}/my_bgs /[^,]+/${base_encode:16,${eval:${${re:0}.bg}}}/my_bgs /$/,${base_encode:16,default}/my_bgs /([^,]+)(,|$)/${define:my_fg,${eval:${${re:1}.fg}}}${define:my_bg,${base_decode:16,${split:${re:repl_index},,,${my_bgs}}}}${define:my_separator,${eval:${${re:1}.separator}}}${define:my_min_length,${eval:${${re:1}.min_length}}}${define:my_max_length,${eval:${${re:1}.max_length}}}${define:my_content,${eval:${${re:1}.content}}}${define:my_next_bg,${base_decode:16,${split:${calc:${re:repl_index}+1},,,${my_bgs}}}}${color:${my_fg},${my_bg}} ${cutscr:+${if:${split:1,0,keep_eol+strip_left,${my_max_length}}!~^[1-9][0-9]*$?${calc:${lengthscr:${my_content}}+1}:${my_max_length}},…,${my_content}}${repeat:${calc:${my_min_length}-${lengthscr:${my_content}}}, }${color:${my_fg},${my_bg}} ${if:${plugins.var.group_tools.${my_monitor}.all.general.powerline}!=?${if:${color:${my_bg}}==${color:${my_next_bg}}?${color:${my_separator}}:${color:${my_bg},${my_next_bg}}${color:reset}}:${color:reset} }/my_list /.+/${re:0} /my_list /.*/${tg_tags}/my_tags / //my_tags /.*/${my_list}${tg_message}/my_message"
/trigger set chanmon_monitor command "/print -newbuffer ${my_monitor} -tags ${my_tags} \t${my_message}"
this trigger create the chanmon monitor
/buffer add chanmon
/eval /set weechat.startup.command_after_plugins ${weechat.startup.command_after_plugins}${if:${weechat.startup.command_after_plugins}!=?;}/buffer add chanmon
/buffer_autoset add core.chanmon notify none
/buffer_autoset add core.chanmon highlight_words -
/buffer_autoset add core.chanmon title Channels Monitor
/buffer_autoset add core.chanmon time_for_each_line 0
/buffer_autoset add core.chanmon localvar_set_no_chanmon_like 1
/eval /buffer_autoset add ${if:${plugins.var.group_tools.newsmon.all.general.buffer_full_name}!=?${plugins.var.group_tools.newsmon.all.general.buffer_full_name}:irc.libera.##news} localvar_set_no_chanmon_like 1
the commands above set some buffer properties for our new monitor buffer
/group_tools_item set chanmon all general powerline 1
/group_tools_item set chanmon all general defaults_options min_length,max_length,fg,bg,separator,content,conditions
/group_tools_item add chanmon date "" 5 5 white 24 24 "${color:underline}${cut:5,,${split:-1, ,,${tg_date}}}" "${tg_highlight}=="
/group_tools_item add chanmon serv "" 2 2 white 31 24 "${color:underline}${server}" "${tg_highlight}=="
/group_tools_item add chanmon chan "" 4 4 white 31 24 "${color:underline}${split:1,#,keep_eol+strip_left,${channel}}" "${tg_highlight}=="
/group_tools_item add chanmon nick "" 5 5 white 31 24 "${color:underline}${if:${tg_tags}=~,irc_action,? *:${tg_tag_nick}}" "${tg_highlight}=="
/group_tools_item add chanmon date_hl "" 5 5 white 52 52 "${color:underline}${cut:5,,${split:-1, ,,${tg_date}}}" "${tg_highlight}!="
/group_tools_item add chanmon serv_hl "" 2 2 white 124 52 "${color:underline}${server}" "${tg_highlight}!="
/group_tools_item add chanmon chan_hl "" 4 4 white 124 52 "${color:underline}${split:1,#,keep_eol+strip_left,${channel}}" "${tg_highlight}!="
/group_tools_item add chanmon nick_hl "" 5 5 white 124 52 "${color:underline}${if:${tg_tags}=~,irc_action,? *:${tg_tag_nick}}" "${tg_highlight}!="
/group_tools_list content chanmon header date serv chan nick date_hl serv_hl chan_hl nick_hl
the commands above create a powerline bar to be displayed in front of the messages in the monitor buffer
you need:
- WeeChat 3.4 for ${define:...}
- the group_tools_item and group_tools_list triggers
/trigger addreplace highmon_monitor print "*;irc_privmsg,matrix_message,matrix_text"
/trigger set highmon_monitor conditions "${tg_highlight} == 1 && ${buffer.local_variables.type} == channel && ${buffer.local_variables.no_highmon_like} == && (${plugins.var.group_tools.highmon.all.general.allow_filtered_lines} != || ${tg_displayed} !=) && (${plugins.var.group_tools.highmon.all.general.allow_hidden_channels} != || ${buffer.hidden} ==)"
/trigger set highmon_monitor regex "/.*/${split:1,_,,${tg_trigger_name}}/my_monitor /.*/${plugins.var.group_tools.${my_monitor}.list.header.list}/my_list /[^,]+/${if:${re:0}=~^[abcdefghijklmnopqrstuvwxyz0-9_]+$?${re:0}}/my_list /[^,]+/plugins.var.group_tools.${my_monitor}.item.${re:0}/my_list /[^,]+/${if:${length:${${re:0}.conditions}}==||${eval_cond:${${re:0}.conditions}}?${re:0}}/my_list /,+/,/my_list /^,|,$//my_list /.*/${my_list}/my_bgs /[^,]+/${base_encode:16,${eval:${${re:0}.bg}}}/my_bgs /$/,${base_encode:16,default}/my_bgs /([^,]+)(,|$)/${define:my_fg,${eval:${${re:1}.fg}}}${define:my_bg,${base_decode:16,${split:${re:repl_index},,,${my_bgs}}}}${define:my_separator,${eval:${${re:1}.separator}}}${define:my_min_length,${eval:${${re:1}.min_length}}}${define:my_max_length,${eval:${${re:1}.max_length}}}${define:my_content,${eval:${${re:1}.content}}}${define:my_next_bg,${base_decode:16,${split:${calc:${re:repl_index}+1},,,${my_bgs}}}}${color:${my_fg},${my_bg}} ${cutscr:+${if:${split:1,0,keep_eol+strip_left,${my_max_length}}!~^[1-9][0-9]*$?${calc:${lengthscr:${my_content}}+1}:${my_max_length}},…,${my_content}}${repeat:${calc:${my_min_length}-${lengthscr:${my_content}}}, }${color:${my_fg},${my_bg}} ${if:${plugins.var.group_tools.${my_monitor}.all.general.powerline}!=?${if:${color:${my_bg}}==${color:${my_next_bg}}?${color:${my_separator}}:${color:${my_bg},${my_next_bg}}${color:reset}}:${color:reset} }/my_list /.+/${re:0} /my_list /.*/${tg_tags}/my_tags / //my_tags /.*/${my_list}${tg_message}/my_message"
/trigger set highmon_monitor command "/print -newbuffer ${my_monitor} -tags ${my_tags} \t${my_message}"
this trigger create the highmon monitor
/buffer add highmon
/eval /set weechat.startup.command_after_plugins ${weechat.startup.command_after_plugins}${if:${weechat.startup.command_after_plugins}!=?;}/buffer add highmon
/buffer_autoset add core.highmon notify none
/buffer_autoset add core.highmon highlight_words -
/buffer_autoset add core.highmon title Highlight Monitor
/buffer_autoset add core.highmon time_for_each_line 0
the commands above set some buffer properties for our new monitor buffer
/group_tools_item set highmon all general powerline,allow_hidden_channels 1
/group_tools_item set highmon all general defaults_options min_length,max_length,fg,bg,separator,content,conditions
/group_tools_item add highmon date "" 5 5 white 52 52 "${color:underline}${cut:5,,${split:-1, ,,${tg_date}}}" "${tg_highlight}!="
/group_tools_item add highmon serv "" 2 2 white 124 52 "${color:underline}${server}" "${tg_highlight}!="
/group_tools_item add highmon chan "" 4 4 white 124 52 "${color:underline}${split:1,#,keep_eol+strip_left,${channel}}" "${tg_highlight}!="
/group_tools_item add highmon nick "" 5 5 white 124 52 "${color:underline}${if:${tg_tags}=~,irc_action,? *:${tg_tag_nick}}" "${tg_highlight}!="
/group_tools_list content highmon header date serv chan nick
the commands above create a powerline bar to be displayed in front of the messages in the monitor buffer
you need:
- WeeChat 3.6 for ${lower:...} and /item
- the group_tools_item, group_tools_list and group_tools triggers
/eval /trigger addreplace newsmon_monitor print "${if:${plugins.var.group_tools.newsmon.all.general.buffer_full_name}!=?${plugins.var.group_tools.newsmon.all.general.buffer_full_name}:irc.libera.##news};irc_privmsg,matrix_message,matrix_text,debug_newsmon"
/trigger set newsmon_monitor conditions "(${plugins.var.group_tools.newsmon.all.general.allow_filtered_lines} != || ${tg_displayed} !=) && ${tg_message_nocolor} =~ ^\[[^]|]+\] +[^ ].* +→ +https?://[^ ]+$"
/trigger set newsmon_monitor regex "/.*/${info:news_parse,site_and_sections,${tg_message_nocolor}}/my_site_and_sections /.*/${split:1,|,,${my_site_and_sections}}/my_site /.*/${split:2,|,,${my_site_and_sections}}/my_first_section /.*/${split:3,|,,${my_site_and_sections}}/my_second_section /.*/${info:news_parse,title,${tg_message_nocolor}}/my_title /.*/${info:news_parse,url,${tg_message_nocolor}}/my_url /.*/${split:1,_,,${tg_trigger_name}}/my_monitor /.*/${plugins.var.group_tools.${my_monitor}.list.header.list}/my_list /[^,]+/${if:${re:0}=~^[abcdefghijklmnopqrstuvwxyz_]+$?${re:0}}/my_list /[^,]+/plugins.var.group_tools.${my_monitor}.item.${re:0}/my_list /[^,]+/${if:${length:${${re:0}.conditions}}==||${eval_cond:${${re:0}.conditions}}?${re:0}}/my_list /,+/,/my_list /^,|,$//my_list /.*/${my_list}/my_bgs /[^,]+/${base_encode:16,${eval:${${re:0}.bg}}}/my_bgs /$/,${base_encode:16,default}/my_bgs /([^,]+)(,|$)/${define:my_fg,${eval:${${re:1}.fg}}}${define:my_bg,${base_decode:16,${split:${re:repl_index},,,${my_bgs}}}}${define:my_separator,${eval:${${re:1}.separator}}}${define:my_min_length,${eval:${${re:1}.min_length}}}${define:my_max_length,${eval:${${re:1}.max_length}}}${define:my_content,${eval:${${re:1}.content}}}${define:my_next_bg,${base_decode:16,${split:${calc:${re:repl_index}+1},,,${my_bgs}}}}${color:${my_fg},${my_bg}} ${cutscr:+${if:${split:1,0,keep_eol+strip_left,${my_max_length}}!~^[1-9][0-9]*$?${calc:${lengthscr:${my_content}}+1}:${my_max_length}},…,${my_content}}${repeat:${calc:${my_min_length}-${lengthscr:${my_content}}}, }${color:${my_fg},${my_bg}} ${if:${plugins.var.group_tools.${my_monitor}.all.general.powerline}!=?${if:${color:${my_bg}}==${color:${my_next_bg}}?${color:${my_separator}}:${color:${my_bg},${my_next_bg}}${color:reset}}:${color:reset} }/my_list /.+/${re:0} /my_list /.*/${tg_tags}/my_tags / //my_tags /.*/${my_list}${my_title}${if:${plugins.var.group_tools.newsmon.all.general.keep_url}!=? → ${my_url}}/my_message"
/trigger set newsmon_monitor command "/print -newbuffer ${my_monitor} -tags ${my_tags} \t${my_message}"
this trigger create the newsmon monitor
/trigger addreplace newsmon_parse_tools info "news_parse"
/trigger set newsmon_parse_tools regex "/.*/${split:1,,,${tg_arguments}}/my_var /.*/${split:2,,keep_eol,${tg_arguments}}/my_message /.*/${my_message}/my_site_and_sections /.*/${my_message}/my_title /^\[([^]]+)\].*/${re:1}/my_site_and_sections / - /|/my_site_and_sections /^\[[^]]+\] (.*)/${re:1}/my_title /.*/${split:-1, ,,${my_title}}/my_url / [^ ]+ [^ ]+$//my_title /.*/${my_${my_var}}/tg_info"
this trigger is the article parser
/eval /trigger addreplace newsmon_add_site_info_tags line "formatted;${if:${plugins.var.group_tools.newsmon.all.general.buffer_full_name}!=?${plugins.var.group_tools.newsmon.all.general.buffer_full_name}:irc.libera.##news};irc_privmsg,matrix_message,matrix_text,debug_newsmon"
/trigger set newsmon_add_site_info_tags conditions "${tg_message_nocolor} =~ ^\[[^]|]+\] +[^ ].* +→ +https?://[^ ]+$"
/trigger set newsmon_add_site_info_tags regex "/.*/${lower:${info:news_parse,site_and_sections,${tg_message_nocolor}}}/my_site_and_sections /.*/site_name,site_first_section,site_second_section/my_news_tags /[^,]+/${re:0}_${base_encode:16,${split:${re:repl_index},|,,${my_site_and_sections}}}/my_news_tags /$/${my_news_tags},/tags /\|/ - /my_site_and_sections /$/site_and_sections_${base_encode:16,${my_site_and_sections}},site_title_${base_encode:16,${lower:${info:news_parse,title,${tg_message_nocolor}}}},site_url_${base_encode:16,${info:news_parse,url,${tg_message_nocolor}}},/tags"
this trigger appends the site_* tags to the article on the source buffer (by default irc.libera.##news)
/trigger addreplace newsmon_filter_rebuild config "plugins.var.group_tools.newsmon_interest.list.news.list;plugins.var.group_tools.newsmon_interest.list.newsmon.list"
/trigger set newsmon_filter_rebuild regex "/.*/${split:6,.,,${tg_option}}/my_list /.*/${raw:${${my_opt}_name},${${my_opt}_first_section},${${my_opt}_second_section},${${my_opt}_and_sections},${${my_opt}_name_start_with},${${my_opt}_first_section_start_with},${${my_opt}_second_section_start_with},${${my_opt}_and_sections_start_with},${${my_opt}_name_end_with},${${my_opt}_first_section_end_with},${${my_opt}_second_section_end_with},${${my_opt}_and_sections_end_with},${${my_opt}_name_contain},${${my_opt}_first_section_contain},${${my_opt}_second_section_contain},${${my_opt}_and_sections_contain},${${my_opt}_title},${${my_opt}_title_start_with},${${my_opt}_title_end_with},${${my_opt}_title_contain}}/my_options /.*/${my_options}/my_options2 /,/+/my_options2 /.*/${tg_value}/my_interests /[^,]+/${if:${re:0}=~^[abcdefghijklmnopqrstuvwxyz_]+$?${re:0}}/my_interests /,+/,/my_interests /^,|,$//my_interests /.*/${my_interests}/my_no_site_tags /([^,]+),?/${define:my_opt,plugins.var.group_tools.newsmon_interest.item.${re:1}.tags_no_site}${eval:${my_options}},/my_no_site_tags /,+/,/my_no_site_tags /^,|,$//my_no_site_tags /.*/${my_interests}/my_site_tags /([^,]+),?/${define:my_opt,plugins.var.group_tools.newsmon_interest.item.${re:1}.tags_site}${eval:${my_options2}}+/my_site_tags /[+]+/+/my_site_tags /^[+]|[+]$//my_site_tags /.*/${my_no_site_tags},${my_site_tags}/my_tags /^,|,$//my_tags /^$/!hide_everything/my_tags /.*/${if:${my_list}==newsmon?core.newsmon:${if:${plugins.var.group_tools.newsmon.all.general.buffer_full_name}!=?${plugins.var.group_tools.newsmon.all.general.buffer_full_name}:irc.libera.##news}}/my_buffer"
/trigger set newsmon_filter_rebuild command "/mute -core /filter addreplace ${my_list}_interest ${my_buffer} ${my_tags} *"
this trigger recreate the filters for the source buffer (irc.libera.##news) and the destination buffer (core.newsmon)
/trigger addreplace newsmon_tags_rebuild config "plugins.var.group_tools.newsmon_interest.item.*"
/trigger set newsmon_tags_rebuild conditions "${split:6,.,,${tg_option}} =~ ^[abcdefghijklmnopqrstuvwxyz_]+$ && ${split:7,.,,${tg_option}} =~ ^(no_)?site_(name|first_section|second_section|and_sections|title)(_start_with|_end_with|_contain)?$"
/trigger set newsmon_tags_rebuild regex "/.*/${split:6,.,,${tg_option}}/my_item /.*/${split:7,.,,${tg_option}}/my_option /.*/${my_option}/my_tag_prefix /^no_//my_tag_prefix /_(contain|start_with|end_with)$//my_tag_prefix /.*/${lower:${tg_value}}/my_tags /[^|]+/${if:${my_option}=~(end_with|contain)$?*}${base_encode:16,${re:0}}${if:${my_option}=~(start_with|contain)$?*}/my_tags /\|+/|/my_tags /^\||\|$//my_tags /.+/${if:${my_option}!~^no_?!}${my_tag_prefix}_${re:0}/my_tags /\|/${if:${my_option}=~^no_?,:+!}${my_tag_prefix}_/my_tags"
/trigger set newsmon_tags_rebuild command "/set plugins.var.group_tools.newsmon_interest.item.${my_item}.tags_${my_option} '${my_tags}'"
this trigger recreate the tags option of an option
/trigger addreplace newsmon_item_rebuild config "plugins.var.group_tools.newsmon_interest.list.all_items.list;plugins.var.group_tools.newsmon_interest.list.newsmon.list"
/trigger set newsmon_item_rebuild regex "/.*/${plugins.var.group_tools.newsmon_interest.list.all_items.list}/my_content /[^,]+/${if:${re:0}=~^[abcdefghijklmnopqrstuvwxyz_]+$?${re:0}}/my_content /,+/,/my_content /^,|,$//my_content /([^,]+),?/${define:my_display,${plugins.var.group_tools.newsmon_interest.item.${re:1}.display}}${define:my_display,${if:${length:${my_display}}==?${re:1}:${my_display}}}${define:my_color,${if:,${plugins.var.group_tools.newsmon_interest.list.newsmon.list},=-,${re:1},?45:24}}${color:${my_color}}${color:darkgray,${my_color}}${cutscr:+5,…,${my_display}}${color:reset}${color:${my_color}}\n/my_content /.*/${base_encode:16,${my_content}}/my_item"
/trigger set newsmon_item_rebuild command "/mute -core /set plugins.var.group_tools.newsmon_interest.all.general.bar_item_base16_encoded_content '${my_item}';/item refresh newsmon_interest"
this trigger rebuild the bar item newsmon_interest
/trigger addreplace newsmon_interest command "newsmon_interest;manage newsmon categories of interest;add <name> ${\x22}<option>${\x22} ${\x22}<value>${\x22} [${\x22}<option>${\x22} ${\x22}<value>${\x22}...] || del|enable|disable <name> [<name>...]; add: add or change a category${\n} del: delete one or more categories${\n} enable: enable some categories${\n}disable: disable some categories${\n} name: name of a category${\n} option: (no_)?site_(name|first_section|second_section|and_sections|title)(_contain|_start_with|_end_with)?${\n} value: a list of sites attributes separated by pipe${\n}${\n}-----${\n}${\n}Here is the format of an article:${\n}${\n} ${color:white,31} site_name first_section second_section ${color:31,default}${color:reset} article_title → article_url${\n}${\n}Not every articles have a first or second section.${\n}${\n}-----${\n}${\n}Examples of articles:${\n}${\n} ${color:white,13} Phoronix ${color:13,default}${color:reset} Hardware Timestamping... → https://www.phoronix.com/...${\n} ${color:white,130} Science Daily all ${color:130,default}${color:reset} How glyphosate... → https://www.sciencedaily.com/...${\n}${\n}-----${\n}${\n}Create a tech category matching ${color:underline}exactly${color:-underline} the site ${color:bold}Phoronix${color:-bold} and ${color:bold}Ars Technica${color:-bold} in addition to all articles with a first section ${color:underline}containing${color:-underline} ${color:bold}tech${color:-bold}:${\n}${\n}${color:121} /newsmon_interest add tech ${\x22}site_name${\x22} ${\x22}Phoronix|Ars Technica${\x22} ${\x22}site_first_section_contain${\x22} ${\x22}tech${\x22}${\n}${\n}Create a Canada category ${color:underline}containing${color:-underline} ${color:bold}Canada${color:-bold} in their site name, site first section, site second section or articles title:${\n}${\n}${color:121} /newsmon_interest add canada ${\x22}site_and_sections_contain${\x22} ${\x22}Canada${\x22} ${\x22}site_title_contain${\x22} ${\x22}Canada${\x22}${\n}${\n}In the previous examples, notice how the options and values are surrounded by ${\x22}${\x22}. You ${color:bold}must${color:-bold} use those if one of those contains a space but it is recommended to err on the side of caution and always use them.${\n}${\n}-----${\n}${\n}You can obtain the list of sites by visiting the URL in the topic of the ##news-chat channel on libera;add|del|enable|disable"
/trigger set newsmon_interest conditions "${tg_argv_eol1} =~ (?-i)^add +[abcdefghijklmnopqrstuvwxyz_]+ . || ${tg_argv_eol1} =~ (?-i)^(del|enable|disable) +([abcdefghijklmnopqrstuvwxyz_]+ *)+$"
/trigger set newsmon_interest regex "/.*/${tg_argv1}/my_action /.*/${if:${my_action}==add?${tg_argv2}:${tg_argv_eol2}}/my_items /.*/${if:${my_action}=~^(add|enable)$?push_if_not:remove}/my_group_tools_list_action /.*/${if:${my_action}=~^(add|del)$?all_items,news,}newsmon/my_lists /.*/${if:${my_action}==add?${repeat:${calc:${tg_shell_argc}-3},,}}/my_add_cmds /,/${if:${re:repl_index}=~[13579]$&&${tg_shell_argv${calc:${re:repl_index}+2}}=~^[abcdefghijklmnopqrstuvwxyz_]+$?${calc:${re:repl_index}+2},}/my_add_cmds ===([^,]+),?===${define:my_option,${tg_shell_argv${re:1}}}${define:my_value,${tg_shell_argv${calc:${re:1}+1}}}/mute -core /set plugins.var.group_tools.newsmon_interest.item.${my_items}.${my_option} '\${base_decode:16,${base_encode:16,${my_value}}}';===my_add_cmds /$/${my_add_cmds}/my_cmds_to_run ===$===${if:${my_action}==del?/group_tools del newsmon_interest ${my_items};}===my_cmds_to_run ===$===/group_tools ${my_group_tools_list_action} newsmon_interest ${my_lists} ${my_items}===my_cmds_to_run"
/trigger set newsmon_interest command "/command -buffer core.weechat * /eval -s ${my_cmds_to_run}"
this trigger create the newsmon_interest command which is a front-end to group_tools (plus a little more)
/trigger add newsmon_click_item hsignal "newsmon_click_item"
/trigger set newsmon_click_item regex "/.*/${plugins.var.group_tools.newsmon_interest.list.all_items.list}/my_list /[^,]+/${if:${re:0}=~^[abcdefghijklmnopqrstuvwxyz_]+$?${re:0}}/my_list /[^,]+/${if:${calc:${re:repl_index}-1}==${_bar_item_line}?${re:0}}/my_list /,//my_list /.*/${my_list}/my_item /.*/${if:${_key}==button1?content:${if:,${plugins.var.group_tools.newsmon_interest.list.newsmon.list},=-,${my_item},?remove:push}}/my_action"
/trigger set newsmon_click_item command "/group_tools_list ${my_action} newsmon_interest newsmon ${my_item}"
/key bindctxt mouse @item(newsmon_interest):button1* hsignal:newsmon_click_item
/key bindctxt mouse @item(newsmon_interest):button2* hsignal:newsmon_click_item
this trigger and these binds allows you to enable or disable categories by clicking on them in the newsmon bar item
/trigger addreplace newsmon_click_article hsignal "newsmon_click_article"
/trigger set newsmon_click_article regex "/.*/${_chat_line_tags}/my_article_url /[^,]+/${if:${re:0}=~^site_url_[[:xdigit:]]+$?${re:0}}/my_article_url /site_url_//my_article_url /,//my_article_url /.*/${base_decode:16,${re:0}}/my_article_url"
/trigger set newsmon_click_article command "/command -buffer ${buffer.full_name} core /input insert ${my_article_url}\x20"
/key bindctxt cursor @chat(core.newsmon):i hsignal:newsmon_click_article;/cursor stop
this trigger and this bind allows you to get the URL of an article from the tags when you press 'i' in cursor mode on an article
/buffer add newsmon
/eval /set weechat.startup.command_after_plugins ${weechat.startup.command_after_plugins}${if:${weechat.startup.command_after_plugins}!=?;}/buffer add newsmon
/buffer_autoset add core.newsmon notify none
/buffer_autoset add core.newsmon highlight_words -
/buffer_autoset add core.newsmon title News Monitor
/buffer_autoset add core.newsmon time_for_each_line 0
/eval /buffer_autoset add ${if:${plugins.var.group_tools.newsmon.all.general.buffer_full_name}!=?${plugins.var.group_tools.newsmon.all.general.buffer_full_name}:irc.libera.##news} notify none
/eval /buffer_autoset add ${if:${plugins.var.group_tools.newsmon.all.general.buffer_full_name}!=?${plugins.var.group_tools.newsmon.all.general.buffer_full_name}:irc.libera.##news} hidden 1
the commands above set some buffer properties for our new monitor buffer
/item addreplace newsmon_interest "${buffer.full_name} == core.newsmon" "${base_decode:16,${plugins.var.group_tools.newsmon_interest.all.general.bar_item_base16_encoded_content}}"
the command above create a new bar item
/group_tools_item set newsmon all general colors 1,3,4,5,6,9,10,13,17,22,23,25,27,33,53,55,57,63,93,94,124,129,130
/group_tools_item set newsmon all general powerline 1
/group_tools_item set newsmon all general defaults_options min_length,max_length,fg,bg,separator,content,conditions
/group_tools_item add newsmon site_name "" 0 "${calc:10+${if:${lengthscr:${my_first_section}}==?4:${if:${lengthscr:${my_first_section}}<7?7-${lengthscr:${my_first_section}}}}}" "white" "${info:nick_color_name,${base_encode:16,${my_site_and_sections}};${plugins.var.group_tools.newsmon.all.general.colors}}" "white" "${color:underline}${my_site}"
/group_tools_item add newsmon site_first_section "" 0 "${calc:7+${if:${lengthscr:${my_site}}<10?10-${lengthscr:${my_site}}}}" "white" "${info:nick_color_name,${base_encode:16,${my_site_and_sections}};${plugins.var.group_tools.newsmon.all.general.colors}}" "white" "${color:underline}${my_first_section}" "${my_first_section}!="
/group_tools_item add newsmon site_no_first_section "" 0 "${calc:7+${if:${lengthscr:${my_site}}<10?10-${lengthscr:${my_site}}}}" "white" "${info:nick_color_name,${base_encode:16,${my_site_and_sections}};${plugins.var.group_tools.newsmon.all.general.colors}}" "white" "${color:underline}N/A" "${my_first_section}=="
/group_tools_list content newsmon header site_name site_first_section site_no_first_section
the commands above create a powerline bar to be displayed in front of the messages in the monitor buffer
/newsmon_interest add tech "display" "💻" "site_name" "Wired|EFF Updates|techdirt|TorrentFreak|Hacker News|CNET|phoronix|Ars Technica|Journal du hacker" "site_and_sections_contain" "netsec|Tech" "site_title_contain" "Linux|Computer|Techno"
/newsmon_interest add science "display" "🧪" "site_and_sections_contain" "Science|Space|Environment" "site_title_contain" "Study|Climate"
/newsmon_interest add canada "display" "🇨🇦" "site_and_sections_contain" "Canada|Quebec|Montreal" "site_title_contain" "Canada|Quebec|Montreal"
/newsmon_interest add world "display" "🌐" "site_and_sections_contain" "World|International"
/newsmon_interest add health "display" "🏥" "site_and_sections_contain" "Health" "site_title_contain" "Health"
/newsmon_interest add finance "display" "💲" "site_and_sections_contain" "Finance|Business|Money|Company|Economy"
/newsmon_interest add hockey "display" "🏒" "site_title_contain" "NHL|Hockey"
/newsmon_interest add life "display" "🙂" "site_and_sections_contain" "Life|People|Culture|Music|Film|Religion|Art"
the commands above create items that represent the news you are interested in
/eval /window splith ${calc:9 / ${window[gui_current_window].win_height} * 100 // 1}
/buffer highmon
/window 1
/layout store main-control windows
a layout with two windows, window 1 is the bigger one and the main one used to display anything. Window 2 is suited to display monitors buffers like chanmon, highmon and newsmon
/window 2
/window splitv 50
/buffer core.newsmon
/window 1
/layout store main-control-control2 windows
a layout with three windows. Windows 2 and windows 3 are suited to display monitors buffers like chanmon, highmon and newsmon
≥ WeeChat 3.1 for tg_trigger_name
/alias del devinfo
/trigger addreplace devinfo command "devinfo;infos about WeeChat;[-extra] [-match];-extra: displays extra informations like in how many day the next stable will be released${\n}-match: show if you are up-to-date${\n}${\n}This command retrieve infos about current and next stable version.${\n}${\n}Exemples:${\n} Verbose output:${\n} /${tg_trigger_name} -extra -match;-extra|-match|%*"
/trigger set devinfo conditions "${tg_argv_eol1} =~ ^(-(extra|match)( +|$))*$"
/trigger set devinfo regex "/.*/${tg_argv_eol1}/my_flags / +/_/my_flags /-//my_flags"
/trigger set devinfo command "/exec -norc -timeout 5 -hsignal devinfo_${my_flags} url:https://weechat.org/dev/info/all/"
/trigger addreplace utils_date_calc_days info date_calc_days
/trigger set utils_date_calc_days conditions "${tg_arguments} =~ ^[0-9]{4}-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])$ && ${info:python_version} !="
/trigger set utils_date_calc_days regex "/.*/${info:python_eval,from datetime import datetime; date1 = datetime.today(); date2 = datetime.strptime('${tg_arguments}', '%Y-%m-%d'); delta = date1 - date2; print(abs(delta.days))}/tg_info"
/trigger addreplace utils_date_preferred info date_preferred
/trigger set utils_date_preferred conditions "${tg_arguments} =~ ^[0-9]{4}-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])$ && ${info:python_version} !="
/trigger set utils_date_preferred regex "/.*/${info:python_eval,from datetime import datetime; print(datetime.strptime('${tg_arguments}', '%Y-%m-%d').strftime('%x'))}/tg_info"
/trigger addreplace devinfo_hsignal hsignal "devinfo_*"
/trigger set devinfo_hsignal conditions "${err} == && ${info:python_version} !="
/trigger set devinfo_hsignal regex "/.*/${tg_signal}/my_flags /^devinfo_//my_flags /(?n)^stable:(.*)/${re:0}${if:${my_flags}=~match&&${info:version}!~-(dev|rc[0-9]+)? ${if:${re:1}==${info:version}?${color:121}(as mine!):${color:163}(mine is ${info:version})}}/out /(?n)^devel:(.*)/${re:0}${if:${my_flags}=~match&&${info:version}=~-(dev|rc[0-9]+)? ${if:${re:1}==${info:version}?${color:121}(as mine!):${color:163}(mine is ${info:version})}}/out /.*/${info:version_git}/my_git /^[^g]+g(.*)/${re:1}/my_git /(?n)^git:(.*)/${re:0}${if:${my_flags}=~match&&${info:version}=~-(dev|rc[0-9]+)? ${if:${re:1}=~^${my_git}?${color:121}(as mine!):${color:163}(mine is ${info:version_git})}}/out /(?n)^(stable_date:)(.*)/${re:1}${info:date_preferred,${re:2}}${if:${my_flags}=~extra? (since ${info:date_calc_days,${re:2}} days)}/out /(?n)^(next_stable_date:)(.*)/${re:1}${info:date_preferred,${re:2}}${if:${my_flags}=~extra? (${info:date_calc_days,${re:2}} days left)}/out /_/ /out /(?n)^([^:]+:)(.*)/${color:31}${re:1} ${color:default}${re:2}/out /\n/\x5cn/out"
/trigger set devinfo_hsignal command "/print -current -escape ${out}"
The devinfo trigger create the devinfo command which is used to retrieve info from https://weechat.org/dev/info/all/ and tell you if you're up-to-date (if you use the -match flag) and in how many days the next stable will be released (if you use the -extra flag)
≥ WeeChat 4.1.0 for ${info:buffer,...}
/buffer_autoset add exec.exec.translated_dict short_name dictionary
/set plugins.var.translate_lang fr
/buffer_autoset add irc.*.*fr localvar_set_translate_lang en
/trigger addreplace translate modifier weechat_print
/trigger set translate conditions "${tg_tags} =~ ,exec_cmd_translated_(text|lang),"
/trigger set translate regex "/.*/${color:*_31}${if:${tg_tags}=~,exec_cmd_translated_text,?Translation:Language}${color:reset}\t${tg_message_nocolor}/"
/trigger addreplace translate_hsignal hsignal "translate_text;translate_lang;translate_dict"
/trigger set translate_hsignal conditions "${tg_signal} != translate_dict || ${tg_signal} == translate_dict && ${_chat_word} !="
/trigger set translate_hsignal regex "/.*/${split:1,,strip_left+strip_right+collapse_seps,${info:spell_dict,${_buffer}}}/my_main_spell_dict /.*/${split:1,_,,${env:LANG}}/my_env_lang /.*/${_buffer_localvar_translate_lang},${if:${_buffer_localvar_type}=~^(channel|private)$?${buffer[${info:search_server_buffer_ptr,${_buffer}}].local_variables.translate_lang}},${plugins.var.translate_lang},${my_main_spell_dict},${my_env_lang}/my_lang /.*/${split:1,,strip_left+strip_right+collapse_seps,${my_lang}}/my_lang /.*/${if:${tg_signal}=~text$?-brief -target ${my_lang}:${if:${tg_signal}=~lang$?-brief -id:-dictionary}}/my_options /.*/${if:${tg_signal}=~dict$?${_chat_word}:${_chat_focused_line}}/my_text"
/trigger set translate_hsignal command "/command -buffer ${_buffer_full_name} * /exec -norc -name ${tg_signal} trans -no-autocorrect -no-ansi -j ${my_options} -- ${my_text}"
/key bindctxt cursor @chat:t /window ${_window_number};hsignal:translate_text;/cursor stop
/key bindctxt cursor @chat:l /window ${_window_number};hsignal:translate_lang;/cursor stop
/key bindctxt cursor @chat:d /window ${_window_number};hsignal:translate_dict;/cursor stop
This let you translate text with the translate-shell program (package has the same name, at least for Debian). If you want to translate something someone said, press the middle mouse button on the message then press 't'. If you want to know the language of the text, press 'l' instead. Finally, you can press 'd' this will open a buffer and call translate-shell in dictionary mode. For the key 't', the target language is choosed like this: if there is a translate_lang localvar for the buffer, use the langage specified by this localvar. If not, check if the buffer is a channel or private and if so, check if there is a translate_lang localvar for the corresponding server buffer. If not, check if the option plugins.var.translate_lang exist. Otherwhise, check if there is a main spell dict set and if not use the LANG env. So, 1) buffer localvar 2) server buffer localvar 3) option 4) main spell dict 5) LANG environment variable
/trigger addreplace nick_validation modifier "input_text_display"
/trigger set nick_validation conditions "${tg_string_nocolor} =~ ^/nick . && ${buffer.plugin.name} == irc"
/trigger set nick_validation regex "/.*/${tg_string_nocolor}/my_nick ===^/nick (.+)===${re:1}===my_nick /^-all (.+)/${re:1}/my_nick ===.*===${if:${tg_string_nocolor}=~^/nick -all[ ]?${info:python_eval,infolist = weechat.infolist_get('irc_server', '', '')\nwhile weechat.infolist_next(infolist):\n if weechat.infolist_integer(infolist, 'is_connected'): print(weechat.infolist_string(infolist, 'name') + ' ')\nweechat.infolist_free(infolist)}:${server}} ===my_servers ===[^ ]+===\n${define:my_nicklen,${info:irc_server_isupport_value,${re:0},NICKLEN}}${if:${info:irc_is_nick,${re:0},${my_nick}}!=?${color:16,46}:${color:16,163}}${re:0} ${color:reverse} NICKLEN = ${calc:${my_nicklen} - ${length:${my_nick}}}/${my_nicklen} CASEMAPPING = ${info:irc_server_isupport_value,${re:0},CASEMAPPING} UTF8MAPPING = ${if:${info:irc_server_isupport_value,${re:0},UTF8MAPPING}!=?${info:irc_server_isupport_value,${re:0},UTF8MAPPING}:no}${color:16,default}===my_servers /.*/${re:0} ${my_servers}/tg_string"
This trigger will give you hint about max nickname length and available character in nickname and will also tell you if the nick is valid or not. Also note that weechat has limited support for the rfc8265. For example, on an ergo server with utf8 nickname enabled, weechat correctly report the nickname é as valid but incorrectly report │ as valid.
≥ WeeChat 3.3 for ${split:...}
/trigger addoff logo_refresh timer "500;0;0"
/trigger set logo_refresh regex "/.*/${plugins.var.logo_colors}/my_colors /^,*$/24,31,121,163,229,white/my_colors ===.*===___ __ ______________ _____===my_first ===.*===__ | / /___________ ____/__ /_______ __ /_===my_second ===.*===__ | /| / /_ _ \ _ \ / __ __ \ __ `/ __/===my_third ===.*===__ |/ |/ / / __/ __/ /___ _ / / / /_/ // /_===my_forth ===.*===____/|__/ \___/\___/\____/ /_/ /_/\__,_/ \__/===my_fifth /[^ ]/${color:*${split:random,,collapse_seps+strip_left+strip_right,${my_colors}}}${re:0}${color:reset}/my_first /[^ ]/${color:*${split:random,,collapse_seps+strip_left+strip_right,${my_colors}}}${re:0}${color:reset}/my_second /[^ ]/${color:*${split:random,,collapse_seps+strip_left+strip_right,${my_colors}}}${re:0}${color:reset}/my_third /[^ ]/${color:*${split:random,,collapse_seps+strip_left+strip_right,${my_colors}}}${re:0}${color:reset}/my_forth /[^ ]/${color:*${split:random,,collapse_seps+strip_left+strip_right,${my_colors}}}${re:0}${color:reset}/my_fifth"
/trigger set logo_refresh command "/print -free -newbuffer logo -y 0 ${my_first};/print -free -newbuffer logo -y 1 ${my_second};/print -free -newbuffer logo -y 2 ${my_third};/print -free -newbuffer logo -y 3 ${my_forth};/print -free -newbuffer logo -y 4 ${my_fifth}"
/trigger addreplace logo command "logo;WeeChat Animated Logo;start|stop|toggle|faster|slower || timer <time> [<align> [<number>]] || speed <speed> || color [\"<range>...\" [\"<name>...\"]]; start: start the animation${\n} stop: stop the animation${\n}toggle: toggle the animation${\n}faster: increase the speed of the animation${\n}slower: decrease the speed of the animation${\n} timer: use a custom ms${\n} speed: use a preset${\n} color: specify the colors${\n} time: number of ms${\n} align: alignment on second${\n}number: max number of calls${\n} speed: one of the following values: ultra, fast, normal, slow${\n} range: a range, eg: 3-35${\n} name: name of a color${\n}${\n}Let's play with the WeeChat Animated ASCII logo!${\n}${\n}Exemples:${\n} Start the timer !!${\n} /logo start${\n} Change the colors${\n} /logo color \"\" \"24 31 121 163 229 white\";start|stop|toggle|faster|slower || timer 5000|4000|3000|2000|1000 || speed ultra|fast|normal|slow || color 0-255"
/trigger set logo conditions "${tg_argv_eol1} =~ (?-i)^(start|stop|toggle|faster|slower)$ || ${tg_argv_eol1} =~ (?-i)^timer +[0-9]+( +[0-9]+)?( +[0-9]+)?$ || ${tg_argv_eol1} =~ (?-i)^speed +(ultra|fast|normal|slow)$ || (${tg_shell_argv1} == color && ${tg_shell_argv2} =~ (?-i)^ *(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-6])-([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-6])( +|$))*$ && ${tg_shell_argc} <= 4)"
/trigger set logo regex "/.*/${tg_argv1}/my_action /start/enable/my_action /stop/disable/my_action /.*/${trigger.trigger.logo_refresh.arguments}/my_hook_args /.*/${split:1,;,,${my_hook_args}}/my_current_ms /.*/${if:${my_action}==timer?${tg_argv3}:${split:2,;,,${my_hook_args}}}/my_align_sec /.*/${if:${my_action}==timer?${tg_argv4}:${split:3,;,,${my_hook_args}}}/my_num_call /.*/${if:${my_action}==faster?${if:${my_current_ms}<=50?${my_current_ms}:${calc:${my_current_ms}-50}}:${if:${my_action}==slower?${calc:${my_current_ms}+50}:${if:${my_action}=~^(speed|timer)$?${tg_argv2}}}}/my_speed /ultra/5/my_speed /fast/50/my_speed /normal/500/my_speed /slow/1000/my_speed /.*/${if:${my_action}==color?${tg_shell_argv2}}/my_colors /([0-9]+)-([0-9]+)/${info:python_eval,print(' '.join(map(str, list(range(${re:1},${re:2})))))}/my_colors /$/${if:${my_action}==color? ${tg_shell_argv3}}/my_colors / +/,/my_colors /^,|,$//my_colors ===.*===/mute ${if:${my_action}=~(enable|disable|toggle)?/trigger ${my_action} logo_refresh:${if:${my_action}==color?/set plugins.var.logo_colors '${my_colors}':/trigger set logo_refresh arguments ${my_speed};${my_align_sec};${my_num_call}}}===my_cmds_to_run"
/trigger set logo command "/command -buffer core.weechat * /eval ${my_cmds_to_run}"
/key bindctxt mouse @chat(core.logo):button1 /logo toggle
/key bindctxt mouse @chat(core.logo):button1-gesture-left* /logo slower
/key bindctxt mouse @chat(core.logo):button1-gesture-right* /logo faster
/buffer_autoset add core.logo title Animated WeeChat Logo - Click on the logo to toggle the animation - Use gesture to increase and decrease the speed
/alias add logo_xmas /logo color "" "34 46 40 124 160 196 white"
/alias add logo_config /logo color "" "24 31 121 163 229 white"
useless thing but nonetheless beautiful
/trigger addreplace day_changed_upgrade_scripts signal day_changed
/trigger set day_changed_upgrade_scripts command "/script update;/wait 10s /script upgrade"
This trigger will update the local script cache and then upgrade all the installed scripts at midnight.
/trigger addreplace utils_holiday info holiday
/trigger set utils_holiday conditions "${tg_arguments} =~ ^(0[1-9]|[1-2][0-9]|3[0-1])-(0[1-9]|1[0-2])$"
/trigger set utils_holiday regex "/.*/${tg_arguments}/ /01-01/HAPPY NEW YEAR!/ /25-12/MERRY CHRISTMAS!/ /[0-9][0-9]-[0-9][0-9]//"
this info is useful for the weechat.look.day_change_message_1_date and _2dates. See these options at the bottom of my configuration.
≥ WeeChat 4.0.0 for keys binding improvement
/buffer_autoset add core.memory_game short_name memory
/buffer_autoset add core.memory_game clear 1
/buffer_autoset add core.memory_game title Memory Game Keys: alt+space: show the grid bar, alt-n: new game, ←↑→↓: move the cursor Input: space: flip card q: quit
/buffer_autoset add core.memory_game key_bind_meta-n /play_memory 4 13
/buffer_autoset add core.memory_game key_bind_up /memory_game_keyboard up
/buffer_autoset add core.memory_game key_bind_down /memory_game_keyboard down
/buffer_autoset add core.memory_game key_bind_left /memory_game_keyboard left
/buffer_autoset add core.memory_game key_bind_right /memory_game_keyboard right
/buffer_autoset add core.memory_game key_bind_meta-space /bar toggle memory_game_choose_grid
/key bindctxt mouse @chat(core.memory_game):button1 hsignal:memory_game
/key bindctxt mouse @item(memory_game_choose_grid):button1-event-drag hsignal:memory_game_item_selected
/key bindctxt mouse @item(memory_game_choose_grid):button1* hsignal:memory_game_item_start
/item addreplace memory_game_choose_grid "" "${repeat:13,▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆${\n}}"
/bar add memory_game_choose_grid window,${buffer.full_name}==core.memory_game top 0 1 memory_game_choose_grid
/bar set memory_game_choose_grid filling_top_bottom vertical
/bar set memory_game_choose_grid color_fg white
/bar toggle memory_game_choose_grid
/alias add play_memory /memory_game $1 $2 🍅🍌🍒🍓🥒🍇🍉🍋🍍🫐🥕🥦🍭🍕🥨🥑🍐🫒🧅🥣🍿🍟🥔🫑🎂🍬🐵🐒🦍🦧🐶🦮🐩🐺🦊🦝🐈🦁🐯🐅🐆🐴🐎🦄🦓🦌🦬🐮🐂🐃🐮🐄🐷🐖🐗🐽🐏🐪🦙🦒🐘🦣🦏🦛🐭🐁🐀🐹🐇🐰🦫🦔🦇🐻🐨🐼🦥🦦🦨🦘🦡🦃🐔🐓🐤🐦🐧🦅🦆🦢🦉🦤🦩🦚🦜🐸🐊🐢🦎🐍🐲🦕🦖🐋🐬🦭🐟🐠🐡🦈🐙🐌🦋🐛🐜🐝🪲🐞🦗🦂🦟🪰🪱
/trigger addreplace memory_game command "memory_game;memory card game by r3m;<lines> <cols> <emojis>; lines: the number of lines${\n} cols: the number of columns${\n}emojis: a list of emojis (must have enough emojis for the grid size you request)${\n}${\n}Create a grid of 4 lines and 13 cols (require 26 emojis for a grid of 52 cards):${\n}${\n} /${tg_trigger_name} 4 13 🍅🍌🍒🍓🥒🍇🍉🍋🍍🫐🥕🥦🍭🍕🥨🥑🍐🫒🧅🥣🍿🍟🥔🫑🎂🍬;4 13 🍅🍌🍒🍓🥒🍇🍉🍋🍍🫐🥕🥦🍭🍕🥨🥑🍐🫒🧅🥣🍿🍟🥔🫑🎂🍬"
/trigger set memory_game conditions "${info:python_version} != && ${tg_argv_eol1} =~ ^[1-9][0-9]* +[1-9][0-9]* . && ${calc:${tg_argv1}*${tg_argv2}} <= ${calc:${length:${tg_argv3}}*2} && ${calc:${tg_argv1}*${tg_argv2}} =~ [02468]$ && ${calc:${length:${tg_argv3}}*2} == ${lengthscr:${tg_argv3}}"
/trigger set memory_game regex "/.*/${tg_argv1}/my_nb_lines /.*/${tg_argv2}/my_nb_cols /.*/${tg_argv3}/my_emojis /.*/${cutscr:${calc:${my_nb_lines}*${my_nb_cols}},,${my_emojis}}/my_emojis /.*/${info:python_eval,import random; emoji = list(\x22${repeat:2,${my_emojis}}\x22); random.shuffle(emoji); print(''.join(emoji))}/my_cards /./${re:0}${if:${calc:${re:repl_index}%${my_nb_cols}}==0?|}/my_cards /[^|]/${re:0},/my_cards /.*/${repeat:${calc:${my_nb_lines}*2-1},,}/my_cmds_to_run ===,===${if:${re:repl_index}=~[13579]$?${define:my_cards_line,${calc:${re:repl_index}//2+1}}/mute -core /set plugins.var.memory_game.cards_in_line_${my_cards_line} ${split:${my_cards_line},|,,${my_cards}};/mute -core /set plugins.var.memory_game.cards_state_in_line_${my_cards_line} ${repeat:${my_nb_cols},hidden,};:/print -newbuffer memory_game -free -y ${re:repl_index} ┃${repeat:${calc:${my_nb_cols}*3+1}, }┃;}===my_cmds_to_run ===$===/print -switch -newbuffer memory_game -free -y 0 ┏${repeat:${calc:${my_nb_cols}*3+1},━}┓;/print -newbuffer memory_game -free -y ${calc:${my_nb_lines}*2} ┗${repeat:${calc:${my_nb_cols}*3+1},━}┛;===my_cmds_to_run ===.*===/mute -core /unset -mask plugins.var.memory_game.*;/buffer clear memory_game;/mute -core /set plugins.var.memory_game.lines ${my_nb_lines};/mute -core /set plugins.var.memory_game.cols ${my_nb_cols};/mute -core /set plugins.var.memory_game.cursor_pos 1,1;${re:0}===my_cmds_to_run ===.*===${if:${plugins.var.memory_game.wait}!=?/print -core -error the card animation most complete, please try again in 2 seconds:${re:0}}===my_cmds_to_run"
/trigger set memory_game command "/command -buffer core.weechat * /eval -s ${my_cmds_to_run}"
/trigger addreplace memory_game_line_modified config "plugins.var.memory_game.cards_state_in_line_*;plugins.var.memory_game.cursor_line_*"
/trigger set memory_game_line_modified conditions "${plugins.var.memory_game.cards_state_in_line_${split:-1,_,,${tg_option}}} !="
/trigger set memory_game_line_modified regex "/.*/${split:-1,_,,${tg_option}}/my_cards_line /.*/${calc:${my_cards_line}*2-1}/my_buffer_line /.*/${plugins.var.memory_game.cursor_pos}/my_cursor_pos /.*/${plugins.var.memory_game.cards_state_in_line_${my_cards_line}}/my_value /.*/${my_value}/my_updated_line /([^,]+),/${if:${my_cards_line},${re:repl_index}==${my_cursor_pos}?${color:121}→: }${if:${re:1}==hidden?${color:,31}❓:${if:${re:1}==found? :${color:,24}${split:${re:repl_index},,,${plugins.var.memory_game.cards_in_line_${my_cards_line}}}}}${color:reset}/my_updated_line /.*/┃${re:0} ┃/my_updated_line /.*/${repeat:${plugins.var.memory_game.lines},,}/my_win /,/${if:${re:repl_index}==${my_cards_line}?${my_value}:${plugins.var.memory_game.cards_state_in_line_${re:repl_index}}}/my_win /.*/${if:${re:0}=~^(found,)+$?1}/my_win ===$===/print -newbuffer memory_game -free -y ${my_buffer_line} ${my_updated_line};${if:${my_win}!=?/buffer clear memory_game;/print -newbuffer memory_game -free ${color:reset} ${color:*_121}YOU WON!}===my_cmds_to_run"
/trigger set memory_game_line_modified command "/command -buffer core.weechat * /eval -s ${my_cmds_to_run}"
/trigger addreplace memory_game_mouse hsignal memory_game
/trigger set memory_game_mouse conditions "${plugins.var.memory_game.wait} == && ${_chat_line_y} =~ [13579]$ && ${_chat_line_y} <= ${calc:${plugins.var.memory_game.lines}*2-1} && ${_chat_line_x} > 1 && ${_chat_line_x} <= ${calc:${plugins.var.memory_game.cols}*3} && ${calc:(${_chat_line_x}+1)%3} =~ ^[01]$ && ${split:${calc:(${_chat_line_x}+1)//3},,,${plugins.var.memory_game.cards_state_in_line_${calc:${_chat_line_y}//2+1}}} == hidden"
/trigger set memory_game_mouse regex "===.*===${calc:${_chat_line_y}//2+1}===my_cards_line ===.*===${calc:(${_chat_line_x}+1)//3}===my_cards_col"
/trigger set memory_game_mouse command "/memory_game_flip_card ${my_cards_line} ${my_cards_col}"
/trigger addreplace memory_game_input signal buffer_user_input_memory_game
/trigger set memory_game_input conditions "${plugins.var.memory_game.wait} == && ${tg_signal_data} =~ ^[ ]$ && ${split:${split:2,,,${plugins.var.memory_game.cursor_pos}},,,${plugins.var.memory_game.cards_state_in_line_${split:1,,,${plugins.var.memory_game.cursor_pos}}}} == hidden"
/trigger set memory_game_input regex "/.*/${split:1,,,${plugins.var.memory_game.cursor_pos}}/my_cards_line /.*/${split:2,,,${plugins.var.memory_game.cursor_pos}}/my_cards_col"
/trigger set memory_game_input command "/memory_game_flip_card ${my_cards_line} ${my_cards_col}"
/trigger addreplace memory_game_keyboard command memory_game_keyboard
/trigger set memory_game_keyboard conditions "${tg_argv_eol1} =~ ^(up|down|left|right)$"
/trigger set memory_game_keyboard regex "/.*/${tg_argv1}/my_key /.*/${plugins.var.memory_game.cursor_pos}/my_cursor_pos /.*/${split:1,,,${my_cursor_pos}}/my_cards_line /.*/${split:2,,,${my_cursor_pos}}/my_cards_col /.*/${plugins.var.memory_game.lines}/my_nb_lines /.*/${plugins.var.memory_game.cols}/my_nb_cols /.*/${if:${my_key}==left?${if:${my_cards_col}==1?${if:${my_cards_line}==1?${my_nb_lines}:${calc:${my_cards_line}-1}},${my_nb_cols}:${my_cards_line},${calc:${my_cards_col}-1}}:${if:${my_key}==right?${if:${my_cards_col}==${my_nb_cols}?${if:${my_cards_line}==${my_nb_lines}?1:${calc:${my_cards_line}+1}},1:${my_cards_line},${calc:${my_cards_col}+1}}:${if:${my_key}==up?${if:${my_cards_line}==1?${my_nb_lines},${if:${my_cards_col}==1?${my_nb_cols}:${calc:${my_cards_col}-1}}:${calc:${my_cards_line}-1},${my_cards_col}}:${if:${my_key}==down?${if:${my_cards_line}==${my_nb_lines}?1,${if:${my_cards_col}==${my_nb_cols}?1:${calc:${my_cards_col}+1}}:${calc:${my_cards_line}+1},${my_cards_col}}}}}}/my_new_cursor_pos"
/trigger set memory_game_keyboard command "/mute -core /set plugins.var.memory_game.cursor_pos ${my_new_cursor_pos};/mute -core /set plugins.var.memory_game.cursor_line_${split:1,,,${my_cursor_pos}} ${my_new_cursor_pos};/mute -core /set plugins.var.memory_game.cursor_line_${split:1,,,${my_new_cursor_pos}} ${my_new_cursor_pos}"
/trigger addreplace memory_game_flip_card command memory_game_flip_card
/trigger set memory_game_flip_card regex "/.*/${tg_argv1}/my_cards_line /.*/${tg_argv2}/my_cards_col /.*/${plugins.var.memory_game.second_card}/my_second_card /.*/${plugins.var.memory_game.cards_state_in_line_${my_cards_line}}/my_updated_states /[^,]+/${if:${re:repl_index}==${my_cards_col}?flipped:${re:0}}/my_updated_states /.*/${if:${my_second_card}!=?${split:1,,,${plugins.var.memory_game.card_1_pos}}}/my_first_card_line /.*/${if:${my_second_card}!=?${split:2,,,${plugins.var.memory_game.card_1_pos}}}/my_first_card_col /.*/${if:${my_second_card}!=?${if:${split:${my_cards_col},,,${plugins.var.memory_game.cards_in_line_${my_cards_line}}}==${split:${my_first_card_col},,,${plugins.var.memory_game.cards_in_line_${my_first_card_line}}}?found:hidden}}/my_result /.*/${if:${my_second_card}!=?${if:${my_first_card_line}==${my_cards_line}?${my_updated_states}:${plugins.var.memory_game.cards_state_in_line_${my_first_card_line}}}}/my_first_card_states /[^,]+/${if:${re:repl_index}==${my_first_card_col}?${my_result}:${re:0}}/my_first_card_states /.*/${if:${my_second_card}!=?${if:${my_first_card_line}==${my_cards_line}?${my_first_card_states}:${my_updated_states}}}/my_second_card_states /[^,]+/${if:${re:repl_index}==${my_cards_col}?${my_result}:${re:0}}/my_second_card_states ===$===/mute -core /set plugins.var.memory_game.cards_state_in_line_${my_cards_line} ${my_updated_states};${if:${my_second_card}==?/mute -core /set plugins.var.memory_game.second_card 1;/mute -core /set plugins.var.memory_game.card_1_pos ${my_cards_line},${my_cards_col}:/mute -core /unset plugins.var.memory_game.second_card;/mute -core /set plugins.var.memory_game.wait 1;/wait 2s /mute -core /set plugins.var.memory_game.cards_state_in_line_${my_first_card_line} ${my_first_card_states};/wait 2s /mute -core /set plugins.var.memory_game.cards_state_in_line_${my_cards_line} ${my_second_card_states};/wait 2s /mute -core /unset plugins.var.memory_game.wait}===my_cmds_to_run"
/trigger set memory_game_flip_card command "/command -buffer core.weechat * /eval -s ${my_cmds_to_run}"
/trigger addreplace memory_game_item_start hsignal memory_game_item_start
/trigger set memory_game_item_start conditions "${_bar_item_name} == ${_bar_item_name2} && ${_bar_item_line} == 0 && ${_bar_item_col} == 0 && ${_bar_item_line2} >= 0 && ${_bar_item_col2} >= 0"
/trigger set memory_game_item_start regex "/.*/${calc:${_bar_item_line2}+1}/my_nb_lines /.*/${calc:${_bar_item_col2}+1}/my_nb_cols ===.*===${calc:${my_nb_cols}//2${if:${my_nb_cols}=~[13579]?+1})}===my_nb_cols"
/trigger set memory_game_item_start command "/play_memory ${my_nb_lines} ${my_nb_cols};/mute -core /item addreplace memory_game_choose_grid ${\x22}${\x22} ${\x22}${repeat:13,▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆${raw:${\n}}}${\x22};/bar toggle memory_game_choose_grid"
/trigger addreplace memory_game_item_selected hsignal memory_game_item_selected
/trigger set memory_game_item_selected conditions "${_bar_item_name} == ${_bar_item_name2} && ${_bar_item_line} == 0 && ${_bar_item_col} == 0 && ${_bar_item_line2} >= 0 && ${_bar_item_col2} >= 0"
/trigger set memory_game_item_selected regex "/.*/${calc:${_bar_item_line2}+1}/my_nb_lines /.*/${calc:${_bar_item_col2}+1}/my_nb_cols ===.*===${calc:${my_nb_cols}//2${if:${my_nb_cols}=~[13579]?+1})}===my_nb_cols ===.*===${color:${if:${calc:${my_nb_lines}*${my_nb_cols}}=~[02468]$?121:163}}===my_color /.*/${my_color}▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆/my_selected_lines /[ ▆]/${if:${calc:${re:repl_index}-1-${_bar_item_col2}}==1?${color:reset}}${re:0}/my_selected_lines /$/${raw:${\x5cn}}/my_selected_lines /.*/${repeat:${calc:${_bar_item_line2}+1},${my_selected_lines}}/my_selected_lines /.*/▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆ ▆/my_not_selected_lines /.*/${repeat:${calc:13-(${_bar_item_line2}+1)},${my_not_selected_lines}${raw:${\x5cn}}}/my_not_selected_lines /.*/${my_selected_lines}${my_not_selected_lines}/my_colored_content"
/trigger set memory_game_item_selected command "/command -buffer core.weechat * /mute -core /item addreplace memory_game_choose_grid ${\x22\x22} ${\x22}${my_colored_content}${\x22}"
This game is not a full-blown memory card game. It only contains the core functionality. It doesn't track the time you took to complete the game. I made this game for two reasons. The first reason is because it was fun and educative, the second reason is to serve as a POC (proof of concept) of what can be accomplished using triggers.
You can play with as many cards as you want (most be even and you must provide enough emojis) in the disposition you want (you specify the line and cards by line).
There is 2 ways to play:
- with the mouse
- with the arrows keys to move and space+enter to select the card
≥ WeeChat 4.0.0 for keys binding improvement
/buffer_autoset add core.sliding_game short_name sliding
/buffer_autoset add core.sliding_game clear 1
/buffer_autoset add core.sliding_game title Sliding Game Keys: alt-n,1-9: new game, ←↑→↓: move a number Input: q: quit
/buffer_autoset add core.sliding_game key_bind_meta-n,3 /sliding_game 3
/buffer_autoset add core.sliding_game key_bind_meta-n,4 /sliding_game 4
/buffer_autoset add core.sliding_game key_bind_meta-n,5 /sliding_game 5
/buffer_autoset add core.sliding_game key_bind_meta-n,6 /sliding_game 6
/buffer_autoset add core.sliding_game key_bind_meta-n,7 /sliding_game 7
/buffer_autoset add core.sliding_game key_bind_meta-n,8 /sliding_game 8
/buffer_autoset add core.sliding_game key_bind_meta-n,9 /sliding_game 9
/buffer_autoset add core.sliding_game key_bind_up /sliding_game_keyboard up
/buffer_autoset add core.sliding_game key_bind_down /sliding_game_keyboard down
/buffer_autoset add core.sliding_game key_bind_right /sliding_game_keyboard right
/buffer_autoset add core.sliding_game key_bind_left /sliding_game_keyboard left
/key bindctxt mouse @chat(core.sliding_game):button1 hsignal:sliding_game
/trigger addreplace sliding_game command "sliding_game;sliding game by r3m;<number>;number: create a grid of number*number${\n}${\n}This is a sliding game (or also named the fifteen) for WeeChat. You need to reorder the number. You can create a 3x3, 4x4, 5x5, 6x6, 7x7, 8x8 and 9x9 grid. In fact you can play with a larger grid by modifying the conditions of the trigger but it is not recommended, it will be very slow.${\n}${\n}Play a 3x3 grid:${\n}${\n} /${tg_trigger_name} 3;3"
/trigger set sliding_game conditions "${info:python_version} != && ${tg_argv_eol1} =~ ^[3-9]?$"
/trigger set sliding_game regex "/.*/${if:${tg_argv1}==?3:${tg_argv1}}/my_nb /.*/${info:python_eval,import random; number = list(map(str, range(0,${calc:${my_nb}*${my_nb}}))); random.shuffle(number); print(','.join(number))}/my_random_numbers /.*/${my_random_numbers}/my_inversions /[^,]+/${if:${re:0}==0?0:${info:sliding_game_how_many_inversion,${split:${re:repl_index},,keep_eol,${my_inversions}}}}/my_inversions /,/+/my_inversions /.*/${calc:${my_inversions}}/my_inversions /.*/${my_random_numbers}/my_space_line ===[^,]+===${if:${re:0}==0?${calc:(${re:repl_index}-1)//${my_nb}}}===my_space_line /,//my_space_line /.*/${if:${my_nb}=~[02468]$?${calc:${re:0}+${my_space_line}}:${re:0}}/my_inversions /,/,,/my_random_numbers /^([^,]+),,([^,]+),(.*),([^,]+),,([^,]+)$/${if:${my_nb}=~[02468]$&&${my_inversions}=~[02468]$||${my_nb}=~[13579]$&&${my_inversions}=~[13579]$?${if:,${re:1},${re:2},!~,0,?${re:2},${re:1},${re:3},${re:4},${re:5}:${re:1},${re:2},${re:3},${re:5},${re:4}}:${re:0}}/my_random_numbers /,+/,/my_random_numbers /(^|,)0/${re:1} /my_random_numbers ===.*===/buffer clear sliding_game;/mute -core /unset -mask plugins.var.sliding_game.*;/mute -core /set plugins.var.sliding_game.random_numbers \x22${my_random_numbers}\x22;/mute -core /set plugins.var.sliding_game.nb ${my_nb};/sliding_game_draw===my_cmds_to_run"
/trigger set sliding_game command "/command -buffer core.weechat * /eval -s ${my_cmds_to_run}"
/trigger addreplace sliding_game_draw command sliding_game_draw
/trigger set sliding_game_draw regex "/.*/${plugins.var.sliding_game.nb}/my_nb /.*/${plugins.var.sliding_game.moves}/my_moves /^$/0/my_moves /.*/${plugins.var.sliding_game.random_numbers}/my_random_numbers /.*/${my_random_numbers}/my_inversions /(^|,) ($|,)//my_inversions /[^,]+/${info:sliding_game_how_many_inversion,${split:${re:repl_index},,keep_eol,${my_inversions}}}/my_inversions /,/+/my_inversions /.*/${calc:${my_inversions}}/my_inversions /.*/${if:${my_inversions}==&&${my_random_numbers}=~[ ]$?1:0}/my_win /.*/${repeat:${calc:${my_nb}*${my_nb}},,}/my_cmds_to_run ===,===${define:my_cell_value,${split:${re:repl_index},,,${my_random_numbers}}}${define:my_cell_line_number,${calc:(${re:repl_index}-1)//${my_nb}+1}}${define:my_cell_width,9}${define:my_cell_modulo_nb_cols,${calc:${re:repl_index}%${my_nb}}}${define:my_cell_value_modulo_nb_cols,${calc:${my_cell_value}%${my_nb}}}${if:${my_cell_modulo_nb_cols}==1?${if:${my_cell_line_number}==1?┏${repeat:${calc:${my_nb}-1},━━━━━━━━━┳}━━━━━━━━━┓;}┃}${if:${my_win}!=&&${my_cell_value}=~[ ]?${color:*_121}YOU WON!${color:reset} :${if:${my_cell_value_modulo_nb_cols}==1?${color:*white}:${color:*31}}${my_cell_value}${color:reset}${repeat:${calc:${my_cell_width}-${length:${my_cell_value}}}, }}┃${if:${my_cell_modulo_nb_cols}==0?;${repeat:2,┃${repeat:${my_nb}, ┃};}${if:${my_cell_line_number}!=${my_nb}?┣${repeat:${calc:${my_nb}-1},━━━━━━━━━╋}━━━━━━━━━┫:┗${repeat:${calc:${my_nb}-1},━━━━━━━━━┻}━━━━━━━━━┛;${color:31}Moves: ${color:reset}${my_moves}};}===my_cmds_to_run ===[^;]+===/print -newbuffer sliding_game -free -y ${calc:${re:repl_index}-1} ${re:0}===my_cmds_to_run ===$===${if:${my_win}!=?/mute -core /set plugins.var.sliding_game.win 1}===my_cmds_to_run"
/trigger set sliding_game_draw command "/command -buffer core.weechat * /eval -s ${my_cmds_to_run}"
/trigger addreplace sliding_game_how_many_inversion info sliding_game_how_many_inversion
/trigger set sliding_game_how_many_inversion regex "/.*/${tg_arguments}/my_number /,0//my_number /.*/${my_number}/my_remaining /^([^,]+).*/${re:1}/my_number /^[^,]+(.*)/${re:1}/my_remaining /[^,]+/${if:${my_number}>${re:0}?.}/my_remaining /,//my_remaining /.*/${length:${my_remaining}}/tg_info"
/trigger addreplace sliding_game_mouse hsignal sliding_game
/trigger set sliding_game_mouse conditions "${define:my_nb_lines_and_cols,${plugins.var.sliding_game.nb}}${plugins.var.sliding_game.win} == && ${_chat_line_x} < ${calc:${my_nb_lines_and_cols}*9+${my_nb_lines_and_cols}} && ${_chat_line_x} !~ 0$ && ${_chat_line_y} > 0 && ${_chat_line_y} < ${calc:${my_nb_lines_and_cols}*3+${my_nb_lines_and_cols}} && ${calc:${_chat_line_y}%4} != 0"
/trigger set sliding_game_mouse regex "/.*/${plugins.var.sliding_game.nb}/my_nb ===.*===${calc:${_chat_line_y}//4+1}===my_cell_line ===.*===${calc:${_chat_line_x}//10+1}===my_cell_col ===.*===${calc:(${my_cell_line} - 1)*${my_nb}+${my_cell_col}}===my_cell_index /.*/${plugins.var.sliding_game.random_numbers}/my_random_numbers /.*/${split:${my_cell_index},,,${my_random_numbers}}/my_cell_value /.*/${info:sliding_game_look_around,${my_nb},${my_cell_line},${my_cell_col},${my_cell_index},space,${my_random_numbers}}/my_space_relative_position / /${if:${my_space_relative_position}!=?-: }/my_random_numbers /[^,]+/${if:${re:0}==${my_cell_value}&&${my_space_relative_position}!=? :${re:0}}/my_random_numbers /-/${my_cell_value}/my_random_numbers ===$===/mute -core /set plugins.var.sliding_game.random_numbers \x22${my_random_numbers}\x22${if:${my_space_relative_position}!=?;/mute -core /set plugins.var.sliding_game.moves ${calc:${plugins.var.sliding_game.moves}+1};/sliding_game_draw}===my_cmds_to_run"
/trigger set sliding_game_mouse command "/command -buffer core.weechat * /eval -s ${my_cmds_to_run}"
/trigger addreplace sliding_game_keyboard command sliding_game_keyboard
/trigger set sliding_game_keyboard conditions "${plugins.var.sliding_game.win} == && ${buffer.full_name} == core.sliding_game && ${tg_argv_eol1} =~ ^(up|down|left|right)$"
/trigger set sliding_game_keyboard regex "/.*/${tg_argv1}/my_key /.*/${plugins.var.sliding_game.nb}/my_nb /.*/${plugins.var.sliding_game.random_numbers}/my_random_numbers /.*/${my_random_numbers}/my_space_cell_index /[^,]+/${if:${re:0}=~[ ]?${re:repl_index}}/my_space_cell_index /,//my_space_cell_index ===.*===${calc:(${my_space_cell_index}-1)//${my_nb}+1}===my_space_cell_line /.*/${calc:${my_space_cell_index}%${my_nb}}/my_space_cell_col /.*/${if:${my_key}==up?below:${if:${my_key}==down?above:${if:${my_key}==left?right:left}}}/my_direction /.*/${info:sliding_game_look_${my_direction},${my_nb},${my_space_cell_line},${my_space_cell_col},${my_space_cell_index},number,${my_random_numbers}}/my_number_cell_value / /${if:${my_number_cell_value}!=?-: }/my_random_numbers /[^,]+/${if:${re:0}==${my_number_cell_value}&&${my_number_cell_value}!=? :${re:0}}/my_random_numbers /-/${my_number_cell_value}/my_random_numbers ===$===/mute -core /set plugins.var.sliding_game.random_numbers \x22${my_random_numbers}\x22${if:${my_number_cell_value}!=?;/mute -core /set plugins.var.sliding_game.moves ${calc:${plugins.var.sliding_game.moves}+1};/sliding_game_draw}===my_cmds_to_run"
/trigger set sliding_game_keyboard command "/command -buffer core.weechat * /eval -s ${my_cmds_to_run}"
/trigger addreplace sliding_game_number_input signal buffer_user_input_sliding_game
/trigger set sliding_game_number_input conditions "${plugins.var.sliding_game.win} == && ${tg_signal_data} =~ ^[1-9][0-9]*$ && ${tg_signal_data} < ${calc:${plugins.var.sliding_game.nb}*${plugins.var.sliding_game.nb}}"
/trigger set sliding_game_number_input regex "/.*/${tg_signal_data}/my_input /.*/${plugins.var.sliding_game.nb}/my_nb /.*/${plugins.var.sliding_game.random_numbers}/my_random_numbers /.*/${my_random_numbers}/my_number_cell_index /[^,]+/${if:${re:0}=~^${my_input}$?${re:repl_index}}/my_number_cell_index /,//my_number_cell_index ===.*===${calc:(${my_number_cell_index}-1)//${my_nb}+1}===my_number_cell_line /.*/${calc:${my_number_cell_index}%${my_nb}}/my_number_cell_col /.*/${info:sliding_game_look_around,${my_nb},${my_number_cell_line},${my_number_cell_col},${my_number_cell_index},space,${my_random_numbers}}/my_space_relative_position / /${if:${my_space_relative_position}!=?-: }/my_random_numbers /[^,]+/${if:${re:0}==${my_input}&&${my_space_relative_position}!=? :${re:0}}/my_random_numbers /-/${my_input}/my_random_numbers ===$===/mute -core /set plugins.var.sliding_game.random_numbers \x22${my_random_numbers}\x22${if:${my_space_relative_position}!=?;/mute -core /set plugins.var.sliding_game.moves ${calc:${plugins.var.sliding_game.moves}+1};/sliding_game_draw}===my_cmds_to_run"
/trigger set sliding_game_number_input command "/command -buffer core.weechat * /eval -s ${my_cmds_to_run}"
/trigger addreplace sliding_game_look_around info sliding_game_look_around;sliding_game_look_above;sliding_game_look_below;sliding_game_look_left;sliding_game_look_right
/trigger set sliding_game_look_around regex "/.*/${split:1,,,${tg_arguments}}/my_nb /.*/${split:2,,,${tg_arguments}}/my_cell_line /.*/${split:3,,,${tg_arguments}}/my_cell_col /.*/${split:4,,,${tg_arguments}}/my_cell_index /.*/${if:${split:5,,,${tg_arguments}}==space?[ ]:.}/my_search_for /.*/${split:6,,keep_eol,${tg_arguments}}/my_random_numbers /.*/${if:${my_cell_line}>1?${split:${calc:${my_cell_index}-${my_nb}},,,${my_random_numbers}}}/my_above_cell_value /.*/${split:${calc:${my_cell_index}+${my_nb}},,,${my_random_numbers}}/my_below_cell_value /.*/${if:${calc:${my_cell_col}%${my_nb}}!=1?${split:${calc:${my_cell_index}-1},,,${my_random_numbers}}}/my_left_cell_value /.*/${if:${calc:${my_cell_col}%${my_nb}}!=0?${split:${calc:${my_cell_index}+1},,,${my_random_numbers}}}/my_right_cell_value /.*/${if:${tg_info_name}!~around?${my_${split:-1,_,,${tg_info_name}}_cell_value}:${if:${my_above_cell_value}=~${my_search_for}?above:${if:${my_below_cell_value}=~${my_search_for}?below:${if:${my_left_cell_value}=~${my_search_for}?left:${if:${my_right_cell_value}=~${my_search_for}?right}}}}}/tg_info"
This game is not a full-blown sliding game. It only contains the core functionality. It doesn't track the time you took to complete the game. I made this game for two reasons. The first reason is because it was fun and educative, the second reason is to serve as a POC (proof of concept) of what can be accomplished using triggers.
you can play grid of 3x3, 4x4, 5x5, 6x6, 7x7, 8x8 and 9x9. in fact it is possible to play with much larger grid but it will be slow. It is possible but very unlikely that you start with an already won game, in this case, just press the shortcut again to start a new game. Since it's very unlikely I prefer to keep the code smaller, faster and especially less complicated.
There is three way to play.
- Using the mouse (Click on the number you want to move)
- Using the arrows (up to move the number below the empty cell in the cell, and so on)
- Using the input (enter the number you want to move then press enter)
/set weechat.look.highlight *pascalpoitras*
/key bindctxt cursor @item(buffer_nicklist):v /window ${_window_number};/voice ${nick}
/key bindctxt cursor @item(buffer_nicklist):o /window ${_window_number};/op ${nick}
/key bindctxt cursor @item(buffer_nicklist):V /window ${_window_number};/devoice ${nick}
/key bindctxt cursor @item(buffer_nicklist):O /window ${_window_number};/deop ${nick}
/key bindctxt cursor @chat:s /window ${_window_number};/slap ${_chat_line_nick};/cursor stop
/key bindctxt cursor @item(buffer_nicklist):s /window ${_window_number};/slap ${nick};/cursor stop
/key bindctxt cursor @chat:a /command -buffer ${buffer.full_name} core /input insert ${_chat_bol}\x20;/cursor stop
/key bindctxt cursor @chat:e /command -buffer ${buffer.full_name} core /input insert ${_chat_eol}\x20;/cursor stop
/key bindctxt cursor @chat:w /command -buffer ${buffer.full_name} core /input insert ${_chat_word}\x20;/cursor stop
/key bind up /input history_global_previous
/key bind down /input history_global_next
/alias add ame allchan -current /me
/alias add amsg allchan -current /msg *
/alias add cq /allpv /buffer close
/alias add znc /quote znc
/alias add irc_stats /set plugins.var.total_irc_servers 0;/set plugins.var.total_irc_channels 0;/set plugins.var.total_irc_privates 0;/allserv /eval /set plugins.var.total_irc_servers ${calc:${plugins.var.total_irc_servers}+1};/allchan /eval /set plugins.var.total_irc_channels ${calc:${plugins.var.total_irc_channels}+1};/allpv /eval /set plugins.var.total_irc_privates ${calc:${plugins.var.total_irc_privates}+1};/eval I am currently on ${plugins.var.total_irc_servers} server${if:${plugins.var.total_irc_servers}>1?s}, ${plugins.var.total_irc_channels} channel${if:${plugins.var.total_irc_channels}>1?s} and I have ${plugins.var.total_irc_privates} quer${if:${plugins.var.total_irc_privates}>1?ies:y}.;/unset -mask plugins.var.total_irc_*
/alias addcompletion -m close /eval ${if:-m==$*?/allpv }/buffer close
/alias addcompletion %(irc_channel)|%(nick)|%* slap /me slaps $* around a bit with a large trout
/alias addcompletion %(irc_channel)|%(nick)|%* fu /say (╹◡╹)凸 $*
/alias addcompletion %(weechat_commands) multicomm /alias add temp $*;/temp
/alias add trigger_toggle /fset c:${name} =* trigger.trigger.$1-*.enabled;/command -buffer fset.fset * /input send m:*;/fset -toggle
The multicomm alias is an alternative to /eval -s, but more "secure". If you use eval -s for this purpose (execute more than one command) but you forget that thing like secure variables will be evaluate this can be very bad.
/set irc.look.smart_filter on
/filter add irc_smart * irc_smart_filter *
/set weechat.color.chat_prefix_join 121
/set weechat.color.chat_host 31
/set irc.color.message_join 121
The weechat.color.chat_host option will also set this color for part and quit. To have a different color, for example, a host in red for parts and quits and green for joins, see this.
/set weechat.color.chat_prefix_quit 131
/set irc.color.message_quit 131
/set exec.command.shell bash
/set irc.server_default.away_check 5
/set irc.server_default.away_check_max_nicks 25
/set irc.color.nick_prefixes "q:lightred;a:lightcyan;o:121;h:lightmagenta;v:229;*:lightblue"
/set irc.network.ban_mask_default "*!*@$host"
/set irc.look.buffer_switch_autojoin off
/set irc.look.buffer_switch_join off
/set irc.look.color_nicks_in_nicklist on
/set irc.look.part_closes_buffer on
/set irc.color.mirc_remap "1,-1:16;14,-1:240"
/set weechat.look.bar_more_down ""
/set weechat.look.bar_more_up ""
/set weechat.look.bar_more_left "…"
/set weechat.look.bar_more_right "…"
/set weechat.look.buffer_notify_default message
/set weechat.look.buffer_time_format "${color:245}%H${color:253}%M"
/set weechat.look.color_inactive_message off
/set weechat.look.color_inactive_prefix off
/set weechat.look.color_inactive_prefix_buffer off
/set weechat.look.color_inactive_window off
/set weechat.look.day_change_message_1date "▬▬▶ ${if:${info:holiday,%d-%m}?${info:holiday,%d-%m}:%a, %d %b %Y} ◀▬▬"
/set weechat.look.day_change_message_2dates "▬▬▶ ${if:${info:holiday,%%d-%%m}?${info:holiday,%%d-%%m}:%%a, %%d %%b %%Y} (%a, %d %b %Y) ◀▬▬"
/set weechat.look.hotlist_add_conditions "${away} || ${buffer.num_displayed} == 0"
/set weechat.look.item_buffer_filter "•"
/set weechat.look.prefix_align_min 0
/set weechat.look.prefix_align_max 10
/set weechat.look.prefix_join "▬▬▶"
/set weechat.look.prefix_quit "◀▬▬"
/set weechat.look.prefix_suffix "│"
/set weechat.look.read_marker_string "─"
/set weechat.look.separator_horizontal ""
/set weechat.color.bar_more 229
/set weechat.color.chat_highlight lightred
/set weechat.color.chat_highlight_bg default
/set weechat.color.chat_nick_colors "cyan,magenta,green,brown,lightblue,lightcyan,lightmagenta,lightgreen,blue"
/set weechat.color.chat_prefix_more 31
/set weechat.color.chat_prefix_suffix 31
/set weechat.color.chat_read_marker 31
/set weechat.color.chat_time 239
/set weechat.color.chat_delimiters 31
/set weechat.color.separator 31
/set weechat.color.status_data_highlight 163
/set weechat.color.status_data_msg 229
/set weechat.color.status_data_private 121
/set weechat.color.status_more 229
/set weechat.color.status_name 121
/set weechat.color.status_name_tls 121
/set weechat.color.status_time white
/set weechat.color.status_nicklist_count white
/set weechat.color.status_number white
/set weechat.history.max_buffer_lines_number 1024
/save