Wednesday, October 28, 2009

The Visual Studio Clipboard Ring

Here's a quasi-funny story. I didn't know C# when I worked at Microsoft, and oh god no I didn't use Visual Studio to write code at Microsoft either. ViM was my editor of choice at M$. Fast-forward to today; Amazon is paying me to build C# applications and libraries. I would use ViM to write C#, but VS 2008 is the cat's whiskers when it comes to .NET development.

With this being said, I do miss a ton of ViM features that aren't in Visual Studio. After what I learned today, I won't miss one - named buffers. To summarize the feature: if you need to preserve multiple items into the clipboard, do the following in command mode:
- select the text (Shift-V, Ctrl-V)
- pick a letter [A-Z] or a number [0-9] - say M
- type "My

To paste the contents of buffer 'M' in command mode, type: "Mp

The clipboard ring doesn't provide named buffers, but it remembers the last 15 items I copied, which is almost 90% of what I want. Here is how you use the feature:
1. Copy a selection using Ctrl-C (Copy).
2. Pressing Ctrl-V will paste the last item you copied.
3. Pressing Ctrl-Shift-V will also paste the last item in the clipboard. If you want to retrieve the second, or last item you inserted into the clipboard, simply keep pressing Ctrl-Shift-V to cycle through the items in the clipboard. Or just drag and drop any entry.

Q.E.D.

No comments:

Post a Comment