mirror of
https://github.com/arcan1s/dotfiles.git
synced 2025-04-25 00:17:17 +00:00
add zhsrc_foreing_server
This commit is contained in:
parent
d3da6a556c
commit
5fbce7c4c8
176
zshrc_foreing_server
Normal file
176
zshrc_foreing_server
Normal file
@ -0,0 +1,176 @@
|
||||
# history
|
||||
HISTFILE=~/.zsh_history
|
||||
HISTSIZE=500000
|
||||
SAVEHIST=500000
|
||||
|
||||
# bindkeys
|
||||
bindkey '^[[A' up-line-or-search # up arrow for back-history-search
|
||||
bindkey '^[[B' down-line-or-search # down arrow for fwd-history-search
|
||||
bindkey '\e[1~' beginning-of-line # home
|
||||
bindkey '\e[2~' overwrite-mode # insert
|
||||
bindkey '\e[3~' delete-char # del
|
||||
bindkey '\e[4~' end-of-line # end
|
||||
bindkey '\e[5~' up-line-or-history # page-up
|
||||
bindkey '\e[6~' down-line-or-history # page-down
|
||||
|
||||
# autocomplit
|
||||
autoload -U compinit
|
||||
compinit
|
||||
zstyle ':completion:*' insert-tab false # Автокомплит для первого символа
|
||||
zstyle ':completion:*' max-errors 2
|
||||
|
||||
# prompt
|
||||
autoload -U promptinit
|
||||
promptinit
|
||||
|
||||
# colors
|
||||
autoload -U colors
|
||||
colors
|
||||
|
||||
# autocd
|
||||
setopt autocd
|
||||
|
||||
# correct
|
||||
setopt CORRECT_ALL
|
||||
SPROMPT="Correct '%R' to '%r' ? (nyae) "
|
||||
|
||||
# append history
|
||||
setopt APPEND_HISTORY
|
||||
|
||||
# ignore dups in history
|
||||
setopt HIST_IGNORE_ALL_DUPS
|
||||
|
||||
# ighore additional space in history
|
||||
setopt HIST_IGNORE_SPACE
|
||||
|
||||
# reduce blanks in history
|
||||
setopt HIST_REDUCE_BLANKS
|
||||
|
||||
# =cmd without autocomplit
|
||||
unsetopt EQUALS
|
||||
|
||||
# disable beeps
|
||||
unsetopt beep
|
||||
|
||||
# autoload calc
|
||||
autoload zcalc
|
||||
|
||||
# automatically log of on 10*60 sec inactivity
|
||||
export TMOUT=600
|
||||
|
||||
# PROMPT && RPROMPT
|
||||
if [[ $EUID == 0 ]]; then
|
||||
# [root@host dir]#
|
||||
PROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
|
||||
%{$fg_bold[red]%}%n%{$reset_color%}\
|
||||
%{$fg_bold[white]%}@%{$reset_color%}\
|
||||
%{$fg_no_bold[blue]%}%m %{$reset_color%}\
|
||||
%{$fg_bold[yellow]%}%1/%{$reset_color%}\
|
||||
%{$fg_bold[white]%}]# %{$reset_color%}"
|
||||
else
|
||||
# [user@host dir]$
|
||||
PROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
|
||||
%{$fg_bold[green]%}%n%{$reset_color%}\
|
||||
%{$fg_bold[white]%}@%{$reset_color%}\
|
||||
%{$fg_no_bold[blue]%}%m %{$reset_color%}\
|
||||
%{$fg_bold[yellow]%}%1/%{$reset_color%}\
|
||||
%{$fg_bold[white]%}]$ %{$reset_color%}"
|
||||
fi
|
||||
precmd() {
|
||||
# last command
|
||||
returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
|
||||
RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
|
||||
%{$fg_bold[cyan]%}%T%{$reset_color%}\
|
||||
%{$fg_bold[white]%}][%{$reset_color%}"\
|
||||
$returncode\
|
||||
"%{$fg_bold[white]%}]%{$reset_color%}"
|
||||
}
|
||||
|
||||
## alias
|
||||
alias grep='grep --colour=auto'
|
||||
alias top='htop'
|
||||
alias df='df -k --print-type --human-readable'
|
||||
alias du='du -k --total --human-readable'
|
||||
|
||||
alias ls='ls --color=auto --group-directories-first'
|
||||
alias ll='ls -l --human-readable'
|
||||
alias lr='ls --recursive'
|
||||
alias la='ll --almost-all'
|
||||
alias lx='ll -X --ignore-backups'
|
||||
alias lz='ll -S --reverse'
|
||||
alias lt='ll -t --reverse'
|
||||
alias lm='la | more'
|
||||
|
||||
# function to extract archives
|
||||
# EXAMPLE: unpack file
|
||||
unpack() {
|
||||
if [[ -f $1 ]]; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar xjfv $1 ;;
|
||||
*.tar.gz) tar xzfv $1 ;;
|
||||
*.tar.xz) tar xvJf $1 ;;
|
||||
*.bz2) bunzip2 $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.rar) unrar x $1 ;;
|
||||
*.tar) tar xf $1 ;;
|
||||
*.tbz) tar xjvf $1 ;;
|
||||
*.tbz2) tar xjf $1 ;;
|
||||
*.tgz) tar xzf $1 ;;
|
||||
*.zip) unzip $1 ;;
|
||||
*.Z) uncompress $1 ;;
|
||||
*.7z) 7z x $1 ;;
|
||||
*) echo "I don't know how to extract '$1'" ;;
|
||||
esac
|
||||
else
|
||||
case $1 in
|
||||
*help) echo "Usage: unpack ARCHIVE_NAME" ;;
|
||||
*) echo "'$1' is not a valid file" ;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
# function to create archives
|
||||
# EXAMPLE: pack tar file
|
||||
pack() {
|
||||
if [ $1 ]; then
|
||||
case $1 in
|
||||
tar.bz2) tar -cjvf $2.tar.bz2 $2 ;;
|
||||
tar.gz) tar -czvf $2.tar.bz2 $2 ;;
|
||||
tar.xz) tar -cf - $2 | xz -9 -c - > $2.tar.xz ;;
|
||||
bz2) bzip $2 ;;
|
||||
gz) gzip -c -9 -n $2 > $2.gz ;;
|
||||
tar) tar cpvf $2.tar $2 ;;
|
||||
tbz) tar cjvf $2.tar.bz2 $2 ;;
|
||||
tgz) tar czvf $2.tar.gz $2 ;;
|
||||
zip) zip -r $2.zip $2 ;;
|
||||
7z) 7z a $2.7z $2 ;;
|
||||
*help) echo "Usage: pack TYPE FILES" ;;
|
||||
*) echo "'$1' cannot be packed via pack()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file"
|
||||
fi
|
||||
}
|
||||
|
||||
# global alias
|
||||
alias -g g="| grep"
|
||||
alias -g l="| less"
|
||||
alias -g t="| tail"
|
||||
alias -g h="| head"
|
||||
alias -g n="| wc -l"
|
||||
alias -g dn="&> /dev/null &"
|
||||
|
||||
# to run command ignoring aliases
|
||||
hash -d b=/usr/bin
|
||||
|
||||
# editor
|
||||
export EDITOR="vim"
|
||||
|
||||
# umask
|
||||
umask 022
|
||||
|
||||
# path
|
||||
export PATH="$PATH:$HOME/.local/bin/"
|
||||
|
||||
# fix urxvt
|
||||
if [[ ${TERM} =~ "rxvt-unicode-*" ]] export TERM="xterm"
|
Loading…
Reference in New Issue
Block a user