Skip to content

Instantly share code, notes, and snippets.

@djromero
Created February 2, 2017 15:42
Show Gist options
  • Save djromero/124bdf544bb1d6d5f98d6a40ac429907 to your computer and use it in GitHub Desktop.
Save djromero/124bdf544bb1d6d5f98d6a40ac429907 to your computer and use it in GitHub Desktop.
Simple shell script to move a file to ~/.Trash To invoke it in tig status view just pressing backspace.
#!/bin/sh
#
# Move a file to ~/.Trash safely in tig status view.
#
# Copy it somewhere in your PATH and add to ~/.tigrc:
#
# bind status <Backspace> !trash.sh "%(file)"
#
path=$1 && shift
date_prefix=$(date +'%Y%m%d.%H%M%S')
file_name=$(basename ${path})
/bin/mv -f "${path}" "${HOME}/.Trash/${date_prefix}-${file_name}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment