2023-08-17 14:14:00 +09:00
|
|
|
# Preztoにぶん投げ
|
|
|
|
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
|
|
|
|
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
|
|
|
|
fi
|
|
|
|
|
2023-11-21 21:52:37 +09:00
|
|
|
# fzf.zshの読み込み
|
|
|
|
[ -f /usr/share/fzf/key-bindings.zsh ] && source /usr/share/fzf/key-bindings.zsh
|
|
|
|
[ -f /usr/share/fzf/completion.zsh ] && source /usr/share/fzf/completion.zsh
|
|
|
|
|
2023-11-23 10:06:52 +09:00
|
|
|
# ロケール
|
|
|
|
export LC_ALL=ja_JP.UTF-8
|
|
|
|
export LANG=ja_JP.UTF-8
|
|
|
|
|
2023-08-17 14:14:00 +09:00
|
|
|
# 上位階層に移動するコマンド
|
2023-11-25 18:18:58 +09:00
|
|
|
alias a="cd ../"
|
|
|
|
alias aa="cd ../../"
|
|
|
|
alias aaa="cd ../../../"
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
# デフォルトエディタをVimにする
|
|
|
|
export EDITOR=nvim
|
2023-11-25 18:18:58 +09:00
|
|
|
alias sudo="sudo -E "
|
2023-08-17 14:14:00 +09:00
|
|
|
alias v=nvim
|
|
|
|
alias vim=nvim
|
|
|
|
|
|
|
|
# paruを短縮する
|
|
|
|
alias poo=paru
|
|
|
|
|
2024-02-25 09:28:05 +09:00
|
|
|
# gitの短縮
|
|
|
|
alias g="git"
|
|
|
|
alias ga="git add"
|
|
|
|
alias gc="git commit"
|
|
|
|
alias gp="git push"
|
|
|
|
alias gr="git rebase"
|
|
|
|
alias gl="git log"
|
|
|
|
|
2024-08-06 13:58:54 +09:00
|
|
|
# ezaをls代わりにする
|
2024-10-24 10:52:15 +09:00
|
|
|
alias ls="eza -a"
|
|
|
|
alias lsl="eza -la"
|
|
|
|
alias lsa="eza -T -a"
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
# batをcatの代わりにする
|
2023-11-23 10:06:52 +09:00
|
|
|
alias cat="bat --color=always --style=plain"
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
# clearを短縮する
|
|
|
|
alias cls=clear
|
|
|
|
|
|
|
|
# 天気情報
|
2024-07-16 10:12:52 +09:00
|
|
|
alias wttr="() { curl -H 'Accept-Language: ${LANG%_ja}' wttr.in/'${1:-Tokyo}' }"
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
# BAT関連
|
2024-10-23 17:55:41 +09:00
|
|
|
export BAT_THEME="ansi"
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
# Zoxide関連
|
|
|
|
eval "$(zoxide init zsh)"
|
|
|
|
zle -N zi
|
2023-11-25 18:18:58 +09:00
|
|
|
bindkey "^z" zi
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
# Tailscale関連
|
2023-11-25 18:18:58 +09:00
|
|
|
alias tlsc="sudo tailscale up --exit-node-allow-lan-access --exit-node=mystech"
|
|
|
|
alias tlscd="sudo tailscale down"
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
# fzf関連
|
2023-11-25 18:18:58 +09:00
|
|
|
export FZF_TMUX="1"
|
|
|
|
export FZF_TMUX_OPTS="-p 50%"
|
2023-11-21 21:52:37 +09:00
|
|
|
export FZF_CTRL_R_OPTS="--reverse --preview 'echo {}' --preview-window=border-sharp,down:3:hidden:wrap --bind '?:toggle-preview'"
|
2023-11-25 18:18:58 +09:00
|
|
|
export FZF_DEFAULT_COMMAND="rg --files --hidden 2> /dev/null --follow --glob '!.git/*'"
|
2023-11-21 21:52:37 +09:00
|
|
|
export FZF_DEFAULT_OPTS="--ansi --no-separator --no-scrollbar --reverse --border=none \
|
2024-10-24 10:52:15 +09:00
|
|
|
--color=bg+:#272e33,bg:#272e33,spinner:#a7c080,hl:#a7c080 \
|
|
|
|
--color=fg:#d3c6aa,header:#a7c080,info:#a7c080,pointer:#a7c080 \
|
|
|
|
--color=marker:#a7c080,fg+:#d3c6aa,prompt:#dbbc7f,hl+:#a7c080"
|
2023-11-25 18:18:58 +09:00
|
|
|
export FZF_CTRL_T_COMMAND="rg --files --hidden 2> /dev/null --follow --glob '!.git/*'"
|
2023-11-22 07:12:33 +09:00
|
|
|
export FZF_CTRL_T_OPTS="--preview 'bat --color=always --style=plain --line-range :100 {}' --preview-window=border-sharp,right:60%"
|
2023-11-25 18:18:58 +09:00
|
|
|
export FZF_ALT_C_COMMAND="fd -t d --hidden"
|
2023-11-24 20:27:10 +09:00
|
|
|
export FZF_ALT_C_OPTS="--preview 'eza {} -h -T -F --no-user --no-time --no-filesize --no-permissions --long | head -200' --preview-window=border-sharp,hidden:right:60% --bind '?:toggle-preview'"
|
2023-11-21 21:52:37 +09:00
|
|
|
export RUNEWIDTH_EASTASIAN=0
|
2023-11-25 18:18:58 +09:00
|
|
|
bindkey "^[t" fzf-file-widget
|
|
|
|
bindkey "^[r" fzf-history-widget
|
|
|
|
bindkey -r "^T"
|
|
|
|
bindkey -r "^R"
|
|
|
|
|
|
|
|
fv() {
|
2023-11-26 15:57:11 +09:00
|
|
|
IFS=$'\n' files=($(fzf --height 50% --preview 'bat --color=always --style=plain {}' --preview-window=border-sharp,right:60% --query="$1" --multi --select-1 --exit-0))
|
2023-11-25 18:18:58 +09:00
|
|
|
[[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}"
|
|
|
|
zsh
|
|
|
|
}
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
fadd() {
|
|
|
|
local out q n addfiles
|
|
|
|
while out=$(
|
|
|
|
git status --short |
|
|
|
|
awk '{if (substr($0,2,1) !~ / /) print $2}' |
|
2023-11-26 15:57:11 +09:00
|
|
|
fzf --height 30% --multi --exit-0 --expect=ctrl-d); do
|
2023-08-17 14:14:00 +09:00
|
|
|
q=$(head -1 <<< "$out")
|
|
|
|
n=$[$(wc -l <<< "$out") - 1]
|
|
|
|
addfiles=(`echo $(tail "-$n" <<< "$out")`)
|
|
|
|
[[ -z "$addfiles" ]] && continue
|
|
|
|
if [ "$q" = ctrl-d ]; then
|
|
|
|
git diff --color=always $addfiles | less -R
|
|
|
|
else
|
|
|
|
git add $addfiles
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2023-11-23 10:06:52 +09:00
|
|
|
fman() {
|
2023-11-26 15:57:11 +09:00
|
|
|
man -k . | fzf --height 50% -q "$1" --prompt='man> ' --preview $'echo {} | tr -d \'()\' | awk \'{printf "%s ", $2} {print $1}\' | xargs -r man | col -bx | bat -l man -p --color always' --preview-window=border-sharp,right:60% --bind '?:toggle-preview' | tr -d '()' | awk '{printf "%s ", $2} {print $1}' | xargs -r man
|
2023-08-17 14:14:00 +09:00
|
|
|
}
|
2023-11-23 10:06:52 +09:00
|
|
|
export MANPAGER="sh -c 'col -bx | bat -l man -p --paging always'"
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
# 履歴関連
|
|
|
|
HISTFILE=~/.zsh_history # ヒストリを保存するファイル
|
|
|
|
HISTSIZE=10000 # メモリに保存されるヒストリの件数
|
|
|
|
SAVEHIST=10000 # 保存されるヒストリの件数
|
|
|
|
setopt bang_hist # !を使ったヒストリ展開を行う(d)
|
|
|
|
setopt extended_history # ヒストリに実行時間も保存する
|
|
|
|
setopt hist_reduce_blanks # 余分なスペースを削除してヒストリに保存する
|
2024-02-25 17:38:34 +09:00
|
|
|
|
|
|
|
## rbenv
|
|
|
|
eval "$(rbenv init - zsh)"
|
2024-07-16 10:12:52 +09:00
|
|
|
|
|
|
|
## Flutter
|
|
|
|
export CHROME_EXECUTABLE="/usr/bin/vivaldi"
|