Tuesday, February 10, 2009

Use Personal/Manual Clipboard while Coding

Coding involve lots of copy/cut and pasting and many of those are hard or confusing to do if you are relying only on unseen standard clipboard buffer. You need more powerful clipboard function that only full text editor can provide.

I find it helpful to use text editor as "manual" clipboard when coding and only relying on standard clipboard for only the tiniest need. I personally use JEdit for that, as it is also my all-purpose text-editor, but any text-editor will do. I use it liberally to put everything that has transient existence there. Here's some example when it can helo:

  • changing system's environment variable like PATH. I copy paste the current one to JEdit twice and edit and paste back the second one (much easier than to have to edit it on the dialog box like on Windows), the first one is for backup when something goes wrong
  • edit critical code. I copy paste the existing one to JEdit before editing the one on the IDE. I do this for relatively long code piece while for short ones, I do my safe-coding on it.
  • store frequently-referenced code. There are part of code that you frequently need to refer to while you code on several places e.g: important struct that being passed around everywhere. I copy it to JEdit for convinient referring. You will need to have dual-monitor setup to have this felt really useful although switching between JEdit and IDE still a bit faster then switching back and forth within one IDE
  • copying several piece of code on several places and not exactly the same everytime. I wouldn't want to do it without having text editor to buffer code pieces for this. This kind of coding task is probably the fastest way to confuse your mind and ruin your day :), you need strategy and buffers to do it safely and, hopefully, fun
  • editing build config. Build config usually needs a lot of copy and paste and although you could do it using system's clipboard you will find that editing and storing related part on the text editor first will ease the task a lot. It will minimize jumping and recopying that will almost certainly happen often
  • cutting code that you are not really sure you want to see that part you cut is gone forever (beyond the recovery-limit of undo)
That's just some of what I can think of right now, there will be lots of other cases you will find much easier to do if you remember you can always buffer it to text editor first.

The more powerful text editor will help you even more relative to less powerful one, you will have all the leverage that the text editor have as the leverage of your "manual" clipboard too like syntax-coloring, structure parsing e.g: SideKick in JEdit, autosave.

You could think your text editor as a side kick of your IDE, it shares the burden and make coding less burdensome.

No comments: