sponsor Vim development Vim logo Vim Book Ad

VimIRC.vim : An IRC client script

 script karma  Rating 301/136, Downloaded by 18542  Comments, bugs, improvements  Vim wiki

created by
Madoka Machitani
script type
This is an IRC client which runs on Vim.  It has some of the features
IRC users might expect, such as multiple servers connectivity, DCC
SEND/CHAT features etc..  Read the plugin file for more feature info and
usage instructions.

For those who are unfamiliar with IRC in general, I recommend visiting
this site first: http://www.irchelp.org/

If you have any questions, problems, or suggestions etc., /query or
e-mail the maintainer.  Do not direct them to the channel #vim please.

  http://www.dd.iij4u.or.jp/~madokam/img/vimirc05.png (invoking web browser)

Here is a minimum set of knowledge required to start/exit the script:

To start it, type


Then you'll be prompted for some user info (nick, full name etc.).

Upon successfull connection, try some normal commands you're familiar
with ("j", "k", "<C-W>-"things and so on).  Typing "i" or "I" will let
you in to the IRC-command mode, where you can enter commands such as
"/join #vim" and messages.

To quit, just press "Q".

Another method of quitting: get out of the loop with "<C-C>", then type


If you change your mind and want to get online again, press "<Space>" on
any of the VimIRC windows.

Have fun!
install details
Just drop the file into your plugin directory.

  Vim 6.2 or later with perl interface enabled
  Perl 5.6 or later (5.8 or later if you want multibyte support)

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vimirc.vim 0.9.28 2005-04-15 6.0 Madoka Machitani This is an "I'm really sorry" fixes release:
* Contrary to what I've said previously, erroneous nickname still caused endless loop when loggin-on.
* When receiving chat messages or something, Vim would cause this error: "Usage: VIBUF::Append(vimbuf, lnum, @lines)".
vimirc.vim 0.9.27 2005-04-14 6.0 Madoka Machitani New maps and some fixes.
* Maps: "r" / "R".  They do just the opposite of "q" / "Q": reconnect to disconnected servers.
* When someone tried to contact (query) you but with different case, the message was totally discarded.
* When you tried to logon with erroneous nickname, it resulted in endless loop.
* Port number was not reused when reconnecting manually with command "/server" (i.e., without arg), failing to reconnect if it was other than the default 6667.
* Global commands (e.g. "/gquit") could not be executed on disconnected servers.
* Window resizing ("<C-L>") should perform a bit better now.
* Added tips for opening hidden buffers.
vimirc.vim 0.9.26 2005-04-12 6.0 Madoka Machitani Small fixes:
* When updating hidden buffers, "E19: Mark has invalid line number" could occur (quite rarely, I believe).
* NOTICE messages sent from the one you were chatting with could not be displayed in the chat buffer.
vimirc.vim 0.9.25 2005-04-09 6.0 Madoka Machitani * VimIRC now uses stacks for putting messages.  You'll notice the efficiency of it especially when updating channels-lists.
* Some multi-key commands ("<C-W>t", etc.) weren't handled properly.
* User mode couldn't be set after auto-reconnecting servers (after disconnect).
* You can now omit your nick or the current channel for the command "/MODE".  E.g.: Entering "/MODE +w" on a non-channel buffer will set the specified mode on you.
* Added abbrev: "/MO[DE]"
* The manner of beeping has become a bit modest.
vimirc.vim 0.9.24 2005-04-08 6.0 Madoka Machitani Some trivial fixes (I'm only listing a few):
* For some unknown reason (to me), cursor position could not be restored sometimes when re-opening hidden channels.  The issue itself might still remain for the time being.
* Nick and command windows could embarrassingly remain open after parting channels with "q" key, for some event-related reason.
vimirc.vim 0.9.23 2005-04-06 6.0 Madoka Machitani This contains rather big improvements:
* Messages can now be received even while offline (i.e., out of the main-loop).  Note that you have to move cursor around periodically for this functionality to be triggered.  The same applies to the next item.
* Timer-related functions (displaying the current time, auto-pinging to keep alive, etc.) will be executed while offline, too.
* Fix on normal mode commands: "@" commands ("@:" etc.) weren't implemented; two-key commands ("f", "t", etc.) could not accept count.
vimirc.vim 0.9.22 2005-04-04 6.0 Madoka Machitani Trivial fixes release:
* Window configuration could get corrupted if you received server messages when the server buffer was hidden and the channels-list was open.
* While typing count for a normal mode command, entering two consecutive zeros nullified the entire input.
* While offline, count for normal mode commands (i.e., maps) could not be handled.
* Really trivial, but "<C-W><C-P>" now opens the previous channel ABOVE the current window, which you would find more intuitive.
* When opening hidden channels, cursor was moved to the bottom, which was bad for grasping the flow of conversation.
* "/PART"ing channels with some particular multibyte characters could fail.
vimirc.vim 0.9.21 2005-04-02 6.0 Madoka Machitani * Commands "<C-N>" / "<C-P>" now accepts count: "3<C-N>" opens the third next channel or server as seen on the info-bar from the current one.
* Also, commands starting with "<C-W>" can now accept count before and/or after it.
* Nicks window could become empty for some unknown reason.  I still don't know why, but tried to fix it.
* Hitting "i" after key-prompt could result in insert mode on a non-command buffer.
vimirc.vim 0.9.20 2005-03-31 6.0 Madoka Machitani * Nick window could be embarrassingly left open, if you sent/received query message while on a buffer other than the chat buffer.
* Command "/ACTION" didn't work as described in the help message.  Let me replace the command with "/DES[CRIBE]".
* Added a small new command "/WHOA[MI]".  Might be useful when you forgot who you were after changing nicks several times.
* Changed abbrev: "/T[OPIC]" => "/TO[PIC]", "/MS[G]" => "/M[SG]"
* Added abbrev: "/T[IME]", "/WH[O]", "/WHOI[S]"
vimirc.vim 0.9.19 2005-03-31 6.0 Madoka Machitani * Many IRC commands are made abbreviatable, e.g.: "/server" can now be typed as "/s".  See Tip 8 for more.
* Could not obtain your host address (required when doing DCC sessions) upon logon, if you logged in with a nick containing some special characters.
* statusline message was inappropriate for chat buffers.
* Cursor scrolled to the bottom when you executed "/list", which was not what I intended.
* Made "/help" message not to disappear automatically.
vimirc.vim 0.9.18 2005-03-28 6.0 Madoka Machitani * If you logged in servers with nick longer than what they accept, VimIRC failed to recognize you as the user.
* It is now possible to open, internally or externally, IRC server-like strings by hitting "<CR>" / "<C-CR>" / "<S-CR>" on them.
* Channel-like strings in buffers other than channels-list are also made accessible with "<CR>" etc..
vimirc.vim 0.9.17 2005-03-25 6.0 Madoka Machitani Some fixes on normal-mode commands:
* If you hit special keys after "<C-W>" or number, you could get stuck.
* When keys like "jk" were typed fast, the second key could not be processed.
* If you (casually) kept pressing "<CR>" for a few seconds, the same URL was opened many many times.
vimirc.vim 0.9.16 2005-03-24 6.0 Madoka Machitani * "auto-join"ing could fail if you logged in multiple servers simultaneously.
* DCC-chat buffers were not treated as such.
* Subtle fixes/improvements have been done on buffer/window manipulation (closing command window quietly, etc.).
vimirc.vim 0.9.15 2005-03-22 6.0 Madoka Machitani Design change, and new commands:
* Abolished multi-window mode, which was the default mode, but wasn't very useful.  Therefore, "g:vimirc_winmode" has no meaning now.  (The original design was done because I couldn't think of any way to update hidden buffers.  The problem was solved long time ago.)
* Instead of the above, added a new command prefix "SPLIT".  Prepend it to commands such as "/JOIN", "/LIST", like this: "/split join #chan".  See Tip 6 & 7 for more.
* Added normal-mode commands: "<C-W><C-N>", "<C-W><C-P>".  They do the same thing as "<C-N>" and "<C-P>" (walking through channels), with windows split open.
vimirc.vim 0.9.14 2005-03-19 6.0 Madoka Machitani Small fixes release:
* Pressing <F1> caused an error.
* When closing channels etc., newly active one sometimes didn't get highlighted properly.
* Key prompts could not accept key after special keys such as "<S-CR>" were hit.
* (single-window mode) Hitting "<C-W><CR>" / "<C-CR>" / "<S-CR>" on channels list now opens the channel in a new window.
vimirc.vim 0.9.13 2005-03-16 6.0 Madoka Machitani This contains an important fix:
* Nicks including "_" or "|" were not considered to be nicks, which could lead to various troubles/misbehaviors.
* (single-window mode) Hitting "<C-W><CR>" on the info-bar opened the specified channel etc. in a new window, but with bad window configuration.
vimirc.vim 0.9.12 2005-03-14 6.0 Madoka Machitani * "/help" wasn't working.
* Added a timeout feature to the "hit any key" prompt.  Prompts with rotating cursor automatically disappear after a few seconds if you give no response to them.  (This might save you from getting disconnected from servers.)
* (GUI) When hiding Vim cursor, attributes such as underline still remained, which was annoying.
vimirc.vim 0.9.11 2005-03-11 6.0 Madoka Machitani * Added a small new feature to "autojoin".  If you wish to display list of channels upon logon, add the word "list" to g:vimirc_autojoin.  See the doc for detail.
* Special-key commands preceded by count ("10<BS>" etc.) could not be executed.
* Forgot to map "ZZ" and "ZQ" to VimIRC's quit function.
* Quit keys could direct the quit command to a wrong server.
vimirc.vim 0.9.10 2005-03-03 6.0 Madoka Machitani Important fixes for normal mode key-handling issues.
* Added a `shocmd' functionality for multi-key commands.  This might prevent that you get stuck in a pending mode without noticing it, being unable to get new messages.
* Added several normal commands I've forgotten to do (",", "''", etc.).
* Added new quit commands: "ZZ" and "ZQ".  (Equivalent to "q" and "Q" respectively.)
* Special keys ("<BS>" etc.) are now safely handled (I should have read ":h getchar()" much earlier).
vimirc.vim 0.9.9 2005-03-02 6.0 Madoka Machitani Sorry for updating so often.  As always, I've introduced a new problem to the previous release.
* (Main-loop issue) Pressing the same key for a long time (well, less than a dozen seconds) could make Vim to crash.
* (Ditto) Pressing "<F1>" opened Vim's help file, which was not what I expected.
* Made Vim's cursor invisible while you are online.  The Annoying blinks now totally disappear (GUI only).
vimirc.vim 0.9.8 2005-03-01 6.0 Madoka Machitani * Hitting keys such as "<C-CR>" while in VimIRC's main-loop caused endless recursion (E132).
* Re-sorted key-handling order slightly, to achieve faster movement of motion commands.  (I'm not sure I did well.)
* Added some error-handling, so as not to get thrown out of the loop for simple errors (e.g., pattern not found).
vimirc.vim 0.9.7 2005-02-28 6.0 Madoka Machitani Quick fix release.
* Hitting "q" on command buffers sometimes failed to quit VimIRC.
* "/WHOIS" command seems to have failed sometimes.
vimirc.vim 0.9.6 2005-02-27 6.0 Madoka Machitani * URLs starting with "www" couldn't be opened properly.
* Added maps "q" and "Q".  Pressing "Q" will quit VimIRC, whereas "q" will just close chat/channel, if the cursor is on one.
vimirc.vim 0.9.5 2005-02-26 6.0 Madoka Machitani This is a bug fix release, with some minor improvements:
* Undefined subroutine (&find_channel) was called.  This caused several misbehaviours including the one below.
* (single window) Highlights in the info-bar couldn't be cleared after bringing hidden channels (with new messages) to the foreground.
* (single window) Attempts to highlight the current channel/server in the info-bar, so that you can easily locate where you are in (see the 3rd screenshot).
vimirc.vim 0.9.4 2005-02-19 6.0 Madoka Machitani Fixes for the following items:
* Paste commands (p and P) have been disabled in command buffers by mistake.
* Single-window mode: channels-list didn't show up in the info-bar.
* DCC chat: Multibyte (Japanese) characters had not been decoded.
vimirc.vim 0.9.3 2005-02-17 6.0 Madoka Machitani This is a buf fix release, with a tiny new command:
* Command: "/UNSET option".  Clears the current setting of an option.
* In the previous release, maps for the key "<CR>" were made invalid on some types of buffers.
* Hitting "i" after hit-any-key prompt to (re)enter the command mode resulted in a strange, non-insert mode.
* Slightly changed the behavior of "i".  It now opens a new input line when typed on an already open command buffer (formerly it left the cursor on the same line, which wasn't very useful).
* Removed the command "/SEARCH", which was not meaningful and had been made available probably by accident.  The functionality itself is available as a normal mode search command (/ or ?).
vimirc.vim 0.9.2 2005-02-15 6.0 Madoka Machitani Minor fix, and an experimental new feature.
* Hitting <CR> near a URL-like string may open it with external web browser.  The relevant option is "vimirc_browser".  See the doc for detail.

This is not much tested.  Feel free to notify me of any errors/misbehaviours you encounter with this feature.
vimirc.vim 0.9.1 2005-02-14 6.0 Madoka Machitani Several minor fixes/improvements:
* (GUI) File selector dialog now pops up for DCC SEND.  Omit filename argument to use this feature, when executing from the command buffer (see "/dcc help" for syntax).
* Tries to fix the annoying window scrolling you might have suffered when opening command buffers.
vimirc.vim 0.9 2005-01-29 6.0 Madoka Machitani I've added authenticated logon feature (apparently most users won't need this, only for completeness).  You can specify password for servers in any of the following ways:
  1. (on Vim's command line) :VimIRC -p password
  2. (in VimIRC's command buffer) /server irc.server.com password
  3. (in .vimrc) let vimirc_pass = 'password' or 'password1@server1,...'
vimirc.vim 0.8.12 2005-01-24 6.0 Madoka Machitani * Due to the previous (0.8.11) change to argument handling, "/[G]AWAY" and "/[G]QUIT" commands have been made to treat arguments (comment) improperly, resulting in awaying impossibility etc..
* I've made channels lists to be cached by default.  The variable "vimirc_listexpire", defaulting to a week, defines the longevity of them.  See the doc in the source for detail.
* Added a window-size restoration functionality.  Hit <C-L> in normal mode when any window has got a bad width/height.
vimirc.vim 0.8.11 2005-01-20 6.0 Madoka Machitani * The previous (0.8.10) fix with the main-loop issue seems to have introduced another one: you would have no way re-entering the loop if you had been gotten out of it by Vim errors, which shouldn't normally happen though.
* As in Vim, key pressed after the 'Hit any key to continue' prompt will now be utilized as a normal mode command.
* Added a mechanism of argument expansion, which currently expands only '%', into the current channel.  See Tip 5 in the source for usage.
vimirc.vim 0.8.10 2005-01-19 6.0 Madoka Machitani In a recent update, I introduced a bug which could cause some difficulty in getting out of the main-loop (for writing messages etc.).  This has been fixed, I hope.
Also, sending multiple messages at a time is now made possible.  See Tip 3 in the source.
vimirc.vim 0.8.9 2005-01-17 6.0 Madoka Machitani Again, several tiny fixes/improvements:
* VimIRCQuit didn't actually quit when executed from inside VimIRC's main-loop.
* Operations (typing <CR>) on nicks window could have been directed to other servers erroneously.
* Repetitive normal mode commands (such as jjjjjjjjj) might now work slightly faster (unnoticeably perhaps).
* Chat windows now have nicks window.
* etc.
vimirc.vim 0.8.8 2005-01-10 6.0 Madoka Machitani Bug Fix: Horribly enough, sending "/ME" messages has been unable for quite some time (sorry!).
No new features and no big improvements this time (sorry again!).
vimirc.vim 0.8.7 2004-05-28 6.0 Madoka Machitani Trivial fixes with single window mode:
1. Channel-list buffers were not visited upon in the <C-P> / <C-N> walkthru.
2. Cursor stayed on the command window after you finished sending messages/commands, which wasn't useful.
vimirc.vim 0.8.6 2004-05-11 6.0 Madoka Machitani Only small fixes this time.
1. The command :VimIRCQuit was causing an error.
2. Warnings on the usage of shift() function were seen on some perl versions. (Thanks to alexander for notifying this, also for the above.)
3. Mode strings on channels were not handled properly (I didn't understand the syntax).
4. You could not enter channels with correct keys (/join #chan key) after you first failed in entering.
vimirc.vim 0.8.5 2004-04-25 6.0 Madoka Machitani Fix: VimIRC was eating too much (around 90% all the time) of CPU-time (shudder!).  Thanks to alexander for pointing this out.
New commands: [DE]OP and [DE]VOICE.  See /help if you don't know of these commands.
Change: g:vimirc_server and '-s' startup option can now have multiple server name, separated by commas.  Thanks again to alexander, by whom it was suggested.
vimirc.vim 0.8.4 2004-04-21 6.0 Madoka Machitani New commands: GQUIT and GAWAY.  Sends QUIT/AWAY commands to all the connected servers at once.

Bug fixes:
1. topics etc. for not joined channels were displayed in newly, undesirably created channel buffers.
2. Manual reconnection with "/server" (without arg) wasn't possible sometimes if multiple connections to servers had been opened.
vimirc.vim 0.8.3 2004-04-20 6.0 Madoka Machitani Bug fixes/Improvements:
1. Server-specific auto-join settings were not processed properly.
2. Characters other than alpha-numerics and underscore could not be used in command aliases.
3. Command "ALIAS" will now accept definitions with and without leading slashes: "/alias /j /join", "/alias j join".
vimirc.vim 0.8.2 2004-04-19 6.0 Madoka Machitani New commands: ALIAS/UNALIAS, with which you'll be able to define/undefine aliases of commands.  Example: /alias /j /join.  Definitions will be saved in a config file, and restored automatically on startup.
vimirc.vim 0.8.1 2004-04-18 6.0 Madoka Machitani Bug fixes:
1. Since its implementation, timer functionality hasn't been working as expected: the direction of comparison operator was wrong and timers have been executed instantly (silly!).
2. netsplit handling wasn't working as expected.
3. search() function caused an error with some special patterns such as "\z".
vimirc.vim 0.8 2004-04-17 6.0 Madoka Machitani A rather big change:
Single-window mode (g:vimirc_winmode == 'single') has become much useful.  Each channel/server will now take its own window, and updates for hidden buffers will be done in the background.  See the 2nd screenshot for an idea how it will work.

New commands:
1. SET: Use this command to set or show the values of internal options.  Usage: "/SET option value".  Omit arguments to see the list of settable options.
2. <C-N> / <C-P> (Normal mode): Cycle through channels/servers.  Useful in single-window mode.

A Fix: "/JOIN 0" was not working.
vimirc.vim 0.7.2 2004-04-09 6.0 Madoka Machitani Small change/improvement in logging:
1. Timestamps are added to separate each session.
2. Logs for channels/chats will now be taken safely (well, in most cases) if those windows have been closed abnormally, i.e. with commands other than "/(QUIT|PART|QUERY)".
vimirc.vim 0.7.1 2004-04-08 6.0 Madoka Machitani Added a logging feature.  Logs will be taken for each channel separately.  See "Options" section for how to enable this feature.

Some minor fixes/improvements have also been done.
vimirc.vim 0.7 2004-04-05 6.0 Madoka Machitani WARNING: You might encounter "Missing endfunction" error while sourcing this version (I haven't confirmed it myself), which should mean, VimIRC is unusable.  If you do see the error, you'll have to compile vim yourself with patches at least up to 6.2.412, or stick to the older version for some time untill 6.3 is out.

Added a significant internal working: timer.  New/improved features related to this include: auto-away.  See "Options" section for how to enable this feature.

Added a command: CTCP.  Usage: /CTCP nick COMMAND.

Bug fixes:
1. "/AWAY message" was sending "1" instead of "message".
2. When a CTCP message was encountered which VimIRC didn't know of, ERRMSG response was always sent back to the originator, even if it was directed to channels.
vimirc.vim 0.6.7 2004-04-01 6.0 Madoka Machitani Change: I rather improved the auto-join (channels on logon) feature to enable server-specific channel settings.  See "Options" section in the plugin for detail.

Bug fixes:
1. "/QUIT"ting caused an error when channels-list window was open.
2. Quit messages like "Client Quit" was regarded as netsplit (silly!)
vimirc.vim 0.6.6 2004-03-31 6.0 Madoka Machitani 0.6.5 (already removed) contained a serious bug: You cannot login to server!
Please replace it with this one if you downloaded it.  Sorry.

Here's a copy of the release note for that version:

A new feature: Auto-reconnect and rejoin.  This is not much tested.  Please let me know if you find any cases where VimIRC doesn't start reconnecting when it should.

1. On terminal vim without "Cursor" highlight group defined, VimIRC was unusable due to the "No such highlight" error.  Thanks to morbuz, who notified me of this and tested the fixed version.
2. :VimIRCQuit could cause an endless loop.
3. (Fixed in the previous ver.) Cooperation of vim and perl failed, if strings to be passed to vim contained double-quotes or backslashes.
vimirc.vim 0.6.4 2004-03-28 6.0 Madoka Machitani New features:
1. Auto-joining channels upon logon
2. Auto-idetification of nicks.
The settings are "vimirc_autojoin", "vimirc_nickpass" respectively.  See the source for details.

A change: the way nicks are displayed has been changed: newly entered, and actively speaking figures will now be displayed on top.  I did this partly for efficiency reason, among others.  If you prefer the older behavior though, wait for some time till I make it configurable.
vimirc.vim 0.6.3 2004-03-24 6.0 Madoka Machitani A fix: "/me message" wasn't sending proper ACTION.  Sorry.
A new feature: Direct conversation over IRC network (/query nick) will now be displayed in a separate window as with DCC Chat.
vimirc.vim 0.6.2 2004-03-23 6.0 Madoka Machitani Some fixes/improvements:
1. Added normal-mode commands: some characterwise motions, search (* / #) and jumplist movement (<C-O> / <C-I>).
2. Fixed an issue of recursive call of the main-loop, which caused pressing i/I lead to a strange non-insert mode.
3. When connected to multiple servers, "/quit"ting from one server resulted in all other windows but one being closed.
vimirc.vim 0.6.1 2004-03-22 6.0 Madoka Machitani A small bug-fix: Currently active window was not restored when someone joined/parted channels.
vimirc.vim 0.6 2004-03-22 6.0 Madoka Machitani New features added:
1. DCC CHAT/SEND.  Type "/dcc help" for the usage.  Also look into the plugin file for the .vimrc settings.  This is not much tested, so if you find any misbehaviors, or incompatibilities with other clients, let me know via e-mail.
2. Single window mode.  .vimrc setting is: let vimirc_winmode = 'single'
vimirc.vim 0.5.3 2004-03-13 6.0 Madoka Machitani A new feature:
Added a map (<CR>) to the nicks window, with which you can operate some action with selected nick(s), such as querying, changing privileges.

1. The issue of inaccessibility to Japanese channels.
2. Older nick was still used internally when you had to change nicks when logging on.
3. Could not parse mode commands like "+vv nick1 nick2".  Characters @/+ will now be added/removed properly.
vimirc.vim 0.5.2 2004-03-11 6.0 Madoka Machitani 1. Removed the "plugin_" part from the global variables, just to keep them short.  Please change your settings accordingly.  Sorry for the inconvenience.
2. Japanese text input/output.  Thanks go to Yasuhiro Matsumoto & Taro Muraoka, who have been helpful on this.  This is still incomplete: you cannot join channels with Japanese characters.
3. Made command windows appear just below the current window.  This is a tentative feature.
4. And some other fixes/changes too trivial to mention.
vimirc.vim 0.5.1 2004-03-09 6.0 Madoka Machitani Fixed some bugs:
1. When you connected to a new server with /server command, the old command window remained open.
2. While connected to multiple servers, [iI] sometimes opened a command window for a wrong server.
3. /list command did not open a list window on some servers.
vimirc.vim 0.5 2004-03-08 6.0 Madoka Machitani Added a new feature: /list command will now open up a separate buffer, where you can sort the list by keys 'o' or 'O'.  Also, you can select a channel to join
by hitting <CR>.

Did some minor fixes inculding: handle operator and voice privileges properly.
vimirc.vim 0.4 2004-03-06 6.0 Madoka Machitani Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
Vim at Github