mirror of
				https://github.com/akelge/vim
				synced 2025-11-04 07:24:23 +00:00 
			
		
		
		
	New ZSH folder (3)
This commit is contained in:
		
							
								
								
									
										26
									
								
								zsh/zsh.d/00-options
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								zsh/zsh.d/00-options
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,26 @@
 | 
			
		||||
setopt ALWAYS_TO_END
 | 
			
		||||
setopt APPEND_HISTORY
 | 
			
		||||
setopt AUTO_CD
 | 
			
		||||
setopt ALL_EXPORT
 | 
			
		||||
setopt AUTO_MENU
 | 
			
		||||
setopt AUTO_LIST
 | 
			
		||||
setopt AUTONAMEDIRS
 | 
			
		||||
setopt AUTO_PARAM_SLASH
 | 
			
		||||
setopt AUTO_REMOVE_SLASH
 | 
			
		||||
setopt AUTO_RESUME
 | 
			
		||||
# setopt CDABLE_VARS
 | 
			
		||||
setopt CORRECT
 | 
			
		||||
setopt FUNCTION_ARGZERO
 | 
			
		||||
setopt HIST_IGNORE_ALL_DUPS
 | 
			
		||||
setopt HIST_NO_STORE
 | 
			
		||||
setopt HIST_REDUCE_BLANKS
 | 
			
		||||
setopt LIST_TYPES
 | 
			
		||||
setopt LONG_LIST_JOBS
 | 
			
		||||
# setopt MENU_COMPLETE
 | 
			
		||||
# setopt NO_AUTOLIST
 | 
			
		||||
setopt NO_BEEP
 | 
			
		||||
setopt NOHUP
 | 
			
		||||
setopt NOTIFY
 | 
			
		||||
setopt PATH_DIRS
 | 
			
		||||
setopt SHORT_LOOPS
 | 
			
		||||
# vim: set ts=4 sw=4 tw=0 ft=zsh : 
 | 
			
		||||
							
								
								
									
										24
									
								
								zsh/zsh.d/10-environment
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								zsh/zsh.d/10-environment
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,24 @@
 | 
			
		||||
#######################################################################################
 | 
			
		||||
# Variables
 | 
			
		||||
 | 
			
		||||
## Vars used always
 | 
			
		||||
PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/sbin:/sbin:$HOME/bin:."
 | 
			
		||||
SAVEHIST=500
 | 
			
		||||
HISTFILE=~/.history
 | 
			
		||||
HISTSIZE=10000
 | 
			
		||||
LANG="it_IT.UTF-8"
 | 
			
		||||
TZ='Europe/Rome'
 | 
			
		||||
MIBS=all
 | 
			
		||||
LOGD=/var/log
 | 
			
		||||
 | 
			
		||||
## If we are not interactive quit
 | 
			
		||||
[ -z "$PS1" ] && return
 | 
			
		||||
 | 
			
		||||
## Vars only for interactive sessions
 | 
			
		||||
EDITOR=vi
 | 
			
		||||
PYTHONSTARTUP=~/.pythonrc.py
 | 
			
		||||
LOGCHECK=30
 | 
			
		||||
REPORTTIME=15
 | 
			
		||||
WATCH=notme
 | 
			
		||||
WATCHFMT="%n %a %l (%m) at %t."
 | 
			
		||||
#  vim: set ts=4 sw=4 tw=0 ft=zsh : 
 | 
			
		||||
							
								
								
									
										14
									
								
								zsh/zsh.d/20-bindkeys
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								zsh/zsh.d/20-bindkeys
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,14 @@
 | 
			
		||||
#######################################################################################
 | 
			
		||||
# Useful under iTerm
 | 
			
		||||
bindkey  "-e" 
 | 
			
		||||
bindkey  "\e[1~" beginning-of-line
 | 
			
		||||
bindkey  "\e[4~" end-of-line
 | 
			
		||||
bindkey  "\e[3~" delete-char
 | 
			
		||||
bindkey  "\eOA" history-search-backward
 | 
			
		||||
bindkey  "\eOB" history-search-forward
 | 
			
		||||
bindkey  "\e[A" history-search-backward
 | 
			
		||||
bindkey  "\e[B" history-search-forward
 | 
			
		||||
bindkey "\e[5D" backward-word
 | 
			
		||||
bindkey "\e[5C" forward-word
 | 
			
		||||
bindkey "" vi-backward-kill-word
 | 
			
		||||
#  vim: set ts=4 sw=4 tw=0 ft=zsh : 
 | 
			
		||||
							
								
								
									
										19
									
								
								zsh/zsh.d/20-complete
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								zsh/zsh.d/20-complete
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
			
		||||
#######################################################################################
 | 
			
		||||
# Start autocomplete
 | 
			
		||||
autoload -U compinit; compinit
 | 
			
		||||
# autoload -U compsys;
 | 
			
		||||
# compctl -g "*(-/)" + -g ".*(-/)" cd
 | 
			
		||||
 | 
			
		||||
# allow approximate
 | 
			
		||||
zstyle ':completion:*' completer _complete _match _approximate
 | 
			
		||||
zstyle ':completion:*:match:*' original only
 | 
			
		||||
zstyle ':completion:*:approximate:*' max-errors 1 numeric
 | 
			
		||||
 | 
			
		||||
# tab completion for PID :D
 | 
			
		||||
zstyle ':completion:*:*:kill:*' menu yes select
 | 
			
		||||
zstyle ':completion:*:kill:*' force-list always
 | 
			
		||||
 | 
			
		||||
# cd not select parent dir
 | 
			
		||||
zstyle ':completion:*:cd:*' ignore-parents parent pwd
 | 
			
		||||
 | 
			
		||||
#  vim: set ts=4 sw=4 tw=0 ft=zsh : 
 | 
			
		||||
							
								
								
									
										28
									
								
								zsh/zsh.d/30-aliases
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								zsh/zsh.d/30-aliases
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,28 @@
 | 
			
		||||
#######################################################################################
 | 
			
		||||
# Aliases
 | 
			
		||||
 | 
			
		||||
alias ls='ls -F --color'
 | 
			
		||||
alias la='ls -A'
 | 
			
		||||
alias ll='ls -l'
 | 
			
		||||
alias dir='ls -l'
 | 
			
		||||
alias lla='la -l'
 | 
			
		||||
 | 
			
		||||
alias killall='killall -v'
 | 
			
		||||
alias cls='clear'
 | 
			
		||||
 | 
			
		||||
alias dc=cd
 | 
			
		||||
alias les=less
 | 
			
		||||
alias fu='sudo -s $( fc -ln -1)'
 | 
			
		||||
 | 
			
		||||
alias mkdir='mkdir -p'
 | 
			
		||||
alias zap='rm -rf'
 | 
			
		||||
alias ftail='tail -f'
 | 
			
		||||
alias grep='grep --colour'
 | 
			
		||||
 | 
			
		||||
alias ns='host -t ns'
 | 
			
		||||
alias mx='host -t mx'
 | 
			
		||||
alias soa='host -t soa'
 | 
			
		||||
alias ptr='host -t ptr'
 | 
			
		||||
 | 
			
		||||
alias vi="vim "
 | 
			
		||||
#  vim: set ts=4 sw=4 tw=0 ft=zsh : 
 | 
			
		||||
							
								
								
									
										22
									
								
								zsh/zsh.d/30-less
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								zsh/zsh.d/30-less
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,22 @@
 | 
			
		||||
#######################################################################################
 | 
			
		||||
# Setup LESS
 | 
			
		||||
 | 
			
		||||
for lp in lesspipe lesspipe.sh; do
 | 
			
		||||
    LESSPIPE=`which $lp`
 | 
			
		||||
    [ $? -eq 0 ] && eval `$LESSPIPE`
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
## make less colourful
 | 
			
		||||
LESS_TERMCAP_mb=$'\E[01;34m'     # begin blinking
 | 
			
		||||
LESS_TERMCAP_md=$'\E[01;36m'     # begin bold
 | 
			
		||||
LESS_TERMCAP_me=$'\E[0m'         # end mode
 | 
			
		||||
LESS_TERMCAP_so=$'\E[01;47;34m'  # begin standout-mode - info box
 | 
			
		||||
LESS_TERMCAP_se=$'\E[0m'         # end standout-mode
 | 
			
		||||
LESS_TERMCAP_us=$'\E[04;32m'     # begin underline
 | 
			
		||||
LESS_TERMCAP_ue=$'\E[0m'         # end underline
 | 
			
		||||
 | 
			
		||||
LESS="-c -x4 -R -MM -PMFile\:?f%f:STDIN. ?BSize\:?B%B:Unk.?B\:?pb%pb\%:Unk.?B\:%i/%m"
 | 
			
		||||
LESSCHARSET=utf-8
 | 
			
		||||
READNULLCMD=/usr/bin/less
 | 
			
		||||
PAGER=/usr/bin/less
 | 
			
		||||
#  vim: set ts=4 sw=4 tw=0 ft=zsh : 
 | 
			
		||||
							
								
								
									
										11
									
								
								zsh/zsh.d/30-prompt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								zsh/zsh.d/30-prompt
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,11 @@
 | 
			
		||||
#######################################################################################
 | 
			
		||||
# Setup PROMPT
 | 
			
		||||
if [ ${TERM[0,5]} = "xterm" ] || [ ${TERM} = "rxvt" ]; then
 | 
			
		||||
  # We are on xterminal
 | 
			
		||||
  PS1="%{]2;%n@%m:%.%}%{]1; %m:%. %}%B<%l> %~ %#%b "
 | 
			
		||||
else
 | 
			
		||||
  # We are not on xterminal
 | 
			
		||||
  PS1="%B[%l] %n@%m:%~ %#%b "
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
#  vim: set ts=4 sw=4 tw=0 ft=zsh : 
 | 
			
		||||
							
								
								
									
										13
									
								
								zsh/zsh.d/30-termcolors
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								zsh/zsh.d/30-termcolors
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,13 @@
 | 
			
		||||
#######################################################################################
 | 
			
		||||
# Colorize terminal
 | 
			
		||||
autoload colors zsh/terminfo
 | 
			
		||||
if [[ "$terminfo[colors]" -ge 8 ]]; then
 | 
			
		||||
    colors
 | 
			
		||||
fi
 | 
			
		||||
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
 | 
			
		||||
    eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
 | 
			
		||||
    eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
 | 
			
		||||
    (( count = $count + 1 ))
 | 
			
		||||
done
 | 
			
		||||
PR_NO_COLOR="%{$terminfo[sgr0]%}"
 | 
			
		||||
#  vim: set ts=4 sw=4 tw=0 ft=zsh : 
 | 
			
		||||
							
								
								
									
										34
									
								
								zsh/zsh.d/90-functions
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								zsh/zsh.d/90-functions
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,34 @@
 | 
			
		||||
#######################################################################################
 | 
			
		||||
# Functions
 | 
			
		||||
 | 
			
		||||
# cdb - Goes to folder by complete path
 | 
			
		||||
function cdb { cd `dirname $1` }
 | 
			
		||||
 | 
			
		||||
# hist - Grep from history
 | 
			
		||||
function hist { grep -i $* $HISTFILE }
 | 
			
		||||
 | 
			
		||||
# hdu - Human readable report of files and directories sizes
 | 
			
		||||
#       *Same behaviour as du*
 | 
			
		||||
function hdu () {
 | 
			
		||||
    du -k $* | sort -nr | awk '{
 | 
			
		||||
        # Prepare human readable
 | 
			
		||||
        if($1>=1024*1024) { size=$1/1024/1024; unit="G" }
 | 
			
		||||
        else if($1>=1024) { size=$1/1024;      unit="M" }
 | 
			
		||||
        else {              size=$1;           unit="K" };
 | 
			
		||||
        format="%10.2f%s";
 | 
			
		||||
        hsize=sprintf(format,size,unit);
 | 
			
		||||
 | 
			
		||||
        # Remove $1 (size), then removes " " at the start of $0
 | 
			
		||||
        $1=""; thepath=$0; sub(/^ /,"",thepath);
 | 
			
		||||
 | 
			
		||||
        # Print size and path (directories are bolded)
 | 
			
		||||
        if ( system("[ -d \""thepath"\" ]") )
 | 
			
		||||
            printf "%-8s %s\n",hsize,thepath;
 | 
			
		||||
        else
 | 
			
		||||
            printf "%-8s \033[1m%s\033[0m/\n",hsize,thepath;
 | 
			
		||||
    }'
 | 
			
		||||
}
 | 
			
		||||
# list total size in . directory
 | 
			
		||||
function dust () { hdu -s * }
 | 
			
		||||
 | 
			
		||||
#  vim: set ts=4 sw=4 tw=0 ft=zsh : 
 | 
			
		||||
							
								
								
									
										11
									
								
								zsh/zsh.d/Darwin/50-darwin
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								zsh/zsh.d/Darwin/50-darwin
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,11 @@
 | 
			
		||||
# Darwin/OSX
 | 
			
		||||
# Environment and aliases for OSX
 | 
			
		||||
export LSCOLORS="GxgxcxdxCxegedabagacad"
 | 
			
		||||
alias aquamacs='open -a Aquamacs\ Emacs'
 | 
			
		||||
alias ldd='otool -L'
 | 
			
		||||
alias ls='ls -F -G'
 | 
			
		||||
alias skill=killall
 | 
			
		||||
alias lsrebuild='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user'
 | 
			
		||||
alias ipython='ipython-2.6 '
 | 
			
		||||
 | 
			
		||||
#  vim: set ts=4 sw=4 tw=0 ft=zsh : 
 | 
			
		||||
							
								
								
									
										19
									
								
								zsh/zsh.d/Darwin/90-coreutilsDarwin
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								zsh/zsh.d/Darwin/90-coreutilsDarwin
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
			
		||||
# Core Utils
 | 
			
		||||
which gcp > /dev/null 
 | 
			
		||||
if [ $? -eq 0 ]; then
 | 
			
		||||
    if [ -f /etc/zsh/gdircolors ]; then
 | 
			
		||||
        eval `gdircolors /etc/zsh/gdircolors`
 | 
			
		||||
    else
 | 
			
		||||
        eval `gdircolors`
 | 
			
		||||
    fi
 | 
			
		||||
    #alias ls='gls --color -F' # OSX ls is better (supports extended attributes)
 | 
			
		||||
    alias ll='ls -l'
 | 
			
		||||
    alias la='ls -a'
 | 
			
		||||
    alias cp='gcp'
 | 
			
		||||
    alias mv='gmv'
 | 
			
		||||
    alias rm='grm'
 | 
			
		||||
    alias du='gdu'
 | 
			
		||||
    alias df='gdf -a'
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
#  vim: set ts=4 sw=4 tw=0 ft=zsh : 
 | 
			
		||||
							
								
								
									
										25
									
								
								zsh/zsh.d/Darwin/90-dsFunctions
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								zsh/zsh.d/Darwin/90-dsFunctions
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,25 @@
 | 
			
		||||
BASE='/LDAPv3/dioniso.cube.lan'
 | 
			
		||||
KEYWORD="desktop"
 | 
			
		||||
 | 
			
		||||
function dsComputerUserList {
 | 
			
		||||
    for c in `dscl $BASE -search Computers Keywords desktop|grep Keywords|cut -f1|sort`; do
 | 
			
		||||
        echo -n $c:
 | 
			
		||||
        dscl $BASE -read Computers/$c Comment|cut -d: -f3
 | 
			
		||||
    done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function dsComputerList {
 | 
			
		||||
    for c in `dsComputerUserList`; do
 | 
			
		||||
        echo $c|cut -d: -f1
 | 
			
		||||
    done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function dsUser {
 | 
			
		||||
    COMPUTER=${1-`dscl . -list Computers|grep -v localhost`}
 | 
			
		||||
    dsComputerUserList| grep -i $COMPUTER|cut -d: -f2
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
unset BASE
 | 
			
		||||
unset KEYWORD
 | 
			
		||||
 | 
			
		||||
#  vim: set ts=4 sw=4 tw=0 ft=zsh : 
 | 
			
		||||
							
								
								
									
										6
									
								
								zsh/zsh.d/Darwin/90-macportsDarwin
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								zsh/zsh.d/Darwin/90-macportsDarwin
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
			
		||||
# Mac Ports
 | 
			
		||||
if [ -f /opt/local/etc/init.sh ]; then
 | 
			
		||||
    source /opt/local/etc/init.sh
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
#  vim: set ts=4 sw=4 tw=0 ft=zsh : 
 | 
			
		||||
							
								
								
									
										4
									
								
								zsh/zsh.d/Linux/50-linux
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								zsh/zsh.d/Linux/50-linux
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,4 @@
 | 
			
		||||
# Linux
 | 
			
		||||
eval `dircolors`
 | 
			
		||||
 | 
			
		||||
#  vim: set ts=4 sw=4 tw=0 ft=zsh : 
 | 
			
		||||
							
								
								
									
										35
									
								
								zsh/zshrc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								zsh/zshrc
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,35 @@
 | 
			
		||||
# /etc/zshrc: system-wide .zshrc file for zsh(1).
 | 
			
		||||
#
 | 
			
		||||
# This file is sourced only for interactive shells. It
 | 
			
		||||
# should contain commands to set up aliases, functions,
 | 
			
		||||
# options, key bindings, etc.
 | 
			
		||||
#
 | 
			
		||||
# Global Order: zshenv, zprofile, zshrc, zlogin
 | 
			
		||||
#
 | 
			
		||||
KERNEL=`uname -s`
 | 
			
		||||
LIBRARY="/Network/Library/zsh.d"
 | 
			
		||||
KERNLIB="${LIBRARY}/${KERNEL}"
 | 
			
		||||
 | 
			
		||||
function loadRC {
 | 
			
		||||
    if [ -d $1 ]; then
 | 
			
		||||
        for zshFile in $1/*; do
 | 
			
		||||
            . $zshFile
 | 
			
		||||
        done
 | 
			
		||||
    fi
 | 
			
		||||
    unset zshFile
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
loadRC ${LIBRARY}
 | 
			
		||||
loadRC ${KERNLIB}
 | 
			
		||||
 | 
			
		||||
unset KERNEL
 | 
			
		||||
unset LIBRARY
 | 
			
		||||
unset KERNLIB
 | 
			
		||||
 | 
			
		||||
# Local (per Host) customizations
 | 
			
		||||
for localDir in /etc/zsh /etc /usr/local/etc /usr/local/etc/zsh; do
 | 
			
		||||
    if [ -f ${localDir}/zshrc.local ]; then
 | 
			
		||||
        . ${localDir}/zshrc.local
 | 
			
		||||
    fi
 | 
			
		||||
done
 | 
			
		||||
unset localDir
 | 
			
		||||
		Reference in New Issue
	
	Block a user