commit 092ac432d31c09214aab7fdd2dd7e1480e933b8d
parent 6fcc0ad1588b59a73c269e0f1b80a13b3c29ae3b
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Sun, 19 Jan 2020 13:26:33 +0100
shell: reorganise aliases and functions
Former-commit-id: bca62889de24952987824c60c5ffbf6080784723
Diffstat:
2 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/shell/aliases b/shell/aliases
@@ -1,20 +1,17 @@
-alias c="clear"
-alias fucking="sudo"
-alias cp='cp -iv' # Preferred 'cp' implementation
-alias mv='mv -iv' # Preferred 'mv' implementation
-alias mkdir='mkdir -pv' # Preferred 'mkdir' implementation
-alias ls="ls -lh" # Preferred 'ls' implementation
-alias l="ls -lah" # Preferred 'ls -a' implementation
-alias ll="ls -FGlAhpO@" # Preferred detailed 'ls' implementation
-alias less='less -iRXc' # Preferred 'less' implementation
-alias du="du -skh" # Preferred 'du' implementation
-alias df="df -h" # Preferred 'df' implementation
-alias htop='sudo htop' # Top should launch htop with sudo
-alias g='git' # Make git easier to type
-alias wheredef='type -a' # Where is a function defined?
-alias lsblk="lsblk -o NAME,LABEL,PARTLABEL,TYPE,FSTYPE,SIZE,MOUNTPOINT,STATE"
-alias rmcolors="sed \"s,\x1B\[[0-9;]*[a-zA-Z],,g\"" # Remove ANSI color codes from text
-alias bc="bc -ql" # Preferred 'bc' implementation
-alias nls="expr \`ls -l | wc -l | xargs echo\` - 1" # Count the number of files in the directory
-alias tree="tree -CAFa -I 'CVS|*.*.package|.svn|.git|node_modules' --dirsfirst"
-alias eslint_here='docker run -it --rm -v $(pwd):/data cytopia/eslint . -f unix'
+alias fucking="sudo" # Because sometimes I'm frustrated
+alias cp='cp -iv' # Prompt if overwrite, verbose
+alias mv='mv -iv' # Prompt if overwrite, verbose
+alias mkdir='mkdir -pv' # Create intermediate dirs, verbose
+alias ls="ls -lh" # List in long format, human-readable sizes
+alias l="ls -lah" # Ls but with all files
+alias ll="ls -FGlAhpO@" # Ls but show everything you can
+alias less='less -iRXc' # Search ig case, fix ANSI colors, don't send init strings, clear screen
+alias du="du -skh" # Show entry for each file, show block counts in 1kb blocks, human-readable sizes
+alias df="df -h" # Show human-readable sizes
+alias bc="bc -ql" # Don't print welcome message, use the standard math lib
+alias jobs="jobs -l" # Show everything including PIDs
+alias htop='sudo htop' # Run htop as root by default
+alias g='git' # Make git easier to type
+alias wheredef='type -a' # Where is a function defined?
+alias tree="tree -CAFa -I 'CVS|*.*.package|.svn|.git|node_modules' --dirsfirst" # Colorize, ANSI graphics hack, indicate ft with appendices, print all files, ignore certain patterns, list dirs first
+alias lsblk="lsblk -o NAME,LABEL,PARTLABEL,TYPE,FSTYPE,SIZE,MOUNTPOINT,STATE" # The columns I want to see in lsblk
diff --git a/shell/functions b/shell/functions
@@ -6,7 +6,9 @@ procinfo() { ps aux | grep "$1"; } # ge
rmempty() { find "${1-.}" -type d -empty -depth -delete; } # remove empty directories
hr() { for ((i=0; i<$(tput cols); i++)); do echo -n "#"; done; echo; } # insert a <hr> in the terminal
vimq() { vim -q <($(fc -nl -1)); } # load results of last command (often ag) in vim quickfix
-gpip(){ PIP_REQUIRE_VIRTUALENV="" pip "$@"; }
+gpip(){ PIP_REQUIRE_VIRTUALENV="" pip "$@"; } # Access global pip while using virtualenvs
+nls() { expr `ls -l | wc -l | xargs echo` - 1; } # Count the number of files in the directory
+
notify() {
if type terminal-notifier &> /dev/null; then
terminal-notifier -title "$1" -message "$2" -activate com.googlecode.iterm2
@@ -43,6 +45,13 @@ extract () {
echo "'$1' is not a valid file"
fi
}
+
+if command -v docker &>/dev/null; then
+ eslint_here() {
+ docker run -it --rm -v $(pwd):/data cytopia/eslint . -f unix;
+ }
+fi
+
if command -v osascript &> /dev/null; then
# cd to current Finder directory
cdf() {