6

Looking for a way to put gedit's temporary tilde files in a different directory than the one I'm working in. Is there a way to do this?

1 Answer 1

0

This solution is based on the External Tools Plugin. It will automatically move the temporary file to a specific directory.

Edit->Preferences->Editor:

Disable Autosave files every X minutes if it is enabled.

Edit->Preferences->Plugins:

Enable External Tools.

Tools->Manage External Tools...:

  1. Click on the + sign in the lower left corner to create a new tool.

  2. Enter the name Move temp files.

  3. In the textarea in the upper right corner paste the program below.

  4. Click into the input field for Shortcut key and press Ctrl+S.

  5. In the dropdown for Save select Current Document.

  6. In the dropdown for Output select Nothing.

    #!/bin/bash
    # Moves the temporary backup file of the current document to a central directory.
    central_backup_dir="/tmp/gedit_tmp/" # Replace this with any directory you like.
    mkdir -p "$central_backup_dir"
    mv "${GEDIT_CURRENT_DOCUMENT_PATH}~" "$central_backup_dir"
    
1
  • gedit forgets the shortcut on restart. You have to manually assign a different shortcut key combination, close the Manage External Tools dialog and set it to Ctrl+s everytime you restart gedit. This seems to be a bug in gedit. (Now I remember why I did not propose this solution the first time I came across this question.)
    – phobic
    Sep 9, 2016 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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