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
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...
:
Click on the
+
sign in the lower left corner to create a new tool.Enter the name
Move temp files
.In the textarea in the upper right corner paste the program below.
Click into the input field for
Shortcut key
and press Ctrl+S.In the dropdown for
Save
selectCurrent Document
.In the dropdown for
Output
selectNothing
.#!/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"
-
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 toCtrl+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.)– phobicSep 9, 2016 at 16:06