Fixed vim and zsh
This commit is contained in:
1
zsh/modules/git/functions/git-branch-current
Symbolic link
1
zsh/modules/git/functions/git-branch-current
Symbolic link
@ -0,0 +1 @@
|
||||
git_current_branch
|
13
zsh/modules/git/functions/git-commit-lost
Normal file
13
zsh/modules/git/functions/git-commit-lost
Normal file
@ -0,0 +1,13 @@
|
||||
if ! is-true "$(commmand git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
print "${0}: not a repository work tree: ${PWD}" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
command git fsck 2> /dev/null \
|
||||
| grep "^dangling commit" \
|
||||
| awk '{print $3}' \
|
||||
| command git log \
|
||||
--date-order \
|
||||
--no-walk \
|
||||
--stdin \
|
||||
--pretty=format:${_git_log_oneline_format}
|
BIN
zsh/modules/git/functions/git-commit-lost.zwc
Normal file
BIN
zsh/modules/git/functions/git-commit-lost.zwc
Normal file
Binary file not shown.
9
zsh/modules/git/functions/git-dir
Normal file
9
zsh/modules/git/functions/git-dir
Normal file
@ -0,0 +1,9 @@
|
||||
local git_dir="${$(command git rev-parse --git-dir):A}"
|
||||
|
||||
if [[ -n "${git_dir}" ]]; then
|
||||
print "${git_dir}"
|
||||
return 0
|
||||
else
|
||||
print "${0}: not a repository: ${PWD}" >&2
|
||||
return 1
|
||||
fi
|
BIN
zsh/modules/git/functions/git-dir.zwc
Normal file
BIN
zsh/modules/git/functions/git-dir.zwc
Normal file
Binary file not shown.
10
zsh/modules/git/functions/git-ignore-add
Normal file
10
zsh/modules/git/functions/git-ignore-add
Normal file
@ -0,0 +1,10 @@
|
||||
# make sure we have a git-root
|
||||
if ! git-root &> /dev/null; then
|
||||
print 'not in a git repository' >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# we are in a git repository. add parameters to .gitignore
|
||||
for file in "${@}"; do
|
||||
print "${file}" >>! $(git-root)/.gitignore
|
||||
done
|
BIN
zsh/modules/git/functions/git-ignore-add.zwc
Normal file
BIN
zsh/modules/git/functions/git-ignore-add.zwc
Normal file
Binary file not shown.
9
zsh/modules/git/functions/git-root
Normal file
9
zsh/modules/git/functions/git-root
Normal file
@ -0,0 +1,9 @@
|
||||
local root="$(command git rev-parse --show-toplevel 2> /dev/null)"
|
||||
|
||||
if [[ -n "${root}" ]]; then
|
||||
print "${root}"
|
||||
return 0
|
||||
else
|
||||
print "${0}: not a repository work tree: ${PWD}" >&2
|
||||
return 1
|
||||
fi
|
BIN
zsh/modules/git/functions/git-root.zwc
Normal file
BIN
zsh/modules/git/functions/git-root.zwc
Normal file
Binary file not shown.
15
zsh/modules/git/functions/git-stash-clear-interactive
Normal file
15
zsh/modules/git/functions/git-stash-clear-interactive
Normal file
@ -0,0 +1,15 @@
|
||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
print "${0}: not a repository work tree: ${PWD}" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local stashed
|
||||
|
||||
if [[ -f "$(git-dir)/refs/stash" ]]; then
|
||||
stashed="$(command git stash list 2> /dev/null | wc -l | awk '{print $1}')"
|
||||
if (( ${stashed} > 0 )); then
|
||||
if read -q "?Clear ${stashed} stashed state(s) [y/N]? "; then
|
||||
command git stash clear
|
||||
fi
|
||||
fi
|
||||
fi
|
BIN
zsh/modules/git/functions/git-stash-clear-interactive.zwc
Normal file
BIN
zsh/modules/git/functions/git-stash-clear-interactive.zwc
Normal file
Binary file not shown.
15
zsh/modules/git/functions/git-stash-dropped
Normal file
15
zsh/modules/git/functions/git-stash-dropped
Normal file
@ -0,0 +1,15 @@
|
||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
print "${0}: not a repository work tree: ${PWD}" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
command git fsck --unreachable 2> /dev/null \
|
||||
| grep 'commit' \
|
||||
| awk '{print $3}' \
|
||||
| command git log \
|
||||
--pretty=format:${_git_log_oneline_format} \
|
||||
--extended-regexp \
|
||||
--grep="${1:-(WIP )?[Oo]n [^:]+:}" \
|
||||
--merges \
|
||||
--no-walk \
|
||||
--stdin
|
BIN
zsh/modules/git/functions/git-stash-dropped.zwc
Normal file
BIN
zsh/modules/git/functions/git-stash-dropped.zwc
Normal file
Binary file not shown.
11
zsh/modules/git/functions/git-stash-recover
Normal file
11
zsh/modules/git/functions/git-stash-recover
Normal file
@ -0,0 +1,11 @@
|
||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
print "${0}: not a repository work tree: ${PWD}" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local commit
|
||||
|
||||
for commit in "${@}"; do
|
||||
git update-ref \
|
||||
-m "$(command git log -1 --pretty="format:%s" "$commit")" refs/stash "${commit}"
|
||||
done
|
BIN
zsh/modules/git/functions/git-stash-recover.zwc
Normal file
BIN
zsh/modules/git/functions/git-stash-recover.zwc
Normal file
Binary file not shown.
25
zsh/modules/git/functions/git-submodule-move
Normal file
25
zsh/modules/git/functions/git-submodule-move
Normal file
@ -0,0 +1,25 @@
|
||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
print "${0}: not a repository work tree: ${PWD}" >&2
|
||||
return 1
|
||||
elif [[ "${PWD}" != "$(git-root)" ]]; then
|
||||
print "${0}: must be run from the root of the work tree" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local src="${1}"
|
||||
local dst="${2}"
|
||||
local url
|
||||
|
||||
url="$(command git config --file "$(git-root)/.gitmodules" --get "submodule.${src}.url")"
|
||||
|
||||
if [[ -z "${url}" ]]; then
|
||||
print "${0}: submodule not found: ${src}" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
mkdir -p "${dst:h}"
|
||||
|
||||
git-submodule-remove "${src}"
|
||||
git submodule add "${url}" "${dst}"
|
||||
|
||||
return 0
|
BIN
zsh/modules/git/functions/git-submodule-move.zwc
Normal file
BIN
zsh/modules/git/functions/git-submodule-move.zwc
Normal file
Binary file not shown.
20
zsh/modules/git/functions/git-submodule-remove
Normal file
20
zsh/modules/git/functions/git-submodule-remove
Normal file
@ -0,0 +1,20 @@
|
||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
print "${0}: not a repository work tree: ${PWD}" >&2
|
||||
return 1
|
||||
elif [[ "${PWD}" != "$(git-root)" ]]; then
|
||||
print "${0}: must be run from the root of the work tree" >&2
|
||||
return 1
|
||||
elif ! command git config --file .gitmodules --get "submodule.${1}.path" &>/dev/null; then
|
||||
print "${0}: submodule not found: ${1}" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
command git config --file "$(git-dir)/config" --remove-section "submodule.${1}" &>/dev/null
|
||||
command git config --file "$(git-root)/.gitmodules" --remove-section "submodule.${1}" &>/dev/null
|
||||
command git add .gitmodules
|
||||
|
||||
command git rm --cached -rf "${1}"
|
||||
rm -rf "${1}"
|
||||
rm -rf "$(git-dir)/modules/${1}"
|
||||
|
||||
return 0
|
BIN
zsh/modules/git/functions/git-submodule-remove.zwc
Normal file
BIN
zsh/modules/git/functions/git-submodule-remove.zwc
Normal file
Binary file not shown.
9
zsh/modules/git/functions/git_current_branch
Normal file
9
zsh/modules/git/functions/git_current_branch
Normal file
@ -0,0 +1,9 @@
|
||||
# slightly modified git_current_branch from oh-my-zsh for theme compatibility
|
||||
local ref
|
||||
ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null)
|
||||
local ret=${?}
|
||||
if [[ ${ret} != 0 ]]; then
|
||||
[[ ${ret} == 128 ]] && return # no git repo.
|
||||
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
|
||||
fi
|
||||
print ${ref#refs/heads/}
|
BIN
zsh/modules/git/functions/git_current_branch.zwc
Normal file
BIN
zsh/modules/git/functions/git_current_branch.zwc
Normal file
Binary file not shown.
5
zsh/modules/git/functions/is-true
Normal file
5
zsh/modules/git/functions/is-true
Normal file
@ -0,0 +1,5 @@
|
||||
# Checks a boolean variable for "true".
|
||||
# Case insensitive: "1", "y", "yes", "t", "true", "o", and "on".
|
||||
is-true() {
|
||||
[[ -n "$1" && "$1" == (1|[Yy]([Ee][Ss]|)|[Tt]([Rr][Uu][Ee]|)|[Oo]([Nn]|)) ]]
|
||||
}
|
BIN
zsh/modules/git/functions/is-true.zwc
Normal file
BIN
zsh/modules/git/functions/is-true.zwc
Normal file
Binary file not shown.
Reference in New Issue
Block a user