WeeChat – auto aspell dict

Here is my new trigger that will set the aspell dictionnary to french whenever you join a channel ending in “-fr”, spanish for -es and italian for -it. First, I set the default dictionnary to english:

/set aspell.check.default_dict en

then, the trigger:

/trigger add setdict signal *,irc_in2_join "${nick} == ${info:irc_nick,${server}} && ${channel} =~ \-(fr|it|es)$" "/.*-(fr|it|es)$/${re:1}/" "/set aspell.dict.irc.${server}.${channel} ${tg_signal_data}"

Now join a channel ending in -fr and it should set the dict to french. If you want to better understand this trigger, here is how it works:

catch the signal join and verify if its you and if the channel end with -fr,-it or -es, then we replace the variable ${tg_signal_data} with the language. Finally, we set a new option for this channel.


zsh debian look

2016-08-31-000906_884x424_scrotIf you want to reproduce this, you will need the zsh shell and the sceenfetch program.

sudo apt-get install zsh screenfetch

then you need to add the following line at the top of ~/.zshrc

# Set up the prompt

autoload -Uz promptinit

# prompt fire (fire, main bg, fire, main fg, date color, second prompt)

prompt fire white 197 white 233 white 197

and at the end of the same file, put this

screenfetch -c 197,

yes it ends with a comma!

WeeChat – grep.py for log files

grep.py is probably one of the most useful script I have ever used. It allows you to search for a pattern in buffers and log files. To grep in a buffer, I prefer to use CTRL+R, but for logs, nothing is comparable to grep.py. In one command, you can see all URLs a certain nickname mentioned before, any time you where highlighted from anyone or someone in particular and so on.

Here I will show you some useful examples and then I will create an alias to a useful grep command. Finally, I will bind a key to use in the chat area and the nicklist.

I do not log via WeeChat but via ZNC. The format of the log and where they are stored is different. You will need to adjust it for you.

My logs goes there:

~/.znc/users/<account name>/moddata/log/<years in format aaaa>/<IRC network>/

There is a log file for each days:


correspond to June 22. If you want the same directory structure than me:

/msg *status loadmod --type=user log %Y/$NETWORK/$WINDOW.%m-%d.log

When you install grep.py, it will automatically find all these logs. Let’s get started:

/script install grep.py

this will obviously install grep.py. Here is some useful examples:

/grep log *.znc/users/r3m/moddata/log/*/freenode/#weechat.* -a ^\[\d{2}:\d{2}:\d{2}\] <%{escape [dude]}>
/grep log *.znc/users/r3m/moddata/log/*/freenode/#weechat.* -a ^\[\d{2}:\d{2}:\d{2}\] <%{escape [dude]}> .*%{url}
/grep log *.znc/users/r3m/moddata/log/*/freenode/#weechat.* -a ^\[\d{2}:\d{2}:\d{2}\] <%{escape [dude]}> .*%{url youtube.com}
/grep log *.znc/users/r3m/moddata/log/*/freenode/#weechat.* -a ^\[\d{2}:\d{2}:\d{2}\] <%{escape [dude]}> r3m

The first will match any line from nickname [dude]. Here I used %{escape } to escape meta character (append a \ before each of them). Otherwise you will probably get unpredictable results. The rest will match respectively any line containing an URL, a youtube link or an highlight (r3m is my nickname).

Next, I created an alias that will erase anything in the input bar and insert:

/grep log */#activechannel.* -a ^\[\d{2}:\d{2}:\d{2}\] <%{escape anickname}>

Then, you press enter to search for any lines from anickname or you append something to it and then press enter.

Here is the alias:

/alias add customgrep /input delete_line;/input insert /grep log *.znc/users/r3m/moddata/log/*/$server/$channel.* -a ^\[\d{2}:\d{2}:\d{2}\] <%{escape $1}>\x20

So, if I go to #weechat buffer and type:

/customgrep FlashCode

and press enter, the input line will become:

/grep log *.znc/users/r3m/moddata/log/*/freenode/#weechat.* -a ^\[\d{2}:\d{2}:\d{2}\] <%{escape FlashCode}>

then press enter again to see every lines from FlashCode.

Now, bind a key, here the ‘g’ key in cursor mode:

/key bindctxt cursor @chat(*):g /window ${_window_number};/customgrep ${_chat_line_nick};/cursor stop
/key bindctxt cursor @item(buffer_nicklist):g /window ${_window_number};/customgrep ${_chat_line_nick};/cursor stop

Now, middle-click on a nickname and press ‘g’. So useful!

Please note that if the nickname contains a \ you will need to escape it two times. For example:

/grep log *.znc/users/r3m/moddata/log/*/freenode/#weechat.* -a ^\[\d{2}:\d{2}:\d{2}\] <%{escape [\\dude]}>

Here we use %{escape } to escape ‘[‘ and ‘]’ but it also escape \ so we must add a \ in front of \.