diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f7a1de1 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "tmux/.tmux/plugins/tpm"] + path = tmux/.tmux/plugins/tpm + url = https://github.com/tmux-plugins/tpm diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index 1b59405..f364508 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -1,17 +1,18 @@ set -g mouse on -# Open new windows with the same directory -unbind c -bind c new-window -c "#{pane_current_path}" +# Plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'rose-pine/tmux' +set -g @plugin 'ofirgall/tmux-window-name' -# Binds -unbind '"' -unbind % -bind | split-window -h -c "#{pane_current_path}" -bind - split-window -v "#{pane_current_path}" +# Plugin config +source $HOME/.tmux/plugin-configs/rose-pine.conf -# Alt-arrow switching -bind -n M-Left select-pane -L -bind -n M-Right select-pane -R -bind -n M-Up select-pane -U -bind -n M-Down select-pane -D +# General config +source $HOME/.tmux/globals.conf + +# Keybindings +source $HOME/.tmux/bindings.conf + +# Initialise tmux plugin manager. +run $HOME/.tmux/plugins/tpm/tpm diff --git a/tmux/.tmux/.gitignore b/tmux/.tmux/.gitignore new file mode 100644 index 0000000..16873f6 --- /dev/null +++ b/tmux/.tmux/.gitignore @@ -0,0 +1 @@ +plugins/ diff --git a/tmux/.tmux/bindings.conf b/tmux/.tmux/bindings.conf new file mode 100644 index 0000000..1b59405 --- /dev/null +++ b/tmux/.tmux/bindings.conf @@ -0,0 +1,17 @@ +set -g mouse on + +# Open new windows with the same directory +unbind c +bind c new-window -c "#{pane_current_path}" + +# Binds +unbind '"' +unbind % +bind | split-window -h -c "#{pane_current_path}" +bind - split-window -v "#{pane_current_path}" + +# Alt-arrow switching +bind -n M-Left select-pane -L +bind -n M-Right select-pane -R +bind -n M-Up select-pane -U +bind -n M-Down select-pane -D diff --git a/tmux/.tmux/gitmux.conf b/tmux/.tmux/gitmux.conf new file mode 100644 index 0000000..4e8e059 --- /dev/null +++ b/tmux/.tmux/gitmux.conf @@ -0,0 +1,85 @@ +tmux: + # The symbols section defines the symbols printed before specific elements + # of Git status displayed in tmux status string. + symbols: + # current branch name. + branch: "⎇ " + # Git SHA1 hash (in 'detached' state). + hashprefix: ":" + # 'ahead count' when local and remote branch diverged. + ahead: ↑· + # 'behind count' when local and remote branch diverged. + behind: ↓· + # count of files in the staging area. + staged: "● " + # count of files in conflicts. + conflict: "✖ " + # count of modified files. + modified: "✚ " + # count of untracked files. + untracked: "… " + # count of stash entries. + stashed: "⚑ " + # count of inserted lines (stats section). + insertions: Σ + # count of deleted lines (stats section). + deletions: Δ + # Shown when the working tree is clean. + clean: ✔ + + # Styles are tmux format strings used to specify text colors and attributes + # of Git status elements. See the STYLES section of tmux man page. + # https://man7.org/linux/man-pages/man1/tmux.1.html#STYLES. + styles: + # Clear previous style. + clear: "#[none]" + # Special tree state strings such as [rebase], [merge], etc. + state: "#[fg=red,bold]" + # Local branch name + branch: "#[fg=white,bold]" + # Remote branch name + remote: "#[fg=cyan]" + # 'divergence' counts + divergence: "#[fg=yellow]" + # 'staged' count + staged: "#[fg=green,bold]" + # 'conflicts' count + conflict: "#[fg=red,bold]" + # 'modified' count + modified: "#[fg=red,bold]" + # 'untracked' count + untracked: "#[fg=magenta,bold]" + # 'stash' count + stashed: "#[fg=cyan,bold]" + # 'insertions' count + insertions: "#[fg=green]" + # 'deletions' count + deletions: "#[fg=red]" + # 'clean' symbol + clean: "#[fg=green,bold]" + + # The layout section defines what components gitmux shows and the order in + # which they appear on tmux status bar. + # + # Allowed components: + # - branch: local branch name. Examples: `⎇ main`, `⎇ :345e7a0` or `[rebase]` + # - remote-branch: remote branch name, for example: `origin/main`. + # - divergence: divergence between local and remote branch, if any. Example: `↓·2↑·1` + # - remote: alias for `remote-branch` followed by `divergence`, for example: `origin/main ↓·2↑·1` + # - flags: symbols representing the working tree state, for example `✚ 1 ⚑ 1 … 2` + # - stats: insertions/deletions (lines), for example`Σ56 Δ21` + # - some string `foo`: any other character of string is directly shown, for example `foo` or `|` + layout: [branch, remote-branch, divergence, " - ", flags] + + # Additional configuration options. + options: + # Maximum displayed length for local and remote branch names. + branch_max_len: 0 + # Trim left or right end of the branch (`right` or `left`). + branch_trim: right + # Character indicating whether and where a branch was truncated. + ellipsis: … + # Hides the clean flag + hide_clean: false + # Swaps order of behind & ahead upstream counts - "↓·1↑·1" -> "↑·1↓·1" + swap_divergence: false diff --git a/tmux/.tmux/globals.conf b/tmux/.tmux/globals.conf new file mode 100644 index 0000000..b8a7cef --- /dev/null +++ b/tmux/.tmux/globals.conf @@ -0,0 +1 @@ +set -g status-interval 2 diff --git a/tmux/.tmux/plugin-configs/rose-pine.conf b/tmux/.tmux/plugin-configs/rose-pine.conf new file mode 100644 index 0000000..7e77f95 --- /dev/null +++ b/tmux/.tmux/plugin-configs/rose-pine.conf @@ -0,0 +1,14 @@ +# Config for rose-pine theme +set -g @rose_pine_variant 'main' +set -g @rose_pine_host 'off' +set -g @rose_pine_date_time '%H:%M' +set -g @rose_pine_user 'on' +set -g @rose_pine_directory 'off' +set -g @rose_pine_bar_bg_disable 'on' +set -g @rose_pine_only_windows 'off' +set -g @rose_pine_disable_active_window_menu 'on' +set -g @rose_pine_show_current_program 'off' +set -g @rose_pine_show_pane_directory 'off' + +set -g @rose_pine_status_left_prepend_section "#(~/go/bin/gitmux -cfg ~/.tmux/gitmux.conf '#{pane_current_path}')" + diff --git a/tmux/.tmux/plugins/tpm b/tmux/.tmux/plugins/tpm new file mode 160000 index 0000000..99469c4 --- /dev/null +++ b/tmux/.tmux/plugins/tpm @@ -0,0 +1 @@ +Subproject commit 99469c4a9b1ccf77fade25842dc7bafbc8ce9946