9

Coming from irssi, I'm used to being able to copy and paste messages from the message view of my terminal (PuTTY) running irssi with relative ease without having hard wraps on the text. This works when irssi is run directly, or when irssi is run in a screen session with the current window set to the size of the terminal (i.e. Ctrl-a, :fit).

How do I achieve something similar for weechat? With the default layout, on the right, weechat draws a border and lists the nicks in the channel. On the left, there's a border for the date/time and the message source (the nick, or the event type). Is it possible to temporarily hide all the chrome of the window and present something like what's kept in the logs?

2
  • Looks like weechat is not a tag here, and I don't have the reputation to make it. If someone has the reputation to do that, please tag it appropriately.
    – user314104
    Feb 8, 2014 at 23:47
  • I ended up doing /alias chatmode /bar show nicklist ; /set weechat.look.prefix_align right ; /set weechat.look.align_end_of_lines message and /alias copymode /bar hide nicklist ; /set weechat.look.prefix_align none ; /set weechat.look.align_end_of_lines time
    – user314104
    Feb 20, 2014 at 2:34

4 Answers 4

13

UPDATE: If you're following the bleeding-edge development versions, there's recently been added a much easier way to get a full-width message area for copying purposes, called the "bare display" mode!

It's bound to meta-l by default—do /key missing to set this keybinding if it's not already in your configuration—and it toggles off all of the WeeChat chrome, leaving just a log-style display of the current buffer's content.

If you don't have the development versions, the following solution using a bunch of settings still works, but I strongly recommend using bare display mode if you have it.


Well, you can fairly easily move the nicklist out of the way or hide it entirely. The commands for each are (respectively):

/set weechat.bar.nicklist.position top
  and
/bar toggle nicklist

If you need the nicklist out of the way regularly, a keybinding may be added, like so.

/key bind meta-f /bar toggle nicklist

The left-side formatting is a little less straightforward. It can be disabled by making the following settings; this will eliminate the border for wrapped lines (so you don't get extra border characters) and disable the alignment of message sources.

/set weechat.look.prefix_align none
/set weechat.look.align_end_of_lines time
  To re-enable, the defaults are:
/set weechat.look.prefix_align right
/set weechat.look.align_end_of_lines message

With all that done, you will likely still end up with hard wraps in your text! Setting the following option corrects this, but it is known for producing rendering bugs in WeeChat so it's not advisable to leave it on all the time:

/set weechat.look.eat_newline_glitch on

With all that set, copying from WeeChat directly should give you something pretty close to your log format.

4
  • I would upvote this again if I could. Thanks for posting with the update!
    – user314104
    Mar 1, 2014 at 5:30
  • I believe the key is meta-l or Alt-l, not !
    – Tri Nguyen
    Jan 5, 2017 at 22:59
  • 1
    @TriNguyen Ah, it was meta-! when I wrote this, but was later changed to meta-l because it's much easier to type.
    – 00dani
    Jan 5, 2017 at 23:06
  • Would be awesome if there was a way to move the time of messages to be on top of the nickname, would save 8 characters of column space. Mar 6, 2017 at 10:01
1

The correct way way to do this is to use Alt+l (a.k.a. Meta-l), which puts the terminal into "canonical mode". This is fundamentally different from the other answers that suggest ways to hide sidebars, because it makes text selections work correctly for wrapped text, which hiding sidebars does not do. This is particularly important when trying to copy long URLs posted in channel buffers.

Detailed Explanation

The exact behavior of a TTY with respect to things like line editing and display are handled by various flags that can be set using termios(3), or directly with ioctl(2). These control things like whether keyboard input should automatically be echoed to the screen, and whether special characters like Backspace or Home/End should be handled the usual way, or whether the terminal should pass them directly to the underlying application to handle them directly.

One of these flags is called ICANON, which controls whether or not the terminal is in canonical mode. The details are in the termios(3) man page (linked above). During normal operations WeeChat takes the terminal out of canonical mode so that it has full control over keyboard input and rendering on the screen. When it does this, the terminal emulator can no longer detect when text is being wrapped. If someone posts a long URL in WeeChat, when you try to select it with your cursor you'll find that the word selection will go to the end of the line and not automatically wrap around. Likewise, if you manually highlight the whole URL, your copy selection will have newlines in it.

By using Alt+l WeeChat will temporarily go back into canonical mode and re-render the screen as plain text. When this happens your terminal is able to distinguish wrapped text, and selections for long "words" such as URLs will work correctly. Once you're done copying text, you can use Alt+l a second time to go back into regular mode.

0

or simply do;

meta-l 

to show 'raw' format ala the logs, removes the nicklist and 'chrome' automagically - also helps with 'longer than width' links which, depending on your terminal emulator can now be clicked on and be a full link. this is on jessie version of weechat:- 1.0.1

0

You can bind a key to toggle nicklist and buffer list, freeing a majority of the screen real-estate, eg:

ctrl-F = "/bar toggle nicklist; /bar toggle buflist"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.