fix some miscellanous issues

whole-command-tab-completion
bretello 2019-12-07 22:32:14 +01:00
parent 194ab3b920
commit 0860036eff
3 changed files with 36 additions and 36 deletions

View File

@ -82,5 +82,5 @@ fi
# dotfiles user aliases
if [[ -f ~/.dotfiles_aliases ]];
then
source ~/.dotfiles_aliases
source $HOME/.dotfiles_aliases
fi

View File

@ -58,12 +58,12 @@ if [[ $SSH_CLIENT ]]; then
fi
alias esource="$EDITOR $HOME/.zshrc"
alias resource="source $HOME/.zshrc"
alias dotedit="$EDITOR $DOTFILES/brethil_dotfile.sh"
alias esource='$EDITOR $HOME/.zshrc'
alias resource='source $HOME/.zshrc'
alias dotedit='$EDITOR $DOTFILES/brethil_dotfile.sh'
# Custom definitions files
alias funedit="$EDITOR ~/.dotfiles_functions.sh"
alias aledit="$EDITOR ~/.dotfiles_aliases.sh"
alias funedit='$EDITOR ~/.dotfiles_functions.sh'
alias aledit='$EDITOR ~/.dotfiles_aliases.sh'
# Extras
functions_file=$DOTFILES/functions.sh # Function definitions

View File

@ -21,7 +21,7 @@ function cheatall
# List all docker tags for an image
function dockertags
{
if [[ -z `which jq` ]]; then
if [[ -z $(command -v jq) ]]; then
echo "jq not installed. Please install jq." 1>&2
return
fi
@ -35,28 +35,30 @@ function dockertags
## Simple calculator. Usage: calc 1+1, calc 5/7, calc "sqrt(2)"
function calc
{
awk "BEGIN { print "$*" }"
awk "BEGIN { print $* }"
}
## Make new directory and cd to that directory. Usage: mcd newfolder
function mcd
{
mkdir -p $1
mkdir -p "$1"
cd $1
}
## Print full path of item in current directory
function ppath
{
echo $PWD/"$1"
echo "$PWD/$1"
}
## Color string with given color. Usage: color colorname "string", available colors in colors.sh
## Color string with given color. Usage: color $colorname "string", available colors in colors.sh
function color
{
color=$1
set -x
shift 1
printf "$color$@$CLEAR"
echo -e "$"$color"$@${CLEAR}\n"
set +x
}
@ -100,17 +102,19 @@ function pmusic
## Simple http server for current directory (or path)
function httpserver
{
cwd="$pwd"
if [[ -e $1 ]];
then
dir="$1"
else
dir="$pwd"
fi
cd "$dir"
sleep 0.1 && open "http://localhost:8000" &>/dev/null &
python -m SimpleHTTPServer
(
if [[ -d $1 ]]; then
cd "$1" && echo "Starting webserver in $(realpath $1)/" || echo "directory: $1 does not exist" >&2 || exit 1
else
echo "Starting webserver in $PWD/"
fi
open "http://localhost:8000" &>/dev/null &
if [[ $(python --version) == "Python 3"* ]]; then
python -m http.server 8000
else
python -m SimpleHTTPServer
fi
)
}
@ -169,7 +173,7 @@ fi
## List defined functions in $DOTFILES/functions.sh
function list_functions
{
cat $DOTFILES/functions.sh | grep --color=no -A 1 '^##' | sed -E 's/function (.*)/\1/g'
grep --color=no -A 1 '^##' $DOTFILES/functions.sh | sed -E 's/function (.*)/\1/g'
}
@ -194,9 +198,9 @@ function ramdisk
mydev=$(hdiutil attach -nomount ram://$NUMSECTORS )
# strip whitespace (hdiutil outputs a lot of spaces/tabs along with the device name)
mydev=$(echo "$mydev"| xargs echo)
newfs_hfs $mydev
newfs_hfs "$mydev"
mkdir -p "/tmp/$name"
mount -t hfs $mydev "/tmp/$name"
mount -t hfs "$mydev" "/tmp/$name"
echo "RAM Disk mounted: /tmp/$name"
echo "To eject (destroy) RAM disk, use:"
echo " $ diskutil eject $mydev"
@ -212,18 +216,14 @@ function man2pdf
function nman
{
if [ $# -eq 1 ] ; then
open x-man-page://$1 ;
open "x-man-page://$1"
elif [ $# -eq 2 ] ; then
open x-man-page://$1/$2 ;
open "x-man-page://$1/$2"
fi
}
fi # end of mac-specific functions
fi
# Force update git repo from origin/master
function gitupdate(){
git fetch --all
git reset --hard origin/master
}
### end of mac-specific functions
function pipupdate(){
for pip in pip2 pip3; do
@ -235,6 +235,6 @@ function pipupdate(){
}
# dotfiles user functions
if [[ -f ~/.dotfiles_functions ]]; then
source ~/.dotfiles_functions
if [[ -f $HOME/.dotfiles_functions ]]; then
source "$HOME/.dotfiles_functions"
fi