mirror of
https://github.com/Lissy93/dotfiles.git
synced 2025-06-28 21:01:20 +02:00
Updates ZSH scripts
This commit is contained in:
parent
efecd0b986
commit
300f426b15
@ -1,9 +1,5 @@
|
|||||||
|
|
||||||
# ~/.zlogin
|
# ~/.zlogin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Compile .zcompdump file, if modified, to increase startup speed
|
# Compile .zcompdump file, if modified, to increase startup speed
|
||||||
# Executed on startin the background, so won't afftect current session
|
# Executed on startin the background, so won't afftect current session
|
||||||
# Credit @htr3n. More info: https://htr3n.github.io/2018/07/faster-zsh/
|
# Credit @htr3n. More info: https://htr3n.github.io/2018/07/faster-zsh/
|
||||||
|
@ -16,7 +16,7 @@ export PAGER="less"
|
|||||||
|
|
||||||
## Respect XDG directories
|
## Respect XDG directories
|
||||||
export ADOTDIR="${XDG_CACHE_HOME}/zsh/antigen"
|
export ADOTDIR="${XDG_CACHE_HOME}/zsh/antigen"
|
||||||
# export ANTIGEN_LOG="${XDG_CACHE_HOME}/zsh/antigen"
|
export OPENSSL_DIR="/usr/local/ssl"
|
||||||
export ANTIBODY_HOME=${XDG_DATA_HOME}/antibody
|
export ANTIBODY_HOME=${XDG_DATA_HOME}/antibody
|
||||||
export CARGO_HOME="${XDG_DATA_HOME}/cargo"
|
export CARGO_HOME="${XDG_DATA_HOME}/cargo"
|
||||||
export DOCKER_CONFIG="${XDG_CONFIG_HOME}/docker"
|
export DOCKER_CONFIG="${XDG_CONFIG_HOME}/docker"
|
||||||
|
@ -34,9 +34,12 @@ source ${utils_dir}/matrix.sh
|
|||||||
source ${utils_dir}/hr.sh
|
source ${utils_dir}/hr.sh
|
||||||
source ${utils_dir}/web-search.sh
|
source ${utils_dir}/web-search.sh
|
||||||
source ${utils_dir}/am-i-online.sh
|
source ${utils_dir}/am-i-online.sh
|
||||||
|
source ${utils_dir}/welcome-banner.sh
|
||||||
|
|
||||||
# Left over tasks
|
# Left over tasks
|
||||||
source ${zsh_dir}/helpers/misc-stuff.zsh
|
source ${zsh_dir}/helpers/misc-stuff.zsh
|
||||||
|
|
||||||
# Import P10k config for command prompt, run `p10k configure` or edit
|
# Import P10k config for command prompt, run `p10k configure` or edit
|
||||||
[[ ! -f ${zsh_dir}/.p10k.zsh ]] || source ${zsh_dir}/.p10k.zsh
|
[[ ! -f ${zsh_dir}/.p10k.zsh ]] || source ${zsh_dir}/.p10k.zsh
|
||||||
|
|
||||||
|
welcome
|
||||||
|
@ -3,8 +3,19 @@ command_exists () {
|
|||||||
hash "$1" 2> /dev/null
|
hash "$1" 2> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Frequently used basics
|
||||||
|
alias a='alias'
|
||||||
|
alias c='clear'
|
||||||
|
alias e='exit'
|
||||||
|
alias f='find'
|
||||||
|
alias l='ls'
|
||||||
|
alias m='man'
|
||||||
|
alias p='pwd'
|
||||||
|
alias s='sudo'
|
||||||
|
alias t='touch'
|
||||||
|
alias v='vim'
|
||||||
|
|
||||||
# File listing options
|
# File listing options
|
||||||
alias l='ls' # Quick ls
|
|
||||||
alias la='ls -A' # List all files/ includes hidden
|
alias la='ls -A' # List all files/ includes hidden
|
||||||
alias ll='ls -lAFh' # List all files, with full details
|
alias ll='ls -lAFh' # List all files, with full details
|
||||||
alias lm='ls -tA -1' # List files sorted by last modified
|
alias lm='ls -tA -1' # List files sorted by last modified
|
||||||
@ -24,6 +35,60 @@ if command_exists exa ; then
|
|||||||
alias tree='f() { exa -aF --tree -L=${1:-2} --icons };f'
|
alias tree='f() { exa -aF --tree -L=${1:-2} --icons };f'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# List contents of packed file, depending on type
|
||||||
|
ls-archive () {
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "No archive specified"
|
||||||
|
return;
|
||||||
|
fi
|
||||||
|
if [[ ! -f $1 ]]; then
|
||||||
|
echo "File not found"
|
||||||
|
return;
|
||||||
|
fi
|
||||||
|
ext="${1##*.}"
|
||||||
|
if [ $ext = 'zip' ]; then
|
||||||
|
unzip -l $1
|
||||||
|
elif [ $ext = 'rar' ]; then
|
||||||
|
unrar l $1
|
||||||
|
elif [ $ext = 'tar' ]; then
|
||||||
|
tar tf $1
|
||||||
|
elif [ $ext = 'tar.gz' ]; then
|
||||||
|
echo $1
|
||||||
|
elif [ $ext = 'ace' ]; then
|
||||||
|
unace l $1
|
||||||
|
else
|
||||||
|
echo "Unknown Archive Format"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
alias lz='ls-archive'
|
||||||
|
|
||||||
|
# Make directory, and cd into it
|
||||||
|
mkcd() {
|
||||||
|
local dir="$*";
|
||||||
|
local mkdir -p "$dir" && cd "$dir";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Make dir and copy
|
||||||
|
mkcp() {
|
||||||
|
local dir="$2"
|
||||||
|
local tmp="$2"; tmp="${tmp: -1}"
|
||||||
|
[ "$tmp" != "/" ] && dir="$(dirname "$2")"
|
||||||
|
[ -d "$dir" ] ||
|
||||||
|
mkdir -p "$dir" &&
|
||||||
|
cp -r "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Move dir and move into it
|
||||||
|
mkmv() {
|
||||||
|
local dir="$2"
|
||||||
|
local tmp="$2"; tmp="${tmp: -1}"
|
||||||
|
[ "$tmp" != "/" ] && dir="$(dirname "$2")"
|
||||||
|
[ -d "$dir" ] ||
|
||||||
|
mkdir -p "$dir" &&
|
||||||
|
mv "$@"
|
||||||
|
}
|
||||||
|
|
||||||
# Getting outa directories
|
# Getting outa directories
|
||||||
alias c~='cd ~'
|
alias c~='cd ~'
|
||||||
alias c.='cd ..'
|
alias c.='cd ..'
|
||||||
@ -42,6 +107,7 @@ alias ff='find . -type f -name' # Find a file by name within current directory
|
|||||||
# Command line history
|
# Command line history
|
||||||
alias h='history' # Shows full history
|
alias h='history' # Shows full history
|
||||||
alias h-search='fc -El 0 | grep' # Searchses for a word in terminal history
|
alias h-search='fc -El 0 | grep' # Searchses for a word in terminal history
|
||||||
|
alias top-history='history 0 | awk '{print $2}' | sort | uniq -c | sort -n -r | head'
|
||||||
|
|
||||||
# Clearing terminal
|
# Clearing terminal
|
||||||
if command_exists hr ; then
|
if command_exists hr ; then
|
||||||
@ -73,29 +139,32 @@ alias as='alias | grep' # Search aliases
|
|||||||
alias ar='unalias' # Remove given alias
|
alias ar='unalias' # Remove given alias
|
||||||
|
|
||||||
# System Monitoring
|
# System Monitoring
|
||||||
alias meminfo='free -m -l -t'
|
alias meminfo='free -m -l -t' # Show free and used memory
|
||||||
alias psmem='ps auxf | sort -nr -k 4' # Show top memory eater
|
alias memhog='ps -eo pid,ppid,cmd,%mem --sort=-%mem | head' # Processes consuming most mem
|
||||||
alias psmem10='ps auxf | sort -nr -k 4 | head -10' # Top 10 memory eaters
|
alias cpuhog='ps -eo pid,ppid,cmd,%cpu --sort=-%cpu | head' # Processes consuming most cpu
|
||||||
alias pscpu='ps auxf | sort -nr -k 3' # Show top CPU eater
|
|
||||||
alias pscpu10='ps auxf | sort -nr -k 3 | head -10' # Top 10 CPU eaters
|
|
||||||
alias cpuinfo='lscpu' # Show CPU Info
|
alias cpuinfo='lscpu' # Show CPU Info
|
||||||
alias distro='cat /etc/*-release' # Show OS info
|
alias distro='cat /etc/*-release' # Show OS info
|
||||||
|
|
||||||
|
# App Specific
|
||||||
|
if command_exists code ; then
|
||||||
|
alias vsc='code .' # Open VS Code in current dir
|
||||||
|
fi
|
||||||
|
|
||||||
# Utilities
|
# Utilities
|
||||||
alias myip='curl icanhazip.com'
|
alias myip='curl icanhazip.com'
|
||||||
alias weather='curl wttr.in'
|
alias weather='curl wttr.in'
|
||||||
alias weather-short='curl "wttr.in?format=3"'
|
alias weather-short='curl "wttr.in?format=3"'
|
||||||
|
alias cheat='curl cheat.sh/'
|
||||||
|
alias tinyurl='curl -s "http://tinyurl.com/api-create.php?url='
|
||||||
alias ports='netstat -tulanp'
|
alias ports='netstat -tulanp'
|
||||||
if command_exists cointop ; then
|
if command_exists cointop ; then; alias crypto='cointop'; fi
|
||||||
alias crypto='cointop'
|
if command_exists gotop ; then; alias gto='gotop'; fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Random
|
# Random lolz
|
||||||
alias cls='clear;ls' # Clear and ls
|
alias cls='clear;ls' # Clear and ls
|
||||||
alias plz="fc -l -1 | cut -d' ' -f2- | xargs sudo" # Re-run last cmd as root
|
alias plz="fc -l -1 | cut -d' ' -f2- | xargs sudo" # Re-run last cmd as root
|
||||||
alias yolo='git add .; git commit -m "YOLO"; git push origin master'
|
alias yolo='git add .; git commit -m "YOLO"; git push origin master'
|
||||||
alias when='date' # Show date
|
alias when='date' # Show date
|
||||||
alias whereami='pwd'
|
alias whereami='pwd'
|
||||||
alias dog='cat'
|
alias dog='cat'
|
||||||
alias simonsays='sudo'
|
|
||||||
alias gtfo='exit'
|
alias gtfo='exit'
|
@ -245,3 +245,6 @@ open-github-pulls() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
alias ghp='open-github-pulls'
|
alias ghp='open-github-pulls'
|
||||||
|
|
||||||
|
# Prompt for main SSH key passphrase, so u don't need to enter it again until session killed
|
||||||
|
alias add-key='eval "$(ssh-agent)" && ssh-add ~/.ssh/id_rsa'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
# Aliases and helper functions for Node.js projects, including yarn, npm, nvm
|
# ZSH helper utils, and aliases for Node.js development (yarn, npn, nvm, node)
|
||||||
|
|
||||||
# Yarn - Project commands
|
# Yarn - Project commands
|
||||||
alias ys='yarn start'
|
alias ys='yarn start'
|
||||||
@ -29,49 +29,56 @@ reinstall_modules () {
|
|||||||
if read -q "choice?Remove and reinstall all node_modules? (y/N)"; then
|
if read -q "choice?Remove and reinstall all node_modules? (y/N)"; then
|
||||||
echo
|
echo
|
||||||
project_dir=$(pwd)
|
project_dir=$(pwd)
|
||||||
if [ -d "$project_dir/node_modules" ]; then
|
# Check file exists, remove it and print message
|
||||||
echo -e "\e[35mRemoveing node_modules...\e[0m"
|
check-and-remove() {
|
||||||
rm -rf "$project_dir/node_modules"
|
if [ -d "$project_dir/$1" ]; then
|
||||||
fi
|
echo -e "\e[35mRemoveing $1...\e[0m"
|
||||||
if [ -f "$project_dir/yarn.lock" ]; then
|
rm -rf "$project_dir/$1"
|
||||||
echo -e "\e[35mRemoveing yarn.lock...\e[0m"
|
|
||||||
rm "$project_dir/yarn.lock"
|
|
||||||
fi
|
|
||||||
if [ -f "$project_dir/package-lock.json" ]; then
|
|
||||||
echo -e "\e[35mRemoveing package-lock.json..."
|
|
||||||
rm "$project_dir/package-lock.json"
|
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
# Delete node_modules and lock files
|
||||||
|
check-and-remove 'node_modules'
|
||||||
|
check-and-remove 'yarn.lock'
|
||||||
|
check-and-remove 'package-lock.json'
|
||||||
|
# Reinstall with yarn (or NPM)
|
||||||
if hash 'yarn' 2> /dev/null; then
|
if hash 'yarn' 2> /dev/null; then
|
||||||
echo -e "\e[35mReinstalling with yarn...\e[0m"
|
echo -e "\e[35mReinstalling with yarn...\e[0m"
|
||||||
yarn
|
yarn
|
||||||
echo -e "\e[35mCleaning Up...\e[0m"
|
echo -e "\e[35mCleaning Up...\e[0m"
|
||||||
yarn autoclean
|
yarn autoclean
|
||||||
else
|
elif hash 'npm' 2> /dev/null; then
|
||||||
echo -e "\e[35mReinstalling with NPM...\e[0m"
|
echo -e "\e[35mReinstalling with NPM...\e[0m"
|
||||||
npm install
|
npm install
|
||||||
|
else
|
||||||
|
echo -e "🚫\033[0;91m Unable to proceed, yarn/ npm not installed\e[0m"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e "\n\e[35mAborting...\e[0m"
|
# Cancelled by user
|
||||||
|
echo -e "\n\033[0;91mAborting...\e[0m"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
alias yn='reinstall_modules'
|
alias yarn-nuke='reinstall_modules'
|
||||||
|
|
||||||
# Prints out versions of core Node.js packages
|
# Prints out versions of core Node.js packages
|
||||||
print_node_versions () {
|
print_node_versions () {
|
||||||
nreset='\033[0m'
|
|
||||||
versions=''
|
versions=''
|
||||||
get_version () {
|
get_version () {
|
||||||
if hash $1 2> /dev/null; then
|
if hash $1 2> /dev/null || command -v $1 >/dev/null; then
|
||||||
versions="$versions\e[36m\e[1m $2: \033[0m\033[3m$($1 --version)\n"
|
versions="$versions\e[36m\e[1m $2: \033[0m$($1 --version)\n\033[0m"
|
||||||
else
|
else
|
||||||
versions="$versions\e[33m\e[1m $2: \033[0m\033[3m Not installed\n"
|
versions="$versions\e[33m\e[1m $2: \033[0m\033[3m Not installed\n\033[0m"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
# Source NVM if not yet done
|
||||||
|
if typeset -f source_nvm > /dev/null && source_nvm
|
||||||
|
|
||||||
|
# Print versions of core Node things
|
||||||
get_version 'node' 'Node.js'
|
get_version 'node' 'Node.js'
|
||||||
get_version 'npm' 'NPM'
|
get_version 'npm' 'NPM'
|
||||||
get_version 'yarn' 'Yarn'
|
get_version 'yarn' 'Yarn'
|
||||||
get_version 'nvm' 'NVM'
|
get_version 'nvm' 'NVM'
|
||||||
|
get_version 'git' 'Git'
|
||||||
echo -e $versions
|
echo -e $versions
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,10 +97,17 @@ alias npmp='npm publish'
|
|||||||
# Location of NVM, will inherit from .zshenv if set
|
# Location of NVM, will inherit from .zshenv if set
|
||||||
NVM_DIR=${NVM_DIR:-$XDG_DATA_HOME/nvm}
|
NVM_DIR=${NVM_DIR:-$XDG_DATA_HOME/nvm}
|
||||||
|
|
||||||
# If NVM present, then import it
|
|
||||||
if [ -f "$nvm_location/nvm.sh" ]; then
|
# On first time using Node command, import NVM if present and not yet sourced
|
||||||
|
function source_nvm node npm yarn $NVM_LAZY_CMD {
|
||||||
|
if [ -f "$NVM_DIR/nvm.sh" ] && ! which nvm &> /dev/null; then
|
||||||
|
echo -e "\033[1;93mInitialising NVM...\033[0m"
|
||||||
source "${NVM_DIR}/nvm.sh"
|
source "${NVM_DIR}/nvm.sh"
|
||||||
|
nvm use default
|
||||||
fi
|
fi
|
||||||
|
unfunction node npm yarn source_nvm $NVM_LAZY_CMD
|
||||||
|
hash "$0" 2> /dev/null && command "$0" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
# Helper function to install NVM
|
# Helper function to install NVM
|
||||||
install_nvm () {
|
install_nvm () {
|
||||||
@ -125,3 +139,43 @@ alias nvmlr='nvm ls-remote'
|
|||||||
alias nvmlts='nvm install --lts && nvm use --lts'
|
alias nvmlts='nvm install --lts && nvm use --lts'
|
||||||
alias nvmlatest='nvm install node --latest-npm && nvm use node'
|
alias nvmlatest='nvm install node --latest-npm && nvm use node'
|
||||||
alias nvmsetup='install_nvm'
|
alias nvmsetup='install_nvm'
|
||||||
|
|
||||||
|
# Helper function that gets supported open method for system
|
||||||
|
launch-url() {
|
||||||
|
if hash open 2> /dev/null; then
|
||||||
|
open_command=open
|
||||||
|
elif hash xdg-open 2> /dev/null; then
|
||||||
|
open_command=xdg-open
|
||||||
|
elif hash lynx 2> /dev/null; then
|
||||||
|
open_command=lynx
|
||||||
|
else
|
||||||
|
echo -e "\033[0;33mUnable to launch browser, open manually instead"
|
||||||
|
echo -e "\033[1;96m🌐 URL: \033[0;96m\e[4m$1\e[0m"
|
||||||
|
return;
|
||||||
|
fi
|
||||||
|
echo $open_command
|
||||||
|
}
|
||||||
|
|
||||||
|
# Open Node.js docs, either specific page or show all
|
||||||
|
function node-docs {
|
||||||
|
local section=${1:-all}
|
||||||
|
launch-url "https://nodejs.org/docs/$(node --version)/api/$section.html"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Launches npmjs.com on the page of a specific module
|
||||||
|
open-npm () {
|
||||||
|
npm_base_url=https://www.npmjs.com
|
||||||
|
if [ $# -ne 0 ]; then
|
||||||
|
# Get NPM module name from user input
|
||||||
|
npm_url=$npm_base_url/package/$@
|
||||||
|
else
|
||||||
|
# Unable to get NPM module name, default to homepage
|
||||||
|
npm_url=$npm_base_url
|
||||||
|
fi
|
||||||
|
# Print messages
|
||||||
|
echo -e "\033[1;96m📦 Opening in browser: \033[0;96m\e[4m$npm_url\e[0m"
|
||||||
|
# And launch!
|
||||||
|
launch-url $npm_url
|
||||||
|
}
|
||||||
|
|
||||||
|
alias npmo='open-npm'
|
||||||
|
@ -2,3 +2,8 @@
|
|||||||
if hash thefuck 2> /dev/null; then;
|
if hash thefuck 2> /dev/null; then;
|
||||||
eval $(thefuck --alias)
|
eval $(thefuck --alias)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Fix default editor, for systems without nvim installed
|
||||||
|
if ! hash nvim 2> /dev/null; then
|
||||||
|
alias nvim='vim'
|
||||||
|
fi
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
zsh_dir=${XDG_CONFIG_HOME:-$HOME/.config}/zsh
|
zsh_dir=${XDG_CONFIG_HOME:-$HOME/.config}/zsh
|
||||||
antigen_dir=${ADOTDIR:-$XDG_DATA_HOME/zsh/antigen}
|
antigen_dir=${ADOTDIR:-$XDG_DATA_HOME/zsh/antigen}
|
||||||
|
antigen_git="https://raw.githubusercontent.com/zsh-users/antigen/master/bin/antigen.zsh"
|
||||||
|
|
||||||
antigen_bin="${ADOTDIR}/antigen.zsh"
|
antigen_bin="${ADOTDIR}/antigen.zsh"
|
||||||
|
|
||||||
@ -12,7 +13,7 @@ else
|
|||||||
if read -q "choice?Would you like to install Antigen now? (y/N)"; then
|
if read -q "choice?Would you like to install Antigen now? (y/N)"; then
|
||||||
echo
|
echo
|
||||||
mkdir -p $antigen_dir
|
mkdir -p $antigen_dir
|
||||||
curl -L git.io/antigen > $antigen_bin
|
curl -L $antigen_git > $antigen_bin
|
||||||
source $antigen_bin
|
source $antigen_bin
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -11,13 +11,160 @@ if type -p dircolors &>/dev/null; then
|
|||||||
eval "$(dircolors -b)"
|
eval "$(dircolors -b)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Colorize 'ls' command. Based on Oh My Zsh;
|
|
||||||
ls --color -d . &>/dev/null && alias ls='ls --color=tty' || { ls -G . &>/dev/null && alias ls='ls -G' }
|
|
||||||
|
|
||||||
|
# Add auto color to certain commands
|
||||||
alias vdir="vdir --color=auto" # Colorize 'vdir' command.
|
alias vdir="vdir --color=auto" # Colorize 'vdir' command.
|
||||||
|
|
||||||
alias grep="grep --color=auto -i" # Colorize 'grep' command and ignore case.
|
alias grep="grep --color=auto -i" # Colorize 'grep' command and ignore case.
|
||||||
alias fgrep="grep --color=auto -i" # Colorize 'fgrep' command and ignore case.
|
alias fgrep="grep --color=auto -i" # Colorize 'fgrep' command and ignore case.
|
||||||
alias egrep="grep --color=auto -i" # Colorize 'egrep' command and ignore case.
|
alias egrep="grep --color=auto -i" # Colorize 'egrep' command and ignore case.
|
||||||
|
|
||||||
alias diff="diff --color=auto" # Colorize 'diff' command.
|
alias diff="diff --color=auto" # Colorize 'diff' command.
|
||||||
|
|
||||||
|
# Color strings for basic file types
|
||||||
|
# FILE 01;34 # regular file
|
||||||
|
# RESET 0 # reset to "normal" color
|
||||||
|
# DIR 01;37 # directory
|
||||||
|
# LINK 01;36 # symbolic link
|
||||||
|
# MULTIHARDLINK 00 # reg file with more than one link
|
||||||
|
# FIFO 40;33 # pipe
|
||||||
|
# SOCK 01;35 # socket
|
||||||
|
# DOOR 01;35 # door
|
||||||
|
# BLK 40;33;01 # block device driver
|
||||||
|
# CHR 40;33;01 # character device driver
|
||||||
|
# ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ...
|
||||||
|
# MISSING 00 # ... and the files they point to
|
||||||
|
# SETUID 37;41 # file that is setuid (u+s)
|
||||||
|
# SETGID 30;43 # file that is setgid (g+s)
|
||||||
|
# CAPABILITY 30;41 # file with capability
|
||||||
|
# STICKY_OTHER_WRITABLE 01;42 # dir that is sticky and other-writable (+t,o+w)
|
||||||
|
# OTHER_WRITABLE 01;32 # dir that is other-writable (o+w) and not sticky
|
||||||
|
# STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
|
||||||
|
# EXEC 01;32 # Files with execute permission
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
# .cmd 01;32
|
||||||
|
# .exe 01;32
|
||||||
|
# .com 01;32
|
||||||
|
# .btm 01;32
|
||||||
|
# .bat 01;32
|
||||||
|
# .sh 01;32
|
||||||
|
# .csh 01;32
|
||||||
|
|
||||||
|
# Archives
|
||||||
|
# .tar 01;31
|
||||||
|
# .tgz 01;31
|
||||||
|
# .arc 01;31
|
||||||
|
# .arj 01;31
|
||||||
|
# .taz 01;31
|
||||||
|
# .lha 01;31
|
||||||
|
# .lz4 01;31
|
||||||
|
# .lzh 01;31
|
||||||
|
# .lzma 01;31
|
||||||
|
# .tlz 01;31
|
||||||
|
# .txz 01;31
|
||||||
|
# .tzo 01;31
|
||||||
|
# .t7z 01;31
|
||||||
|
# .zip 01;31
|
||||||
|
# .z 01;31
|
||||||
|
# .Z 01;31
|
||||||
|
# .dz 01;31
|
||||||
|
# .gz 01;31
|
||||||
|
# .lrz 01;31
|
||||||
|
# .lz 01;31
|
||||||
|
# .lzo 01;31
|
||||||
|
# .xz 01;31
|
||||||
|
# .zst 01;31
|
||||||
|
# .tzst 01;31
|
||||||
|
# .bz2 01;31
|
||||||
|
# .bz 01;31
|
||||||
|
# .tbz 01;31
|
||||||
|
# .tbz2 01;31
|
||||||
|
# .tz 01;31
|
||||||
|
# .deb 01;31
|
||||||
|
# .rpm 01;31
|
||||||
|
# .jar 01;31
|
||||||
|
# .war 01;31
|
||||||
|
# .ear 01;31
|
||||||
|
# .sar 01;31
|
||||||
|
# .rar 01;31
|
||||||
|
# .alz 01;31
|
||||||
|
# .ace 01;31
|
||||||
|
# .zoo 01;31
|
||||||
|
# .cpio 01;31
|
||||||
|
# .7z 01;31
|
||||||
|
# .rz 01;31
|
||||||
|
# .cab 01;31
|
||||||
|
# .wim 01;31
|
||||||
|
# .swm 01;31
|
||||||
|
# .dwm 01;31
|
||||||
|
# .esd 01;31
|
||||||
|
|
||||||
|
# Images
|
||||||
|
# .jpg 01;35
|
||||||
|
# .jpeg 01;35
|
||||||
|
# .mjpg 01;35
|
||||||
|
# .mjpeg 01;35
|
||||||
|
# .gif 01;35
|
||||||
|
# .bmp 01;35
|
||||||
|
# .pbm 01;35
|
||||||
|
# .pgm 01;35
|
||||||
|
# .ppm 01;35
|
||||||
|
# .tga 01;35
|
||||||
|
# .xbm 01;35
|
||||||
|
# .xpm 01;35
|
||||||
|
# .tif 01;35
|
||||||
|
# .tiff 01;35
|
||||||
|
# .png 01;35
|
||||||
|
# .svg 01;35
|
||||||
|
# .svgz 01;35
|
||||||
|
# .mng 01;35
|
||||||
|
# .pcx 01;35
|
||||||
|
# .mov 01;35
|
||||||
|
# .mpg 01;35
|
||||||
|
# .mpeg 01;35
|
||||||
|
# .m2v 01;35
|
||||||
|
# .mkv 01;35
|
||||||
|
# .webm 01;35
|
||||||
|
# .ogm 01;35
|
||||||
|
# .mp4 01;35
|
||||||
|
# .m4v 01;35
|
||||||
|
# .mp4v 01;35
|
||||||
|
# .vob 01;35
|
||||||
|
# .qt 01;35
|
||||||
|
# .nuv 01;35
|
||||||
|
# .wmv 01;35
|
||||||
|
# .asf 01;35
|
||||||
|
# .rm 01;35
|
||||||
|
# .rmvb 01;35
|
||||||
|
# .flc 01;35
|
||||||
|
# .avi 01;35
|
||||||
|
# .fli 01;35
|
||||||
|
# .flv 01;35
|
||||||
|
# .gl 01;35
|
||||||
|
# .dl 01;35
|
||||||
|
# .xcf 01;35
|
||||||
|
# .xwd 01;35
|
||||||
|
# .yuv 01;35
|
||||||
|
# .cgm 01;35
|
||||||
|
# .emf 01;35
|
||||||
|
# .ogv 01;35
|
||||||
|
# .ogx 01;35
|
||||||
|
|
||||||
|
# Audio
|
||||||
|
# .aac 00;36
|
||||||
|
# .au 00;36
|
||||||
|
# .flac 00;36
|
||||||
|
# .m4a 00;36
|
||||||
|
# .mid 00;36
|
||||||
|
# .go 00;33
|
||||||
|
# .php 00;33
|
||||||
|
# .midi 00;36
|
||||||
|
# .mka 00;36
|
||||||
|
# .mp3 00;36
|
||||||
|
# .mpc 00;36
|
||||||
|
# .ogg 00;36
|
||||||
|
# .ra 00;36
|
||||||
|
# .wav 00;36
|
||||||
|
# .oga 00;36
|
||||||
|
# .opus 00;36
|
||||||
|
# .spx 00;36
|
||||||
|
# .xspf 00;36
|
||||||
|
@ -46,6 +46,9 @@ autoload -Uz compinit
|
|||||||
# Enable extended globbing.
|
# Enable extended globbing.
|
||||||
setopt extendedglob
|
setopt extendedglob
|
||||||
|
|
||||||
|
# Allow SSH tab completion for mosh hostnames
|
||||||
|
compdef mosh=ssh
|
||||||
|
|
||||||
# Location for completions
|
# Location for completions
|
||||||
zcompdump="${XDG_CACHE_HOME:-${HOME}/.cache}/zsh/.zcompdump"
|
zcompdump="${XDG_CACHE_HOME:-${HOME}/.cache}/zsh/.zcompdump"
|
||||||
|
|
||||||
|
28
zsh/lib/expansions.zsh
Normal file
28
zsh/lib/expansions.zsh
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
# Expands all glob expressions, subcommands and aliases (including global)
|
||||||
|
# Inspired by: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/globalias
|
||||||
|
|
||||||
|
globalias() {
|
||||||
|
# Get last word to the left of the cursor, and split into array
|
||||||
|
local word=${${(Az)LBUFFER}[-1]}
|
||||||
|
# If matching alias found, then expand
|
||||||
|
if [[ $GLOBALIAS_FILTER_VALUES[(Ie)$word] -eq 0 ]]; then
|
||||||
|
zle _expand_alias
|
||||||
|
zle expand-word
|
||||||
|
fi
|
||||||
|
zle self-insert
|
||||||
|
}
|
||||||
|
|
||||||
|
# Make function availible
|
||||||
|
zle -N globalias
|
||||||
|
|
||||||
|
# space expands all aliases, including global
|
||||||
|
bindkey -M emacs " " globalias
|
||||||
|
bindkey -M viins " " globalias
|
||||||
|
|
||||||
|
# control-space to make a normal space
|
||||||
|
bindkey -M emacs "^ " magic-space
|
||||||
|
bindkey -M viins "^ " magic-space
|
||||||
|
|
||||||
|
# normal space during searches
|
||||||
|
bindkey -M isearch " " magic-space
|
Loading…
x
Reference in New Issue
Block a user