Dark Side cat /dev/brain

Weechat + Tmux + Base16

This is a simple, Base16 friendly, Weechat setup.

What’s weechat?

Weechat ( homepage might be blocked in Mainland China ) is a modular, ncurses based Internet Relay Chat ( IRC ) client.

Scripts

  • Some must-have scripts
  /script install buffers.pl buffer_autoclose.py iset.pl go.py colorize_nicks.py
  • Some extra scripts
  /script install histsearch.py nickregain.pl shortenurl.py

Color Settings

Note: If you are NOT using Base16, blow right through it.

/color alias 196 lightred
/color alias 130 brown
/color alias 208 orange
/color alias 003 yellow
/color alias 113 green
/color alias 046 lightgreen
/color alias 045 aqua
/color alias 081 lightblue
/color alias 135 purple
/color alias 170 magenta
/color alias 201 lightmagenta
/color alias 039 cyan
/color alias 051 lightcyan
  • Make the title bar and the status bar using dark background colors.
/set weechat.bar.status.color_bg 10
/set weechat.bar.title.color_bg 10

IRC Settings

/set weechat.look.buffer_notify_default message
/set irc.look.smart_filter on
/filter add irc_smart * irc_smart_filter *
/filter add irc_join_names * irc_366,irc_332,irc_333,irc_329,irc_324 *
  • Replace the nickname for a message with a little arrow if the previous message in your buffer was from the same user.
/set weechat.look.prefix_same_nick "⤷"

FAQ

iTerm2 + tmux + weechat with broken layout

Check the settings below if you are using double width characters ( such as Chinese, Japanese,Koeran, etc. ), and you see your weechat with some strange characters when you switch between buffers.

"Preferences" > "Profiles" > "Text" > "Double-Width Characters" >
 "Treat ambiguous-width characters as double width"

This option should be unselected.

Non-ASCII characters shows as “???”

Check your weechat’s charset settings with “/charset” command ( in weechat ).

charset: terminal: US-ASCII, internal: UTF-8

Run the following shell command might fix this problem.

export LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8"

Rerun “/charset” command in weechat, you should see:

charset: terminal: UTF-8, internal: UTF-8

It seems that nl_langinfo(3) can’t recogize LC_CTYPE = “UTF-8” properly. But when I try it like this:

#include <langinfo.h>
#include <strings.h>
#include <stdio.h>
#include <locale.h>

int main(){
    setlocale (LC_ALL, "");
    char *weechat_local_charset;
    weechat_local_charset = strdup (nl_langinfo (CODESET));
    printf("%s\n", weechat_local_charset);
}
$ gcc foo.c -o foo
$ export LANG=en_US.UTF-8 LC_CTYPE="UTF-8"
$ ./foo
UTF-8
$

nl_langinfo(3) works correctly. Looks strange, can anyone tell me why?

comments powered by Disqus