Git Product home page Git Product logo

zsh-git-prompt's Introduction

Informative git prompt for zsh

Build Status

A zsh prompt that displays information about the current git repository. In particular the branch name, difference with remote branch, number of files staged, changed, etc.

(an original idea from this blog post).

Examples

The prompt may look like the following:

  • (master↑3|✚1): on branch master, ahead of remote by 3 commits, 1 file changed but not staged
  • (status|●2): on branch status, 2 files staged
  • (master|✚7…): on branch master, 7 files changed, some files untracked
  • (master|✖2✚3): on branch master, 2 conflicts, 3 files changed
  • (experimental↓2↑3|✔): on branch experimental; your branch has diverged by 3 commits, remote by 2 commits; the repository is otherwise clean
  • (:70c2952|✔): not on any branch; parent commit has hash 70c2952; the repository is otherwise clean

Here is how it could look like when you are ahead by 4 commits, behind by 5 commits, and have 1 staged files, 1 changed but unstaged file, and some untracked files, on branch dev:

Prompt Structure

By default, the general appearance of the prompt is:

(<branch><branch tracking>|<local status>)

The symbols are as follows:

Local Status Symbols

Symbol Meaning
repository clean
●n there are n staged files
✖n there are n unmerged files
✚n there are n changed but unstaged files
there are some untracked files

Branch Tracking Symbols

Symbol Meaning
↑n ahead of remote by n commits
↓n behind remote by n commits
↓m↑n branches diverged, other by m commits, yours by n commits

Branch Symbol

When the branch name starts with a colon :, it means it’s actually a hash, not a branch (although it should be pretty clear, unless you name your branches like hashes :-)

Install

  1. Clone this repository somewhere on your hard drive.

  2. Source the file zshrc.sh from your ~/.zshrc config file, and configure your prompt. So, somewhere in ~/.zshrc, you should have:

    source path/to/zshrc.sh
    # an example prompt
    PROMPT='%B%m%~%b$(git_super_status) %# '
  3. Go in a git repository and test it!

Haskell (optional)

There is now a Haskell implementation as well, which can be four to six times faster than the Python one. The reason is not that Haskell is faster in itself (although it is), but that this implementation calls git only once. To install, do the following:

  1. Make sure Haskell's stack is installed on your system
  2. cd to this folder
  3. Run stack setup to install the Haskell compiler, if it is not already there
  4. Run stack build && stack install (don't worry, the executable is only “installed” in this folder, not on your system)
  5. Define the variable GIT_PROMPT_EXECUTABLE="haskell" somewhere in your .zshrc

Customisation

  • You may redefine the function git_super_status (after the source statement) to adapt it to your needs (to change the order in which the information is displayed).
  • Define the variable ZSH_THEME_GIT_PROMPT_CACHE in order to enable caching.
  • You may also change a number of variables (which name start with ZSH_THEME_GIT_PROMPT_) to change the appearance of the prompt. Take a look in the file zshrc.sh to see how the function git_super_status is defined, and what variables are available.

Enjoy!

zsh-git-prompt's People

Contributors

axelson avatar e0da avatar h43z avatar olivierverdier avatar rnc avatar scelis avatar xtaran avatar zackrw 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  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

zsh-git-prompt's Issues

No git info after new terminal window with Cmd-N

Hello Oliver,

nice extention, thank you for that! ;-) But I have a little trouble here ...

I configured my iTerm to inherit the current $PDW to a newly opened window (e.g. with Cmd-N).
But if I'm in a git repo and press Cmd-N I have no git info in my new window. That's because the
only zsh-hook that's getting triggert is precmd an precmd is not doing anything because
__EXECUTED_GIT_COMMAND is not set.

To quick fix this, I manually put __EXECUTED_GIT_COMMAND=1 at the end of my .zshrc but maybe
you have a better solution for this typically start-up condition issue ...

Clarify installation instructions

For some reason, installation did not work for me. I:

  • downloaded the repo
  • moved it out of downloads to Desktop
  • two-finger-clicked "get info" and then copied the "Where" (path) of zshrc.sh
  • $ atom ~/.zshrc

Saw this:
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

Changed to:
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
source /Users/amandasimon/Desktop/zsh-git-prompt-master
PROMPT='%B%m%~%b$(git_super_status) %# '

Restarted my terminal and cd'd into a git directory but saw no changes.

What am I doing wrong?

Prompt only updates when zsh is first started

If I make changes or cd into a git repository, zsh does not register the difference (e.g. the changed files, or the fact that we're now in a git repo) until you launch zsh again.

For example, starting in a regular directory (/), then cding into a git repo ($HOME):

USER at HOST in  /
$ cd ~
USER at HOST in  ~
$ zsh
USER at HOST in  ~  (master↑2|✚2)
$

The same thing happens when you are already in a git repo, and changes are made:

USER at HOST in  ~/test  (master|✔)
$ touch test
USER at HOST in  ~/test  (master|✔)
$ zsh
USER at HOST in  ~/test  (master|…)
$ git add test
USER at HOST in  ~/test  (master|…)
$ zsh
USER at HOST in  ~/test  (master|●1)
$

I'm unsure if it's related, but the stock zsh ${git_branch} doesn't register changes for me. It only shows the branch. On some machines it works (all have the same exact config files), on others it doesn't.

Let me know if you need any config files, or environment variables, etc.

My .zshrc at the time of testing (prompt starts at line 33): https://github.com/zhimsel/dotfiles/blob/af3687d409e5bac1eb1c735076eaa79c2b7f0806/.zshrc

non-branch commitish doesn't work

The following advertised example doesn't work:

(:70c2952): not on any branch; parent commit has sha1 70c2952

Observe:

(master|✔)~/.zsh-git-prompt> git checkout HEAD\^
Note: checking out 'HEAD^'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at d8cc0aa... more readable presentation of the output
~/.zsh-git-prompt> 

I'm using this repo at c6032a6 with zsh 4.3.12 (x86_64-unknown-linux-gnu) and Python 2.7.2. Thanks.

Special Character not working

Hello, the special characters +,x,o, OK, etc, that you used, are not supported by my linux version. I don't know how to support them. So I modified the variable ZSH_THEME_GIT_PROMPT_* with some classical ascii variable.
I think it would be better to have a generic setting to use such more standards character

Simplify Installation

If zshrc.sh:4 changes to the following:

export __GIT_PROMPT_DIR="`dirname $0`"

Then the installation could be simplified to:
$ git clone https://github.com/olivierverdier/zsh-git-prompt.git
$ edit ~/.zshrc to include:

source path/to/zsh-git-prompt/zshrc.sh
PROMPT='%B%m%~%b$(git_super_status) %# '

This eliminates the need to create a new folder, copy/move files around, or edit zshrc.sh to point to the correct location.

Carriage Returns on Windows

On windows the haskell implementation spits out windows newlines ie crlf.

This breaks zsh when it tries to compare against what it expects to be ints.

The haskell impl could use putStr and manually output a linefeed, another seperator character could be used or zshrc.sh could manually strip whitespace (this is the hack I'm currently running).

git_super_status problem

I always get this type of error :

zsh: command not found: git_super_status 

Can somebody point a quick solution for this?
By the way it is really nice zsh theme because I really want this current branch view :)
Kudos to author!

Best regards,
Hrvoje

Fatal error when walking into .git

cd zsh-git-prompt # and things looks fine.
cd .git # and you'll get a bunch of errors.

A hack I've implemented:

diff --git a/gitstatus.py b/gitstatus.py
index 6588b05..a8fefca 100755
--- a/gitstatus.py
+++ b/gitstatus.py
@@ -9,11 +9,14 @@ from subprocess import Popen, PIPE
 gitsym = Popen(['git', 'symbolic-ref', 'HEAD'], stdout=PIPE, stderr=PIPE)
 branch, error = gitsym.communicate()

-if error.find('fatal: Not a git repository') != -1:
+from os import getcwd
+from re import search
+if error.find('fatal: Not a git repository') != -1 or search("/.git",
+        getcwd()):
        import sys
        sys.exit(0)

-branch = branch.strip()[11:]
+branch = branch.strip()[11:][:25] # only first 25 chars of branch name


 changed_files = [namestat[0] for namestat in Popen(['git','diff','--name-status'], st

Python 3.2.2

File "/home/george/.zsh/git-prompt/gitstatus.py", line 66
print out
^
SyntaxError: invalid syntax

%G introduces question marks on very small terminal dimensions

I noticed that when the terminal is two rows high (long story), %G introduces a question mark into the prompt string. I don't understand enough about %G (something about unicode? Docs are confusing) to know if it's zsh's fault or not, but it may be something to be aware of.

I'm running OS X, El Capitan, zsh 5.2, and it triggers under tmux 2.2 with Terminal.app (Terminal.app seems to forbid anything smaller than 5 rows) and I also checked it in iTerm2.

I also did a quick check on one of my VMs, and it also triggers in Linux Mint, zsh 5.0.2, MATE Terminal

Here's some screenshots:
screen shot 2016-06-25 at 7 12 50 pm
screen shot 2016-06-25 at 7 12 55 pm

Removing the %G for the + removed the ? it had:
screen shot 2016-06-25 at 7 15 13 pm

Here's my config in case it's somehow my fault. It's a bit modified, but I don't think I broke it. https://gist.github.com/vilhelmen/d0d7abae17b46997b5c96de1b9349cd1

Extra whitespace in git prompt on some terminals

I'm seeing a problem where zsh-git-prompt causes my prompt to be displayed with extra whitespace characters at the end, when logged in to an Ubuntu Linux box from a Mac terminal. See screenshot below. Any ideas on why this is happening?

screen shot 2014-02-26 at 9 35 43 am

Problems installing zsh-git-prompt

Hi!

I have tried installing the git-prompt, but get some strange errors!

When I add source (..../zshrc.sh) I get a strange warninger for every blank line in my config file?!

Also a few errors that stands out, *colors* function definition not found, no such option: *PROMPT_SUBST* ^M and command not found: *add-zsh-hook*

t460y~/.zsh_plugins/zsh-git-prompt$(git_super_status) % zsh
: command not found...
/home/richard/.zsh_plugins/zsh-git-prompt/zshrc.sh:2: command not found: ^M
: command not found...
/home/richard/.zsh_plugins/zsh-git-prompt/zshrc.sh:7: command not found: ^M
: command not found...
/home/richard/.zsh_plugins/zsh-git-prompt/zshrc.sh:9: command not found: ^M
/home/richard/.zsh_plugins/zsh-git-prompt/zshrc.sh:12: colors^M: function definition file not found
: command not found...
/home/richard/.zsh_plugins/zsh-git-prompt/zshrc.sh:13: command not found: ^M
/home/richard/.zsh_plugins/zsh-git-prompt/zshrc.sh:setopt:15: no such option: PROMPT_SUBST^M
: command not found...
/home/richard/.zsh_plugins/zsh-git-prompt/zshrc.sh:16: command not found: ^M
: command not found...
/home/richard/.zsh_plugins/zsh-git-prompt/zshrc.sh:18: command not found: ^M
zsh: add-zsh-hook: command not found...
/home/richard/.zsh_plugins/zsh-git-prompt/zshrc.sh:19: command not found: add-zsh-hook
zsh: add-zsh-hook: command not found...
/home/richard/.zsh_plugins/zsh-git-prompt/zshrc.sh:20: command not found: add-zsh-hook
zsh: add-zsh-hook: command not found...
/home/richard/.zsh_plugins/zsh-git-prompt/zshrc.sh:21: command not found: add-zsh-hook
: command not found...
/home/richard/.zsh_plugins/zsh-git-prompt/zshrc.sh:22: command not found: ^M
/home/richard/.zsh_plugins/zsh-git-prompt/zshrc.sh:25: parse error near `in^M'
[richard@t460y]~/.zsh_plugins/zsh-git-prompt% 

Branch name proceeded by b, quoted

Just installed zsh-git-prompt and the branch name is appearing proceeded by the letter b, and in quotes, e.g. b'master'.

Not a big issue, I'm just wondering if you could suggest why this is happening as as far as I can tell it shouldn't be, and looks a little ugly to me.

Missing Haskell steps in README

I installed stack on my Mac with Homebrew for this project. I ran stack setup and that worked, but when I ran stack build I got

Run from outside a project, using implicit global project config
Using resolver: lts-4.1 from implicit global project's config file: /Users/force/.stack/global-project/stack.yaml
Error parsing targets: The specified targets matched no packages.

So I ran stack init and got

Writing default config file to: /Users/force/.dotfiles/files/zsh/git-prompt/stack.yaml
Basing on cabal files:
- /Users/force/.dotfiles/files/zsh/git-prompt/src/git-prompt.cabal

Checking against build plan lts-4.1
Selected resolver: lts-4.1
Wrote project config to: /Users/force/.dotfiles/files/zsh/git-prompt/stack.yaml

Then I ran stack build

[1 of 1] Compiling Main             ( /private/var/folders/sq/kjmvwnk167l8y1mx26tzs_8m0000gn/T/stack48699/Setup.hs, /private/var/folders/sq/kjmvwnk167l8y1mx26tzs_8m0000gn/T/stack48699/Setup.o )
Linking /Users/force/.stack/setup-exe-cache/x86_64-osx/tmp-setup-Simple-Cabal-1.22.5.0-ghc-7.10.3 ...
primitive-0.6.1.0: download
primitive-0.6.1.0: configure
random-1.1: download
mtl-2.2.1: download
text-1.2.2.0: download
primitive-0.6.1.0: build
random-1.1: configure
random-1.1: build
mtl-2.2.1: configure
mtl-2.2.1: build
text-1.2.2.0: configure
text-1.2.2.0: build
primitive-0.6.1.0: copy/register
mtl-2.2.1: copy/register
random-1.1: copy/register
tf-random-0.5: download
tf-random-0.5: configure
tf-random-0.5: build
tf-random-0.5: copy/register
QuickCheck-2.8.1: download
QuickCheck-2.8.1: configure
QuickCheck-2.8.1: build
QuickCheck-2.8.1: copy/register
text-1.2.2.0: copy/register
parsec-3.1.9: download
parsec-3.1.9: configure
parsec-3.1.9: build
parsec-3.1.9: copy/register
git-prompt-0.1.0.0: configure
Configuring git-prompt-0.1.0.0...
git-prompt-0.1.0.0: build
Preprocessing library git-prompt-0.1.0.0...
[1 of 3] Compiling StatusParse      ( src/StatusParse.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/StatusParse.o )
[2 of 3] Compiling BranchParse      ( src/BranchParse.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/BranchParse.o )
[3 of 3] Compiling Utils            ( src/Utils.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Utils.o )
In-place registering git-prompt-0.1.0.0...
Preprocessing executable 'gitstatus' for git-prompt-0.1.0.0...
[1 of 1] Compiling Main             ( app/Main.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/gitstatus/gitstatus-tmp/Main.o )
Linking .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/gitstatus/gitstatus ...
git-prompt-0.1.0.0: copy/register
Installing library in
/Users/force/.dotfiles/files/zsh/git-prompt/.stack-work/install/x86_64-osx/lts-4.1/7.10.3/lib/x86_64-osx-ghc-7.10.3/git-prompt-0.1.0.0-GyKbGQsRujX2Ik9bjYPmgX
Installing executable(s) in
/Users/force/.dotfiles/files/zsh/git-prompt/.stack-work/install/x86_64-osx/lts-4.1/7.10.3/bin
Registering git-prompt-0.1.0.0...
Completed 8 action(s).

Then I ran stack install

Installation path /Users/force/.local/bin not found in PATH environment variable
Copying from /Users/force/.dotfiles/files/zsh/git-prompt/.stack-work/install/x86_64-osx/lts-4.1/7.10.3/bin/gitstatus to /Users/force/.local/bin/gitstatus

Copied executables to /Users/force/.local/bin:
- gitstatus

And it looks like it works. I ran ~/.local/bin/gitstatus

master 0 0 0 0 0 2

But now there are untracked files in the repository. git status yields

On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    .stack-work/
    stack.yaml

nothing added to commit but untracked files present (use "git add" to track)

So the Haskell installation still has some kinks.

  1. Looks like stack.yaml should be added to the repo or stack init should be added to the README.
  2. .stack-work should be added to the .gitignore.
  3. If stack.yaml isn't added to the repo, it should be added to the .gitignore.

Thanks for all your hard work, Olivier!

Traceback(Most recent call last): line 44 gitstatus.py

For whatever reason, when I enter some of my repositories, I get the following:

Traceback (Most recent call last):
branch = symbols['prehash']+ Popen(['git','rev-parse','--short','HEAD'], stdout=PIPE).communicate()[0][:-1]
TypeError: Can't convert 'bytes' object to str implicitly

I am currently using python 3.3.4. I've noticed that the error only occurs when I enter a submodule.

Any ideas as to what the issue is?

Prompt doesn't update until a git operation is performed

For example, if I edit a file and then type ls, I still get (master|✔) until I do a git status or something. Maybe this is by design? I expected it to always be current, so any cd or ls or whatever would give me an up-to-date prompt.

Thanks!
Justin

Relevant info:

% zsh --version
zsh 4.3.17 (x86_64-unknown-linux-gnu)
% uname -a
Linux enzo 3.2.0-26-generic #41-Ubuntu SMP Thu Jun 14 17:49:24 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
% cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04 LTS"

Incompability with `noglob`

I have setted the following alias in my ~/.zshrc:

alias git='noglob git'

This completely stucks the git prompt.

It seems strange as the git calls are made in Python.

Does anyone had had this problem?

zsh-git-prompt blocks access to the repo until loaded

My concern is about the speed to display the prompt.

I have a big git repo here, but not huge : ~45,000 files.
When accessing for the first time the repo ('cd' into it), my SSD disk "spins" for nearly ~15sec, and then, display the prompt.

I don't have any problems with smaller repo.

So, is there a way to make the Git prompt's computation not blocking ?

Git prompt status while in a subdir

If it's possible, is there a way of updating the prompt status while editing files in a subdirectory of the main repo dir?

Normally I can edit files in a subdir and a + isn't show until I cd to the main git directory.

Use same name for git repo and path to load gitstatus.py

I did a git submodule add git://github.com/olivierverdier/zsh-git-prompt.git in my ~/.zsh so I got it added at ~.zsh/zsh-git-prompt/, but python argues: python: can't open file '/home/abe/.zsh/git-prompt/gitstatus.py': [Errno 2] No such file or directory

IMHO either this load path should be dynamical or default to the same name as the git repo.

Remote commits is not working

Me and several of my friends have an issue with the prompting of the remote commits (the downward arrow). It's simply never visible, like if our computer doesn't detect remote commits.
Is there a particular thing to config ?
The other symbols work fine.

Add a symbolic link to let it work as oh-my-zsh plugin out of the box

Hi,
i know that there is already a oh-my-zsh plugin version of zsh-git-prompt, but it does not come with the haskell version and i do not know how much of the updates they have integrated. So i prefer to use this version.
By adding a symbolic link zsh-git-prompt.plugin.zsh -> zshrc.sh people can just clone this into their custom plugin folder and it works as oh-my-zsh plugin without further work.

git_super_status differ by OS

[On Mac OS Sierra] (%{%}master%{%}|%{…%G%}%{%}%{%})
[On Kali Linux] %{%}git:(%{%}%{%}master%{%}|%{…%G%}%{%}%{%}%{%}

add `dist` directory to `.gitignore`

When compiling the Haskell version, the binaries are being placed in the dist directory, leaving the repository "dirty".
By adding the dist directory to .gitignore, one could use this repo more easily in a custom dotfiles repository as a submodule.

git 1.8.5 changes `git status` output, requiring change to gitstatus.py

older gits output:

# On branch master

1.8.5 outputs:

On branch master

so this line in gitstatus.py:

branch = bline.split(' ')[3]

needs to change to:

branch = bline.split(' ')[2]

but note that the 1.8.5 release notes say "Scripts that parse the output of "git status" are advised to use "git status --porcelain" instead, as its format is stable and easier to parse." which sounds like even better advice.

Prompt doesn't change on change directory for zsh under RHEL5

The title pretty much says it. Basically what happens is in order to see changes every time I change directories, I have to do this:

source ~/.zshrc
cd /path/to/git/repo    # git info not shown
source ~/.zshrc         # git info shown
cd /path/to/regular/dir # git info still shown
source ~/.zshrc         # git info not shown

Any solutions to fix this problem? Obviously not everyone has it, since this works for most people. Also, I have in my zshrc.sh file:

ZSH_THEME_GIT_PROMPT_NOCACHE=1

So I don't think that's the problem.

New untracked files do not update without changing directory

For example:

After adding a new file there is no change:

² /tmp/gss (master|✔) touch qqq
² /tmp/gss (master|✔)

But after cd . it shows that there is an untracked file

² /tmp/gss (master|✔) cd .
² /tmp/gss (master|…)

Adding the haskell implementation to homebrew formula

Is this possible? It would be nice to be able to brew install zsh-git-prompt --with-haskell or something like that, though I'm not sure how to go about that.

Edit: This is purely for convenience, I'm currently just building myself.

zsh triggered warning

I get the following warning occasionally in my terminal.

update_current_git_vars:10: array parameter __CURRENT_GIT_STATUS created globally in function update_current_git_vars

On new prompt, characters take a long time to appear (OSX)

With this plugin enabled, typing commands after first receiving a prompt (i.e. immediately after the last command finishes) has no visible output for about 2 seconds. Once character start to appear, the response time is as normal for that prompt, but the delay returns as soon as a new prompt appears.

→ zsh --version
zsh 5.0.5 (x86_64-apple-darwin14.0)

Commenting out antigen bundle olivierverdier/zsh-git-prompt from my .zshrc resolves the issue completely.

Let me know if I can provide more detail to clarify the problem.

Add support for stash (Haskell)

I noticed there's a pull request for adding stash info, but it only covers the Python implementation. It would be nice to have it for Haskell as well.

Long delay back to prompt for large repositories

I am working with a large repository containing tens of thousands of directories. As long as the cwd is located in that directory the prompt will return after a delay of ~10 seconds.
With other git repositories this does not happen.

I tried running the same git command the plugin seems to be running:

time git status --porcelain --branch

and i see that the reported elpased time is ~10 seconds, which convinced me that the root cause of the slowness is git and not the plugin.

Next, i tried running the original command with '-uno' which will not report untracked files:

time git status --porcelain --branch -uno

And the elapsed time for that experiment was less than one second.

As a user i would like to have an option to ignore untracked information to allow better performance.

Turn off unicode symbols for Linux TTY

Hello, I have a feature request to turn off the unicode symbols and use ascii for linux TTY. It could be done with something like this:

if [[ ${TERM} == "linux" ]]; then
    GIT_PROMPT_SYMBOL="%{$fg[green]%}git:"
    GIT_PROMPT_CLEAN="%{$fg_bold[green]%}-"
    GIT_PROMPT_AHEAD="%{$fg_bold[yellow]%}> NUM"
    GIT_PROMPT_BEHIND="%{$fg_bold[yellow]%}< NUM"
    GIT_PROMPT_MERGING="%{$fg_bold[magenta]%}Y"
    GIT_PROMPT_UNTRACKED="${fg_alert}!"
    GIT_PROMPT_MODIFIED="${fg_alert}+"
    GIT_PROMPT_STAGED="%{$fg_bold[blue]%}="
else
    GIT_PROMPT_SYMBOL="%{$fg[green]%} "
    GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✔ "
    GIT_PROMPT_AHEAD="%{$fg_bold[yellow]%}🡩 NUM "
    GIT_PROMPT_BEHIND="%{$fg_bold[yellow]%}behind: 🡫 NUM "
    GIT_PROMPT_MERGING="%{$fg_bold[magenta]%}🜉 "
    GIT_PROMPT_UNTRACKED="${fg_alert}✗ "
    GIT_PROMPT_MODIFIED="${fg_alert}➕ "
    GIT_PROMPT_STAGED="%{$fg_bold[blue]%}🟓 "
fi

I have this working with a zsh prompt I wrote from scratch: https://gist.github.com/meskarune/6a647b067de3addd045f11c07aaf1cfc

I sometimes need to use my computer with a TTY and with unicode it messes up the prompt. This way you can detect if it's a TTY and still have a usable prompt.

edit: here is a list of unicode symbols and ascii characters that could be used:

Unicode:
branch:  ⎇
clean: ✔ —
untracked: ✗ X
modified files: ➕ 🜂 𝌀
staged: 🟓 🗲 🔀
merge: 🜉 𝈠 🝓
ahead: 🡩 𝌁
behind: 🡫 𝌃

Ascii:
branch: git: , #
clean: -- , ok , ~~
untracked: ! , X , %
modified files: + , ... , *
staged: = , O , S
merge: Y , {{ , >> , |-
ahead: > NUM, ^ NUM
behind: < NUM, v NUM

support

Hi @olivierverdier just wondering are you still maintaining this ?

I do not have any particular issues at this stage but I can see it hasn't been updated in a while and outstanding issues.

cheers.

gitstatus ignores python version

I tried to switch python version inside gitstatus.py, on arch and ubuntu 11.04. Both have python 2 and 3 installed.
Setting #!/usr/bin/env python3 or #!/usr/bin/python3.2 on ubuntu is ignored as well as setting #!/usr/bin/env python2 or #!/usr/bin/python2 in arch. I confirmed this with print(sys.version).
A simple helloword.py did allow me to switch version though.
So whats wrong? The prompt on ubuntu looks lovely, I´d like to have it on arch as well.

Cheers kodiak

git_status_report not displayed

Although the function is called (I notice the delay) it does not display anything, even though gitstatus.py works:

10:25 bartek@artemis ~/code/tmLQCD.kost  $ ~/.zsh/git-prompt/gitstatus.py 
cgmms_filename

0
0
5
2027
0

I've inserted git_super_status after the pwd:

PROMPT="\
$PR_TITLEBAR\
%{${fg_bold[green]}%}%n\
%{${fg_bold[blue]}%}@\
%{${fg_bold[green]}%}%m\
%{${fg_bold[blue]}%} %~% \
%{${at_normal}${fg_lgray}%}$(git_super_status) \
%{${fg_bold[white]}%} $ \
%{${at_normal}${fg_lgray}%}"

ZSH git prompt not detecting git changes

Also, seems that __CURRENT_GIT_STATUS is not auto updating as well.

To reporoduce

  • I start with a clean git state of master branch.
  • Touch a new file blah
  • See that the git status prompt did not update
  • Re-source my ~/.zshrc file and it picks up the new untracked file
dots (master|✔) ~࿔ git st
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
dots (master|✔) ~࿔ touch blah
dots (master|✔) ~࿔ git st
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        blah

nothing added to commit but untracked files present (use "git add" to track)
dots (master|✔) ~࿔ source ~/.zshrc
dots (master|?) ~࿔

Prompt with Agnoster theme

Hi, I customized the plugin because I use Agnoster theme. I don't know how to integrate it to the project because, so I put my gist here.

I just basically override some functions, this is a bit crappy but it works well. My goal here is to share it and obviously, if you want to add it to the project, I would be glad to help you.

New version?

Noticed that there hasn't been a release on GitHub for several years. Would be useful if they were more frequent because it would allow zsh-git-prompt to be installed with package managers. Will there be a new release any time soon? Is there a need for one?

Over-eager caching?

The prompt doesn't update when I switch branches in a different terminal window (until I do "git status" again).

Is there an inexpensive way to check if the branch has changed on each execution?

Number of branches

This is a suggestion from fish-shell#2824.

The idea is to display the number of branches on the prompt too.
Something like (master↑1↓2⎇3|●3✖4✚5…6)

What are your thoughts on this?
Thanks.

Git status in RPROMPT colors the command line

Hi,

I love your zsh prompt. It's great. I've tried to modify so that the git status appears on the right side. I did this as follows:

PROMPT=$'%U%n@%m%u:%{${fg[cyan]}%}%B%~%b%{${fg[default]}%} '
RPROMPT=$'$(prompt_git_info)'

This works, but once a cd into a git repo directory, the command line itself turns read (meaning the chars that I type in the command line). Is there anyway to prevent this from happening?

Thank you

Branch tracking not working

Hey,

Branch tracking (up and down arrows) are not working, and I don't know why. I tested on different machines (ubuntu and macos) and got the same result.

When I make a new commit I don't see the UP arrow, and when I have a new remote commit I don't see the down arrow.

I'm a new zsh user, so maybe I'm missing some basic zsh config?

Thank you.

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.