diff options
author | Leonid Volnitsky <Leonid@Volnitsky.com> | 2008-12-04 17:44:56 +0200 |
---|---|---|
committer | Leonid Volnitsky <Leonid@Volnitsky.com> | 2008-12-04 17:44:56 +0200 |
commit | b080374cc32752b479bdba91a1b3f0f923bb4b61 (patch) | |
tree | c36883e45de4ac2358fc1ee7868f342171ed3f30 | |
parent | -- (diff) | |
download | git-prompt-b080374cc32752b479bdba91a1b3f0f923bb4b61.tar.gz git-prompt-b080374cc32752b479bdba91a1b3f0f923bb4b61.tar.bz2 git-prompt-b080374cc32752b479bdba91a1b3f0f923bb4b61.zip |
fixed: file list tunctation on esc
-rw-r--r-- | git-prompt.sh | 16 | ||||
-rw-r--r-- | index.txt | 64 |
2 files changed, 66 insertions, 14 deletions
diff --git a/git-prompt.sh b/git-prompt.sh index 4aa962b..86c707c 100644 --- a/git-prompt.sh +++ b/git-prompt.sh @@ -41,6 +41,7 @@ max_untracked=2 max_modified=4 max_added=4 + max_file_list_lengh=100 ##################################################################### post config @@ -430,12 +431,19 @@ parse_vcs_dir() { ### file list unset file_list - [[ ${added_files[1]} ]] && file_list+=" "$added_vcs_color${added_files[@]:1:$max_added}${added_files[$max_added+1]:+...} - [[ ${modified_files[1]} ]] && file_list+=" "$modified_vcs_color${modified_files[@]:1:$max_modified}${modified_files[$max_modified+1]:+...} - [[ ${untracked_files[1]} ]] && file_list+=" "$untracked_vcs_color${untracked_files[@]:1:$max_untracked}${untracked_files[$max_untracked+1]:+...} + #[[ ${added_files[1]} ]] && file_list+=" "$added_vcs_color${added_files[@]:1:$max_added}${added_files[$max_added+1]:+...} + #[[ ${modified_files[1]} ]] && file_list+=" "$modified_vcs_color${modified_files[@]:1:$max_modified}${modified_files[$max_modified+1]:+...} + #[[ ${untracked_files[1]} ]] && file_list+=" "$untracked_vcs_color${untracked_files[@]:1:$max_untracked}${untracked_files[$max_untracked+1]:+...} + [[ ${added_files[1]} ]] && file_list+=" "$added_vcs_color${added_files[@]} + [[ ${modified_files[1]} ]] && file_list+=" "$modified_vcs_color${modified_files[@]} + [[ ${untracked_files[1]} ]] && file_list+=" "$untracked_vcs_color${untracked_files[@]} [[ ${vim_files} ]] && file_list+=" "${RED}VIM:${vim_files} file_list=${file_list:+:$file_list} - file_list=${file_list:0:100} # max lenth + + if [[ ${#file_list} -gt $max_file_list_lengh ]] ; then + file_list=${file_list:0:100} + file_list="${file_list% *} ..." + fi tail_local="($vcs_info$vcs_color${file_list}$vcs_color)" @@ -1,38 +1,82 @@ = GIT Prompt - -Get it from github: http://github.com/lvv/git-prompt/tree/master/git-prompt.sh[git-prompt.sh] + - git clone - -More info in http://github.com/lvv/git-prompt/tree/master/README[README] +:compact-option: compact == Basic Usage image:screenshot-prompt-basic.png[basic usage] -[red]*1* is `false(1)` exit code. Hosts are colored as configured in `git-prompt.sh` file. +Number [red]*1* is `false(1)` exit code. Hosts are colored as configured in `git-prompt.sh` file. == GIT Branch and files are colored according to state. "M" stands for master. +image:screenshot-prompt-git.png[git module] + [cols="3,8",frame="topbot",options="header"] |================================================================ | Color | Meaning | [green]#green# | Modified or new file. Modifications are in index but not in repo yet. | [red]#red# | Modified and tracked by repo, but modifications not added to index yet. -| [lightblue]#light blue# | Untracked file. +| [blue]#light blue# | Untracked file. | [darkblue]#blue branch# | Clean | [red]#red# or [magenta]#magenta# branch | In middle of doing something or detached head. |================================================================ -image:screenshot-prompt-git.png[git module] - == Subversion - ... == Labels ... + +== Install +Download link:git-prompt.sh[] or get with GIT: + +[source,sh] +------------------ + git clone git://github.com/lvv/git-prompt.git +--------------- + +Put following command in our profile in interactive section: + +[source,sh] +--------------------- + . /path/to/git-prompt.sh +--------------------- + +If there are no interactivity test in your profile, then above command should be: + +[source,sh] +-------------------- + [[ $- == *i* ]] && . /etc/git-prompt.sh +--------------------- + +== DEPENDENCY + +Most of dependencies (except git and svn) are probably already installed on your host. + +- bash (tested with v3.2.33) +- git (optional) +- svn (optional) +- sed +- tput (terminfo) +- tty (core utils) +- grep +- locale (glibc) +- id (core utils) + + +== TODO + +- TO FIX: when file list is too long, git-prompt truncates it. Sometimes this truncation can be on color escape sequence. +- external config at `/etc/git-prompt.conf` and `~/.git-prompt.conf` +- new mail (howto at: `http://kikhome.net/?p=11` ) +- ctrl-Z subshell indicator +- wiki/screenshots for labels and svn module +- VIM module needs to be moved out of GIT module +- make module (to show generated, stale files) +- How detect current merge? (current method through .git/MERGE_HEAD not always works) + |