-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(chezmoi): fix externals and add tmux config
- Loading branch information
misumisumi
committed
Feb 9, 2025
1 parent
169cd6f
commit 66a5f6e
Showing
7 changed files
with
223 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
[".config/nvim"] | ||
type = "git-repo" | ||
url = "https://github.com/misumisumi/nvimdots" | ||
executable = true | ||
refreshPeriod = "168h" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[".tmux/plugins/tpm"] | ||
type = "git-repo" | ||
url = "https://github.com/tmux-plugins/tpm.git" | ||
refreshPeriod = "168h" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
|
||
set -g @plugin "tmux-plugins/tpm" | ||
set -g default-terminal "tmux-256color" | ||
set -g base-index 1 | ||
setw -g pane-base-index 1 | ||
|
||
|
||
|
||
|
||
|
||
set -g status-keys vi | ||
set -g mode-keys vi | ||
|
||
bind -N "Select pane to the left of the active pane" h select-pane -L | ||
bind -N "Select pane below the active pane" j select-pane -D | ||
bind -N "Select pane above the active pane" k select-pane -U | ||
bind -N "Select pane to the right of the active pane" l select-pane -R | ||
|
||
bind -r -N "Resize the pane left by 5" \ | ||
H resize-pane -L 5 | ||
bind -r -N "Resize the pane down by 5" \ | ||
J resize-pane -D 5 | ||
bind -r -N "Resize the pane up by 5" \ | ||
K resize-pane -U 5 | ||
bind -r -N "Resize the pane right by 5" \ | ||
L resize-pane -R 5 | ||
|
||
|
||
# rebind main key: C-b | ||
unbind C-b | ||
set -g prefix C-b | ||
bind -N "Send the prefix key through to the application" \ | ||
C-b send-prefix | ||
|
||
|
||
|
||
|
||
set -g mouse off | ||
set -g focus-events off | ||
setw -g aggressive-resize off | ||
setw -g clock-mode-style 24 | ||
set -s escape-time 10 | ||
set -g history-limit 10000 | ||
|
||
# ============================================= # | ||
# Load plugins with Home Manager # | ||
# --------------------------------------------- # | ||
|
||
# tmuxplugin-sensible | ||
# --------------------- | ||
|
||
set -g @plugin tmux-plugins/tmux-sensible | ||
|
||
|
||
# tmuxplugin-extrakto | ||
# --------------------- | ||
|
||
set -g @plugin laktak/extrakto | ||
|
||
|
||
# tmuxplugin-tmux-fzf | ||
# --------------------- | ||
|
||
set -g @plugin 'sainnhe/tmux-fzf' | ||
|
||
|
||
# tmuxplugin-resurrect | ||
# --------------------- | ||
set -g @resurrect-capture-pane-contents 'on' | ||
|
||
set -g @plugin tmux-plugins/tmux-resurrect | ||
|
||
|
||
# tmuxplugin-continuum | ||
# --------------------- | ||
set -g @continuum-save-interval '10' | ||
|
||
set -g @plugin tmux-plugins/tmux-continuum | ||
|
||
|
||
# tmuxplugin-dracula | ||
# --------------------- | ||
set -g @dracula-cpu-usage-label "CPU" | ||
set -g @dracula-gpu-usage-label "GPU" | ||
set -g @dracula-ram-usage-label "RAM" | ||
set -g @dracula-refresh-rate 5 | ||
set -g @dracula-show-battery false | ||
set -g @dracula-show-fahrenheit false | ||
set -g @dracula-show-flags true | ||
set -g @dracula-show-left-icon session | ||
set -g @dracula-show-powerline true | ||
set -g @dracula-show-timezone false | ||
|
||
if-shell '[ -z $SSH_CONNECTION ]' { | ||
set -g @dracula-plugins "time" | ||
set -g @dracula-time-colors "dark_purple white" | ||
} { | ||
set -g @dracula-plugins "cpu-usage gpu-usage ram-usage time" | ||
set -g @dracula-time-colors "dark_purple white" | ||
set -g @dracula-ram-usage-colors "white dark_purple" | ||
set -g @dracula-gpu-usage-colors "dark_purple white" | ||
set -g @dracula-cpu-usage-colors "white dark_purple" | ||
} | ||
|
||
set -g @plugin dracula/tmux | ||
|
||
|
||
# tmuxplugin-tilish | ||
# --------------------- | ||
set -g @tilish-default 'main-horizontal' | ||
set -g @tilish-dmenu 'on' | ||
set -g @tilish-prefix "C-n" | ||
set -g @tilish-navigate 'on' | ||
bind -T tailish f resize-pane -Z | ||
bind C-h previous-window | ||
bind C-l next-window | ||
bind | split-window -v # 水平方向split | ||
bind - split-window -h # 垂直方向split | ||
|
||
set -g @plugin 'jabirali/tmux-tilish' | ||
|
||
# ============================================= # | ||
|
||
set -ag terminal-overrides ",xterm-256color:RGB" | ||
set -s focus-events on | ||
setw -g xterm-keys on | ||
set -g mouse on | ||
|
||
setw -g window-active-style fg='#c0caf5',bg='#24283b' | ||
setw -g window-style fg='#a9b1d6',bg='#1d202f' | ||
|
||
set -g display-panes-time 800 # slightly longer pane indicators display time | ||
set -g display-time 1000 # slightly longer status messages display time | ||
|
||
set -g status-interval 10 # redraw status line every 10 seconds | ||
|
||
set-hook -g window-pane-changed[0] "set -w main-pane-height 70%" | ||
set-hook -g window-pane-changed[1] "set -w main-pane-width 75%" | ||
set-hook -g window-pane-changed[2] "select-layout" | ||
set-hook -g session-created[2] "select-layout main-horizontal" | ||
|
||
# activity | ||
set -g monitor-activity on | ||
set -g visual-activity off | ||
|
||
# Emulate visual-mode in copy-mode of tmux & copy to buffer | ||
bind -T copy-mode-vi v send -X begin-selection | ||
bind -T copy-mode-vi C-v send -X rectangle-toggle | ||
bind -T copy-mode-vi y send -X copy-selection-and-cancel | ||
bind -T copy-mode-vi Escape send -X cancel | ||
bind -T copy-mode-vi H send -X start-of-line | ||
bind -T copy-mode-vi L send -X end-of-line | ||
|
||
bind q kill-pane | ||
bind C-q kill-session | ||
bind C-t run "tmux last-pane || tmux last-window || tmux new-window" | ||
bind g popup -w90% -h90% -E lazygit # (prefix) gでlazygitを起動する | ||
|
||
bind i display-panes | ||
|
||
# reload config file | ||
bind r source-file ~/.config/tmux/tmux.conf \; display "Reloaded!" | ||
|
||
run-shell "tmux setenv -g TMUX_VERSION $(tmux -V | cut -c 6- | sed -e 's/[a-z]//g')" | ||
if-shell -b '[ "$(echo "$TMUX_VERSION < 3.0" | bc)" = 1 ]' "bind S choose-tree -s" | ||
if-shell -b '[ "$(echo "$TMUX_VERSION < 3.2" | bc)" = 1 ]' { | ||
bind C-a run-shell "tmux list-sessions | fzf-tmux --reverse | awk -F':' '{print $1}' | xargs tmux switch-client -t" | ||
} | ||
if-shell -b '[ "$(echo "$TMUX_VERSION >= 3.0" | bc)" = 1 ]' "bind S choose-tree -Zs" | ||
if-shell -b '[ "$(echo "$TMUX_VERSION >= 3.2" | bc)" = 1 ]' { | ||
bind C-a run-shell "tmux list-sessions | fzf-tmux -p --reverse | awk -F':' '{print $1}' | xargs tmux switch-client -t" | ||
} | ||
run ~/.tmux/plugins/tpm/tpm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env bash | ||
cd "$(git rev-parse --show-toplevel)" || exit 1 | ||
|
||
# tmux.conf convert from nix to chezmoi | ||
echo "tmux.conf convert from nix to chezmoi" | ||
|
||
TMUXCONF="$XDG_CONFIG_HOME/tmux/tmux.conf" | ||
CHEZMOI_TMUXCONF="chezmoi/dot_config/tmux/tmux.conf" | ||
[ ! -d "$(dirname "$CHEZMOI_TMUXCONF")" ] && mkdir -p "$(dirname "$CHEZMOI_TMUXCONF")" | ||
cp "$TMUXCONF" "$CHEZMOI_TMUXCONF" | ||
chmod +w "$CHEZMOI_TMUXCONF" | ||
|
||
TMUX_PLUGINS_LIST_URL="https://raw.githubusercontent.com/tmux-plugins/list/refs/heads/master/README.md" | ||
TMUX_PLUGINS_LIST=$(curl -s "$TMUX_PLUGINS_LIST_URL" | grep -oP "\(https://github.com.*?\)" | sed -E "s%\(https://github.com/(.*)/(.*)\)%\1/\2%g") | ||
|
||
grep -n -E 'run-shell.*tmux-plugins' "$TMUXCONF" | while read -r line; do | ||
n=$(echo "$line" | cut -d: -f1) | ||
plugin=$(echo "$line" | cut -d: -f2 | cut -d" " -f2 | cut -d"/" -f7) | ||
|
||
if [ "$plugin" == "tilish" ]; then | ||
sed -i -E "${n} s%run-shell.*%set -g @plugin 'jabirali/tmux-tilish'%g" "$CHEZMOI_TMUXCONF" | ||
continue | ||
elif [ "$plugin" == "tmux-fzf" ]; then | ||
sed -i -E "${n} s%run-shell.*%set -g @plugin 'sainnhe/tmux-fzf'%g" "$CHEZMOI_TMUXCONF" | ||
continue | ||
fi | ||
|
||
plugin_repo=$(echo "$TMUX_PLUGINS_LIST" | grep "$plugin") | ||
if [ -z "$plugin_repo" ]; then | ||
echo "plugin_repo not found: $plugin" | ||
else | ||
sed -i -E "${n} s%run-shell.*%set -g @plugin ${plugin_repo}%g" "$CHEZMOI_TMUXCONF" | ||
fi | ||
done | ||
|
||
# add tpm that is tmux plugin manager | ||
sed '1 a set -g @plugin "tmux-plugins/tpm"' -i "$CHEZMOI_TMUXCONF" | ||
echo "run ~/.tmux/plugins/tpm/tpm" >>"$CHEZMOI_TMUXCONF" | ||
|
||
if ! grep -q "/nix/store" "$CHEZMOI_TMUXCONF"; then | ||
echo "Success: tmux.conf convert from nix to chezmoi" | ||
else | ||
echo "Error: tmux.conf convert from nix to chezmoi" | ||
exit 1 | ||
fi |