Where does gedit store the last cursor position?

Thanks to the answers/comments above, I now know that the gedit position is saved in the GNOME Virtual File System. In particular, it is in the file ~/.local/share/gvfs-metadata/home.

There are a bunch of command line tools for working with gvfs.

gvfs-cat            gvfs-mkdir          gvfs-rename
gvfs-copy           gvfs-monitor-dir    gvfs-rm
gvfs-info           gvfs-monitor-file   gvfs-save
gvfs-less           gvfs-mount          gvfs-set-attribute
gvfs-ls             gvfs-move           gvfs-trash
gvfs-mime           gvfs-open           gvfs-tree

The gedit position can be seen with:

gvfs-info FILENAME | grep metadata::gedit-position

It can be changed like this:

gvfs-set-attribute FILENAME metadata::gedit-position 42

There's a file in ~/.local/share/gvfs-metadata which gets touched every time you move the cursor and close gedit. It's a binary file, so not easily interpreted. You can probably understand it better with the gedit source code

Tags:

Gedit