add more settings in zsh
This commit is contained in:
parent
a2cf636c0b
commit
345be3d5c9
1 changed files with 104 additions and 13 deletions
117
dot_zshrc
117
dot_zshrc
|
@ -1,23 +1,114 @@
|
||||||
# needed for history and autosuggestions
|
autoload -U promptinit; promptinit;
|
||||||
export HISTFILE=~/.zhistory
|
autoload -U compinit bashcompinit
|
||||||
export HISTSIZE=10000000
|
compinit
|
||||||
export SAVEHIST=10000000
|
bashcompinit
|
||||||
|
zstyle ':completion:*' menu yes select
|
||||||
|
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}'
|
||||||
|
zstyle ':completion:*' rehash true
|
||||||
|
|
||||||
# make midnight commander colorful
|
autoload -U select-word-style
|
||||||
export TERM=xterm-256color
|
select-word-style bash
|
||||||
# by default backspace deletes whole word
|
|
||||||
bindkey "^H" backward-delete-char
|
setopt auto_cd
|
||||||
# up/down should search in history not step
|
setopt HIST_IGNORE_SPACE
|
||||||
bindkey '\e[A' history-beginning-search-backward
|
setopt interactive_comments
|
||||||
bindkey '\e[B' history-beginning-search-forward
|
setopt inc_append_history
|
||||||
# colored prompt
|
setopt share_history
|
||||||
|
setopt AUTO_PUSHD
|
||||||
|
setopt PUSHD_IGNORE_DUPS
|
||||||
|
setopt PUSHD_SILENT
|
||||||
|
|
||||||
|
if [[ -t 0 && $- = *i* ]]
|
||||||
|
then
|
||||||
|
stty -ixon
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset histchars
|
||||||
|
|
||||||
|
for index ({1..9}) alias "$index"="cd +${index}"; unset index
|
||||||
|
|
||||||
|
HISTFILE=~/.zsh_history
|
||||||
|
HISTSIZE=10000000
|
||||||
|
SAVEHIST=10000000
|
||||||
|
|
||||||
|
bindkey '^[.' insert-last-word
|
||||||
|
bindkey "^[[H" beginning-of-line # HOME
|
||||||
|
bindkey "^[[F" end-of-line # END
|
||||||
|
bindkey "^[OH" beginning-of-line # HOME
|
||||||
|
bindkey "^[OF" end-of-line # END
|
||||||
|
bindkey "^[[3~" delete-char # DEL
|
||||||
|
bindkey -M emacs '\e#' pound-insert # ALT+#
|
||||||
|
bindkey '^R' history-incremental-pattern-search-backward
|
||||||
|
bindkey '^S' history-incremental-pattern-search-forward
|
||||||
|
bindkey '^[[1;3C' forward-word
|
||||||
|
bindkey '^[[1;3D' backward-word
|
||||||
|
|
||||||
|
mem() {
|
||||||
|
echo $(echo $(smem -t -P $1 | tail -n 1 | rev | cut -d ' ' -f 2 | rev) / 1024 | bc) MB
|
||||||
|
}
|
||||||
|
|
||||||
|
alias eZ="vim ~/.zshrc"
|
||||||
|
alias eI="vim ~/.config/sway/config"
|
||||||
|
alias eW="vim ~/.config/wezterm/wezterm.lua"
|
||||||
|
alias eI="vim ~/.config/sway/config"
|
||||||
|
alias eV="vim ~/.vimrc"
|
||||||
|
alias eS="vim ~/.config/starship.toml"
|
||||||
|
alias wetter="curl http://v3.wttr.in/Niedersachsen.sxl; sleep 5; curl http://v1.wttr.in/Hildesheim"
|
||||||
|
alias history="history 0"
|
||||||
|
alias etcher="usbimager"
|
||||||
|
alias ls='ls --color=auto'
|
||||||
|
|
||||||
|
function rm
|
||||||
|
{
|
||||||
|
/bin/rm $@ -I
|
||||||
|
}
|
||||||
|
|
||||||
|
alias k="kubectl"
|
||||||
|
alias serve="python -m http.server 8000"
|
||||||
|
|
||||||
|
function imgcat()
|
||||||
|
{
|
||||||
|
local CNT=0
|
||||||
|
local IFS=$'\n'
|
||||||
|
local posY=$(($(echo -e "cols" | tput -S) / 2))
|
||||||
|
local posX=$(($(echo -e "lines" | tput -S) / 4))
|
||||||
|
|
||||||
|
for i in $(find $1 -type f -exec file --mime-type {} \+ | awk -F: '{if ($2 ~/image\//) print $1}'); do
|
||||||
|
CNT=$((CNT+1))
|
||||||
|
if test $(($CNT % 2)) -eq 0 && test "$2" != "-1"; then
|
||||||
|
printf "\033[${posX}A"
|
||||||
|
printf "\033[${posY}C"
|
||||||
|
echo -e "==== $(basename $i) ===="
|
||||||
|
printf "\033[${posY}C"
|
||||||
|
else
|
||||||
|
echo -e "==== $(basename $i) ===="
|
||||||
|
fi
|
||||||
|
|
||||||
|
if echo "$i" | grep -e ".svg$" &> /dev/null; then
|
||||||
|
ffmpeg -i "$i" -vf scale=640:-1 -f image2pipe -vcodec png - 2> /dev/null | wezterm imgcat --height 20%
|
||||||
|
else
|
||||||
|
wezterm imgcat --height 20% "$i";
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function fixvmware() {
|
||||||
|
sudo systemctl restart docker
|
||||||
|
virsh --connect qemu:///system net-destroy default
|
||||||
|
virsh --connect qemu:///system net-start --network default
|
||||||
|
}
|
||||||
|
|
||||||
|
## colored prompt
|
||||||
autoload -U colors && colors
|
autoload -U colors && colors
|
||||||
PS1="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%/ %{$reset_color%}% "
|
PS1="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%/ %{$reset_color%}% "
|
||||||
# called when executing a command
|
## called when executing a command
|
||||||
function preexec {
|
function preexec {
|
||||||
print -Pn "\e]0;${(q)1}\e\\"
|
print -Pn "\e]0;${(q)1}\e\\"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export PNPM_HOME="$HOME/.local/share/pnpm"
|
||||||
|
export PATH="$PATH:$HOME/.local/bin"
|
||||||
|
|
||||||
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||||
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||||
source /usr/share/fzf/key-bindings.zsh
|
source /usr/share/fzf/key-bindings.zsh
|
||||||
|
|
Loading…
Reference in a new issue