I have a text file that looks like:
a=12
b=13
c=14
d =15
e = 16
f = 17
Some of the numbers have spaces after them. Some don't. Some have tabs etc.
It seems that when i am in InteliJ's editor any place i click on is well .. clickable.
How can i restrict it by actual line length?
Settings -> Editor -> Allow placement of caret after end of line.
You can set the global code style to do things like put spaces around the assignment operator, and then do a global "reformat code" by selected text, file, or entire project.
I use IntelliJ 12:
Related
I have a problem with PhpStorm. I'm talking about the line which divide code.
Sometimes I have too much characters in one line and this line move next characters to next line.
I prefer to use Ctrl + Alt + L to format code and this line destroy readability of code.
How can I move this line or even delete it?
You can try setting Hard wrap at value in Settings | Editor | Code Style | HTML to some big number and set Visual guides: accordingly. You can also try disabling Wrap text and setting Wrap attributes to Do not wrap.
Note that you can hide the hard wrap guide line by disabling Show hard wrap guide (configured in Code Style options) in Settings | Editor | General | Appearance, but hiding it won't prevent code from being wrapped (as #LazyOne mentioned in his comment)
I have this code for example:
$sql = Yii::$app->db->createCommand("UPDATE {{%users}} SET foo=:foo, bar=:bar");
Now if I go in and put my cursor just before SET and press enter, PHPStorm will place the code at the start of the next line. Is there anyway to get it to indent so it goes under the UPDATE or similar automatically?
I think you are looking for "Continuation indent".
You can set this parameter in Settings -> Editor -> Code Style -> (the language you want) -> Tabs and Indents -> Continuation Indent (set to number of spaces you want)
I am faced with the problem... I'm using ideavimrc where I have have set
set scrolloff=30
Is it possible to set in IDEA VIM like blank lines after the last line so that my text will be ~ at the center even when the cursor is at the end of the line. See the picture...
You can try checkbox in Preferences -> Editor -> General -> Show virtual space at file bottom.
I occasionally need to go line-by line and change the indentation of the code.
Is there a shortcut in Pycharm where I can add spaces (format the indent) in the begining of multiple lines simultaneously without processing each line individually?
Highlight/ select the lines you want indented, then press TAB as often as needed until they reach the proper indent level.
You can remove spaces with SHIFT TAB.
You can also use CTRL+ALT+I to auto-indent the selection.
Select the block that you want to indent then press TAB. It will work.
To auto indent all the codes in Pycharm just press these sequencies:
CTR + A to select all the text files and then press
CTRL+ALT+I
Select all that you want to indent, then do CTRL+ALT+I to indent all of it. This should work in Pycharm
Use shift +alt on windows machine
Continuation indent for Mac pro: Preferences -> Editor -> Code Style -> the language -> Tabs and Indents
If Ctrl + ALT + I is not working and every time needs to press the Insert button to get the pointer.
So go to Tools -> Select Vim if it is checked then it will be disabled.
Now you can intend code directly selecting multiple lines.
Is it possible to remove empty/blank lines using code formatting in Intellij IDEA?
Yes. It is possible to configure the number of blank lines in the settings menu (CTRL+ATL+S): File -> Settings -> Editor -> Code Style -> Java(or Scala or whatever your language is) -> Blank Lines
File >> Setting >> Editor >> Code style java >>Blank lines tab
You should change to 0 in code label(as picture), It would remove all unnecessary blank line when press format shortcut: ctrl + alt + L
You can find and replace with regex option also ^(?:[\t ]*(?:\r?\n|\r))+. It searches all empty lines in file. You need to just replace it with empty
I use regular expressions to remove extra blank lines from the code. Here are the instructions.
Open Find and Replace dialog. Use shortcut CTRL+SHIFT+R.
In the search box type ^(?:[\t ]*(?:\r?\n|\r)){2,}. This will search for two ore more blank lines.
In a replace box type \n. This will replace with one blank line.
Open Reformat Code dialog and click Run. Use shortcut CTRL+ALT+L.
This works on all JetBrains IDEs. Use the screenshot as referece.
Just in case it helps someone using newer versions of Intellij, in Intellij IDEA 2016.2.4 it is File -> Other Settings -> Default Settings -> Editor -> Code Style -> Java(or Scala or whatever your language is) -> Blank Lines
For those trying to remove blank lines at the end of the file, this became a feature as of August 2020.
The proper place to configure this action is under Settings|Editor|General|On Save. Check "Remove trailing blank lines"