# Vim, the ultimate command-line password manager

Thanks to a comment on a recent blog post where I lamented the lack of an easy-to-use password manager, I’ve switched from Revelation to… Vim.

I already use Vim for my note-keeping system. I simply add a modeline to the top of the file,

# vim: set ic hlsearch:

This makes searches case-insensitive, so I can just open the file and start typing a search, and it highlights it and moves to the first match as I type. It’s a great way to find something in a file. I have used this simple technique for many years to build a topical index over thousands of interesting email threads, code snippets, posts from bloggers, and customer issues. To use a buzzword, it scales as large as I need it to, and I can quickly find just about anything on any topic I’ve cared about in the past.

The remaining question is how to encrypt the file full of passwords. That’s what Sergio showed me in his comment. There’s a GPG plugin for Vim that detects that I’m opening a GPG-encrypted file and decrypts the buffer for me. This makes it incredibly easy to open, search, edit, and save the file. Much easier than Revelation. I found that the plugin didn’t properly encrypt the file (or I’m doing something wrong), so I first created the file as plain-text and manually encrypted it with GPG, and subsequently the plugin seems to work great.

I still might follow up on Sergio’s suggestions for building something on top of this. I’d really like integration with the desktop: press a key, start typing and seeing matches auto-complete, press TAB when I have the one I want, and copy the password. Maybe I will actually do this. Or maybe a hot-key to simply open Vim with the password file in a terminal is all I need.

I'm Baron Schwartz, the founder and CEO of VividCortex. I am the author of High Performance MySQL and many open-source tools for performance analysis, monitoring, and system administration. I contribute to various database communities such as Oracle, PostgreSQL, Redis and MongoDB.