In 16.04 with Unity I have (gedit - Version 3.18.3) Which has the preference menu shown below:
As you can see, there are a number of useful options here, the one I miss the most is Display line numbers. This is unavailable on 18.04 with Gnome (gedit - Version 3.28.1) much to my annoyance as seen below.
Open Gedit and click the dropdown triangle to the right of where it says Text Editor in the upper left corner of the desktop next to Activities.
Select Preferences from the Text Editor dropdown menu.
In the Gedit Preferences window click the View tab.
In the Gedit Preferences window check the first option that says Display line numbers which is marked by the mouse cursor in the below screenshot.
Clicking ▾ + Display line numbers in the lower right corner displays line numbers for the tab that has focus only.
If you just want to display line numbers, click the cursor position indicator in the status bar at the bottom (which looks like "Ln x, Col y") and check "Display line numbers".
As mentioned in the answers by @vanadium and @karel, the "Preferences" option has been moved to the "App Menu" in the top bar next to "Activities". But if you wish you can bring it back to the application window using (GNOME) Tweaks to get a behaviour closer to the older release.
Launch Tweaks and go to the "Top Bar" section. Then toggle the "Application Menu" option OFF.
Then re-login or restart GNOME shell to be sure and you should see something like this:
The dialog you are looking for is now - confusingly - found under the App menu. That is the menu that appears when you click the application name in the top bar of the Ubuntu 18.04 desktop, which is an adapted version of the Gnome Shell desktop. It is designed to provide options that apply to application environment.
As you experienced yourself, the design might not be that fortunate. Rumours are that Gnome Shell developpers are planning to move that menu back inside the application window.
With some digging I discovered that the command
does the trick to turn the line numbers on. Other gedit preferences can also be adjusted. The command
will provide you with a list of options.
References:
https://howto8165.wordpress.com/2015/11/25/how-to-change-hidden-preferences-for-gedit/
configure gedit to always open in new window