r/unixporn•
sshbio

[DWM/DVTM] ii + vim = IRC client

Screenshot
[DWM/DVTM] ii + vim = IRC client

Posted Mar 3, 2016, 9:51 AM UTC

3612
sshbioOP•

This is ii: how-to | FAQ

It is a FIFO based IRC client, that builds a file structure, read through pipes, and write to file to provide interaction with IRC servers.

It can be used with with ease:

Run ii with arguments: ii -s irc.freenode.net and it will create a ~/irc with a tree that is like a menu:

irc
|_ irc.freenode.net
|  |_ in
|  |_ out
|
|_ irc.iotek.org
   |_ in
   |_ out

Then open any out file with vim (not the in, this would make it crash).

This will show you the output from the server. To interact with it, open a new empty buffer (enew), and write the message you want in it, like /join #suckless, and instead of saving it, run this: :.w >> ~/irc/irc.freenode.net/in to write the current line to the channel.

This will create a new directory for this channel:

irc
|_ irc.freenode.net
|  |_ in
|  |_ out
|  |
|  |_ #suckless
|     |_ in
|     |_ out
|
|_ irc.iotek.org
   |_ in
      |_ out

And you got it: you can open the out file and write line per line messages with a similar command: :.w >> ~/irc/irc.freenode.net/\#suckless/in.

[EDIT] As u/Carpetsmoker said below, this does not work very well... Try its plugin for real live vim irc client!

To have the live conversation, you can set vim to autoread the ~/irc/irc.freenode.net/#suckless/out file.

You can have syntax highilght with this syntax highlight plugin, and use all of your vim plugins, keybindings, completion (nicknames)... to edit your messages.

You can use tabs, like one tab per channel, and to avoid repeating all of these, you can write a script to organise your space like you want. Or maybe pick these ones.

If you want aditionnal features without re-inventing the wheel, there are plenty of interfaces built for ii! Like hysteria or many others.

If you like this approach, maybe you will like ratox as well, which provides bindings for the tox protocol.

4
Carpetsmoker•

I posted this on the r/vim thread, but especially the first part is worth repeating as a great many people seem to not know this:

To have the live conversation, you can set vim to autoread the ~/irc/irc.freenode.net/#suckless/out file.

This doesn't work like you expect it to. The problem with this is that autoread doesn't work if you're not doing anything with Vim. The answer to that SO question is wrong. See this question and my answer to it, and my auto_autoread.vim plugin that I created.


I also started work on making the ii + vim experience a bit more streamlined with a little program called virc. Truth be told, I don't remember how well it works, since I haven't used it in a year, but IIRC it works reasonably well. The thing that I wanted to do before a real release was to properly implement private messages somehow (/msg YourNick Hello!), which aren't very obvious with ii (it just creates a new FIFO, which isn't at all obvious). I do plan to finish it some day ... So feedback is always welcome :-)

3
FedeMPArch•

You should xpost this in r/vim. They/we will love it.

2
sshbioOP•

Yes, I can't imagine why I have not done it already!

1
jordan__zzzUbuntu•

This here is the real porn...

3
sshbioOP•

Then ricing my vim also rices my IRC client.

1
WIldefyrcrux•

Too bad it doesn't interpret color codes!!!

2
sshbioOP•

Maybe it can!

The vim conceal mode seems to permit it: http://www.vim.org/scripts/script.php?script_id=302

Conceal mode could be used to make irssi/weechat-style themes: https://github.com/ehamberg/vim-cute-python/blob/master/README.markdown

1
x_ero~•

dig it.

god i <3 that /motd

still need to make it into a figlet / toilet font

2
4drift•

I second that!

And this is very interesting.

1
sshbioOP•

The color theme is badwolf, and the modeline is there.

1
TheRealLazloFalconiFreeBSD•

I had badwolf a while back and then it seemed to disappear off the face of the planet! Thanks for finding it again!

2