mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-06 02:51:32 +01:00
feat(jj): completions, aliases and prompt utils
This commit is contained in:
parent
5fd2059e5e
commit
30abebff27
2 changed files with 116 additions and 0 deletions
55
plugins/jj/jj.plugin.zsh
Normal file
55
plugins/jj/jj.plugin.zsh
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
# 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'
|
||||
Loading…
Add table
Add a link
Reference in a new issue