How to make phpstorm display line numbers by default? - ide

How to make phpstorm display line numbers by default?
Couldn't find that option. It's kind of annoying to turn them on manually for each page.

Settings (or Preferences if you are on Mac) | Editor | General | Appearance and check Show line numbers.

Just now found where is it on Windows. Its View -> Active Editor -> Show Line Numbers (changes only for current document) and File -> Settings -> Editor -> Appearance -> Show Line Numbers (for all documents)
For Mac Version go to PhpStorm -> Preferences in menu.
In the preference window go to IDE settings -> Editor -> Appearance -> Show Line Numbers (To change setting for all documents)
OR if you want to quickly set show line number PER CURRENT WINDOW even easier - right click on the long white column (where breakpoints are set) then select Show Line Numbers.
Red dot on the screenshot is a place where you have to click

All the guys are right. I am just bringing the the current soultion with the images.
Go to File-> Settings
In the box in the top right corner type in line numbers, just below that choose Editor->Appearance, from the right checkboxes, find Show line numbers and check it.
After that hit Apply and OK
That should do the trick.
My version of PhpStorm is 6.0.3

If you're on a Mac:
PhpStorm -> Preferences... -> Editor -> Appearance -> Show Line Numbers

just double tap 'Shift'
and search for 'Line Numbers'
and there you will see a toggle option on or off

In PHPStorm 8 this setting is no longer under 'Appearance' but now in:
File -> Settings -> Editor -> Appearance -> Show line numbers

Follow the below steps:
Click on File->Settings->
In the Settings dialog box Expand Editor under IDE Settings
Click Apperance - > select Show line numbers.
Click Apply->Ok.

Simplest solution for line numbers in php storm..There are many other solutions but i think A big picture a good from 1000 words.

File -> Settings -> Editor -> General -> Appearance
check "Show Line Numbers"
This is the current location as of phpStorm 8.0.2 on Ubuntu 14.04

Settings -> editor | appearance | Show line numbers

Just right click on left side where line numbers generally show, select "show line numbers"

In PHPStorm 2016: File > Settings > Editor > General > Appearance > check "Show line numbers"

By typing command + shift + A you will get a search prompt and write line numbers . Now you can trigger button on or off

For PhpStorm version 9 on Windows.
File→Settings→Editor→General→Appearence then check Show line numbers

in the top right corner is a search button type show line numbers and you will see a toggle option. this way you never have to do it yourself. :)

File->settings->IDE Settings->Editor->Appearance
And just check the "Show line numbers" works with 8.0.1

On the Mac version 8.0.1 has this setting here:
PhpStorm > Preferences > Editor (this is in the second section on the left - i.e. IDE Settings NOT Project Settings) > Appearance > Show line numbers

You should go to: File -> Settings -> Editor -> General -> Appearance -> Show Line Numbers

As of the latest version:
PhpStorm > Preferences.. > Editor > General > Appearance > Show line numbers

Related

How to change line width in IntelliJ (from 120 character)

I was wondering how I can change the line length in IntelliJ.
Since I use a pretty high resolution, I get that line that shows 120 characters straight through the middle of the screen. Can I change it from 120 to, say, 250?
IntelliJ IDEA 2018
File > Settings... > Editor > Code Style > Hard wrap at
IntelliJ IDEA 2016 & 2017
File > Settings... > Editor > Code Style > Right margin (columns):
You can alter the "Right margin" attribute in the preferences, which can be found via
File | Settings | Project Settings | Code Style - General
Right Margin (columns) In this text box, specify the number of columns
to be used to display pages in the editor.
Source: Jetbrains
It seems like Jetbrains made some renaming and moved settings around so the accepted answer is no longer 100% valid anymore.
Intellij 2018.3:
hard wrap - idea will automatically wrap the line as you type, this is not what the OP was asking for
visual guide - just a vertical line indicating a characters limit, default is 120
If you just want to change the visual guide from the default 120 to lets say 80 in my example:
Also you can change the color or the visual guide by clicking on the Foreground:
Lastly, you can also set the visual guide for all file types (unless specified) here:
It may be useful to notice that very good answers given above may not be enough. It is because of one more tick is required here:
Be aware that need to change both location:
File > Settings... > Editor > Code Style > "Hard Wrap at"
and
File > Settings... > Editor > Code Style > (your language) > Wrapping and Braces > Hard wrap at
I didn't understand why my this didn't work but I found out that this setting is now also under the programming language itself at:
'Editor' | 'Code Style' | < your language > | 'Wrapping and Braces' | 'Right margin (columns)'
Open .editorconfig in the root of your project (or create one if you don't have any) and add:
max_line_length = 80
The IDE should pick it up immediately (works in PhpStorm, developed by the same company). As a bonus, it can be committed to GIT and will stay consistent across different editors you may be using in the future. More info on .editorconfig.

How do I stop PyCharm from autocompleting class methods?

When I type:
def method(, PyCharm jumps in with def method(self):. I would like to disable this behaviour.
The option is located at:
Settings > Editor > Smart Keys > Insert Self...
EDIT: As of pycharm 2017.1 it's under File -> Settings -> Editor -> General -> Smart Keys
Go to File > Settings (or Ctrl+Alt+S) > [IDE Settings] > Editor > Code Completion.
The "Autopopup code completion" setting will determine if the popup opens automatically. Below it, the "Insert selected variant by typing dot, space, etc." is likely the setting you want to turn off.
In PyCharm 2017.1
File -> Settings -> Editor -> General -> Smart Keys -> "Insert 'self' when defining a method"

How to make IntelliJ IDEA insert a new line at every end of file?

How do I make IntelliJ IDEA insert a new line at every end of file,
so that GitHub doesn't complain for example?
Change your Editor settings:
Settings → Editor → General → Ensure line feed at file end on Save
For MAC users:
Preferences > Editor > General > Ensure every saved file ends with a line break
IntelliJ IDEA 2016.3
Approach 1
File > Settings... > Editor > General > Ensure line feed at file end on Save
Approach 2
Help > Find Action... (Ctrl+Shift+A) > type "Ensure line feed" > switch the toggle to ON (using the mouse click or Enter) for "Other: Ensure line feed at file end on Save" line
Possible alternative with a number of handy features is EditorConfig
Just submit an .editorconfig file to your repo
[*]
insert_final_newline = true
And it will work natively not only in Idea, but in all major IDEs (some require a plugin).
Now all team members would have same configuration, eol, eof, and no more tabs vs spaces :)
For Mac Users: IntelliJ Idea version 2020.2
Option1:
IntelliJ Idea -> Preferences -> General -> Ensure an empty line at the end of a file on save
Option2:
⬆️ + ⌘ + A or Or just click on Help from menu bar -> Find Action and then type Ensu and choose Ensure an empty line at the end of a file on save
General -> Save Files For IntelliJ IDEA 2020.
Check the Bottom Right Corner:
In latest versions of IntelliJ, the setting has been renamed to 'Ensure an empty line at the end of a file on save', and it has been moved under Setting>Editor>General>Save Files
This should have been a comment, but I wanted to add the screenshot as well so wrote as an answer.
As Rider (IDEA's cousin for .NET) is driving me crazy, this might be helpful for those writing C# as Ensure line feed at file end on Save alone won't work. It needs
File → Settings → Editor → Code Style → C# → Line Breaks and Wrapping → Line feed at end of file.
I don't remember changing it and I haven't imported any settings for sure, so I guess it's by default disabled.
With the IntelliJ Idea version 2020.3:
Go to File > Sttings > Editor > General > On Save
And then select/deselect "Ensure every saved file ends with a line break"
With the Intellij version 2022.3.1
Preferences (cmd + ,) > Editor > General > Ensure every saved file ends with a line break
Check, apply, and click ok
intellij

Force code formatter in IntelliJ to join lines

I'm trying to force IntelliJ to reformat the code the way Eclipse does it.
When I set a line width to e.g. 120 chars I would like IDE to join line that were broken up to multiple lines (e.g. because the line width was set to 80 chars).
I want to go from here:
int a = 1
+ 2;
To here:
int a = 1 + 2
Is it possible in IntelliJ? I'm looking for the appropriate setting in the formatter but cannot find it. Could someone tell me where I can find it?
This works for me in intellij 8 if i go to:
File -> Settings -> Code Style -> Wrapping -> Binary operations -> set to: 'Wrap if long' or 'Do not wrap'
Then CTRL-ALT-L to reformat the code
Menu -> Edit -> Join Lines (Ctrl+Shift+J)
If your code already contains inappropriate line breaks and you want the formatter to remove them during the reformat,
File -> Settings -> Code Style -> Wrapping and Braces ->
Keep When Formatting -> Line Breaks -> Untick
(at least on IntelliJ 15 based Editors)
For Intellij 2016.2.x I had to deselect this option in the Settings:
Then go back to your code and press CTRL-ALT-L

Show line numbers in Visual SlickEdit

Does anyone know how I can show line numbers in Visual SlickEdit? I can do this on a per file basis by doing View->Line Numbers, but I'd like to just set it as a mode in the editor and not have to do it for every file I open.
Thanks.
Do you want it for a specific file type?
You can do it for each language or all-languages
Tools->Options->Languages
Here you would select either 'All Languages' or a specific language (I just tried the 'all')
then you would select 'Line Numbers' on the right pane.
I've got SlickEdit 2007 (12.x), and AFAIK there's not a way to toggle line numbers for all files at once, but if you're only interested in a few different file types, you can turn on display of line numbers on a per-extension basis in the Display Line Numbers checkbox of the General tab of Tools > Options > File Extension Setup for each extension.
I'm using SlickEdit 2013 (v18.0.1.2 32-bit)
use
Tools -> Options -> Languages -> All Languages -> view
mark the check box line numbers
For SlickEdit Version 12.0.3.0 (Windows)
Tools -> Options -> File Extension Setup -> General (Tab)
You will see, Display line numbers check box
For SlickEdit 2012 (v17.0.2.0 64bit) (Linux)
Tools -> Options -> Languages -> Languages -> View
You will see, Line numbers check box