Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new modules for battery status, makefile, foreground jobs, made modules reorderable, plus other fixes and upgrades #36

Open
wants to merge 118 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
3df2929
-Fix: typo in variable name
Sep 21, 2013
f774e01
-Fix: better detection of UTF-8, add flag to track UTF-8-ness
Sep 21, 2013
6c232e8
-Fix: use UTF-8 arrow chars in git report only if utf8_prompt flag se…
Sep 21, 2013
93bc3ac
-Add: battery module
Sep 21, 2013
054c5c7
-Add: make module
Sep 21, 2013
5dadee4
-Add: jobs module (background/stopped jobs)
Sep 21, 2013
a34699a
-Add: highlight slashes in path with different color
Sep 21, 2013
dc731d6
-Change: different color for '@'
Sep 21, 2013
5d6be0d
-Change: different color for prompt
Sep 21, 2013
ac54b39
-Add: default user name and host suppression now configurable, can be…
Sep 21, 2013
1bcaacd
-Fix: upcase host name only if it's not abbreviated
Sep 21, 2013
d2b934a
-Fix: typo in variable name
Sep 21, 2013
f41a4ef
-Fix: force git status to print English messages
Sep 22, 2013
ee4c52d
-Fix: backslash in id needs to be escaped if colorized
Sep 22, 2013
f696b8f
-Fix: rc module can be switched off
Sep 22, 2013
1e0c8ce
-Fix: suppress printing of error code after the first time
Sep 22, 2013
181e5d2
-Add: option to disable make status check for a list of directories
Sep 22, 2013
7e4b041
-Remove: tail_local (unused variable)
Sep 22, 2013
4ed392a
-Fix: use == in tests
Sep 22, 2013
51f5b0c
-Fix: virtualenv uses its own string instead of abusing rc
Sep 22, 2013
957ece2
-Change: remove explicit spaces from module outputs; order of modules…
Sep 22, 2013
f8fbed4
-Add: display revision for hg
Sep 22, 2013
8c203b9
-Add: note about svn module being broken
Sep 22, 2013
888c6b0
-Add: config file with personal favorite options
Sep 22, 2013
8ce4a25
-Fix: some cleanup, use local variables in functions
Sep 22, 2013
19f98be
-Fix: return empty make indicator if directory was in ignore list
Sep 22, 2013
ad7b930
-Fix: better UTF-8 detection
Sep 22, 2013
653e4fb
-Fix: remove PROMPT from reorderable config, this eliminates an unwan…
Sep 23, 2013
1d011f1
-Update: docs with new features
Sep 23, 2013
02e4aa6
-Update: docs language cleanup, added new dependencies and author note
Sep 23, 2013
f5caae8
-Fix: TERM in case of screen may be screen-256colors, take that into …
Sep 28, 2013
fd5a61f
-Fix: remove PROMPT from order string in personal conf
Sep 28, 2013
587b9b9
-Fix: correct logical operator in test for acpi presence and output
Sep 28, 2013
d23b4f0
-Add: detection of remote session via SSH[2]_CLIENT
Sep 28, 2013
bc64e9c
-Fix: remote session abbrev condition
Sep 28, 2013
ad52c3b
-Fix: no upcase host in personal conf
Sep 28, 2013
0e23f94
-Add: display @ before host in different color if remote session
Sep 28, 2013
2685f91
-Fix: replace hardcoded unprintable characters in xterm label escape …
Sep 28, 2013
39e884e
-Fix: workaround screen UTF-8 bug with abbreviated host and id
Sep 28, 2013
7e91c7a
-Add: track deleted files in svn/hg (TODO for git); -Fix: remove mixe…
Sep 29, 2013
83529e6
-Fix: suppress warning from which when detecting make and acpi
Sep 30, 2013
8188403
-Fix: issue colors_reset after jobs indicator
Oct 1, 2013
e92be99
-Fix: try to salvage some functionality in mc (abbreviated id and hos…
Oct 1, 2013
64a6c24
-Fix: use different character if revision number shown for hg
Oct 2, 2013
3452514
-Fix: use local variables in hg section
Oct 2, 2013
0ea7d68
-Add: show multiple heads for hg
Oct 2, 2013
3980ffb
-Fix: svn detection based on svn info for >1.7 svn
Oct 4, 2013
5f2a4bc
-Fix: stupid mistakes
Oct 4, 2013
9163167
-Add: display if hg working dir is not at tip
Oct 11, 2013
7251a79
-Fix: changed hg wd up-to-date flag location and color to make it dis…
Oct 12, 2013
4739c3c
-Add: color slashes differently if pwd is not writable
Oct 12, 2013
149a551
-Add: functions to turn fancy prompt on and off
Oct 12, 2013
5f2ff18
-Change: better mark for hg wd not up to date (fat up arrow)
Oct 12, 2013
7299ab2
-Change: revise svn revision info logic, use svnversion if installed
Oct 13, 2013
39cdc04
-Fix: typo in comment
Oct 13, 2013
2a04c55
-Add: list conflicted files for svn
Oct 13, 2013
dd8efaa
-Change: reorder elments in vcs file list
Oct 13, 2013
6594b60
-Fix: reset colors after vcs_info in svn module
Oct 13, 2013
8b7c734
-Add: display conflicted and deleted files for git
Oct 13, 2013
ff1c30f
[hg_module] -Fix: different way of pushing file onto file list array …
Oct 13, 2013
94e6acd
[svn_module] -Fix: different way of pushing file onto file list array…
Oct 13, 2013
c3d767a
[git_module] -Fix: different way of pushing file onto file list array…
Oct 13, 2013
3d2c9d4
-Fix: slashes in cwd were not colorized when cwd was truncated (weird…
Oct 13, 2013
721560f
-Add: command_time module that displays time elapsed while last comma…
Oct 13, 2013
9fdca71
-Add: load module
Oct 13, 2013
83b37c2
[svn_module] -Fix: svnversion 1.7 produces different output in unvers…
Oct 13, 2013
1e0daa3
-Fix: broken non-portable method of extracting load from uptime output
Oct 13, 2013
4ef7cb3
-Change: use utf-8 block chars to display load
Oct 13, 2013
db57202
[load_module] -Fix: remove all leading zeros from load_value to avoid…
Oct 14, 2013
463c272
[load_module] -Fix: configurable colors and style
Oct 14, 2013
07bf1e2
[conf] -Fix: removed obsolete PROMPT from order string
Oct 14, 2013
e25ecab
-Fix: minor indentation (the whole thing is in dire need of reformatt…
Oct 14, 2013
0ec7e36
[load_module] -Fix: properly remove leading zeroes from load value (p…
Oct 16, 2013
54ec53c
-Fix: small optimization to vcs status parsing: don't set status vari…
Oct 17, 2013
75e6a81
[load_module] -Fix: suppress display of load if it's exactly load_thr…
Oct 17, 2013
7bf9d6e
[git_module] -Add: stash detection and display
Oct 17, 2013
303e74c
-Add: clock module with optional alert interval
Oct 18, 2013
aace46a
[clock] -Fix: check for utf8, fall back to digital if unavailable
Oct 18, 2013
cf0df0a
[load] -Fix: stricter test for user-overridden defaults; better docum…
Oct 18, 2013
a9fdf3b
[clock] -Fix: array index calculation for analog clock
Oct 18, 2013
cc43538
-Fix: some cleanup (unset, local)
Oct 18, 2013
bc8a847
[vcs] -Fix: simplify revision parsing for svn and hg
Oct 18, 2013
6c4dedf
[clock] -Fix: array index calculation for analog clock (really fix it)
Oct 18, 2013
b101a9a
[load] -Fix: replaced full block character with inverse circle so tha…
Oct 19, 2013
4d0632f
[hg] -Fix: instead of calling hg root, hg branch and hg id separately…
Oct 19, 2013
a19d810
-Fix: set window and pane titles with tmux as well as screen
Oct 19, 2013
361d52c
-Fix: remove dead code from section that sets screen window number, a…
Oct 19, 2013
9ad879e
-Add: replace screen tty number with unicode circled numbers
Oct 19, 2013
c1bb420
[load] -Fix: on linux, read load from /proc/loadavg
Oct 20, 2013
19deaa6
-Add: display tmux session name in xterm title
Oct 20, 2013
10288e1
-Fix: display tmux session name in xterm title, a bit more safely
Oct 20, 2013
dd94581
[hg] -Fix: older hg versions' 'hg log' report empty branch name if de…
Oct 21, 2013
02b4c1e
[screen] -Fix: don't display tty number if xterm is screen but or i…
Oct 21, 2013
9b3149a
[screen] -Fix: don't display tty number if xterm is screen but or i…
Oct 21, 2013
4153458
[screen] -Fix: display host name in screen/tmux window title if remot…
Oct 21, 2013
5a0247d
-Fix: don't display // in screen/xterm title if in root dir
Oct 22, 2013
099ec06
-Fix: more reliable ssh session detection via $SSH_CONNECTION variable
Oct 23, 2013
0a405c8
[set_shell_label] -Fix: display host name in screen/tmux window name …
Oct 23, 2013
402b510
[set_shell_label] -Fix: forgotten variable name in previous commit
Oct 23, 2013
529ce57
-Fix: get id and tty in a function; more robust tmux session and tty …
Oct 29, 2013
2446732
-Fix: add new runtime functions to enable/disable utf8, separate host…
Nov 16, 2013
483e77d
-Fix: at_color logic, don't swallow one dot from abbreviated host name
Nov 16, 2013
19887ae
-Fix: suppress svnversion's stderr, return on error
Nov 23, 2013
7172a9d
[git] -Fix: git status in git 1.8 omits #'s, fixed regexps to parse n…
Dec 13, 2013
29affa9
[git] -Fix: previous commit broke ahead/behind detection
Dec 13, 2013
77fe951
-Fix: recent refactoring broke mc special case, apply bandaid
Jan 9, 2014
e206c7d
[git] -Fix: show locally deleted files for git
Jan 9, 2014
a10a8dc
[hg] -Fix: suppress stderr of hg heads
Jan 23, 2014
a242d01
[hg] -Fix: use more backwards compatible hg log template to get branc…
Jun 2, 2014
fc222fb
-Fix: escape backslahses in VCS names lists
Oct 19, 2014
6853a51
-Fix: hack for mc-wrapper on Fedora/Centos
pjuhasz Oct 6, 2015
c75c2fb
[hg] -Add: support for hg phase
pjuhasz Oct 7, 2015
20ac93e
[sudo] -Add: sudo module
xhabit Oct 14, 2015
ff4238c
-Fix: unset color var at init to avoid warning when running repeatedly
xhabit Nov 23, 2017
a654ed2
-Fix: display first (0th) battery status from acpi output
xhabit May 22, 2019
66731d6
[battery] -Change: no longer use acpi -b to get battery status, its o…
xhabit May 27, 2019
3019280
[tmux] -Fix: tty/tmux session breakage (because tmux display-message …
pjuhasz Dec 26, 2023
6882147
[vcs] -Fix: dim color tput command, and change hex_vcs_color default …
pjuhasz Dec 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 74 additions & 2 deletions git-prompt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# max_file_list_length=100 # in characters
# count_only=off # off - display file list; on - display file count
# rawhex_len=5 # length of git rawhex revision id display (use 0 to hide it)
# enable_utf8=on # use utf8 characters in prompt

############################################################ MODULES

Expand All @@ -20,10 +21,30 @@
# hg_module=on
# vim_module=on
# virtualenv_module=on
# battery_module=off
# make_module=off
# jobs_module=on
# rc_module=on
# command_time_module=on
# clock_module=off
# load_module=on
# sudo_module=off


### Order of modules
# prompt_modules_order="RC LOAD CLOCK CTIME VIRTUALENV VCS SUDO WHO_WHERE JOBS BATTERY CWD MAKE"

########################################################### DEFAULT OBJECTS
### Default objects are not displayed. Example:
### Default user and hostname can be abbreviated or suppressed.
### Valid settings:
### * keep - display fully
### * abbrev - abbreviate to first character
### * delete - do not display at all

# default_host_abbrev_mode=delete
# default_id_abbrev_mode=delete

### Examples:

## default_user=lvv
## default_host="ahp" # remote host is always shown
Expand All @@ -46,17 +67,67 @@
# they are always dirty (ex: home, /etc) or directory with huge repo (ex: linux src)
## vcs_ignore_dir_list=" /etc $HOME /usr/src/linux.git "

# Do not check make status for listed directories
# useful for large projects where make -q would take several seconds
## make_ignore_dir_list=" /etc $HOME /usr/src/linux.git "

### Display revision number for Mercurial repositories
### valid options:
### * num - display local revision number
### * id - display global revision id (hex string, truncated to rawhex_len characters
### * none - do not display at all
# hg_revision_display=none

### Check for and display multiple hg heads
# hg_multiple_heads_display=on

### Display elapsed time used by long-running command if it's above this threshold:
### (seconds)
# command_time_threshold=15

### Colors and color change thresholds for load display.
### If the load is under the first value in the list, the display is supressed.
### Both have to be arrays with the same number of elements
# load_colors=(BLACK red RED whiteonred)
# load_thresholds=(100 200 300 400)

### Display style for load
### valid options:
### * markonly # only display the mark, supress the value
### * numeric # display mark and numeric value
### * bar # display mark and unicode bar chart
# load_display_style=bar


### Clock options
### Display style - analog or digital
# clock_style=analog

### Alert interval, in minutes
### if 0, clock is always shown, otherwise it's displayed only every x minutes
# clock_alert_interval=30

########################################################### COLOR

### directory, exit code, root color

# cols=`tput colors`
# if [[ -n "$cols" && $cols -ge 8 ]]; then # if terminal supports colors
# dir_color=CYAN
# slash_color=BLUE
# slash_color_readonly=MAGENTA
# prompt_color=white
# rc_color=red
# virtualenv_color=green
# user_id_color=blue
# root_id_color=magenta
# make_color_ok=BLACK
# make_color_dirty=RED
# jobs_color_bkg=yellow
# jobs_color_stop=red
# at_color=green
# at_color_remote=RED
# clock_color=BLACK
# else # B/W terminal
# dir_color=bw_bold
# rc_color=bw_bold
Expand Down Expand Up @@ -86,8 +157,9 @@
# clean_vcs_color=blue # nothing to commit (working directory clean)
# modified_vcs_color=red # Changed but not updated:
# added_vcs_color=green # Changes to be committed:
# mixed_vcs_color=yellow #
# untracked_vcs_color=BLUE # Untracked files:
# deleted_vcs_color=yellow # Deleted files:
# conflicted_vcs_color=CYAN # Conflicted files:
# op_vcs_color=MAGENTA
# detached_vcs_color=RED
# hex_vcs_color=BLACK # git revision id: bright black (makes gray)
Expand Down
170 changes: 170 additions & 0 deletions git-prompt.conf.mine
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@

### GIT-PROMPT.SH CONFIG
###
### lines commented-out with single '#' are default values
### lines commented-out with double '##' are examples
###
### NOTE: this is bash syntax - no spaces around "="

###########################################################

# error_bell=off # sound terminal bell when command return code is not zero. (use setterm to set pitch and duration)
max_file_list_length=30 # in characters
count_only=on # off - display file list; on - display file count
# rawhex_len=5 # length of git rawhex revision id display (use 0 to hide it)
# enable_utf8=on # use utf8 characters in prompt

############################################################ MODULES

# git_module=on
svn_module=on
# hg_module=on
vim_module=off
virtualenv_module=off
battery_module=on
make_module=on
# jobs_module=on
rc_module=on
command_time_module=on
load_module=on
clock_module=on
sudo_module=on


### order of modules
prompt_modules_order="RC LOAD CLOCK CTIME VIRTUALENV SUDO WHO_WHERE JOBS BATTERY CWD VCS MAKE"

########################################################### DEFAULT OBJECTS
### Default user and hostname can be abbreviated or suppressed.
### Valid settings:
### * keep - display fully
### * abbrev - abbreviate to first character
### * delete - do not display at all

default_host_abbrev_mode=abbrev
default_id_abbrev_mode=abbrev

### Examples:

default_user=kikuchiyo
default_host=aryabhata # remote host is always shown
## default_domain="lvvnet"

########################################################### Current Working Dir display
# cwd_cmd='\w' # display full path
## cwd_cmd='\W' # display only last dir of path
cwd_cmd='cwd_truncate $(($COLUMNS/4))' # display only last N chars of path

########################################################### ETC

# Some don't like hostname in uppercase
upcase_hostname=off # =off
# Some don't like long hostname
# short_hostname=off # =on

# Do not do VCS parsing for listed directories
# useful for directories for which it is difficult to maintain .gitignore so
# they are always dirty (ex: home, /etc) or directory with huge repo (ex: linux src)
## vcs_ignore_dir_list=" /etc $HOME /usr/src/linux.git "

# Do not check make status for listed directories
# useful for large projects where make -q would take several seconds
make_ignore_dir_list=" /etc $HOME /usr/src/linux.git "

### Display revision number for Mercurial repositories
### valid options:
### * num - display local revision number
### * id - display global revision id (hex string, truncated to rawhex_len characters
### * none - do not display at all
hg_revision_display=num

### Check for and display multiple hg heads
# hg_multiple_heads_display=on

### Display elapsed time used by long-running command if it's above this threshold:
### (seconds)
# command_time_threshold=15

### Colors and color change thresholds for load display.
### If the load is under the first value in the list, the display is supressed.
### Both have to be arrays with the same number of elements
# load_colors=(BLACK red RED whiteonred)
# load_thresholds=(100 200 300 400)

### Display style for load
### valid options:
### * markonly # only display the mark, supress the value
### * numeric # display mark and numeric value
### * bar # display mark and unicode bar chart
# load_display_style=bar

### Clock options
### Display style - analog or digital
clock_style=analog

### Alert interval, in minutes
### if 0, clock is always shown, otherwise it's displayed only every x minutes
clock_alert_interval=30

########################################################### COLOR

### directory, exit code, root color

# cols=`tput colors`
# if [[ -n "$cols" && $cols -ge 8 ]]; then # if terminal supports colors
dir_color=BLUE
slash_color=CYAN
slash_color_readonly=MAGENTA
prompt_color=colors_reset
rc_color=red
virtualenv_color=green
user_id_color=GREEN
root_id_color=magenta
make_color_ok=BLACK
make_color_dirty=RED
jobs_color_bkg=yellow
jobs_color_stop=red
at_color=green
at_color_remote=RED
clock_color=WHITE
sudo_color=RED

# else # B/W terminal
# dir_color=bw_bold
# rc_color=bw_bold
# fi

### prompt character for root/non-root, default '>' for both
# prompt_char='>'
# root_prompt_char='>'
prompt_char='$'
## prompt_char='➔'
root_prompt_char='#'

##### Per host color

### Per host color. If not set, color will be derived from hostname checksum).
### Variable name is uppercase-short-hostname with appended "_host_color"
### Example per-host-color config:

## TASHA_host_color=cyan
## AL_host_color=green
## AHP_host_color=white
ARYABHATA_host_color=green
PALATABLA_host_color=cyan

##### VCS (version control system) state colors

# init_vcs_color=WHITE # initial
# clean_vcs_color=blue # nothing to commit (working directory clean)
# modified_vcs_color=red # Changed but not updated:
# added_vcs_color=green # Changes to be committed:
# untracked_vcs_color=BLUE # Untracked files:
# deleted_vcs_color=yellow # Deleted files:
# conflicted_vcs_color=CYAN # Conflicted files:
# op_vcs_color=MAGENTA
# detached_vcs_color=RED
# hex_vcs_color=white # git revision id: bright black (makes gray)


# :vim:ft=sh ts=8 sw=8 et:
Loading