new simple zshrc without p10k
This commit is contained in:
parent
e4c64cb6e1
commit
6cc2363c2b
96
home/.zshrc
96
home/.zshrc
@ -1,47 +1,83 @@
|
||||
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
|
||||
# Initialization code that may require console input (password prompts, [y/n]
|
||||
# confirmations, etc.) must go above this block; everything else may go below.
|
||||
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
|
||||
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
|
||||
fi
|
||||
# Lines configured by zsh-newuser-install
|
||||
HISTFILE=~/.histfile
|
||||
HISTSIZE=1000
|
||||
SAVEHIST=1000
|
||||
setopt autocd nomatch notify appendhistory sharehistory hist_ignore_space hist_ignore_all_dups hist_save_no_dups hist_find_no_dups
|
||||
unsetopt beep extendedglob
|
||||
bindkey -e
|
||||
# End of lines configured by zsh-newuser-install
|
||||
# The following lines were added by compinstall
|
||||
zstyle :compinstall filename '/home/dom/.zshrc'
|
||||
|
||||
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
||||
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
# End of lines added by compinstall
|
||||
|
||||
parse_git_branch() {
|
||||
local branch=""
|
||||
branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
|
||||
local git_status=$(git status --porcelain 2>/dev/null)
|
||||
local color=green
|
||||
if echo "$git_status" | grep -q "^ M"; then
|
||||
color=yellow
|
||||
branch="${branch}*"
|
||||
fi
|
||||
if echo "$git_status" | grep -qE "^ A|^\?\?"; then
|
||||
color=yellow
|
||||
branch="${branch}+"
|
||||
fi
|
||||
if echo "$git_status" | grep -q "^ D"; then
|
||||
color=yellow
|
||||
branch="${branch}-"
|
||||
fi
|
||||
|
||||
if [[ -n "$branch" ]]; then
|
||||
branch=[%F{${color}}${branch}%F{reset}]
|
||||
fi
|
||||
echo " $branch"
|
||||
}
|
||||
|
||||
precmd() {
|
||||
print ""
|
||||
print -rP "%F{#b4befe}%B%n@%m%b %2~%F{#f5e0dc}$(parse_git_branch)%f"
|
||||
}
|
||||
# PS1="%F{#008000}%B%n@%m%b %K{#3a3a3a}%1~%k:%f"
|
||||
PROMPT="%B%F{#b4befe}$%f%b "
|
||||
RPROMPT="%F{241}%B%T%b%f"
|
||||
|
||||
# set PATH so it includes user's private ~/.local/bin if it exists
|
||||
if [ -d "$HOME/.local/bin" ] ; then
|
||||
PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
|
||||
HISTFILE=~/.histfile
|
||||
HISTSIZE=1000
|
||||
SAVEHIST=1000
|
||||
|
||||
TERM_ID=(ps -o 'ppid=' -p $$)
|
||||
TERM_NAME=(ps -o 'cmd=' -p $TERM_ID)
|
||||
if [[ "$TERM_NAME" = "kitty" ]]; then
|
||||
alias ssh="kitty +kitten ssh"
|
||||
else
|
||||
alias ssh="TERM=xterm-256color ssh"
|
||||
fi
|
||||
alias fl='lsd -l -h -1 --group-dirs first -X --config-file ~/.config/lsd/config.yaml'
|
||||
alias orphans='[[ -n $(pacman -Qdt) ]] && sudo pacman -Rs $(pacman -Qdtq) || echo "no orphans to remove"'
|
||||
|
||||
# Key bindings
|
||||
bindkey "^[[3~" delete-char
|
||||
bindkey "^[[H" beginning-of-line
|
||||
bindkey "^[[F" end-of-line
|
||||
bindkey "^[[1;5C" forward-word
|
||||
bindkey "^[[1;5D" backward-word
|
||||
|
||||
plugins=(zsh-interactive-cd git aliases docker archlinux sudo vscode)
|
||||
# Aliases
|
||||
alias ssh="TERM=xterm-256color ssh"
|
||||
#alias fl='lsd -l -h -1 --group-dirs first -X --config-file ~/.config/lsd/config.yaml'
|
||||
alias orphans='[[ -n $(pacman -Qdt) ]] && sudo pacman -Rs $(pacman -Qdtq) || echo "no orphans to remove"'
|
||||
alias ls='exa --icons --color=always --group-directories-first'
|
||||
alias ll='exa -alF --icons --color=always --group-directories-first'
|
||||
alias la='exa -a --icons --color=always --group-directories-first'
|
||||
alias l='exa -F --icons --color=always --group-directories-first'
|
||||
|
||||
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
# FZF
|
||||
eval "$(fzf --zsh)"
|
||||
export FZF_DEFAULT_COMMAND="fd --hidden --strip-cwd-prefix --exclude .git"
|
||||
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
|
||||
export FZF_ALT_C_COMMAND="fd --type=d --hidden --strip-cwd-prefix --exclude .git"
|
||||
export FZF_DEFAULT_OPTS="--height 50% --layout=default --border --color=hl:#2dd4bf"
|
||||
|
||||
source /usr/share/oh-my-zsh/oh-my-zsh.sh
|
||||
source ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k/powerlevel10k.zsh-theme
|
||||
# FZF Previews
|
||||
export FZF_CTRL_T_OPTS="--preview 'bat --color=always -n --line-range :500 {}'"
|
||||
export FZF_ALT_C_OPTS="--preview 'eza --tree --color=always {} | head -200'"
|
||||
|
||||
# Plugins
|
||||
source ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
source ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
|
||||
eval "$(fzf --zsh)"
|
||||
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user