Migrate to home-manager
This commit is contained in:
parent
6781866277
commit
2f6d4e1d3c
147 changed files with 6181 additions and 6078 deletions
files/config/fish
59
files/config/fish/config.fish
Normal file
59
files/config/fish/config.fish
Normal file
|
@ -0,0 +1,59 @@
|
|||
# Bindings
|
||||
bind \cg __zoxide_zi_repaint
|
||||
bind \cJ forward-char
|
||||
bind \cn history-prefix-search-forward
|
||||
bind \cp history-prefix-search-backward
|
||||
|
||||
# Settings
|
||||
set fish_greeting
|
||||
set fish_emoji_width 2
|
||||
|
||||
# xdg-open support on ssh remotes
|
||||
if test -n SSH_TTY; and type -q wezterm-open-url
|
||||
set -x DE generic
|
||||
set -x BROWSER wezterm-open-url
|
||||
end
|
||||
|
||||
# Colors
|
||||
set fish_color_command --bold
|
||||
set fish_color_comment --italics --dim
|
||||
set fish_color_autosuggestion --italics --bold red
|
||||
set fish_color_cancel
|
||||
set fish_color_command --bold
|
||||
set fish_color_comment --italics --dim
|
||||
set fish_color_cwd normal
|
||||
set fish_color_cwd_root normal
|
||||
set fish_color_end
|
||||
set fish_color_error
|
||||
set fish_color_escape
|
||||
set fish_color_gray 6c7086
|
||||
set fish_color_history_current
|
||||
set fish_color_host normal
|
||||
set fish_color_host_remote yellow
|
||||
set fish_color_keyword
|
||||
set fish_color_match
|
||||
set fish_color_normal normal
|
||||
set fish_color_operator
|
||||
set fish_color_option
|
||||
set fish_color_param normal
|
||||
set fish_color_quote --italics
|
||||
set fish_color_redirection
|
||||
set fish_color_search_match -r
|
||||
set fish_color_selection -r
|
||||
set fish_color_status normal
|
||||
set fish_color_string --italics
|
||||
set fish_color_user normal
|
||||
set fish_color_valid_path
|
||||
set fish_pager_color_background
|
||||
set fish_pager_color_completion normal
|
||||
set fish_pager_color_description --dim
|
||||
set fish_pager_color_prefix --underline
|
||||
set fish_pager_color_progress --dim
|
||||
set fish_pager_color_secondary_background
|
||||
set fish_pager_color_secondary_completion
|
||||
set fish_pager_color_secondary_description
|
||||
set fish_pager_color_secondary_prefix
|
||||
set fish_pager_color_selected_background -r
|
||||
set fish_pager_color_selected_completion
|
||||
set fish_pager_color_selected_description
|
||||
set fish_pager_color_selected_prefix
|
37
files/config/fish/go-task.fish
Normal file
37
files/config/fish/go-task.fish
Normal file
|
@ -0,0 +1,37 @@
|
|||
set GO_TASK_PROGNAME task
|
||||
|
||||
function __task_get_tasks --description "Prints all available tasks with their description"
|
||||
# Read the list of tasks (and potential errors)
|
||||
$GO_TASK_PROGNAME --list-all 2>&1 | read -lz rawOutput
|
||||
|
||||
# Return on non-zero exit code (for cases when there is no Taskfile found or etc.)
|
||||
if test $status -ne 0
|
||||
return
|
||||
end
|
||||
|
||||
# Grab names and descriptions (if any) of the tasks
|
||||
set -l output (echo $rawOutput | sed -e '1d; s/\* \(.*\):\s*\(.*\)\s*(aliases.*/\1\t\2/' -e 's/\* \(.*\):\s*\(.*\)/\1\t\2/'| string split0)
|
||||
if test $output
|
||||
echo $output
|
||||
end
|
||||
end
|
||||
|
||||
complete -c $GO_TASK_PROGNAME -d 'Runs the specified task(s). Falls back to the "default" task if no task name was specified, or lists all tasks if an unknown task name was
|
||||
specified.' -xa "(__task_get_tasks)"
|
||||
|
||||
complete -c $GO_TASK_PROGNAME -s c -l color -d 'colored output (default true)'
|
||||
complete -c $GO_TASK_PROGNAME -s d -l dir -d 'sets directory of execution'
|
||||
complete -c $GO_TASK_PROGNAME -l dry -d 'compiles and prints tasks in the order that they would be run, without executing them'
|
||||
complete -c $GO_TASK_PROGNAME -s f -l force -d 'forces execution even when the task is up-to-date'
|
||||
complete -c $GO_TASK_PROGNAME -s h -l help -d 'shows Task usage'
|
||||
complete -c $GO_TASK_PROGNAME -s i -l init -d 'creates a new Taskfile.yml in the current folder'
|
||||
complete -c $GO_TASK_PROGNAME -s l -l list -d 'lists tasks with description of current Taskfile'
|
||||
complete -c $GO_TASK_PROGNAME -s o -l output -d 'sets output style: [interleaved|group|prefixed]' -xa "interleaved group prefixed"
|
||||
complete -c $GO_TASK_PROGNAME -s p -l parallel -d 'executes tasks provided on command line in parallel'
|
||||
complete -c $GO_TASK_PROGNAME -s s -l silent -d 'disables echoing'
|
||||
complete -c $GO_TASK_PROGNAME -l status -d 'exits with non-zero exit code if any of the given tasks is not up-to-date'
|
||||
complete -c $GO_TASK_PROGNAME -l summary -d 'show summary about a task'
|
||||
complete -c $GO_TASK_PROGNAME -s t -l taskfile -d 'choose which Taskfile to run. Defaults to "Taskfile.yml"'
|
||||
complete -c $GO_TASK_PROGNAME -s v -l verbose -d 'enables verbose mode'
|
||||
complete -c $GO_TASK_PROGNAME -l version -d 'show Task version'
|
||||
complete -c $GO_TASK_PROGNAME -s w -l watch -d 'enables watch of the given task'
|
338
files/config/fish/jj.fish
Normal file
338
files/config/fish/jj.fish
Normal file
|
@ -0,0 +1,338 @@
|
|||
# TODO: passthru other args? E.g.. --at-operation, --repository
|
||||
function __jj
|
||||
command jj --ignore-working-copy --color=never --quiet $argv 2>/dev/null
|
||||
end
|
||||
|
||||
# Aliases
|
||||
# Based on https://github.com/fish-shell/fish-shell/blob/cd71359c42f633d9d71a63591ae16d150407a2b2/share/completions/git.fish#L625.
|
||||
#
|
||||
# Aliases are stored in global variables.
|
||||
# `__jj_aliases` is a list of all aliases and `__jj_alias_$alias` is the command line for the alias.
|
||||
function __jj_add_alias
|
||||
set -l alias $argv[1]
|
||||
set -l alias_escaped (string escape --style=var -- $alias)
|
||||
set -g __jj_alias_$alias_escaped $argv
|
||||
set --append -g __jj_aliases $alias
|
||||
end
|
||||
|
||||
__jj config list aliases -T 'concat(name, "\t", value, "\n")' --include-defaults | while read -l config_alias
|
||||
set -l parsed (string match --regex '^aliases\.(.+)\t(.*)$' --groups-only -- $config_alias)
|
||||
set -l alias $parsed[1]
|
||||
set -l command $parsed[2]
|
||||
set -l args $alias
|
||||
# Replace wrapping `[]` if any
|
||||
set -l command (string replace -r --all '^\[|]$' "" -- $command)
|
||||
while test (string length -- $command) -gt 0
|
||||
set -l parsed (string match -r '^"((?:\\\"|[^"])*?)"(?:,\s)?(.*)$' --groups-only -- $command)
|
||||
set --append args $parsed[1]
|
||||
set command $parsed[2]
|
||||
end
|
||||
__jj_add_alias $args
|
||||
end
|
||||
|
||||
__jj_add_alias ci commit
|
||||
__jj_add_alias desc describe
|
||||
__jj_add_alias op operation
|
||||
__jj_add_alias st status
|
||||
|
||||
# Resolve aliases that call another alias.
|
||||
for alias in $__jj_aliases
|
||||
set -l handled $alias
|
||||
|
||||
while true
|
||||
set -l alias_escaped (string escape --style=var -- $alias)
|
||||
set -l alias_varname __jj_alias_$alias_escaped
|
||||
set -l aliased_command $$alias_varname[1][2]
|
||||
set -l aliased_escaped (string escape --style=var -- $aliased_command)
|
||||
set -l aliased_varname __jj_alias_$aliased_escaped
|
||||
set -q $aliased_varname
|
||||
or break
|
||||
|
||||
# Prevent infinite recursion
|
||||
contains $aliased_escaped $handled
|
||||
and break
|
||||
|
||||
# Expand alias in cmdline
|
||||
set -l aliased_cmdline $$aliased_varname[1][2..-1]
|
||||
set --append aliased_cmdline $$alias_varname[1][3..-1]
|
||||
set -g $alias_varname $$alias_varname[1][1] $aliased_cmdline
|
||||
set --append handled $aliased_escaped
|
||||
end
|
||||
end
|
||||
|
||||
function __jj_aliases_with_descriptions
|
||||
for alias in $__jj_aliases
|
||||
set -l alias_escaped (string escape --style=var -- $alias)
|
||||
set -l alias_varname __jj_alias_$alias_escaped
|
||||
set -l aliased_cmdline (string join " " -- $$alias_varname[1][2..-1] | string replace -r --all '\\\"' '"')
|
||||
printf "%s\talias: %s\n" $alias $aliased_cmdline
|
||||
end
|
||||
end
|
||||
|
||||
# Based on https://github.com/fish-shell/fish-shell/blob/2d4e42ee93327b9cfd554a0d809f85e3d371e70e/share/functions/__fish_seen_subcommand_from.fish.
|
||||
# Test to see if we've seen a subcommand from a list.
|
||||
# This logic may seem backwards, but the commandline will often be much shorter than the list.
|
||||
function __jj_seen_subcommand_from
|
||||
set -l cmd (commandline -opc)
|
||||
set -e cmd[1]
|
||||
|
||||
# Check command line arguments first.
|
||||
for i in $cmd
|
||||
if contains -- $i $argv
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
# Check aliases.
|
||||
set -l alias $cmd[1]
|
||||
set -l alias_escaped (string escape --style=var -- $alias)
|
||||
set -l varname __jj_alias_$alias_escaped
|
||||
set -q $varname
|
||||
or return 1
|
||||
|
||||
for i in $$varname[1][2..-1]
|
||||
if contains -- $i $argv
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
return 1
|
||||
end
|
||||
|
||||
function __jj_changes
|
||||
__jj log --no-graph --limit 1000 -r $argv[1] \
|
||||
-T 'separate("\t", change_id.shortest(), if(description, description.first_line(), "(no description set)")) ++ "\n"'
|
||||
end
|
||||
|
||||
function __jj_branches
|
||||
set -f filter $argv[1]
|
||||
if string length --quiet -- $argv[2]
|
||||
__jj branch list --all-remotes -r "$argv[2]" \
|
||||
-T "if($filter, name ++ if(remote, \"@\" ++ remote) ++ \"\t\" ++ if(normal_target, normal_target.change_id().shortest() ++ \": \" ++ if(normal_target.description(), normal_target.description().first_line(), \"(no description set)\"), \"(conflicted branch)\") ++ \"\n\")"
|
||||
else
|
||||
__jj branch list --all-remotes \
|
||||
-T "if($filter, name ++ if(remote, \"@\" ++ remote) ++ \"\t\" ++ if(normal_target, normal_target.change_id().shortest() ++ \": \" ++ if(normal_target.description(), normal_target.description().first_line(), \"(no description set)\"), \"(conflicted branch)\") ++ \"\n\")"
|
||||
end
|
||||
end
|
||||
|
||||
function __jj_all_branches
|
||||
__jj_branches '!remote || !remote.starts_with("git")' $argv[1]
|
||||
end
|
||||
|
||||
function __jj_local_branches
|
||||
__jj_branches '!remote' ''
|
||||
end
|
||||
|
||||
function __jj_remote_branches
|
||||
__jj_branches 'remote && !remote.starts_with("git")' ''
|
||||
end
|
||||
|
||||
function __jj_all_changes
|
||||
if string length --quiet -- $argv[1]
|
||||
set -f REV $argv[1]
|
||||
else
|
||||
set -f REV "all()"
|
||||
end
|
||||
__jj_changes $REV
|
||||
__jj_all_branches $REV
|
||||
end
|
||||
|
||||
function __jj_mutable_changes
|
||||
set -f REV "mutable()"
|
||||
__jj_changes $REV
|
||||
__jj_all_branches $REV
|
||||
end
|
||||
|
||||
function __jj_revision_modified_files
|
||||
if test $argv[1] = "@"
|
||||
set -f suffix ""
|
||||
else
|
||||
set -l change_id (__jj log --no-graph --limit 1 -T 'change_id.shortest()')
|
||||
set -f suffix " in $change_id"
|
||||
end
|
||||
|
||||
__jj diff -r $argv[1] --summary | while read -l line
|
||||
set -l file (string split " " -m 1 -- $line)
|
||||
switch $file[1]
|
||||
case M
|
||||
set -f change Modified
|
||||
case D
|
||||
set -f change Deleted
|
||||
case A
|
||||
set -f change Added
|
||||
end
|
||||
printf "%s\t%s%s\n" $file[2] $change $suffix
|
||||
end
|
||||
end
|
||||
|
||||
function __jj_remotes
|
||||
__jj git remote list | while read -l remote
|
||||
printf "%s\t%s\n" (string split " " -m 1 -- $remote)
|
||||
end
|
||||
end
|
||||
|
||||
function __jj_operations
|
||||
__jj operation log --no-graph --limit 1000 -T 'separate("\t", id.short(), description) ++ "\n"'
|
||||
end
|
||||
|
||||
function __jj_parse_revision
|
||||
set -l cmd (commandline -opc)
|
||||
set -e cmd[1]
|
||||
set -l return_next false
|
||||
set -l return_value 1
|
||||
|
||||
# Check aliases.
|
||||
set -l alias $cmd[1]
|
||||
set -l alias_escaped (string escape --style=var -- $alias)
|
||||
set -l varname __jj_alias_$alias_escaped
|
||||
|
||||
if set -q $varname
|
||||
set cmd $$varname[1][2..-1] $cmd[2..-1]
|
||||
end
|
||||
|
||||
# Check command line arguments first.
|
||||
for i in $cmd
|
||||
if $return_next
|
||||
echo $i
|
||||
set return_value 0
|
||||
else if contains -- $i -r --revision --from
|
||||
set return_next true
|
||||
else
|
||||
set -l match (string match --regex '^(?:-r=?|--revision=|--from=)(.+)\s*$' --groups-only -- $i)
|
||||
if set -q match[1]
|
||||
echo $match[1]
|
||||
set return_value 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return $return_value
|
||||
end
|
||||
|
||||
function __jj_revision_files
|
||||
set -l description (__jj log --no-graph --limit 1 -r $argv[1] -T 'change_id.shortest() ++ ": " ++ coalesce(description.first_line().substr(0, 30), "(no description set)")')
|
||||
__jj file list -r $argv[1] | while read -l file
|
||||
printf "%s\t%s\n" $file $description
|
||||
end
|
||||
end
|
||||
|
||||
function __jj_revision_conflicted_files
|
||||
__jj resolve --list -r $argv[1] | while read -l line
|
||||
set -l file (string split " " -m 1 -- $line)
|
||||
printf "%s\t%s\n" $file[1] $file[2]
|
||||
end
|
||||
end
|
||||
|
||||
function __jj_parse_revision_files
|
||||
set -l rev (__jj_parse_revision)
|
||||
if test $status -eq 1
|
||||
set rev "@"
|
||||
end
|
||||
__jj_revision_files $rev
|
||||
end
|
||||
|
||||
function __jj_parse_revision_conflicted_files
|
||||
set -l rev (__jj_parse_revision)
|
||||
if test $status -eq 1
|
||||
set rev "@"
|
||||
end
|
||||
__jj_revision_conflicted_files $rev
|
||||
end
|
||||
|
||||
function __jj_parse_revision_files_or_wc_modified_files
|
||||
set -l revs (__jj_parse_revision)
|
||||
if test $status -eq 1
|
||||
__jj_revision_modified_files "@"
|
||||
else
|
||||
for rev in $revs
|
||||
__jj_revision_files $rev
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function __jj_parse_revision_modified_files_or_wc_modified_files
|
||||
set -l revs (__jj_parse_revision)
|
||||
if test $status -eq 1
|
||||
__jj_revision_modified_files "@"
|
||||
else
|
||||
for rev in $revs
|
||||
__jj_revision_modified_files $rev
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Aliases.
|
||||
complete -f -c jj -n __fish_use_subcommand -a '(__jj_aliases_with_descriptions)'
|
||||
|
||||
# Files.
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from file; and __jj_seen_subcommand_from show' -ka '(__jj_parse_revision_files)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from file; and __jj_seen_subcommand_from chmod' -ka '(__jj_parse_revision_files)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from commit' -ka '(__jj_revision_modified_files "@")'
|
||||
complete -c jj -n '__jj_seen_subcommand_from diff' -ka '(__jj_parse_revision_files_or_wc_modified_files)'
|
||||
complete -c jj -n '__jj_seen_subcommand_from interdiff' -ka '(__jj_parse_revision_files)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from resolve' -ka '(__jj_parse_revision_conflicted_files)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from restore' -ka '(__jj_parse_revision_files_or_wc_modified_files)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from split' -ka '(__jj_parse_revision_modified_files_or_wc_modified_files)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from squash' -ka '(__jj_parse_revision_modified_files_or_wc_modified_files)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from untrack' -ka '(__jj_parse_revision_files_or_wc_modified_files)'
|
||||
|
||||
# Revisions.
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from abandon' -ka '(__jj_mutable_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from backout' -s r -l revision -rka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from backout' -s d -l destination -rka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from file; and __jj_seen_subcommand_from show' -s r -l revision -rka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from chmod' -s r -l revision -rka '(__jj_mutable_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from describe' -ka '(__jj_mutable_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from diff' -s r -l revision -rka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from diff' -l from -rka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from diff' -l to -rka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from diffedit' -s r -l revision -rka '(__jj_mutable_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from diffedit' -l from -rka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from diffedit' -l to -rka '(__jj_mutable_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from duplicate' -ka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from edit' -ka '(__jj_mutable_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from file; and __jj_seen_subcommand_from list' -s r -l revision -rka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from interdiff' -l from -rka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from interdiff' -l to -rka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from log' -s r -rka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from new' -ka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from new' -s A -l after -l insert-after -rka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from new' -s B -l before -l insert-before -rka '(__jj_mutable_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from obslog' -s r -l revision -rka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from parallelize' -ka '(__jj_mutable_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from rebase' -s r -l revisions -rka '(__jj_mutable_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from rebase' -s s -l source -rka '(__jj_mutable_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from rebase' -s b -l branch -rka '(__jj_mutable_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from rebase' -s d -l destination -rka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from rebase' -s A -l after -l insert-after -rka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from rebase' -s B -l before -l insert-before -rka '(__jj_mutable_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from resolve' -s r -l revision -rka '(__jj_mutable_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from restore' -l from -rka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from restore' -l to -rka '(__jj_mutable_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from restore' -s c -l changes-in -rka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from show' -ka '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from split' -s r -l revision -rka '(__jj_mutable_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from squash' -s r -l revision -rka '(__jj_mutable_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from squash' -l from -rka '(__jj_mutable_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from squash' -l to -l into -rka '(__jj_mutable_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from unsquash' -s r -l revision -rka '(__jj_mutable_changes)'
|
||||
|
||||
# Branches.
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from branch; and __jj_seen_subcommand_from delete forget rename set d f r s' -ka '(__jj_local_branches)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from branch; and __jj_seen_subcommand_from track t' -ka '(__jj_branches "remote && !tracked" "")'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from branch; and __jj_seen_subcommand_from untrack' -ka '(__jj_branches "remote && tracked && !remote.starts_with(\"git\")" "")'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from branch; and __jj_seen_subcommand_from create move set c m s' -s r -l revision -kra '(__jj_all_changes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from branch; and __jj_seen_subcommand_from move' -l from -rka '(__jj_changes "all()")'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from branch; and __jj_seen_subcommand_from move' -l to -rka '(__jj_changes "all()")'
|
||||
|
||||
# Git.
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from git; and __jj_seen_subcommand_from push' -s c -l change -kra '(__jj_changes "all()")'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from git; and __jj_seen_subcommand_from push' -s r -l revisions -kra '(__jj_changes "all()")'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from git; and __jj_seen_subcommand_from fetch push' -s b -l branch -rka '(__jj_local_branches)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from git; and __jj_seen_subcommand_from fetch push' -l remote -rka '(__jj_remotes)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from git; and __jj_seen_subcommand_from remote; and __jj_seen_subcommand_from remove rename set-url' -ka '(__jj_remotes)'
|
||||
|
||||
# Operations.
|
||||
complete -f -c jj -l at-op -l at-operation -rka '(__jj_operations)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from undo' -ka '(__jj_operations)'
|
||||
complete -f -c jj -n '__jj_seen_subcommand_from operation; and __jj_seen_subcommand_from abandon undo restore' -ka '(__jj_operations)'
|
55
files/config/fish/semantic-prompt.fish
Normal file
55
files/config/fish/semantic-prompt.fish
Normal file
|
@ -0,0 +1,55 @@
|
|||
## Semantic prompt (for Wezterm)
|
||||
|
||||
set _fishprompt_aid "fish"$fish_pid
|
||||
set _fishprompt_started 0
|
||||
# empty if running; or a numeric exit code; or CANCEL
|
||||
set _fishprompt_postexec ""
|
||||
|
||||
functions -c fish_prompt _fishprompt_saved_prompt
|
||||
set _fishprompt_prompt_count 0
|
||||
set _fishprompt_disp_count 0
|
||||
function _fishprompt_start --on-event fish_prompt
|
||||
set _fishprompt_prompt_count (math $_fishprompt_prompt_count + 1)
|
||||
# don't use post-exec, because it is called *before* omitted-newline output
|
||||
if [ -n "$_fishprompt_postexec" ]
|
||||
printf "\033]133;D;%s;aid=%s\007" "$_fishprompt_postexec" $_fishprompt_aid
|
||||
end
|
||||
printf "\033]133;A;aid=%s;cl=m\007" $_fishprompt_aid
|
||||
end
|
||||
|
||||
function fish_prompt
|
||||
set _fishprompt_disp_count (math $_fishprompt_disp_count + 1)
|
||||
printf "\033]133;P;k=i\007%b\033]133;B\007" (string join "\n" (_fishprompt_saved_prompt))
|
||||
set _fishprompt_started 1
|
||||
set _fishprompt_postexec ""
|
||||
end
|
||||
|
||||
function _fishprompt_preexec --on-event fish_preexec
|
||||
if [ "$_fishprompt_started" = 1 ]
|
||||
printf "\033]133;C;\007"
|
||||
end
|
||||
set _fishprompt_started 0
|
||||
end
|
||||
|
||||
function _fishprompt_postexec --on-event fish_postexec
|
||||
set _fishprompt_postexec $status
|
||||
_fishprompt_start
|
||||
end
|
||||
|
||||
function __fishprompt_cancel --on-event fish_cancel
|
||||
set _fishprompt_postexec CANCEL
|
||||
_fishprompt_start
|
||||
end
|
||||
|
||||
function _fishprompt_exit --on-process %self
|
||||
if [ "$_fishprompt_started" = 1 ]
|
||||
printf "\033]133;Z;aid=%s\007" $_fishprompt_aid
|
||||
end
|
||||
end
|
||||
|
||||
if functions -q fish_right_prompt
|
||||
functions -c fish_right_prompt _fishprompt_saved_right_prompt
|
||||
function fish_right_prompt
|
||||
printf "\033]133;P;k=r\007%b\033]133;B\007" (string join "\n" (_fishprompt_saved_right_prompt))
|
||||
end
|
||||
end
|
72
files/config/fish/vcs.fish
Normal file
72
files/config/fish/vcs.fish
Normal file
|
@ -0,0 +1,72 @@
|
|||
|
||||
function __jj_in_repo
|
||||
jj --ignore-working-copy --quiet root >>/dev/null 2>&1
|
||||
end
|
||||
|
||||
function vcs_root
|
||||
jj workspace root --ignore-working-copy 2>/dev/null || git rev-parse --show-toplevel 2>/dev/null || pwd
|
||||
end
|
||||
|
||||
function vcs_broot
|
||||
br (vcs_root)
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
function vcs_jump
|
||||
set _dir (vcs_root)
|
||||
if [ "$_dir" = "$PWD" ]
|
||||
set _dir (br -f --conf "$HOME/.config/broot/conf.toml")
|
||||
end
|
||||
[ -n "$_dir" ] && pushd $_dir >>/dev/null
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
function vcs_status
|
||||
if __jj_in_repo
|
||||
jj status --ignore-working-copy
|
||||
else
|
||||
git status -sb
|
||||
end
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
function vcs_diff
|
||||
if __jj_in_repo
|
||||
jj show $argv
|
||||
else
|
||||
git diff --stat -p -C --color-words $argv
|
||||
end
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
|
||||
function vcs_log
|
||||
if __jj_in_repo
|
||||
jj log --ignore-working-copy $argv
|
||||
else
|
||||
git diff --stat -p -C --color-words $argv
|
||||
end
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
function vcs_ui
|
||||
if __jj_in_repo
|
||||
lazyjj
|
||||
else
|
||||
gitui
|
||||
end
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
# Abbreviations
|
||||
|
||||
abbr -a d vcs_diff
|
||||
abbr -a s vcs_status
|
||||
|
||||
# Bindings
|
||||
bind \c_ vcs_jump
|
||||
bind \ea vcs_log
|
||||
bind \ee vcs_broot
|
||||
bind \eg vcs_ui
|
||||
bind \eS vcs_diff
|
||||
bind \es vcs_status
|
Loading…
Add table
Add a link
Reference in a new issue