You're typing a line of code and for whatever reason the caret isn't at the end of the line when you have finished typing it.
For example, in Python with IntelliJ's code completion.
I type:
def get_id(
and code completion automatically finishes it off to:
def get_id(self):
with the caret placed after the 'f' in 'self'.
Normally I'll press End then Enter to have the caret nicely indented for the next line. But End is an awkward key to hit—it moves around on different keyboards, it can be a long stretch or squashed in somewhere on a laptop.
IDEA's Ctrl+Enter line completion works well in some languages in some instances but not in others. The example above—it'll just push the ): down to the next line.
I've scanned through all the shortcut keys in IDEA's docs and third-party sites but can't see any shortcut to do this. Similarly, with auto quote or bracket completion when you just want to get past the closing quote/bracket to continue typing—I find myself just typing the closing quote/bracket instead of reaching for → or End.
Is there something obvious I'm overlooking?
Related
I'm using the terraform plugin specifically but this is a more general intellij hotkey question.
I start typing a supported element and autocomplete pops up:
Hit tab and it sets up the method and puts the cursor in the first input and I can start typing and it gives me possible inputs:
But when i hit tab or enter it just completes it and leaves the cursor where it is:
Is there a hotkey to complete one of those options and then also jump to the next input?
There is a ticket for this feature, but its not implemented yet, please vote: https://youtrack.jetbrains.com/issue/IDEABKL-7063
Most programs copy selected text (say selectedText1), open textbox and paste buffer in search when Ctrl-C, Ctrl-F, Ctrl-V hotkeys are pressed. IntelliJ decided change this behavior to "more efficient". Ctrl-C, Ctrl-F copy-paste highlighted text in a search box.
I end up pressing Ctrl-C, Ctrl-F, Ctrl-V -> selectedText1selectedText1 0 results -> Backspace several times -> selectedText -> too many results, because selectedTextProcessor and selectedText2 are included.
This breaks workflow.
AutoHotKey script to replace ^F with ^F, ^A, Backspace is my current workaround.
Is there a way to tell intelliJ that I want conventional ^c,^f,^v behavior? For instance enable "if ^F,^V are pressed, first ^V is omitted.
No there's no way to do that. The whole point is this way is more efficient.
Your claim about "most programs" and "conventional behaviour" is spurious. Most that I use will default to searching the text on the clipboard, if there isn't already text selected in the current window.
When searching for a String in Intellij's console, you have to type the word you are looking for in a special input. But as soon as you begin typing, intellij is beginning to parse the whole console log which can be huge (it can freeze the whole IDE), and it starts to look for the first letter typed.
So if you want to search for "WARN", it begins to look for "W" for no reason. Is there a way to have a manual "start search" in intellij console and to disable the "auto-search" on typing in search box? That way I would just type the whole word and then search for it in the log, as the word is more restrictive the search would not freeze intellij.
I found how to bypass auto-search, use a text editor (notepad++, scite...) then type in it what you want to look for. Copy it to the clipboard. Paste then in the search box instead of all characters in it (use ctrl+a to select all, then paste).
Intellij will take the paste event as an unique event (not a succession of many keyboard events).
I have comments that gets balloon (PEP 8: Line too long ... > 120)
I wish there was a command that will wrap the lines with few keystrokes.
Right now, even if I type Alt+Enter and press enter on Reformat file, nothing actually changes. Is there a setting or plugin I could use to accomplish the formatting easily?
Under the Edit menu, there is a Fill Paragraph option, which does what I believe you want. You can assign a key command to this in Preferences, under Appearance & Behavior -> Keymap (search for "fill").
Personally, I choose first stroke Esc, second stroke Q, because that's what I've always used in Emacs...
Firstly, reformatting won't work, not in Python at least, where whitespace is important. PyCharm's "Wrap when typing reaches right margin" option is what you're looking for. Now this will not work when you copy and paste code, but in the places where it gives you trouble, just press enter, and it will work.
To be able to auto-reformat comments (and code, for that matter) to honor a right margin after the fact, go into Project Settings under Code Style and then further under Python. Click the Wrapping and Braces tab, and check the "Ensure right margin is not exceeded" checkbox.
Now if you select a region of lines and then run the Code/Reformat Code... command, PyCharm will do its best to wrap the comments or code appropriately.
You will probably have to do some tweaking of the results to suit your stylistic taste. For example, I wish PyCharm would do aggressive filling of text in block comments, at least optionally so.
PyCharm will not reformat code such that it becomes invalid Python, so sometimes it will still leave a line longer than the margin (120 or whatever you set under Project Settings/Code Style/General).
With recent PyCharm this now is located at "Editor -> Code Style", with the checkbox named "Wrap on typing"
The Screenshot shows PyCharm version 2016.2.1 Professional.
Updated Answer:
Use "soft wraps." You can search for it in the help bar.
View > Active Editor > Use Soft Wraps
It won't work for existing text or text that's copied in, but will for any newly typed text.
Due to automatic code completion, I regularly find myself in between parentheses, having to get to the end of a line to add the inevitable semicolon.
Then I have to get my right hand up, move it to the right, hit End, and come back to the main part of the keyboard again to enter the semicolon.
I perceive this as disturbing to my flow of typing, especially when writing on a notebook, as then those moves of my hand are very inefficient.
Is there already a key combination for reaching the end of a line, or adding a semicolon, within the main keyboard area? Or is it possible to configure PhpStorm in those regards?
(I'm using PhpStorm, but I added the IntelliJ IDEA tag to this question as I guess they would be similar regarding those basic features.)
More efficiently: invoke Edit | Complete Current Statement (Ctrl+Shift+Enter) to automatically insert semicolon at end of line and start new line.
You can assign any keyboard shortcut to the Move Caret to Line End action in Settings | Keymap.
You need to try touchcursor. I just love it.