📜 ⬆️ ⬇️

Excellent console irc client "Weechat"

Quite a long time ago, I’ve been using a great console WecChat IRC client. It has a lot of advantages, for example for it you can write extensions in five (!) Languages: perl, ruby, python, lua, tcl). There is almost no Russian-language documentation on it, and on Habré there is not a single mention of it. That is why I decided to make copy-paste from my blog here, in habrahabr.



Not so long ago, after two years of development, and the adoption of about 1,000 patches and improvements, version 0.3 was released. Everyone was waiting for the jabber plugin to appear, and it appeared there, but extremely raw. By the way, weechat itself does not know how to work with networks (IRC / etc), he can only display information via ncurses (in GUI development on QT, GTK and Tcl). All its features are implemented by plugins (IRC, aspell, charset etc for all of this just below).
')
And so proceed:

Getting weechat


Weechat is now included in almost all common distributions. So you can install it from there. If it is not in them, or you want the latest version, you can download and compile from git:

git clone git://git.sv.gnu.org/weechat.git

Add and configure server



In order to connect to the irc network, you need to add it:

/server add dalnet irc.avtograd.ru/6667

Here I add server irc.avtograd.ru with connection to port 6667,
and give him the name dalnet.

Next, set your nicknames =)

/set irc.server.dalnet.nicks «1,2,3,4,5″

Now the username and your real name

/set irc.server.dalnet.username "_"
/set irc.server.dalnet.realname "_"

If you want to automatically connect to the network when you turn it on, we write:

/set irc.server.dalnet.autoconnect on

For autologin to channels:

/set irc.server.dalnet.autojoin "#channel1,#channel2"

If you need to execute any command after connecting to the server, for example, to identify the nickname NickServ, use the command: CE

/set irc.server.dalnet.command "/msg nickserv identify xxxxxx"

Save:

/save

After all this, write / connect dalnet or if you set the auto-connect at startup, then restart and enjoy! ;)

Encoding setting



Encoding is in my opinion the strength of this client. In it, it is easy to configure and not forced. With that very flexible.

If the server uses CP1251 (which is not an Orthodox server;)) then we write:

/charset CP1251

This will set the incoming and outgoing messages to one encoding - CP1251.
If different encodings are needed for incoming and outgoing messages, then the decode and encode parameters are used.

/charset decode UTF-8
/charset encode CP1251

And now the main thing: To set the encoding for a specific server, you must execute the / charset command in its buffer. Suppose to install a global encoding, you must run :.

/set charset.default.decode UTF-8
/set charset.default.encode UTF-8

Spellchecking



Perhaps no longer a single linux user can live without a spell checker :) In weechat, the aspell plugin is used to configure it and requires the aspell system installed.

You can view all dictionaries in the system with the command:

/aspell dictlist

The output of the command will be shown in the server's buffer.

To globally install Russian spell checker, you must set the corresponding parameter to the desired value:

/set aspell.check.default_dict "ru"

In order to set a specific dictionary in a certain buffer, it is necessary to set it in its buffer. Those. let's say that to set the #awesome English dictionary for the English-language channel, just go to its buffer and write:

/aspell enable en

By the way, you can always globally install several languages ​​for verification:

/set aspell.check.default_dict "ru, en"

Basic concepts



In weechat there are buffers and windows (buffers \ window). By default, when you connect to the server and log in to the channel, you will have one window, with one buffer, and a small vertical window with a list of all those present. In each buffer, no more than one chat. You can divide a window into two or more parts as you like. For example, to split a window in half vertically, write:

/window spitv 33

Each window can have its own independent buffer. To move between windows, use the F7 \ F8 keys.

To move between buffers, you can use the / buffer command and specify the buffer number. For example, the command / buffer 3 goes to the third buffer.

Plugins



As I wrote above, in weechat there is a very big opportunity for extensibility. You can write additions to it in five (!) Languages: python, ruby, lua, perl and tcl! Now there are not so many plug-ins as we would like, but they are quite enough. View all existing plugins on this page - weechat.org/plugins

In general, I would recommend downloading the add-on weeget.py With it, you can view and install add-ons right from the weechat itself. And so, download and install weeget. In the console, we write:

cd ~/.weechat/python/autoload
wget weechat.org/files/scripts/weeget.py

All the plugins weechat keeps in its folder in the home directory. Each language has its own folder. In order for weechat to load the necessary plug-ins at startup, you must also place it in the autoload folder, which we did. Each language has its own autoload folder. To load plugins recently added to autoload, you can enter the name of the language, followed by the autoload command. For example, perl, it might look like this:

/perl autoload

In order to load any plug-in, it is necessary, depending on the language in which it is made to be put in a directory, and to write something like the following construction:

/ load _.

For example for the plugin weeget.py

/python load weeget.py

You can also view all available using the list parameter or unload using unload

/python list
/python unload weeget.py

For the “installation” of plugins, I recommended weeget a little higher. To use it is extremely simple. Go to the "command" buffer and write the following:

/weeget list

A list of all the plug-ins that are on the site. If you want to sort by word, or tag, just add it. For example game:

/weeget list game

To install the plugin, you must use the install command:

/weeget install _

For example for the plugin weetris.pl:

/weeget install weetris

To remove, use the remove parameter:

/weeget remove weetris

For more information write:

/help weeget

By the way, the buffers plugin is extremely useful which displays on the left a list of all buffers with numbers.

Keyboard shortcuts and frequently used commands



Commands:
* / join # channel Login to channel
* / leave - leave - current channel
* / buffer close - close the current buffer
* / buffer clear - clear buffer
* / connect server_name - connect to a specific server
* / connect -all - connect to all servers
* / disconnect -all - disconnect from all servers
* / disconnect server_name - disconnect from a specific server
* / quit - exit

Keyboard shortcuts
* ctrl + a - To the beginning of the line
* ctrl + e - To the end of the line
* ctrl + k - Delete from the cursor position to the end of the command line
* ctrl + u - Remove from the cursor position, before the start of the command line
* ctrl + w - Delete the previous command line word
* alt + d - remove the next command line word
* alt + r - Delete all contents of the command line
* ctrl-r - Search
* ctrl + y - Paste from clipboard
* alt + b - To the previous command line word
* alf + f - To the next command line word
* alt + n - Scroll to the next highlighted message.
* alt + p - scroll in the previous highlighted message
* alt + u - Go to first unread post
* ctrl + n (F6) - Next buffer
* ctrl + p (F5) - Previous buffer
* F12 - one page down
* F11 - one page up nicks
* Alt + 1-9 - to buffer with number
* Alt + a - Go to the buffer with activity (where they wrote your nickname for example)
* PageUp - scroll up
* PageDown - scroll down

Conclusion:

In conclusion, I want to write that this is far from all the possibilities of weechat. I just described something that would not be bad to set up to configure and know before use. In addition, in weechat its English reference is extremely good, which is easy to call just by writing / help.

Finally a screenshot:

Image downloaded service ITmages

Useful links:

* Weechat documentation in multiple languages
* Page with plugins
* Weechat WiKi
* IRC: irc.freenode.net #weechat and # weechat-fr channels
* Mailing list
* Archive mailing
* Feedback from the authors - weechat-support@nongnu.org
* Original on my blog

I publish in my personal blog, because I did not find a suitable one, and I do not know whether a similar post is appropriate here. Suggestions for publishing to a specific blog are relevant, and I will be extremely happy with it =)

By the way, this post, I was asked to write my good friend renya. He has long been reading Habr, but he does not have an account here. If there are kind people with invite, share with him - renya-vad@yandex.ru =)

UPD: Transferred to * nix. I did not find a more suitable blog.

Source: https://habr.com/ru/post/71875/


All Articles