Skip to content

Instantly share code, notes, and snippets.

@jpillora
Last active September 15, 2018 15:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jpillora/c95edc521c115bd8925599be18def294 to your computer and use it in GitHub Desktop.
Save jpillora/c95edc521c115bd8925599be18def294 to your computer and use it in GitHub Desktop.
install micro text editor from https://github.com/zyedidia/micro/releases
#!/bin/bash
#os check
case `uname -s` in
Darwin) OS="osx";;
Linux) OS="linux64";;
*) echo "unknown os: $(uname -s)" && exit 1;;
esac
#version check
echo -n "checking latest version... "
VER=`curl -sI https://github.com/zyedidia/micro/releases/latest | grep Location | sed "s~^.*tag\/v~~" | tr -d '\n' | tr -d '\r'`
if [ ! "$VER" ] ; then
echo "failed to find version"
exit 1
fi
echo "found ${VER}"
#building url
FILE="micro-${VER}-${OS}.tar.gz"
URL="https://github.com/zyedidia/micro/releases/download/v${VER}/${FILE}"
#download
PWD=`pwd`
DL=/tmp/microdl
echo "downloading: $URL" && \
mkdir -p $DL && curl -L -"#" $URL | tar zxf - -C $DL && \
cd $DL/micro-${VER}/ && \
chmod +x micro && \
((mv micro /usr/local/bin/micro > /dev/null 2>&1 && echo "installed micro to /usr/local/bin") || \
(mv micro $PWD/micro && echo "downloaded micro to $PWD")) && \
rm -rf $DL && \
mkdir -p ~/.config/micro &&
echo '{ "CtrlA": "StartOfLine", "CtrlE": "EndOfLine" }' > ~/.config/micro/bindings.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment