Finders, Keepers: Long Lost RSE Keyboard Shortcuts
March 29, 2016 Susan Gantner
If you have read many of my past Four Hundred Guru tips, you’ll remember that I write a lot about RSE (a.k.a. RDi) and particularly I write a lot about keyboard shortcuts. I’ve even created my own card with my favorite keyboard shortcuts. This tip is to confess that I’ve recently realized that I’ve been missing out on a set of shortcuts that I should have been using and including on my shortcut cards all along. I published a tip about a year ago about Playing with Blocks and I included an edited version of that tip on the back of my latest Favorite Keyboard Shortcuts card. Now I realize that I omitted some shortcuts from that tip that would have made things even easier for some parts of it. The original tip was about selecting blocks of code, and my favorite way to do that most of the time is using Alt+L. Then I talked about things I might do with the selected blocks of code. One of the most obvious things to do with a block is to copy or move it. My original tip suggested using the standard Windows shortcuts to copy or cut–Ctrl+C or Ctrl+X–followed by paste–Ctrl+V. There’s nothing wrong with copying or moving code that way. It works and I’ve been doing it that way for years. But I’ve had a few people ask me recently why I don’t use Alt+C or Alt+M. The real answer to that question was “because I didn’t realize how they work!” For some reason, I was convinced that those were simply alternative keys that behaved the same as the Windows shortcuts I had been using, so I didn’t see any reason to do things differently in RDi than what I do with all my other applications. Then one day, I tried it out and found that there is indeed a difference and I must confess that I am now regularly using Alt+C and Alt+M. So for those who don’t know about these particular shortcuts (perhaps because you learned most of your shortcuts from me), allow me to introduce you to yet another way to copy/cut and paste code from one place to another. It works just a little differently from the standard Windows shortcut method so I’ll describe the behavioral differences. The most obvious difference with this method is that once you have your code selection marked, you don’t need to specifically copy (or cut) and then paste. Instead you simply position to the location where the code is to go and you use either Alt+C to copy the code or Alt+M to move the code block. So after marking your selection, instead of two actions (e.g., Ctrl+C followed by Ctrl+V) you just Alt+C or Alt+M at the destination. This works to move or copy code between source members (I usually do that in split screen editor mode) as well as within a source member. When using the Alt+C or Alt+M shortcuts, the code at the destination is inserted after the position of your cursor. This differs from the Ctrl+V behavior that pastes before the cursor position. That took me a bit of getting used to! Another difference with the Alt+C/Alt+M method of pasting is that the pasted code remains selected after the paste action. This comes in handy especially when pasting a block of free form logic from one member to another but where the code needs to be subsequently shifted a bit left or right to get the appropriate indentation level. With the just-pasted lines of code still selected, you can now simply use Alt+F7 to shift left or Alt+F8 to shift right. You can, of course, de-select the pasted code using your favorite method. I typically double click. One thing that both the methods have in common is that both Ctrl+V and Alt+C/Alt+M will push existing code aside to make room for the code being pasted. Most of the time this is exactly what I want so I don’t need to make room for the pasted code first. However, every once in a while I do want it to overlay the paste location rather than to push the destination code out of the way. This is particularly useful when I’m not copying full lines of code, but rather just a column. For example, maybe I may want to copy a column of variable names from where they are defined on D specs to some other location, either for use elsewhere in a similar declaration or in logic that will work with those fields. Selecting the column (or rectangle) of code is done by Alt+R, followed by a second Alt+R in the diagonally opposite corner of the column. Using my old method of pasting with Ctrl+C, Ctrl+V, the column doesn’t remain lined up as a column at all. Using the Alt+C method, it remains lined up but it shifts the rest of the code on the lines, which may not always be desirable, especially if the paste is happening into fixed format specs. There is another paste shortcut you can use–Alt+Z–that will paste as Alt+C does but it will overlay whatever code is currently in the space rather than inserting and shifting the existing code out of the way. So there you have it! Even more ways to play with blocks of code using RDi. Susan Gantner is half of Partner400, a consulting company focused on education on modern programming and database techniques and tools on the IBM i platform. She is also a founding partner in System i Developer, a consortium of System i educators and hosts of the RPG & DB2 Summit conferences. Susan was a programmer for corporations in Atlanta, Georgia, before joining IBM. During her IBM career, she worked in both the Rochester and Toronto labs, providing technical support and education for application developers. Susan left IBM in 1999 to devote more time to teaching and consulting. Together with Jon Paris, she now runs Partner400, and appears regularly at many technical conferences, including System i Developer’s RPG & DB2 Summit. Send your questions or comments for Susan to Ted Holt via the IT Jungle Contact page. RELATED STORIES Updated RDi Keyboard Shortcuts A Fastpath To Open A Specific Member In RSE Everybody Likes Shortcuts! Part 2, Playing With Blocks Everybody Likes Shortcuts! Part 1, Navigation My Favorite Keyboard Shortcuts for RSE
|