zsh config

とりあえず、現状復帰

autoload -Uz add-zsh-hook vcs_info
setopt prompt_subst
add-zsh-hook precmd my_precmd

zstyle ':vcs_info:git:*' formats '%b'

function my_precmd {
  vcs_info
  local git2color='cyan'
  local branch=''
  [[ "${vcs_info_msg_0_}" != "" ]] && branch="(${vcs_info_msg_0_}) "
  [[ "${vcs_info_msg_0_}" == "main" ]] && git2color='red'
  local git2="%F{${git2color}}${branch}%f"
  psvar[1]="${git2}"
}

PROMPT='${psvar[1]}%~ %F{yellow}%f '
export EDITOR='/opt/homebrew/bin/nvim'
export OPENER='/usr/bin/open'

setopt autocd
setopt correct
setopt correctall

alias vim='nvim'
alias less='bat'
alias mutt='neomutt'
alias publish='$HOME/.config/publish.sh'

setopt extended_history       # record timestamp of command in HISTFILE
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups       # ignore duplicated commands history list
setopt hist_ignore_space      # ignore commands that start with space
setopt hist_verify            # show command with history expansion to user before running it
setopt share_history          # share command history data

function restart_screen {
    if [[ $(uname) == 'Darwin' ]]; then
        yabai --stop-service
        yabai --start-service
        brew services restart sketchybar > /dev/null
    fi
}

# zsh completions
if type brew &>/dev/null
then
  FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"

  autoload -Uz compinit
  compinit
fi

source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh

lfcd () {
    tmp="$(mktemp)"
    lf -last-dir-path="$tmp" "$@"
    if [ -f "$tmp" ]; then
        dir="$(cat "$tmp")"
        rm -f "$tmp"
        if [ -d "$dir" ]; then
            if [ "$dir" != "$(pwd)" ]; then
                cd "$dir"
            fi
        fi
    fi
}

alias lf='lfcd'

# Node Version Manager
export NVM_DIR="$HOME/.nvm"
 [ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"  # This loads nvm
  [ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"  # This loads nvm bash_completion

# fzf
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

# brew install zoxide
eval "$(zoxide init zsh)"
alias cd='z'

# brew install bottom
alias htop='btm'

# brew install exa
# alias ls='exa -l --group-directories-first --no-user --git -s mod -r'
alias ls='eza'

alias email='himalaya list'
alias reply='himalaya reply --all'
alias trash='himalaya delete'

alias mmm='~/.config/org-capture-task.sh'

function check {
    himalaya read $1 | less
}

# moves the mail to 'GMail/All Mail'
function archive {
    himalaya move "[Gmail]/All Mail" $1
}

# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/yasushi/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/yasushi/google-cloud-sdk/path.zsh.inc'; fi

# The next line enables shell command completion for gcloud.
if [ -f '/Users/yasushi/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/yasushi/google-cloud-sdk/completion.zsh.inc'; fi

# git interfaces (lazygit, gitui) need this everyonce in a while
ssh-add ~/.ssh/new_sunny >/dev/null 2>&1

# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/yasushi/Desktop/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/yasushi/Desktop/google-cloud-sdk/path.zsh.inc'; fi

# The next line enables shell command completion for gcloud.
if [ -f '/Users/yasushi/Desktop/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/yasushi/Desktop/google-cloud-sdk/completion.zsh.inc'; fi

# Cargo needs to be there
. "$HOME/.cargo/env"
PATH=/opt/homebrew/bin/:/usr/bin:PATH

<2023-09-08 Fri> .zshenv いじるとやばそうだから tangle やめた

Date: 2023-03-15 Wed 15:48