1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-30 09:40:09 +00:00
ohmyzsh/plugins/jj/jj.plugin.zsh

55 lines
1.3 KiB
Bash

# if jj is not found, don't do the rest of the script
if (( ! $+commands[jj] )); then
return
fi
source <(jj util completion zsh)
compdef _jj jj
function __jj_prompt_jj() {
local flags=("--no-pager")
if (( ${ZSH_THEME_JJ_IGNORE_WORKING_COPY:-0} )); then
flags+=("--ignore-working-copy")
fi
command jj $flags "$@"
}
# convenience functions for themes
function jj_prompt_template_raw() {
__jj_prompt_jj log --no-graph -r @ -T "$@" 2> /dev/null
}
function jj_prompt_template() {
local out
out=$(jj_prompt_template_raw "$@") || return 1
echo "${out:gs/%/%%}"
}
# Aliases (sorted alphabetically)
alias j='jj'
alias jb='jj bookmark'
alias jbc='jj bookmark create'
alias jbd='jj bookmark d'
alias jbl='jj bookmark list'
alias jbr='jj bookmark rename'
alias jbs='jj bookmark set'
alias jbt='jj bookmark track'
alias jc='jj commit'
alias jcmsg='jj commit --message'
alias jd='jj diff'
alias jdmsg='jj desc --message'
alias jds='jj desc'
alias je='jj edit'
alias jgcl='jj git clone'
alias jgf='jj git fetch'
alias jgp='jj git push'
alias jl='jj log'
alias jn='jj new'
alias jrb='jj rebase'
alias jrs='jj restore'
alias jrt='cd "$(jj root || echo .)"'
alias js='jj squash'
alias jsp='jj split'
alias jsps='jj split --siblings'
alias jst='jj st'
alias jsto='jj squash --into'