Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged

theme #102

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
all:
just --list

# Update jj-repo dep
@update-jj:
nix flake update --update-input jj-repo
53 changes: 53 additions & 0 deletions conf/bash/scripts/jj-util.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# provide some util functions for jj

# template string for jj commit message
JJ_TEMPLATE="\"'[' ++ change_id.shortest(7) ++ '] ' ++ description.first_line() ++ '\\n'\""
JJ_LOG_CMD_PRE="jj log --quiet --no-pager --no-graph --color never --template '\"[\" ++ change_id.shortest(7) ++ \"]\" ++ \"\\t\" ++ description.first_line() ++ \"\\n\"' -r"
FZF_CMD="fzf --cycle --tmux 98% --ansi --layout=reverse --scheme=path --bind='ctrl-y:execute-silent(echo {} | pbcopy)' --header='Enter: select line, Ctrl-Y: copy line'"

# get the next node of a revision
function __jj_util_get_next_changeid() {
# jj log --quiet --no-pager --no-graph --color never -r "<rev>+ ~ description('private:')"
# select next node that doesn't have private: in description
local rev="$1"
if [[ -z "$rev" ]]; then
return 1
fi

# get the command output and parse the text, remove unused output.
# then check line count, if only one line, extract change id and return
# otherwise use fzf to select one and return
# no private and no merges commits
local cmd="$JJ_LOG_CMD_PRE \"$rev+ ~ description(\\\"private:\\\") ~ merges() \""
# local cmd="$JJ_LOG_CMD_PRE \"$rev+\""
local output=$(eval $cmd)

# check empty output first
if [[ -z "$output" ]]; then
return 1
fi

# filter lines to ensure they match our format [changeid]\t description
# and store in a temporary variable
local filtered_output
filtered_output=$(echo -e "$output" | grep -E '^\[[a-z0-9]+\].*')
# check if we have any valid lines
if [[ -z "$filtered_output" ]]; then
return 1
fi

local line_count=$(echo "$filtered_output" | wc -l)
if [[ $line_count -eq 1 ]]; then
echo "$filtered_output" | awk -F'[][]' '{print $2}'
return 0
fi

# use fzf to select one and return
local selected
selected=$(echo "$filtered_output" | eval $FZF_CMD)
if [[ $? -ne 0 ]]; then
return 1
fi
echo "$selected" | awk -F'[][]' '{print $2}'
return 0
}
2 changes: 1 addition & 1 deletion conf/fish/funcs/_fzf-jj-bookmarks.fish
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function _fzf-jj-bookmarks --description "Search for jujutsu bookmarks"
jj root --quiet &>/dev/null; or return
set -f lines (jj bookmark list --sort committer-date- --quiet --no-pager --color always | grep -v '^[[:space:]]' | grep -v '\(deleted\)' | fzf --tmux 98% --ansi --layout=reverse \
set -f lines (jj bookmark list --sort committer-date- --quiet --no-pager --color always | grep -v '^[[:space:]]' | grep -v '\(deleted\)' | fzf --cycle --tmux 98% --ansi --layout=reverse \
--scheme=path \
--preview='jj log --color=always -r "stack($(echo {} | cut -d: -f2 | awk "{print \$1}" | string trim))" --no-graph' \
--preview-label='Commit Details' \
Expand Down
2 changes: 1 addition & 1 deletion conf/ghostty/config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# https://github.com/ghostty-org/ghostty/blob/b8ffee7acbdd5ee97953f6e6d02e047d4bfda37b/src/input/key.zig#L255


theme = dark:kanagawa-dragon,light:solarized-light
theme = dark:jb-dark,light:solarized-light
font-family = "Berkeley Mono"
window-title-font-family = "PT Sans"
font-feature = "+calt"
Expand Down
30 changes: 30 additions & 0 deletions conf/ghostty/themes/jb-dark
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
background = 1E1F22
foreground = BCBEC4

selection-background = 214283
selection-foreground = BCBEC4

cursor-color = CED0D6
cursor-text = 1E1F22

palette = 0=#000000
palette = 1=#F0524F
palette = 2=#5C962C
palette = 3=#A68A0D
palette = 4=#3993D4
palette = 5=#A771BF
palette = 6=#00A3A3
palette = 7=#808080
palette = 8=#595959
palette = 9=#FF4050
palette = 10=#4FC414
palette = 11=#E5BF00
palette = 12=#1FB0FF
palette = 13=#ED7EED
palette = 14=#00E5E5
palette = 15=#FFFFFF

# Seems like this is not working via themes
# macos-icon = custom-style
# macos-icon-ghost-color = BCBEC4
# macos-icon-screen-color = 1E1F22
30 changes: 30 additions & 0 deletions conf/ghostty/themes/jb-light
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
foreground = 000000
background = FFFFFF

selection-background = A6D2FF
selection-foreground = 000000

cursor-color = 000000
cursor-text = FFFFFF

palette = 0=#000000
palette = 1=#CE0505
palette = 2=#067D17
palette = 3=#B28C00
palette = 4=#063FDB
palette = 5=#B309B3
palette = 6=#028E8E
palette = 7=#929292
palette = 8=#656565
palette = 9=#FF1616
palette = 10=#16B42C
palette = 11=#ECC32C
palette = 12=#2D61F0
palette = 13=#E617E6
palette = 14=#15C1C1
palette = 15=#C9C9C9

# Seems like this is not working via themes
# macos-icon = custom-style
# macos-icon-ghost-color = 000000
# macos-icon-screen-color = FFFFFF
32 changes: 16 additions & 16 deletions conf/tmux/bin/pane.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,36 @@ else
panes=$(tmux list-panes -a -F "$TMUX_FZF_PANE_FORMAT")
fi

FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --header='Select an action.' --bind='ctrl-x:execute-silent(echo {} | sed \"s/: .*//\" | xargs -I{} tmux kill-pane -t {})+reload(tmux list-panes -a -F \"$DEFAULT_FORMAT\")'"
FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --cycle --header='Select an action.' --bind='ctrl-x:execute-silent(echo {} | sed \"s/: .*//\" | xargs -I{} tmux kill-pane -t {})+reload(tmux list-panes -a -F \"$DEFAULT_FORMAT\")'"
if [[ -z "$1" ]]; then
action=$(printf "switch\nbreak\njoin\nswap\nlayout\nkill\nresize\nrename\n[cancel]" | eval "$TMUX_FZF_BIN $TMUX_FZF_OPTIONS")
action=$(printf "switch\nbreak\njoin\nswap\nlayout\nkill\nresize\nrename" | eval "$TMUX_FZF_BIN $TMUX_FZF_OPTIONS")
else
action="$1"
fi

[[ "$action" == "[cancel]" || -z "$action" ]] && exit
[[ -z "$action" ]] && exit
if [[ "$action" == "layout" ]]; then
FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --header='Select a layout.'"
target_origin=$(printf "even-horizontal\neven-vertical\nmain-horizontal\nmain-vertical\ntiled\n[cancel]" | eval "$TMUX_FZF_BIN $TMUX_FZF_OPTIONS")
[[ "$target_origin" == "[cancel]" || -z "$target_origin" ]] && exit
target_origin=$(printf "even-horizontal\neven-vertical\nmain-horizontal\nmain-vertical\ntiled" | eval "$TMUX_FZF_BIN $TMUX_FZF_OPTIONS")
[[ -z "$target_origin" ]] && exit
tmux select-layout "$target_origin"
elif [[ "$action" == "resize" ]]; then
FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --header='Select direction.'"
target_origin=$(printf "left\nright\nup\ndown\n[cancel]" | eval "$TMUX_FZF_BIN $TMUX_FZF_OPTIONS")
[[ "$target_origin" == "[cancel]" || -z "$target_origin" ]] && exit
target_origin=$(printf "left\nright\nup\ndown" | eval "$TMUX_FZF_BIN $TMUX_FZF_OPTIONS")
[[ -z "$target_origin" ]] && exit
if [[ "$target_origin" == "left" || "$target_origin" == "right" ]]; then
FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --header='Cells to be adjusted.'"
size=$(printf "1\n2\n3\n5\n10\n20\n30\n[cancel]" | eval "$TMUX_FZF_BIN $TMUX_FZF_OPTIONS")
[[ "$size" == "[cancel]" || -z "$size" ]] && exit
size=$(printf "1\n2\n3\n5\n10\n20\n30" | eval "$TMUX_FZF_BIN $TMUX_FZF_OPTIONS")
[[ -z "$size" ]] && exit
if [[ "$target_origin" == "left" ]]; then
tmux resize-pane -L "$size"
else
tmux resize-pane -R "$size"
fi
elif [[ "$target_origin" == "up" || "$target_origin" == "down" ]]; then
FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --header='Lines to be adjusted.'"
size=$(printf "1\n2\n3\n5\n10\n15\n20\n[cancel]" | eval "$TMUX_FZF_BIN $TMUX_FZF_OPTIONS")
[[ "$size" == "[cancel]" || -z "$size" ]] && exit
size=$(printf "1\n2\n3\n5\n10\n15\n20" | eval "$TMUX_FZF_BIN $TMUX_FZF_OPTIONS")
[[ -z "$size" ]] && exit
if [[ "$target_origin" == "up" ]]; then
tmux resize-pane -U "$size"
else
Expand All @@ -59,12 +59,12 @@ else
fi
if [[ "$action" == "switch" || "$action" == "join" ]]; then
panes=$(echo "$panes" | grep -v "^$current_pane")
target_origin=$(printf "%s\n[cancel]" "$panes" | eval "$TMUX_FZF_BIN $TMUX_FZF_OPTIONS $TMUX_FZF_PREVIEW_OPTIONS")
target_origin=$(printf "%s" "$panes" | eval "$TMUX_FZF_BIN $TMUX_FZF_OPTIONS $TMUX_FZF_PREVIEW_OPTIONS")
else
target_origin=$(printf "[current]\n%s\n[cancel]" "$panes" | eval "$TMUX_FZF_BIN $TMUX_FZF_OPTIONS $TMUX_FZF_PREVIEW_OPTIONS")
target_origin=$(printf "[current]\n%s" "$panes" | eval "$TMUX_FZF_BIN $TMUX_FZF_OPTIONS $TMUX_FZF_PREVIEW_OPTIONS")
target_origin=$(echo "$target_origin" | sed -E "s/\[current\]/$current_pane_origin/")
fi
[[ "$target_origin" == "[cancel]" || -z "$target_origin" ]] && exit
[[ -z "$target_origin" ]] && exit
target=$(echo "$target_origin" | sed 's/: .*//')
if [[ "$action" == "switch" ]]; then
echo "$target" | sed -E 's/:.*//g' | xargs -I{} tmux switch-client -t {}
Expand All @@ -75,8 +75,8 @@ else
elif [[ "$action" == "swap" ]]; then
panes=$(echo "$panes" | grep -v "^$target")
FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --header='Select another target pane.'"
target_swap_origin=$(printf "%s\n[cancel]" "$panes" | eval "$TMUX_FZF_BIN $TMUX_FZF_OPTIONS $TMUX_FZF_PREVIEW_OPTIONS")
[[ "$target_swap_origin" == "[cancel]" || -z "$target_swap_origin" ]] && exit
target_swap_origin=$(printf "%s" "$panes" | eval "$TMUX_FZF_BIN $TMUX_FZF_OPTIONS $TMUX_FZF_PREVIEW_OPTIONS")
[[ -z "$target_swap_origin" ]] && exit
target_swap=$(echo "$target_swap_origin" | sed 's/: .*//')
tmux swap-pane -s "$target" -t "$target_swap"
elif [[ "$action" == "join" ]]; then
Expand Down
Loading
Loading