How do I clear the list of recently opened documents with gedit?
-
i tried a lot, could not success..i have downloaded the source code for gedit. there is one clue, but installing it is very hard.– PRATAPNov 3, 2018 at 9:39
-
github.com/GNOME/gedit/tree/master/gedit open it and check for the file gedit-recent.c if you open this file, there is one option called privacy it is set to FALSE, i tried to make it to TRUE and install it, but installing it manually is very hard.– PRATAPNov 3, 2018 at 9:40
-
askubuntu.com/q/407014/739431 if installing is easy, we can make changes into source code and try. but installing is very hard.– PRATAPNov 3, 2018 at 9:40
-
@PRATAP You spent some time on this question and thought you might like to see I posted an answer below.– WinEunuuchs2UnixMar 25, 2019 at 11:03
-
@WinEunuuchs2Unix sure, will have a look in sometime and revert back to you..– PRATAPMar 25, 2019 at 11:06
3 Answers
Permanent method to always set number of entries
I'm revising my answer with a variation of this GUI answer for command line users.
Use this command to get current number of entries:
$ gsettings get org.gnome.gedit.preferences.ui max-recents
uint32 5
I want to change to 10
so I'll use this command:
$ gsettings set org.gnome.gedit.preferences.ui max-recents 10
$ gsettings get org.gnome.gedit.preferences.ui max-recents
uint32 10
If you permanently want to have zero saved recent files change 10
to 0
. Notice how the get
command is repeated after the set
command to ensure it "sticks".
Manual method to remove entries
The gedit
most recent files list are stored in USER_DIR/.local/share/recently-used.xbel
.
Root User
$ sudo cat /root/.local/share/recently-used.xbel
<?xml version="1.0" encoding="UTF-8"?>
<xbel version="1.0"
xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"
xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info"
>
<bookmark href="file:///etc/default/grub" added="2018-08-03T19:25:50Z" modified="2018-12-27T17:03:38Z" visited="2018-08-03T19:25:51Z">
<info>
<metadata owner="http://freedesktop.org">
<mime:mime-type type="text/plain"/>
<bookmark:groups>
<bookmark:group>gedit</bookmark:group>
</bookmark:groups>
<bookmark:applications>
<bookmark:application name="gedit" exec="'gedit %u'" modified="2018-12-27T17:03:38Z" count="41"/>
</bookmark:applications>
</metadata>
</info>
</bookmark>
Normal User
$ cat ~/.local/share/recently-used.xbel
<?xml version="1.0" encoding="UTF-8"?>
<xbel version="1.0"
xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"
xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info"
>
<bookmark href="file:///home/rick/.conkyrc" added="2019-03-15T10:57:55Z" modified="2019-03-23T19:04:43Z" visited="2019-03-15T10:57:55Z">
<info>
<metadata owner="http://freedesktop.org">
<mime:mime-type type="text/plain"/>
<bookmark:groups>
<bookmark:group>gedit</bookmark:group>
</bookmark:groups>
<bookmark:applications>
<bookmark:application name="gedit" exec="'gedit %u'" modified="2019-03-23T19:04:43Z" count="50"/>
</bookmark:applications>
</metadata>
</info>
</bookmark>
When removing a gedit
entry delete all lines from <bookmark href...>
to </bookmark>
inclusive.
NOTE: Other applications store entries in this file, not just gedit
.
-
excellent.. can you please furthermore add the details on how to empty the said lines by running another script so that OP will run that script to clear his gedit history. I have just tried.. the part
<bookmark href...>
to</bookmark>
but it is not in a single place if multile files are opened other than gedit..– PRATAPMar 25, 2019 at 12:46 -
@Mogli Although a
sed
expert would have a nifty answer, I would simply edit the file and manually delete the lines. Apologies for my sloowwwww comment reply! Jul 1, 2019 at 18:06 -
In
vim
to remove<bookmark href...>
to</bookmark>
can be useddat
command (delete whole tag). Put cursor for example tobookmark
word and in normal mode enter:dat
. 3 hours ago
Edited:
In Terminal, type "dconf-editor" to start Configuration Editor. If it is not installed install by
sudo apt install dconf-editor
To delete search history: Navigate to
org > gnome > gedit > preferences > ui
change max-recent from 5 to 0.
-
Hi, I just tried but couldn't locate the gnome-settings in apps. Photo:imgur.com/X7TbFo7 Nov 1, 2018 at 9:29
-
Hi, edited the answer and tested it. Please try this one. Hope this helps Nov 1, 2018 at 13:08
-
Upvoting answer because I used it to increase most recent file list to 10 with:
gsettings set org.gnome.gedit.preferences.ui max-recents 10
. I found 5 far too few for my needs. I also gave credit to you in my own answer for usinggsettings
. Hope that is ok. Jul 1, 2019 at 18:15
for Ubuntu 20.04:
Run the following command in terminal:
$ dconf-editor
Navigate to /org/gnome/gedit/state/history-entry/search-for-entry
and change Custom value
to ['']