From a5444b54a65020aa82e78d05b7eb45f78c90429e Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 8 Sep 2012 15:07:43 +0900 Subject: [PATCH 1/4] add git alias clean-p --- setup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.sh b/setup.sh index 3c7499a..513bda4 100755 --- a/setup.sh +++ b/setup.sh @@ -61,6 +61,7 @@ git_config(){ # git config --global alias.my-ls "ls-files | xargs ls" # git config --global alias.ll "!git ls-files | xargs ls -l -CFG --color=auto --time-style=long-iso" git config --global alias.addi "add -i" + git config --global alias.clean-p "!test -z \"\$(git status -s -uno)\"" if false iswindows; then git config --global core.fileMode false fi From fe54c9c1fa8a4ca8330ad5688485f43b8b0803d7 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 10 Sep 2012 13:17:31 +0900 Subject: [PATCH 2/4] fix o --- bashrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bashrc b/bashrc index 48bdc4a..9250955 100755 --- a/bashrc +++ b/bashrc @@ -404,7 +404,7 @@ o(){ else for f in "$@" do - open_file "$f" + open_file "$(realpath "$f")" done fi } From 17be182200cdc454f411eba49a44c8b04b29e445 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 10 Sep 2012 14:08:58 +0900 Subject: [PATCH 3/4] realpath --no-symlinks dont work on ubuntu --- bashrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bashrc b/bashrc index f81e2f9..5f84b37 100755 --- a/bashrc +++ b/bashrc @@ -234,7 +234,7 @@ cd(){ __dirs_rm_dup(){ for d in "$@" do - local next="$(realpath --no-symlinks "$d")" + local next="$(realpath --strip "$d")" for l in $(\dirs -v -l | cut -d " " -f 2- | \grep -x " *[0-9]\+ \+${next}" | \grep -o "^ *[0-9]\+ " | tac) do From 72568ce94f6a6c80d2f1a706ab083494f53c1ae2 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 10 Sep 2012 14:40:45 +0900 Subject: [PATCH 4/4] add func __realpath --- bashrc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/bashrc b/bashrc index 5f84b37..d50ab89 100755 --- a/bashrc +++ b/bashrc @@ -234,7 +234,7 @@ cd(){ __dirs_rm_dup(){ for d in "$@" do - local next="$(realpath --strip "$d")" + local next="$(__realpath --strip "$d")" for l in $(\dirs -v -l | cut -d " " -f 2- | \grep -x " *[0-9]\+ \+${next}" | \grep -o "^ *[0-9]\+ " | tac) do @@ -243,6 +243,22 @@ __dirs_rm_dup(){ done } +__realpath(){ + if type realpath >/dev/null 2>&1 + then + command realpath "$@" + else + while ! test -d $1 + do + shift + done + local d="$OLDPWD" + command cd "$1" + echo "$PWD" + command cd "$d" + fi +} + dh(){ if test $# -eq 0 then