Skip to content

Instantly share code, notes, and snippets.

@bobrik
Created August 10, 2012 08:26
Show Gist options
  • Save bobrik/3312595 to your computer and use it in GitHub Desktop.
Save bobrik/3312595 to your computer and use it in GitHub Desktop.
rmate as $PAGER shell variable (instead of less or whatever you use)
#!/bin/sh
# EDITOR should be set to rmate
# Usage: git diff | rmatein
# First arg may be set to file extension to hint rmate about file type
if [ -n "${1}" ]; then
POSTFIX=".${1}"
fi
TMP_FILE=$( mktemp "/tmp/rmateXXXXXXXX${POSTFIX}" )
cat /dev/stdin | ansifilter > $TMP_FILE
$EDITOR $TMP_FILE
rm $TMP_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment