Selecting several lines in Intellij using keyboard shortcuts - intellij-idea

How can I select several lines in Intellij using keyboard shortcuts?
I found out that I can do it with
ctrl + shift + right/left
But I have to press this buttons several times to select whole line.
What is more the selection starts from current caret position, so if it's not the beginning/end (depending of using left or right arrow) of the line, the whole first line is not selected.

What I usually do is to hit the Home key, and then either:
Shift+End to select until the end of the current line, or
Shift+Down to select until the next line, and then keep pressing Shift+Down to select multiple lines.
Also, IntelliJ IDEA supports the "Extend Selection" and "Shrink Selection" commands, for which the default key bindings are Ctrl+Alt+Left and Ctrl+Alt+Right.
These allow you to select entire blocks of code rather than word by word. You may still need to press the keys multiple times, but way fewer times than when selecting on a word by word basis.

Related

Is it possible to split selection into multi cursor in Intellij IDEA?

In sublime you can select a part of text or even whole text by Ctrl+A and tap Ctrl+Shift+L will split your selection into multi cursor, it is especially useful when you deal with a big selection, and it's a bit horribly to select it by Mouse3 dragging...
Is it possible in Idea?
On my machine the keyboard shortcut to make this happen is alt + shift + insert. The command is called column selection mode.

Find and Replace/Insert 'CR', del Space wherever a user Clicks in a Word document

Short Version
In MS Word, is there a way to insert some text and remove some(simultaneously) at the point of blinking cursor or wherever a user clicks repeatedly.
This (Insertion/Deletion) can be achieved in the following ways:
Mouse click
(Ctrl, Alt or Shift) + Mouse click
Ctrl/Alt/Shift+Mouse click + (Any Key)
Long Version
I have text copied from various sources in different word files which I want to format in a particular style so as to match a given layout. Basically the text needs to be broken down into new lines/paragraphs at specific places which is given in the instructions. Instead of having to press 'Enter' and then remove/delete spaces at every line, I wish to do that with just one click per line using macro.
These files could be 500+ in number, so modifying all in one go using Macros is the preferred way.(Although I find it impossible when the point of insertion of 'Enter' can only be done manually on each file.) I have used Macros to achieve 90% of that however need one last step where a Macro can do the following:
Where ever the user clicks on the page, all space(regular, non-breaking space, white-space) until the next printed character is deleted.
An 'Enter' or Carriage-Return is inserted, so that the text moves to the next line.
Steps 1 and 2 are repeated at every click the user makes on the text.
Example Text
This is an example, of my text, which I need to split up, into different lines.
Expected Text
This is an example, of my text,
which I need to split up,
into different lines.
Notice that as 'Enter' is pressed at the end of these lines although they come in next line but usually a space character is there in front of those lines. Another approach is to click, delete the required spaces until the next character and then hit enter. I want either of these to be done automatically with just a mouse click or a minimum of key+mouse combo.
Something like Find ^w and Replace with ^p running at every place a user clicks, but with Macros.
Any help is appreciated.
This would be possible by defining a shortcut to your macro. So you would need to click at a position and use your shortcut to run the macro.
Eg. Add this to a module in your document
Option Explicit
Public Sub DeleteSpacesAndInsertEnter()
Application.ScreenUpdating = False
Selection.SetRange Selection.Start, Selection.Start + 1
If Asc(Selection.Text) = 32 Or Asc(Selection.Text) = 160 Then
Do While Asc(Selection.Text) = 32 Or Asc(Selection.Text) = 160
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeBackspace
Selection.SetRange Selection.Start, Selection.Start + 1
Loop
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.TypeParagraph
End If
Application.ScreenUpdating = True
End Sub
and assign a shortcut to it.
It deletes all spaces & non breaking spaces right from the current cursor position and then inserts an enter.
Earlier, I thought of using Find and Replace at the place of cursor, Finding ^w and Replacing with ^p but this required me to Constantly lift the shortcut keys I assigned with my macro, otherwise it would just break the complete text at every word into paragraphs. Just pressing Ctrl and click would highlight the text between cursor and mouse click. All in all, I had to press (Ctrl+D), move the cursor to the new point using Click, AGAIN press Ctrl+D. Thus lifting 3 fingers for every change, making it impractical.
Pᴇʜ Macro helped
Ctrl+D+Click still doesn't work seamlessly. Works in 3 steps repeating.
Alt+D+Click worked almost flawlessly, with just one step repeating.
Applying this macro, even if I keep Alt+D(my shortcut) pressed all the time, simply clicking at the desired place does my job. Although Alt + Click anywhere in Word 2007 brings up a Research Window which updates as the text is clicked but in no way interferes with the job being done.
Thanks a lot everyone and especially P for all your help, really appreciate it.
Cheers

Select current line in intellij

Is there any way to select the whole line at caret in IntelliJ 15? I know you can select the current word (ctl + w), go to beginning/end of line but I can't find a current line selection feature.
Simply hit
ctrl+c
Note that for this to select the whole line, you need to ensure that nothing is already selected; otherwise it'll work as an usual "copy" command.
move caret to line
on Windows, press ctrl+shift+a .
This popup appears, where you find Select Line at Caret
for quick access, you can specify a shortcut in Settings
I would like to also add the following from JetBrains website. Because, that what i was looking for here, but no one mentioned it.
1- To select text from the current caret position to the beginning/end of
the current word:
Ctrl+Shift+Left, Ctrl+Shift+Right.
2- To select text from the caret
position to the beginning/end of the current line:
Double-click Ctrl and press Home/End
3- To select text from the current
caret position to the top/bottom of the screen:
Ctrl+Shift+Page Up, Ctrl+Shift+Page Down.
If none of the above are working, I suggest using end and home keys in combination with shift allowing you to select lines quickly.
Go to the end of the line and hit Ctrl+W. If you'll hit Ctrl+W at the beginning of the line it will select only one word.
Not a keyboard feature, but nice to use:
to select the whole row just click on row number on the left of the code.
In addition to that you can click and drag selection.
Moreover, you can doubleclick on the number of the first line of method which results selection of the whole method.

phpstorm search selection jumps to next occurrence

I use PhpStorm for years and have a habbit to select some word to find all its occurences in file.
Before phpstorm 10 when I select some word and press Ctrl+F, it just highlighted the word, cursor stayed on the word (and its occurences) and it showed search panel at the top of editor with matches count.
After upgrade to phpstorm 10 it became work in other way. Now when I select some word and press Ctrl+F it immediately jumps to next occerence of the selected word (it may be e.g. on the other end of the file).
That's very annoying - have to hit Back to move to the place where I started searching.
Does anybody know the reason of it? Maybe there is a way to disable such new behaviour?

In IDEA, how to jump to next occurrence of currently selected text?

In IDEA, when I have some text selected (e.g., a symbol), is there a way to quickly jump to the next occurrence of my current selection in the current file? I can do Ctrl+F, F3 and Esc but isn't there a quicker way, without the need to go through the find panel?
Edit: to make it clear, I am looking for a way to do this without the Find panel being open.
(One thing I noticed: the area behind scrollbar automatically indicates where else the current selection appears in the current file. Maybe there is some command to go to the next occurrence as indicated by the gutter?)
Select desired text and press CTRL+F3 to search for current selection, and then F3 for next ocurrence (or keep pressing CTRL+F3)
Try BrowseWordAtCaret, it is much better than CTRL+F3 which others suggested.
Description:
Allows to easily browse next/previous word at caret and highlight other appearances of selected word.
Usage: Browse with CTRL-ALT-UP, CTRL-ALT-DOWN (note: on default-keymap this shortcut is also for next/previous occurrence).
Once you have your search dialog open, use F3 to move to the next occurrence. Use Shift+F3 to move back an occurrence.