gt – script to create a temp file in gedit
I am really lazy with my editors. I have aliases in my shell configuration for gedit and vim that are very basic:
alias v="vim -p" # open in tab alias sv="sudo vim -p" alias g="bgcmd gedit" alias sg="bgcmd gksudo gedit"
This is very nice for me because I use my editors quite a bit. One thing I needed though was a command that would create and open a temporary file in gedit. The main reason for this is that at the time I don’t know how to name or place the file properly. Another reason is that at other times I like to have a scratchpad but would lose information if it was just a New File and a crash… happened.
gt will create and open a file named of the current time (MMDDhhmm) and will be saved in the trash folder. If
gt is followed by a name (e.g.
gt cssbox or
cssbox.css) the name will be appended to the current time.
The name is helpful if wanting to dig the file out of the trash folder at a later time.