1
0
mirror of https://github.com/amix/vimrc synced 2025-07-03 22:25:32 +08:00

Update vim-snippets.

This commit is contained in:
Kurtis Moxley
2022-05-19 22:57:32 +08:00
parent 421583d7d6
commit 5608a81ee4
24 changed files with 962 additions and 263 deletions

View File

@ -55,7 +55,7 @@ snippet go
done
# Set SCRIPT_DIR variable to directory script is located.
snippet sdir
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SCRIPT_DIR="\$( cd "\$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
# getopt
snippet getopt
__ScriptVersion="${1:version}"
@ -66,7 +66,7 @@ snippet getopt
#===============================================================================
function usage ()
{
echo "Usage : $${0:0} [options] [--]
echo "Usage : \$${0:0} [options] [--]
Options:
-h|help Display this message
@ -80,18 +80,18 @@ snippet getopt
while getopts ":hv" opt
do
case $opt in
case \$opt in
h|help ) usage; exit 0 ;;
v|version ) echo "$${0:0} -- Version $__ScriptVersion"; exit 0 ;;
v|version ) echo "\$${0:0} -- Version \$__ScriptVersion"; exit 0 ;;
* ) echo -e "\n Option does not exist : $OPTARG\n"
* ) echo -e "\\n Option does not exist : \$OPTARG\\n"
usage; exit 1 ;;
esac # --- end of case ---
done
shift $(($OPTIND-1))
shift \$(($OPTIND-1))
snippet root
if [ \$(id -u) -ne 0 ]; then exec sudo \$0; fi