Effective Code Editing with Cloud9 IDE
We at Cloud9 IDE dogfood our product every day. Everybody at our company uses Cloud9 to develop Cloud9 which is a great experience, because all the useful stuff we work on can immediately be integrated in our workflow. As as result, over time, we added many useful little features and keybindings that make us significantly more productive as developers. In this post we will share a few of those tricks with you, so that you can make most out of Cloud9 IDE.
While "wired in" you want to focus on your code as much as possible, reduce the use of the mouse and just use the keyboard. Here's a couple of useful keyboard short-cuts you may not know about yet.
Selected word highlight and navigation. If you have a word selected (e.g. a variable name), you will notice that other occurrences of that word are automatically highlighted. To jump between them, you can use Ctrl-K (Cmd-G on Mac) and Ctrl-Shift-K (Cmd-Shift-G on Mac) to jump between them.
Moving/copying lines. You can use Alt-Up (Option-Up on Mac) and Alt-Down (Option-Down on Mac) to move lines up and down. Add the Shift key to copy the line, or select multiple lines to move/copy them together. While you may think this is not super useful, you will likely find that when you get used to it, you'll use this feature all the time.
Indenting and outdenting blocks. Select a block of code and use Tab and Shift-Tab to indent or outdent the block of code.
Search within a file. Use Ctrl-F (Cmd-F on Mac) to search within the file -- a small search box will appear along the top-right. Press enter to search, and keep pressing it to jump to the next result.
Code formatting (JavaScript). Copied a piece of code from some blog? Had your colleague edit your code and it it looks bad? Select the poorly formatted code, press Ctrl-Shift-B (Cmd-Shift-B on Mac) to automatically reformat it.
Delete a line. The less code, the better. Deleting code is one of the most satisfying things to do. Ctrl-D (Cmd-D on Mac) makes it faster, my removing lines one at a time.
Reveal file. Having trouble finding your currently open file in the file tree? Happens to the best of us. Simply press Ctrl-Shift-L (Cmd-Shift-L on Mac) to reveal the current file in the file tree.
Tab switching. Want to quickly switch between two or more open tabs? Give Ctrl-Tab (Alt-Tab on Mac) a try. To switch to the tab to the left use Ctrl-[ (Cmd-[ on Mac), to switch to the tab to the right use Ctrl-] (Cmd-] on Mac).
Close a tab. Use Alt-W (Option-W on Mac) to quickly close the current tab.
Quickly open a file. Press Alt-Shift-R (Option-Shift-R on Mac) to open the open file dialog and search for any file within your project.
Search file contents. Want to search your entire project, or a certain directory? Select the directory in your file tree and press Alt-Shift-F (Option-Shift-F on Mac) to quickly to a full-text search of your files for a certain phrase.
Close any dialog. Just by pressing Esc, easy no?
Mouse trickery. If you are a mouse aficionado, here's a couple of clickery tricks:
| Double click: | select current word |
| Triple click: | select current line |
| Quadruple click: | select entire file |
Bonus tip: Want to really get in the zone? Press Ctrl-E (Command-E on Mac) to enter Zen mode.
Snippets
It is only a short while ago since we added code completion to Cloud9, but it is already used a lot. At this point it features word completion (to complete long variable and method names, for instance), but also some useful built-in snippets. To find out all the JavaScript snippets available to you, just move your cursor to an empty line and press Ctrl-Space (or Alt-Space, if that doesn't work). You will now see a drop-down of all available snippets and other completions. To insert any of these, type in the snippet name in your code, followed by Ctrl-space to expand. The ones we use most are:
- log, which expands to console.log(). Extremely useful, especially if you're a "printf debugger", not a "debugger debugger".
- fora, which expands to a for loop that iterates over an array. Boiler plate code that you otherwise have to write by hand over and over again.
- setTimeout, which expands to a setTimeout call with function closure and timeout of 0, to postpone execution of some piece of code.
What are the features in Cloud9 that make you a more effective code editor? What can we do to make you more effective in your coding?








Comments 14 Comments
- ALT+up/down to swap the content of a line (|| reorder)
- rename all instances of selected entry (|| structure)
- toggle comment via CTRL+7 (|| commenting)
Moreover a shortcut for accessing the preview wouldn't be bad :)
Some key combinations doesn't work for me, even though they seem already implemented - e.g. selecting the console (read somewhere it should be ESC + shift) or creating a new file (CTRL+n), opens a new browser window instead. Another would be CTRL+Tab, which switches between the tabs of the browser...
I really like the features so far, but perhaps you could think about some of these improvements:
- as I create a new file via the menu, the edit tab opens but gets unfocused (instead the console gets active) - would be more convenient if the carret would be actvie in the tab
- an export function in the file section, allowing the user to get the files to your local harddrive
- a shortcut to "enlarge"/"shrink" the console window, allowing to easily get the output of your logs
- CTRL+left click at a function name, should jump to the place where it got created
- the panels which doesn't update themself but got an icon, should refreshed as you press F5 (like if you opened the panel "Project files")
- customization through the possibility to allow using your own style themes (perhaps via an import of textmate themes) and creating own
Finally I've got a question, for which I couldn't find an answer: Why is there a line, splitting the edit screen in half ? Currently Cloud9 doesn't seems to provide a dual splitt view pane and couldn't find an option to disable it for a better overview :(
var myFunction = function(arguments){
// several dozen lines of code
// ...
// ...
};
becomes
var myFunction = function(arguments){...};
Makes it much easier to work with larger files.
Anyway, thanks, and keep on dogfooding - it's working!
I have 0.5.1 on Lion with Chrome and most of the hotkeys are NOT working (Zen mode, tabs and files manipulations are one of them). Do you have any additional manuals on working hotkeys?
Hope to seen better manuals about writing extensions and digging through Cloud9 as you have many feats under the hood that hard to find about.
Cheap Kamagra Online
Now, back to the coding, I'd like to ask you for a little bit of help. I played couple of times with some language parsing, you can see my old project for ActionScript: code.google.com/p/minibuilder
As Cloud9 is starting to be interesting to me, and I do more and more JavaScript, I'd like to play a bit with a solution for true code completion. My main target is, funny, PHP. I guess it has a fairly simple structure. With JS, it's very hard. The best we can do is base it on the JSDoc and similar type annotations.
What I need from you is some guidance in the code. Where to look and how should I build a provider for these code hints. Also, parameters info for functions is a must.
Thanks in advance,
Victor Dramba
- give the ability to customize the keys bindings: in my case, I do love the "Tab switching" shortcut but it's totally unusable for me... Yeah, I've an AZERTY keyboard and to get the opening bracket [ I have to use the key combination Ctrl + Alt + 5, so the shortcut Ctrl + [ couldn't be done :(
- to be able to add/remove shortcut to any available command in the editor: for example, the "debug" command has no default key shortcut and it would be cool if I could add it one :) On the same kind, there are some commands I don't use frequently so I don't need shortcut for them... :)
- give the ability to close a file tab by pressing the central mouse button over the full tab and not only the X button: yeah I'm not a mouse sniper and I'm wasting time to target precisely the X to the close the tab, if the whole tab can handle a click with the central mouse button, then I could do so more quickly :)
- to be able to select multiple files/folders in the "Project Files" window with Ctrl+Click or similar (Ctrl+Shift+Arrow and space to toggle selected elements), and then be able to run commands on them (open, delete, whatever),
- the "Project Files" panel could be able (if the user wants to) to track the current selected file (as does the "Reveal in File Tree" menu),
- when the cursor is right after a bracket ()[]{}, the corresponding one is highlighted. It would be cool if the same could also happen when the cursor is right >before< the bracket, except on the edge case where there are brackets before and after the cursor such as in "function whatever( args )<cursor>{ /* content */ }",
- add a command and/or a shortcut to move the cursor to the corresponding bracket (or tag in XML-like files),
- add block color highlighting in the editor, as wished by Douglas Crockford and explained here https://plus.google.com/118095276221607585885/posts/XXkzgJEoE9v (this would be really awesome !),
- to be able to enable or disable any-single-functionality in the editor. I think this one is the most important feature in this list, as each developer has its own preferences for coding and an editor couldn't satisfy every-single-developer that use it,
- have a place where to find all available shortcuts and snippets,
- to be able to edit/configure/add snippets,
- to be able to edit the rules used in the "beautify" command. (BTW, why does this command returns "Cannot execute command. You are currently offline." in offline mode ? Does it have server-side processing ??),
- about the code folding, it would be cool if we could fold the level N of nested function/object/whatever with a shortcut and not only the level 0,
- to be able to move/hide and organize panels, for example I don't use often the Preferences panel and I don't want to see its button on the left panel, I can use the Window menu to open it when I want :)
- add a shortcut to open/focus the console panel,
- to be able to manage and organize icons on the UI, and contextualize them: the "Step into" button doesn't make sense in "edition mode",
- add support for plugins,
- add an option to serve coffee, and optionally support coffeescript :)
To get more awesomeness, pick the best from notepad++, Eclipse, Netbeans, Flash IDE, Visual Studio, VIM, TextMate and brings them to Cloud9 ! :)
I hope this message will be useful for you and you'll like it :)
Cheers