[SOLVED] Gedit is not remembering last cursor position
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
In my previous installation, gedit defaulted to open my files at the last cursor position. I just re-installed ubuntu 20.04 and gedit opens my files at the top of the document.
I found a thread which explains how to disable the feature with the following steps:
Code:
gconf-editor
apps
gedit-2
preferences
editor
cursor_position
restore_cursor_position = No
So I thought I could change the restore_cursor_position to Yes to solve my problem.
Unfortunately, when I install the gconf-editor, there is no gedit-2 option in the apps section.
I've tried other editors, but they do the same thing.
How do I get gedit to open my files at the last cursor position by default?
$ gsettings describe org.gnome.gedit.preferences.editor restore-cursor-position
Whether gedit should restore the previous cursor position when a file is loaded.
$ gsettings describe org.gnome.gedit.preferences.editor restore-cursor-position
Whether gedit should restore the previous cursor position when a file is loaded.
This looks promising. I'm running xfce so I think I should be using the dconf-editor and not the gconf-editor. I really am lost when it comes to this level of understanding linux.
I've been trying to figure out how to set that key (restore-cursor-position) to true. Or even how to display the current value of the key. I'm not even sure if it is a key. I'm a little lost.
I've been trying to decipher the man page for gsettings, but it just confuses me more.
I apologize for my ignorance, but this is how we learn things, right?
So my question is, what is the gsettings command to set restore-cursor-position to true.
Are you sure it's gedit you're using and not, say mousepad (which is part of default Xubuntu installation)?
I have a launcher on my panel that is set to open a specific file with gedit.
When I saw your post, I tried opening the file from the command line. I made some changes and went back in to the file the same way and it remembered the cursor position.
It turns out that my launcher was configured using sudo gedit and that is what was causing the problem. I have no idea why I would have done that to open a specific file which did not require super user privileges.
Problem solved.
But now that you know the root cause of this problem, do you know why opening gedit as a super user behaves differently?
gsettings changes settings for the current user, not for root.
I'm very sorry to have to report that the problem has resurfaced and this time I'm not opening gedit with the sudo command. Everything was working really well, and then, poof. It wasn't working well anymore. gedit is not remembering my last cursor position in changed files even when I open without the sudo command.
I was really happy for a minute. And now I'm back to relative sadness.
I guess you open files with gedit with and without su (or sudo). And [I guess] now the gedit config file is read only for the user and you even cannot configure it (because it is write protected and owned by root).
The only solution to this problem is to avoid doing it. (or actually you may try to make a workaround, but that looks extremely difficult to me).
I guess you open files with gedit with and without su (or sudo). And [I guess] now the gedit config file is read only for the user and you even cannot configure it (because it is write protected and owned by root).
The only solution to this problem is to avoid doing it. (or actually you may try to make a workaround, but that looks extremely difficult to me).
Sometimes I need to edit a file with sudo because it is a system file. I admit that when it comes to permissions on files I really don't have a clue.
Is there a way to restore the gedit config file to default settings? I uninstalled gedit and reinstalled it and it didn't make any difference. I also tried:
Code:
gsettings set org.gnome.gedit.preferences.editor restore-cursor-position true
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.