mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-31 03:51:14 -03:00
Add a simple fish_jj_prompt
jj is often colocated with Git so the Git prompt also works, but jj is always in a detached HEAD state, which is atypical for Git. The jj prompt improves things by showing the revision ID which is usually more useful than the commit ID. This prompt is mostly adapted from the defaults for "jj log -r @". Showing conflicting/empty commits seems useful. Also perhaps bookmarks and tags, not sure. The main problem with this prompt is that due to --ignore-working-copy, the information may be stale. That will be rectified after every jj command, so hopefully this doesn't cause issues.
This commit is contained in:
14
share/functions/fish_jj_prompt.fish
Normal file
14
share/functions/fish_jj_prompt.fish
Normal file
@@ -0,0 +1,14 @@
|
||||
function fish_jj_prompt
|
||||
jj log 2>/dev/null --no-graph --ignore-working-copy --color=always --revisions @ \
|
||||
--template '
|
||||
concat(
|
||||
" ",
|
||||
separate(" ",
|
||||
format_short_change_id_with_hidden_and_divergent_info(self),
|
||||
bookmarks,
|
||||
tags,
|
||||
if(conflict, label("conflict", "×")),
|
||||
if(empty, label("empty", "(empty)"))
|
||||
),
|
||||
)'
|
||||
end
|
||||
@@ -1,7 +1,8 @@
|
||||
function fish_vcs_prompt --description "Print all vcs prompts"
|
||||
# If a prompt succeeded, we assume that it's printed the correct info.
|
||||
# This is so we don't try svn if git already worked.
|
||||
fish_git_prompt $argv
|
||||
fish_jj_prompt $argv
|
||||
or fish_git_prompt $argv
|
||||
or fish_hg_prompt $argv
|
||||
or fish_fossil_prompt $argv
|
||||
# The svn prompt is disabled by default because it's quite slow on common svn repositories.
|
||||
|
||||
Reference in New Issue
Block a user