Skip to content

Instantly share code, notes, and snippets.

@researcx
Forked from pascalpoitras/config.md
Last active January 30, 2021 16:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save researcx/26558dfbfd9417157f20b7c236f28f05 to your computer and use it in GitHub Desktop.
Save researcx/26558dfbfd9417157f20b7c236f28f05 to your computer and use it in GitHub Desktop.
My always up-to-date WeeChat configuration (requires weechat 2.3-dev (weechat-devel) or higher)

idea and some snippets taken from pascalpoitras' weechat config

Enable mouse

/mouse enable

Set up encrypted data

/secure passphrase <pass>
/secure set relaypass <pass>
/secure set bitlbeepass <pass>
/secure set bncaddrport <addr/port>
/secure set bncpass <pass>

Servers

Default settings

/set irc.server_default.nicks kei,keira
/set irc.server_default.username k
/set irc.server_default.msg_part ""
/set irc.server_default.msg_quit ""
/set irc.server_default.ssl_verify off
/set irc.server_default.capabilities "account-notify,away-notify,cap-notify,multi-prefix,server-time"

Set up bitlbee

/server add IM 0.0.0.0/9997 -autoconnect
/set irc.server.IM.command "/msg &bitlbee identify;/oper kei ${sec.data.bitlbeepass};/away <my away message>"

Set up IRC servers

/server add RIZON ${sec.data.bncaddrport} -ssl -autoconnect
/set irc.server.RIZON.password kei/rizon:${sec.data.bncpass}

/server add FREENODE ${sec.data.bncaddrport} -ssl -autoconnect
/set irc.server.FREENODE.password kei/freenode:${sec.data.bncpass}

/connect -all

Plugins

Load at startup

/set weechat.plugin.autoload "*,!lua,!tcl,!fifo,!xfer,!guile,!javascript"

this will load all modules except lua, tcl, fifo, xfer, guile and javascript

Aspell

/set aspell.check.default_dict en
/set aspell.check.suggestions 3
/set aspell.color.suggestion *green
/aspell enable

Relay

$ mkdir -p ~/.weechat/ssl
$ cd ~/.weechat/ssl
$ export IP=192.168.1.x
$ openssl req -x509 -nodes -newkey rsa:2048 -keyout relay.pem \
    -subj "/O=weechat/CN=my-weechat" \
    -config <(cat /etc/ssl/openssl.cnf <(printf "\n[v3_ca]\nsubjectAltName = @alternate_names\n[alternate_names]\nIP.1 = \${ENV::IP}")) \
    -days 365 -out relay.pem
/relay sslcertkey
/relay add ssl.weechat <port>
/set relay.network.password ${sec.data.relaypass}

Logging

/set logger.level.core.weechat 0
/set logger.level.irc 0
/set logger.level.irc.freenode.##news 1

Alternatively, disable logging

/set weechat.plugin.autoload "*,!lua,!tcl,!fifo,!xfer,!guile,!javascript,!logger"
/plugin unload logger

Scripts

/script install nickregain.pl allquery.py buffer_autoset.py bufsave.py colorize_nicks.py grep.py prism.py terminal_title.py go.py

terminal_title.py (for tmux)

/set plugins.var.python.terminal-title.title "WeeChat %version"

nickregain.pl

/set plugins.var.perl.nickregain.RIZON_enabled on
/set plugins.var.perl.nickregain.FREENODE_enabled on

file_download.py (private script (for now), ignore this)

/set plugins.var.python.file_download.global on
/set plugins.var.python.file_download.download_limit 10485760

News (from pascalpoitras, w/ custom edits)

news

/filter add news irc.FREENODE.##news !nick_newsly*+!host_yano@unaffiliated/yano/bot/rssly,!irc_privmsg *
/filter add news_interest irc.FREENODE.##news nick_newsly*+irc_privmsg,host_yano@unaffiliated/yano/bot/rssly+irc_privmsg !^(\s|\[)(Reddit [-] /r/netsec|Wired|EFF Updates|techdirt|TorrentFreak|Science Daily|Hacker News|phoronix|Google News - UK|Google News - Science|Google News - Health|Google News - World|Twitter - @BBCBreaking|BBC|The Guardian|Ars Technica|The Intercept|Canoe [-] Weird News)( \-| | |\])

##news is a channel on Freenode with a bot named newsly that display news from various sources. The first /filter command hides everything that happens on the channel except PRIVMSG from newsly. The second /filter hides every news except those from the given list.

Full list of news sources is available here. To add to the list, modify the second filter, separate them using "|".

The following trigger uses the new hook_line. You must be using 2.3-dev (weechat-devel) or higher.

/trigger add news_line line "*;irc.FREENODE.##news;irc_privmsg+nick_newsly*" "" "/.*/${tg_message_nocolor}/site_name /^\[([^]]+)\].*/${re:1}/site_name /.*/${tg_message_nocolor}/title /^[^]]+\]//title /.*/${site_name}/site_color /^([^-]+).*/${info:nick_color_name,${re:1}}/site_color /.*/${title}/url ==.*(https?://[^ ]+).*==${re:1}==url /\+/%2B/url /,/%2C/url /\!/%21/url /\*/%2A/url /.*/${re:0},url_${url}/tags ==https?://[^ ]+ .*====title /.*/[${color:${site_color}}${site_name}${color:reset}] ${title}/message/url /.*//prefix" "" "" "none"

hides the nick "newsly" and formats the news to look nicer, this version keeps the URLs and the timestamps (non-powerline version)

/set weechat.bar.nicklist.conditions "${nicklist} && ${buffer.full_name} != irc.FREENODE.##news"

disables nicklist in the ##news channel.

Highlight Monitor (from pascalpoitras)

/eval /set weechat.startup.command_after_plugins "${weechat.startup.command_after_plugins};/buffer add highmon"

/buffer_autoset add core.highmon title Highlight Monitor

/trigger add highmon_like print ""
/trigger set highmon_like conditions "${tg_highlight} == 1 && ${tg_displayed} == 1 && ${buffer.local_variables.type} == channel && ${tg_tags} =~ ,irc_privmsg,"
/trigger set highmon_like command "/print -newbuffer highmon -tags ${tg_tags} ${color:${info:nick_color_name,${server}}}${cut:4,${color:${weechat.color.chat_prefix_more}}${weechat.look.prefix_align_more},${server}}${color:${info:nick_color_name,${channel}}}${channel}\t${if:${tg_tags} !~ ,irc_action,?${weechat.look.quote_nick_prefix}${tg_prefix}${color:reset}${weechat.look.quote_nick_suffix}:${tg_prefix}${color:reset}} ${tg_message}"

This trigger create a new buffer named highmon. This buffer will contain all the highlighted message from all the channels you are on. This is similar to the highmon.pl script but without any options.

Highlights

/set weechat.look.highlight kei
/buffer_autoset add weechat.notify.irc.FREENODE.##news highlight
/buffer_autoset add irc.FREENODE.##news highlight_words <news you want to be notified of, perhaps some local area names>
/buffer_autoset add irc.IM.&bitlbee highlight_words "New request"

Triggers

/trigger add upgrade_scripts signal day_changed
/trigger set upgrade_scripts command "/script update;/wait 10s /script upgrade"

The trigger upgrade_scripts will update the local script cache and then upgrade all the installed scripts at midnight. (from pascalpoitras)

Alias

/alias add shrug /msg $channel ¯\_(ツ)_/¯
/alias add lenny /msg $channel ( ͡° ͜ʖ ͡°)
/alias add slap /me slaps $1 around a bit with a large trout

Filters

/set irc.look.smart_filter on
/filter add irc_smart *,!irc.IM.* irc_smart_filter *

Miscellaneous

/set irc.server_default.away_check 0
/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.part_closes_buffer on

Keyboard Shortcuts

/key bind meta-meta2-A /window up
/key bind meta-meta2-B /window down
/key bind meta-meta2-C /buffer +1
/key bind meta-meta2-D /buffer -1
/key bind meta-g /go
/key bind meta-c /close
/key bind meta-h /buffer hide
/key bind meta-x /c
/key bind meta-4 /c -all

alt+up/down - move between horizontal split windows

alt+left/right - move between buffers

alt+c - close the active buffer

alt+h - hide the active buffer

alt+g - /go plugin

alt+c - close buffer

alt+x - clear buffer

alt+4 - clear all buffers

Security settings

Disable CTCP

/set irc.ctcp.action ""
/set irc.ctcp.clientinfo ""
/set irc.ctcp.finger ""
/set irc.ctcp.ping ""
/set irc.ctcp.source ""
/set irc.ctcp.time ""
/set irc.ctcp.userinfo ""
/set irc.ctcp.version ""

Appearance

Colors

/set logger.color.backlog_end darkgray
/set logger.color.backlog_line darkgray

/set weechat.color.separator red
/set weechat.bar.title.color_bg red
/set weechat.bar.title.color_fg black
/set weechat.bar.status.color_bg default

/set weechat.bar.fset.color_fg yellow
/set fset.color.title_count_options white
/set fset.color.title_current_option yellow
/set fset.color.line_selected_bg1 52

Active/Inactive Buffers

/set weechat.look.color_inactive_window off

Bars

/set weechat.bar.input.items "[input_search],[input_paste],input_text"
/set weechat.bar.status.items "[time],[input_prompt]+(away),[buffer_plugin],buffer_name+(buffer_modes),scroll,[lag],[aspell_suggest]"

Buffer List

/set irc.look.server_buffer independent

Note: show channels and privates buffers under their respective server instead of mixing them all.

/set buflist.format.buffer_current "${format_number}${indent}${format_nick_prefix}${color:253}${format_name}"
/set buflist.format.hotlist_highlight "${color:201}"
/set buflist.format.hotlist_message "${color:229}"
/set buflist.format.hotlist_private "${color:121}"
/set buflist.format.hotlist_low "${color:default}"
/set weechat.look.hotlist_add_conditions "${buffer.num_displayed} == 0 || ${buffer.active} == 0"
/set buflist.format.number "${color:darkgray}${number}${if:${number_displayed}?.: }"
/set buflist.look.sort "irc_server.disconnected,number"
/set weechat.bar.buflist.size 25
/set weechat.bar.buflist.size_max 25

Nicklist

/set irc.look.color_nicks_in_nicklist off
/set weechat.bar.nicklist.size 10
/set weechat.bar.nicklist.size_max 10

Highlights

/set weechat.color.chat_highlight yellow
/set weechat.color.chat_highlight_bg red

Miscellaneous

/set weechat.look.buffer_time_format [%Y-%m-%d %H:%M:%S]
/set weechat.look.read_marker_string "─"
/set weechat.look.prefix_suffix "│"
/set weechat.look.separator_horizontal ""
/set weechat.color.chat_nick_colors "229,226,224,222,219,211,209,195,192,185,176,172,159,155,145,142,141,139,135,109"

All done

/save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment