zsh: Remove all
parent
512d0656e5
commit
f433e11586
|
@ -60,9 +60,8 @@ Xft.rgba: rgb
|
||||||
!! http://xcolors.net/dl/derp
|
!! http://xcolors.net/dl/derp
|
||||||
!! https://bbs.archlinux.org/viewtopic.php?id=51818
|
!! https://bbs.archlinux.org/viewtopic.php?id=51818
|
||||||
|
|
||||||
!! Color order is as listed in .shell.d/colors_rc. Bright values are all
|
!! Bright values are all canonical colors except for blue and black which are
|
||||||
!! canonical colors except for blue and black which are not bright enough on a
|
!! not bright enough on a black background.
|
||||||
!! black background.
|
|
||||||
URxvt.background: black
|
URxvt.background: black
|
||||||
URxvt.foreground: white
|
URxvt.foreground: white
|
||||||
URxvt.color0 : black
|
URxvt.color0 : black
|
||||||
|
|
2
.bashrc
2
.bashrc
|
@ -28,7 +28,7 @@
|
||||||
## Enable color support of ls.
|
## Enable color support of ls.
|
||||||
if [ "$TERM" != "dumb" ]; then
|
if [ "$TERM" != "dumb" ]; then
|
||||||
if [ "$OSTYPE" = "linux-gnu" ]; then
|
if [ "$OSTYPE" = "linux-gnu" ]; then
|
||||||
eval "$(dircolors "$HOME/.shell.d/dircolorsdb")"
|
eval "$(dircolors "$HOME/.dircolorsdb")"
|
||||||
else
|
else
|
||||||
export LSCOLORS="Ex"
|
export LSCOLORS="Ex"
|
||||||
# export LSCOLORS="ExfxcxDxCxdxdxCxCxECEh"
|
# export LSCOLORS="ExfxcxDxCxdxdxCxCxECEh"
|
||||||
|
|
|
@ -19,9 +19,6 @@
|
||||||
.ssh
|
.ssh
|
||||||
.texlive*
|
.texlive*
|
||||||
.wine
|
.wine
|
||||||
.zcompdump
|
|
||||||
.zdirs
|
|
||||||
.zshistfile
|
|
||||||
games*
|
games*
|
||||||
go
|
go
|
||||||
music*
|
music*
|
||||||
|
|
|
@ -370,4 +370,3 @@ zathura-djvu
|
||||||
zathura-pdf-poppler
|
zathura-pdf-poppler
|
||||||
zathura-ps
|
zathura-ps
|
||||||
zip
|
zip
|
||||||
zsh
|
|
||||||
|
|
3
.profile
3
.profile
|
@ -24,9 +24,6 @@ prependpath () {
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
## Common resources.
|
|
||||||
[ -d "$HOME/.shell.d" ] && export SHELL_DIR="$HOME/.shell.d"
|
|
||||||
|
|
||||||
## Mask
|
## Mask
|
||||||
## Result for 027 is: rwxr-x---
|
## Result for 027 is: rwxr-x---
|
||||||
umask 027
|
umask 027
|
||||||
|
|
|
@ -10,7 +10,6 @@ set -- "$HOME/.cache/awesome" \
|
||||||
"$HOME/.cache/emacs/saveplace" \
|
"$HOME/.cache/emacs/saveplace" \
|
||||||
"$HOME/.cache/mutt" \
|
"$HOME/.cache/mutt" \
|
||||||
"$HOME/.cache/qutebrowser" \
|
"$HOME/.cache/qutebrowser" \
|
||||||
"$HOME/.cache/zsh" \
|
|
||||||
"$HOME/.cmus/autosave" \
|
"$HOME/.cmus/autosave" \
|
||||||
"$HOME/.cmus/cache" \
|
"$HOME/.cmus/cache" \
|
||||||
"$HOME/.cmus/command-history" \
|
"$HOME/.cmus/command-history" \
|
||||||
|
|
|
@ -1,82 +0,0 @@
|
||||||
## -*- mode:sh -*- #
|
|
||||||
################################################################################
|
|
||||||
## Shell Config -- Alias Definitions.
|
|
||||||
|
|
||||||
## Warning: if this does not work if you change shell without relogging, use
|
|
||||||
## 'source .<shell>rc' instead.
|
|
||||||
## Note that 'ps -o command= $$' gives the same result with parameters.
|
|
||||||
if [ "zsh" = "$(ps -o comm= $$)" ]; then
|
|
||||||
alias ssrc='source ~/.zshrc'
|
|
||||||
fi
|
|
||||||
|
|
||||||
##==============================================================================
|
|
||||||
## General
|
|
||||||
|
|
||||||
## 'ls' redefinition
|
|
||||||
alias ls='ls -F'
|
|
||||||
|
|
||||||
## GNU extras.
|
|
||||||
if [ "$OSTYPE" = "linux-gnu" ]; then
|
|
||||||
alias ls='ls --color=auto -v --group-directories-first'
|
|
||||||
else
|
|
||||||
alias ls='ls -G'
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Listing aliases.
|
|
||||||
alias l='ls -1'
|
|
||||||
alias la='ls -lAh' # Hidden files
|
|
||||||
alias lc='ls -ltcrh' # Sort by change time
|
|
||||||
alias lk='ls -lSrh' # Sort by size
|
|
||||||
alias ll='ls -lh' # Detailed view with human readable values.
|
|
||||||
alias lx='ls -lXh' # Sort by extension
|
|
||||||
|
|
||||||
## Misc
|
|
||||||
alias grep='grep --color=auto'
|
|
||||||
|
|
||||||
## Prevents accidentally clobbering files.
|
|
||||||
alias mkdir='mkdir -p'
|
|
||||||
|
|
||||||
## Reset terminal -- Faster alternative of 'reset'.
|
|
||||||
alias cls='printf "\ec"'
|
|
||||||
|
|
||||||
##==============================================================================
|
|
||||||
## Pacman aliases
|
|
||||||
|
|
||||||
if command -v "pacman" >/dev/null 2>&1; then
|
|
||||||
# alias pc='sudo pacman -Sc'
|
|
||||||
alias pi='sudo pacman -S --needed'
|
|
||||||
alias pqi='pacman -Qi'
|
|
||||||
alias pqo='pacman -Qo'
|
|
||||||
alias pqs='pacman -Qs'
|
|
||||||
alias pr='sudo pacman -Rs'
|
|
||||||
alias psi='pacman -Si'
|
|
||||||
alias pss='pacman -Ss'
|
|
||||||
alias pu='yes | sudo pacman -Sc && sudo pacman -Syu'
|
|
||||||
fi
|
|
||||||
|
|
||||||
##==============================================================================
|
|
||||||
## FreeBSD aliases
|
|
||||||
|
|
||||||
if [ "$(uname)" = "FreeBSD" ]; then
|
|
||||||
alias pa='sudo pkg_add -r'
|
|
||||||
# alias pd='sudo pkg_delete'
|
|
||||||
alias pd='sudo pkg_deinstall -cd'
|
|
||||||
alias pi='pkg_info -RrcdsD -l "::"'
|
|
||||||
alias pil='pkg_info -L'
|
|
||||||
|
|
||||||
## Origin of file
|
|
||||||
alias piw='pkg_info -W'
|
|
||||||
|
|
||||||
## Search
|
|
||||||
alias pis='pkg_info -Qox'
|
|
||||||
# alias pvs='pkg_version -Is'
|
|
||||||
alias psr='pkg_search -r'
|
|
||||||
|
|
||||||
## Out-of-date packages.
|
|
||||||
alias pv='pkg_version -Il "<"'
|
|
||||||
|
|
||||||
## Port tree
|
|
||||||
alias mi='sudo make install'
|
|
||||||
alias mid='sudo make install distclean'
|
|
||||||
alias mc='sudo make config'
|
|
||||||
fi
|
|
|
@ -1,51 +0,0 @@
|
||||||
## -*- mode:sh -*- #
|
|
||||||
## Colors for universal support
|
|
||||||
|
|
||||||
Color_Reset='\e[0m'
|
|
||||||
|
|
||||||
## Style
|
|
||||||
Color_Bold='\e[1m'
|
|
||||||
Color_Underline='\e[4m'
|
|
||||||
Color_Blink='\e[5m'
|
|
||||||
Color_Reverse='\e[7m'
|
|
||||||
Color_Concealed='\e[8m'
|
|
||||||
|
|
||||||
## Foreground Regular
|
|
||||||
FR_Black='\e[30m'
|
|
||||||
FR_Red='\e[31m'
|
|
||||||
FR_Green='\e[32m'
|
|
||||||
FR_Yellow='\e[33m'
|
|
||||||
FR_Blue='\e[34m'
|
|
||||||
FR_Magenta='\e[35m'
|
|
||||||
FR_Cyan='\e[36m'
|
|
||||||
FR_White='\e[37m'
|
|
||||||
|
|
||||||
## Background Regular
|
|
||||||
BR_Black='\e[40m'
|
|
||||||
BR_Red='\e[41m'
|
|
||||||
BR_Green='\e[42m'
|
|
||||||
BR_Yellow='\e[43m'
|
|
||||||
BR_Blue='\e[44m'
|
|
||||||
BR_Magenta='\e[45m'
|
|
||||||
BR_Cyan='\e[46m'
|
|
||||||
BR_White='\e[47m'
|
|
||||||
|
|
||||||
## Foreground Bright
|
|
||||||
FB_Black='\e[90m'
|
|
||||||
FB_Red='\e[91m'
|
|
||||||
FB_Green='\e[92m'
|
|
||||||
FB_Yellow='\e[93m'
|
|
||||||
FB_Blue='\e[94m'
|
|
||||||
FB_Magenta='\e[95m'
|
|
||||||
FB_Cyan='\e[96m'
|
|
||||||
FB_White='\e[97m'
|
|
||||||
|
|
||||||
## Background Bright
|
|
||||||
BB_Black='\e[100m'
|
|
||||||
BB_Red='\e[101m'
|
|
||||||
BB_Green='\e[102m'
|
|
||||||
BB_Yellow='\e[103m'
|
|
||||||
BB_Blue='\e[104m'
|
|
||||||
BB_Magenta='\e[195m'
|
|
||||||
BB_Cyan='\e[106m'
|
|
||||||
BB_White='\e[107m'
|
|
|
@ -1,38 +0,0 @@
|
||||||
#compdef pcc
|
|
||||||
|
|
||||||
## Pacman custom completion
|
|
||||||
|
|
||||||
## Let's check if pacman completion is already loaded. If not, we parse the
|
|
||||||
## pacman completion file.
|
|
||||||
if type _pacman_action_none | grep -q "not found"; then
|
|
||||||
source "/usr/share/zsh/site-functions/_pacman"
|
|
||||||
fi
|
|
||||||
|
|
||||||
_pcc () {
|
|
||||||
case $words[1] in
|
|
||||||
pacsize)
|
|
||||||
case $words[2] in
|
|
||||||
-*)
|
|
||||||
return 1 ;;
|
|
||||||
*)
|
|
||||||
_pacman_action_sync
|
|
||||||
return ;;
|
|
||||||
esac
|
|
||||||
return ;;
|
|
||||||
*)
|
|
||||||
case $words[2] in
|
|
||||||
-*)
|
|
||||||
return 1 ;;
|
|
||||||
*)
|
|
||||||
_pacman_action_query
|
|
||||||
return ;;
|
|
||||||
esac
|
|
||||||
return ;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
_pcc "$@"
|
|
||||||
|
|
||||||
## Local Variables:
|
|
||||||
## mode: sh
|
|
||||||
## End:
|
|
|
@ -1,14 +0,0 @@
|
||||||
## -*- mode:sh -*- #
|
|
||||||
|
|
||||||
## Zsh
|
|
||||||
compdef _gcc crun
|
|
||||||
compdef _gs pdfcompress
|
|
||||||
compdef _gs pdfextract
|
|
||||||
compdef _gs pdfresize
|
|
||||||
compdef _pcc pacfiles
|
|
||||||
compdef _pcc pacsize
|
|
||||||
compdef _pcc pel
|
|
||||||
compdef _pcc pql
|
|
||||||
compdef _tex ltx
|
|
||||||
compdef _path_commands typex
|
|
||||||
compdef _pspdf zat
|
|
|
@ -1,177 +0,0 @@
|
||||||
## Colors codes: see colors_rc
|
|
||||||
|
|
||||||
## Filesystem
|
|
||||||
FIFO 1;33 # pipe
|
|
||||||
MULTIHARDLINK 1;37 # regular file with more than one link
|
|
||||||
|
|
||||||
## Archives or compressed (bright red)
|
|
||||||
.7z 91
|
|
||||||
.Z 91
|
|
||||||
.ace 91
|
|
||||||
.arj 91
|
|
||||||
.bz 91
|
|
||||||
.bz2 91
|
|
||||||
.cpio 91
|
|
||||||
.deb 91
|
|
||||||
.dz 91
|
|
||||||
.ear 91
|
|
||||||
.gz 91
|
|
||||||
.jar 91
|
|
||||||
.lz 91
|
|
||||||
.lzh 91
|
|
||||||
.lzma 91
|
|
||||||
.rar 91
|
|
||||||
.rpm 91
|
|
||||||
.rz 91
|
|
||||||
.sar 91
|
|
||||||
.tar 91
|
|
||||||
.taz 91
|
|
||||||
.tbz 91
|
|
||||||
.tbz2 91
|
|
||||||
.tgz 91
|
|
||||||
.tlz 91
|
|
||||||
.txz 91
|
|
||||||
.tz 91
|
|
||||||
.war 91
|
|
||||||
.xz 91
|
|
||||||
.z 91
|
|
||||||
.z 91
|
|
||||||
.zip 91
|
|
||||||
.zoo 91
|
|
||||||
|
|
||||||
## Disc image
|
|
||||||
.img 4;91
|
|
||||||
.iso 4;91
|
|
||||||
|
|
||||||
# Image formats (underlined yellow)
|
|
||||||
.bmp 4;33
|
|
||||||
.gif 4;33
|
|
||||||
.jpeg 4;33
|
|
||||||
.jpg 4;33
|
|
||||||
.mng 4;33
|
|
||||||
.pbm 4;33
|
|
||||||
.pcx 4;33
|
|
||||||
.pgm 4;33
|
|
||||||
.png 4;33
|
|
||||||
.ppm 4;33
|
|
||||||
.svg 4;33
|
|
||||||
.svgz 4;33
|
|
||||||
.tga 4;33
|
|
||||||
.tif 4;33
|
|
||||||
.tiff 4;33
|
|
||||||
.xbm 4;33
|
|
||||||
.xpm 4;33
|
|
||||||
|
|
||||||
## Image formats uppercase (underlined yellow)
|
|
||||||
## We treat the special case of uppercase files since a lot of cameras save
|
|
||||||
## their file this way.
|
|
||||||
.BMP 4;33
|
|
||||||
.GIF 4;33
|
|
||||||
.JPEG 4;33
|
|
||||||
.JPG 4;33
|
|
||||||
.MNG 4;33
|
|
||||||
.PBM 4;33
|
|
||||||
.PCX 4;33
|
|
||||||
.PGM 4;33
|
|
||||||
.PNG 4;33
|
|
||||||
.PPM 4;33
|
|
||||||
.SVG 4;33
|
|
||||||
.SVGZ 4;33
|
|
||||||
.TGA 4;33
|
|
||||||
.TIF 4;33
|
|
||||||
.TIFF 4;33
|
|
||||||
.XBM 4;33
|
|
||||||
.XPM 4;33
|
|
||||||
|
|
||||||
## Documents (yellow)
|
|
||||||
.0 33
|
|
||||||
.1 33
|
|
||||||
.2 33
|
|
||||||
.3 33
|
|
||||||
.4 33
|
|
||||||
.5 33
|
|
||||||
.6 33
|
|
||||||
.7 33
|
|
||||||
.8 33
|
|
||||||
.9 33
|
|
||||||
.dvi 33
|
|
||||||
.pdf 33
|
|
||||||
.ps 33
|
|
||||||
|
|
||||||
## Videos (bright magenta)
|
|
||||||
.asf 95
|
|
||||||
.avi 95
|
|
||||||
.cgm 95
|
|
||||||
.dl 95
|
|
||||||
.emf 95
|
|
||||||
.flc 95
|
|
||||||
.fli 95
|
|
||||||
.flv 95
|
|
||||||
.gl 95
|
|
||||||
.m2v 95
|
|
||||||
.m4v 95
|
|
||||||
.mkv 95
|
|
||||||
.mov 95
|
|
||||||
.mp4 95
|
|
||||||
.mp4v 95
|
|
||||||
.mpeg 95
|
|
||||||
.mpg 95
|
|
||||||
.nuv 95
|
|
||||||
.ogm 95
|
|
||||||
.qt 95
|
|
||||||
.rm 95
|
|
||||||
.rmvb 95
|
|
||||||
.vob 95
|
|
||||||
.webm 95
|
|
||||||
.wmv 95
|
|
||||||
.xcf 95
|
|
||||||
.xwd 95
|
|
||||||
.yuv 95
|
|
||||||
|
|
||||||
## Audio formats (underlined bright magenta)
|
|
||||||
.aac 4;95
|
|
||||||
.ape 4;95
|
|
||||||
.au 4;95
|
|
||||||
.flac 4;95
|
|
||||||
.mid 4;95
|
|
||||||
.midi 4;95
|
|
||||||
.mka 4;95
|
|
||||||
.mp3 4;95
|
|
||||||
.mpc 4;95
|
|
||||||
.ogg 4;95
|
|
||||||
.ra 4;95
|
|
||||||
.wav 4;95
|
|
||||||
|
|
||||||
## Text files (underlined white)
|
|
||||||
.log 4;37
|
|
||||||
.srt 4;37
|
|
||||||
.sub 4;37
|
|
||||||
.tex 4;37
|
|
||||||
.txt 4;37
|
|
||||||
|
|
||||||
## Web (underlined white)
|
|
||||||
.css 4;37
|
|
||||||
.htm 4;37
|
|
||||||
.html 4;37
|
|
||||||
.js 4;37
|
|
||||||
|
|
||||||
## Makefile (underlined cyan)
|
|
||||||
.in 4;36
|
|
||||||
.mk 4;36
|
|
||||||
|
|
||||||
## Programming (cyan)
|
|
||||||
.bash 36
|
|
||||||
.c 36
|
|
||||||
.cc 36
|
|
||||||
.cpp 36
|
|
||||||
.csh 36
|
|
||||||
.el 36
|
|
||||||
.h 36
|
|
||||||
.hh 36
|
|
||||||
.hpp 36
|
|
||||||
.ksh 36
|
|
||||||
.lua 36
|
|
||||||
.pl 36
|
|
||||||
.py 36
|
|
||||||
.sh 36
|
|
||||||
.zsh 36
|
|
156
.shell.d/funs_rc
156
.shell.d/funs_rc
|
@ -1,156 +0,0 @@
|
||||||
## -*- mode:sh -*- #
|
|
||||||
################################################################################
|
|
||||||
## Shell -- Functions.
|
|
||||||
|
|
||||||
## Functions that can be useful outside a shell (like in Emacs or Ranger) should
|
|
||||||
## be written in stand-alone scripts instead.
|
|
||||||
|
|
||||||
## Colored man pager.
|
|
||||||
man () {
|
|
||||||
# Justify man pager to current window size.
|
|
||||||
local width=$(tput cols)
|
|
||||||
[ $width -gt $MANWIDTH ] && width=$MANWIDTH
|
|
||||||
|
|
||||||
# mb = ?
|
|
||||||
# md = bold (titles, commands)
|
|
||||||
# so = status bar
|
|
||||||
# us = italic (arguments, files)
|
|
||||||
env \
|
|
||||||
MANWIDTH=$width \
|
|
||||||
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
|
||||||
LESS_TERMCAP_md=$(printf "\e[0;36m") \
|
|
||||||
LESS_TERMCAP_me=$(printf "\e[0m") \
|
|
||||||
LESS_TERMCAP_se=$(printf "\e[0m") \
|
|
||||||
LESS_TERMCAP_so=$(printf "\e[1;4;37m") \
|
|
||||||
LESS_TERMCAP_ue=$(printf "\e[0m") \
|
|
||||||
LESS_TERMCAP_us=$(printf "\e[0;33m") \
|
|
||||||
man "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
## Make directories and change into the first one.
|
|
||||||
mkcd () {
|
|
||||||
mkdir -p "$@"
|
|
||||||
cd "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
## Quick search. More flexible alternative: 'ff -di'.
|
|
||||||
search () {
|
|
||||||
find . -iname "*$1*"
|
|
||||||
}
|
|
||||||
|
|
||||||
## Vim-only: search the vim reference manual for a keyword.
|
|
||||||
## Usage: :h <keyword>
|
|
||||||
if command -v vim >/dev/null 2>&1; then
|
|
||||||
:h ()
|
|
||||||
{
|
|
||||||
vim --cmd ":silent help $@" --cmd "only";
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Extended info
|
|
||||||
typex () {
|
|
||||||
local xpath cmd
|
|
||||||
|
|
||||||
if [ $# -lt 1 ]; then
|
|
||||||
echo >&2 "Provide an existing command as parameter."
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
for i; do
|
|
||||||
cmd="$(command -v "$i" 2>/dev/null)"
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "$i: does not exist"
|
|
||||||
elif [ -z "$(echo "$cmd" | grep ^/)" ]; then
|
|
||||||
type "$i"
|
|
||||||
else
|
|
||||||
xpath="$(type "$i" | cut -d' ' -f3)"
|
|
||||||
ls -l "$xpath"
|
|
||||||
file "$xpath" | cut -d':' -f2 | cut -b 2-
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# Automatically change the directory in shell after closing ranger.
|
|
||||||
# Compatible with ranger >= 1.4.2.
|
|
||||||
#
|
|
||||||
# To undo the effect of this function, you can type "cd -" to return to the
|
|
||||||
# original directory.
|
|
||||||
browse () {
|
|
||||||
local tempfile="$(mktemp)"
|
|
||||||
ranger --choosedir="$tempfile" "${@:-$(pwd)}"
|
|
||||||
if [ -f "$tempfile" ] && [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then
|
|
||||||
cd -- "$(cat "$tempfile")"
|
|
||||||
fi
|
|
||||||
rm -f -- "$tempfile"
|
|
||||||
}
|
|
||||||
|
|
||||||
## Webcam testing with an mplayer-like player.
|
|
||||||
webcam () {
|
|
||||||
mpv --tv driver=v4l2:width=640:height=480:device=/dev/video0 tv://
|
|
||||||
}
|
|
||||||
|
|
||||||
##==============================================================================
|
|
||||||
## Pacman functions
|
|
||||||
|
|
||||||
if command -v pacman >/dev/null 2>&1; then
|
|
||||||
if command -v fzf >/dev/null 2>&1; then
|
|
||||||
pel() {
|
|
||||||
local result count
|
|
||||||
count=$#
|
|
||||||
while IFS= read -r i; do
|
|
||||||
set "$@" "$i"
|
|
||||||
done <<EOF
|
|
||||||
$(pacman -Qlq "$@" | grep -v "/$" | fzf)
|
|
||||||
EOF
|
|
||||||
shift $count
|
|
||||||
[ -n "$1" ] && $EDITOR "$@"
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Get detailed file list for the specified packages, omitting folders.
|
|
||||||
pql () {
|
|
||||||
pacman -Ql "$@" | grep -v "/$"
|
|
||||||
}
|
|
||||||
|
|
||||||
pli () {
|
|
||||||
expac -t '%F %T' '%-8l %n' | sort -rn | head -${1:-30}
|
|
||||||
}
|
|
||||||
|
|
||||||
pacfiles () {
|
|
||||||
pacman -Qlq "$@" | grep -v '/$' | xargs du -cbh | sort -h
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
##==============================================================================
|
|
||||||
## FreeBSD functions
|
|
||||||
|
|
||||||
if [ "$(uname)" = FreeBSD ]; then
|
|
||||||
## TODO: Useless FreeBSD function?
|
|
||||||
# mqs () {
|
|
||||||
# local str="$(echo "$@" | sed -E 's/[ \t]+/\\|/g')"
|
|
||||||
# (cd /usr/ports && make quicksearch name="$str")
|
|
||||||
# }
|
|
||||||
|
|
||||||
port-list () {
|
|
||||||
pkg_info | cut -f1 -d' '
|
|
||||||
}
|
|
||||||
|
|
||||||
port-size () {
|
|
||||||
pkg_info -Qsb "$@" | sed 's/\([^:]*\):\(.*\)/\2 KiB \1/g'
|
|
||||||
}
|
|
||||||
|
|
||||||
mcd () {
|
|
||||||
local DEST=$(pkg_search -r "$@" | head -n1 | awk '{print $2}')
|
|
||||||
cd -- "$DEST"
|
|
||||||
}
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
##==============================================================================
|
|
||||||
## Luarocks functions
|
|
||||||
|
|
||||||
if command -v luarocks >/dev/null 2>&1; then
|
|
||||||
lri () {
|
|
||||||
sudo sh -c 'umask 022 && luarocks install $0 $@' "$@"
|
|
||||||
}
|
|
||||||
fi
|
|
|
@ -1,69 +0,0 @@
|
||||||
## Zsh Key bindings
|
|
||||||
|
|
||||||
## References:
|
|
||||||
## http://mundy.yazzy.org/unix/zsh.php
|
|
||||||
## http://www.zsh.org/mla/users/2000/msg00727.html
|
|
||||||
|
|
||||||
## Bindings functions:
|
|
||||||
# backward-char
|
|
||||||
# backward-delete-char
|
|
||||||
# backward-delete-to-slash
|
|
||||||
# backward-word
|
|
||||||
# beginning-of-history # PageUp
|
|
||||||
# beginning-of-line # Home
|
|
||||||
# delete-char # Del
|
|
||||||
# down-line-or-history
|
|
||||||
# down-line-or-search
|
|
||||||
# emacs-backward-word
|
|
||||||
# emacs-forward-word
|
|
||||||
# end-of-history # PageDown
|
|
||||||
# end-of-line # End
|
|
||||||
# forward-char
|
|
||||||
# forward-word
|
|
||||||
# quoted-insert # Ins
|
|
||||||
# up-line-or-history
|
|
||||||
# up-line-or-search
|
|
||||||
# expand-or-complete-prefix ## completion in the middle of a line
|
|
||||||
|
|
||||||
## Emacs bindings
|
|
||||||
bindkey -e
|
|
||||||
|
|
||||||
## Set '/' as a word delimiter.
|
|
||||||
autoload -U select-word-style
|
|
||||||
select-word-style bash
|
|
||||||
|
|
||||||
## Portable key codes: you can use
|
|
||||||
# ${terminfo[<capname>]}
|
|
||||||
## or
|
|
||||||
# echotc <TCap Code>
|
|
||||||
## See terminfo(5)
|
|
||||||
|
|
||||||
## Note that double brackets are needed to expand wildcards properly.
|
|
||||||
if [[ $TERM = *xterm* ]] ; then
|
|
||||||
bindkey "\e[3~" delete-char
|
|
||||||
bindkey "\e[1;5D" backward-word
|
|
||||||
bindkey "\e[1;5C" forward-word
|
|
||||||
bindkey "\eOH" beginning-of-line
|
|
||||||
bindkey "\eOF" end-of-line
|
|
||||||
|
|
||||||
bindkey "\e[Z" reverse-menu-complete # Shift+Tab
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $TERM = *rxvt* ]] ; then
|
|
||||||
bindkey "^w" kill-region
|
|
||||||
bindkey "\e[3~" delete-char
|
|
||||||
bindkey "\eOd" backward-word
|
|
||||||
bindkey "\eOc" forward-word
|
|
||||||
bindkey "\e[5~" beginning-of-history
|
|
||||||
bindkey "\e[6~" end-of-history
|
|
||||||
bindkey "\e[7~" beginning-of-line
|
|
||||||
bindkey "\e[8~" end-of-line
|
|
||||||
|
|
||||||
bindkey -s "\e^B" "^A^Kbrowse\n"
|
|
||||||
|
|
||||||
bindkey "\e[Z" reverse-menu-complete # Shift+Tab
|
|
||||||
fi
|
|
||||||
|
|
||||||
## For FreeBSD console.
|
|
||||||
# bindkey "\e[H" beginning-of-line
|
|
||||||
# bindkey "\e[F" end-of-line
|
|
|
@ -1,135 +0,0 @@
|
||||||
## -*- mode:sh -*- #
|
|
||||||
## Zsh specific options
|
|
||||||
|
|
||||||
ZCACHE=~/.cache/zsh/
|
|
||||||
[ ! -e "$ZCACHE" ] && mkdir -p "$ZCACHE"
|
|
||||||
|
|
||||||
##==============================================================================
|
|
||||||
## History options
|
|
||||||
|
|
||||||
HISTFILE="$ZCACHE/history"
|
|
||||||
HISTSIZE=1000
|
|
||||||
SAVEHIST=1000
|
|
||||||
setopt hist_ignore_all_dups
|
|
||||||
setopt hist_ignore_space # Commands beginning with a space won't be recorded.
|
|
||||||
setopt appendhistory
|
|
||||||
|
|
||||||
##==============================================================================
|
|
||||||
## Misc
|
|
||||||
|
|
||||||
## Not recommended.
|
|
||||||
# setopt completealiases
|
|
||||||
|
|
||||||
setopt autocd # When only dirname is entered, then auto cd to it.
|
|
||||||
|
|
||||||
## ???
|
|
||||||
# setopt extendedglob nomatch notify
|
|
||||||
|
|
||||||
## Usually not needed if pc speaker is off.
|
|
||||||
unsetopt beep
|
|
||||||
|
|
||||||
## Turn of ^s so it does not freeze output.
|
|
||||||
unsetopt flowcontrol
|
|
||||||
|
|
||||||
##==============================================================================
|
|
||||||
## Directory stack
|
|
||||||
|
|
||||||
## We use expanded path for DIRSTACKFILE since we need to locate it for the
|
|
||||||
## zshcd script.
|
|
||||||
DIRSTACKFILE="$HOME/.cache/zsh/dirs"
|
|
||||||
if [[ -f $DIRSTACKFILE ]] && [[ $#dirstack -eq 0 ]]; then
|
|
||||||
dirstack=( ${(f)"$(< $DIRSTACKFILE)"} )
|
|
||||||
[[ -d $dirstack[1] ]] && cd $dirstack[1]
|
|
||||||
fi
|
|
||||||
chpwd() {
|
|
||||||
print -l $PWD ${(u)dirstack} >$DIRSTACKFILE
|
|
||||||
}
|
|
||||||
|
|
||||||
DIRSTACKSIZE=100
|
|
||||||
|
|
||||||
setopt autopushd pushdsilent pushdtohome
|
|
||||||
setopt pushdignoredups
|
|
||||||
|
|
||||||
## This reverts the +/- operators.
|
|
||||||
setopt pushdminus
|
|
||||||
|
|
||||||
##==============================================================================
|
|
||||||
## Completion
|
|
||||||
|
|
||||||
## Custom completion
|
|
||||||
fpath=(~/.shell.d/completion $fpath)
|
|
||||||
|
|
||||||
autoload -Uz compinit
|
|
||||||
# compinit
|
|
||||||
compinit -d "$ZCACHE/compdump"
|
|
||||||
|
|
||||||
zstyle ':completion:*' menu select
|
|
||||||
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
|
|
||||||
zstyle ':completion:*:commands' rehash true # New binaries in path get recognized.
|
|
||||||
|
|
||||||
zstyle ':completion:*' completer _complete _match _approximate ## Allow approximate
|
|
||||||
zstyle ':completion:*:match:*' original only
|
|
||||||
zstyle ':completion:*:approximate:*' max-errors 1 numeric
|
|
||||||
|
|
||||||
## Tab completion for PID :D -- Useless ?
|
|
||||||
# zstyle ':completion:*:*:kill:*' menu yes select
|
|
||||||
# zstyle ':completion:*:kill:*' force-list always
|
|
||||||
|
|
||||||
## ???
|
|
||||||
# zstyle :compinstall filename "$HOME/.zshrc"
|
|
||||||
|
|
||||||
##==============================================================================
|
|
||||||
## TESTING
|
|
||||||
|
|
||||||
## Remove RPS1 after <enter>
|
|
||||||
setopt transient_rprompt
|
|
||||||
|
|
||||||
## Color vars
|
|
||||||
autoload -U colors terminfo
|
|
||||||
colors
|
|
||||||
|
|
||||||
## Zargs powaa
|
|
||||||
autoload -U zargs
|
|
||||||
|
|
||||||
##==============================================================================
|
|
||||||
## Prompt
|
|
||||||
|
|
||||||
autoload -U promptinit
|
|
||||||
promptinit
|
|
||||||
prompt adam2
|
|
||||||
|
|
||||||
##==============================================================================
|
|
||||||
## fzf (external)
|
|
||||||
|
|
||||||
if [ -f /usr/share/fzf/key-bindings.zsh ]; then
|
|
||||||
. /usr/share/fzf/key-bindings.zsh
|
|
||||||
. /usr/share/fzf/completion.zsh
|
|
||||||
bindkey '^T' transpose-chars
|
|
||||||
bindkey '\e^t' fzf-file-widget
|
|
||||||
bindkey '\ec' capitalize-word
|
|
||||||
bindkey '\eC' fzf-cd-widget
|
|
||||||
|
|
||||||
fzf-bcd() {
|
|
||||||
setopt localoptions pipefail 2> /dev/null
|
|
||||||
cd "${$(pwd | nawk -v RS=/ '/\n/ {exit} {p=p $0 "/"; print p}' | fzf --tac):-.}"
|
|
||||||
local ret=$?
|
|
||||||
zle reset-prompt
|
|
||||||
zle redisplay
|
|
||||||
typeset -f zle-line-init >/dev/null && zle zle-line-init
|
|
||||||
return $ret
|
|
||||||
}
|
|
||||||
zle -N fzf-bcd
|
|
||||||
bindkey "\e^L" fzf-bcd
|
|
||||||
|
|
||||||
fzf-cdhist() {
|
|
||||||
setopt localoptions pipefail 2> /dev/null
|
|
||||||
cd "${$(dirs -lp | fzf):-.}"
|
|
||||||
local ret=$?
|
|
||||||
zle reset-prompt
|
|
||||||
zle redisplay
|
|
||||||
typeset -f zle-line-init >/dev/null && zle zle-line-init
|
|
||||||
return $ret
|
|
||||||
}
|
|
||||||
zle -N fzf-cdhist
|
|
||||||
bindkey "\er" fzf-cdhist
|
|
||||||
fi
|
|
24
.zshrc
24
.zshrc
|
@ -1,24 +0,0 @@
|
||||||
## Zsh master file
|
|
||||||
|
|
||||||
loadrc () {
|
|
||||||
for i; do
|
|
||||||
[ -f "${SHELL_DIR}/$i" ] && . "${SHELL_DIR}/$i"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
## Options should be sourced first, before the SHELL_FILEBROWSER hook.
|
|
||||||
loadrc options_zsh
|
|
||||||
loadrc keys_zsh
|
|
||||||
loadrc alias_rc colors_rc completion_rc funs_rc
|
|
||||||
|
|
||||||
## Assign a binding
|
|
||||||
## sh -c 'export SHELL_FILEBROWSER=true; exec $TERMCMD'
|
|
||||||
## and this will autostart the file browser.
|
|
||||||
[ -n "$SHELL_FILEBROWSER" ] && unset SHELL_FILEBROWSER && browse
|
|
||||||
|
|
||||||
## Start at a specific location. Useful when switching to a shell from a browser
|
|
||||||
## for instance.
|
|
||||||
[ -n "$SHELL_CD" ] && cd "$SHELL_CD" && unsert SHELL_CD
|
|
||||||
|
|
||||||
## Shell hook: should be sourced last.
|
|
||||||
loadrc hook
|
|
Loading…
Reference in New Issue