Although I've never used gedit, its man page indicates it is
an X-window enabled file editor. You seem to be invoking
gedit from the command line and it is complaining about not being
able to open "display:".
The $DISPLAY environmental variable is used to tell gedit how
to connect to the X-window... I'm guessing it is not set...
...probably because you "ssh'ed" to your rpi.
(You can confirm it is not set by issuing
nano works because it is NOT an X-window enabled application.