Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

Boosting Software Developer Productivity with a Clipboard Manager

blog/cards/boosting-software-developer-productivity-with-a-clipboard-manager.jpg

Being able to select and paste more than 1 clipboard item at a time is a huge time saver. Here's a few apps for each major OS.

Quick Jump: Why Would You Want a Clipboard Manager? | Which Clipboard Manager Should You Use? | Windows | MacOS | Linux | BONUS: There's Also pbcopy and pbpaste

One perk of doing freelance development work is I get an opportunity to work with many developers on a regular basis.

Since most of my work is remote, I do a lot of screen sharing with developers and it’s always interesting to see how they have their development environment set up.

Lately I’ve been finding more and more people using third party clipboard managers. The main feature of one is the ability to store multiple items in your clipboard and then easily search and pick the result you want when it comes time to paste your data.

I can’t believe how long I’ve gone without using one myself but now that I’ve been using one for a bit, I can’t imagine life without it.

Why Would You Want a Clipboard Manager?

As software developers, we’re constantly copying code from our own code bases, stackoverflow, gists… you name it, we copy it! Think about how many times you’ve copied something, but then copied something else, only to realize 15 seconds later you want the first thing you copied again.

Now you’re stuck re-copying the first thing you had, but that might have came from a web page you’ve closed, so you have to go back and find it again. I thought long and hard about this work flow and it’s something I used to do a lot.

This is where a clipboard manager steps in to save the day. There are free and paid apps for Windows, MacOS and Linux.

Which Clipboard Manager Should You Use?

There’s many different apps to choose from. I’m going to list what I think is a good one to use for all major operating systems.

My criteria for a good clipboard manager would have at least these features:
  • Configure hot keys to bring up the clipboard selector (I use CTRL + Alt + V)
  • Quickly select a clipboard item via hot key, arrow keys or mouse
  • Search through the list of clipboard items immediately
  • Configure how many items get saved and when they expire
  • Ability to paste in plain-text as a separate hot key

The last one is useful because how many times have you tried to paste code from your editor into a gmail message and now you have all sorts of background colors and formatting from your editor? It happens to me all the time.

Having an ability to paste an item without formatting is really nice to have.

Windows

I spent quite a bit of time researching and trying a few different apps out. This involved reading comparison reviews, watching Youtube videos and also installing some of the best candidates on my machine to try them out.

I came to the conclusion that Ditto was the best option for me because it nailed all of the important features listed above and more. Here’s a screenshot:

blog/ditto-clipboard-manager-for-windows.jpg

You can really tell that the person who created this application is a user of their own app.

For example, when you hit your hot key to bring up the clipboard selector, the first item is selected but if you want to search to narrow down your clipboard items, you can just immediately start typing to filter without having to move into the search box.

Something like that wasn’t “invented”. That comes from real world usage.

It also supports images and even has a nice little tooltip feature where if you mouse over a clipboard item you can see the full contents (for text).

Also another nice perk is it has a portable installer and only uses about 2.5mb of RAM.

It’s funny because my machine has 16gb of RAM but my mindset on memory usage is still back in 1999 when the RAM usage of a program actually mattered a lot. It makes me happy to see that some people still care about memory and runtime efficiency.

Making Ditto Work with WSL Terminals

The only problem with Ditto is if you use WSL, most terminals accept CTRL + Shift + V to paste, not CTRL + V and Ditto sends the virtual key code for CTRL + V to paste text.

However, if you go to the options menu for Ditto and then advanced options (under general), you can change the default paste string as seen in the screenshot below:

blog/advanced-ditto-options.jpg

That makes Ditto send CTRL + Shift + V as its paste code and now terminals like ubuntu.exe and wsltty will work, or any terminal that expects you to use CTRL + Shift + V.

Although, this also means applications that support CTRL + V for pasting will not work through Ditto, but fortunately browsers like Chrome allow for CTRL + Shift + V to paste.

In other words, Ditto will work inside of your terminal, VSCode and Chrome so that should cover 99% of the use cases where you would want to paste from Ditto. In other cases, you can simply press CTRL + V to bypass using Ditto.

Lastly Ditto is also open source which is great, and they accept donations too.

MacOS

As you know I use Windows but in 2021 I started to use a MBP from a company issued laptop for some work.

I looked at a bunch of different tools and ultimately landed on using Maccy. It’s open source and MIT licensed with a donation model. It’s very similar to how Ditto works so my review of Ditto pretty much directly applies to Maccy too!

As someone who has done a bunch of contract work I have seen other developers on macOS use different tools. I have no first hand experience with these but I figured I’d list them for completeness’ sake in case you didn’t want to use Maccy.

Alfred has a clipboard history extension that you can add. If you try it, let me know in the comments below.

The other clipboard manager I’ve seen being used is Paste 2:

blog/paste-2-clipboard-manager-for-macos.jpg

This one has a really powerful search and it has some developer oriented features such as code snippet highlighting. As you can see, it’s much less minimal. It also costs $9.99.

I would say try them all out because they have free trials. Paste 2 is much less minimal but it may have some features you want. Of course there are many other options too, and some free apps as well. Do a bit of research with Google and let me know how it goes.

Linux

I don’t have any experience using clipboard managers on Linux so there’s not much to say.

It looks like someone over at Tecmint did a high level comparison of 10 different clipboard managers for Linux so you may want to check that out. I found that list by Googling.

Just based on the screenshots they posted, I would probably start with Clipman:

blog/clipman-clipboard-manager-for-linux.jpg

It looks like a minimal drop down menu and it’s based on XFCE which is awesome because I used to run an xubuntu VM for around 5 years which uses XFCE under the hood.

BONUS: There’s Also pbcopy and pbpaste

Since we’re talking about clipboard optimizations, here’s 1 more thing to look into using.

MacOS comes with 2 commands called pbcopy and pbpaste. They allow you to access your clipboard in your terminal, but you can set this up for Windows and Linux too.

For example you could do whoami | pbcopy and that will copy your currently signed in user to your clipboard.

Likewise, you could run pbpaste to paste the contents of your clipboard to STDOUT. That means you could do things like pbpaste > example.txt to write out a new file with the contents of your clipboard. That’s pretty handy sometimes.

If you want to get this running on Windows with WSL (which is what I do) or Ubuntu, just run sudo apt-get install xclip and then open up your ~/.bashrc file and create these 2 aliases at the bottom of the file:

alias pbcopy="xclip -selection clipboard"
alias pbpaste="xclip -selection clipboard -o"

Now you’re all set up to use pbcopy and pbpaste. Make sure you run source ~/.bashrc to reload your shell session, and make any necessary adjustments if you’re using zsh or fish.

Are you using a clipboard manager? Which one are you using? Let me know below.

Never Miss a Tip, Trick or Tutorial

Like you, I'm super protective of my inbox, so don't worry about getting spammed. You can expect a few emails per month (at most), and you can 1-click unsubscribe at any time. See what else you'll get too.



Comments