Code Monkey home page Code Monkey logo

gitmux's Introduction

Gitmux shows git status in your tmux status bar


tests goreport

demo

  • easy. Install and forget about it
  • minimal. Just shows what you need, when you need it
  • discrete. Get out of your way if current directory is not in a Git tree
  • shell-agnostic. Does not rely on shell-features so works with all of them
  • customizable. Colors, symbols and layout are configurable

Prerequisites

Works with all reasonably recent tmux versions (2.1+)

Installing

Binary release

Download the latest binary for your platform/architecture and uncompress it.

Homebrew tap (macOS and linux) (amd64 and arm64)

Install the latest version with:

brew tap arl/arl
brew install gitmux

AUR

Arch Linux users can download the gitmux, gitmux-bin or gitmux-git AUR package.

From source

Download and install a Go compiler (Go 1.16 or later). Run go install to build and install gitmux:

go install github.com/arl/gitmux@latest

Getting started

If your tmux version supports pane_current_path (tmux v2.1+), just add this line to your .tmux.conf:

set -g status-right '#(gitmux "#{pane_current_path}")'

If your tmux doesn't support pane_current_path then you can use a bash-specific solution to achieve relatively similar behaviour: gitmux will refresh after every shell command you run or when you switch windows, however it won't refresh automatically, nor when switching panes.

Note that tmux v2.1 was released in 2015 so you're probably better off updating to a more recent version anyway ๐Ÿ™‚.

Customizing

gitmux output can be customized via a configuration file in YAML format.

This is the default gitmux configuration file, in YAML format:

tmux:
    symbols:
        branch: 'โŽ‡ '
        hashprefix: ':'
        ahead: โ†‘ยท
        behind: โ†“ยท
        staged: 'โ— '
        conflict: 'โœ– '
        modified: 'โœš '
        untracked: 'โ€ฆ '
        stashed: 'โš‘ '
        clean: โœ”
        insertions: ฮฃ
        deletions: ฮ”
    styles:
        clear: '#[fg=default]'
        state: '#[fg=red,bold]'
        branch: '#[fg=white,bold]'
        remote: '#[fg=cyan]'
        divergence: '#[fg=default]'
        staged: '#[fg=green,bold]'
        conflict: '#[fg=red,bold]'
        modified: '#[fg=red,bold]'
        untracked: '#[fg=magenta,bold]'
        stashed: '#[fg=cyan,bold]'
        clean: '#[fg=green,bold]'
        insertions: '#[fg=green]'
        deletions: '#[fg=red]'
    layout: [branch, .., remote-branch, divergence, '- ', flags]
    options:
        branch_max_len: 0
        branch_trim: right
        ellipsis: โ€ฆ
        hide_clean: false
        swap_divergence: false
        divergence_space: false

First, save the default configuration to a new file:

gitmux -printcfg > $HOME/.gitmux.conf

Modify the line you've added to .tmux.conf, passing the path of the configuration file as argument to gitmux via the -cfg flag

set -g status-right '#(gitmux -cfg $HOME/.gitmux.conf "#{pane_current_path}")'

Open .gitmux.conf and modify it, replacing symbols, styles and layout to suit your needs.

In tmux status bar, gitmux output immediately reflects the changes you make to the configuration.

gitmux configuration is split into 4 sections:

  • symbols: they're just strings of unicode characters
  • styles: tmux format strings
  • layout: list of gitmux layout components, defines the component to show and in their order.
  • options: additional configuration options

Symbols

The symbols section defines the symbols printed before specific elements of Git status displayed in tmux status string:

  symbols:
        branch: "โŽ‡ "    # current branch name.
        hashprefix: ":"  # Git SHA1 hash (in 'detached' state).
        ahead: โ†‘ยท        # 'ahead count' when local and remote branch diverged.
        behind: โ†“ยท       # 'behind count' when local and remote branch diverged.
        staged: "โ— "     # count of files in the staging area.
        conflict: "โœ– "   # count of files in conflicts.
        modified: "โœš "   # count of modified files.
        untracked: "โ€ฆ "  # count of untracked files.
        stashed: "โš‘ "    # count of stash entries.
        insertions: ฮฃ    # count of inserted lines (stats section).
        deletions: ฮ”     # count of deleted lines (stats section).
        clean: โœ”         # Shown when the working tree is clean.

Styles

Styles are tmux format strings used to specify text colors and attributes of Git status elements. See the STYLES section of tmux man page.

  styles:
    clear: '#[fg=default]'          # Clear previous style.
    state: '#[fg=red,bold]'         # Special tree state strings such as [rebase], [merge], etc.
    branch: '#[fg=white,bold]'      # Local branch name
    remote: '#[fg=cyan]'            # Remote branch name
    divergence: "#[fg=yellow]"      # 'divergence' counts
    staged: '#[fg=green,bold]'      # 'staged' count
    conflict: '#[fg=red,bold]'      # 'conflicts' count
    modified: '#[fg=red,bold]'      # 'modified' count
    untracked: '#[fg=magenta,bold]' # 'untracked' count
    stashed: '#[fg=cyan,bold]'      # 'stash' count
    insertions: '#[fg=green]'       # 'insertions' count
    deletions: '#[fg=red]'          # 'deletions' count
    clean: '#[fg=green,bold]'       # 'clean' symbol

Layout components

The layout section defines what components gitmux shows and the order in which they appear on tmux status bar.

For example, the default gitmux layout shows is:

layout: [branch, .., remote-branch, divergence, " - ", flags]

It shows, in that order:

  • the local branch name,
  • 2 dots characters ..,
  • the remote branch name
  • the local/remote divergence
  • a - character
  • and finally the flags representing the working tree state

Note that elements only appear when they make sense, for example if local and remote branch are aligned, the divergence string won't show up. Same thing for the remote branch, etc.

But you can anyway choose to never show some components if you wish, or to present them in a different order.

This is the list of the possible keywords for layout:

Layout keywords Description Example
branch local branch name main
remote-branch remote branch name origin/main
divergence divergence local/remote branch, if any โ†“ยท2โ†‘ยท1
remote alias for remote-branch followed by divergence origin/main โ†“ยท2โ†‘ยท1
flags Symbols representing the working tree state โœš 1 โš‘ 1 โ€ฆ 2
stats Insertions/deletions (lines). Disabled by default ฮฃ56 ฮ”21
any string foo Non-keywords are shown as-is hello gitmux

Some example layouts:

  • default layout:
layout: [branch, .., remote-branch, divergence, " - ", flags]
  • some examples layouts:
layout: [branch, divergence, " - ", flags]
layout: [flags, " ", branch]
layout: [branch, "|", flags, "|", stats]

Additional options

This is the list of additional configuration options:

Option Description Default
branch_max_len Maximum displayed length for local and remote branch names 0 (no limit)
branch_trim Trim left, right or from the center of the branch (right, left or center) right (trailing)
ellipsis Character to show branch name has been truncated โ€ฆ
hide_clean Hides the clean flag entirely false
swap_divergence Swaps order of behind & ahead upstream counts false
divergence_space Add a space between behind & ahead upstream counts false

Troubleshooting

Check the opened and closed issues and don't hesitate to report anything by filing a new one.

Gitmux takes too long to refresh?

In case gitmux takes too long to refresh, try to decrease the value of the status-interval option. A reasonable value is 2 seconds, which you can set in .tmux.conf with:

set -g status-interval 2

Check out tmux man page for more details.

Contributing

Pull requests are welcome.
For major changes, please open an issue first to open a discussion.

License: MIT

gitmux's People

Contributors

antiz96 avatar arl avatar blaok avatar bouteilleralan avatar cdelledonne avatar dependabot[bot] avatar hqkhan avatar joshmedeski avatar macintacos avatar rtalexk avatar salarkhan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gitmux's Issues

gitmux not roturn anting

if i'm run $ gitmux:

#[fg=default]#[fg=default]#[fg=white,bold]โŽ‡ #[fg=default]#[fg=white,bold]master#[fg=default]..#[fg=default]#[fg=cyan]origin/master#[fg=default] - #[fg=default]#[fg=green,bold]โœ”%

if i'm run $ gitmux "#{pane_current_path}" , i dont got any output
what i shoud be run

[BUG] After install the bar did not appear

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
After downloading gitmux via go, I simply follow the guide.

Expected behavior
I should see some thing like that.

Environment:

  • gitmux version: zsh: command not found: gitmux
  • tmux version: tmux 3.0a
  • tmux.conf:
# Source:
# https://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/

# switch panes using Alt-arrow without prefix
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

# Swap panel to left/right
# https://superuser.com/a/552493
bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1

# Reload on the go!
bind -n M-r source-file ~/.tmux.conf \; display-message "Config reloaded..."

# Enable mouse mode/ control (clickable windows, panes, resizable panes) [tmux MUST >= 2.1)
set -g mouse on

# don't rename windows automatically
set-option -g allow-rename on

# -------------------- #
# -------------------- #
# -------------------- #

# Source:
# https://blog.wescale.fr/2019/03/14/tmux-diviser-pour-mieux-regner/

set -g status-position bottom

# -------------------- #
# -------------------- #
# -------------------- #

set -g history-limit 5000

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'arcticicestudio/nord-tmux'

# Automatic tpm installation (https://github.com/tmux-plugins/tpm/blob/master/docs/automatic_tpm_installation.md)
if "test ! -d ~/.tmux/plugins/tpm" \
  "run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
  • OS: Regolith Linux
  • Shell: Zsh

Additional context
I think the fact that I use the nord theme for tmux cause a conflict.

feature-request: truncate long branch names

Hi, I was wondering if you would consider adding a configuration option to allow the user to truncate (and up to how much) long branch names. I encountered some very long branch names, which don't fit in my status bar when on a small screen (e.g. a laptop).

Cheers!

Git info not working with oh-my-tmux setup

Expected Behavior

Git info appearing on the right-hand side of the tmux bar

Actual Behavior

Nothing is showing up

Steps to Reproduce the Problem

  1. Install https://github.com/gpakosz/.tmux
  2. install gitmux
  3. Configure ~/.tmux.conf.local to tmux_conf_theme_status_right='#{prefix}#{pairing}#{synchronized} #(gitmux "#{pane_current_path}"), #{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} '

Specifications

  • OS: MacOS Catalina(10.15.5)
  • gitmux version: <<development version>>
  • tmux version: tmux 3.1b

Doesn't render UTF-8 characters in WSL running Ubuntu

Describe the bug

Doesn't render UTF-8 characters in WSL running Ubuntu.

To Reproduce

  • Install Ubuntu for WSL.
  • Start WSL with "bash" command.
  • Install tmux and gitmux.
  • Configure tmux to load gitmux
  • Run tmux
  • Enter some directory under git control.
  • Look at the gitmux info bar on bottom-right. The first and last characters are question marks.

Expected behavior

The question marks should be UTF-8 characters.

Screenshot

strange characters

Environment:

  • gitmux version: gitmux -V

0.7.4

  • tmux version: tmux -V

tmux next-3.3

  • OS

Windows 10

  • shell (bash/fish/...)

bash

  • your gitmux config gitmux.cfg if you're not using the default one.

Using default.

  • in case the problem only happens in a specific directory, please paste the
    output of gitmux -dbg in that directory.

Happens on all git repositories

Additional context

Locale output:

LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

The new Windows Terminal

It works when I run bash inside the new Windows Terminal.

Conflict+Staged counting

@arl, hello again! Similar problem. Now the conflict is counted as staged. Instead I expect 11 staged, 1 conflicting and 1 untracked.

Demo

Screenshot from 2022-03-01 17-46-56

Raw output of command:

git status --porcelain --branch -z

git.txt

Originally posted by @iusmac in #61 (comment)

Add optional replace 'origin' with nerdfont symbol for origin's URL

Is your feature request related to a problem? Please describe.

It would be nice if the remote name was shortened to a symbol representing the host provider, rather than origin.

Describe the solution you'd like

For remote name (remote, or remote-branch), when the remote url contains a known public domain for a Git hosting service, replace the remote name string (i.e. "origin") with the Nerd Font UTF8 symbol for the remote host:

Host Match Icon Class Hex
GitHub github ๏‚› nf-fa-github f09b
GitLab gitlab ๏Š– nf-fa-gitlab f296
BitBucket bitbucket ๏…ฑ nf-fa-bitbucket f171
(other) (other) ๎œ‚ nf-dev-git e702

Describe alternatives you've considered

  • Use the branch_max_len and branch_trim options. This is not as pretty, can loose information, and is not concise, like the existing flag characters.
  • Provide an option to specify some string for the remote
  • Use shorter strings or symbols for local remote names. Git defaults to origin, and nerd-fonts or other symbols can be difficult to type in git commands.

Additional context

Add any other context or screenshots about the feature request here.

[FEATURE] Conditional Spacing

Is your feature request related to a problem? Please describe.
I would like to conditionally load spaces in my layout based off what data is avaliable.

Describe the solution you'd like
I'd like spaces to be rendered conditionally based on if it's needed to show clear spacing.

Describe alternatives you've considered
I've thought about prepending spaces on the symbols, but it's creates a separate set of problems with spacing.

Additional context
Without spaces, you'll notice the different sections bump up against each other.
Screenshot 2023-03-07 at 5 35 15 PM

If I do include ' ' space values in my layout and the different sections shown I end up with unwanted whitespace.
Screenshot 2023-03-07 at 5 35 33 PM

[FEATURE] Count Line Numbers

Is your feature request related to a problem? Please describe.
As a gitmux user, I want to display the number of lines changed in my repository (instead of number of files changed).

Describe the solution you'd like
Add a count_lines options to the gitmux.conf options.

Describe alternatives you've considered
The alternative is to continue using gitmux as-is by displaying number of files changed.

Additional context
This isn't a deal breaker, showing file numbers is plenty helpful. But GitHub PRs show line numbers changed and I thin it will help me better prioritize committing early to reduce the chances of over-sized commits.

[BUG] Staged changes to be committed added using "git add -p" are not shown

Describe the bug
Gitmux ignores staged files that are not staged at the same time. I have been experienced this behavior for quite a while in all of my projects, and I have always doubted if this is a bug or normal behavior since no one has reported it...

To Reproduce

  1. Make a multiline changes to a file
  2. Add a hunk using git add -p <file>
  3. Check using git status that the <file> is staged and not staged at the
    same time as shown below:
Demo

Screenshot from 2022-02-21 10-59-46

Expected behavior
I expect gitmux to show the counters for a staged file, for a modified file and for an untracked file as in the screenshot:

Demo

Screenshot from 2022-02-21 10-59-46

Environment:

  • gitmux version: 0.7.6
  • tmux version: tmux 3.3-rc
  • OS: Ubuntu 21.10
  • shell: bash 5.1.8(1)-release
gitmux config:
tmux:
  symbols:
    branch: 'โŽ‡  '
    hashprefix: '# '
    ahead: 'โ†‘ '
    behind: 'โ†“ '
    staged: '+ '
    conflict: 'X '
    modified: '~ '
    untracked: '? '
    stashed: 'โš‘  '
    clean: 'OK'
  styles:
    state: '#[fg=colour1]'
    branch: '#[fg=colour8]'
    remote: ' #[fg=colour6]'
    staged: '#[fg=colour2]'
    conflict: '#[fg=colour1]'
    modified: '#[fg=colour11]'
    untracked: '#[fg=colour8]'
    stashed: '#[fg=colour6]'
    clean: '#[fg=colour2]'
  layout: [branch, remote, ' ', flags]

My investigation:
I took a look at the code and executed inside my project directory the same command with the same arguments used in:
https://github.com/arl/gitstatus/blob/3b1abc4b71ca8cf7e6b6d05f4b35a9b75715013c/status.go#L72

err := runAndParse(ctx, &st.Porcelain, "git", "status", "--porcelain", "--branch", "-z")

For 1 modified and 1 untracked file the output was:
## 11...origin/11 M entrypoint.sh?? README.md

After using git add -p I got 1 staged, 1 modified and 1 untracked file and the output was:
## 11...origin/11MM entrypoint.sh?? README.md

The output is different, so it can be distinguished by the parser / interpreter.

[BUG] status flickers gitmux returns nothing

Describe the bug

I noticed that intermittently gitmux returns nothing.

To Reproduce

Today I was able to consistently reproduce the issue.

I cloned Neovim and attached to TMUX see video below. I have another repository open in a second window where it currently works. I do notice that intermittently it also experiences the same issue in that repository, it is rare though.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment:

  • gitmux version: 0.10.2
  • tmux version:
  • OS MacOS
  • shell zsh
  • your gitmux config gitmux.cfg if you're not using the default one.
tmux:
  symbols:
    branch: '๏˜ '
    hashprefix: ':'
    ahead: '๏ข'
    behind: '๏ฃ'
    staged: '๏„‘'
    conflict: '!='
    untracked: '๏™'
    modified: '๏„Œ'
    stashed: 'โ‰ก'
    clean: '๏€Œ'
    insertions: '๏ง'
    deletions: '๏จ'
  styles:
    state: '#[fg=red]'
    branch: '#[fg=magenta]'
    staged: '#[fg=green]'
    conflict: '#[fg=red]'
    modified: '#[fg=blue]'
    untracked: '#[fg=yellow]'
    stashed: '#[fg=gray]'
    clean: '#[fg=green]'
    divergence: '#[fg=magenta]'
  layout: []
  • in case the problem only happens in a specific directory, please paste the
    output of gitmux -dbg in that directory.
{
 "NumModified": 0,
 "NumConflicts": 0,
 "NumUntracked": 0,
 "NumStaged": 0,
 "IsDetached": false,
 "IsInitial": false,
 "LocalBranch": "master",
 "RemoteBranch": "origin/master",
 "AheadCount": 0,
 "BehindCount": 0,
 "NumStashed": 0,
 "HEAD": "c45a111e3",
 "State": "default",
 "IsClean": true,
 "Insertions": 0,
 "Deletions": 0
}

Additional context
Add any other context about the problem here.

At some point the flickering stops and gitmux returns nothing. This is the first time I see that gitmux is not able to recover.

gitmux.mp4

Enhance README

Current README doesn't show examples for styling output, nor using showing git status in another part of the status bar, or in a second status bar.

Parentheses/brackets around gitmux output

It would nice if gitmux would put parentheses or brackets like ()/[]/<> around gitmux info, just to separate git info from other info like path, time.

Since it would need a lot more work in ~/.tmux.conf to do that for git-repo and non-git-repo

Doc: add screenshots to README

The screencast is nice as a quick intro but it doesn't give a full picture when it comes to customizing gitmux output.

Add screenshots for each example layouts and probably add some more screeshots for the styles section.

[FEATURE] Add the LICENSE file to the binary tar.gz archives in releases

Hi,
First of all, thanks for your awesome with gitmux !

Is your feature request related to a problem? Please describe.
Not necessarily a problem but it would better suit the best practice in terms of licensing as it implies to include the license file with your project, which is not the case when installing gitmux via Binary release as you only get the binary (and not the LICENSE) in the tar.gz archive.

Also, I maintain the gitmux-bin AUR package and this request would make the maintenance easier on my side.
Indeed, gitmux being protected by the MIT license, I have to include the LICENSE file (in addition to the binary) during the installation process (see https://wiki.archlinux.org/title/PKGBUILD#license). As the LICENSE file is not included in the binary tar.gz archive itself, I have to get it directly from the GitHub repo.
While grabbing the LICENSE file directly from the GitHub repo is not an issue from a technical stand point, the Arch-Linux packaging guidelines and best-practices imply to check the integrity of every downloaded resources through their hashes before the installation process, for obvious security reason.
According to that, the installation process of the gitmux-bin AUR package depends on the integrity of a file that is subject to change without necessarily leading to a new release. In other words, a change of the LICENSE file on the GitHub repo can make the build fail even tho there's no new release nor changes to the binary (until I update the hash of the LICENSE file accordingly in the PKGBUILD and publish the update).
If the file was provided in the binary tar.gz archive directly, I would not have to rely on its hash, as verifying the integrity of the archives itself would be enough (preventing the possibility of a failed build because of a change in the LICENSE file on the GitHub repo).
The tar.gz archives would then be enough to deliver both the binary and the LICENSE file.

Describe the solution you'd like
Adding the LICENSE file into the different binary tar.gz archives in releases.

Describe alternatives you've considered
While not being as "clean" as the solution described above, an alternative would be to add the LICENSE file directly to the releases assets.
It will make the maintenance on my side a little bit easier as grabbing the LICENSE file from the release guarantee that it will not change (thus nor its hash) until the next release but that's still an additional file to download and check during the install process. Also, this alternative will not change the fact that the MIT custom license will not be provided to people that install gitmux via Binary release .

Additional context
I'm aware that the LICENSE file shouldn't be modified too frequently and thus the above described case might be pretty rare.
On the other hand, I assume this change is fairly easy to do and would improve the binary tar.gz archives structure and the maintenance of the gitmux-bin AUR package, hence my suggestion :)

Thanks for your awesome work BTW !

Consider possibility to choose/reorder/remove the info shown

As of now it's not possible to not show the remote branch, to not show X, to not show Y, to reorder branch and remote, etc, etc. to sum it up, the order and the specific information presented are static.

Not exactly sure how we would make them configurable
Also, is it worth the hassle?

#(gitmux #{pane_current_path}) doesn't work

Expected Behavior

shows git status

Actual Behavior

shows nothing

Steps to Reproduce the Problem

  1. add this line to tmux.conf set -g status-right '#(gitmux #{pane_current_path})'

I fixed the issue with set -g status-right '#(gitmux "#{pane_current_path}")' which is surround #{pane_current_path} with ""

Specifications

  • OS: macOS 10.15.3 + zsh
  • gitmux version: <development version>>
  • tmux version: tmux 3.0a
  • in case the problem only happens in a specific directory: run gitmux -dbg in that directory

Gitmux loads only once

Greetings! Using the gitmux and after I make tmux kill-server and make a new session it stops working. Any ideas?
Shell: Bash
Ubuntu 20.04
.tmux.conf:

set-environment -g PATH "$HOME/bin:/home/d.stolbov/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:$HOME/go/bin:$HOME"

# remap prefix from 'C-b' to 'C-a'

unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

unbind C-d
# split panes using | and -
bind q split-window -h
bind s split-window -v
unbind '"'
unbind %

# don't rename windows automatically
set-option -g allow-rename off

# start window index at 1
set -g base-index 1

# start pane index at 1
set -g pane-base-index 1

# re-number windows when one is closed
set -g renumber-windows on

## Capture current tmux buffer and copy it to system clipboard with prefix + 'Ctrl + c'
bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"

## Optional - paste from system clipboard to tmux session with prefix + 'Ctrl + v'
## bind C-v run "tmux set-buffer "$(xclip -o -sel clipboard)"; tmux paste-buffer"

#copy and paste vim style

## Enable vi-copy-mode
setw -g mode-keys vi

# Turn off mouse and use vim keys for navigations
# turn this on if you want to use touchpad or mouse to scroll through terminal
setw -g mouse off

## changing the key to enter copy mode from `[` to `ESC`
unbind [
bind Escape copy-mode

## unbind p and set it to paste from buffer
unbind p
bind p paste-buffer

## set keys for visual mode (v) and yank/copy (y)
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'

## reload tmux config
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded tmux config!"
set -g default-terminal "screen-256color"
set-option -ga terminal-overrides ",xterm-256color:Tc"

bind u command-prompt -I "#W" "rename-window '%%'"

set -goq @themepack-status-right-area-left-prefix "#(gitmux -cfg .gitmux.conf #{pane_current_path})"
set -goq @themepack-status-left-area-middle-suffix "๐Ÿถ"

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'jimeh/tmux-themepack'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @themepack 'powerline/double/yellow'

set -g @resurrect-strategy-nvim 'session'
set-option -sg escape-time 10

# Initialize TMUX plugin manager
run '~/.tmux/plugins/tpm/tpm'

Edit symbols in gitmux output

I'm in an environment(ssh into remote server) that doesn't support all the symbols in gitmux
gitmux

BTW: I'm using this as my pane-border-format:

set -g pane-border-format "#[reverse,bold]#(echo '#')#{pane_index}: #{s|$HOME|~|:pane_current_path}#[default] (#(gitmux -q -fmt tmux #{pane_current_path})#[default])"

NOTE: the () would be a problem when in a directory which is not git repo. #8

Would this be fixed?

[BUG] branch name doesn't get fully displayed

Describe the bug
A clear and concise description of what the bug is.
The branch name is not fully displayed.

I personally put the gitmux inside pane-border-format, but I tried to put the config inside status-right, it is the same result,

BTW: The setting is "branch_max_len: 0" in gitmux --printcfg, and the branch name is fully displayed when just executing gitmux

To Reproduce

Steps to reproduce the behavior.
switch to any branch such as master branch

Expected behavior
A clear and concise description of what you expected to happen.
The branch name should be fully displayed if branch_max_len: 0

Screenshots
If applicable, add screenshots to help explain your problem.
Screenshot_20200906_215055
Screenshot_20200906_215034

Environment:

  • gitmux version: 0.7.4
  • tmux version: tmux 3.1b
  • OS 5.7.19-2-MANJARO
  • shell (bash/fish/...) fish shell
  • your gitmux config gitmux.cfg if you're not using the default one.
    default:
tmux:
symbols:
branch: 'โŽ‡ '
hashprefix: ':'
ahead: โ†‘ยท
behind: โ†“ยท
staged: 'โ— '
conflict: 'โœ– '
modified: 'โœš '
untracked: 'โ€ฆ '
stashed: 'โš‘ '
clean: โœ”
styles:
state: '#[fg=red,bold]'
branch: '#[fg=white,bold]'
remote: '#[fg=cyan]'
staged: '#[fg=green,bold]'
conflict: '#[fg=red,bold]'
modified: '#[fg=red,bold]'
untracked: '#[fg=magenta,bold]'
stashed: '#[fg=cyan,bold]'
clean: '#[fg=green,bold]'
layout: [branch, .., remote-branch, divergence, ' - ', flags]
options:
branch_max_len: 0
  • in case the problem only happens in a specific directory, please paste the
    output of gitmux -dbg in that directory.

Additional context
Add any other context about the problem here.

UPDATE:
Weird thing is: when I'm using a different environment, the branch name got fully displayed:

Not fully displayed:
Manjaro+KDE+Yakuake+gitmux+tmux
Fully displayed:
Manjaro+XFCE+xfce4-terminal+gitmux+tmux

I'll check the KDE environment later.

Space missing from behind the 'staged' symbol in default config

Hi,

Minor issue, but a space is missing from behind the โ—/staged symbol in the default config in tmux/formatter.go (https://github.com/arl/gitmux/blob/master/format/tmux/formater.go#L55) and it makes that part of the display illegible (at least with the default fixed font on ubuntu). Indeed, I haven't realized what that blob could be until I got myself to look into gitmux config to fix the colors.

I see there's a space after all the other symbols, so this must be accidental or not causing a problem with the font you are using.

Expected Behavior

Selection_999(302)

Actual Behavior

Selection_999(303)

Specifications

  • OS: Ubuntu 20.04
  • gitmux version: 0.3.2 and 0.5.0
  • tmux version: tmux -V

[FEATURE] ellipisis

Use โ€ฆ instead of ... when trimming a branch name (or anything else for that matter)

โ€ฆ is only one character wide so using it instead of ... gives 2 more characters of screen estate.

image

Many fonts that I've tried seems to support this special character, but I guess it should be controllable via options file also.

documentation: add warning+solution for tmux < 2.1 - #{pane_current_path} not supported

Expected Behavior

Git information shows up in status bar when in a git repo.

Actual Behavior

It doesn't.

Steps to Reproduce the Problem

  1. On Raspbian jessie, install gitmux and put set -g status-right '#(gitmux "#{pane_current_path}")' in ~/.tmux.conf, and re-source.
  2. Go to a git repo.
  3. Run gitmux manually, which seems to produce sensible output: #[fg=default]#[fg=default]#[fg=white,bold]โŽ‡ #[fg=default]master#[fg=default]..#[fg=cyan]origin/master#[fg=default]#[fg=default] - #[fg=red,bold]โœš 1 #[fg=cyan,bold]โš‘ 1 #[fg=magenta,bold]โ€ฆ1
  4. Observe lack of git info in status bar.

Specifications

  • OS: Raspbian GNU/Linux 8 (jessie)
  • gitmux version: 0.4.1
  • tmux version: 1.9

Same setup works for me on a x86 box with tmux 2.1. Any ideas?

[FEATURE] trim-from-left branch name

if branch_max_len > 0

and the branch name is too long

it should truncate by removing the start and leaving the end of the branh name

because may of my branches start with authorname/ so it's not useful to see just the start.

fatal: Unable to create '/path/.git/index.lock': File exists.

After using gitmux in tmux, from time to time, a problem occurs to me:

fatal: Unable to create '/path/.git/index.lock': File exists.

I think this is because git is kept running in the background inside gitmux with tmux.

and I used an script before using gitmux:
https://github.com/c02y/dotfiles/blob/5cbcbda2d49d0f0458fc404b57c5ab0fbd9def7a/bin/.local/bin/pane-border-format.sh#L50

I use --no-optional-locks for git command in that script to avoid this problem, could you please fix this issue.

Updates to the git status are slow

Expected Behavior

Add a new file or branch changes should be reflected sub second in the tmux status bar

Actual Behavior

Take more than a couple of seconds (most of the times) to update the git status with changes in the tmux status bar

Steps to Reproduce the Problem

  1. In a repo create a branch and check it out
  2. Look at the gitmux status on the status bar
  3. Notice that it takes a while (2-3 seconds) for the status to update

Specifications

  • OS: Pop_OS 19.10
  • gitmux version: gitmux -V 0.4.1
  • tmux version: tmux -V 2.9a

Feature: breakdown remote into 2 separate layout components

I would like to remove the remote-branch-name from the layout, because it's almost ever the same as the local one (<branch-name> and origin/<branch-name>).

If I remove remote from the layout not only the remote-branch-name isn't displayed anymore, also the information how many commits I am behind or above the origin branch is gone.

Is it possible to add another parameter to the config, e.g. remote-flags? Thus, with remote I could handle, if the remote-branch-name is displayed or not and with remote-flags I could handle, if the number of how many commits I am behind or above the origin branch is displayed or not.

[FEATURE] add a "reset" style

Is your feature request related to a problem? Please describe.

I am using the output of gitmux and the date like so:

set -g status-right '#(gitmux -cfg $HOME/.gitmux.conf "#{pane_current_path}") %d.%m.%Y %H:%M:%S'

The problem is, that the last item in the gitmux outputs sets some color which will then be used for the date. So sometimes I have a green date, sometimes a magenta one etc.

My current solution is this custom layout in .gitmux.conf:

layout: [branch, remote-branch, divergence, " - ", flags, "#[fg=default]"]

Describe the solution you'd like
A style called "reset" or something like that should be added and maybe included in the default layout.

[FEATURE] Is it able to keep running for one panel

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I use gitmux in pane-border-format, and if I keep greping gitmux in ps list, the PID is keeping increasing since it runs and exits, it is able to keep the process in a while loop with a delay of course, display the result but not exit the gitmux process, sorry about that I'm a little picky, it is OK if it creates new gitmux process for new tmux pane/window. (I don't know if it is limited by display-time)

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

[BUG] #91 has removed layout flexibility making previous layout impossible

Describe the bug
#91 added spaces between every layout item, which broke the previous flexibility of being able to configure where you wanted spaces, which could have been configured in the layout, in the styles, in the symbols, or nowhere.

To Reproduce

For example, you want ... to separate the local and remote branch names with no spaces between, but you obviously only want the ... when there is also a remote branch. This used to be able to be configured by prefixing the remote style with .... But since #91, this still works with no remote branch, but when there is a remote branch a space is appended to the local branch name and before the ....

Expected behavior
With local and remote branches they are concatenated with ... between. With only a local branch the ... should not be appended to the local branch name. No spaces should be added in either case.

Screenshots
Before:
20230406T165205-Alacritty@2x

Now:
20230406T165316-Alacritty@2x

Environment:

  • gitmux version: 0.10.2
  • tmux version: tmux 3.3a
  • OS: macOS 12.6.3
  • shell: bash 5.2.15

[FEATURE] Add comments to YAML config printed with `-printcfg`

Adding comments explaining what the settings are for, and possibly some choices (where applicable) would be really helpful for users.

Comments will need to be added in embedded gitmux.yml file.
We can remove the tmux.DefaultCfg variable, it will be unmarshaled from the embedded file (when -printcfg has been given)

Gitmux not loading at all

Describe the bug
Gitmux is not showing in the statusbar.

To Reproduce

Tmux conf:

# True color support
# set-option -g default-terminal "tmux-256color"
set -g default-terminal "${TERM}"
set-option -ga terminal-overrides ",*256col*:Tc"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'  # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'  # underscore colours - needs tmux-3.0
set -g mouse on

set-option -g default-shell "/bin/bash"
set -g default-command "/bin/bash"

# set -s escape-time 10 
set -g base-index 1
setw -g pane-base-index 1
setw -g mode-keys vi

# scrollback buffer n lines
set -g history-limit 100000
setw -g automatic-rename on   # rename window to reflect current program
set -g renumber-windows on    # renumber windows when a window is closed

set -g set-clipboard on

bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
bind-key -T prefix e select-pane -t :.+

bind-key -T copy-mode-vi Escape send-keys -X cancel
bind-key -T copy-mode-vi J send-keys NPage
bind-key -T copy-mode-vi K send-keys PPage

bind W command-prompt -I "swap-window -t "

# open a new window in the current directory
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind '%' split-window -h -c "#{pane_current_path}"

set-option -sg escape-time 10

bind r source-file $HOME/.config/tmux/tmux.conf \; display-message "Config reloaded..."

bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

bind-key -T copy-mode-vi C-j send-keys -X scroll-down
bind-key -T copy-mode-vi C-k send-keys -X scroll-up

set -g status-interval 2      # update status every 2 seconds
set -g status-left-length 200 # increase status line length
set -g status-position top    # macOS / darwin style
set -g status-right ''        # empty

set -g status-left                  '#[fg=blue,bold]#S'
set -ga status-left                 '#[fg=white,nobold]#(gitmux -timeout 200ms -cfg $HOME/.config/tmux/gitmux.conf) '
set -g pane-active-border-style     'fg=magenta,bg=default'
set -g pane-border-style            'fg=brightblack,bg=default'
set -g status-style                 'bg=default' # transparent
set -g window-status-current-format '#[fg=magenta]#W'
set -g window-status-format         '#[fg=gray]#W'

# Fuzzback config
set -g @fuzzback-bind /
set -g @fuzzback-popup 1
set -g @fuzzback-popup-size '95%'
set -g @fuzzback-fzf-bind ''
set -g @fuzzback-fzf-colors 'bg+:#656A7c,gutter:#323F4E,pointer:#F48FB1,info:#ffe6b3,hl:#F48FB1,hl+:#F48FB1,border:#FFFFFF'

# Plugins
# set -g @plugin 'tmux-plugins/tmux-resurrect'
# set -g @plugin 'tmux-plugins/tmux-continuum'
# set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# set -g @plugin 'hqkhan/tmux-onedark-theme'
# set -g @plugin 'joshmedeski/tmux-nerd-font-window-name'
# set -g @plugin 'roosta/tmux-fuzzback'

set -g @tpm-clean 'u'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

I commented and removed all tmux plugins to see if it'd fix but still nothing.

Expected behavior
Expecting gitmux to show branch and other git items on the statusbar.

Screenshots
image

The above image shows nothing from gitmux.

Here's the output in the terminal when I call gitmux manually in my yadm repo. The issue is there in any other git repo.

~/dots/yadm-repo took 2m14s
๏ก gitmux --cfg $HOME/.config/tmux/gitmux.conf
#[fg=default]#[fg=default]#[fg=white,nobold] ืฉื‚ #[fg=default]#[fg=white,nobold]main#[fg=default] #[fg=default]#[fg=green,nobold]้ƒฝ1 #[fg=yellow,nobold]๏‘€ 2#[fg=default] #[fg=default]#[fg=green]๎ซœ 7 #[fg=red]๎ซŸ 7

Environment:

  • gitmux version: 0.9.1
  • tmux version: tmux next-3.4
  • OS: AL2_x86
  • shell: bash

Gitmux Config: $HOME/.config/tmux/gitmux.conf:

tmux:
  symbols:
    branch: ' ืฉื‚ '
    hashprefix: ':'
    ahead: '๎ญ '
    behind: '๎ญ€ '
    staged: '้ƒฝ'
    conflict: '็น'
    untracked: '๎ฉฟ '
    modified: '๏‘€ '
    stashed: '๏’‡ '
    clean: ''
    insertions: '๎ซœ '
    deletions: '๎ซŸ '
  styles:
    state: '#[fg=red,nobold]'
    branch: '#[fg=white,nobold]'
    staged: '#[fg=green,nobold]'
    conflict: '#[fg=red,nobold]'
    modified: '#[fg=yellow,nobold]'
    untracked: '#[fg=gray,nobold]'
    stashed: '#[fg=gray,nobold]'
    clean: '#[fg=green,nobold]'
    divergence: '#[fg=cyan,nobold]'
  layout: [branch, divergence, ' ', flags, ' ', stats]
  options:
    branch_max_len: 0

[FEATURE] Deploy to Homebrew

Is your feature request related to a problem? Please describe.
Installing gitmux is tricky for non-developers. I'd like to make it more accessible to more people.

Describe the solution you'd like
As a gitmux user, I'd like to install and manage updates through homebrew.

Describe alternatives you've considered
I realize the binary is available to download, but updates are not strait-forward as I have to track releases on GitHub and manually overwrite the binary on updates.

Additional context
Love gitmux, so helpful. I think homebrew support will make it that much easier to use.

Download Latest Release

Can you add a latest tag or symlink it in some way? The use case is downloading the newest version from CLI without knowing the version number of the latest version. There may already be a way to do this but I can't figure it out if there is.
Thank you

Local Branch text does not take formatting

Expected Behavior

Setting Branch style should affect branch text

Actual Behavior

Only affects symbol

image

Steps to Reproduce the Problem

tmux:
  symbols:
    branch: '๎œฅ '
    hashprefix: ':'
    ahead: โ†‘ยท
    behind: โ†“ยท
    staged: '๏˜ฎ '
    conflict: '๏‘ง '
    modified: 'โž• '
    untracked: 'โ€ฆ '
    stashed: '๏œฟ '
    clean: ๏ฎ
  styles:
    state: '#[fg=red]'
    branch: '#[fg=white]'
    remote: '#[fg=cyan]'
    staged: '#[fg=green]'
    conflict: '#[fg=red]'
    modified: '#[fg=red]'
    untracked: '#[fg=magenta,bold]'
    stashed: '#[fg=cyan,bold]'
    clean: '#[fg=green,bold]'
  layout: [' ', branch, .., remote-branch, divergence, ' - ', flags, ' |']
  options:
    branch_max_len: 0

Specifications

  • OS: Fedora 30
  • gitmux version: 0.7.0
  • tmux version: 2.9a

Layout cannot be changed

Expected Behavior

I have the following gitmux.config, where I removed the branch-symbol and added a custom layout. With the custom layout I would remove the remote-branch.

tmux:
  symbols:
    branch: ''
    hashprefix: ':'
    ahead: โ†‘ยท
    behind: โ†“ยท
    staged: โ—
    conflict: 'โœ– '
    modified: 'โœš '
    untracked: โ€ฆ
    stashed: 'โš‘ '
    clean: โœ”
  styles:
    state: '#[fg=red,bold]'
    branch: '#[fg=white,bold]'
    remote: '#[fg=cyan]'
    staged: '#[fg=green,bold]'
    conflict: '#[fg=red,bold]'
    modified: '#[fg=red,bold]'
    untracked: '#[fg=magenta,bold]'
    stashed: '#[fg=cyan,bold]'
    clean: '#[fg=green,bold]'
  layouts: [branch, '  ', flags]

Actual Behavior

If I call the following command $ gitmux -cfg gitmux.conf I get this output:

#[fg=default]#[fg=default]#[fg=white,bold]#[fg=default]master#[fg=default]..#[fg=cyan]origin/master#[fg=default]#[fg=default] - #[fg=magenta,bold]โ€ฆ1%

The branch-symbol is removed, but the layout didn't change. Where do I have to put the layout-config to change the layout?

Specifications

  • OS: macOS
  • gitmux version: 0.4.1
  • tmux version: tmux 3.0a

[CONTRIBUTING] add a pull request template

Add a pull request template, saying:

  • update the default config
  • how to run the tests
  • that new tests are needed
  • that important and/or breaking changes should be discussed first in an issue

[BUG] Stashed files not handled in some cases

Hello again! It appears that stashed files are no longer handled in v0.7.8.

How to reproduce

$ mkdir testGitmux
$ cd testGitmux
$ git init
$ touch test_file
$ git add test_file
$ git commit -m 'First commit'
$ touch new_file
$ git add new_file 
$ git stash push

Even though there's a stashed file, gitmux claims the tree is "clean". But if we create an untracked file (touch another_file), gitmux will show 1 untracked and 1 stashed.

I've checked the previous version (v0.7.7) and stashed files are handled as expected.

timeout if gitmux takes too long to print the result

Expected Behavior

When in some situation, gitmux takes too long to print the result, it should just quit and print nothing like it never existed.

This kind is situation is: I got a repo pulled inside Windows partition, and I'm using Linux as the guest on Virtual Machine, and I share the repo folder to the Linux, trust me, I don't want this, anyway, when I'm in this situation, normal git status will take too long so I tried to avoid using git or tig or anything related to git in this repo inside Linux.

Currently my workaround is using #(timeout 2 ~/.local/bin/gitmux #{pane_current_path}) in my ~/.tmux.conf to quit gitmux after 2 seconds whatever the result is.

Could you please add this timeout feature into gitmux, of cause if you think this is unnecessary, that's OK, I can just use my workaround since this is really a special situation.

And if others got the similar problem using gitmux, and once they see this issue page, they can use my workaround too.

Actual Behavior

the "~/.local/bin/gitmux..." string stuck in tmux status bar until it finished.

Steps to Reproduce the Problem

  1. as I said, you may have to be that specific situation, but this is not the problem gitmux but the git itself or even Windows OS

Specifications

  • OS: Manjaro
  • gitmux version: gitmux -V 0.7.0
  • tmux version: tmux -V 3.1b
  • in case the problem only happens in a specific directory: run gitmux -dbg in that directory

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.