diff --git a/bin/git-forgit b/bin/git-forgit index bf31790..b9a6a26 100755 --- a/bin/git-forgit +++ b/bin/git-forgit @@ -164,6 +164,12 @@ _forgit_get_files_from_diff_line() { sed 's/.*] *//' | sed 's/ -> /\n/' | tr '\n' '\0' } +_forgit_get_single_file_from_diff_line() { + # Similar to the function above, but only gets a single file from a single line + # Gets the new name of renamed files + sed 's/.*] *//' | sed 's/.*-> //' +} + _forgit_exec_diff() { _forgit_diff_git_opts=() _forgit_parse_array _forgit_diff_git_opts "$FORGIT_DIFF_GIT_OPTS" @@ -184,6 +190,12 @@ _forgit_diff_view() { "$FORGIT" exec_diff "${commits[@]}" -U"$diff_context" -- | $_forgit_diff_pager } +_forgit_edit_diffed_file() { + local input_line=$1 + filename=$(echo "$input_line" | _forgit_get_single_file_from_diff_line) + $EDITOR "$filename" >/dev/tty /dev/tty \" " @@ -258,6 +267,12 @@ _forgit_get_single_file_from_add_line() { sed -e 's/^\"//' -e 's/\"$//' } +_forgit_edit_add_file() { + local input_line=$1 + filename=$(echo "$input_line" | _forgit_get_single_file_from_add_line) + $EDITOR "$filename" >/dev/tty /dev/tty