Update zsh config

This commit is contained in:
2022-03-18 10:06:10 +03:00
parent 8d4925cff2
commit 316cc4d51f
30 changed files with 1124 additions and 20 deletions

View File

@ -1,7 +1,13 @@
# alias af=alias-finder
alias menu="menu | lolcat"
alias nomnom="menu | lolcat"
alias so="shrout"
alias sf="shrfile"
alias co="cpyout"
alias cf="cpyfile"
alias ls=lsd
alias lt="lsd --tree"
alias lsl="clear; ls"
alias lll="clear; ll"
alias rake='noglob bundled_rake'
alias weather='curl wttr.in/?0'
alias gdm='gd master'
@ -22,20 +28,21 @@ alias suod="sudo"
alias sduo="sudo"
alias zz='z -c' # restrict matches to subdirs of $PWD
alias zi='z -I' # use fzf to select in multiple matches
alias h=z
alias hi='z -I'
alias hh='z -c'
alias hb='z -b'
alias n=z
alias ni='z -I'
alias nn='z -c'
alias nb='z -b'
alias t="todo.sh"
alias ta="todo.sh add"
alias tl="todo.sh list"
alias td="todo.sh do"
alias tp="todo.sh pri"
alias vim="nvim"
alias v="vim"
alias viz="vim ${ZDOTDIR:-$HOME}/.zshrc"
alias vizp="vim ${ZDOTDIR:-$HOME}/.zpreztorc"
alias vit="vim ~/.tmux.conf"
alias vip="vim ~/.config/polybar/config"
alias vip="vim ~/.config/polybar/config.ini"
alias viv="vim ~/.vimrc"
alias viw="vim ~/.which-key.vim"
alias via="vim ${ZDOTDIR:-$HOME}/.aliases"

View File

@ -37,6 +37,7 @@
vcs # git status
# =========================[ Line #2 ]=========================
newline # \n
background_jobs # presence of background jobs
prompt_char # prompt symbol
)
@ -48,7 +49,6 @@
# =========================[ Line #1 ]=========================
status # exit code of the last command
command_execution_time # duration of the last command
background_jobs # presence of background jobs
direnv # direnv status (https://direnv.net/)
asdf # asdf version manager (https://github.com/asdf-vm/asdf)
virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html)
@ -549,10 +549,11 @@
#######################[ background_jobs: presence of background jobs ]#######################
# Don't show the number of background jobs.
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=true
# Background jobs color.
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=70
# Custom icon.
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION=''
# typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='⭐'
#######################[ direnv: direnv status (https://direnv.net/) ]########################

View File

@ -215,7 +215,7 @@ zstyle ':prezto:module:syntax-highlighting' highlighters \
#
# Auto start a session when Zsh is launched in a local terminal.
zstyle ':prezto:module:tmux:auto-start' local 'yes'
zstyle ':prezto:module:tmux:auto-start' local 'no'
# Auto start a session when Zsh is launched in a SSH connection.
# zstyle ':prezto:module:tmux:auto-start' remote 'yes'

View File

@ -5,8 +5,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
export PATH="$HOME/.local/bin/:$PATH"
export npm_config_prefix="$HOME/.local"
#
# Browser
@ -57,7 +56,7 @@ path=(
# Set the default Less options.
# Mouse-wheel scrolling has been disabled by -X (disable screen clearing).
# Remove -X to enable it.
export LESS='-g -i -M -R -S -w -X -z-4'
export LESS='-g -i -M -R -S -w -z-4'
# Set the Less input preprocessor.
# Try both `lesspipe` and `lesspipe.sh` as either might exist on a system.

View File

@ -1,3 +1,6 @@
d="$HOME/scripts/colorscripts"
bash "$d/`ls $d | shuf -n 1`"
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.config/zsh/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
@ -24,12 +27,10 @@ fpath=("${ZDOTDIR:-$HOME}/.zsh" $fpath)
# Customize to your needs...
source "${ZDOTDIR:-$HOME}/.aliases"
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
ZSH_AUTOSUGGEST_STRATEGY=(history)
ZSH_AUTOSUGGEST_MANUAL_REBIND=true
export PATH=$PATH:$HOME/.pyenv/bin/
# To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh.
[[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh
@ -57,12 +58,15 @@ zinit light-mode for \
### End of Zinit's installer chunk
zinit snippet OMZ::plugins/git/git.plugin.zsh
zinit snippet OMZ::plugins/last-working-dir/last-working-dir.plugin.zsh
zinit snippet OMZ::plugins/dirhistory/dirhistory.plugin.zsh
zinit light skywind3000/z.lua
# ZVM
function zvm_config() {
ZVM_LINE_INIT_MODE=$ZVM_MODE_INSERT
# ZVM_INSERT_MODE_CURSOR=$ZVM_CURSOR_BLOCK
ZVM_INSERT_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BEAM
ZVM_NORMAL_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BLOCK
ZVM_LAZY_KEYBINDINGS=true
ZVM_VI_INSERT_ESCAPE_BINDKEY=kj
}
@ -78,8 +82,12 @@ function zvm_after_init() {
bindkey '^f' forward-word
bindkey '^g' autosuggest-accept
# allow ctrl-r and ctrl-s to search the history
bindkey '^r' history-incremental-search-backward
bindkey '^s' history-incremental-search-forward
# bindkey '^r' history-incremental-search-backward
# bindkey '^s' history-incremental-search-forward
bindkey '^h' backward-kill-word
bindkey '^[[M' kill-word
bindkey -s '^@' ""
bindkey -s '' "fg\n"
# allow ctrl-a and ctrl-e to move to beginning/end of line
@ -88,15 +96,52 @@ function zvm_after_init() {
# allow ctrl-h, ctrl-w, ctrl-? for char and word deletion (standard behaviour)
bindkey '^h' backward-delete-char
# bindkey '^h' backward-delete-char
bindkey '^w' backward-kill-word
bindkey '^x' fzf-cd-widget
bindkey "\e\e" fuck-command-line
bindkey "\e[1;3D" dirhistory_zle_dirhistory_back
bindkey "\e[1;3C" dirhistory_zle_dirhistory_future
bindkey "\e[1;3A" dirhistory_zle_dirhistory_up
bindkey "\e[1;3B" dirhistory_zle_dirhistory_down
}
doit ()
{
# this function is created for forcing the deletion of the file or directory.
#
# rm somedir
# rm: cannot remove 'somedir': Is a directory
# rmdir somedir/
# rmdir: failed to remove 'somedir/': Directory not empty
# rm -rf somedir/
# rm: cannot remove 'somedir/': Permission denied
#
# Just remove the f**king directory!!
lastCommand=$(history | tail -n 1 | cut -d' ' -f3-)
firstWord=$(echo $lastCommand | cut -d' ' -f1)
RED="\033[1;31m"
GREEN="\033[1;32m"
NOCOLOR="\033[0m"
lastWord=$(echo $lastCommand | awk '{print $NF}')
case "$firstWord" in
"rm"|"rmdir")
echo -en "Execute ${RED}\"sudo rm -rf $lastWord\"${NOCOLOR}?"
read -k "? " ans
echo
if [ "$ans" = "y" ]; then
sudo rm -rf $lastWord
fi
;;
"cd")
mkdir $lastWord && cd $lastWord
;;
*) echo "Don't know what to do with \"$lastCommand\"."
;;
esac
}