Skip to content

Instantly share code, notes, and snippets.

@hbsnow
Last active November 15, 2020 02:38
Show Gist options
  • Save hbsnow/3c8991898f8830b58c67dfa33426cac4 to your computer and use it in GitHub Desktop.
Save hbsnow/3c8991898f8830b58c67dfa33426cac4 to your computer and use it in GitHub Desktop.
zsh設定ファイル
export LANG=ja_JP.UTF-8
export LC_ALL=ja_JP.UTF-8
export VISUAL='code -w'
export EDITOR=$VISUAL
autoload -Uz is-at-least
# prezto
if [ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi
# anyenv
if [ -d $HOME/.anyenv ]; then
export PATH="$HOME/.anyenv/bin:$PATH"
fi
# cdr
if is-at-least 4.3.11; then
autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
add-zsh-hook chpwd chpwd_recent_dirs
chpwd_functions+=chpwd_recent_dirs
zstyle ':chpwd:*' recent-dirs-max 1000
zstyle ':chpwd:*' recent-dirs-default true
zstyle ':completion:*' recent-dirs-insert always
# 既に存在しないディレクトリをcdrのリストから削除する
# https://blog.n-z.jp/blog/2014-07-25-compact-chpwd-recent-dirs.html
function _my-compact-chpwd-recent-dirs() {
emulate -L zsh
setopt extendedglob
local -aU reply
integer history_size
autoload -Uz chpwd_recent_filehandler
chpwd_recent_filehandler
history_size=$#reply
reply=(${^reply}(N))
(( $history_size == $#reply )) || chpwd_recent_filehandler $reply
}
_my-compact-chpwd-recent-dirs
fi
@hbsnow
Copy link
Author

hbsnow commented Nov 12, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment