-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.zshrc
More file actions
161 lines (130 loc) · 4.06 KB
/
Copy path.zshrc
File metadata and controls
161 lines (130 loc) · 4.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# ===== プロンプト設定 =====
# 対話的シェル起動時に毎回読み込まれる
precmd() {
# Gitブランチ名を取得して表示
CURRENT_BRANCH=$(git branch --show-current 2>/dev/null)
if [ -n "$CURRENT_BRANCH" ]; then
CURRENT_BRANCH_TEXT=" (%F{blue}${CURRENT_BRANCH}%f)"
else
unset CURRENT_BRANCH_TEXT
fi
# Devbox環境を表示
if [ "${DEVBOX_SHELL_ENABLED:-}" = "1" ]; then
DEVBOX_TEXT="%F{cyan}📦%f"
else
DEVBOX_TEXT=""
fi
# Python仮想環境名を取得して表示
if [ -n "$VIRTUAL_ENV" ]; then
VENV_NAME=$(basename "$VIRTUAL_ENV")
VENV_TEXT="(%F{yellow}${VENV_NAME}%f) "
else
VENV_TEXT=""
fi
# プロンプト: 📦 (venv) user: ~/path (branch)
PS1="$DEVBOX_TEXT$VENV_TEXT%F{green}%n%f: %F{magenta}%~%f$CURRENT_BRANCH_TEXT"$'\n'"%# "
}
# ===== エイリアス =====
alias vim="nvim"
# モダンツール
alias ls="eza -l --git --icons"
alias la="eza -la --git --icons"
alias cat="bat --style=header,grid"
# 42Tokyo
alias wcc="cc -Wall -Wextra -Werror"
alias wg++="g++ -Wall -Wextra -Werror"
alias norm="norminette -R CheckDefine"
alias francinette=/Users/naoki/francinette/tester.sh
alias paco=/Users/naoki/francinette/tester.sh
# GitHub Actions
alias pinact='go run github.com/suzuki-shunsuke/pinact/cmd/pinact@latest run'
# AtCoder
alias ojt='oj t -c "go run main.go"'
# ghq + fzf
alias repo='ghq-fzf-widget'
alias repov='ghq-fzf-view'
# wine
alias BlueArchive='wine ~/.wine/drive_c/YostarGames/BlueArchive_JP_Gamelauncher/BlueArchive_JP_Gamelauncher.exe'
# ===== 関数 =====
# ghq + fzf
ghq-fzf-select() {
ghq list | fzf \
--exact \
--reverse \
--ansi \
--preview-window=right:50%:wrap \
--preview "eza -la --git --icons --color=always --no-permissions --no-user --no-time --no-filesize $(ghq root)/{}"
}
ghq-fzf-widget() {
local src
src=$(ghq-fzf-select) || return
if [[ -n "$src" ]]; then
cd "$(ghq root)/$src"
fi
}
ghq-fzf-view() {
local src
src=$(ghq-fzf-select) || return
if [[ -n "$src" ]]; then
gh repo view --web "$src"
fi
}
# ffmpeg
minify_video() {
if [ -z "$1" ]; then
echo "Usage: minify_video <video_file>"
return 1
fi
local file_path=$1
local file_ext="${file_path##*.}"
local base_name=$(basename "$file_path" ".$file_ext")
local dir_path=$(dirname "$file_path")
local output_file="${dir_path}/${base_name}_minify.mp4"
echo "Compressing: $file_path"
echo "Output: $output_file"
if ffmpeg -i "$file_path" -vcodec libx264 -crf 23 "$output_file"; then
echo "\nCompression completed!"
read -q "?Delete original file? (y/N): "
echo
if [[ $REPLY == "y" ]]; then
rm "$file_path"
echo "\033[32m✓ Successfully deleted:\033[0m $file_path"
fi
else
echo "Error: Compression failed"
return 1
fi
}
# man
man() {
env GROFF_NO_SGR=1 LESS_TERMCAP_mb=$'\E[01;31m' \
LESS_TERMCAP_md=$'\E[01;38;5;74m' \
LESS_TERMCAP_me=$'\E[0m' \
LESS_TERMCAP_se=$'\E[0m' \
LESS_TERMCAP_so=$'\E[38;5;246m' \
LESS_TERMCAP_ue=$'\E[0m' \
LESS_TERMCAP_us=$'\E[04;38;5;146m' \
man "$@"
}
# 指定したportをkill
kpp() {
pid=`lsof -i :"$1" -t`
wait
if [ -z $pid ]; then
tput bel
echo "$(tput setaf 3)🧘 No Process on Port $1$(tput sgr 0)"
else
kill -9 $pid
lsof -i :"$1" -t 2>/dev/null >/dev/null || echo "$(tput setaf 2)🔪 Killed Processes on Port $1$(tput sgr 0)"
fi
}
# ===== オプション =====
# ===== プラグイン =====
# sheldon
eval "$(sheldon source)"
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/naoki/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/naoki/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/naoki/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/naoki/google-cloud-sdk/completion.zsh.inc'; fi
# Vite+ bin (https://viteplus.dev)
. "$HOME/.vite-plus/env"