From fad9f4f28a90cb744d6d76b3e2e4019572711ee4 Mon Sep 17 00:00:00 2001 From: Leonid Volnitsky Date: Wed, 17 Mar 2010 22:09:07 +0200 Subject: -- completion docs/cleanup --- Makefile | 13 +++++++++++-- git-prompt.sh | 20 +++++++++----------- index.txt | 15 +++++++++++++-- 3 files changed, 33 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 5fb2098..27631ce 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,16 @@ -HOMEDIR ?= /home/lvv/p/volnitsky.com/ -include $(HOMEDIR)/include.mk +ifeq ($(USER),lvv) + HOMEDIR := /home/lvv/p/volnitsky.com/ + INCLUDE := $(HOMEDIR)/include.mk +else + INCLUDE := /dev/null +endif + +include $(INCLUDE) + + COPY_LIST = git-prompt.sh + install: cp -v git-prompt.sh /etc/ [ -f /etc/git-prompt.conf ] || cp -v git-prompt.conf /etc/ diff --git a/git-prompt.sh b/git-prompt.sh index 83c2d76..a4c7216 100755 --- a/git-prompt.sh +++ b/git-prompt.sh @@ -379,11 +379,8 @@ parse_hg_status() { vcs_info=${branch/default/D} } -alias g='git' -# parse git complete -parse_git_complete() -{ +parse_git_complete() { if [ "${BASH_VERSION%.*}" \< "3.0" ]; then # echo "You will need to upgrade 'bash' to version 3.0 \ # for full programmable completion features (bash complete) \ @@ -391,13 +388,14 @@ parse_git_complete() return fi - complete -f -W "$(echo `git branch -a | sed -e s/[\ \*]//g | cut -f 1 -d ' ' | uniq`; \ - echo `git remote | sed -e s/[\ \*]//g | cut -f 1 -d ' ' | uniq`; \ - echo `git | tail -23 | head -21 | cut -d ' ' -f 4`; \ - echo '--help'; \ - echo '--staged'; \ - echo 'remote'; \ - echo 'help'; \ + complete -f -W "$( + echo `git branch -a | sed -e s/[\ \*]//g | cut -f 1 -d ' ' | uniq`; \ + echo `git remote | sed -e s/[\ \*]//g | cut -f 1 -d ' ' | uniq`; \ + echo `git | tail -23 | head -21 | cut -d ' ' -f 4`; \ + echo '--help'; \ + echo '--staged'; \ + echo 'remote'; \ + echo 'help'; \ )" g git } diff --git a/index.txt b/index.txt index b810288..a0c3b84 100644 --- a/index.txt +++ b/index.txt @@ -72,7 +72,7 @@ to directories you once visited. Git-prompt have builtin, simplified autojump. It is only about 10 lines of code (vs original 100+ LOC), there is no database. It remembers only directories from current session. It selects not most frequent dir, but last visited. Matches are done from beginning of of -dir name. +dir name (not path name). ----------------- cd /tmp @@ -87,6 +87,16 @@ j .*3 # same as cd "~/long dir mp3" ------------- +== Bash Completion + +Completion can be done for git subcommands, branches and remotes: + +--------------------- +git ch # expands to git checkout +git checkout ma # expands to git checkout master +-------------------- + + == Install Download link:git-prompt.sh[] or get it with GIT: @@ -174,11 +184,12 @@ time consuming ops in postconfig which is executed only once. == Authors - Leonid Volnitsky (original author) , http://volnitsky.com - Niklas Hofer (CWD truncation) , httpx://github.com/niklas/[] -- Lee Nussbaum (HG support) lee.nussbaum AT gmail.com, httpx://github.com/wln[] +- Lee Nussbaum (HG support) , httpx://github.com/wln[] - Albert Vernon http://xenoclub.wordpress.com[] - Amir Yalon httpx://github.com/amiryal[] - Martin httpx://github.com/jerrywho[] - Alexander Goldstein (emacs-shell, prompt chars) httpx://github.com/alexg0[] +- Dmitry (bash completion) [bibliography] -- cgit v1.2.3