I've seen this done in TextMate and I was wondering if there's a way to do it in IDEA.
Say I have the following code:
leaseLabel = "Lease";
leaseLabelPlural = "Leases";
portfolioLabel = "Portfolio";
portfolioLabelPlural = "Portfolios";
buildingLabel = "Building";
What is the best way to append '+ "foo"' to every line? Column mode won't work since the lines are not correctly aligned on the right side... unless there is an easy way to right justify the text :P
In this case you can also just select the piece of code in which you want to do this and perform a replace on it. Replace:
";
with:
" + "foo";
So in case you didn't know: If you have text selected while you perform a replace (Ctrl+R or Cmd+R) it will only apply to the selected piece of text.
Place caret at end
Windows: CTRL + CTRL(Hold) + ↑ / ↓
Mac: option + option(Hold) + ↑ / ↓.
To place caret at the end of rows: move caret to top row, clone down to bottom, and click END.
Change Multi-caret Hotkey
To add a custom Keymap, CTRL+SHIFT+A, type
keymap
and click on the one withSettings
as subtext. Search forClone Caret Above
andClone Caret Below
.I mapped mine to ALT+SHIFT+↑ / ↓ on Windows and ⌘+↑ / ↓ on Mac.
Bonus
Try holding combinations of CTRL, SHIFT, and arrows for improved selection power.
Select Next Occurrence:
Unselect Occurrence:
Select All Occurrences:
for more reference: link
For mac users it's :
ALT + SHIFT + Click
Since Idea IntelliJ IDEA 13.1 there is possibility to edit multiple lines.
Use:
Alt + Shift + Mouse click
for selection. More about this new improvement in IntelliJ blogpost here. Very useful feature.
It took me a while to find out, but on a Mac you can double-press Option (press it once, release, press it again, keep it pressed) and use Up/Down keys to create/remove carets as you wish.
You can also hold Shift+Option and click to create/remove carets at specific points.