add jj to prompt status and direnv to installed packages
This commit is contained in:
18
dot_config/private_fish/functions/_insert_jj_after_git.fish
Normal file
18
dot_config/private_fish/functions/_insert_jj_after_git.fish
Normal file
@@ -0,0 +1,18 @@
|
||||
function _insert_jj_after_git
|
||||
# Get current items
|
||||
set -l current_items $tide_left_prompt_items
|
||||
|
||||
# Check if jj already exists
|
||||
if not contains jj $current_items
|
||||
# Find git's position
|
||||
set -l git_pos (contains -i git $current_items)
|
||||
|
||||
if test $git_pos -gt 0
|
||||
# Create new list: items before git + git + jj + items after git
|
||||
set -l new_items $current_items[1..$git_pos] jj $current_items[(math $git_pos + 1)..-1]
|
||||
|
||||
# Update the universal variable
|
||||
set -U tide_left_prompt_items $new_items
|
||||
end
|
||||
end
|
||||
end
|
||||
33
dot_config/private_fish/functions/_tide_item_jj.fish
Normal file
33
dot_config/private_fish/functions/_tide_item_jj.fish
Normal file
@@ -0,0 +1,33 @@
|
||||
function _tide_item_jj
|
||||
if not command -sq jj; or not jj root --quiet &>/dev/null
|
||||
return 1
|
||||
end
|
||||
|
||||
set jj_status (jj log -r@ -n1 --ignore-working-copy --no-graph --color always -T '
|
||||
separate(" ",
|
||||
bookmarks.map(|x| if(
|
||||
x.name().substr(0, 10).starts_with(x.name()),
|
||||
x.name().substr(0, 10),
|
||||
x.name().substr(0, 9) ++ "…")
|
||||
).join(" "),
|
||||
tags.map(|x| if(
|
||||
x.name().substr(0, 10).starts_with(x.name()),
|
||||
x.name().substr(0, 10),
|
||||
x.name().substr(0, 9) ++ "…")
|
||||
).join(" "),
|
||||
surround("\"","\"",
|
||||
if(
|
||||
description.first_line().substr(0, 24).starts_with(description.first_line()),
|
||||
description.first_line().substr(0, 24),
|
||||
description.first_line().substr(0, 23) ++ "…"
|
||||
)
|
||||
),
|
||||
change_id.shortest(),
|
||||
commit_id.shortest(),
|
||||
if(conflict, "conflict"),
|
||||
if(divergent, "divergent"),
|
||||
if(hidden, "hidden"),
|
||||
)' | string trim)
|
||||
set jj_info $jj_status
|
||||
_tide_print_item jj $tide_jj_icon' ' "($(string join ', ' $jj_info))"
|
||||
end
|
||||
Reference in New Issue
Block a user