Not too long ago... ok, I guess about three and a half years ago now... WeeChat got one of its greatest features incorporated into the main code -- the buflist. Prior to this, it was in the form of a script.

With this change, buflist became more powerful and versatile as well.


For a while now I've had a fancy bit of logic in my buflist to show when a network is disconnected. When the topic of having away and part status in the buflist came up while chatting, I did some refactoring to add those as well:

/set buflist.format.buffer "${format_number}${indent}${format_nick_prefix}${color_hotlist}${if:(${buffer.full_name} =~ ^irc)?${if:(${irc_server.away_time} > 0)?${color:yellow}>}${if:(${irc_channel.part} == 1)?${color:magenta}_}${if:(${irc_server.is_connected} == 0)?${color:*magenta}*}}${if:${type}==private?↪}${name}"

## A Breakdown
/set buflist.format.buffer 
    ${format_number}                                ## buflist.format.number
    ${indent}                                       ## buflist.format.indent
    ${format_nick_prefix}                           ## buflist.format.nick_prefix
        ${if:(${buffer.full_name} =~ ^irc)?         ## Checks that buffer is from irc plugin
            ${if:(${irc_server.away_time} > 0)?     ## Checks if an away time is set
                ${color:yellow}>                    ## Adds color and indicator
            ${if:(${irc_channel.part} == 1)?        ## Checks part status
                ${color:magenta}_                   ## Adds color and indicator
            ${if:(${irc_server.is_connected} == 0)? ## Checks connect status
                ${color:*magenta}*                  ## Adds color and indicator
        ${if:${type}==private?                      ## Checks if privmsg
            ↪                                       ## Adds indicator
    ${name}                                         ## buflist.format.name

With this setting, an /away irc buffer gets colored yellow and marked with a >; a /part-ed chan gets colored magenta and marked with a _; and a disconnected irc buffer gets bold magenta and marked with a *. The order of the if test also means that away < parted < disconnected in regards to color.

weechat_buflist_formatting screenshot

Toning Down

As I use screen_away.py script, and as this buflist.format.buffer overrides hostlist msg colorings, I ended up using this minor tweak to only apply the away to the server buffers (which I have separated).

/set buflist.format.buffer "${format_number}${indent}${format_nick_prefix}${color_hotlist}${if:(${buffer.full_name} =~ ^irc)?${if:(${irc_server.away_time} > 0 && ${buffer.name} =~ ^server)?${color:yellow}>}${if:(${irc_channel.part} == 1)?${color:magenta}_}${if:(${irc_server.is_connected} == 0)?${color:*magenta}*}}${if:${type}==private?↪}${name}"

Other Settings

I'll go ahead and include my other relevant seeming settings for my buflist setup here as well.

## copypasta'ed out of /fset
buflist.format.buffer                   string   "${format_number}${indent}${format_nick_prefix}${color_hotlist}${if:(${buffer.full_name} =~ ^irc)?${if:(${irc_server.away_time} > 0)?${color:yellow}>}${if:(${irc_channel.part} == 1)?${color:magenta}_}${if:(${irc_server.is_connected} == 0)?${color:*magenta}*}}${if:${type}==private?↪}${name}"
buflist.format.buffer_current           string   "${color:red,17}${format_buffer}"
buflist.format.hotlist_highlight        string   "${color:red}"
buflist.format.hotlist_low              string   "${color:white}"
buflist.format.hotlist_message          string   "${color:blue}"
buflist.format.hotlist_none             string   "${color:247}${if:${type}==server?${color:240}}"
buflist.format.hotlist_private          string   "${color:red}"
buflist.format.indent                   string   "${color:240}${if:${buffer.next_buffer.local_variables.type}=~^(channel|private)$?├ :└─}"
buflist.format.number                   string   "${color:240}${number}${if:${number_displayed}?.: }"
buflist.look.nick_prefix                boolean  on
buflist.look.nick_prefix_empty          boolean  off

The buflist.format.indent is one of the more fancy options, as I like the extra readability. It should be noted that I have my server buffers split individual, and my buffers hierarchically sorted under each server. While I used to do this manually, I now use the autosort.py script with some fancy logic to deal with it for me (and disabled mouse buffer rearrangement to reduce hair pulling).

Also worth noting is that I disable the hotlist_low priority msgs from my hotlist/buflist, so I never see it... It mostly just covers content that I would smartfilter anyway.

long ago

- demure