parent
e80a0825e0
commit
1c1e7d5ec9
4 changed files with 50 additions and 2 deletions
|
@ -71,6 +71,9 @@ _install_plugin https://github.com/zsh-users/zsh-autosuggestions
|
||||||
|
|
||||||
# ]] Plugins
|
# ]] Plugins
|
||||||
|
|
||||||
|
# Custom fpath
|
||||||
|
fpath+=( "$XDG_DATA_HOME/zsh/functions/VCS_Info" )
|
||||||
|
|
||||||
_command_exists() {
|
_command_exists() {
|
||||||
[ $(command -v $1 | wc -l) -gt 0 ] && return 0 || return 1
|
[ $(command -v $1 | wc -l) -gt 0 ] && return 0 || return 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,10 @@ setopt prompt_subst
|
||||||
zstyle ':vcs_info:*' stagedstr 'M'
|
zstyle ':vcs_info:*' stagedstr 'M'
|
||||||
zstyle ':vcs_info:*' unstagedstr '!'
|
zstyle ':vcs_info:*' unstagedstr '!'
|
||||||
zstyle ':vcs_info:*' check-for-changes true
|
zstyle ':vcs_info:*' check-for-changes true
|
||||||
zstyle ':vcs_info:git:*' formats '%F{5} %b %F{1}%c%u %f'
|
zstyle ':vcs_info:jj:*' formats '%F{5}(jj) %b %F{1}%c%u %f'
|
||||||
|
zstyle ':vcs_info:git:*' formats '%F{5}(git) %b %F{1}%c%u %f'
|
||||||
zstyle ':vcs_info:git*+set-message:*' hooks git-untracked
|
zstyle ':vcs_info:git*+set-message:*' hooks git-untracked
|
||||||
zstyle ':vcs_info:*' enable git
|
zstyle ':vcs_info:*' enable git jj
|
||||||
+vi-git-untracked() {
|
+vi-git-untracked() {
|
||||||
# Return early if we're not in git dir
|
# Return early if we're not in git dir
|
||||||
[ $(git rev-parse --is-inside-work-tree 2> /dev/null) = 'true' ] || return 0
|
[ $(git rev-parse --is-inside-work-tree 2> /dev/null) = 'true' ] || return 0
|
||||||
|
|
9
.local/share/zsh/functions/VCS_Info/VCS_INFO_detect_jj
Normal file
9
.local/share/zsh/functions/VCS_Info/VCS_INFO_detect_jj
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
## vim: filetype=zsh
|
||||||
|
setopt localoptions NO_shwordsplit
|
||||||
|
|
||||||
|
[[ $1 == '--flavours' ]] && return 1
|
||||||
|
|
||||||
|
VCS_INFO_check_com jj || return 1
|
||||||
|
vcs_comm[detect_need_file]=working_copy
|
||||||
|
VCS_INFO_bydir_detect '.jj'
|
||||||
|
return $?
|
35
.local/share/zsh/functions/VCS_Info/VCS_INFO_get_data_jj
Normal file
35
.local/share/zsh/functions/VCS_Info/VCS_INFO_get_data_jj
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
## vim: filetype=zsh
|
||||||
|
setopt localoptions NO_shwordsplit
|
||||||
|
|
||||||
|
local action branch base staged unstaged revision misc
|
||||||
|
local _is_working_copy _is_root _is_empty _bookmarks _bookmark_id _parent_id
|
||||||
|
|
||||||
|
eval `${vcs_comm[cmd]} log --ignore-working-copy -n 1 --no-graph --color never \
|
||||||
|
-r "coalesce(ancestors(present(@)) & bookmarks(), root())" \
|
||||||
|
-T '
|
||||||
|
separate(" ",
|
||||||
|
"_bookmark_id=" ++ change_id,
|
||||||
|
"_is_working_copy=" ++ current_working_copy,
|
||||||
|
"_is_root=" ++ root,
|
||||||
|
"branch=\"" ++ bookmarks.join(" ") ++ "\"",
|
||||||
|
)
|
||||||
|
'`
|
||||||
|
|
||||||
|
eval `${vcs_comm[cmd]} log --ignore-working-copy -n 1 --no-graph --color never -r "@" \
|
||||||
|
-T '
|
||||||
|
separate(" ",
|
||||||
|
"revision=\"" ++ change_id.shortest() ++ "\"",
|
||||||
|
"_parent_id=\"" ++ parents.map(|c| c.change_id()).join("-") ++ "\"",
|
||||||
|
if(empty, "", "unstaged=true"),
|
||||||
|
if(conflict, "action=conflict")
|
||||||
|
)'`
|
||||||
|
|
||||||
|
if [[ $_is_working_copy == "false" && $_bookmark_id != $_parent_id ]]; then
|
||||||
|
staged=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $_is_root == "true" ]]; then
|
||||||
|
branch="root()"
|
||||||
|
fi
|
||||||
|
|
||||||
|
VCS_INFO_formats "${action}" "${branch}" "${base}" "${staged}" "${unstaged}" "${revision}" "${misc}"
|
Loading…
Add table
Add a link
Reference in a new issue