Introducing CoVim – Real-Time Collaboration for Vim
Today we’re announcing CoVim, a plugin that adds multi-user, real-time collaboration to your favorite (or least favorite) text editor. CoVim allows you to remotely code, write, edit, and collaborate, all within your custom Vim configuration. Originally started as a senior capstone project for Tufts University, we’re now open-sourcing it to give the world one of Vim’s most requested features. Think Google Docs for Vim.
Work on CoVim started almost a year ago. I wanted to explore this concept of a shared classroom note-taking platform (someone should still do that, by the way) while my project partner Sam Haney wanted to explore something a bit more well-known and dependable. We decided to meet each other halfway, and CoVim was born.
How it Works
Vim has built-in Python scripting, so Python was an obvious choice for our project. For networking, we used Twisted, a powerful event-driven networking engine that comes included in most versions of Python. Whenever the user makes a change to the document or moves their cursor, the client sends an update to the server. The server then updates any cursor locations before sending the update to the other clients.
With CoVim, there’s no representation of a file. All updates live within the Vim buffer, which is simply a working copy of the document’s text. This isn’t so much a bug or feature, but more a symptom of how Vim represents documents-in-progress. While it’s the responsibility of the user to remember to save their work, it also allows users the freedom to save whatever and whenever they want.
CoVim is obviously awesome, but that alone doesn’t justify a year of hard work. So, what can we actually do with it?
The problem we initially set out to solve is one that plagued us as students: the annoyance of pair programming on one computer. Pair programming is a great coding technique that turns frustrating work into a team effort, but the physical limitations are a pain. There’s just one screen and one keyboard, so space is cramped and switching writers interrupts the creative flow. With CoVim, you can have your own screen and keyboard, so space is never cramped and time is never wasted switching writers.
But students aren’t the only ones who can benefit. Teaching Assistants can use CoVim to help multiple students during office hours, and a professor can walk through a students code with them one-on-one without ever leaving the office. Going one step further, TA’s could run office hours completely remotely, whenever they had a free second. (Is this a great idea? Probably not, but it is a good example of just how much CoVim can help in academia.)
Businesses will also benefit from CoVim. Got a question for someone across the office? Instead of trying to explain the problem in abstract, just open Vim and let them see the code in question. Does your company practice code reviews? Walk through the code together so that feedback can be given line-by-line. Making it so easy to share code will increase collaboration in any business, which means better code quality and greater results.
Grab the Code
CoVim is on GitHub, so go check it out, grab the code, and start sharing. Tons of work went into this project, and it wouldn’t have been possible without Ming Chow (an amazing Tufts professor who completely revamped the Senior Capstone Program) and my project partner Sam Haney. There are tons more features on the way (including chat, annotations, & admin tools), so keep on the lookout.