19

When you open an existing text file in gedit, the cursor starts at the position it was at when you last closed the file. So gedit presumably needs to store a list of inodes and offsets.

I'm curious as to where this information is stored since I can't find it in ~/.config/gedit

3

2 Answers 2

26

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
12

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

1
  • Thanks. Apparently there are command line tools for working with gvfs. See the edit to my question.
    – CrazyApe84
    Aug 14, 2017 at 0:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.