1.5.0 A lot of fixes,,

migration to zsh, more to come!
This commit is contained in:
2021-03-10 20:31:18 +00:00
parent 96011f7715
commit c58ec27adb
7 changed files with 206 additions and 69 deletions

74
zsh/.aliases Normal file
View File

@@ -0,0 +1,74 @@
#!/bin/zsh
# Easier navigation: .., ..., ...., ....., ~ and -
alias ..="cd .."
alias cd..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../.."
##* Colours!
alias ls="command ls --color=auto"
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
# Shortcuts
alias g="git"
alias h="history"
alias j="jobs"
# alternative to tail -f
alias lessf="less +F"
# List all files colorized in long format
alias l="ls -l"
alias ll="ls -lah"
# List all files colorized in long format, including dot files
alias la="ls -la"
# List only directories
alias lsd="ls -l | grep --color=never '^d'"
# Enable aliases to be sudoed
alias sudo='sudo '
# Get week number
alias week='date +%V'
# Stopwatch
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'
# Dice for the undecided
alias dice='echo $[ 1 + $RANDOM % 6 ]'
alias yn='[ $[ $RANDOM % 2 ] == 0 ] && echo "Yes" || echo "No"'
# IP addresses
alias myip="dig +short myip.opendns.com @resolver1.opendns.com"
alias localip="ifconfig wlan0 | grep 'inet addr' | cut -d ':' -f 2 | cut -d ' ' -f 1"
alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
# Canonical hex dump; some systems have this symlinked
command -v hd > /dev/null || alias hd="hexdump -C"
# URL-encode strings
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"'
# Ring the terminal bell
alias ding="tput bel"
# Intuitive map function
# For example, to list all directories that contain a certain file:
# find . -name .gitattributes | map dirname
alias map="xargs -n1"
# Reload the shell (i.e. invoke as a login shell)
alias reload="exec $SHELL -l"
# See if connection works
alias p="ping 1.1.1.1"
# Print each PATH entry on a separate line
alias path='echo -e ${PATH//:/\\n}'

34
zsh/.zshrc Normal file
View File

@@ -0,0 +1,34 @@
source ~/.zplug/init.zsh
source ~/.aliases
# Supports oh-my-zsh plugins and the like
zplug "plugins/git", from:oh-my-zsh
zplug "plugins/colored-man-pages", from:oh-my-zsh
zplug "plugins/command-not-found", from:oh-my-zsh
zplug "plugins/web-search", from:oh-my-zsh
zplug "plugins/tmux", from:oh-my-zsh
zplug "plugins/urltools", from:oh-my-zsh
zplug "oldratlee/hacker-quotes"
zplug "plugins/thefuck", from:oh-my-zsh
zplug "modules/prompt", from:prezto
# Load completion library for those sweet [tab] squares
zplug "lib/completion", from:oh-my-zsh
# Syntax highlighting for commands, load last
zplug "zsh-users/zsh-syntax-highlighting", from:github, defer:3
zplug "zsh-users/zsh-autosuggestions", defer:3
# Install plugins if there are plugins that have not been installed
if ! zplug check --verbose; then
printf "Install? [y/N]: "
if read -q; then
echo; zplug install
fi
fi
# Then, source plugins and add commands to $PATH
zplug load
prompt pure