From 3d06b5a06203a876430a6c40db2947ac2f0ab23a Mon Sep 17 00:00:00 2001 From: Thomas NOEL Date: Tue, 3 Dec 2019 17:12:53 +0100 Subject: [PATCH] some dotfiles --- dotfiles/.bash-git-prompt/LICENSE.txt | 23 + dotfiles/.bash-git-prompt/README.md | 396 ++++++++++ dotfiles/.bash-git-prompt/bash-git-prompt.rb | 31 + .../.bash-git-prompt/bash-git-prompt.spec | 70 ++ dotfiles/.bash-git-prompt/git-prompt-help.sh | 76 ++ dotfiles/.bash-git-prompt/gitprompt.fish | 115 +++ dotfiles/.bash-git-prompt/gitprompt.png | Bin 0 -> 22550 bytes dotfiles/.bash-git-prompt/gitprompt.sh | 702 ++++++++++++++++++ dotfiles/.bash-git-prompt/gitstatus.py | 154 ++++ dotfiles/.bash-git-prompt/gitstatus.sh | 199 +++++ .../.bash-git-prompt/gitstatus_pre-1.7.10.sh | 140 ++++ dotfiles/.bash-git-prompt/prompt-colors.sh | 78 ++ .../.bash-git-prompt/themes/Chmike.bgptheme | 32 + .../.bash-git-prompt/themes/Crunch.bgptheme | 34 + .../themes/Custom.bgptemplate | 65 ++ .../.bash-git-prompt/themes/Default.bgptheme | 113 +++ .../themes/Default_NoExitState.bgptheme | 11 + .../Default_NoExitState_Ubuntu.bgptheme | 15 + .../themes/Default_Ubuntu.bgptheme | 11 + .../.bash-git-prompt/themes/Evermeet.bgptheme | 31 + .../themes/Evermeet_Lowres.bgptheme | 33 + .../themes/Evermeet_Ubuntu.bgptheme | 33 + .../.bash-git-prompt/themes/Minimal.bgptheme | 62 ++ .../themes/Minimal_Chevron.bgptheme | 72 ++ .../themes/Minimal_UserHost.bgptheme | 70 ++ .../themes/Plague_Doctor.bgptheme | 41 + .../themes/Single_line.bgptheme | 11 + .../themes/Single_line_Dark.bgptheme | 20 + .../themes/Single_line_Minimalist.bgptheme | 33 + .../themes/Single_line_NoExitState.bgptheme | 12 + .../Single_line_NoExitState_Gentoo.bgptheme | 20 + .../Single_line_NoExitState_openSUSE.bgptheme | 20 + .../themes/Single_line_Solarized.bgptheme | 34 + .../Single_line_Solarized_Lamda.bgptheme | 48 ++ .../themes/Single_line_Ubuntu.bgptheme | 25 + .../themes/Single_line_openSUSE.bgptheme | 20 + .../themes/Single_line_username_repo.bgptheme | 13 + .../themes/Solarized.bgptheme | 13 + .../themes/Solarized_Extravagant.bgptheme | 41 + .../themes/Solarized_NoExitState.bgptheme | 16 + .../Solarized_NoExitState_Ubuntu.bgptheme | 18 + .../themes/Solarized_Ubuntu.bgptheme | 14 + .../themes/Solarized_UserHost.bgptheme | 23 + .../themes/TruncatedPwd_WindowTitle.bgptheme | 40 + ...ncatedPwd_WindowTitle_NoExitState.bgptheme | 40 + ...wd_WindowTitle_NoExitState_Ubuntu.bgptheme | 46 ++ .../TruncatedPwd_WindowTitle_Ubuntu.bgptheme | 45 ++ dotfiles/.bash_completion | 8 + dotfiles/.bashrc | 162 ++++ dotfiles/.mailcap | 5 + 50 files changed, 3334 insertions(+) create mode 100644 dotfiles/.bash-git-prompt/LICENSE.txt create mode 100644 dotfiles/.bash-git-prompt/README.md create mode 100644 dotfiles/.bash-git-prompt/bash-git-prompt.rb create mode 100644 dotfiles/.bash-git-prompt/bash-git-prompt.spec create mode 100755 dotfiles/.bash-git-prompt/git-prompt-help.sh create mode 100644 dotfiles/.bash-git-prompt/gitprompt.fish create mode 100644 dotfiles/.bash-git-prompt/gitprompt.png create mode 100755 dotfiles/.bash-git-prompt/gitprompt.sh create mode 100755 dotfiles/.bash-git-prompt/gitstatus.py create mode 100755 dotfiles/.bash-git-prompt/gitstatus.sh create mode 100755 dotfiles/.bash-git-prompt/gitstatus_pre-1.7.10.sh create mode 100644 dotfiles/.bash-git-prompt/prompt-colors.sh create mode 100644 dotfiles/.bash-git-prompt/themes/Chmike.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Crunch.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Custom.bgptemplate create mode 100644 dotfiles/.bash-git-prompt/themes/Default.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Default_NoExitState.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Default_NoExitState_Ubuntu.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Default_Ubuntu.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Evermeet.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Evermeet_Lowres.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Evermeet_Ubuntu.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Minimal.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Minimal_Chevron.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Minimal_UserHost.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Plague_Doctor.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Single_line.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Single_line_Dark.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Single_line_Minimalist.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Single_line_NoExitState.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Single_line_NoExitState_Gentoo.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Single_line_NoExitState_openSUSE.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Single_line_Solarized.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Single_line_Solarized_Lamda.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Single_line_Ubuntu.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Single_line_openSUSE.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Single_line_username_repo.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Solarized.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Solarized_Extravagant.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Solarized_NoExitState.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Solarized_NoExitState_Ubuntu.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Solarized_Ubuntu.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/Solarized_UserHost.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/TruncatedPwd_WindowTitle.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/TruncatedPwd_WindowTitle_NoExitState.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/TruncatedPwd_WindowTitle_NoExitState_Ubuntu.bgptheme create mode 100644 dotfiles/.bash-git-prompt/themes/TruncatedPwd_WindowTitle_Ubuntu.bgptheme create mode 100644 dotfiles/.bash_completion create mode 100644 dotfiles/.bashrc create mode 100644 dotfiles/.mailcap diff --git a/dotfiles/.bash-git-prompt/LICENSE.txt b/dotfiles/.bash-git-prompt/LICENSE.txt new file mode 100644 index 0000000..d9cf93e --- /dev/null +++ b/dotfiles/.bash-git-prompt/LICENSE.txt @@ -0,0 +1,23 @@ +Copyright (c) 2016, Martin Gondermann +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/dotfiles/.bash-git-prompt/README.md b/dotfiles/.bash-git-prompt/README.md new file mode 100644 index 0000000..8f7ecff --- /dev/null +++ b/dotfiles/.bash-git-prompt/README.md @@ -0,0 +1,396 @@ +# Informative git prompt for bash and fish + +[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/magicmonty/bash-git-prompt?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) + +This prompt is a port of the "Informative git prompt for zsh" which you can +find [here](https://github.com/olivierverdier/zsh-git-prompt) + +A ``bash`` 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][]). + +`gitstatus.sh` and `git-prompt-help.sh` added by [AKS](http://github.com/aks). + +# ATTENTION! Breaking changes! + +**If you use this prompt already, please update your `.git-prompt-colors.sh`, +if you have one. It now contains a function named `define_git_prompt_colors()` or `override_git_prompt_colors()`!** + +**Please see the ``Custom.bgptemplate`` in the ``themes`` subdirectory of the installation directory!** + +**You can now also use the function `override_git_prompt_colors()`. It should define the variable `GIT_PROMPT_THEME_NAME` +and call the function `reload_git_prompt_colors ` like follows:** + +```sh +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Custom" # needed for reload optimization, should be unique + + # Place your overrides here + ... +} + +# load the theme +reload_git_prompt_colors "Custom" +``` + +The advantage of this approach is, that you only need to specify the parts, that are different to the Default theme. + +--- + +**The variable `GIT_PROMPT_SHOW_LAST_COMMAND_INDICATOR` was replaced with a more general placeholder +named ``_LAST_COMMAND_INDICATOR_``, which is replaced by the state of the last executed command. It is now activated by default.** + +## Examples + +The prompt may look like the following: + +![Example prompt](gitprompt.png) + +* ``(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 +* ``(master|⚑2)``: on branch ``master``, 2 stash entries +* ``(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 + +## Prompt Structure + +By default, the general appearance of the prompt is:: + + ( |) + +The symbols are as follows: + +- Local Status Symbols + - ``✔``: repository clean + - ``●n``: there are ``n`` staged files + - ``✖n``: there are ``n`` files with merge conflicts + - ``✖-n``: there are ``n`` staged files waiting for removal + - ``✚n``: there are ``n`` changed but *unstaged* files + - ``…n``: there are ``n`` untracked files + - ``⚑n``: there are ``n`` stash entries +- Upstream branch + - Shows the remote tracking branch + - Disabled by default + - Enable by setting GIT_PROMPT_SHOW_UPSTREAM=1 +- Branch Tracking Symbols + - ``↑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 + - ``L``: local branch, not remotely tracked +- 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 :-) + +## Installation + +### via [Homebrew][homebrew] on Mac OS X + +- Run `brew update` + +- Run `brew install bash-git-prompt` for the last stable release or `brew install --HEAD bash-git-prompt` for the + latest version directly from the repository + +- Now you can source the file in your `~/.bash_profile` as follows: + +```sh +if [ -f "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh" ]; then + __GIT_PROMPT_DIR=$(brew --prefix)/opt/bash-git-prompt/share + GIT_PROMPT_ONLY_IN_REPO=1 + source "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh" +fi +``` + +### via Git clone + +- Clone this repository to your home directory. + +```sh +git clone https://github.com/magicmonty/bash-git-prompt.git ~/.bash-git-prompt --depth=1 +``` + +Add to the `~/.bashrc`: +``` +if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then + GIT_PROMPT_ONLY_IN_REPO=1 + source $HOME/.bash-git-prompt/gitprompt.sh +fi +``` + +### install for the fish shell + +- If you cloned the repo to a directory other then ~/.bash-git-prompt , set __GIT_PROMPT_DIR in ~/.config/fish/config.fish + to that path + +- To install as an option in the fish_config GUI + +```sh +sudo install -m 666 gitprompt.fish /usr/share/fish/tools/web_config/sample_prompts/ +fish_config +``` + to install the bash-git-prompt as a choice under the prompt tab of the web config. Selecting this will copy it to + ~/.config/fish/functions/fish_prompt.fish + +- You can also do + +```sh +mkdir -p ~/.config/fish/functions/ +cp gitprompt.fish ~/.config/fish/functions/fish_prompt.fish +``` + to overwrite the current prompt with the bash-git-prompt directly + + +### All configs for .bashrc + +```sh + + # Set config variables first + GIT_PROMPT_ONLY_IN_REPO=1 + + # GIT_PROMPT_FETCH_REMOTE_STATUS=0 # uncomment to avoid fetching remote status + # GIT_PROMPT_IGNORE_SUBMODULES=1 # uncomment to avoid searching for changed files in submodules + # GIT_PROMPT_WITH_VIRTUAL_ENV=0 # uncomment to avoid setting virtual environment infos for node/python/conda environments + + # GIT_PROMPT_SHOW_UPSTREAM=1 # uncomment to show upstream tracking branch + # GIT_PROMPT_SHOW_UNTRACKED_FILES=normal # can be no, normal or all; determines counting of untracked files + + # GIT_PROMPT_SHOW_CHANGED_FILES_COUNT=0 # uncomment to avoid printing the number of changed files + + # GIT_PROMPT_STATUS_COMMAND=gitstatus_pre-1.7.10.sh # uncomment to support Git older than 1.7.10 + + # GIT_PROMPT_START=... # uncomment for custom prompt start sequence + # GIT_PROMPT_END=... # uncomment for custom prompt end sequence + + # as last entry source the gitprompt script + # GIT_PROMPT_THEME=Custom # use custom theme specified in file GIT_PROMPT_THEME_FILE (default ~/.git-prompt-colors.sh) + # GIT_PROMPT_THEME_FILE=~/.git-prompt-colors.sh + # GIT_PROMPT_THEME=Solarized # use theme optimized for solarized color scheme + source ~/.bash-git-prompt/gitprompt.sh +``` + +You can set the `GIT_PROMPT_SHOW_UNTRACKED_FILES` variable to `no` or `normal` to speed things up if you have lots of +untracked files in your repository. This can be the case for build systems that put their build artifacts in +the subdirectory structure of the git repository. Setting it to `all` will count all untracked files, including files +listed in .gitignore. + +- `cd` to a git repository and test it! + +#### Themes + +The most settings are now stored in theme files. To select a theme, set the variable `GIT_PROMPT_THEME` to the name +of the theme located in `/themes` without the extension `.bgptheme` like this: + +```sh +GIT_PROMPT_THEME=Solarized +``` + +If you set `GIT_PROMPT_THEME` to `Custom`, then the `.git-prompt-colors.sh` in the home directory will be used. +This file can now be generated with the command `git_prompt_make_custom_theme []`. If the name of +the base theme is ommitted or the theme file is not found, then the Default theme is used. If you have already a custom +`.git-prompt-colors.sh` in your home directory, a error message will be shown. + +You can display a list of available themes with `git_prompt_list_themes` (the current theme is highlighted) + +**If you omit the `GIT_PROMPT_THEME` variable, the Default theme is used or, if you have a custom `.git-prompt-colors.sh` +in your home directory, then the Custom theme is used.** + +##### Ubuntu Themes + +Ubuntu requires a bit more spacing for some characters so it has its own themes. + +These can be listed with `git_prompt_list_themes`: +```sh +git_prompt_list_themes | grep Ubuntu +``` + +##### Theme structure + +Please see the ``Custom.bgptemplate`` in the ``themes`` subdirectory of the installation directory! + +A theme consists of a function `override_git_prompt_colors()` which defines at least the variable `GIT_PROMPT_THEME_NAME` + with a unique theme identifier and a call to the function `reload_git_prompt_colors ` like follows: + +```sh +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Custom" # needed for reload optimization, should be unique + + # Place your overrides here + ... +} + +# load the theme +reload_git_prompt_colors "Custom" +``` + +The advantage of this approach is, that you only need to specify the parts, that are different to the Default theme. + +If you use a custom theme in `.git-prompt-colors.sh`, please set `GIT_PROMPT_THEME_NAME="Custom"`. + +#### Further customizations + +- You can define `GIT_PROMPT_START` and `GIT_PROMPT_END` to tweak your prompt. + +- The default colors are defined within `prompt-colors.sh`, which is sourced by + `gitprompt.sh`. The colors used for various git status are defined in + `themes/Default.bgptheme`. Both of these files may be overridden by copying + them to $HOME with a `.` prefix. They can also be placed in `$HOME/lib` + without the leading `.`. The defaults are the original files in the + `~/.bash-git-prompt` directory. + +- You can use `GIT_PROMPT_START_USER`, `GIT_PROMPT_START_ROOT`, + `GIT_PROMPT_END_USER` and `GIT_PROMPT_END_ROOT` in your + `.git-prompt-colors.sh` to tweak your prompt. You can also override the start + and end of the prompt by setting `GIT_PROMPT_START` and `GIT_PROMPT_END` + before you source the `gitprompt.sh`. + +- The current git repo information is obtained by the script `gitstatus.sh`. +- You can define `prompt_callback` function to tweak your prompt dynamically. + +```sh +function prompt_callback { + if [ `jobs | wc -l` -ne 0 ]; then + echo -n " jobs:\j" + fi +} +``` + +- There are two helper functions that can be used within `prompt_callback`: + - `gp_set_window_title ` - sets the window title to the given string (should work for XTerm type terminals like in OS X or Ubuntu) + - `gp_truncate_pwd` - a function that returns the current PWD truncated to fit the current terminal width. Specify the length to truncate to as a parameter. Otherwise it defaults to 1/3 of the terminal width. + +- If you want to show the git prompt only if you are in a git repository you + can set `GIT_PROMPT_ONLY_IN_REPO=1` before sourcing the gitprompt script + +- You can show an abbreviated `username/repo` in the prompt by setting `GIT_PROMPT_WITH_USERNAME_AND_REPO=1` and setting the placeholder `_USERNAME_REPO_` in your `GIT_PROMPT_PREFIX`. You can also add a `GIT_PROMPT_USERNAME_REPO_SEPARATOR=" | "` so the `username/repo` is nicely separated if there is a remote and if there is no remote, neither the username/repo part nor the separator will be shown. See the theme `Single_line_username_repo.bgptheme` for an example. + + +- There is an indicator at the start of the prompt, which shows + the result of the last executed command by if you put the placeholder + `_LAST_COMMAND_INDICATOR_` in any of the prompt templates. + It is now by default activated in the default theme: + +```sh + GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${Yellow}${PathShort}${ResetColor}" + GIT_PROMPT_START_ROOT="_LAST_COMMAND_INDICATOR_ ${GIT_PROMPT_START_USER}" +``` + + If you want to display the exit code too, you can use the placeholder + ``_LAST_COMMAND_STATE_`` in ``GIT_PROMPT_COMMAND_OK`` or ``GIT_PROMPT_COMMAND_FAIL`` + in your ``.git-prompt-colors.sh``: + +```sh +GIT_PROMPT_COMMAND_OK="${Green}✔ " # displays as ✔ +GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_ " # displays as ✘-1 for exit code 1 +``` + +- It is now possible to disable the fetching of the remote repository either + globally by setting ``GIT_PROMPT_FETCH_REMOTE_STATUS=0`` in your .bashrc or + on a per repository basis by creating a file named ``.bash-git-rc`` with the + content ``FETCH_REMOTE_STATUS=0`` in the root of your git repository. + +- You can also ignore a repository completely by creating a file named ``.bash-git-rc`` with the + content ``GIT_PROMPT_IGNORE=1`` in the root of your git repository. + +- If you have a repository with many untracked files, the git prompt can become very slow. + You can disable the display of untracked files on a per repository basis by setting + ``GIT_PROMPT_SHOW_UNTRACKED_FILES=no`` in your ``.bash-git-rc`` in the repository or + by disabling it globally in your ``.bashrc`` + +- If you have a repository with a deep submodule hierarchy, this can also affect performance. + You can disable searching for changes in submodules on a per repository basis by setting + ``GIT_PROMPT_IGNORE_SUBMODULES=1`` in your ``.bash-git-rc`` + +- You can get help on the git prompt with the function ``git_prompt_help``. + Examples are available with ``git_prompt_examples``. + A list of all available named colors is available with `git_prompt_color_samples` + +- If you make any changes to any file that is sourced by `gitprompt.sh`, you + should run this command, so that the next prompt update will find all the + files and source them anew. + +```sh +git_prompt_reset +``` + +- You can disable/enable gitprompt by running: + +```sh +git_prompt_toggle +``` + + +**Enjoy!** + +## Alternative RPM Install + +This project ships an RPM spec to simplify installation on RHEL and +clones. If you wish to install from RPM, you may first build the RPM +from scratch by following this procedure: +* Clone this repository and tag the release with a version number + +````sh + git tag -a -m "Tag release 1.1" 1.1 +```` + +* Run the following command to create a tarball: + +````sh + VER=$(git describe) + # replace dash with underscore to work around + # rpmbuild does not allow dash in version string + VER=${VER//\-/_} + git archive \ + --format tar \ + --prefix=bash-git-prompt-${VER}/ \ + HEAD \ + -- *.sh \ + *.fish \ + README.md \ + themes \ + > bash-git-prompt-${VER}.tar + mkdir -p /tmp/bash-git-prompt-${VER} + sed "s/Version:.*/Version: ${VER}/" \ + bash-git-prompt.spec \ + > /tmp/bash-git-prompt-${VER}/bash-git-prompt.spec + OLDDIR=$(pwd) + cd /tmp + tar -uf ${OLDDIR}/bash-git-prompt-${VER}.tar \ + bash-git-prompt-${VER}/bash-git-prompt.spec + cd ${OLDDIR} + gzip bash-git-prompt-${VER}.tar + mv bash-git-prompt-${VER}.tar.gz bash-git-prompt-${VER}.tgz +```` + +* Log into an RHEL or clones host and run: + +````sh +rpmbuild -ta bash-git-prompt-xxx.tar.gz +```` +Then you may publish or install the rpm from "~/rpmbuild/RPMS/noarch". + +## License +This code is under the [BSD 2 Clause (NetBSD) license][license]. + +## Who Are You? +The current maintainer of the original bash-git-prompt is [Martin Gondermann][magicmonty]. + +## Contributing +If you want to contribute you can look for issues with the label [up-for-grabs][upforgrabs]. +Please leave a comment on the issue, that you want to fix it, so others know, the labels are "taken". + +Pull requests are welcome. I will check them and merge them, if I think they help the project. + +## Donations +I accept tips through [Flattr][flattr]. + +[![Flattr](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=magicmonty&url=https%3A%2F%2Fgithub.com%2Fmagicmonty%2Fbash-git-prompt) + +[blog post]: http://sebastiancelis.com/2009/nov/16/zsh-prompt-git-users/ +[tip]:https://www.gittip.com/magicmonty/ +[magicmonty]: http://blog.pagansoft.de/pages/about.html +[license]:https://github.com/magicmonty/bash-git-prompt/tree/master/LICENSE.txt +[flattr]: https://flattr.com/submit/auto?user_id=magicmonty&url=https%3A%2F%2Fgithub.com%2Fmagicmonty%2Fbash-git-prompt +[homebrew]: http://brew.sh/ +[upforgrabs]: https://github.com/magicmonty/bash-git-prompt/labels/up-for-grabs diff --git a/dotfiles/.bash-git-prompt/bash-git-prompt.rb b/dotfiles/.bash-git-prompt/bash-git-prompt.rb new file mode 100644 index 0000000..7243acc --- /dev/null +++ b/dotfiles/.bash-git-prompt/bash-git-prompt.rb @@ -0,0 +1,31 @@ +class BashGitPrompt < Formula + desc "Informative, fancy bash prompt for Git users" + homepage "https://github.com/magicmonty/bash-git-prompt" + url "https://github.com/magicmonty/bash-git-prompt/archive/2.7.1.tar.gz" + sha256 "5e5fc6f5133b65760fede8050d4c3bc8edb8e78bc7ce26c16db442aa94b8a709" + head "https://github.com/magicmonty/bash-git-prompt.git" + + bottle :unneeded + + def install + share.install "gitprompt.sh", "gitprompt.fish", "git-prompt-help.sh", + "gitstatus.py", "gitstatus.sh", "gitstatus_pre-1.7.10.sh", + "prompt-colors.sh" + + (share/"themes").install Dir["themes/*.bgptheme"], "themes/Custom.bgptemplate" + doc.install "README.md" + end + + def caveats; <<~EOS + You should add the following to your .bashrc (or .bash_profile if bash is your login shell): + if [ -f "#{HOMEBREW_PREFIX}/opt/bash-git-prompt/share/gitprompt.sh" ]; then + __GIT_PROMPT_DIR="#{HOMEBREW_PREFIX}/opt/bash-git-prompt/share" + source "#{HOMEBREW_PREFIX}/opt/bash-git-prompt/share/gitprompt.sh" + fi + EOS + end + + test do + system "true" + end +end diff --git a/dotfiles/.bash-git-prompt/bash-git-prompt.spec b/dotfiles/.bash-git-prompt/bash-git-prompt.spec new file mode 100644 index 0000000..71efbde --- /dev/null +++ b/dotfiles/.bash-git-prompt/bash-git-prompt.spec @@ -0,0 +1,70 @@ +%global START_TOKEN ### Generated by %{name} rpm package +%global END_TOKEN ### Generated by %{name} rpm package + +Name: bash-git-prompt +Version: 2.7.1 +Release: 1%{?dist} +Summary: Informative git prompt for bash and fish + +Group: Development/Tools +License: FreeBSD +URL: https://github.com/magicmonty/bash-git-prompt +Source0: https://github.com/magicmonty/%{name}/archive/%{name}-%{version}.tar.gz +Requires: git +BuildArch: noarch + +%description +A bash prompt that displays information about the current git repository. In particular the branch name, difference with remote branch, number of files staged, changed, etc. + +This package will automatically enable the git prompt for bash after +install. It will disable the prompt accordingly after uninstall. + +%prep +%setup -q + +%build +# No command are required here +# These comments are here to avoid rpm lint issue + +%install +install -dm 755 %{buildroot}%{_datadir}/%{name} +install -pm 755 *.sh %{buildroot}%{_datadir}/%{name} +#install -pm 755 *.py %{buildroot}%{_datadir}/%{name} +install -pm 755 *.fish %{buildroot}%{_datadir}/%{name} +install -pm 644 README.md %{buildroot}%{_datadir}/%{name} +install -dm 755 %{buildroot}%{_datadir}/%{name}/themes +install -pm 644 themes/*.bgptheme %{buildroot}%{_datadir}/%{name}/themes +install -pm 644 themes/*.bgptemplate %{buildroot}%{_datadir}/%{name}/themes + +%post +# enable bash-git-prompt +cat << EOF >> /etc/bashrc +%{START_TOKEN} +if [ -f %{_datadir}/%{name}/gitprompt.sh ]; then + # Set config variables first + + GIT_PROMPT_ONLY_IN_REPO=1 + GIT_PROMPT_THEME=Default + source %{_datadir}/%{name}/gitprompt.sh +fi +%{END_TOKEN} +EOF + +%postun +# remove bash-git-prompt setup +sed -i -e '/^%{START_TOKEN}/, /^%{END_TOKEN}/{d}' /etc/bashrc + +%files +%defattr(-,root,root,-) +%{_datadir}/%{name} + +%doc README.md + +%license LICENSE.txt + +%changelog +* Tue Jun 28 2016 Koustubh Sinkar +- Updating the spec file to reflect more recent changes + +* Fri Aug 08 2014 Justin Zhang ${GIT_PROMPT_SEPARATOR}${GIT_PROMPT_SUFFIX} + +BRANCH is a branch name, such as "master" or "stage", a tag name, or commit +hash prefixed with ':'. + +TRACKING indicates how the local branch differs from the +remote branch. It can be empty, or one of: + + ${GIT_PROMPT_BRANCH}${ResetColor}${GIT_PROMPT_REMOTE}${GIT_PROMPT_SYMBOLS_AHEAD}N${ResetColor} - ahead of remote by N commits + ${GIT_PROMPT_BRANCH}${ResetColor}${GIT_PROMPT_REMOTE}${GIT_PROMPT_SYMBOLS_BEHIND}M${ResetColor} - behind remote by M commits + ${GIT_PROMPT_BRANCH}${ResetColor}${GIT_PROMPT_REMOTE}${GIT_PROMPT_SYMBOLS_AHEAD}N${GIT_PROMPT_SYMBOLS_BEHIND}M${ResetColor} - branches diverged, other by M commits, yours by N commits + +LOCALSTATUS is one of the following: + + ${GIT_PROMPT_CLEAN}${ResetColor} - repository clean + ${GIT_PROMPT_STAGED}N${ResetColor} - N staged files + ${GIT_PROMPT_CONFLICTS}N${ResetColor} - N files with merge conflicts + ${GIT_PROMPT_CHANGED}N${ResetColor} - N changed but *unstaged* files + ${GIT_PROMPT_UNTRACKED}N${ResetColor} - N untracked files + ${GIT_PROMPT_STASHED}N${ResetColor} - N stash entries + +See "git_prompt_examples" for examples. +EOF +} + +help_git_prompt() { git_prompt_help ; } + +git_prompt_examples() { + cat < + +function fish_prompt + + if not set -q __GIT_PROMPT_DIR + set __GIT_PROMPT_DIR ~/.bash-git-prompt + end + + # Colors + # Reset + set ResetColor (set_color normal) # Text Reset + + # Regular Colors + set Red (set_color red) # Red + set Yellow (set_color yellow); # Yellow + set Blue (set_color blue) # Blue + set WHITE (set_color white) + + # Bold + set BGreen (set_color -o green) # Green + + # High Intensty + set IBlack (set_color -o black) # Black + + # Bold High Intensty + set Magenta (set_color -o purple) # Purple + + # Default values for the appearance of the prompt. Configure at will. + set GIT_PROMPT_PREFIX "[" + set GIT_PROMPT_SUFFIX "]" + set GIT_PROMPT_SEPARATOR "|" + set GIT_PROMPT_BRANCH "$Magenta" + set GIT_PROMPT_STAGED "$Red● " + set GIT_PROMPT_CONFLICTS "$Red✖ " + set GIT_PROMPT_CHANGED "$Blue✚ " + set GIT_PROMPT_REMOTE " " + set GIT_PROMPT_UNTRACKED "…" + set GIT_PROMPT_STASHED "⚑ " + set GIT_PROMPT_CLEAN "$BGreen✔" + + # Various variables you might want for your PS1 prompt instead + set Time (date +%R) + set PathShort (pwd|sed "s=$HOME=~=") + + set PROMPT_START "$Yellow$PathShort$ResetColor" + set PROMPT_END " \n$WHITE$Time$ResetColor \$ " + + set -e __CURRENT_GIT_STATUS + set gitstatus "$__GIT_PROMPT_DIR/gitstatus.py" + + set _GIT_STATUS (python $gitstatus) + set __CURRENT_GIT_STATUS $_GIT_STATUS + + set __CURRENT_GIT_STATUS_PARAM_COUNT (count $__CURRENT_GIT_STATUS) + + if not test "0" -eq $__CURRENT_GIT_STATUS_PARAM_COUNT + set GIT_BRANCH $__CURRENT_GIT_STATUS[1] + set GIT_REMOTE "$__CURRENT_GIT_STATUS[2]" + if contains "." "$GIT_REMOTE" + set -e GIT_REMOTE + end + set GIT_STAGED $__CURRENT_GIT_STATUS[3] + set GIT_CONFLICTS $__CURRENT_GIT_STATUS[4] + set GIT_CHANGED $__CURRENT_GIT_STATUS[5] + set GIT_UNTRACKED $__CURRENT_GIT_STATUS[6] + set GIT_STASHED $__CURRENT_GIT_STATUS[7] + set GIT_CLEAN $__CURRENT_GIT_STATUS[8] + end + + if test -n "$__CURRENT_GIT_STATUS" + set STATUS " $GIT_PROMPT_PREFIX$GIT_PROMPT_BRANCH$GIT_BRANCH$ResetColor" + + if set -q GIT_REMOTE + set STATUS "$STATUS$GIT_PROMPT_REMOTE$GIT_REMOTE$ResetColor" + end + + set STATUS "$STATUS$GIT_PROMPT_SEPARATOR" + + if [ $GIT_STAGED != "0" ] + set STATUS "$STATUS$GIT_PROMPT_STAGED$GIT_STAGED$ResetColor" + end + + if [ $GIT_CONFLICTS != "0" ] + set STATUS "$STATUS$GIT_PROMPT_CONFLICTS$GIT_CONFLICTS$ResetColor" + end + + if [ $GIT_CHANGED != "0" ] + set STATUS "$STATUS$GIT_PROMPT_CHANGED$GIT_CHANGED$ResetColor" + end + + if [ "$GIT_UNTRACKED" != "0" ] + set STATUS "$STATUS$GIT_PROMPT_UNTRACKED$GIT_UNTRACKED$ResetColor" + end + + if [ "$GIT_STASHED" != "0" ] + set STATUS "$STATUS$GIT_PROMPT_STASHED$GIT_STASHED$ResetColor" + end + + if [ "$GIT_CLEAN" = "1" ] + set STATUS "$STATUS$GIT_PROMPT_CLEAN" + end + + set STATUS "$STATUS$ResetColor$GIT_PROMPT_SUFFIX" + + set PS1 "$PROMPT_START$STATUS$PROMPT_END" + else + set PS1 "$PROMPT_START$PROMPT_END" + end + + echo -e $PS1 + +end + + diff --git a/dotfiles/.bash-git-prompt/gitprompt.png b/dotfiles/.bash-git-prompt/gitprompt.png new file mode 100644 index 0000000000000000000000000000000000000000..c3d5c0580a42085a7ef80de1567e47d201bb8379 GIT binary patch literal 22550 zcmY)WbyQo=_dO1$KyfQjT#8$;;_hC&xVsdG;O_1ktUw9w?ga`Ihf<)pYjAgddA&dD zyVmpMkKE*D?##V&&YUwdd+$W6D$8P^5~BhD01SCKDRlq<4h{A>6d4Zo9w$Ea9(I6t zlaT+4jEuazsj>n4itR3~|CX`F}F+qf!mb#Mjz7c>1s|NduF)AtZ|M} zERat0dV2Y+O9Q&oj5yL-Q)a0(nY<%JqKq7_1LSePuj}vc*K>2dFY%zc(ORDdz2rPx z)%I>asuj!T`L1Pgf19_sVxldYIe6lKfI%4kq=5e#`8due+>f4#`e;qv3CL zb3NbaBXR7gf3*;OR0=PQ4-YSviTCJS1&GbMf5I-)e`MCG`aLmm zGF>=e9QXpF*=_i*@teZjB^SqiDYdj}{Z>e^SVRfow*S+uw@`j=ZZ5TPU&U_A<|j^H z(dRmgv3VA!o>xR$pl**sqzSv%Y&>uB{!l#0y326h-3wG?Sc1<+htFw6C+>o!bxmUS z`WFhW@7)o1K)AXr1l*8HL_>Mi-p#<$b>*!pTr?;Hk zDlHMkAm<{aOrvaPh^bXBcwKht1rrtsnEagJT|K_=f*I8JtoIZOdkir5Hv`rM{^F?* zgZG}X_-c5d)#imfP9H9SO~>mHiPLl44w9xO(lv!Mw7T`tzbDMEvGD5nuXW(V&4LZr z(hvDmeaD^$*uB69B^S#ikO`hHhp*d#Z*R1(V6A*(v_3dDO{8QEJ2u~AJ%r+fjs6bOY;Nl zesA>Mt=_R|Y7T7HeGC}5;dMV-6Xxah9E!Uu73Muz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}ddseh7ONPV4Pe1kCzIXSluFO?#5JQ;FX1Ckz_xrtGFH9&o91g413bm*P z2M14{JURB87{_t9+YMcyGJTiHWRzKZkH=HmNs&BF8a)idIGs+YtciY62t;*y2qiwB zPpd01Y4W5K17BzpN)3%A*uk4?9s&+aWfk05EOz9`k+!xrSg6v@%|{Ve?wtVuqsdSe z1U&x_ZXaP725O@!4+pJ0vPq+?2L=!}o6T;wXS3M}B}aikR6Y7DPeP%Ps^rp{m)^7D zn~!!rrYc``@Apb#hi(i3C9JdAEI|-*()^WIURktgQAsz>R;o-xFJ32ZxZ{94wl&Ai- z_67}HLjDVHj0;JUBuNsSk%l(7a>QjkB{!+Kw?mZD%1W`~g1|5=5C~|MhY<+GSdSsB zR_o7x`Qi)Dz4+0gkIOoq&GSn6V3y;@k1trT06oGg0Qm+4V!Xx>EAQ*r_2%we?qS{f z&cIOM6zAd|_o-Lg#iYI93dC1Z%8p`mm-y=KiCf*@wjoVk7b_6a`JMa}?$K$MS> zwOzB>Y&05G9;tZxo#R2&rw*v|aNTiyj^xu5R^jQ4|@5fl9FiK{%aGk|b5_BP(oc>#U^ux9-Ow^=|}XOveyP zClL;ZwOOWd5kqLRNtsNBrfHAIQ{C#{(P)$)i2C|^sBOivY_5f^0I7c?5Qu_2glaTe z0Yx_57@{2N--$$mqNu7@|4ygV^3FAaAl&Y9ou!J@zY&ND{oMiv{LPpod@>2FLM+h6a{p5e*MIsUCAxtI{ zoarqNk|cSaH<-39IZ$dl8jad)HmLp$Q$||#?{a)Pj7#KjMAtu!5~%(S)oRg9H3Csh zm~wS1aPCo(B#z?@5)@^PA++k>Fd+l=Tt!hVLjBv}aKvJ /dev/null + }& +} + +function git_prompt_dir() { + # assume the gitstatus.sh is in the same directory as this script + # code thanks to http://stackoverflow.com/questions/59895 + if [[ -z "${__GIT_PROMPT_DIR:+x}" ]]; then + local SOURCE="${BASH_SOURCE[0]}" + while [[ -h "${SOURCE}" ]]; do + local DIR="$( command cd -P "$( dirname "${SOURCE}" )" && pwd )" + SOURCE="$(readlink "${SOURCE}")" + [[ ${SOURCE} != /* ]] && SOURCE="${DIR}/${SOURCE}" + done + __GIT_PROMPT_DIR="$( command cd -P "$( dirname "${SOURCE}" )" && pwd )" + fi +} + +function echoc() { + echo -e "${1}${2}${ResetColor}" | sed 's/\\\]//g' | sed 's/\\\[//g' +} + +function get_theme() { + local CUSTOM_THEME_FILE="${HOME}/.git-prompt-colors.sh" + if [[ ! (-z "${GIT_PROMPT_THEME_FILE:+x}" ) ]]; then + CUSTOM_THEME_FILE="${GIT_PROMPT_THEME_FILE}" + fi + local DEFAULT_THEME_FILE="${__GIT_PROMPT_DIR}/themes/Default.bgptheme" + + if [[ -z "${GIT_PROMPT_THEME+x}" ]]; then + if [[ -r "${CUSTOM_THEME_FILE}" ]]; then + GIT_PROMPT_THEME="Custom" + __GIT_PROMPT_THEME_FILE="${CUSTOM_THEME_FILE}" + else + GIT_PROMPT_THEME="Default" + __GIT_PROMPT_THEME_FILE="${DEFAULT_THEME_FILE}" + fi + else + if [[ "${GIT_PROMPT_THEME}" = "Custom" ]]; then + GIT_PROMPT_THEME="Custom" + __GIT_PROMPT_THEME_FILE="${CUSTOM_THEME_FILE}" + + if [[ ! (-r "${__GIT_PROMPT_THEME_FILE}") ]]; then + GIT_PROMPT_THEME="Default" + __GIT_PROMPT_THEME_FILE="${DEFAULT_THEME_FILE}" + fi + else + local theme="" + + # use default theme, if theme was not found + for themefile in "${__GIT_PROMPT_DIR}/themes/"*.bgptheme; do + local basename=${themefile##*/} + if [[ "${basename%.bgptheme}" = "${GIT_PROMPT_THEME}" ]]; then + theme="${GIT_PROMPT_THEME}" + break + fi + done + + if [[ "${theme}" = "" ]]; then + GIT_PROMPT_THEME="Default" + fi + + __GIT_PROMPT_THEME_FILE="${__GIT_PROMPT_DIR}/themes/${GIT_PROMPT_THEME}.bgptheme" + fi + fi +} + +function git_prompt_load_colors() { + if gp_set_file_var __PROMPT_COLORS_FILE prompt-colors.sh ; then + # outsource the color defs + source "${__PROMPT_COLORS_FILE}" + else + echo 1>&2 "Cannot find prompt-colors.sh!" + fi +} + +function git_prompt_load_theme() { + get_theme + local DEFAULT_THEME_FILE="${__GIT_PROMPT_DIR}/themes/Default.bgptheme" + source "${DEFAULT_THEME_FILE}" + source "${__GIT_PROMPT_THEME_FILE}" +} + +function git_prompt_list_themes() { + git_prompt_load_colors + git_prompt_dir + get_theme + + for themefile in "${__GIT_PROMPT_DIR}/themes/"*.bgptheme; do + local basename="${themefile##*/}" + local theme="${basename%.bgptheme}" + if [[ "${GIT_PROMPT_THEME}" = "${theme}" ]]; then + echoc "${Red}" "*${theme}" + else + echo "${theme}" + fi + done + + if [[ "${GIT_PROMPT_THEME}" = "Custom" ]]; then + echoc "${Magenta}" "*Custom" + else + echoc "${Blue}" "Custom" + fi +} + +function git_prompt_make_custom_theme() { + if [[ -r "${HOME}/.git-prompt-colors.sh" ]]; then + echoc "${Red}" "You have already created a custom theme!" + else + git_prompt_dir + + local base="Default" + if [[ -n "${1}" && -r "${__GIT_PROMPT_DIR}/themes/${1}.bgptheme" ]]; then + base="${1}" + echoc "${Green}" "Using theme ${Magenta}\"${base}\"${Green} as base theme!" + else + echoc "${Green}" "Using theme ${Magenta}\"Default\"${Green} as base theme!" + fi + + if [[ "${base}" = "Custom" ]]; then + echoc "${Red}" "You cannot use the custom theme as base" + else + echoc "${Green}" "Creating new custom theme in \"${HOME}/.git-prompt-colors.sh\"" + echoc "${DimYellow}" "Please add ${Magenta}\"GIT_PROMPT_THEME=Custom\"${DimYellow} to your .bashrc to use this theme" + if [[ "${base}" == "Default" ]]; then + cp "${__GIT_PROMPT_DIR}/themes/Custom.bgptemplate" "${HOME}/.git-prompt-colors.sh" + else + cp "${__GIT_PROMPT_DIR}/themes/${base}.bgptheme" "${HOME}/.git-prompt-colors.sh" + fi + fi + fi +} + +# gp_set_file_var ENVAR SOMEFILE +# +# If ENVAR is set, check that it's value exists as a readable file. Otherwise, +# Set ENVAR to the path to SOMEFILE, based on $HOME, $__GIT_PROMPT_DIR, and the +# directory of the current script. The SOMEFILE can be prefixed with '.', or +# not. +# +# Return 0 (success) if ENVAR not already defined, 1 (failure) otherwise. + +function gp_set_file_var() { + local envar="${1}" + local file="${2}" + if eval "[[ -n \"\${${envar}+x}\" && -r \"\${${envar}+x}\" ]]" ; then # is envar set to a readable file? + local basefile + eval "basefile=\"\`basename \\\"\${${envar}}\\\"\`\"" # assign basefile + if [[ "${basefile}" = "${file}" || "${basefile}" = ".${file}" ]]; then + return 0 + fi + else # envar is not set, or it's set to a different file than requested + eval "${envar}=" # set empty envar + gp_maybe_set_envar_to_path "${envar}" "${HOME}/.${file}" "${HOME}/${file}" "${HOME}/lib/${file}" && return 0 + git_prompt_dir + gp_maybe_set_envar_to_path "${envar}" "${__GIT_PROMPT_DIR}/${file}" "${0##*/}/${file}" && return 0 + fi + return 1 +} + +# gp_maybe_set_envar_to_path ENVAR FILEPATH ... +# +# return 0 (true) if any FILEPATH is readable, set ENVAR to it +# return 1 (false) if not + +function gp_maybe_set_envar_to_path() { + local envar="${1}" + shift + local file + for file in "${@}" ; do + if [[ -r "${file}" ]]; then + eval "${envar}=\"${file}\"" + return 0 + fi + done + return 1 +} + +# git_prompt_reset +# +# unsets selected GIT_PROMPT variables, causing the next prompt callback to +# recalculate them from scratch. + +git_prompt_reset() { + local var + for var in GIT_PROMPT_DIR __GIT_PROMPT_COLORS_FILE __PROMPT_COLORS_FILE __GIT_STATUS_CMD GIT_PROMPT_THEME_NAME; do + unset ${var} + done +} + +# gp_format_exit_status RETVAL +# +# echos the symbolic signal name represented by RETVAL if the process was +# signalled, otherwise echos the original value of RETVAL + +gp_format_exit_status() { + local RETVAL="${1}" + local SIGNAL + # Suppress STDERR in case RETVAL is not an integer (in such cases, RETVAL + # is echoed verbatim) + if [[ "${RETVAL}" -gt 128 ]] 2>/dev/null; then + SIGNAL=$(( RETVAL - 128 )) + kill -l "${SIGNAL}" 2>/dev/null || echo "${RETVAL}" + else + echo "${RETVAL}" + fi +} + +gp_format_username_repo() { + git config --get remote.origin.url | sed 's|^.*//||; s/.*@//; s/[^:/]\+[:/]//; s/.git$//' +} + +function git_prompt_config() { + #Checking if root to change output + _isroot=false + [[ "${UID}" -eq 0 ]] && _isroot=true + + # There are two files related to colors: + # + # prompt-colors.sh -- sets generic color names suitable for bash 'PS1' prompt + # git-prompt-colors.sh -- sets the GIT_PROMPT color scheme, using names from prompt-colors.sh + git_prompt_load_colors + + # source the user's ~/.git-prompt-colors.sh file, or the one that should be + # sitting in the same directory as this script + git_prompt_load_theme + + if is_function prompt_callback; then + prompt_callback="prompt_callback" + else + prompt_callback="prompt_callback_default" + fi + + if [[ "${GIT_PROMPT_LAST_COMMAND_STATE:-0}" = 0 ]]; then + LAST_COMMAND_INDICATOR="${GIT_PROMPT_COMMAND_OK}"; + else + LAST_COMMAND_INDICATOR="${GIT_PROMPT_COMMAND_FAIL}"; + fi + + # replace _LAST_COMMAND_STATE_ token with the actual state + GIT_PROMPT_LAST_COMMAND_STATE=$(gp_format_exit_status "${GIT_PROMPT_LAST_COMMAND_STATE}") + LAST_COMMAND_INDICATOR="${LAST_COMMAND_INDICATOR//_LAST_COMMAND_STATE_/${GIT_PROMPT_LAST_COMMAND_STATE}}" + + # Do this only once to define PROMPT_START and PROMPT_END + + if [[ -z "${PROMPT_START:+x}" || -z "${PROMPT_END:+x}" ]]; then + + if [[ -z "${GIT_PROMPT_START:+x}" ]] ; then + if ${_isroot}; then + PROMPT_START="${GIT_PROMPT_START_ROOT-}" + else + PROMPT_START="${GIT_PROMPT_START_USER-}" + fi + else + PROMPT_START="${GIT_PROMPT_START-}" + fi + + if [[ -z "${GIT_PROMPT_END:+x}" ]] ; then + if $_isroot; then + PROMPT_END="${GIT_PROMPT_END_ROOT-}" + else + PROMPT_END="${GIT_PROMPT_END_USER-}" + fi + else + PROMPT_END="${GIT_PROMPT_END-}" + fi + fi + + # set GIT_PROMPT_LEADING_SPACE to 0 if you want to have no leading space in front of the GIT prompt + if [[ "${GIT_PROMPT_LEADING_SPACE:-1}" = "0" ]]; then + PROMPT_LEADING_SPACE="" + else + PROMPT_LEADING_SPACE=" " + fi + + if [[ "${GIT_PROMPT_ONLY_IN_REPO:-0}" == 1 ]]; then + EMPTY_PROMPT="${OLD_GITPROMPT}" + elif [[ "${GIT_PROMPT_WITH_VIRTUAL_ENV:-1}" == 1 ]]; then + local ps="$(gp_add_virtualenv_to_prompt)${PROMPT_START}$(${prompt_callback})${PROMPT_END}" + EMPTY_PROMPT="${ps//_LAST_COMMAND_INDICATOR_/${LAST_COMMAND_INDICATOR}}" + else + local ps="${PROMPT_START}$(${prompt_callback})${PROMPT_END}" + EMPTY_PROMPT="${ps//_LAST_COMMAND_INDICATOR_/${LAST_COMMAND_INDICATOR}}" + fi + + # fetch remote revisions every other $GIT_PROMPT_FETCH_TIMEOUT (default 5) minutes + if [[ -z "${GIT_PROMPT_FETCH_TIMEOUT:+x}" ]]; then + GIT_PROMPT_FETCH_TIMEOUT="5" + fi + if [[ -z "${__GIT_STATUS_CMD:+x}" ]] ; then # if GIT_STATUS_CMD not defined.. + git_prompt_dir + if ! gp_maybe_set_envar_to_path __GIT_STATUS_CMD "${__GIT_PROMPT_DIR}/${GIT_PROMPT_STATUS_COMMAND}" ; then + echo 1>&2 "Cannot find ${GIT_PROMPT_STATUS_COMMAND}!" + fi + # __GIT_STATUS_CMD defined + fi + unset GIT_BRANCH +} + +function setLastCommandState() { + GIT_PROMPT_LAST_COMMAND_STATE="${?}" +} + +function we_are_on_repo() { + if [[ -e "$(git rev-parse --git-dir 2> /dev/null)" ]]; then + echo 1 + else + echo 0 + fi +} + +function update_old_git_prompt() { + local in_repo=$(we_are_on_repo) + if [[ "${GIT_PROMPT_OLD_DIR_WAS_GIT}" = 0 ]]; then + OLD_GITPROMPT="${PS1}" + fi + + GIT_PROMPT_OLD_DIR_WAS_GIT="${in_repo}" +} + +function setGitPrompt() { + update_old_git_prompt + + local repo=$(git rev-parse --show-toplevel 2> /dev/null) + if [[ ! -e "${repo}" ]] && [[ "${GIT_PROMPT_ONLY_IN_REPO-}" = 1 ]]; then + # we do not permit bash-git-prompt outside git repos, so nothing to do + PS1="${OLD_GITPROMPT}" + return + fi + + local EMPTY_PROMPT + local __GIT_STATUS_CMD + + git_prompt_config + + if [[ ! -e "${repo}" ]] || [[ "${GIT_PROMPT_DISABLE-}" = 1 ]]; then + PS1="${EMPTY_PROMPT}" + return + fi + + local FETCH_REMOTE_STATUS=1 + if [[ "${GIT_PROMPT_FETCH_REMOTE_STATUS}" = 0 ]]; then + FETCH_REMOTE_STATUS=0 + fi + + unset GIT_PROMPT_IGNORE + OLD_GIT_PROMPT_SHOW_UNTRACKED_FILES="${GIT_PROMPT_SHOW_UNTRACKED_FILES}" + unset GIT_PROMPT_SHOW_UNTRACKED_FILES + + OLD_GIT_PROMPT_IGNORE_SUBMODULES="${GIT_PROMPT_IGNORE_SUBMODULES}" + unset GIT_PROMPT_IGNORE_SUBMODULES + + if [[ -e "${repo}/.bash-git-rc" ]]; then + # The config file can only contain variable declarations on the form A_B=0 or G_P=all + local CONFIG_SYNTAX="^(FETCH_REMOTE_STATUS|GIT_PROMPT_SHOW_UNTRACKED_FILES|GIT_PROMPT_IGNORE_SUBMODULES|GIT_PROMPT_IGNORE)=[0-9a-z]+$" + if grep -q -v -E "${CONFIG_SYNTAX}" "${repo}/.bash-git-rc"; then + echo ".bash-git-rc can only contain variable values on the form NAME=value. Ignoring file." >&2 + else + source "${repo}/.bash-git-rc" + fi + fi + + if [[ -z "${GIT_PROMPT_SHOW_UNTRACKED_FILES+x}" ]]; then + GIT_PROMPT_SHOW_UNTRACKED_FILES="${OLD_GIT_PROMPT_SHOW_UNTRACKED_FILES}" + fi + unset OLD_GIT_PROMPT_SHOW_UNTRACKED_FILES + + if [[ -z "${GIT_PROMPT_IGNORE_SUBMODULES+x}" ]]; then + GIT_PROMPT_IGNORE_SUBMODULES="${OLD_GIT_PROMPT_IGNORE_SUBMODULES}" + fi + unset OLD_GIT_PROMPT_IGNORE_SUBMODULES + + if [[ "${GIT_PROMPT_IGNORE-}" = 1 ]]; then + PS1="${EMPTY_PROMPT}" + return + fi + + if [[ "${FETCH_REMOTE_STATUS}" = 1 ]]; then + checkUpstream + fi + + updatePrompt +} + +# some versions of find do not have -mmin +_have_find_mmin=1 + +function olderThanMinutes() { + local matches + local find_exit_code + + if [[ -z "${_find_command+x}" ]]; then + if command -v gfind > /dev/null; then + _find_command="gfind" + else + _find_command="find" + fi + fi + + if [[ "${_have_find_mmin}" = 1 ]]; then + matches=$("${_find_command}" "${1}" -mmin +"${2}" 2> /dev/null) + find_exit_code="${?}" + if [[ -n "${matches}" ]]; then + return 0 + else + if [[ "${find_exit_code}" != 0 ]]; then + _have_find_mmin=0 + else + return 1 + fi + fi + fi + + # try perl, solaris ships with perl + if command -v perl > /dev/null; then + perl -e '((time - (stat("'"${1}"'"))[9]) / 60) > '"${2}"' && exit(0) || exit(1)' + return "${?}" + else + echo >&2 + echo "WARNING: neither a find that supports -mmin (such as GNU find) or perl is available, disabling remote status checking. Install GNU find as gfind or perl to enable this feature, or set GIT_PROMPT_FETCH_REMOTE_STATUS=0 to disable this warning." >&2 + echo >&2 + GIT_PROMPT_FETCH_REMOTE_STATUS=0 + return 1 + fi +} + +function checkUpstream() { + local GIT_PROMPT_FETCH_TIMEOUT + git_prompt_config + + local FETCH_HEAD="${repo}/.git/FETCH_HEAD" + # Fech repo if local is stale for more than $GIT_FETCH_TIMEOUT minutes + if [[ ! -e "${FETCH_HEAD}" ]] || olderThanMinutes "${FETCH_HEAD}" "${GIT_PROMPT_FETCH_TIMEOUT}" + then + if [[ -n $(git remote show) ]]; then + ( + async_run "GIT_TERMINAL_PROMPT=0 git fetch --quiet" + disown -h + ) + fi + fi +} + +function replaceSymbols() { + # Disable globbing, so a * could be used as symbol here + set -f + + if [[ -z ${GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING+x} ]]; then + GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING=L + fi + + local VALUE="${1//_AHEAD_/${GIT_PROMPT_SYMBOLS_AHEAD}}" + local VALUE1="${VALUE//_BEHIND_/${GIT_PROMPT_SYMBOLS_BEHIND}}" + local VALUE2="${VALUE1//_NO_REMOTE_TRACKING_/${GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING}}" + + echo "${VALUE2//_PREHASH_/${GIT_PROMPT_SYMBOLS_PREHASH}}" + + # reenable globbing symbols + set +f +} + +function createPrivateIndex { + # Create a copy of the index to avoid conflicts with parallel git commands, e.g. git rebase. + local __GIT_INDEX_FILE + local __GIT_INDEX_PRIVATE + if [[ -z "${GIT_INDEX_FILE+x}" ]]; then + __GIT_INDEX_FILE="$(git rev-parse --git-dir)/index" + else + __GIT_INDEX_FILE="${GIT_INDEX_FILE}" + fi + __GIT_INDEX_PRIVATE="/tmp/git-index-private$$" + command cp "${__GIT_INDEX_FILE}" "${__GIT_INDEX_PRIVATE}" 2>/dev/null + echo "${__GIT_INDEX_PRIVATE}" +} + +function updatePrompt() { + local LAST_COMMAND_INDICATOR + local PROMPT_LEADING_SPACE + local PROMPT_START + local PROMPT_END + local EMPTY_PROMPT + local Blue="\[\033[0;34m\]" + + git_prompt_config + + __GIT_PROMPT_IGNORE_STASH="${GIT_PROMPT_IGNORE_STASH:-0}" + __GIT_PROMPT_SHOW_UPSTREAM="${GIT_PROMPT_SHOW_UPSTREAM:-0}" + __GIT_PROMPT_IGNORE_SUBMODULES="${GIT_PROMPT_IGNORE_SUBMODULES:-0}" + __GIT_PROMPT_WITH_USERNAME_AND_REPO="${GIT_PROMPT_WITH_USERNAME_AND_REPO:-0}" + export __GIT_PROMPT_SHOW_UNTRACKED_FILES="${GIT_PROMPT_SHOW_UNTRACKED_FILES-normal}" + local __GIT_PROMPT_SHOW_CHANGED_FILES_COUNT="${GIT_PROMPT_SHOW_CHANGED_FILES_COUNT:-1}" + + local GIT_INDEX_PRIVATE="$(createPrivateIndex)" + #important to define GIT_INDEX_FILE as local: This way it only affects this function (and below) - even with the export afterwards + local GIT_INDEX_FILE + export GIT_INDEX_FILE="${GIT_INDEX_PRIVATE}" + + local -a git_status_fields + while IFS=$'\n' read -r line; do git_status_fields+=("${line}"); done < <("${__GIT_STATUS_CMD}" 2>/dev/null) + + export GIT_BRANCH=$(replaceSymbols "${git_status_fields[0]}") + local GIT_REMOTE="$(replaceSymbols "${git_status_fields[1]}")" + if [[ "." == "${GIT_REMOTE}" ]]; then + unset GIT_REMOTE + fi + local GIT_REMOTE_USERNAME_REPO="$(replaceSymbols "${git_status_fields[2]}")" + if [[ "." == "${GIT_REMOTE_USERNAME_REPO}" ]]; then + unset GIT_REMOTE_USERNAME_REPO + fi + + local GIT_FORMATTED_UPSTREAM + local GIT_UPSTREAM_PRIVATE="${git_status_fields[3]}" + if [[ "${__GIT_PROMPT_SHOW_UPSTREAM:-0}" != "1" || "^" == "${GIT_UPSTREAM_PRIVATE}" ]]; then + unset GIT_FORMATTED_UPSTREAM + else + GIT_FORMATTED_UPSTREAM="${GIT_PROMPT_UPSTREAM//_UPSTREAM_/${GIT_UPSTREAM_PRIVATE}}" + fi + + local GIT_STAGED="${git_status_fields[4]}" + local GIT_CONFLICTS="${git_status_fields[5]}" + local GIT_CHANGED="${git_status_fields[6]}" + local GIT_UNTRACKED="${git_status_fields[7]}" + local GIT_STASHED="${git_status_fields[8]}" + local GIT_CLEAN="${git_status_fields[9]}" + + + local NEW_PROMPT="${EMPTY_PROMPT}" + if [[ "${#git_status_fields[@]}" -gt 0 ]]; then + + if [[ -z "${GIT_REMOTE_USERNAME_REPO+x}" ]]; then + local GIT_PROMPT_PREFIX_FINAL="${GIT_PROMPT_PREFIX//_USERNAME_REPO_/${ResetColor}}" + else + if [[ -z "${GIT_PROMPT_USERNAME_REPO_SEPARATOR+x}" ]]; then + local GIT_PROMPT_PREFIX_FINAL="${GIT_PROMPT_PREFIX//_USERNAME_REPO_/${GIT_REMOTE_USERNAME_REPO}${ResetColor}}" + else + local GIT_PROMPT_PREFIX_FINAL="${GIT_PROMPT_PREFIX//_USERNAME_REPO_/${GIT_REMOTE_USERNAME_REPO}${ResetColor}${GIT_PROMPT_USERNAME_REPO_SEPARATOR}}" + fi + fi + + case "${GIT_BRANCH-}" in + ${GIT_PROMPT_MASTER_BRANCHES}) + local STATUS_PREFIX="${PROMPT_LEADING_SPACE}${GIT_PROMPT_PREFIX_FINAL}${GIT_PROMPT_MASTER_BRANCH}${URL_SHORT-}\${GIT_BRANCH}${ResetColor}${GIT_FORMATTED_UPSTREAM-}" + ;; + *) + local STATUS_PREFIX="${PROMPT_LEADING_SPACE}${GIT_PROMPT_PREFIX_FINAL}${GIT_PROMPT_BRANCH}${URL_SHORT-}\${GIT_BRANCH}${ResetColor}${GIT_FORMATTED_UPSTREAM-}" + ;; + esac + local STATUS="" + + # __add_status KIND VALEXPR INSERT + # eg: __add_status 'STAGED' '-ne 0' + + __chk_gitvar_status() { + local v + if [[ "${2-}" = "-n" ]] ; then + v="${2} \"\${GIT_${1}-}\"" + else + v="\${GIT_${1}-} ${2}" + fi + if eval "[[ ${v} ]]" ; then + if [[ "${3-}" != '-' ]] && [[ "${__GIT_PROMPT_SHOW_CHANGED_FILES_COUNT}" == "1" || "${1-}" == "REMOTE" ]]; then + __add_status "\${GIT_PROMPT_${1}}\${GIT_${1}}\${ResetColor}" + else + __add_status "\${GIT_PROMPT_${1}}\${ResetColor}" + fi + fi + } + + __add_gitvar_status() { + __add_status "\${GIT_PROMPT_${1}}\${GIT_${1}}\${ResetColor}" + } + + # __add_status SOMETEXT + __add_status() { + eval "STATUS=\"${STATUS}${1}\"" + } + + __chk_gitvar_status 'REMOTE' '-n' + if [[ "${GIT_CLEAN}" -eq 0 ]] || [[ "${GIT_PROMPT_CLEAN}" != "" ]]; then + __add_status "${GIT_PROMPT_SEPARATOR}" + __chk_gitvar_status 'STAGED' '!= "0" && ${GIT_STAGED-} != "^"' + __chk_gitvar_status 'CONFLICTS' '!= "0"' + __chk_gitvar_status 'CHANGED' '!= "0"' + __chk_gitvar_status 'UNTRACKED' '!= "0"' + __chk_gitvar_status 'STASHED' '!= "0"' + __chk_gitvar_status 'CLEAN' '= "1"' - + fi + __add_status "${ResetColor}${GIT_PROMPT_SUFFIX}" + + NEW_PROMPT="$(gp_add_virtualenv_to_prompt)${PROMPT_START}$(${prompt_callback})${STATUS_PREFIX}${STATUS}${PROMPT_END}" + else + NEW_PROMPT="${EMPTY_PROMPT}" + fi + + PS1="${NEW_PROMPT//_LAST_COMMAND_INDICATOR_/${LAST_COMMAND_INDICATOR}${ResetColor}}" + command rm "${GIT_INDEX_PRIVATE}" 2>/dev/null +} + +# Helper function that returns virtual env information to be set in prompt +# Honors virtualenvs own setting VIRTUAL_ENV_DISABLE_PROMPT +function gp_add_virtualenv_to_prompt { + local ACCUMULATED_VENV_PROMPT="" + local VENV="" + if [[ -n "${VIRTUAL_ENV-}" && -z "${VIRTUAL_ENV_DISABLE_PROMPT+x}" ]]; then + VENV=$(basename "${VIRTUAL_ENV}") + ACCUMULATED_VENV_PROMPT="${ACCUMULATED_VENV_PROMPT}${GIT_PROMPT_VIRTUALENV//_VIRTUALENV_/${VENV}}" + fi + if [[ -n "${NODE_VIRTUAL_ENV-}" && -z "${NODE_VIRTUAL_ENV_DISABLE_PROMPT+x}" ]]; then + VENV=$(basename "${NODE_VIRTUAL_ENV}") + ACCUMULATED_VENV_PROMPT="${ACCUMULATED_VENV_PROMPT}${GIT_PROMPT_VIRTUALENV//_VIRTUALENV_/${VENV}}" + fi + if [[ -n "${CONDA_DEFAULT_ENV-}" ]]; then + VENV=$(basename "${CONDA_DEFAULT_ENV}") + ACCUMULATED_VENV_PROMPT="${ACCUMULATED_VENV_PROMPT}${GIT_PROMPT_VIRTUALENV//_VIRTUALENV_/${VENV}}" + fi + echo "${ACCUMULATED_VENV_PROMPT}" +} + +# Use exit status from declare command to determine whether input argument is a +# bash function +function is_function { + declare -Ff "${1}" >/dev/null; +} + +# Helper function that truncates $PWD depending on window width +# Optionally specify maximum length as parameter (defaults to 1/3 of terminal) +function gp_truncate_pwd { + local tilde="~" + local newPWD="${PWD/#${HOME}/${tilde}}" + local pwdmaxlen="${1:-$((${COLUMNS:-80}/3))}" + [[ "${#newPWD}" -gt "${pwdmaxlen}" ]] && newPWD="...${newPWD:3-$pwdmaxlen}" + echo -n "${newPWD}" +} + +# Sets the window title to the given argument string +function gp_set_window_title { + echo -ne "\[\033]0;"${@}"\007\]" +} + +function prompt_callback_default { + return +} + +# toggle gitprompt +function git_prompt_toggle() { + if [[ "${GIT_PROMPT_DISABLE:-0}" = 1 ]]; then + GIT_PROMPT_DISABLE=0 + else + GIT_PROMPT_DISABLE=1 + fi + return +} + +function gp_install_prompt { + if [[ -z "${OLD_GITPROMPT+x}" ]]; then + OLD_GITPROMPT=${PS1} + fi + + if [[ -z "${GIT_PROMPT_OLD_DIR_WAS_GIT+x}" ]]; then + GIT_PROMPT_OLD_DIR_WAS_GIT=$(we_are_on_repo) + fi + + if [[ -z "${PROMPT_COMMAND:+x}" ]]; then + PROMPT_COMMAND=setGitPrompt + else + PROMPT_COMMAND="${PROMPT_COMMAND//$'\n'/;}" # convert all new lines to semi-colons + PROMPT_COMMAND="${PROMPT_COMMAND#\;}" # remove leading semi-colon + PROMPT_COMMAND="${PROMPT_COMMAND%% }" # remove trailing spaces + PROMPT_COMMAND="${PROMPT_COMMAND%\;}" # remove trailing semi-colon + + local new_entry="setGitPrompt" + case ";${PROMPT_COMMAND};" in + *";${new_entry};"*) + # echo "PROMPT_COMMAND already contains: $new_entry" + :;; + *) + PROMPT_COMMAND="${PROMPT_COMMAND};${new_entry}" + # echo "PROMPT_COMMAND does not contain: $new_entry" + ;; + esac + fi + + local setLastCommandStateEntry="setLastCommandState" + case ";${PROMPT_COMMAND};" in + *";${setLastCommandStateEntry};"*) + # echo "PROMPT_COMMAND already contains: $setLastCommandStateEntry" + :;; + *) + PROMPT_COMMAND="${setLastCommandStateEntry};${PROMPT_COMMAND}" + # echo "PROMPT_COMMAND does not contain: $setLastCommandStateEntry" + ;; + esac + + git_prompt_dir + source "${__GIT_PROMPT_DIR}/git-prompt-help.sh" +} + +gp_install_prompt diff --git a/dotfiles/.bash-git-prompt/gitstatus.py b/dotfiles/.bash-git-prompt/gitstatus.py new file mode 100755 index 0000000..bf1d1d9 --- /dev/null +++ b/dotfiles/.bash-git-prompt/gitstatus.py @@ -0,0 +1,154 @@ +#!/usr/bin/env python +# -*- coding: UTF-8 -*- + +"""This module defines a Print function to use with python 2.x or 3.x., so we can use the prompt with older versions of +Python too + +It's interface is that of python 3.0's print. See +http://docs.python.org/3.0/library/functions.html?highlight=print#print + +Shamelessly ripped from +http://www.daniweb.com/software-development/python/code/217214/a-print-function-for-different-versions-of-python +""" +# change those symbols to whatever you prefer +symbols = {'ahead of': '↑·', 'behind': '↓·', 'prehash': ':'} + +import sys +import re +from subprocess import Popen, PIPE + +__all__ = ["Print"] + +try: + Print = eval("print") # python 3.0 case + python_version = 3 + to_str = str +except SyntaxError as e: + python_version = 2 + to_str = unicode + D = dict() + try: + exec ("from __future__ import print_function\np=print", D) + Print = D["p"] # 2.6 case + except SyntaxError: + def Print(*args, **kwd): # 2.4, 2.5, define our own Print function + fout = kwd.get("file", sys.stdout) + w = fout.write + if args: + w(str(args[0])) + sep = kwd.get("sep", " ") + for a in args[1:]: + w(sep) + w(str(a)) + w(kwd.get("end", "\n")) + finally: + del D + + +def get_tag_or_hash(): + cmd = Popen(['git', 'describe', '--exact-match'], stdout=PIPE, stderr=PIPE) + so, se = cmd.communicate() + tag = '%s' % so.decode('utf-8').strip() + + if tag: + return tag + else: + cmd = Popen(['git', 'rev-parse', '--short', 'HEAD'], stdout=PIPE, stderr=PIPE) + so, se = cmd.communicate() + hash_name = '%s' % so.decode('utf-8').strip() + return ''.join([symbols['prehash'], hash_name]) + + +def get_stash(): + cmd = Popen(['git', 'rev-parse', '--git-dir'], stdout=PIPE, stderr=PIPE) + so, se = cmd.communicate() + stash_file = '%s%s' % (so.decode('utf-8').rstrip(), '/logs/refs/stash') + + try: + with open(stash_file) as f: + return sum(1 for _ in f) + except IOError: + return 0 + + +# `git status --porcelain --branch` can collect all information +# branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind +po = Popen(['git', 'status', '--porcelain', '--branch'], env={'LC_ALL': 'C'}, stdout=PIPE, stderr=PIPE) +stdout, stderr = po.communicate() +if po.returncode != 0: + sys.exit(0) # Not a git repository + +# collect git status information +untracked, staged, changed, conflicts = [], [], [], [] +num_ahead, num_behind = 0, 0 +ahead, behind = '', '' +branch = '' +remote = '' +status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()] +for st in status: + if st[0] == '#' and st[1] == '#': + if re.search('Initial commit on', st[2]): + branch = st[2].split(' ')[-1] + elif re.search('No commits yet on', st[2]): + branch = st[2].split(' ')[-1] + elif re.search('no branch', st[2]): # detached status + branch = get_tag_or_hash() + elif len(st[2].strip().split('...')) == 1: + branch = st[2].strip() + else: + # current and remote branch info + branch, rest = st[2].strip().split('...') + if len(rest.split(' ')) == 1: + # remote_branch = rest.split(' ')[0] + pass + else: + # ahead or behind + divergence = ' '.join(rest.split(' ')[1:]) + divergence = divergence.lstrip('[').rstrip(']') + for div in divergence.split(', '): + if 'ahead' in div: + num_ahead = int(div[len('ahead '):].strip()) + ahead = '%s%s' % (symbols['ahead of'], num_ahead) + elif 'behind' in div: + num_behind = int(div[len('behind '):].strip()) + behind = '%s%s' % (symbols['behind'], num_behind) + remote = ''.join([behind, ahead]) + elif st[0] == '?' and st[1] == '?': + untracked.append(st) + else: + if st[1] == 'M': + changed.append(st) + if st[0] == 'U': + conflicts.append(st) + elif st[0] != ' ': + staged.append(st) + +stashed = get_stash() +if not changed and not staged and not conflicts and not untracked and not stashed: + clean = 1 +else: + clean = 0 + +if remote == "": + remote = '.' + +if python_version == 2: + remote = remote.decode('utf-8') + +out = '\n'.join([ + branch, + remote, + to_str(len(staged)), + to_str(len(conflicts)), + to_str(len(changed)), + to_str(len(untracked)), + to_str(stashed), + to_str(clean), + to_str(python_version), +]) + + +if python_version == 2: + Print(out.encode('utf-8')) +else: + Print(out) diff --git a/dotfiles/.bash-git-prompt/gitstatus.sh b/dotfiles/.bash-git-prompt/gitstatus.sh new file mode 100755 index 0000000..7cbda63 --- /dev/null +++ b/dotfiles/.bash-git-prompt/gitstatus.sh @@ -0,0 +1,199 @@ +#!/usr/bin/env bash +# -*- coding: utf-8 -*- +# gitstatus.sh -- produce the current git repo status on STDOUT +# Functionally equivalent to 'gitstatus.py', but written in bash (not python). +# +# Alan K. Stebbens [http://github.com/aks] + +set -u + +if [[ -z "${__GIT_PROMPT_DIR:+x}" ]]; then + SOURCE="${BASH_SOURCE[0]}" + while [[ -h "${SOURCE}" ]]; do + DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )" + SOURCE="$(readlink "${SOURCE}")" + [[ "${SOURCE}" != /* ]] && SOURCE="${DIR}/${SOURCE}" + done + __GIT_PROMPT_DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )" +fi + +if [[ "${__GIT_PROMPT_IGNORE_SUBMODULES:-0}" == "1" ]]; then + _ignore_submodules="--ignore-submodules" +else + _ignore_submodules="" +fi + +if [[ "${__GIT_PROMPT_WITH_USERNAME_AND_REPO:-0}" == "1" ]]; then + # returns "user/repo" from remote.origin.url git variable + # + # supports urls: + # https://user@bitbucket.org/user/repo.git + # https://github.com/user/repo.git + # git@github.com:user/repo.git + # + remote_url=$(git config --get remote.origin.url | sed 's|^.*//||; s/.*@//; s/[^:/]\+[:/]//; s/.git$//') +else + remote_url='.' +fi + +gitstatus=$( LC_ALL=C git status ${_ignore_submodules} --untracked-files="${__GIT_PROMPT_SHOW_UNTRACKED_FILES:-normal}" --porcelain --branch ) + +# if the status is fatal, exit now +[[ ! "${?}" ]] && exit 0 + +git_dir="$(git rev-parse --git-dir 2>/dev/null)" +[[ -z "${git_dir:+x}" ]] && exit 0 + +__git_prompt_read () +{ + local f="${1}" + shift + [[ -r "${f}" ]] && read -r "${@}" <"${f}" +} + +state="" +step="" +total="" +if [[ -d "${git_dir}/rebase-merge" ]]; then + __git_prompt_read "${git_dir}/rebase-merge/msgnum" step + __git_prompt_read "${git_dir}/rebase-merge/end" total + if [[ -f "${git_dir}/rebase-merge/interactive" ]]; then + state="|REBASE-i" + else + state="|REBASE-m" + fi +else + if [[ -d "${git_dir}/rebase-apply" ]]; then + __git_prompt_read "${git_dir}/rebase-apply/next" step + __git_prompt_read "${git_dir}/rebase-apply/last" total + if [[ -f "${git_dir}/rebase-apply/rebasing" ]]; then + state="|REBASE" + elif [[ -f "${git_dir}/rebase-apply/applying" ]]; then + state="|AM" + else + state="|AM/REBASE" + fi + elif [[ -f "${git_dir}/MERGE_HEAD" ]]; then + state="|MERGING" + elif [[ -f "${git_dir}/CHERRY_PICK_HEAD" ]]; then + state="|CHERRY-PICKING" + elif [[ -f "${git_dir}/REVERT_HEAD" ]]; then + state="|REVERTING" + elif [[ -f "${git_dir}/BISECT_LOG" ]]; then + state="|BISECTING" + fi +fi + +if [[ -n "${step}" ]] && [[ -n "${total}" ]]; then + state="${state} ${step}/${total}" +fi + +num_staged=0 +num_changed=0 +num_conflicts=0 +num_untracked=0 +while IFS='' read -r line || [[ -n "${line}" ]]; do + status="${line:0:2}" + while [[ -n ${status} ]]; do + case "${status}" in + #two fixed character matches, loop finished + \#\#) branch_line="${line/\.\.\./^}"; break ;; + \?\?) ((num_untracked++)); break ;; + U?) ((num_conflicts++)); break;; + ?U) ((num_conflicts++)); break;; + DD) ((num_conflicts++)); break;; + AA) ((num_conflicts++)); break;; + #two character matches, first loop + ?M) ((num_changed++)) ;; + ?D) ((num_changed++)) ;; + ?\ ) ;; + #single character matches, second loop + U) ((num_conflicts++)) ;; + \ ) ;; + *) ((num_staged++)) ;; + esac + status="${status:0:(${#status}-1)}" + done +done <<< "${gitstatus}" + +num_stashed=0 +if [[ "${__GIT_PROMPT_IGNORE_STASH:-0}" != "1" ]]; then + stash_file="${git_dir}/logs/refs/stash" + if [[ -e "${stash_file}" ]]; then + while IFS='' read -r wcline || [[ -n "${wcline}" ]]; do + ((num_stashed++)) + done < "${stash_file}" + fi +fi + +clean=0 +if (( num_changed == 0 && num_staged == 0 && num_untracked == 0 && num_stashed == 0 && num_conflicts == 0)) ; then + clean=1 +fi + +IFS="^" read -ra branch_fields <<< "${branch_line/\#\# }" +branch="${branch_fields[0]}" +remote="" +upstream="" + +if [[ "${branch}" == *"Initial commit on"* ]]; then + IFS=" " read -ra fields <<< "${branch}" + branch="${fields[3]}" + remote="_NO_REMOTE_TRACKING_" + remote_url='.' +elif [[ "${branch}" == *"No commits yet on"* ]]; then + IFS=" " read -ra fields <<< "${branch}" + branch="${fields[4]}" + remote="_NO_REMOTE_TRACKING_" + remote_url='.' +elif [[ "${branch}" == *"no branch"* ]]; then + tag=$( git describe --tags --exact-match ) + if [[ -n "${tag}" ]]; then + branch="${tag}" + else + branch="_PREHASH_$( git rev-parse --short HEAD )" + fi +else + if [[ "${#branch_fields[@]}" -eq 1 ]]; then + remote="_NO_REMOTE_TRACKING_" + remote_url='.' + else + IFS="[,]" read -ra remote_fields <<< "${branch_fields[1]}" + upstream="${remote_fields[0]}" + for remote_field in "${remote_fields[@]}"; do + if [[ "${remote_field}" == "ahead "* ]]; then + num_ahead="${remote_field:6}" + ahead="_AHEAD_${num_ahead}" + fi + if [[ "${remote_field}" == "behind "* ]] || [[ "${remote_field}" == " behind "* ]]; then + num_behind="${remote_field:7}" + behind="_BEHIND_${num_behind# }" + fi + done + remote="${behind-}${ahead-}" + fi +fi + +if [[ -z "${remote:+x}" ]] ; then + remote='.' +fi + +if [[ -z "${upstream:+x}" ]] ; then + upstream='^' +fi + +UPSTREAM_TRIMMED=`echo $upstream |xargs` + +printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \ + "${branch}${state}" \ + "${remote}" \ + "${remote_url}" \ + "${UPSTREAM_TRIMMED}" \ + "${num_staged}" \ + "${num_conflicts}" \ + "${num_changed}" \ + "${num_untracked}" \ + "${num_stashed}" \ + "${clean}" + +exit diff --git a/dotfiles/.bash-git-prompt/gitstatus_pre-1.7.10.sh b/dotfiles/.bash-git-prompt/gitstatus_pre-1.7.10.sh new file mode 100755 index 0000000..7ae7238 --- /dev/null +++ b/dotfiles/.bash-git-prompt/gitstatus_pre-1.7.10.sh @@ -0,0 +1,140 @@ +#!/usr/bin/env bash +# -*- coding: UTF-8 -*- +# gitstatus.sh -- produce the current git repo status on STDOUT +# Functionally equivalent to 'gitstatus.py', but written in bash (not python). +# +# Alan K. Stebbens [http://github.com/aks] + +# helper functions +count_lines() { echo "${1}" | egrep -c "^${2}" ; } +all_lines() { echo "${1}" | grep -v "^$" | wc -l ; } + +if [[ -z "${__GIT_PROMPT_DIR-}" ]]; then + SOURCE="${BASH_SOURCE[0]}" + while [[ -h "${SOURCE}" ]]; do + DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )" + SOURCE="$(readlink "${SOURCE}")" + [[ "${SOURCE}" != /* ]] && SOURCE="${DIR}/${SOURCE}" + done + __GIT_PROMPT_DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )" +fi + +if [[ "${__GIT_PROMPT_WITH_USERNAME_AND_REPO}" == "1" ]]; then + # returns "user/repo" from remote.origin.url git variable + # + # supports urls: + # https://user@bitbucket.org/user/repo.git + # https://github.com/user/repo.git + # git@github.com:user/repo.git + # + remote_url=$(git config --get remote.origin.url | sed 's|^.*//||; s/.*@//; s/[^:/]\+[:/]//; s/.git$//') +else + remote_url='.' +fi + +gitsym=$( git symbolic-ref HEAD 2>/dev/null ) + +#If exit status OK, we have a branch +if [[ "${?}" == 0 ]]; then + # the current branch is the tail end of the symbolic reference + branch="${gitsym##refs/heads/}" # get the basename after "refs/heads/" +fi + +gitstatus=$( git diff --name-status 2>&1 ) + +# if the diff is fatal, exit now +if [[ "${?}" != 0 ]]; then exit 0; fi + +staged_files=$( git diff --staged --name-status ) + +num_changed=$(( $( all_lines "${gitstatus}" ) - $( count_lines "${gitstatus}" U ) )) +num_conflicts=$( count_lines "${staged_files}" U ) +num_staged=$(( $( all_lines "${staged_files}" ) - num_conflicts )) +num_untracked=$( git ls-files --others --exclude-standard $(git rev-parse --show-cdup) | wc -l ) + +num_stashed=0 +if [[ "${__GIT_PROMPT_IGNORE_STASH}" != "1" ]]; then + stash_file="$( git rev-parse --git-dir )/logs/refs/stash" + if [[ -e "${stash_file}" ]]; then + while IFS='' read -r wcline || [[ -n "${wcline}" ]]; do + ((num_stashed++)) + done < "${stash_file}" + fi +fi + +clean=0 +if (( num_changed == 0 && num_staged == 0 && num_untracked == 0 && num_stashed == 0 && num_conflicts == 0 )) ; then + clean=1 +fi + +remote="" +upstream="" + +if [[ -z "${branch-}" ]]; then + tag=$( git describe --tags --exact-match 2>/dev/null ) + if [[ -n "${tag}" ]]; then + branch="${tag}" + else + branch="_PREHASH_$( git rev-parse --short HEAD )" + fi +else + remote_name=$( git config "branch.${branch}.remote" ) + + if [[ -n "$remote_name" ]]; then + merge_name=$( git config "branch.${branch}.merge" ) + else + remote_name='origin' + merge_name="refs/heads/${branch}" + fi + + if [[ "${remote_name}" == '.' ]]; then + remote_ref="${merge_name}" + else + remote_ref="refs/remotes/${remote_name}/${merge_name##refs/heads/}" + fi + + # detect if the local branch have a remote tracking branch + upstream=$( git rev-parse --abbrev-ref "${branch}"@{upstream} 2>&1 ) + + if [[ "${?}" == 0 ]]; then + # get the revision list, and count the leading "<" and ">" + revgit=$( git rev-list --left-right "${remote_ref}...HEAD" 2>/dev/null ) + if [[ "${?}" == 0 ]]; then + num_revs=$( all_lines "${revgit}" ) + num_ahead=$( count_lines "${revgit}" "^>" ) + num_behind=$(( num_revs - num_ahead )) + if (( num_behind > 0 )) ; then + remote="${remote}_BEHIND_${num_behind}" + fi + if (( num_ahead > 0 )) ; then + remote="${remote}_AHEAD_${num_ahead}" + fi + fi + else + remote='_NO_REMOTE_TRACKING_' + remote_url='.' + unset upstream + fi +fi + +if [[ -z "${remote:+x}" ]] ; then + remote='.' +fi + +if [[ -z "${upstream:+x}" ]] ; then + upstream='^' +fi + +printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \ + "${branch}" \ + "${remote}" \ + "${remote_url}" \ + "${upstream}" \ + "${num_staged}" \ + "${num_conflicts}" \ + "${num_changed}" \ + "${num_untracked// /}" \ + "${num_stashed}" \ + "${clean}" + +exit diff --git a/dotfiles/.bash-git-prompt/prompt-colors.sh b/dotfiles/.bash-git-prompt/prompt-colors.sh new file mode 100644 index 0000000..c8794a6 --- /dev/null +++ b/dotfiles/.bash-git-prompt/prompt-colors.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash +# prompt-colors.sh +# +# source this file to get color definitions +# are also printed to STDERR. + +define_color_names() { + + ColorNames=( Black Red Green Yellow Blue Magenta Cyan White ) + FgColors=( 30 31 32 33 34 35 36 37 ) + BgColors=( 40 41 42 43 44 45 46 47 ) + + local AttrNorm=0 + local AttrBright=1 + local AttrDim=2 + local AttrUnder=4 + local AttrBlink=5 + local AttrRev=7 + local AttrHide=8 + + # define "BoldCOLOR", "BrightCOLOR", and "DimCOLOR" names + + # _map_colors ATTRNAME ATTRVALUE + # + # Defines three names for every color, attribute combintaion: + # {ATTRNAME}{COLORNAME} + # {ATTRNAME}{COLORNAME}Fg + # {ATTRNAME}{COLORNAME}Bg + # + # Example: BoldRed, BoldRedFg, BoldRedBg + + _map_colors() { + local x=0 + local attrname="${1}" + local attrcode="${2}" + while (( x < 8 )) ; do + local colorname="${ColorNames[x]}" + local fgcolorcode="${FgColors[x]}" + local bgcolorcode="${BgColors[x]}" + longcolorname="${attrname}${colorname}" + _def_color "${longcolorname}" "${attrcode}" "${fgcolorcode}" + _def_color "${longcolorname}Fg" "${attrcode}" "${fgcolorcode}" + _def_color "${longcolorname}Bg" "${attrcode}" "${bgcolorcode}" + (( x++ )) + done + } + + # _term_color [ N | N M ] + _term_color() { + local cv + if [[ "${#}" -gt 1 ]]; then + cv="${1};${2}" + else + cv="${1}" + fi + echo "\[\033[${cv}m\]" + } + + # def_color NAME ATTRCODE COLORCODE + _def_color() { + local def="${1}=\"\`_term_color ${2} ${3}\`\"" + eval "${def}" + } + + _map_colors Bold ${AttrBright} + _map_colors Bright ${AttrBright} + _map_colors Dim ${AttrDim} + _map_colors '' ${AttrNorm} + + _def_color IntenseBlack 0 90 + _def_color ResetColor 0 0 + +} + +# do the color definitions only once +if [[ -z "${ColorNames+x}" || "${#ColorNames[*]}" = 0 || -z "${IntenseBlack:+x}" || -z "${ResetColor:+x}" ]]; then + define_color_names +fi diff --git a/dotfiles/.bash-git-prompt/themes/Chmike.bgptheme b/dotfiles/.bash-git-prompt/themes/Chmike.bgptheme new file mode 100644 index 0000000..f6c8852 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Chmike.bgptheme @@ -0,0 +1,32 @@ +# This theme for gitprompt.sh is designed for dark color schemes +# it is clone of oh-my-zsh crunch theme style with exit status + +override_git_prompt_colors() { + if [ -e ~/.rvm/bin/rvm-prompt ]; then + RUBY_PROMPT='{$(~/.rvm/bin/rvm-prompt i v)}' + else + if command -v rbenv > /dev/null; then + RUBY_PROMPT='{$(rbenv version | sed -e "s/ (set.*$//")}' + fi + fi + Time12a="\$(date +%H:%M)" + + + GIT_PROMPT_THEME_NAME="Chmike" + GIT_PROMPT_BRANCH="${Green}" + GIT_PROMPT_MASTER_BRANCH="${GIT_PROMPT_BRANCH}" + GIT_PROMPT_REMOTE=" " + GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="⭐" + + GIT_PROMPT_SEPARATOR="|" + GIT_PROMPT_CHANGED="${Cyan}❗" + GIT_PROMPT_STAGED="${Yellow}▸" + GIT_PROMPT_UNTRACKED="${Blue}…" + GIT_PROMPT_CONFLICTS="${BoldRed}❓" + GIT_PROMPT_STASHED="${Magenta}>" + GIT_PROMPT_CLEAN="${Green}✔ " + GIT_PROMPT_COMMAND_OK="${Green}✔" + GIT_PROMPT_COMMAND_FAIL="${Red}✘" +} + +reload_git_prompt_colors "Chmike" diff --git a/dotfiles/.bash-git-prompt/themes/Crunch.bgptheme b/dotfiles/.bash-git-prompt/themes/Crunch.bgptheme new file mode 100644 index 0000000..8dd182f --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Crunch.bgptheme @@ -0,0 +1,34 @@ +# This theme for gitprompt.sh is designed for dark color schemes +# it is clone of oh-my-zsh crunch theme style with exit status + +override_git_prompt_colors() { + if [ -e ~/.rvm/bin/rvm-prompt ]; then + RUBY_PROMPT='{$(~/.rvm/bin/rvm-prompt i v)}' + else + if command -v rbenv > /dev/null; then + RUBY_PROMPT='{$(rbenv version | sed -e "s/ (set.*$//")}' + fi + fi + Time12a="\$(date +%H:%M)" + + GIT_PROMPT_THEME_NAME="Crunch" + GIT_PROMPT_STAGED="${Yellow}● " + GIT_PROMPT_UNTRACKED="${Cyan}… " + GIT_PROMPT_STASHED="${BoldMagenta}⚑ " + GIT_PROMPT_CLEAN="${Green}✔ " + GIT_PROMPT_COMMAND_OK="${Green}✔ " + GIT_PROMPT_COMMAND_FAIL="${Red}✘ " + + KERNEL_PROMPT='‹$(uname -r)›' + + GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_${White}{${Yellow}${Time12a}${White}}[${Magenta}${RUBY_PROMPT}${White}]${Cyan}${PathShort}${White}:" + GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}" + GIT_PROMPT_END_USER="${BoldBlue} ➭ ${ResetColor}" + GIT_PROMPT_END_ROOT="${BoldRed} # ${ResetColor}" + GIT_PROMPT_LEADING_SPACE=0 + GIT_PROMPT_PREFIX="${Green}[" + GIT_PROMPT_SUFFIX="${Green}]" + GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="✭" +} + +reload_git_prompt_colors "Crunch" diff --git a/dotfiles/.bash-git-prompt/themes/Custom.bgptemplate b/dotfiles/.bash-git-prompt/themes/Custom.bgptemplate new file mode 100644 index 0000000..ac17c67 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Custom.bgptemplate @@ -0,0 +1,65 @@ +# This is the custom theme template for gitprompt.sh + +# These are the defaults from the "Default" theme +# You just need to override what you want to have changed +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Custom" + + # Time12a="\$(date +%H:%M)" + # PathShort="\w"; + + ## These are the color definitions used by gitprompt.sh + # GIT_PROMPT_PREFIX="[" # start of the git info string + # GIT_PROMPT_SUFFIX="]" # the end of the git info string + # GIT_PROMPT_SEPARATOR="|" # separates each item + + # GIT_PROMPT_BRANCH="${Magenta}" # the git branch that is active in the current directory + # GIT_PROMPT_MASTER_BRANCH="${GIT_PROMPT_BRANCH}" # used if the git branch that is active in the current directory is $GIT_PROMPT_MASTER_BRANCHES + # GIT_PROMPT_STAGED="${Red}●" # the number of staged files/directories + # GIT_PROMPT_CONFLICTS="${Red}✖ " # the number of files in conflict + # GIT_PROMPT_CHANGED="${Blue}✚ " # the number of changed files + + # GIT_PROMPT_REMOTE=" " # the remote branch name (if any) and the symbols for ahead and behind + # GIT_PROMPT_UNTRACKED="${Cyan}…" # the number of untracked files/dirs + # GIT_PROMPT_STASHED="${BoldBlue}⚑ " # the number of stashed files/dir + # GIT_PROMPT_CLEAN="${BoldGreen}✔" # a colored flag indicating a "clean" repo + + ## For the command indicator, the placeholder _LAST_COMMAND_STATE_ + ## will be replaced with the exit code of the last command + ## e.g. + ## GIT_PROMPT_COMMAND_OK="${Green}✔-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of 0 + ## GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of other than 0 + + # GIT_PROMPT_COMMAND_OK="${Green}✔" # indicator if the last command returned with an exit code of 0 + # GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_" # indicator if the last command returned with an exit code of other than 0 + + ## template for displaying the current virtual environment + ## use the placeholder _VIRTUALENV_ will be replaced with + ## the name of the current virtual environment (currently CONDA and VIRTUAL_ENV) + # GIT_PROMPT_VIRTUALENV="(${Blue}_VIRTUALENV_${ResetColor}) " + + # template for displaying the current remote tracking branch + # use the placeholder _UPSTREAM_ will be replaced with + # the name of the current remote tracking branch + # GIT_PROMPT_UPSTREAM=" {${Blue}_UPSTREAM_${ResetColor}}" + + ## _LAST_COMMAND_INDICATOR_ will be replaced by the appropriate GIT_PROMPT_COMMAND_OK OR GIT_PROMPT_COMMAND_FAIL + # GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${Yellow}${PathShort}${ResetColor}" + # GIT_PROMPT_START_ROOT="_LAST_COMMAND_INDICATOR_ ${GIT_PROMPT_START_USER}" + # GIT_PROMPT_END_USER=" \n${White}${Time12a}${ResetColor} $ " + # GIT_PROMPT_END_ROOT=" \n${White}${Time12a}${ResetColor} # " + + ## Please do not add colors to these symbols + # GIT_PROMPT_SYMBOLS_AHEAD="↑·" # The symbol for "n versions ahead of origin" + # GIT_PROMPT_SYMBOLS_BEHIND="↓·" # The symbol for "n versions behind of origin" + # GIT_PROMPT_SYMBOLS_PREHASH=":" # Written before hash of commit, if no name could be found + # GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="L" # This symbol is written after the branch, if the branch is not tracked + + # branch name(s) that will use $GIT_PROMPT_MASTER_BRANCH color + # To specify multiple branches, use + # shopt -s extglob + # GIT_PROMPT_MASTER_BRANCHES='@(master|production)' + # GIT_PROMPT_MASTER_BRANCHES="master" +} + +reload_git_prompt_colors "Custom" diff --git a/dotfiles/.bash-git-prompt/themes/Default.bgptheme b/dotfiles/.bash-git-prompt/themes/Default.bgptheme new file mode 100644 index 0000000..a43a5f1 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Default.bgptheme @@ -0,0 +1,113 @@ +# This is the default theme for gitprompt.sh + +unset_git_prompt_colors() { + unset Time12a + unset PathShort + unset GIT_PROMPT_PREFIX + unset GIT_PROMPT_SUFFIX + unset GIT_PROMPT_SEPARATOR + unset GIT_PROMPT_BRANCH + unset GIT_PROMPT_STAGED + unset GIT_PROMPT_CONFLICTS + unset GIT_PROMPT_CHANGED + unset GIT_PROMPT_REMOTE + unset GIT_PROMPT_UNTRACKED + unset GIT_PROMPT_STASHED + unset GIT_PROMPT_CLEAN + unset GIT_PROMPT_COMMAND_OK + unset GIT_PROMPT_COMMAND_FAIL + unset GIT_PROMPT_VIRTUALENV + unset GIT_PROMPT_UPSTREAM + unset GIT_PROMPT_START_USER + unset GIT_PROMPT_START_ROOT + unset GIT_PROMPT_END_USER + unset GIT_PROMPT_END_ROOT + unset GIT_PROMPT_SYMBOLS_AHEAD + unset GIT_PROMPT_SYMBOLS_BEHIND + unset GIT_PROMPT_SYMBOLS_PREHASH + unset GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING +} + +define_helpers() { + Time12a="\$(date +%H:%M)" + PathShort="\w"; +} + +define_undefined_git_prompt_colors() { + if [ -z ${GIT_PROMPT_THEME_NAME:+x} ]; then GIT_PROMPT_THEME_NAME="Default"; fi + + # These are the color definitions used by gitprompt.sh + if [ -z "${GIT_PROMPT_PREFIX+x}" ]; then GIT_PROMPT_PREFIX="["; fi # start of the git info string + if [ -z "${GIT_PROMPT_SUFFIX+x}" ]; then GIT_PROMPT_SUFFIX="]"; fi # the end of the git info string + if [ -z "${GIT_PROMPT_SEPARATOR+x}" ]; then GIT_PROMPT_SEPARATOR="|"; fi # separates each item + + if [ -z "${GIT_PROMPT_BRANCH+x}" ]; then GIT_PROMPT_BRANCH="${Magenta}"; fi # the git branch that is active in the current directory + if [ -z "${GIT_PROMPT_MASTER_BRANCH+x}" ]; then GIT_PROMPT_MASTER_BRANCH="${GIT_PROMPT_BRANCH}"; fi # used if the git branch that is active in the current directory is $GIT_PROMPT_MASTER_BRANCHES + if [ -z "${GIT_PROMPT_STAGED+x}" ]; then GIT_PROMPT_STAGED="${Red}●"; fi # the number of staged files/directories + if [ -z "${GIT_PROMPT_CONFLICTS+x}" ]; then GIT_PROMPT_CONFLICTS="${Red}✖ "; fi # the number of files in conflict + if [ -z "${GIT_PROMPT_CHANGED+x}" ]; then GIT_PROMPT_CHANGED="${Blue}✚ "; fi # the number of changed files + + if [ -z "${GIT_PROMPT_REMOTE+x}" ]; then GIT_PROMPT_REMOTE=" "; fi # the remote branch name (if any) and the symbols for ahead and behind + if [ -z "${GIT_PROMPT_UNTRACKED+x}" ]; then GIT_PROMPT_UNTRACKED="${Cyan}…"; fi # the number of untracked files/dirs + if [ -z "${GIT_PROMPT_STASHED+x}" ]; then GIT_PROMPT_STASHED="${BoldBlue}⚑ "; fi # the number of stashed files/dir + if [ -z "${GIT_PROMPT_CLEAN+x}" ]; then GIT_PROMPT_CLEAN="${BoldGreen}✔"; fi # a colored flag indicating a "clean" repo + + # For the command indicator, the placeholder _LAST_COMMAND_STATE_ + # will be replaced with the exit code of the last command + # e.g. + # GIT_PROMPT_COMMAND_OK="${Green}✔-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of 0 + # GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of other than 0 + + if [ -z "${GIT_PROMPT_COMMAND_OK+x}" ]; then GIT_PROMPT_COMMAND_OK="${Green}✔"; fi # indicator if the last command returned with an exit code of 0 + if [ -z "${GIT_PROMPT_COMMAND_FAIL+x}" ]; then GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_"; fi # indicator if the last command returned with an exit code of other than 0 + + # Possible to change which command is used to create git status information + # There are three options: + # 1) gitstatus.sh (uses git status --branch --porcelain - fast, requires git > 1.7.10) + # 2) gitstatus_pre-1.7.10.sh (Uses a variety of git commands and pipes - slower, works with older git clients) + # 3) gitstatus.py (Unsupported, lack features found in the bash versions) + if [ -z "${GIT_PROMPT_STATUS_COMMAND+x}" ]; then GIT_PROMPT_STATUS_COMMAND="gitstatus.sh"; fi # Point out the command to get the git status from + + # template for displaying the current virtual environment + # use the placeholder _VIRTUALENV_ will be replaced with + # the name of the current virtual environment (currently CONDA and VIRTUAL_ENV) + if [ -z "${GIT_PROMPT_VIRTUALENV+x}" ]; then GIT_PROMPT_VIRTUALENV="(${Blue}_VIRTUALENV_${ResetColor}) "; fi + + # template for displaying the current remote tracking branch + # use the placeholder _UPSTREAM_ will be replaced with + # the name of the current remote tracking branch + if [ -z "${GIT_PROMPT_UPSTREAM+x}" ]; then GIT_PROMPT_UPSTREAM=" {${Blue}_UPSTREAM_${ResetColor}}"; fi + + # _LAST_COMMAND_INDICATOR_ will be replaced by the appropriate GIT_PROMPT_COMMAND_OK OR GIT_PROMPT_COMMAND_FAIL + if [ -z "${GIT_PROMPT_START_USER+x}" ]; then GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${Yellow}${PathShort}${ResetColor}"; fi + if [ -z "${GIT_PROMPT_START_ROOT+x}" ]; then GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}"; fi + if [ -z "${GIT_PROMPT_END_USER+x}" ]; then GIT_PROMPT_END_USER=" \n${White}${Time12a}${ResetColor} $ "; fi + if [ -z "${GIT_PROMPT_END_ROOT+x}" ]; then GIT_PROMPT_END_ROOT=" \n${White}${Time12a}${ResetColor} # "; fi + + # Please do not add colors to these symbols + if [ -z ${GIT_PROMPT_SYMBOLS_AHEAD+x} ]; then GIT_PROMPT_SYMBOLS_AHEAD="↑·"; fi # The symbol for "n versions ahead of origin" + if [ -z ${GIT_PROMPT_SYMBOLS_BEHIND+x} ]; then GIT_PROMPT_SYMBOLS_BEHIND="↓·"; fi # The symbol for "n versions behind of origin" + if [ -z ${GIT_PROMPT_SYMBOLS_PREHASH+x} ]; then GIT_PROMPT_SYMBOLS_PREHASH=":"; fi # Written before hash of commit, if no name could be found + if [ -z ${GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING+x} ]; then GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="L"; fi # This symbol is written after the branch, if the branch is not tracked + + # branch name(s) that will use $GIT_PROMPT_MASTER_BRANCH color + # To specify multiple branches, use + # shopt -s extglob + # GIT_PROMPT_MASTER_BRANCHES='@(master|production)' + if [ -z ${GIT_PROMPT_MASTER_BRANCHES+x} ]; then GIT_PROMPT_MASTER_BRANCHES="master"; fi +} + +# call only from theme file +reload_git_prompt_colors() { + if [[ "${GIT_PROMPT_THEME_NAME-}" != "${1}" ]]; then + unset_git_prompt_colors + define_helpers + override_git_prompt_colors + define_undefined_git_prompt_colors + fi +} + +if [[ "${GIT_PROMPT_THEME-}" == "Default" && "${GIT_PROMPT_THEME_NAME-}" != "Default" ]]; then + define_helpers + define_undefined_git_prompt_colors +fi diff --git a/dotfiles/.bash-git-prompt/themes/Default_NoExitState.bgptheme b/dotfiles/.bash-git-prompt/themes/Default_NoExitState.bgptheme new file mode 100644 index 0000000..239aae1 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Default_NoExitState.bgptheme @@ -0,0 +1,11 @@ +# This is the default theme for gitprompt.sh +# without the indicator of the last command state + +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Default NoExitState" + GIT_PROMPT_COMMAND_FAIL="${Red}✘" # indicator if the last command returned with an exit code of other than 0 + GIT_PROMPT_START_USER="${Yellow}${PathShort}${ResetColor}" + GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}" +} + +reload_git_prompt_colors "Default NoExitState" diff --git a/dotfiles/.bash-git-prompt/themes/Default_NoExitState_Ubuntu.bgptheme b/dotfiles/.bash-git-prompt/themes/Default_NoExitState_Ubuntu.bgptheme new file mode 100644 index 0000000..27b78a8 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Default_NoExitState_Ubuntu.bgptheme @@ -0,0 +1,15 @@ +# This is the default theme for gitprompt.sh +# without the indicator of the last command state +# tweaked for Ubuntu terminal fonts + +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Default NoExitState Ubuntu" + GIT_PROMPT_STAGED="${Red}● " # the number of staged files/directories + GIT_PROMPT_CLEAN="${BoldGreen}✔ " # a colored flag indicating a "clean" repo + GIT_PROMPT_COMMAND_OK="${Green}✔ " # indicator if the last command returned with an exit code of 0 + GIT_PROMPT_COMMAND_FAIL="${Red}✘ " # indicator if the last command returned with an exit code of other than 0 + GIT_PROMPT_START_USER="${Yellow}${PathShort}${ResetColor}" + GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}" +} + +reload_git_prompt_colors "Default NoExitState Ubuntu" diff --git a/dotfiles/.bash-git-prompt/themes/Default_Ubuntu.bgptheme b/dotfiles/.bash-git-prompt/themes/Default_Ubuntu.bgptheme new file mode 100644 index 0000000..e68b7b7 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Default_Ubuntu.bgptheme @@ -0,0 +1,11 @@ +# This is the default theme for gitprompt.sh +# tweaked for Ubuntu terminal fonts + +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Default Ubuntu" + GIT_PROMPT_STAGED="${Red}● " # the number of staged files/directories + GIT_PROMPT_CLEAN="${BoldGreen}✔ " # a colored flag indicating a "clean" repo + GIT_PROMPT_COMMAND_OK="${Green}✔ " # indicator if the last command returned with an exit code of 0 +} + +reload_git_prompt_colors "Default Ubuntu" diff --git a/dotfiles/.bash-git-prompt/themes/Evermeet.bgptheme b/dotfiles/.bash-git-prompt/themes/Evermeet.bgptheme new file mode 100644 index 0000000..5381407 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Evermeet.bgptheme @@ -0,0 +1,31 @@ +# This theme for gitprompt.sh is designed for dark color schemes +# It is most suitable for Retina or high resolution displays + +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Evermeet" + + GIT_PROMPT_PREFIX="" # start of the git info string + GIT_PROMPT_SUFFIX="" # the end of the git info string + GIT_PROMPT_SEPARATOR="|" # separates each item + + GIT_PROMPT_BRANCH="${Magenta}" # the git branch that is active in the current directory + GIT_PROMPT_MASTER_BRANCH="${GIT_PROMPT_BRANCH}" # used if the git branch that is active in the current directory is $GIT_PROMPT_MASTER_BRANCHES + GIT_PROMPT_STAGED="${Cyan}●" # the number of staged files/directories + GIT_PROMPT_CONFLICTS="${BoldRed}✖" # the number of files in conflict + GIT_PROMPT_CHANGED="${Cyan}✚" # the number of changed files + + GIT_PROMPT_UNTRACKED="${Cyan}…" # the number of untracked files/dirs + GIT_PROMPT_STASHED="${Magenta}⚑" # the number of stashed files/dir + GIT_PROMPT_CLEAN="${BoldGreen}✔" # a colored flag indicating a "clean" repo + + GIT_PROMPT_UPSTREAM=" {${Magenta}_UPSTREAM_${ResetColor}}" + + GIT_PROMPT_START_USER="[${BoldGreen}\u@\h${ResetColor} ${BoldYellow}\${?}${ResetColor} ${BoldBlue}\w${ResetColor}" + GIT_PROMPT_START_ROOT="[${BoldRed}\u@\h${ResetColor} ${BoldYellow}\${?}${ResetColor} ${BoldBlue}\w${ResetColor}" + GIT_PROMPT_END_USER="]$ " + GIT_PROMPT_END_ROOT="]# " + + GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="⭑" # This symbol is written after the branch, if the branch is not tracked +} + +reload_git_prompt_colors "Evermeet" diff --git a/dotfiles/.bash-git-prompt/themes/Evermeet_Lowres.bgptheme b/dotfiles/.bash-git-prompt/themes/Evermeet_Lowres.bgptheme new file mode 100644 index 0000000..6034535 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Evermeet_Lowres.bgptheme @@ -0,0 +1,33 @@ +# This theme for gitprompt.sh is designed for dark color schemes +# On lowres screens unicode characters like ✖ require a space after them +# otherwise the following character may overlap with the unicode character +# tweaked for low resolution and non-retina screens + +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Evermeet_Lowres" + + GIT_PROMPT_PREFIX="" # start of the git info string + GIT_PROMPT_SUFFIX="" # the end of the git info string + GIT_PROMPT_SEPARATOR="|" # separates each item + + GIT_PROMPT_BRANCH="${Magenta}" # the git branch that is active in the current directory + GIT_PROMPT_MASTER_BRANCH="${GIT_PROMPT_BRANCH}" # used if the git branch that is active in the current directory is $GIT_PROMPT_MASTER_BRANCHES + GIT_PROMPT_STAGED="${Cyan}●" # the number of staged files/directories + GIT_PROMPT_CONFLICTS="${BoldRed}✖ " # the number of files in conflict + GIT_PROMPT_CHANGED="${Cyan}✚ " # the number of changed files + + GIT_PROMPT_UNTRACKED="${Cyan}…" # the number of untracked files/dirs + GIT_PROMPT_STASHED="${Magenta}⚑" # the number of stashed files/dir + GIT_PROMPT_CLEAN="${BoldGreen}✔" # a colored flag indicating a "clean" repo + + GIT_PROMPT_UPSTREAM=" {${Magenta}_UPSTREAM_${ResetColor}}" + + GIT_PROMPT_START_USER="[${BoldGreen}\u@\h${ResetColor} ${BoldYellow}\${?}${ResetColor} ${BoldBlue}\w${ResetColor}" + GIT_PROMPT_START_ROOT="[${BoldRed}\u@\h${ResetColor} ${BoldYellow}\${?}${ResetColor} ${BoldBlue}\w${ResetColor}" + GIT_PROMPT_END_USER="]$ " + GIT_PROMPT_END_ROOT="]# " + + GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="⭑ " # This symbol is written after the branch, if the branch is not tracked +} + +reload_git_prompt_colors "Evermeet_Lowres" diff --git a/dotfiles/.bash-git-prompt/themes/Evermeet_Ubuntu.bgptheme b/dotfiles/.bash-git-prompt/themes/Evermeet_Ubuntu.bgptheme new file mode 100644 index 0000000..1bf043f --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Evermeet_Ubuntu.bgptheme @@ -0,0 +1,33 @@ +# This theme for gitprompt.sh is designed for dark color schemes +# On lowres screens unicode characters like ✖ require a space after them +# otherwise the following character may overlap with the unicode character +# tweaked for Ubuntu terminal fonts + +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Evermeet_Ubuntu" + + GIT_PROMPT_PREFIX="" # start of the git info string + GIT_PROMPT_SUFFIX="" # the end of the git info string + GIT_PROMPT_SEPARATOR="|" # separates each item + + GIT_PROMPT_BRANCH="${Magenta}" # the git branch that is active in the current directory + GIT_PROMPT_MASTER_BRANCH="${GIT_PROMPT_BRANCH}" # used if the git branch that is active in the current directory is $GIT_PROMPT_MASTER_BRANCHES + GIT_PROMPT_STAGED="${Cyan}● " # the number of staged files/directories + GIT_PROMPT_CONFLICTS="${BoldRed}✖ " # the number of files in conflict + GIT_PROMPT_CHANGED="${Cyan}✚ " # the number of changed files + + GIT_PROMPT_UNTRACKED="${Cyan}…" # the number of untracked files/dirs + GIT_PROMPT_STASHED="${Magenta}⚑ " # the number of stashed files/dir + GIT_PROMPT_CLEAN="${BoldGreen}✔ " # a colored flag indicating a "clean" repo + + GIT_PROMPT_UPSTREAM=" {${Magenta}_UPSTREAM_${ResetColor}}" + + GIT_PROMPT_START_USER="[${BoldGreen}\u@\h${ResetColor} ${BoldYellow}\${?}${ResetColor} ${BoldBlue}\w${ResetColor}" + GIT_PROMPT_START_ROOT="[${BoldRed}\u@\h${ResetColor} ${BoldYellow}\${?}${ResetColor} ${BoldBlue}\w${ResetColor}" + GIT_PROMPT_END_USER="]$ " + GIT_PROMPT_END_ROOT="]# " + + GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="⭑ " # This symbol is written after the branch, if the branch is not tracked +} + +reload_git_prompt_colors "Evermeet_Ubuntu" diff --git a/dotfiles/.bash-git-prompt/themes/Minimal.bgptheme b/dotfiles/.bash-git-prompt/themes/Minimal.bgptheme new file mode 100644 index 0000000..5077715 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Minimal.bgptheme @@ -0,0 +1,62 @@ +############################################################################## +# Changes the prompt to a Debian-style one that truncates pwd to a max length +# depending on the terminal column width. Also uses the prompt_callback +# function of bash-git-prompt to set the window title to almost the same +# Debian-style. This version has been tweaked for Ubuntu standard terminal +# fonts. +# +# The prompt will use a Debian-style on the form +# +# relative-path-from-git-toplevel-dir bash-git-prompt-info +# HH:MM:SS ▶ +# +# The window title will have the form +# relative-path-from-git-toplevel-dir +# +# Example usage: +# if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then +# GIT_PROMPT_THEME=Minimal +# source ~/.bash-git-prompt/gitprompt.sh +# fi +# +# Imbibinebe [https://github.com/imbibinebe] +############################################################################## +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Minimal" + + #Overrides the prompt_callback function used by bash-git-prompt + function prompt_callback { + GIT_CONTAINER_FOLDER_FULLPATH=$(git rev-parse --show-toplevel 2> /dev/null) + GIT_CONTAINER_FOLDER=$(basename $GIT_CONTAINER_FOLDER_FULLPATH 2> /dev/null) + CURRENT_FULLPATH=$(pwd) + local PS1=$GIT_CONTAINER_FOLDER${CURRENT_FULLPATH#$GIT_CONTAINER_FOLDER_FULLPATH} + gp_set_window_title "$PS1" + echo -n "${BoldYellow}${PS1}${ResetColor}" + } + + Time12a="\$(date +%H:%M:%S)" + GIT_PROMPT_BRANCH="${BoldMagenta}" # the git branch that is active in the current directory + GIT_PROMPT_MASTER_BRANCH="${GIT_PROMPT_MASTER_BRANCH}" # used if the git branch that is active in the current directory is $GIT_PROMPT_MASTER_BRANCHES + GIT_PROMPT_PREFIX="" # start of the git info string + GIT_PROMPT_SUFFIX="" # the end of the git info string + GIT_PROMPT_SEPARATOR="" # separates each item + GIT_PROMPT_STAGED=" ${Green}●" # the number of staged files/directories + GIT_PROMPT_CONFLICTS=" ${BoldRed}✖" # the number of files in conflict + GIT_PROMPT_CHANGED=" ${BoldBlue}✚" # the number of changed files + + # GIT_PROMPT_REMOTE=" " # the remote branch name (if any) and the symbols for ahead and behind + GIT_PROMPT_UNTRACKED=" ${Cyan}…" # the number of untracked files/dirs + GIT_PROMPT_STASHED=" ${BoldCyan}⚑" # the number of stashed files/dir + GIT_PROMPT_CLEAN=" ${BoldGreen}✔" # a colored flag indicating a "clean" repo + + local gp_end="_LAST_COMMAND_INDICATOR_\n${White}${Time12a}${ResetColor}" + + GIT_PROMPT_START_USER="" + GIT_PROMPT_END_USER="${gp_end} ▶ " + GIT_PROMPT_END_ROOT="${gp_end} /!!!\ " + + GIT_PROMPT_COMMAND_OK="${Green} ✔ " # indicator if the last command returned with an exit code of 0 + GIT_PROMPT_COMMAND_FAIL="${BoldRed} ✘-_LAST_COMMAND_STATE_" # indicator if the last command returned with an exit code of other than 0 +} + +reload_git_prompt_colors "Minimal" diff --git a/dotfiles/.bash-git-prompt/themes/Minimal_Chevron.bgptheme b/dotfiles/.bash-git-prompt/themes/Minimal_Chevron.bgptheme new file mode 100644 index 0000000..1219055 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Minimal_Chevron.bgptheme @@ -0,0 +1,72 @@ +############################################################################## +# Changes the prompt to a Debian-style one that truncates pwd to a max length +# depending on the terminal column width. Also uses the prompt_callback +# function of bash-git-prompt to set the window title to almost the same +# Debian-style. This version has been tweaked for Ubuntu standard terminal +# fonts. +# +# The prompt will use a Debian-style on the form +# +# relative-path-from-git-toplevel-dir bash-git-prompt-info +# HH:MM ▶ +# +# ● ✖ ◆ ➤ ▶ ❚❖ ⬅ ◀ ✔ ✘ ⬆ ⬇ ✚ ❮❮ ❯❯ ✦ ✛ ✲ +# +# The window title will have the form +# relative-path-from-git-toplevel-dir +# +# Example usage: +# if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then +# GIT_PROMPT_THEME=Minimal_Time +# source ~/.bash-git-prompt/gitprompt.sh +# fi +# +# [https://github.com/modib] +############################################################################## +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Minimal_Time" + + #Overrides the prompt_callback function used by bash-git-prompt + function prompt_callback { + GIT_CONTAINER_FOLDER_FULLPATH=$(git rev-parse --show-toplevel 2> /dev/null) + GIT_CONTAINER_FOLDER=$(basename $GIT_CONTAINER_FOLDER_FULLPATH 2> /dev/null) + CURRENT_FULLPATH=$(pwd) + local PS1=$GIT_CONTAINER_FOLDER${CURRENT_FULLPATH#$GIT_CONTAINER_FOLDER_FULLPATH} + gp_set_window_title "$PS1" + echo "${Cyan}${PS1}${ResetColor}" + } + + Time12a="\$(date +%H:%M)" + GIT_PROMPT_BRANCH="${Magenta}" # the git branch that is active in the current directory + GIT_PROMPT_MASTER_BRANCH="${White}" # used if the git branch that is active in the current directory is $GIT_PROMPT_MASTER_BRANCHES + + GIT_PROMPT_PREFIX="[" + GIT_PROMPT_SUFFIX="]" + GIT_PROMPT_SEPARATOR="" # separates each item + GIT_PROMPT_STAGED=" ${Green}●" # the number of staged files/directories + GIT_PROMPT_CONFLICTS=" ${Red}❮❮" # the number of files in conflict + GIT_PROMPT_CHANGED=" ${Yellow}✚." # the number of changed files + + GIT_PROMPT_REMOTE=" " # the remote branch name (if any) and the symbols for ahead and behind + GIT_PROMPT_UNTRACKED=" ${Cyan}…" # the number of untracked files/dirs + GIT_PROMPT_STASHED=" ${Cyan}⚑" # the number of stashed files/dir + GIT_PROMPT_CLEAN=" ${Green}❯❯" # a colored flag indicating a "clean" repo + GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="${Red}✭" + + GIT_PROMPT_COMMAND_OK="${Green}❯❯" # indicator if the last command returned with an exit code of 0 + GIT_PROMPT_COMMAND_FAIL="${Red}❮❮ _LAST_COMMAND_STATE_" # indicator if the last command returned with an exit code of other than 0 + + local gp_start="_LAST_COMMAND_INDICATOR_" + local gp_end="\n${White}${Time12a}${ResetColor} ❯❯" + + GIT_PROMPT_START_USER="\n${gp_start} " + GIT_PROMPT_END_USER="${gp_end} " + + #GIT_PROMPT_SYMBOLS_AHEAD="↑·" + GIT_PROMPT_SYMBOLS_AHEAD="⬆." + #GIT_PROMPT_SYMBOLS_BEHIND="↓·" + GIT_PROMPT_SYMBOLS_BEHIND="⬇." + +} + +reload_git_prompt_colors "Minimal_Time" diff --git a/dotfiles/.bash-git-prompt/themes/Minimal_UserHost.bgptheme b/dotfiles/.bash-git-prompt/themes/Minimal_UserHost.bgptheme new file mode 100644 index 0000000..d446302 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Minimal_UserHost.bgptheme @@ -0,0 +1,70 @@ +############################################################################## +# Changes the prompt to a Debian-style one that truncates pwd to a max length +# depending on the terminal column width. Also uses the prompt_callback +# function of bash-git-prompt to set the window title to almost the same +# Debian-style. This version has been tweaked for Ubuntu standard terminal +# fonts. +# +# The prompt will use a Debian-style on the form +# +# relative-path-from-git-toplevel-dir bash-git-prompt-info +# HH:MM:SS User@Host ▶ +# +# The window title will have the form +# relative-path-from-git-toplevel-dir +# +# Example usage: +# if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then +# GIT_PROMPT_THEME=Minimal_UserHost +# source ~/.bash-git-prompt/gitprompt.sh +# fi +# +# Gert Pellin [https://github.com/switch87] +# +# Based on Minimal by Imbibinebe [https://github.com/imbibinebe] +############################################################################## +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Minimal_UserHost" + + #Overrides the prompt_callback function used by bash-git-prompt + function prompt_callback { + GIT_CONTAINER_FOLDER_FULLPATH=$(git rev-parse --show-toplevel 2> /dev/null) + GIT_CONTAINER_FOLDER=$(basename $GIT_CONTAINER_FOLDER_FULLPATH 2> /dev/null) + CURRENT_FULLPATH=$(pwd) + local PS1=$GIT_CONTAINER_FOLDER${CURRENT_FULLPATH#$GIT_CONTAINER_FOLDER_FULLPATH} + gp_set_window_title "$PS1" + echo -n "${BoldYellow}${PS1}${ResetColor}" + } + + Time12a="\$(date +%H:%M:%S)" + if [ "$(id -u)" != "0" ]; then + UserHost_Color="${BoldGreen}" + else + UserHost_Color="${BoldRed}" + fi + + GIT_PROMPT_BRANCH="${BoldMagenta}" # the git branch that is active in the current directory + GIT_PROMPT_MASTER_BRANCH="${GIT_PROMPT_MASTER_BRANCH}" # used if the git branch that is active in the current directory is $GIT_PROMPT_MASTER_BRANCHES + GIT_PROMPT_PREFIX="" # start of the git info string + GIT_PROMPT_SUFFIX="" # the end of the git info string + GIT_PROMPT_SEPARATOR="" # separates each item + GIT_PROMPT_STAGED=" ${Green}●" # the number of staged files/directories + GIT_PROMPT_CONFLICTS=" ${BoldRed}✖" # the number of files in conflict + GIT_PROMPT_CHANGED=" ${BoldBlue}✚" # the number of changed files + + # GIT_PROMPT_REMOTE=" " # the remote branch name (if any) and the symbols for ahead and behind + GIT_PROMPT_UNTRACKED=" ${Cyan}…" # the number of untracked files/dirs + GIT_PROMPT_STASHED=" ${BoldCyan}⚑" # the number of stashed files/dir + GIT_PROMPT_CLEAN=" ${BoldGreen}✔" # a colored flag indicating a "clean" repo + + local gp_end="_LAST_COMMAND_INDICATOR_\n${BoldBlack}${Time12a} ${UserHost_Color}$(whoami)@$(hostname)${ResetColor}" + + GIT_PROMPT_START_USER="" + GIT_PROMPT_END_USER="${gp_end} ▶ " + GIT_PROMPT_END_ROOT="${gp_end} /!!!\ " + + GIT_PROMPT_COMMAND_OK="${Green} ✔ " # indicator if the last command returned with an exit code of 0 + GIT_PROMPT_COMMAND_FAIL="${BoldRed} ✘-_LAST_COMMAND_STATE_" # indicator if the last command returned with an exit code of other than 0 +} + +reload_git_prompt_colors "Minimal_UserHost" diff --git a/dotfiles/.bash-git-prompt/themes/Plague_Doctor.bgptheme b/dotfiles/.bash-git-prompt/themes/Plague_Doctor.bgptheme new file mode 100644 index 0000000..f399f68 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Plague_Doctor.bgptheme @@ -0,0 +1,41 @@ +# Plague Doctor's bash-git-prompt theme. +# +# Note 1: The theme is designed to work only in GIT Repos. +# If one needs a coresponding prompt for non GIT locations, here is the code: +# +# if [ -f ]; then +# source +# MYPROMPT="${White}\A${ResetColor} ${BoldGreen}\\u${White}@${BoldYellow}\\h ${Cyan}\w${ResetColor}${BoldWhite} $ ${ResetColor}" +# else +# MYPROMPT="\[\033[37m\]\A \[\033[1m\]\[\033[32m\]\u\[\033[0m\]\[\033[37m\]@\[\033[1m\]\[\033[33m\]\h:\[\033[0m\]\[\033[36m\] \w\[\033[0m\]\[\033[1m\]\[\033[37m\] \$ \[\033[0m\]" +# fi +# export PS1=$MYPROMPT +# +# Note 2: The theme looks very nice with "FantasqueSansMono Nerd Font" https://github.com/ryanoasis/nerd-fonts + +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Plague Doctor" + GIT_PROMPT_ONLY_IN_REPO=1 + GIT_PROMPT_LEADING_SPACE=0 + + GIT_PROMPT_PREFIX="[ " + GIT_PROMPT_SUFFIX=" ]" + GIT_PROMPT_SEPARATOR=" |" + GIT_PROMPT_STAGED=" ${Red}● ${ResetColor}" + GIT_PROMPT_CONFLICTS=" ${Red}✖ ${ResetColor}" + GIT_PROMPT_CHANGED=" ${Blue}✚ ${ResetColor}" + GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}" + GIT_PROMPT_STASHED=" ${BoldBlue}⚑ ${ResetColor}" + GIT_PROMPT_CLEAN=" ${BoldGreen}✔ ${ResetColor}" + GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="✭" + + GIT_PROMPT_COMMAND_OK="${Green}✔ " + GIT_PROMPT_COMMAND_FAIL="${Red}✘ " + + GIT_PROMPT_START_USER="${BoldBlue} ${ResetColor}" + GIT_PROMPT_START_ROOT="${BoldRed}❖ ${ResetColor}" + GIT_PROMPT_END_USER="\n_LAST_COMMAND_INDICATOR_${White}${Time12a}${ResetColor} ${BoldGreen}\\u${White}@${BoldYellow}\\h ${Cyan}${PathShort}${ResetColor}${BoldWhite} $ ${ResetColor}" + GIT_PROMPT_END_ROOT="\n_LAST_COMMAND_INDICATOR_${White}${Time12a}${ResetColor} ${BoldRed}\\u${White}@${BoldYellow}\\h ${Cyan}${PathShort}${ResetColor}${BoldRed} # ${ResetColor}" +} + +reload_git_prompt_colors "Plague Doctor" diff --git a/dotfiles/.bash-git-prompt/themes/Single_line.bgptheme b/dotfiles/.bash-git-prompt/themes/Single_line.bgptheme new file mode 100644 index 0000000..124c1d5 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Single_line.bgptheme @@ -0,0 +1,11 @@ +# This is an alternative approach. Single line in git repo. +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Single_line" + + GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${White}${Time12a}${ResetColor} ${BoldYellow}${PathShort}${ResetColor}" + GIT_PROMPT_END_USER="${ResetColor} $ " + GIT_PROMPT_END_ROOT="${BoldRed} # " +} + +reload_git_prompt_colors "Single_line" + diff --git a/dotfiles/.bash-git-prompt/themes/Single_line_Dark.bgptheme b/dotfiles/.bash-git-prompt/themes/Single_line_Dark.bgptheme new file mode 100644 index 0000000..c68a198 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Single_line_Dark.bgptheme @@ -0,0 +1,20 @@ +# This is a theme for gitprompt.sh, +# it uses the default openSUSE bash prompt style with exit status + +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Single_line_nono031" + GIT_PROMPT_BRANCH="${Cyan}" + GIT_PROMPT_MASTER_BRANCH="${GIT_PROMPT_BRANCH}" + GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}" + GIT_PROMPT_CHANGED="${Yellow}✚ " + GIT_PROMPT_STAGED="${Magenta}●" + + GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${BoldGreen}\h:${BoldBlue}\w${ResetColor}" + GIT_PROMPT_START_ROOT="_LAST_COMMAND_INDICATOR_ ${BoldRed}\h:${BoldBlue}\w${ResetColor}" + + GIT_PROMPT_END_USER="${ResetColor}> " + GIT_PROMPT_END_ROOT=" # ${ResetColor}" +} + +reload_git_prompt_colors "Single_line_nono031" + diff --git a/dotfiles/.bash-git-prompt/themes/Single_line_Minimalist.bgptheme b/dotfiles/.bash-git-prompt/themes/Single_line_Minimalist.bgptheme new file mode 100644 index 0000000..1f73687 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Single_line_Minimalist.bgptheme @@ -0,0 +1,33 @@ +# This is an alternative approach. Single line minimalist in git repo. +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Single_line_Minimalist" + + function prompt_callback { + local PS1="$(gp_truncate_pwd)" + gp_set_window_title "$PS1" + } + + Time12a="\$(date +%H:%M:%S)" + PathShort="\W"; + + GIT_PROMPT_PREFIX="[" + GIT_PROMPT_SUFFIX="]" + GIT_PROMPT_SEPARATOR=" " + GIT_PROMPT_STAGED="${Red}●${ResetColor}" + GIT_PROMPT_CONFLICTS="${Red}✖${ResetColor}" + GIT_PROMPT_CHANGED="${Blue}✚${ResetColor}" + GIT_PROMPT_UNTRACKED="${Cyan}…${ResetColor}" + GIT_PROMPT_STASHED="${BoldBlue}⚑${ResetColor}" + GIT_PROMPT_CLEAN="${BoldGreen}✔${ResetColor}" + + GIT_PROMPT_COMMAND_OK="${Green}✔" + GIT_PROMPT_COMMAND_FAIL="${Red}✘" + + GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${White}${Time12a}${ResetColor} ${Cyan}${PathShort}${ResetColor}" + GIT_PROMPT_END_USER="${ResetColor} $ " + GIT_PROMPT_END_ROOT="${BoldRed} # " + +} + +reload_git_prompt_colors "Single_line_Minimalist" + diff --git a/dotfiles/.bash-git-prompt/themes/Single_line_NoExitState.bgptheme b/dotfiles/.bash-git-prompt/themes/Single_line_NoExitState.bgptheme new file mode 100644 index 0000000..46f7000 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Single_line_NoExitState.bgptheme @@ -0,0 +1,12 @@ +# This is an alternative approach. Single line in git repo. +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Single_line_NoExitState" + + GIT_PROMPT_COMMAND_FAIL="${Red}✘" + GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${White}${Time12a}${ResetColor} ${BoldYellow}${PathShort}${ResetColor}" + GIT_PROMPT_END_USER="${ResetColor} $ " + GIT_PROMPT_END_ROOT="${BoldRed} # " +} + +reload_git_prompt_colors "Single_line_NoExitState" + diff --git a/dotfiles/.bash-git-prompt/themes/Single_line_NoExitState_Gentoo.bgptheme b/dotfiles/.bash-git-prompt/themes/Single_line_NoExitState_Gentoo.bgptheme new file mode 100644 index 0000000..21d9657 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Single_line_NoExitState_Gentoo.bgptheme @@ -0,0 +1,20 @@ +# This is a theme for gitprompt.sh, +# it uses the default Gentoo bash prompt style. + +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Single_line_NoExitState_Gentoo" + GIT_PROMPT_BRANCH="${Cyan}" + GIT_PROMPT_MASTER_BRANCH="${GIT_PROMPT_BRANCH}" + GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}" + GIT_PROMPT_CHANGED="${Yellow}✚ " + GIT_PROMPT_STAGED="${Magenta}●" + + GIT_PROMPT_START_USER="${BoldGreen}\u@\h ${BrightBlue}\w${ResetColor}" + GIT_PROMPT_START_ROOT="${BoldRed}\h ${BrightBlue}\w${ResetColor}" + + GIT_PROMPT_END_USER="${BrightBlue} \$ ${ResetColor}" + GIT_PROMPT_END_ROOT="${BrightBlue} \$ ${ResetColor}" +} + +reload_git_prompt_colors "Single_line_NoExitState_Gentoo" + diff --git a/dotfiles/.bash-git-prompt/themes/Single_line_NoExitState_openSUSE.bgptheme b/dotfiles/.bash-git-prompt/themes/Single_line_NoExitState_openSUSE.bgptheme new file mode 100644 index 0000000..72d0d6d --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Single_line_NoExitState_openSUSE.bgptheme @@ -0,0 +1,20 @@ +# This is a theme for gitprompt.sh, +# it uses the default openSUSE bash prompt style + +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Single_line_NoExitState_openSUSE" + GIT_PROMPT_BRANCH="${Cyan}" + GIT_PROMPT_MASTER_BRANCH="${GIT_PROMPT_BRANCH}" + GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}" + GIT_PROMPT_CHANGED="${Yellow}✚ " + GIT_PROMPT_STAGED="${Magenta}●" + + GIT_PROMPT_START_USER="\u@\h:\w" + GIT_PROMPT_START_ROOT="${BoldRed}\h:\w" + + GIT_PROMPT_END_USER="> " + GIT_PROMPT_END_ROOT=" # ${ResetColor}" +} + +reload_git_prompt_colors "Single_line_NoExitState_openSUSE" + diff --git a/dotfiles/.bash-git-prompt/themes/Single_line_Solarized.bgptheme b/dotfiles/.bash-git-prompt/themes/Single_line_Solarized.bgptheme new file mode 100644 index 0000000..95725bf --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Single_line_Solarized.bgptheme @@ -0,0 +1,34 @@ +# This is an alternative approach. Single line in git repo. +# Theme optimised for Terminus and PowerLine compatible fonts. +# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes +# without the indicator of the last command state +# tweaked for Ubuntu terminal fonts + +define_helpers() { + PathShort="${BoldBlue}\u:${Cyan}\W" +} + +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Single_line_Solarized" + + + GIT_PROMPT_PREFIX="[ " + GIT_PROMPT_SUFFIX=" ]" + GIT_PROMPT_SEPARATOR=" |" + GIT_PROMPT_STAGED=" ${Yellow}● ${ResetColor}" + GIT_PROMPT_CONFLICTS=" ${Red}✖ ${ResetColor}" + GIT_PROMPT_CHANGED=" ${Blue}✚ ${ResetColor}" + GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}" + GIT_PROMPT_STASHED=" ${BoldMagenta}⚑ ${ResetColor}" + GIT_PROMPT_CLEAN=" ${Green}✔ ${ResetColor}" + + GIT_PROMPT_COMMAND_FAIL="${Red}✘" + + GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${Yellow}${PathShort}${ResetColor}" + GIT_PROMPT_END_USER="${BoldBlue} ➭ ${ResetColor}" + GIT_PROMPT_END_ROOT="${BoldRed} # ${ResetColor}" + + GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="✭" +} + +reload_git_prompt_colors "Single_line_Solarized" diff --git a/dotfiles/.bash-git-prompt/themes/Single_line_Solarized_Lamda.bgptheme b/dotfiles/.bash-git-prompt/themes/Single_line_Solarized_Lamda.bgptheme new file mode 100644 index 0000000..690062b --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Single_line_Solarized_Lamda.bgptheme @@ -0,0 +1,48 @@ +# This is an alternative approach. Single line in git repo. +# Theme optimised for Terminus and PowerLine compatible fonts. +# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes +# without the indicator of the last command state +# tweaked for Ubuntu terminal fonts + + +define_helpers() { + YELLOW=$(tput setaf 3) + PathShort="\[$YELLOW\][\A] ${Cyan}\w" +} + +override_git_prompt_colors() { + YELLOW=$(tput setaf 3) + ORANGE=$(tput setaf 9) + RED=$(tput setaf 1) + MAGENTA=$(tput setaf 5) + VIOLET=$(tput setaf 13) + BLUE=$(tput setaf 4) + CYAN=$(tput setaf 6) + GREEN=$(tput setaf 2) + BOLD=$(tput bold) + RESET=$(tput sgr0) + + + GIT_PROMPT_THEME_NAME="Single_line_Solarized_Lamda" + + + GIT_PROMPT_PREFIX="[ " + GIT_PROMPT_SUFFIX=" ]" + GIT_PROMPT_SEPARATOR=" |" + GIT_PROMPT_STAGED=" ${Yellow}● ${ResetColor}" + GIT_PROMPT_CONFLICTS=" ${Red}✖ ${ResetColor}" + GIT_PROMPT_CHANGED=" ${Blue}✚ ${ResetColor}" + GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}" + GIT_PROMPT_STASHED=" ${BoldMagenta}⚑ ${ResetColor}" + GIT_PROMPT_CLEAN=" ${Green}✔ ${ResetColor}" + + GIT_PROMPT_COMMAND_FAIL="${Red}✘" + + GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${Yellow}${PathShort}${ResetColor}" + GIT_PROMPT_END_USER="\[$ORANGE\] λ ${ResetColor}" + GIT_PROMPT_END_ROOT="${BoldRed} # ${ResetColor}" + + GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="✭" +} + +reload_git_prompt_colors "Single_line_Solarized_Lamda" diff --git a/dotfiles/.bash-git-prompt/themes/Single_line_Ubuntu.bgptheme b/dotfiles/.bash-git-prompt/themes/Single_line_Ubuntu.bgptheme new file mode 100644 index 0000000..7dd3a4f --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Single_line_Ubuntu.bgptheme @@ -0,0 +1,25 @@ +# This is an alternative approach. Single line in git repo. +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Single_line_Ubuntu" + + GIT_PROMPT_PREFIX="[ " + GIT_PROMPT_SUFFIX=" ]" + GIT_PROMPT_SEPARATOR=" |" + GIT_PROMPT_STAGED=" ${Red}● ${ResetColor}" + GIT_PROMPT_CONFLICTS=" ${Red}✖ ${ResetColor}" + GIT_PROMPT_CHANGED=" ${Blue}✚ ${ResetColor}" + GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}" + GIT_PROMPT_STASHED=" ${BoldBlue}⚑ ${ResetColor}" + GIT_PROMPT_CLEAN=" ${BoldGreen}✔ ${ResetColor}" + + GIT_PROMPT_COMMAND_OK="${Green}✔ " + GIT_PROMPT_COMMAND_FAIL="${Red}✘ " + + GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${White}${Time12a}${ResetColor} ${Cyan}${PathShort}${ResetColor}" + GIT_PROMPT_END_USER="${ResetColor} $ " + GIT_PROMPT_END_ROOT="${BoldRed} # " + +} + +reload_git_prompt_colors "Single_line_Ubuntu" + diff --git a/dotfiles/.bash-git-prompt/themes/Single_line_openSUSE.bgptheme b/dotfiles/.bash-git-prompt/themes/Single_line_openSUSE.bgptheme new file mode 100644 index 0000000..faf24bf --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Single_line_openSUSE.bgptheme @@ -0,0 +1,20 @@ +# This is a theme for gitprompt.sh, +# it uses the default openSUSE bash prompt style with exit status + +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Single_line_openSUSE" + GIT_PROMPT_BRANCH="${Cyan}" + GIT_PROMPT_MASTER_BRANCH="${GIT_PROMPT_BRANCH}" + GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}" + GIT_PROMPT_CHANGED="${Yellow}✚ " + GIT_PROMPT_STAGED="${Magenta}●" + + GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${ResetColor}\u@\h:\w" + GIT_PROMPT_START_ROOT="_LAST_COMMAND_INDICATOR_ ${BoldRed}\h:\w" + + GIT_PROMPT_END_USER="${ResetColor}> " + GIT_PROMPT_END_ROOT=" # ${ResetColor}" +} + +reload_git_prompt_colors "Single_line_openSUSE" + diff --git a/dotfiles/.bash-git-prompt/themes/Single_line_username_repo.bgptheme b/dotfiles/.bash-git-prompt/themes/Single_line_username_repo.bgptheme new file mode 100644 index 0000000..b4a3dff --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Single_line_username_repo.bgptheme @@ -0,0 +1,13 @@ +# This is an alternative approach. Single line in git repo. +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Single_line_username_repo" + GIT_PROMPT_WITH_USERNAME_AND_REPO=1 + GIT_PROMPT_USERNAME_REPO_SEPARATOR=" | " + GIT_PROMPT_PREFIX="[ ${Blue}_USERNAME_REPO_" + GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${White}${Time12a}${ResetColor} ${BoldYellow}${PathShort}${ResetColor}" + GIT_PROMPT_END_USER="${ResetColor} $ " + GIT_PROMPT_END_ROOT="${BoldRed} # " +} + +reload_git_prompt_colors "Single_line_username_repo" + diff --git a/dotfiles/.bash-git-prompt/themes/Solarized.bgptheme b/dotfiles/.bash-git-prompt/themes/Solarized.bgptheme new file mode 100644 index 0000000..caf1ea8 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Solarized.bgptheme @@ -0,0 +1,13 @@ +# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes +# tweaked for Ubuntu terminal fonts + +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Solarized" + GIT_PROMPT_STAGED="${Yellow}●" + GIT_PROMPT_STASHED="${BoldMagenta}⚑ " + GIT_PROMPT_CLEAN="${Green}✔" + GIT_PROMPT_END_USER=" \n${BoldBlue}${Time12a}${ResetColor} $ " + GIT_PROMPT_END_ROOT=" \n${BoldBlue}${Time12a}${ResetColor} # " +} + +reload_git_prompt_colors "Solarized" \ No newline at end of file diff --git a/dotfiles/.bash-git-prompt/themes/Solarized_Extravagant.bgptheme b/dotfiles/.bash-git-prompt/themes/Solarized_Extravagant.bgptheme new file mode 100644 index 0000000..f87ccb4 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Solarized_Extravagant.bgptheme @@ -0,0 +1,41 @@ +# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes +# tweaked for Ubuntu terminal fonts +# some modifications on colors +# added ruby prompt, and kernel version as well + +override_git_prompt_colors() { + if [ -e ~/.rvm/bin/rvm-prompt ]; then + RUBY_PROMPT='{$(~/.rvm/bin/rvm-prompt i v)}' + else + if command -v rbenv > /dev/null; then + RUBY_PROMPT='{$(rbenv version | sed -e "s/ (set.*$//")}' + fi + fi + Time12a="\$(date +%H:%M:%S)" + + GIT_PROMPT_THEME_NAME="Solarized Extravagant" + GIT_PROMPT_STAGED="${Yellow}● " + GIT_PROMPT_UNTRACKED="${Cyan}… " + GIT_PROMPT_STASHED="${BoldMagenta}⚑ " + GIT_PROMPT_CLEAN="${Green}✔ " + GIT_PROMPT_COMMAND_OK="${Green}✔ " + GIT_PROMPT_COMMAND_FAIL="${Red}✘ " + + KERNEL_PROMPT='‹$(uname -r)›' + + GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${BoldBlueFg}${Time12a} ${Green}${KERNEL_PROMPT} ${Cyan}${RUBY_PROMPT} ${Yellow}${PathShort}" + GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}" + if [ -n "$SSH_CLIENT" ]; then + GIT_PROMPT_END_USER="\n${BoldRed} ➤ ${ResetColor}" + GIT_PROMPT_END_ROOT="\n${BoldRed} » ${ResetColor}" + else + GIT_PROMPT_END_USER="\n${BoldBlue} ➭ ${ResetColor}" + GIT_PROMPT_END_ROOT="\n${BoldRed} # ${ResetColor}" + fi + GIT_PROMPT_LEADING_SPACE=1 + GIT_PROMPT_PREFIX="${Cyan}[" + GIT_PROMPT_SUFFIX="${Cyan}]" + GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="✭" +} + +reload_git_prompt_colors "Solarized Extravagant" diff --git a/dotfiles/.bash-git-prompt/themes/Solarized_NoExitState.bgptheme b/dotfiles/.bash-git-prompt/themes/Solarized_NoExitState.bgptheme new file mode 100644 index 0000000..77f8e50 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Solarized_NoExitState.bgptheme @@ -0,0 +1,16 @@ +# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes +# without the indicator of the last command state + +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Solarized NoExitState" + GIT_PROMPT_STAGED="${Yellow}●" + GIT_PROMPT_STASHED="${BoldMagenta}⚑ " + GIT_PROMPT_CLEAN="${Green}✔" + GIT_PROMPT_COMMAND_FAIL="${Red}✘" + GIT_PROMPT_START_USER="${Yellow}${PathShort}${ResetColor}" + GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}" + GIT_PROMPT_END_USER=" \n${BoldBlue}${Time12a}${ResetColor} $ " + GIT_PROMPT_END_ROOT=" \n${BoldBlue}${Time12a}${ResetColor} # " +} + +reload_git_prompt_colors "Solarized NoExitState" \ No newline at end of file diff --git a/dotfiles/.bash-git-prompt/themes/Solarized_NoExitState_Ubuntu.bgptheme b/dotfiles/.bash-git-prompt/themes/Solarized_NoExitState_Ubuntu.bgptheme new file mode 100644 index 0000000..be6be1f --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Solarized_NoExitState_Ubuntu.bgptheme @@ -0,0 +1,18 @@ +# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes +# without the indicator of the last command state +# tweaked for Ubuntu terminal fonts + +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Solarized NoExitState Ubuntu" + GIT_PROMPT_STAGED="${Yellow}● " + GIT_PROMPT_STASHED="${BoldMagenta}⚑ " + GIT_PROMPT_CLEAN="${Green}✔ " + GIT_PROMPT_COMMAND_OK="${Green}✔ " + GIT_PROMPT_COMMAND_FAIL="${Red}✘ " + GIT_PROMPT_START_USER="${Yellow}${PathShort}${ResetColor}" + GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}" + GIT_PROMPT_END_USER=" \n${BoldBlue}${Time12a}${ResetColor} $ " + GIT_PROMPT_END_ROOT=" \n${BoldBlue}${Time12a}${ResetColor} # " +} + +reload_git_prompt_colors "Solarized NoExitState Ubuntu" diff --git a/dotfiles/.bash-git-prompt/themes/Solarized_Ubuntu.bgptheme b/dotfiles/.bash-git-prompt/themes/Solarized_Ubuntu.bgptheme new file mode 100644 index 0000000..99589c4 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Solarized_Ubuntu.bgptheme @@ -0,0 +1,14 @@ +# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes +# tweaked for Ubuntu terminal fonts + +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="Solarized Ubuntu" + GIT_PROMPT_STAGED="${Yellow}● " + GIT_PROMPT_STASHED="${BoldMagenta}⚑ " + GIT_PROMPT_CLEAN="${Green}✔ " + GIT_PROMPT_COMMAND_OK="${Green}✔ " + GIT_PROMPT_END_USER=" \n${BoldBlue}${Time12a}${ResetColor} $ " + GIT_PROMPT_END_ROOT=" \n${BoldBlue}${Time12a}${ResetColor} # " +} + +reload_git_prompt_colors "Solarized Ubuntu" diff --git a/dotfiles/.bash-git-prompt/themes/Solarized_UserHost.bgptheme b/dotfiles/.bash-git-prompt/themes/Solarized_UserHost.bgptheme new file mode 100644 index 0000000..4eea2f1 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/Solarized_UserHost.bgptheme @@ -0,0 +1,23 @@ +# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes +# based on "Solarized Extravagant", with user@host on the second line and some things removed. + +function override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME='Solarized UserHost' + GIT_PROMPT_STAGED="${Yellow}● " + GIT_PROMPT_UNTRACKED="${Cyan}… " + GIT_PROMPT_STASHED="${BoldMagenta}⚑ " + GIT_PROMPT_CLEAN="${Green}✔ " + GIT_PROMPT_COMMAND_OK="${Green}✔ " + GIT_PROMPT_COMMAND_FAIL="${Red}✘ " + + GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${Yellow}${PathShort}" + GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}" + GIT_PROMPT_END_USER="\n${Blue}\\u${White}@${BoldBlue}\\h ${BoldRed} ➤ ${ResetColor} " + GIT_PROMPT_END_ROOT="\n${Blue}\\u${White}@${BoldBlue}\\h ${BoldRed} #️ ${ResetColor} " + GIT_PROMPT_LEADING_SPACE=1 + GIT_PROMPT_PREFIX="${Cyan}[" + GIT_PROMPT_SUFFIX="${Cyan}]" + GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="✭" +} + +reload_git_prompt_colors 'Solarized UserHost' diff --git a/dotfiles/.bash-git-prompt/themes/TruncatedPwd_WindowTitle.bgptheme b/dotfiles/.bash-git-prompt/themes/TruncatedPwd_WindowTitle.bgptheme new file mode 100644 index 0000000..1c1f5ee --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/TruncatedPwd_WindowTitle.bgptheme @@ -0,0 +1,40 @@ +############################################################################## +# Changes the prompt to a Debian-style one that truncates pwd to a max length +# depending on the terminal column width. Also uses the prompt_callback +# function of bash-git-prompt to set the window title to almost the same +# Debian-style. +# +# The prompt will use a Debian-style on the form +# +# [user@host: ] [bash-git-prompt-info] +# HH:MM $ +# +# The window title will have the form +# user@host: +# +# Example usage: +# if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then +# GIT_PROMPT_THEME=TruncatedPwd_WindowTitle +# source ~/.bash-git-prompt/gitprompt.sh +# fi +# +# oGre [https://github.com/ogr3] +############################################################################## +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="TruncatedPwd_WindowTitle" + + #Overrides the prompt_callback function used by bash-git-prompt + function prompt_callback { + local PS1="\u@\h: $(gp_truncate_pwd)" + gp_set_window_title "$PS1" + echo -n "${Yellow}[${PS1}]${ResetColor}" + } + + local gp_end=" _LAST_COMMAND_INDICATOR_\n${White}${Time12a}${ResetColor}" + + GIT_PROMPT_START_USER="" + GIT_PROMPT_END_USER="${gp_end} $ " + GIT_PROMPT_END_ROOT="${gp_end} # " +} + +reload_git_prompt_colors "TruncatedPwd_WindowTitle" diff --git a/dotfiles/.bash-git-prompt/themes/TruncatedPwd_WindowTitle_NoExitState.bgptheme b/dotfiles/.bash-git-prompt/themes/TruncatedPwd_WindowTitle_NoExitState.bgptheme new file mode 100644 index 0000000..566bf51 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/TruncatedPwd_WindowTitle_NoExitState.bgptheme @@ -0,0 +1,40 @@ +############################################################################## +# Changes the prompt to a Debian-style one that truncates pwd to a max length +# depending on the terminal column width. Also uses the prompt_callback +# function of bash-git-prompt to set the window title to almost the same +# Debian-style. +# +# The prompt will use a Debian-style on the form +# +# [user@host: ] [bash-git-prompt-info] +# HH:MM $ +# +# The window title will have the form +# user@host: +# +# Example usage: +# if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then +# GIT_PROMPT_THEME=TruncatedPwd_WindowTitle_NoExitState +# source ~/.bash-git-prompt/gitprompt.sh +# fi +# +# oGre [https://github.com/ogr3] +############################################################################## +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="TruncatedPwd_WindowTitle_NoExitState" + + #Overrides the prompt_callback function used by bash-git-prompt + function prompt_callback { + local PS1="\u@\h: $(gp_truncate_pwd)" + gp_set_window_title "${PS1}" + echo -n "${Yellow}[${PS1}]${ResetColor}" + } + + local gp_end=" _LAST_COMMAND_INDICATOR_\n${White}${Time12a}${ResetColor}" + + GIT_PROMPT_START_USER="" + GIT_PROMPT_END_USER="${gp_end} $ " + GIT_PROMPT_END_ROOT="${gp_end} # " +} + +reload_git_prompt_colors "TruncatedPwd_WindowTitle_NoExitState" diff --git a/dotfiles/.bash-git-prompt/themes/TruncatedPwd_WindowTitle_NoExitState_Ubuntu.bgptheme b/dotfiles/.bash-git-prompt/themes/TruncatedPwd_WindowTitle_NoExitState_Ubuntu.bgptheme new file mode 100644 index 0000000..1d4a1d0 --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/TruncatedPwd_WindowTitle_NoExitState_Ubuntu.bgptheme @@ -0,0 +1,46 @@ +############################################################################## +# Changes the prompt to a Debian-style one that truncates pwd to a max length +# depending on the terminal column width. Also uses the prompt_callback +# function of bash-git-prompt to set the window title to almost the same +# Debian-style. This version has been tweaked for Ubuntu standard terminal +# fonts. +# +# The prompt will use a Debian-style on the form +# +# [user@host: ] [bash-git-prompt-info] +# HH:MM $ +# +# The window title will have the form +# user@host: +# +# Example usage: +# if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then +# GIT_PROMPT_THEME=TruncatedPwd_WindowTitle_NoExitState_Ubuntu +# source ~/.bash-git-prompt/gitprompt.sh +# fi +# +# oGre [https://github.com/ogr3] +############################################################################## +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="TruncatedPwd_WindowTitle_NoExitState_Ubuntu" + + #Overrides the prompt_callback function used by bash-git-prompt + function prompt_callback { + local PS1="\u@\h: $(gp_truncate_pwd)" + gp_set_window_title "${PS1}" + echo -n "${Yellow}[${PS1}]${ResetColor}" + } + + local gp_end=" _LAST_COMMAND_INDICATOR_\n${White}${Time12a}${ResetColor}" + + GIT_PROMPT_START_USER="" + GIT_PROMPT_END_USER="${gp_end} $ " + GIT_PROMPT_END_ROOT="${gp_end} # " + + GIT_PROMPT_STAGED="${Red}● " # the number of staged files/directories + GIT_PROMPT_CLEAN="${BoldGreen}✔ " # a colored flag indicating a "clean" repo + GIT_PROMPT_COMMAND_OK="${Green}✔ " # indicator if the last command returned with an exit code of 0 + GIT_PROMPT_COMMAND_FAIL="${Red}✘ " # indicator if the last command returned with an exit code of other than 0 +} + +reload_git_prompt_colors "TruncatedPwd_WindowTitle_NoExitState_Ubuntu" diff --git a/dotfiles/.bash-git-prompt/themes/TruncatedPwd_WindowTitle_Ubuntu.bgptheme b/dotfiles/.bash-git-prompt/themes/TruncatedPwd_WindowTitle_Ubuntu.bgptheme new file mode 100644 index 0000000..709497b --- /dev/null +++ b/dotfiles/.bash-git-prompt/themes/TruncatedPwd_WindowTitle_Ubuntu.bgptheme @@ -0,0 +1,45 @@ +############################################################################## +# Changes the prompt to a Debian-style one that truncates pwd to a max length +# depending on the terminal column width. Also uses the prompt_callback +# function of bash-git-prompt to set the window title to almost the same +# Debian-style. This version has been tweaked for Ubuntu standard terminal +# fonts. +# +# The prompt will use a Debian-style on the form +# +# [user@host: ] [bash-git-prompt-info] +# HH:MM $ +# +# The window title will have the form +# user@host: +# +# Example usage: +# if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then +# GIT_PROMPT_THEME=TruncatedPwd_WindowTitle_Ubuntu +# source ~/.bash-git-prompt/gitprompt.sh +# fi +# +# oGre [https://github.com/ogr3] +############################################################################## +override_git_prompt_colors() { + GIT_PROMPT_THEME_NAME="TruncatedPwd_WindowTitle_Ubuntu" + + #Overrides the prompt_callback function used by bash-git-prompt + function prompt_callback { + local PS1="\u@\h: $(gp_truncate_pwd)" + gp_set_window_title "${PS1}" + echo -n "${Yellow}[${PS1}]${ResetColor}" + } + + local gp_end=" _LAST_COMMAND_INDICATOR_\n${White}${Time12a}${ResetColor}" + + GIT_PROMPT_START_USER="" + GIT_PROMPT_END_USER="${gp_end} $ " + GIT_PROMPT_END_ROOT="${gp_end} # " + + GIT_PROMPT_STAGED="${Red}● " # the number of staged files/directories + GIT_PROMPT_CLEAN="${BoldGreen}✔ " # a colored flag indicating a "clean" repo + GIT_PROMPT_COMMAND_OK="${Green}✔ " # indicator if the last command returned with an exit code of 0 +} + +reload_git_prompt_colors "TruncatedPwd_WindowTitle_Ubuntu" diff --git a/dotfiles/.bash_completion b/dotfiles/.bash_completion new file mode 100644 index 0000000..abe7b0f --- /dev/null +++ b/dotfiles/.bash_completion @@ -0,0 +1,8 @@ +_eotoctoc() +{ + local cur prev words cword + _init_completion -n = || return + + _known_hosts_real "" +} && +complete -F _eotoctoc eotoctoc diff --git a/dotfiles/.bashrc b/dotfiles/.bashrc new file mode 100644 index 0000000..72fae14 --- /dev/null +++ b/dotfiles/.bashrc @@ -0,0 +1,162 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +export DEBEMAIL="tnoel@entrouvert.com" +export DEBFULLNAME="Thomas NOEL" + +# If not running interactively, don't do anything +case $- in + *i*) ;; + *) return;; +esac + +cat ~/TODO 2> /dev/null || /bin/true + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL="erasedups:ignoreboth" +# Don't record some commands +export HISTIGNORE="&:[ ]*:exit:ls:bg:fg:history:clear" +# Useful timestamp format +HISTTIMEFORMAT='%F %T ' +# Record each line as it gets issued +PROMPT_COMMAND='history -a' +# Avoid duplicate entries +# Append to the history file, don't overwrite it +shopt -s histappend +# Save multi-line commands as one command +shopt -s cmdhist +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=500000 +HISTFILESIZE=100000 + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + + +# If set, the pattern "**" used in a pathname expansion context will +# match all files and zero or more directories and subdirectories. +#shopt -s globstar + +# make less more friendly for non-text input files, see lesspipe(1) +#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm-color) color_prompt=yes;; +esac + +# uncomment for a colored prompt, if the terminal has the capability; turned +# off by default to not distract the user: the focus in a terminal window +# should be on the output of commands, not on the prompt +#force_color_prompt=yes + +if [ -n "$force_color_prompt" ]; then + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes + else + color_prompt= + fi +fi + +if [ "$color_prompt" = yes ]; then + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' +else + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' +fi +unset color_prompt force_color_prompt + +# If this is an xterm set the title to user@host:dir +case "$TERM" in +xterm*|rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + ;; +*) + ;; +esac + +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + #alias grep='grep --color=auto' + #alias fgrep='fgrep --color=auto' + #alias egrep='egrep --color=auto' +fi + +# some more ls aliases +#alias ll='ls -l' +#alias la='ls -A' +#alias l='ls -CF' + +# Alias definitions. +# You may want to put all your additions into a separate file like +# ~/.bash_aliases, instead of adding them here directly. +# See /usr/share/doc/bash-doc/examples in the bash-doc package. + +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi +complete -F _known_hosts eotoctoc +. /usr/share/bash-completion/completions/aptitude +complete -F _aptitude apt + +. ~/.bash-git-prompt/gitprompt.sh +GIT_PROMPT_START='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w' +GIT_PROMPT_END='\$ ' + +# Automatically trim long paths in the prompt (requires Bash 4.x) +PROMPT_DIRTRIM=2 + +# Prevent file overwrite on stdout redirection +set -o noclobber + + +## SMARTER TAB-COMPLETION (Readline bindings) ## + +# Perform file completion in a case insensitive fashion +bind "set completion-ignore-case on" +# Treat hyphens and underscores as equivalent +#bind "set completion-map-case on" +# Display matches for ambiguous patterns at first tab press +bind "set show-all-if-ambiguous on" + + +## BETTER DIRECTORY NAVIGATION ## + +# Prepend cd to directory names automatically +#shopt -s autocd +# Correct spelling errors during tab-completion +#shopt -s dirspell +# Correct spelling errors in arguments supplied to cd +#shopt -s cdspell + +# This defines where cd looks for targets +# Add the directories you want to have fast access to, separated by colon +# Ex: CDPATH=".:~:~/projects" will look for targets in the current working directory, in home and in the ~/projects folder +CDPATH=".:~/dev/publik/src/" + diff --git a/dotfiles/.mailcap b/dotfiles/.mailcap new file mode 100644 index 0000000..e7d33bc --- /dev/null +++ b/dotfiles/.mailcap @@ -0,0 +1,5 @@ +text/calendar; /home/thomas/bin/vcalendar-filter; copiousoutput +application/pdf; mutt-pdf %s +image/*; eog %s +text/html; firefox %s; nametemplate=%s.html +text/html; w3m -dump %s; nametemplate=%s.html; copiousoutput