百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
V

vmail

> 编程语言
开源

一个用于 Gmail 的 vim 接口

787 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

一个用于 Gmail 的 vim 接口

Vmail

Vmail is a Vim interface to Gmail.

screenshots

Why Vmail? Because some people are 1000 times more productive and happy in Vim than in any web browser or GUI program.

Prerequisites

  • a Gmail account
  • a relatively recent version of Vim (Vmail is developed against Vim 7.3)
  • Ruby 1.9.0 or higher with SSL support compiled in (Vmail is developed using Ruby 1.9.2)
  • libsqlite3-dev and sqlite3 (try installing with apt-get, brew, yum, emerge, etc.)
  • text-only-mode web browser (w3m, elinks, or lynx) should be available to view HTML mail parts in Vmail

To install Ruby 1.9.2, I recommend using the RVM Version Manager.

The current version of Vmail assumes a Unix environment.

Your Gmail account should be IMAP-enabled.

If you want to use elinks to display HTML parts, here are instructions.

Installation

gem install vmail

Test your installation by typing vmail -h. You should see Vmail's help.

On some systems you may run into a PATH issue, where the system can't find the vmail command after installation. Please report this if you encounter this problem, and mention what system you're using. You might want to try

sudo gem install vmail

to see if that puts vmail on your PATH. (If you're using rbenv, running rbenv rehash should do the trick.)

Vmail is evolving rapidly. To update to the latest version, simply run the installation command again.

gem install vmail

If you ever want to uninstall Vmail from your system, just execute this command:

gem uninstall vmail

... and all traces of Vmail will removed, except the few files it creates during execution (see below).

Configuration file

To run Vmail, create a yaml file called .vmailrc and save it either in ~/.vmail/default/ or in your home directory. If you do the latter, Vmail will move the file to ~/.vmail/default/ when it starts up.

The .vmailrc file should look something like this. Substitute your own values.

username: [email protected]
password: password
name: Daniel Choi
signature: |
  --
  Sent from Vmail. http://danielchoi.com/software/vmail.html

This file should be formatted in YAML syntax. If you have any unsual characters in a string value, try putting quotes around that value.

You can omit the password key-value pair if you'd rather not have the password saved in the file. In that case, you'll prompted for the password each time you start Vmail.

You can also add an always_cc: key-value pair. This will pre-insert whatever email address you specify in the cc: line of any email you start composing in Vmail. You can also add an always_bcc: option that works in the same way.

If you want to use a shell script to print the signature, use the signature_script: option instead; e.g.,

username: [email protected]
password: password
name: Daniel Choi
signature_script: /home/choi/bin/vmail_signature.sh

You can add a vim_opts: key-value pair to run arbitrary Vim commands when Vmail starts up. For example, to turn on the cursorline, add this to .vmailrc:

vim_opts: set cursorline

If you want to configure Vmail with multiple Gmail accounts, here's how.

If you are behind a firewall that blocks IMAP, see these additional configuration options that you can use.

If you have a non English(US) Gmail account, you would need a little extra configuration to make Vmail work.

Another optional parameter is date_format, which controls the appearance of the dates in the message list. Here you can use a strptime-compatible date format string. Make sure you enclose these in quotes:

date_format: '%b %d %I:%M%P'
date_format_previous_years: '%b %d %Y'

Contacts autocompletion

Vmail uses Vim autocompletion to help you auto-complete email addresses. To use this feature, generate a vmail-contacts.txt file. This is a simple list of your email contacts. Invoking Vmail with the -g option generates this file for you by collecting all the recipients and cc's from your last 500 sent emails. You can adjust this number by using -g with a number argument.

After Vmail generates this file for you, you can edit it however and whenever you want, as long as there is one address per line.

Starting Vmail

Once you've created the configuration file and (optionally) the contacts file, you can start Vmail with

vmail

This opens the Vmail/Vim interface and shows you the last 100 messages in your Gmail inbox.

You can have Vmail show messages from any other mailbox (a.k.a. label) on startup by passing in the mailbox name as an argument:

vmail starred

You can also pass in search parameters after specifying the mailbox:

vmail important from [email protected]

Viewing messages

The first screen Vmail shows you is a list of messages. You can view a message by moving the cursor line to it and pressing ENTER. This will split the screen and show the message content in the bottom pane. Pressing ENTER will also move the cursor to the message window. If you want to look at a message but keep the cursor in the list window, type l (as in look) instead of ENTER.

To full-screen the message, press SPACE when the cursor is in the message window. You can also use the standard Vim key sequence C-w C-o. To go back to the split view, press SPACE or ENTER. (ENTER moves the cursor to the list window.)

You can full-screen the list window by pressing SPACE while the cursor is in it. You can also use the standard Vim key sequence C-w C-o. To go back to the split view, press SPACE or ENTER. (ENTER opens a message and moves the cursor to the message window.)

In the split view, you can jump between the two panes by just pressing ENTER from either window. You can also use the standard Vim key sequence C-w C-w.

You can use or `,j` from either split window to show the next message. You can use or ,k to show the previous message.

Vmail loads a certain number messages at a time, starting with the most recent. If there are more messages that Vmail hasn't loaded, you'll see a line at the bottom of the list that looks something like this:

> Load 100 more messages. 156 remaining.

Put the cursor on this line and press ENTER to load more of these messages.

Tip: To go straight to the bottom line and load more messages, type G.

Unread messages are marked with a + symbol.

To view the raw RFC822 version of a message, type ,R while viewing the message.

Starring, deleting, archiving, marking spam, marking read/unread

To star a message, put the cursor on it and type ,*. (Note that the comma before the * is part of the key sequence.) Starring a message copies it to the starred mailbox. Starred messages are marked with a * symbol and color-highlighted.

To delete a message, put the cursor on it and type ,#. Deleting a message puts it in the trash mailbox. Deleting a message from the trash mailbox deletes it permanently.

To archive a message, put the cursor on it and type ,e. Archiving a message moves it to the all mailbox.

To mark a message spam, put the cursor on it and type ,!. This moves the message to to the spam mailbox.

To mark a message as unread, put the cursor on it and type U.

To mark a message as read, put the curson on it and type I.

You can use visual selections in the message list when you star, delete, mark as spam, mark as read, mark as unread or archive. Use v to start marking a range of lines (the horizontal position of the cursor doesn't matter). Then type any of the above commands to perform an action on all the messages you selected.

To save you keystrokes, Vmail provides alternative key mappings for ,*, ,#, and ,!:

  • star: ,* → ,8
  • trash/delete: ,# → ,3
  • mark spam: ,! → ,1

These save you from having to press the SHIFT key in each case.

Checking for new messages, INBOX polling

To check for new messages in the current mailbox, press u in normal mode if you're in the message list window or ,u if you are in the message window. Watch the status line.

If you have notify-send (Linux) or growlnotify (OS X) installed on your system, Vmail can also poll your INBOX every 30 seconds for new messages. If it detects a new message, it will alert you through your notification program. NOTE: If vim is compiled with the clientserver flag, the new messages will be displayed automatically. Else, one will have to manually check for new messages(u) to get them displayed.

To enable automatic inbox polling put the line polling: true in your .vmailrc.

You may try this hack as a workaround for compiling Vim with clientserver.

Switching mailboxes, moving messages, copying messages to another mailbox

To switch mailboxes, type ,m. You'll see an autocomplete window appear at the top. The standard Vim autocomplete keystrokes apply:

  • C-p and C-n move you up and down the match list
  • C-e closes the match list and lets you continue typing
  • C-u: when the match list is active, cycles forward through the match list and what you've typed so far; when the match list is inactive, erases what you've typed.
  • C-x C-u finds matches for what you've typed so far (when the match list window is closed)
  • C-y selects the highlighted match without triggering ENTER
  • ENTER selects the highlighted match from the match list

Tip: start typing the first 1-3 characters of the mailbox name, then press C-n, C-u or C-p until you highlight the right match, and finally press ENTER to select.

To move a message to another mailbox, put the cursor on the message in the message list, and type ,b. You'll be prompted to select the target mailbox.

To copy a message to another mailbox, put the cursor on the message in the message list, and type ,B. You'll be prompted to select the target mailbox.

If you type in the name of a target mailbox that doesn't exist yet, Vmail will create it for you before performing a move or copy.

Composing messages

To start writing a new a email message, type ,c. That's a comma followed by the character 'c'.

To reply to a message, type ,r.

To reply-all to a message, type ,a.

To forward a message, type ,f.

All these commands open a message composition window. At the top, you will see mail headers like this:

from: Daniel Choi 
to:
subject:

The from: field will be pre-filled from your .vmailrc configuration. You're responsible for filling in the to: and the subject: fields. You can add a cc: and bcc: field if you want.

When you fill in the recipient addresses, you can use Vim autocompletion if you generated a vmail-contacts.txt file. Start typing a name or email address, then press C-x C-u to invoke autocompletion. Select a matching email address with C-n, C-p, or C-u and then press SPACE or any other character (such as a ,) to continue typing.

Make sure your email addresses are separated by commas and that they all ultimately appear on the same, unbroken line for each field. Rejoin the lines if breaks get inserted.

After you fill in the headers, write your message. Make sure there is a blank line betwe

Issues· 85 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言