Code editing in Comma
The Comma editor works largely like other graphical text editors. Those who are used to working in Vim may find the IdeaVim plugin useful. One may install it through the Plugins section of the Settings dialog.
Ctrl+F searches within the current file, while
Ctrl+Shift+F can perform a text search over the
Ctrl+R does a textual replace within the current file, the
Ctrl+Shift+R provides this
across the entire project.
Ctrl+W will select the current program element. Pressing it again will expand the selection
to the next program element.
Ctrl+Shift+W will make the selection narrower again.
This is especially useful for selecting valid program elements to copy/paste, but also can come in handy to check the precedence of a complex expression!
Comment code out
Ctrl+/ will comment out the current line, or selected lines, of code - unless that line is already
commented out, in which case it will uncomment it.
Ctrl+Shift+Enter will complete the current statement “smartly”. For example, pressing it
class SomeName will insert the curly braces and place the cursor inside of the class
body. Similar happens with routine declarations and control flow statements. On other statements, it
; and then places the cursor onto the next line.
Duplicate or cut a line
Ctrl+D to duplicate the current line, and
Ctrl+X to cut the current line.
Move statement up/down
Alt+Shift+Down can be used to move the current line up and down. But what if
you need to move a multi-line statement?
Ctrl+Shift+Down move statements up and
down, correctly handling multi-line ones.
Ctrl+Num pad - to collapse the code at the current location, and
Ctrl+Num pad + to expand it
Mark all references
When the cursor is on a symbol, for example a variable, then all usages of that variable currently on
the screen will be shown with a gently colored background. But how to know if there are usages off
Ctrl+Shift+F7 highlights them more vividly, and also shows the locations of other usages
on the scroll bar. Press
Ctrl+Shift+F7 on that symbol again to clear this.