switch to rose pine to cover both light and dark themes
This commit is contained in:
@@ -11,7 +11,10 @@ alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
|
||||
alias d='dirs -v'
|
||||
# shfmt needs to ignore this because it is a zsh specific syntax
|
||||
# shfmt:ignore:start
|
||||
for index ({1..9}) alias "c$index"="cd +${index}"; unset index
|
||||
# shfmt:ignore:end
|
||||
|
||||
_get_aws_config_path() {
|
||||
local config_path="${AWS_CONFIG_FILE:-$HOME/.aws/config}"
|
||||
@@ -102,11 +105,46 @@ alias tgi="tg grunt init"
|
||||
alias tgp="tg grunt plan -lock=false"
|
||||
alias tga="tg grunt apply"
|
||||
alias tgu="tg grunt get -update"
|
||||
alias tgg="tg grunt graph-dependencies"
|
||||
|
||||
alias idot='dot -Tsvg -Goverlap=scale -Grankdir=RL -Gbgcolor="#282a36" -Ncolor="#f8f8f2" -Ecolor="#f8f8f2" -Nfontcolor="#f8f8f2" -Gfontname="PragmataPro Mono Liga Regular" -Gfontsize=13 -Nfontname="PragmataPro" -Nfontsize=13 -Nshape=box -Earrowhead=normal'
|
||||
|
||||
alias curltime="curl -w \"@$HOME/.curl-format.txt\" -o /dev/null -s "
|
||||
|
||||
alias vi=nvim
|
||||
alias vim=nvim
|
||||
|
||||
git_root() {
|
||||
# Check if we're in a git repository
|
||||
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
|
||||
echo "Error: Not in a git repository" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Get the root of the git repository
|
||||
local git_root
|
||||
git_root=$(git rev-parse --show-toplevel)
|
||||
|
||||
if [ -n "$git_root" ]; then
|
||||
echo "Changing directory to git root: $git_root"
|
||||
cd "$git_root"
|
||||
return 0
|
||||
else
|
||||
echo "Error: Could not determine git root directory" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
alias groot="git_root"
|
||||
|
||||
git_push() {
|
||||
# Check if we're in a git repository
|
||||
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
|
||||
echo "Error: Not in a git repository" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local branch
|
||||
branch=$(git branch --show-current)
|
||||
|
||||
git push origin "$branch" $@
|
||||
}
|
||||
|
||||
alias gpush="git_push"
|
||||
|
||||
110
zsh/.zshrc
110
zsh/.zshrc
@@ -8,28 +8,40 @@ setopt HIST_IGNORE_SPACE # Do not record an event starting with a space.
|
||||
unsetopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file.
|
||||
setopt SHARE_HISTORY # Share history between all sessions.
|
||||
|
||||
bindkey -e
|
||||
|
||||
bindkey '^R' history-incremental-search-backward
|
||||
bindkey '^A' beginning-of-line
|
||||
bindkey '^E' end-of-line
|
||||
bindkey '^K' kill-line
|
||||
|
||||
bindkey "^[[1;5C" forward-word
|
||||
bindkey "^[[1;5D" backward-word
|
||||
|
||||
setopt AUTO_PUSHD # Push the current directory visited on the stack.
|
||||
setopt PUSHD_IGNORE_DUPS # Do not store duplicates in the stack.
|
||||
setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd.
|
||||
|
||||
DISABLE_AUTO_TITLE="true"
|
||||
|
||||
# install zsh-syntax-highlighting
|
||||
case "$(uname -s)" in
|
||||
Linux*) {
|
||||
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
|
||||
} ;;
|
||||
Darwin*) {
|
||||
source "$(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
export LESSOPEN="|$(brew --prefix)/bin/lesspipe.sh %s"
|
||||
} ;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
bindkey "^[[1;5C" forward-word
|
||||
bindkey "^[[1;5D" backward-word
|
||||
if [ -f ~/.zsh_aliases ]; then
|
||||
. ~/.zsh_aliases
|
||||
fi
|
||||
|
||||
# Set fpath before sourcing completion.zsh
|
||||
fpath=("$DOTFILES/zsh/zsh-completions/src" $fpath)
|
||||
@@ -37,16 +49,92 @@ fpath=("$DOTFILES/zsh/zsh-completions/src" $fpath)
|
||||
source "$DOTFILES/zsh/completion.zsh"
|
||||
source "$DOTFILES/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh"
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
# export starship_precmd_user_func="set_win_title"
|
||||
#
|
||||
# eval "$(starship init zsh)"
|
||||
|
||||
if [ -f ~/.zsh_aliases ]; then
|
||||
. ~/.zsh_aliases
|
||||
fi
|
||||
autoload -Uz vcs_info
|
||||
setopt prompt_subst
|
||||
|
||||
function set_win_title() {
|
||||
echo -ne "\033]0; $(basename "$PWD") \007"
|
||||
zstyle ':vcs_info:*' enable git
|
||||
zstyle ':vcs_info:*' max-exports 3
|
||||
|
||||
zstyle ':vcs_info:*+*:*' debug false
|
||||
|
||||
zstyle ':vcs_info:git:*' check-for-changes true
|
||||
zstyle ':vcs_info:git:*' get-revision false
|
||||
zstyle ':vcs_info:git:*' stagedstr '+'
|
||||
zstyle ':vcs_info:git:*' unstagedstr '!'
|
||||
|
||||
zstyle ':vcs_info:git*:*' use-simple true
|
||||
zstyle ':vcs_info:git*:*' cache-ttl 30 # Cache for 30 seconds
|
||||
|
||||
function preexec() {
|
||||
# Command execution timer
|
||||
timer=${timer:-$SECONDS}
|
||||
|
||||
# Check if the command is a git command
|
||||
if [[ "$1" == git* || "$1" == "g "* ]]; then
|
||||
__GIT_COMMAND_EXECUTED=1
|
||||
else
|
||||
__GIT_COMMAND_EXECUTED=0
|
||||
fi
|
||||
}
|
||||
export starship_precmd_user_func="set_win_title"
|
||||
|
||||
eval "$(starship init zsh)"
|
||||
precmd() {
|
||||
if [[ $__GIT_COMMAND_EXECUTED -eq 1 ]]; then
|
||||
zstyle ':vcs_info:git*:*' cache-ttl 0
|
||||
__GIT_COMMAND_EXECUTED=0
|
||||
fi
|
||||
vcs_info
|
||||
zstyle ':vcs_info:git*:*' cache-ttl 30
|
||||
|
||||
PS1=$'%B%(?.%F{240}--.%F{red}!%?)%f '
|
||||
|
||||
if [[ -z ${vcs_info_msg_0_} ]]; then
|
||||
PS1+=$'%F{cyan}%5~%f%b '
|
||||
else
|
||||
PS1+=$'%F{cyan}%3~%f%b ${vcs_info_msg_0_} '
|
||||
fi
|
||||
|
||||
if [ $timer ]; then
|
||||
timer_show=$(($SECONDS - $timer))
|
||||
if [ $timer_show -gt 3 ]; then
|
||||
PS1+=$'%F{240}-- %ftook %F{red}${timer_show}s %f'
|
||||
fi
|
||||
unset timer
|
||||
fi
|
||||
|
||||
PS1+=$'\n;; '
|
||||
}
|
||||
zstyle ':vcs_info:git*' formats "%F{red}⎇ %b %F{blue}[%c%u] %F{240}(%F{red}%m%F{240})%f" # branch [staged unstaged(+untracked)] (misc(ahead/behind))
|
||||
|
||||
zstyle ':vcs_info:git*+set-message:*' hooks git-untracked
|
||||
+vi-git-untracked() {
|
||||
if [[ $(git rev-parse --is-inside-work-tree 2>/dev/null) == 'true' ]] &&
|
||||
git status --porcelain | grep -m1 --mmap '??' &>/dev/null; then
|
||||
hook_com[unstaged]+='?'
|
||||
fi
|
||||
}
|
||||
# zstyle ':vcs_info:git*+set-message:*' hooks git-st
|
||||
# function +vi-git-st() {
|
||||
# local ahead behind
|
||||
# local -a gitstatus
|
||||
#
|
||||
# # Exit early in case the worktree is on a detached HEAD
|
||||
# git rev-parse ${hook_com[branch]}@{upstream} >/dev/null 2>&1 || return 0
|
||||
#
|
||||
# local -a ahead_and_behind=(
|
||||
# $(git rev-list --left-right --count HEAD...${hook_com[branch]}@{upstream} 2>/dev/null)
|
||||
# )
|
||||
#
|
||||
# ahead=${ahead_and_behind[1]}
|
||||
# behind=${ahead_and_behind[2]}
|
||||
#
|
||||
# (( $ahead )) && gitstatus+=( "+${ahead}" )
|
||||
# (( $behind )) && gitstatus+=( "-${behind}" )
|
||||
#
|
||||
# # shfmt:ignore:start
|
||||
# hook_com[misc]+=${(j:/:)gitstatus}
|
||||
# # shfmt:ignore:end
|
||||
# }
|
||||
|
||||
Reference in New Issue
Block a user