summaryrefslogtreecommitdiff
path: root/home-config/fish/functions
diff options
context:
space:
mode:
authorRyan Schanzenbacher <ryan@rschanz.org>2024-04-05 11:57:45 -0400
committerRyan Schanzenbacher <ryan@rschanz.org>2024-04-05 11:57:45 -0400
commitb88d77fb2d0d5028a6f5670695dee6bec129501f (patch)
tree2536b0461d297e647cf07157641c9b1223339adf /home-config/fish/functions
parent776a7ca55d2d2c3f396de91db1c6c3c5065012cd (diff)
ahhh sloppy fish, still needs fixing, esp with the vars
Diffstat (limited to 'home-config/fish/functions')
-rw-r--r--home-config/fish/functions/_fzf_configure_bindings_help.fish43
-rw-r--r--home-config/fish/functions/_fzf_extract_var_info.fish15
-rw-r--r--home-config/fish/functions/_fzf_preview_changed_file.fish49
-rw-r--r--home-config/fish/functions/_fzf_preview_file.fish43
-rw-r--r--home-config/fish/functions/_fzf_report_diff_type.fish18
-rw-r--r--home-config/fish/functions/_fzf_report_file_type.fish6
-rw-r--r--home-config/fish/functions/_fzf_search_directory.fish33
-rw-r--r--home-config/fish/functions/_fzf_search_git_log.fish36
-rw-r--r--home-config/fish/functions/_fzf_search_git_status.fish41
-rw-r--r--home-config/fish/functions/_fzf_search_history.fish39
-rw-r--r--home-config/fish/functions/_fzf_search_processes.fish32
-rw-r--r--home-config/fish/functions/_fzf_search_variables.fish47
-rw-r--r--home-config/fish/functions/_fzf_wrapper.fish20
-rw-r--r--home-config/fish/functions/_tide_1_line_prompt.fish19
-rw-r--r--home-config/fish/functions/_tide_2_line_prompt.fish31
-rw-r--r--home-config/fish/functions/_tide_cache_variables.fish17
-rw-r--r--home-config/fish/functions/_tide_detect_os.fish77
-rw-r--r--home-config/fish/functions/_tide_find_and_remove.fish3
-rw-r--r--home-config/fish/functions/_tide_fish_colorize.fish7
-rw-r--r--home-config/fish/functions/_tide_item_aws.fish11
-rw-r--r--home-config/fish/functions/_tide_item_character.fish17
-rw-r--r--home-config/fish/functions/_tide_item_cmd_duration.fish12
-rw-r--r--home-config/fish/functions/_tide_item_context.fish14
-rw-r--r--home-config/fish/functions/_tide_item_crystal.fish6
-rw-r--r--home-config/fish/functions/_tide_item_direnv.fish7
-rw-r--r--home-config/fish/functions/_tide_item_distrobox.fish4
-rw-r--r--home-config/fish/functions/_tide_item_docker.fish5
-rw-r--r--home-config/fish/functions/_tide_item_elixir.fish4
-rw-r--r--home-config/fish/functions/_tide_item_gcloud.fish8
-rw-r--r--home-config/fish/functions/_tide_item_git.fish72
-rw-r--r--home-config/fish/functions/_tide_item_go.fish6
-rw-r--r--home-config/fish/functions/_tide_item_java.fish6
-rw-r--r--home-config/fish/functions/_tide_item_jobs.fish7
-rw-r--r--home-config/fish/functions/_tide_item_kubectl.fish4
-rw-r--r--home-config/fish/functions/_tide_item_nix_shell.fish3
-rw-r--r--home-config/fish/functions/_tide_item_node.fish6
-rw-r--r--home-config/fish/functions/_tide_item_os.fish3
-rw-r--r--home-config/fish/functions/_tide_item_php.fish6
-rw-r--r--home-config/fish/functions/_tide_item_private_mode.fish3
-rw-r--r--home-config/fish/functions/_tide_item_pulumi.fish19
-rw-r--r--home-config/fish/functions/_tide_item_python.fish27
-rw-r--r--home-config/fish/functions/_tide_item_ruby.fish6
-rw-r--r--home-config/fish/functions/_tide_item_rustc.fish6
-rw-r--r--home-config/fish/functions/_tide_item_shlvl.fish4
-rw-r--r--home-config/fish/functions/_tide_item_status.fish15
-rw-r--r--home-config/fish/functions/_tide_item_terraform.fish5
-rw-r--r--home-config/fish/functions/_tide_item_time.fish3
-rw-r--r--home-config/fish/functions/_tide_item_toolbox.fish4
-rw-r--r--home-config/fish/functions/_tide_item_vi_mode.fish16
-rw-r--r--home-config/fish/functions/_tide_item_zig.fish6
-rw-r--r--home-config/fish/functions/_tide_parent_dirs.fish7
-rw-r--r--home-config/fish/functions/_tide_print_item.fish22
-rw-r--r--home-config/fish/functions/_tide_pwd.fish42
-rw-r--r--home-config/fish/functions/_tide_remove_unusable_items.fish25
-rw-r--r--home-config/fish/functions/_tide_sub_bug-report.fish73
-rw-r--r--home-config/fish/functions/_tide_sub_configure.fish156
-rw-r--r--home-config/fish/functions/_tide_sub_reload.fish3
-rw-r--r--home-config/fish/functions/fish_mode_prompt.fish1
-rw-r--r--home-config/fish/functions/fish_prompt.fish171
-rw-r--r--home-config/fish/functions/fisher.fish240
-rw-r--r--home-config/fish/functions/fzf_configure_bindings.fish46
-rw-r--r--home-config/fish/functions/tide.fish28
-rw-r--r--home-config/fish/functions/tide/configure/choices/all/finish.fish46
-rw-r--r--home-config/fish/functions/tide/configure/choices/all/icons.fish33
-rw-r--r--home-config/fish/functions/tide/configure/choices/all/prompt_colors.fish26
-rw-r--r--home-config/fish/functions/tide/configure/choices/all/prompt_connection.fish31
-rw-r--r--home-config/fish/functions/tide/configure/choices/all/prompt_connection_andor_frame_color.fish40
-rw-r--r--home-config/fish/functions/tide/configure/choices/all/prompt_spacing.fish22
-rw-r--r--home-config/fish/functions/tide/configure/choices/all/show_time.fish33
-rw-r--r--home-config/fish/functions/tide/configure/choices/all/style.fish36
-rw-r--r--home-config/fish/functions/tide/configure/choices/all/transient.fish22
-rw-r--r--home-config/fish/functions/tide/configure/choices/classic/classic_prompt_color.fish38
-rw-r--r--home-config/fish/functions/tide/configure/choices/classic/classic_prompt_separators.fish40
-rw-r--r--home-config/fish/functions/tide/configure/choices/lean/lean_prompt_height.fish26
-rw-r--r--home-config/fish/functions/tide/configure/choices/powerline/powerline_prompt_heads.fish32
-rw-r--r--home-config/fish/functions/tide/configure/choices/powerline/powerline_prompt_style.fish51
-rw-r--r--home-config/fish/functions/tide/configure/choices/powerline/powerline_prompt_tails.fish40
-rw-r--r--home-config/fish/functions/tide/configure/choices/powerline/powerline_right_prompt_frame.fish20
-rw-r--r--home-config/fish/functions/tide/configure/choices/rainbow/rainbow_prompt_separators.fish40
-rw-r--r--home-config/fish/functions/tide/configure/configs/classic.fish116
-rw-r--r--home-config/fish/functions/tide/configure/configs/classic_16color.fish89
-rw-r--r--home-config/fish/functions/tide/configure/configs/lean.fish116
-rw-r--r--home-config/fish/functions/tide/configure/configs/lean_16color.fish89
-rw-r--r--home-config/fish/functions/tide/configure/configs/rainbow.fish116
-rw-r--r--home-config/fish/functions/tide/configure/configs/rainbow_16color.fish93
-rw-r--r--home-config/fish/functions/tide/configure/functions/_fake_tide_cache_variables.fish41
-rw-r--r--home-config/fish/functions/tide/configure/functions/_fake_tide_item_character.fish8
-rw-r--r--home-config/fish/functions/tide/configure/functions/_fake_tide_item_cmd_duration.fish3
-rw-r--r--home-config/fish/functions/tide/configure/functions/_fake_tide_item_git.fish3
-rw-r--r--home-config/fish/functions/tide/configure/functions/_fake_tide_item_newline.fish5
-rw-r--r--home-config/fish/functions/tide/configure/functions/_fake_tide_item_os.fish3
-rw-r--r--home-config/fish/functions/tide/configure/functions/_fake_tide_item_time.fish3
-rw-r--r--home-config/fish/functions/tide/configure/functions/_fake_tide_print_item.fish22
-rw-r--r--home-config/fish/functions/tide/configure/functions/_fake_tide_prompt.fish42
-rw-r--r--home-config/fish/functions/tide/configure/functions/_fake_tide_pwd.fish11
-rw-r--r--home-config/fish/functions/tide/configure/icons.fish40
96 files changed, 3081 insertions, 0 deletions
diff --git a/home-config/fish/functions/_fzf_configure_bindings_help.fish b/home-config/fish/functions/_fzf_configure_bindings_help.fish
new file mode 100644
index 0000000..ecfe68e
--- /dev/null
+++ b/home-config/fish/functions/_fzf_configure_bindings_help.fish
@@ -0,0 +1,43 @@
1function _fzf_configure_bindings_help --description "Prints the help message for fzf_configure_bindings."
2 echo "\
3USAGE:
4 fzf_configure_bindings [--COMMAND=[KEY_SEQUENCE]...]
5
6DESCRIPTION
7 fzf_configure_bindings installs key bindings for fzf.fish's commands and erases any bindings it
8 previously installed. It installs bindings for both default and insert modes. fzf.fish executes
9 it without options on fish startup to install the out-of-the-box key bindings.
10
11 By default, commands are bound to a mnemonic key sequence, shown below. Each command's binding
12 can be configured using a namesake corresponding option:
13 COMMAND | DEFAULT KEY SEQUENCE | CORRESPONDING OPTION
14 Search Directory | Ctrl+Alt+F (F for file) | --directory
15 Search Git Log | Ctrl+Alt+L (L for log) | --git_log
16 Search Git Status | Ctrl+Alt+S (S for status) | --git_status
17 Search History | Ctrl+R (R for reverse) | --history
18 Search Processes | Ctrl+Alt+P (P for process) | --processes
19 Search Variables | Ctrl+V (V for variable) | --variables
20 Override a command's binding by specifying its corresponding option with the desired key
21 sequence. Disable a command's binding by specifying its corresponding option with no value.
22
23 Because fzf_configure_bindings erases bindings it previously installed, it can be cleanly
24 executed multiple times. Once the desired fzf_configure_bindings command has been found, add it
25 to your config.fish in order to persist the customized bindings.
26
27 In terms of validation, fzf_configure_bindings fails if passed unknown options. It expects an
28 equals sign between an option's name and value. However, it does not validate key sequences.
29
30 Pass -h or --help to print this help message and exit.
31
32EXAMPLES
33 Default bindings but bind Search Directory to Ctrl+F and Search Variables to Ctrl+Alt+V
34 \$ fzf_configure_bindings --directory=\cf --variables=\e\cv
35 Default bindings but disable Search History
36 \$ fzf_configure_bindings --history=
37 An agglomeration of different options
38 \$ fzf_configure_bindings --git_status=\cg --history=\ch --variables= --processes=
39
40SEE Also
41 To learn more about fish key bindings, see bind(1) and fish_key_reader(1).
42"
43end
diff --git a/home-config/fish/functions/_fzf_extract_var_info.fish b/home-config/fish/functions/_fzf_extract_var_info.fish
new file mode 100644
index 0000000..dd4e952
--- /dev/null
+++ b/home-config/fish/functions/_fzf_extract_var_info.fish
@@ -0,0 +1,15 @@
1# helper function for _fzf_search_variables
2function _fzf_extract_var_info --argument-names variable_name set_show_output --description "Extract and reformat lines pertaining to \$variable_name from \$set_show_output."
3 # Extract only the lines about the variable, all of which begin with either
4 # $variable_name: ...or... $variable_name[
5 string match --regex "^\\\$$variable_name(?::|\[).*" <$set_show_output |
6
7 # Strip the variable name prefix, including ": " for scope info lines
8 string replace --regex "^\\\$$variable_name(?:: )?" '' |
9
10 # Distill the lines of values, replacing...
11 # [1]: |value|
12 # ...with...
13 # [1] value
14 string replace --regex ": \|(.*)\|" ' $1'
15end
diff --git a/home-config/fish/functions/_fzf_preview_changed_file.fish b/home-config/fish/functions/_fzf_preview_changed_file.fish
new file mode 100644
index 0000000..78dd561
--- /dev/null
+++ b/home-config/fish/functions/_fzf_preview_changed_file.fish
@@ -0,0 +1,49 @@
1# helper for _fzf_search_git_status
2# arg should be a line from git status --short, e.g.
3# MM functions/_fzf_preview_changed_file.fish
4# D README.md
5# R LICENSE -> "New License"
6function _fzf_preview_changed_file --argument-names path_status --description "Show the git diff of the given file."
7 # remove quotes because they'll be interpreted literally by git diff
8 # no need to requote when referencing $path because fish does not perform word splitting
9 # https://fishshell.com/docs/current/fish_for_bash_users.html
10 set -f path (string unescape (string sub --start 4 $path_status))
11 # first letter of short format shows index, second letter shows working tree
12 # https://git-scm.com/docs/git-status/2.35.0#_short_format
13 set -f index_status (string sub --length 1 $path_status)
14 set -f working_tree_status (string sub --start 2 --length 1 $path_status)
15
16 set -f diff_opts --color=always
17
18 if test $index_status = '?'
19 _fzf_report_diff_type Untracked
20 _fzf_preview_file $path
21 else if contains {$index_status}$working_tree_status DD AU UD UA DU AA UU
22 # Unmerged statuses taken directly from git status help's short format table
23 # Unmerged statuses are mutually exclusive with other statuses, so if we see
24 # these, then safe to assume the path is unmerged
25 _fzf_report_diff_type Unmerged
26 git diff $diff_opts -- $path
27 else
28 if test $index_status != ' '
29 _fzf_report_diff_type Staged
30
31 # renames are only detected in the index, never working tree, so only need to test for it here
32 # https://stackoverflow.com/questions/73954214
33 if test $index_status = R
34 # diff the post-rename path with the original path, otherwise the diff will show the entire file as being added
35 set -f orig_and_new_path (string split --max 1 -- ' -> ' $path)
36 git diff --staged $diff_opts -- $orig_and_new_path[1] $orig_and_new_path[2]
37 # path currently has the form of "original -> current", so we need to correct it before it's used below
38 set path $orig_and_new_path[2]
39 else
40 git diff --staged $diff_opts -- $path
41 end
42 end
43
44 if test $working_tree_status != ' '
45 _fzf_report_diff_type Unstaged
46 git diff $diff_opts -- $path
47 end
48 end
49end
diff --git a/home-config/fish/functions/_fzf_preview_file.fish b/home-config/fish/functions/_fzf_preview_file.fish
new file mode 100644
index 0000000..c926475
--- /dev/null
+++ b/home-config/fish/functions/_fzf_preview_file.fish
@@ -0,0 +1,43 @@
1# helper function for _fzf_search_directory and _fzf_search_git_status
2function _fzf_preview_file --description "Print a preview for the given file based on its file type."
3 # because there's no way to guarantee that _fzf_search_directory passes the path to _fzf_preview_file
4 # as one argument, we collect all the arguments into one single variable and treat that as the path
5 set -f file_path $argv
6
7 if test -L "$file_path" # symlink
8 # notify user and recurse on the target of the symlink, which can be any of these file types
9 set -l target_path (realpath "$file_path")
10
11 set_color yellow
12 echo "'$file_path' is a symlink to '$target_path'."
13 set_color normal
14
15 _fzf_preview_file "$target_path"
16 else if test -f "$file_path" # regular file
17 if set --query fzf_preview_file_cmd
18 # need to escape quotes to make sure eval receives file_path as a single arg
19 eval "$fzf_preview_file_cmd '$file_path'"
20 else
21 bat --style=numbers --color=always "$file_path"
22 end
23 else if test -d "$file_path" # directory
24 if set --query fzf_preview_dir_cmd
25 # see above
26 eval "$fzf_preview_dir_cmd '$file_path'"
27 else
28 # -A list hidden files as well, except for . and ..
29 # -F helps classify files by appending symbols after the file name
30 command ls -A -F "$file_path"
31 end
32 else if test -c "$file_path"
33 _fzf_report_file_type "$file_path" "character device file"
34 else if test -b "$file_path"
35 _fzf_report_file_type "$file_path" "block device file"
36 else if test -S "$file_path"
37 _fzf_report_file_type "$file_path" socket
38 else if test -p "$file_path"
39 _fzf_report_file_type "$file_path" "named pipe"
40 else
41 echo "$file_path doesn't exist." >&2
42 end
43end
diff --git a/home-config/fish/functions/_fzf_report_diff_type.fish b/home-config/fish/functions/_fzf_report_diff_type.fish
new file mode 100644
index 0000000..cc26fb3
--- /dev/null
+++ b/home-config/fish/functions/_fzf_report_diff_type.fish
@@ -0,0 +1,18 @@
1# helper for _fzf_preview_changed_file
2# prints out something like
3# ╭────────╮
4# │ Staged │
5# ╰────────╯
6function _fzf_report_diff_type --argument-names diff_type --description "Print a distinct colored header meant to preface a git patch."
7 # number of "-" to draw is the length of the string to box + 2 for padding
8 set -f repeat_count (math 2 + (string length $diff_type))
9 set -f line (string repeat --count $repeat_count ─)
10 set -f top_border ╭$line╮
11 set -f btm_border ╰$line╯
12
13 set_color yellow
14 echo $top_border
15 echo "│ $diff_type │"
16 echo $btm_border
17 set_color normal
18end
diff --git a/home-config/fish/functions/_fzf_report_file_type.fish b/home-config/fish/functions/_fzf_report_file_type.fish
new file mode 100644
index 0000000..49e02e1
--- /dev/null
+++ b/home-config/fish/functions/_fzf_report_file_type.fish
@@ -0,0 +1,6 @@
1# helper function for _fzf_preview_file
2function _fzf_report_file_type --argument-names file_path file_type --description "Explain the file type for a file."
3 set_color red
4 echo "Cannot preview '$file_path': it is a $file_type."
5 set_color normal
6end
diff --git a/home-config/fish/functions/_fzf_search_directory.fish b/home-config/fish/functions/_fzf_search_directory.fish
new file mode 100644
index 0000000..4541eec
--- /dev/null
+++ b/home-config/fish/functions/_fzf_search_directory.fish
@@ -0,0 +1,33 @@
1function _fzf_search_directory --description "Search the current directory. Replace the current token with the selected file paths."
2 # Directly use fd binary to avoid output buffering delay caused by a fd alias, if any.
3 # Debian-based distros install fd as fdfind and the fd package is something else, so
4 # check for fdfind first. Fall back to "fd" for a clear error message.
5 set -f fd_cmd (command -v fdfind || command -v fd || echo "fd")
6 set -f --append fd_cmd --color=always $fzf_fd_opts
7
8 set -f fzf_arguments --multi --ansi $fzf_directory_opts
9 set -f token (commandline --current-token)
10 # expand any variables or leading tilde (~) in the token
11 set -f expanded_token (eval echo -- $token)
12 # unescape token because it's already quoted so backslashes will mess up the path
13 set -f unescaped_exp_token (string unescape -- $expanded_token)
14
15 # If the current token is a directory and has a trailing slash,
16 # then use it as fd's base directory.
17 if string match --quiet -- "*/" $unescaped_exp_token && test -d "$unescaped_exp_token"
18 set --append fd_cmd --base-directory=$unescaped_exp_token
19 # use the directory name as fzf's prompt to indicate the search is limited to that directory
20 set --prepend fzf_arguments --prompt="Directory $unescaped_exp_token> " --preview="_fzf_preview_file $expanded_token{}"
21 set -f file_paths_selected $unescaped_exp_token($fd_cmd 2>/dev/null | _fzf_wrapper $fzf_arguments)
22 else
23 set --prepend fzf_arguments --prompt="Directory> " --query="$unescaped_exp_token" --preview='_fzf_preview_file {}'
24 set -f file_paths_selected ($fd_cmd 2>/dev/null | _fzf_wrapper $fzf_arguments)
25 end
26
27
28 if test $status -eq 0
29 commandline --current-token --replace -- (string escape -- $file_paths_selected | string join ' ')
30 end
31
32 commandline --function repaint
33end
diff --git a/home-config/fish/functions/_fzf_search_git_log.fish b/home-config/fish/functions/_fzf_search_git_log.fish
new file mode 100644
index 0000000..aa54724
--- /dev/null
+++ b/home-config/fish/functions/_fzf_search_git_log.fish
@@ -0,0 +1,36 @@
1function _fzf_search_git_log --description "Search the output of git log and preview commits. Replace the current token with the selected commit hash."
2 if not git rev-parse --git-dir >/dev/null 2>&1
3 echo '_fzf_search_git_log: Not in a git repository.' >&2
4 else
5 if not set --query fzf_git_log_format
6 # %h gives you the abbreviated commit hash, which is useful for saving screen space, but we will have to expand it later below
7 set -f fzf_git_log_format '%C(bold blue)%h%C(reset) - %C(cyan)%ad%C(reset) %C(yellow)%d%C(reset) %C(normal)%s%C(reset) %C(dim normal)[%an]%C(reset)'
8 end
9
10 set -f preview_cmd 'git show --color=always --stat --patch {1}'
11 if set --query fzf_diff_highlighter
12 set preview_cmd "$preview_cmd | $fzf_diff_highlighter"
13 end
14
15 set -f selected_log_lines (
16 git log --no-show-signature --color=always --format=format:$fzf_git_log_format --date=short | \
17 _fzf_wrapper --ansi \
18 --multi \
19 --scheme=history \
20 --prompt="Git Log> " \
21 --preview=$preview_cmd \
22 --query=(commandline --current-token) \
23 $fzf_git_log_opts
24 )
25 if test $status -eq 0
26 for line in $selected_log_lines
27 set -f abbreviated_commit_hash (string split --field 1 " " $line)
28 set -f full_commit_hash (git rev-parse $abbreviated_commit_hash)
29 set -f --append commit_hashes $full_commit_hash
30 end
31 commandline --current-token --replace (string join ' ' $commit_hashes)
32 end
33 end
34
35 commandline --function repaint
36end
diff --git a/home-config/fish/functions/_fzf_search_git_status.fish b/home-config/fish/functions/_fzf_search_git_status.fish
new file mode 100644
index 0000000..358f88c
--- /dev/null
+++ b/home-config/fish/functions/_fzf_search_git_status.fish
@@ -0,0 +1,41 @@
1function _fzf_search_git_status --description "Search the output of git status. Replace the current token with the selected file paths."
2 if not git rev-parse --git-dir >/dev/null 2>&1
3 echo '_fzf_search_git_status: Not in a git repository.' >&2
4 else
5 set -f preview_cmd '_fzf_preview_changed_file {}'
6 if set --query fzf_diff_highlighter
7 set preview_cmd "$preview_cmd | $fzf_diff_highlighter"
8 end
9
10 set -f selected_paths (
11 # Pass configuration color.status=always to force status to use colors even though output is sent to a pipe
12 git -c color.status=always status --short |
13 _fzf_wrapper --ansi \
14 --multi \
15 --prompt="Git Status> " \
16 --query=(commandline --current-token) \
17 --preview=$preview_cmd \
18 --nth="2.." \
19 $fzf_git_status_opts
20 )
21 if test $status -eq 0
22 # git status --short automatically escapes the paths of most files for us so not going to bother trying to handle
23 # the few edges cases of weird file names that should be extremely rare (e.g. "this;needs;escaping")
24 set -f cleaned_paths
25
26 for path in $selected_paths
27 if test (string sub --length 1 $path) = R
28 # path has been renamed and looks like "R LICENSE -> LICENSE.md"
29 # extract the path to use from after the arrow
30 set --append cleaned_paths (string split -- "-> " $path)[-1]
31 else
32 set --append cleaned_paths (string sub --start=4 $path)
33 end
34 end
35
36 commandline --current-token --replace -- (string join ' ' $cleaned_paths)
37 end
38 end
39
40 commandline --function repaint
41end
diff --git a/home-config/fish/functions/_fzf_search_history.fish b/home-config/fish/functions/_fzf_search_history.fish
new file mode 100644
index 0000000..cafbce9
--- /dev/null
+++ b/home-config/fish/functions/_fzf_search_history.fish
@@ -0,0 +1,39 @@
1function _fzf_search_history --description "Search command history. Replace the command line with the selected command."
2 # history merge incorporates history changes from other fish sessions
3 # it errors out if called in private mode
4 if test -z "$fish_private_mode"
5 builtin history merge
6 end
7
8 if not set --query fzf_history_time_format
9 # Reference https://devhints.io/strftime to understand strftime format symbols
10 set -f fzf_history_time_format "%m-%d %H:%M:%S"
11 end
12
13 # Delinate time from command in history entries using the vertical box drawing char (U+2502).
14 # Then, to get raw command from history entries, delete everything up to it. The ? on regex is
15 # necessary to make regex non-greedy so it won't match into commands containing the char.
16 set -f time_prefix_regex '^.*? │ '
17 # Delinate commands throughout pipeline using null rather than newlines because commands can be multi-line
18 set -f commands_selected (
19 builtin history --null --show-time="$fzf_history_time_format │ " |
20 _fzf_wrapper --read0 \
21 --print0 \
22 --multi \
23 --scheme=history \
24 --prompt="History> " \
25 --query=(commandline) \
26 --preview="string replace --regex '$time_prefix_regex' '' -- {} | fish_indent --ansi" \
27 --preview-window="bottom:3:wrap" \
28 $fzf_history_opts |
29 string split0 |
30 # remove timestamps from commands selected
31 string replace --regex $time_prefix_regex ''
32 )
33
34 if test $status -eq 0
35 commandline --replace -- $commands_selected
36 end
37
38 commandline --function repaint
39end
diff --git a/home-config/fish/functions/_fzf_search_processes.fish b/home-config/fish/functions/_fzf_search_processes.fish
new file mode 100644
index 0000000..133a880
--- /dev/null
+++ b/home-config/fish/functions/_fzf_search_processes.fish
@@ -0,0 +1,32 @@
1function _fzf_search_processes --description "Search all running processes. Replace the current token with the pid of the selected process."
2 # Directly use ps command because it is often aliased to a different command entirely
3 # or with options that dirty the search results and preview output
4 set -f ps_cmd (command -v ps || echo "ps")
5 # use all caps to be consistent with ps default format
6 # snake_case because ps doesn't seem to allow spaces in the field names
7 set -f ps_preview_fmt (string join ',' 'pid' 'ppid=PARENT' 'user' '%cpu' 'rss=RSS_IN_KB' 'start=START_TIME' 'command')
8 set -f processes_selected (
9 $ps_cmd -A -opid,command | \
10 _fzf_wrapper --multi \
11 --prompt="Processes> " \
12 --query (commandline --current-token) \
13 --ansi \
14 # first line outputted by ps is a header, so we need to mark it as so
15 --header-lines=1 \
16 # ps uses exit code 1 if the process was not found, in which case show an message explaining so
17 --preview="$ps_cmd -o '$ps_preview_fmt' -p {1} || echo 'Cannot preview {1} because it exited.'" \
18 --preview-window="bottom:4:wrap" \
19 $fzf_processes_opts
20 )
21
22 if test $status -eq 0
23 for process in $processes_selected
24 set -f --append pids_selected (string split --no-empty --field=1 -- " " $process)
25 end
26
27 # string join to replace the newlines outputted by string split with spaces
28 commandline --current-token --replace -- (string join ' ' $pids_selected)
29 end
30
31 commandline --function repaint
32end
diff --git a/home-config/fish/functions/_fzf_search_variables.fish b/home-config/fish/functions/_fzf_search_variables.fish
new file mode 100644
index 0000000..52a7c70
--- /dev/null
+++ b/home-config/fish/functions/_fzf_search_variables.fish
@@ -0,0 +1,47 @@
1# This function expects the following two arguments:
2# argument 1 = output of (set --show | psub), i.e. a file with the scope info and values of all variables
3# argument 2 = output of (set --names | psub), i.e. a file with all variable names
4function _fzf_search_variables --argument-names set_show_output set_names_output --description "Search and preview shell variables. Replace the current token with the selected variable."
5 if test -z "$set_names_output"
6 printf '%s\n' '_fzf_search_variables requires 2 arguments.' >&2
7
8 commandline --function repaint
9 return 22 # 22 means invalid argument in POSIX
10 end
11
12 # Exclude the history variable from being piped into fzf because
13 # 1. it's not included in $set_names_output
14 # 2. it tends to be a very large value => increases computation time
15 # 3._fzf_search_history is a much better way to examine history anyway
16 set -f all_variable_names (string match --invert history <$set_names_output)
17
18 set -f current_token (commandline --current-token)
19 # Use the current token to pre-populate fzf's query. If the current token begins
20 # with a $, remove it from the query so that it will better match the variable names
21 set -f cleaned_curr_token (string replace -- '$' '' $current_token)
22
23 set -f variable_names_selected (
24 printf '%s\n' $all_variable_names |
25 _fzf_wrapper --preview "_fzf_extract_var_info {} $set_show_output" \
26 --prompt="Variables> " \
27 --preview-window="wrap" \
28 --multi \
29 --query=$cleaned_curr_token \
30 $fzf_variables_opts
31 )
32
33 if test $status -eq 0
34 # If the current token begins with a $, do not overwrite the $ when
35 # replacing the current token with the selected variable.
36 # Uses brace expansion to prepend $ to each variable name.
37 commandline --current-token --replace (
38 if string match --quiet -- '$*' $current_token
39 string join " " \${$variable_names_selected}
40 else
41 string join " " $variable_names_selected
42 end
43 )
44 end
45
46 commandline --function repaint
47end
diff --git a/home-config/fish/functions/_fzf_wrapper.fish b/home-config/fish/functions/_fzf_wrapper.fish
new file mode 100644
index 0000000..45556ce
--- /dev/null
+++ b/home-config/fish/functions/_fzf_wrapper.fish
@@ -0,0 +1,20 @@
1function _fzf_wrapper --description "Prepares some environment variables before executing fzf."
2 # Make sure fzf uses fish to execute preview commands, some of which
3 # are autoloaded fish functions so don't exist in other shells.
4 # Use --function so that it doesn't clobber SHELL outside this function.
5 set -f --export SHELL (command --search fish)
6
7 # If FZF_DEFAULT_OPTS is not set, then set some sane defaults.
8 # See https://github.com/junegunn/fzf#environment-variables
9 if not set --query FZF_DEFAULT_OPTS
10 # cycle allows jumping between the first and last results, making scrolling faster
11 # layout=reverse lists results top to bottom, mimicking the familiar layouts of git log, history, and env
12 # border shows where the fzf window begins and ends
13 # height=90% leaves space to see the current command and some scrollback, maintaining context of work
14 # preview-window=wrap wraps long lines in the preview window, making reading easier
15 # marker=* makes the multi-select marker more distinguishable from the pointer (since both default to >)
16 set --export FZF_DEFAULT_OPTS '--cycle --layout=reverse --border --height=90% --preview-window=wrap --marker="*"'
17 end
18
19 fzf $argv
20end
diff --git a/home-config/fish/functions/_tide_1_line_prompt.fish b/home-config/fish/functions/_tide_1_line_prompt.fish
new file mode 100644
index 0000000..5772223
--- /dev/null
+++ b/home-config/fish/functions/_tide_1_line_prompt.fish
@@ -0,0 +1,19 @@
1function _tide_1_line_prompt
2 set -g add_prefix
3 _tide_side=left for item in $_tide_left_items
4 _tide_item_$item
5 end
6 set_color $prev_bg_color -b normal
7 echo $tide_left_prompt_suffix
8
9 set -g add_prefix
10 _tide_side=right for item in $_tide_right_items
11 _tide_item_$item
12 end
13 set_color $prev_bg_color -b normal
14 echo $tide_right_prompt_suffix
15end
16
17function _tide_item_pwd
18 _tide_print_item pwd @PWD@
19end
diff --git a/home-config/fish/functions/_tide_2_line_prompt.fish b/home-config/fish/functions/_tide_2_line_prompt.fish
new file mode 100644
index 0000000..e9017af
--- /dev/null
+++ b/home-config/fish/functions/_tide_2_line_prompt.fish
@@ -0,0 +1,31 @@
1function _tide_2_line_prompt
2 set -g add_prefix
3 _tide_side=left for item in $_tide_left_items
4 _tide_item_$item
5 end
6 if not set -e add_prefix
7 set_color $prev_bg_color -b normal
8 echo $tide_left_prompt_suffix
9 end
10
11 echo
12
13 set -g add_prefix
14 _tide_side=right for item in $_tide_right_items
15 _tide_item_$item
16 end
17 if not set -e add_prefix
18 set_color $prev_bg_color -b normal
19 echo $tide_right_prompt_suffix
20 end
21end
22
23function _tide_item_pwd
24 _tide_print_item pwd @PWD@
25end
26
27function _tide_item_newline
28 set_color $prev_bg_color -b normal
29 v=tide_"$_tide_side"_prompt_suffix echo $$v
30 set -g add_prefix
31end
diff --git a/home-config/fish/functions/_tide_cache_variables.fish b/home-config/fish/functions/_tide_cache_variables.fish
new file mode 100644
index 0000000..31e3850
--- /dev/null
+++ b/home-config/fish/functions/_tide_cache_variables.fish
@@ -0,0 +1,17 @@
1function _tide_cache_variables
2 # Same-color-separator color
3 set_color $tide_prompt_color_separator_same_color | read -gx _tide_color_separator_same_color
4
5 # git
6 contains git $_tide_left_items $_tide_right_items && set_color $tide_git_color_branch | read -gx _tide_location_color
7
8 # private_mode
9 if contains private_mode $_tide_left_items $_tide_right_items && test -n "$fish_private_mode"
10 set -gx _tide_private_mode
11 else
12 set -e _tide_private_mode
13 end
14
15 # item padding
16 test "$tide_prompt_pad_items" = true && set -gx _tide_pad ' ' || set -e _tide_pad
17end
diff --git a/home-config/fish/functions/_tide_detect_os.fish b/home-config/fish/functions/_tide_detect_os.fish
new file mode 100644
index 0000000..cf38388
--- /dev/null
+++ b/home-config/fish/functions/_tide_detect_os.fish
@@ -0,0 +1,77 @@
1# Outputs icon, color, bg_color
2function _tide_detect_os
3 set -lx defaultColor 080808 CED7CF
4 switch (uname | string lower)
5 case darwin
6 printf %s\n  D6D6D6 333333 # from apple.com header
7 case freebsd openbsd dragonfly
8 printf %s\n  FFFFFF AB2B28 # https://freebsdfoundation.org/about-us/about-the-foundation/project/
9 case 'cygwin*' 'mingw*_nt*' 'msys_nt*'
10 printf %s\n  FFFFFF 00CCFF # https://answers.microsoft.com/en-us/windows/forum/all/what-is-the-official-windows-8-blue-rgb-or-hex/fd57144b-f69b-42d8-8c21-6ca911646e44
11 case linux
12 if test (uname -o) = Android
13 echo ﲎ # This character is evil and messes up code display, so it's put on its own line
14 # https://developer.android.com/distribute/marketing-tools/brand-guidelines
15 printf %s\n 3DDC84 3C3F41 # fg is from above link, bg is from Android Studio default dark theme
16 else
17 _tide_detect_os_linux_cases /etc/os-release ID ||
18 _tide_detect_os_linux_cases /etc/os-release ID_LIKE ||
19 _tide_detect_os_linux_cases /etc/lsb-release DISTRIB_ID ||
20 printf %s\n  $defaultColor
21 end
22 case '*'
23 echo -ns '?'
24 end
25end
26
27function _tide_detect_os_linux_cases -a file key
28 test -e $file || return
29 set -l split_file (string split '=' <$file)
30 set -l key_index (contains --index $key $split_file) || return
31 set -l value (string trim --chars='"' $split_file[(math $key_index + 1)])
32
33 # Anything which would have pure white background has been changed to D4D4D4
34 # It was just too bright otherwise
35 switch (string lower $value)
36 case alpine
37 printf %s\n  FFFFFF 0D597F # from alpine logo
38 case arch
39 printf %s\n  1793D1 4D4D4D # from arch wiki header
40 case centos
41 printf %s\n  000000 D4D4D4 # https://wiki.centos.org/ArtWork/Brand/Logo, monochromatic
42 case debian
43 printf %s\n  C70036 D4D4D4 # from debian logo https://www.debian.org/logos/openlogo-nd-100.png
44 case devuan
45 printf %s\n  $defaultColor # logo is monochromatic
46 case elementary
47 printf %s\n  000000 D4D4D4 # https://elementary.io/brand, encouraged to be monochromatic
48 case fedora
49 printf %s\n  FFFFFF 294172 # from logo https://fedoraproject.org/w/uploads/2/2d/Logo_fedoralogo.png
50 case gentoo
51 printf %s\n  FFFFFF 54487A # https://wiki.gentoo.org/wiki/Project:Artwork/Colors
52 case mageia
53 printf %s\n  FFFFFF 262F45 # https://wiki.mageia.org/en/Artwork_guidelines
54 case manjaro
55 printf %s\n  FFFFFF 35BF5C # from https://gitlab.manjaro.org/artwork/branding/logo/-/blob/master/logo.svg
56 case mint linuxmint
57 printf %s\n  FFFFFF 69B53F # extracted from https://linuxmint.com/web/img/favicon.ico
58 case nixos
59 printf %s\n  FFFFFF 5277C3 # https://github.com/NixOS/nixos-artwork/tree/master/logo
60 case opensuse-leap opensuse-tumbleweed opensuse-microos
61 printf %s\n  73BA25 173f4f # https://en.opensuse.org/openSUSE:Artwork_brand
62 case raspbian
63 printf %s\n  FFFFFF A22846 # https://static.raspberrypi.org/files/Raspberry_Pi_Visual_Guidelines_2020.pdf
64 case rhel
65 printf %s\n  EE0000 000000 # https://www.redhat.com/en/about/brand/standards/color
66 case sabayon
67 printf %s\n  $defaultColor # Can't find colors, and they are rebranding anyway
68 case slackware
69 printf %s\n  $defaultColor # Doesn't really have a logo, and the colors are too close to PWD blue anyway
70 case ubuntu
71 printf %s\n  E95420 D4D4D4 # https://design.ubuntu.com/brand/
72 case void
73 printf %s\n  FFFFFF 478061 # from https://alpha.de.repo.voidlinux.org/logos/void.svg
74 case '*'
75 return 1
76 end
77end
diff --git a/home-config/fish/functions/_tide_find_and_remove.fish b/home-config/fish/functions/_tide_find_and_remove.fish
new file mode 100644
index 0000000..29f2180
--- /dev/null
+++ b/home-config/fish/functions/_tide_find_and_remove.fish
@@ -0,0 +1,3 @@
1function _tide_find_and_remove -a name list --no-scope-shadowing
2 contains --index $name $$list | read -l index && set -e "$list"[$index]
3end
diff --git a/home-config/fish/functions/_tide_fish_colorize.fish b/home-config/fish/functions/_tide_fish_colorize.fish
new file mode 100644
index 0000000..f79b188
--- /dev/null
+++ b/home-config/fish/functions/_tide_fish_colorize.fish
@@ -0,0 +1,7 @@
1function _tide_fish_colorize
2 if command -q fish_indent
3 echo -ns "$argv" | fish_indent --ansi
4 else
5 echo -ns "$argv"
6 end
7end
diff --git a/home-config/fish/functions/_tide_item_aws.fish b/home-config/fish/functions/_tide_item_aws.fish
new file mode 100644
index 0000000..7cb6338
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_aws.fish
@@ -0,0 +1,11 @@
1function _tide_item_aws
2 # AWS_PROFILE overrides AWS_DEFAULT_PROFILE, AWS_REGION overrides AWS_DEFAULT_REGION
3 set -q AWS_PROFILE && set -l AWS_DEFAULT_PROFILE $AWS_PROFILE
4 set -q AWS_REGION && set -l AWS_DEFAULT_REGION $AWS_REGION
5
6 if test -n "$AWS_DEFAULT_PROFILE" && test -n "$AWS_DEFAULT_REGION"
7 _tide_print_item aws $tide_aws_icon' ' "$AWS_DEFAULT_PROFILE/$AWS_DEFAULT_REGION"
8 else if test -n "$AWS_DEFAULT_PROFILE$AWS_DEFAULT_REGION"
9 _tide_print_item aws $tide_aws_icon' ' "$AWS_DEFAULT_PROFILE$AWS_DEFAULT_REGION"
10 end
11end
diff --git a/home-config/fish/functions/_tide_item_character.fish b/home-config/fish/functions/_tide_item_character.fish
new file mode 100644
index 0000000..10bb324
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_character.fish
@@ -0,0 +1,17 @@
1function _tide_item_character
2 test $_tide_status = 0 && set_color $tide_character_color || set_color $tide_character_color_failure
3
4 set -q add_prefix || echo -ns ' '
5
6 test "$fish_key_bindings" = fish_default_key_bindings && echo -ns $tide_character_icon ||
7 switch $fish_bind_mode
8 case insert
9 echo -ns $tide_character_icon
10 case default
11 echo -ns $tide_character_vi_icon_default
12 case replace replace_one
13 echo -ns $tide_character_vi_icon_replace
14 case visual
15 echo -ns $tide_character_vi_icon_visual
16 end
17end
diff --git a/home-config/fish/functions/_tide_item_cmd_duration.fish b/home-config/fish/functions/_tide_item_cmd_duration.fish
new file mode 100644
index 0000000..bc48bac
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_cmd_duration.fish
@@ -0,0 +1,12 @@
1function _tide_item_cmd_duration
2 test $CMD_DURATION -gt $tide_cmd_duration_threshold && t=(
3 math -s0 "$CMD_DURATION/3600000" # Hours
4 math -s0 "$CMD_DURATION/60000"%60 # Minutes
5 math -s$tide_cmd_duration_decimals "$CMD_DURATION/1000"%60) if test $t[1] != 0
6 _tide_print_item cmd_duration $tide_cmd_duration_icon' ' "$t[1]h $t[2]m $t[3]s"
7 else if test $t[2] != 0
8 _tide_print_item cmd_duration $tide_cmd_duration_icon' ' "$t[2]m $t[3]s"
9 else
10 _tide_print_item cmd_duration $tide_cmd_duration_icon' ' "$t[3]s"
11 end
12end
diff --git a/home-config/fish/functions/_tide_item_context.fish b/home-config/fish/functions/_tide_item_context.fish
new file mode 100644
index 0000000..cbdf420
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_context.fish
@@ -0,0 +1,14 @@
1function _tide_item_context
2 if set -q SSH_TTY
3 set -fx tide_context_color $tide_context_color_ssh
4 else if test "$EUID" = 0
5 set -fx tide_context_color $tide_context_color_root
6 else if test "$tide_context_always_display" = true
7 set -fx tide_context_color $tide_context_color_default
8 else
9 return
10 end
11
12 string match -qr "^(?<h>(\.?[^\.]*){0,$tide_context_hostname_parts})" @$hostname
13 _tide_print_item context $USER$h
14end
diff --git a/home-config/fish/functions/_tide_item_crystal.fish b/home-config/fish/functions/_tide_item_crystal.fish
new file mode 100644
index 0000000..620dde4
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_crystal.fish
@@ -0,0 +1,6 @@
1function _tide_item_crystal
2 if path is $_tide_parent_dirs/shard.yml
3 crystal --version | string match -qr "(?<v>[\d.]+)"
4 _tide_print_item crystal $tide_crystal_icon' ' $v
5 end
6end
diff --git a/home-config/fish/functions/_tide_item_direnv.fish b/home-config/fish/functions/_tide_item_direnv.fish
new file mode 100644
index 0000000..f3c892b
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_direnv.fish
@@ -0,0 +1,7 @@
1function _tide_item_direnv
2 set -q DIRENV_DIR || return
3 direnv status | string match -q 'Found RC allowed false' &&
4 set -lx tide_direnv_color $tide_direnv_color_denied &&
5 set -lx tide_direnv_bg_color $tide_direnv_bg_color_denied
6 _tide_print_item direnv $tide_direnv_icon
7end
diff --git a/home-config/fish/functions/_tide_item_distrobox.fish b/home-config/fish/functions/_tide_item_distrobox.fish
new file mode 100644
index 0000000..5e06a8b
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_distrobox.fish
@@ -0,0 +1,4 @@
1function _tide_item_distrobox
2 test -e /etc/profile.d/distrobox_profile.sh && test -e /run/.containerenv &&
3 _tide_print_item distrobox $tide_distrobox_icon' ' (string match -rg 'name="(.*)"' </run/.containerenv)
4end
diff --git a/home-config/fish/functions/_tide_item_docker.fish b/home-config/fish/functions/_tide_item_docker.fish
new file mode 100644
index 0000000..4eec0bf
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_docker.fish
@@ -0,0 +1,5 @@
1function _tide_item_docker
2 docker context inspect --format '{{.Name}}' | read -l context
3 contains -- "$context" $tide_docker_default_contexts ||
4 _tide_print_item docker $tide_docker_icon' ' $context
5end
diff --git a/home-config/fish/functions/_tide_item_elixir.fish b/home-config/fish/functions/_tide_item_elixir.fish
new file mode 100644
index 0000000..fa9d36a
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_elixir.fish
@@ -0,0 +1,4 @@
1function _tide_item_elixir
2 path is $_tide_parent_dirs/mix.exs &&
3 _tide_print_item elixir $tide_elixir_icon' ' (elixir --short-version)
4end
diff --git a/home-config/fish/functions/_tide_item_gcloud.fish b/home-config/fish/functions/_tide_item_gcloud.fish
new file mode 100644
index 0000000..609783a
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_gcloud.fish
@@ -0,0 +1,8 @@
1function _tide_item_gcloud
2 set -q CLOUDSDK_CONFIG || set -l CLOUDSDK_CONFIG ~/.config/gcloud
3 path is $CLOUDSDK_CONFIG/active_config &&
4 read -l config <$CLOUDSDK_CONFIG/active_config &&
5 path is $CLOUDSDK_CONFIG/configurations/config_$config &&
6 string match -qr '^\s*project\s*=\s*(?<project>.*)' <$CLOUDSDK_CONFIG/configurations/config_$config &&
7 _tide_print_item gcloud $tide_gcloud_icon' ' $project
8end
diff --git a/home-config/fish/functions/_tide_item_git.fish b/home-config/fish/functions/_tide_item_git.fish
new file mode 100644
index 0000000..3154acc
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_git.fish
@@ -0,0 +1,72 @@
1function _tide_item_git
2 if git branch --show-current 2>/dev/null | string shorten -"$tide_git_truncation_strategy"m$tide_git_truncation_length | read -l location
3 git rev-parse --git-dir --is-inside-git-dir | read -fL gdir in_gdir
4 set location $_tide_location_color$location
5 else if test $pipestatus[1] != 0
6 return
7 else if git tag --points-at HEAD | string shorten -"$tide_git_truncation_strategy"m$tide_git_truncation_length | read location
8 git rev-parse --git-dir --is-inside-git-dir | read -fL gdir in_gdir
9 set location '#'$_tide_location_color$location
10 else
11 git rev-parse --git-dir --is-inside-git-dir --short HEAD | read -fL gdir in_gdir location
12 set location @$_tide_location_color$location
13 end
14
15 # Operation
16 if test -d $gdir/rebase-merge
17 # Turn ANY into ALL, via double negation
18 if not path is -v $gdir/rebase-merge/{msgnum,end}
19 read -f step <$gdir/rebase-merge/msgnum
20 read -f total_steps <$gdir/rebase-merge/end
21 end
22 test -f $gdir/rebase-merge/interactive && set -f operation rebase-i || set -f operation rebase-m
23 else if test -d $gdir/rebase-apply
24 if not path is -v $gdir/rebase-apply/{next,last}
25 read -f step <$gdir/rebase-apply/next
26 read -f total_steps <$gdir/rebase-apply/last
27 end
28 if test -f $gdir/rebase-apply/rebasing
29 set -f operation rebase
30 else if test -f $gdir/rebase-apply/applying
31 set -f operation am
32 else
33 set -f operation am/rebase
34 end
35 else if test -f $gdir/MERGE_HEAD
36 set -f operation merge
37 else if test -f $gdir/CHERRY_PICK_HEAD
38 set -f operation cherry-pick
39 else if test -f $gdir/REVERT_HEAD
40 set -f operation revert
41 else if test -f $gdir/BISECT_LOG
42 set -f operation bisect
43 end
44
45 # Git status/stash + Upstream behind/ahead
46 test $in_gdir = true && set -l _set_dir_opt -C $gdir/..
47 # Suppress errors in case we are in a bare repo or there is no upstream
48 set -l stat (git $_set_dir_opt --no-optional-locks status --porcelain 2>/dev/null)
49 string match -qr '(0|(?<stash>.*))\n(0|(?<conflicted>.*))\n(0|(?<staged>.*))
50(0|(?<dirty>.*))\n(0|(?<untracked>.*))(\n(0|(?<behind>.*))\t(0|(?<ahead>.*)))?' \
51 "$(git $_set_dir_opt stash list 2>/dev/null | count
52 string match -r ^UU $stat | count
53 string match -r ^[ADMR]. $stat | count
54 string match -r ^.[ADMR] $stat | count
55 string match -r '^\?\?' $stat | count
56 git rev-list --count --left-right @{upstream}...HEAD 2>/dev/null)"
57
58 if test -n "$operation$conflicted"
59 set -g tide_git_bg_color $tide_git_bg_color_urgent
60 else if test -n "$staged$dirty$untracked"
61 set -g tide_git_bg_color $tide_git_bg_color_unstable
62 end
63
64 _tide_print_item git $_tide_location_color$tide_git_icon' ' (set_color white; echo -ns $location
65 set_color $tide_git_color_operation; echo -ns ' '$operation ' '$step/$total_steps
66 set_color $tide_git_color_upstream; echo -ns ' ⇣'$behind ' ⇡'$ahead
67 set_color $tide_git_color_stash; echo -ns ' *'$stash
68 set_color $tide_git_color_conflicted; echo -ns ' ~'$conflicted
69 set_color $tide_git_color_staged; echo -ns ' +'$staged
70 set_color $tide_git_color_dirty; echo -ns ' !'$dirty
71 set_color $tide_git_color_untracked; echo -ns ' ?'$untracked)
72end
diff --git a/home-config/fish/functions/_tide_item_go.fish b/home-config/fish/functions/_tide_item_go.fish
new file mode 100644
index 0000000..b9aacae
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_go.fish
@@ -0,0 +1,6 @@
1function _tide_item_go
2 if path is $_tide_parent_dirs/go.mod
3 go version | string match -qr "(?<v>[\d.]+)"
4 _tide_print_item go $tide_go_icon' ' $v
5 end
6end
diff --git a/home-config/fish/functions/_tide_item_java.fish b/home-config/fish/functions/_tide_item_java.fish
new file mode 100644
index 0000000..804ec05
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_java.fish
@@ -0,0 +1,6 @@
1function _tide_item_java
2 if path is $_tide_parent_dirs/pom.xml
3 java -version &| string match -qr "(?<v>[\d.]+)"
4 _tide_print_item java $tide_java_icon' ' $v
5 end
6end
diff --git a/home-config/fish/functions/_tide_item_jobs.fish b/home-config/fish/functions/_tide_item_jobs.fish
new file mode 100644
index 0000000..2a02118
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_jobs.fish
@@ -0,0 +1,7 @@
1function _tide_item_jobs
2 set -q _tide_jobs && if test $_tide_jobs -ge $tide_jobs_number_threshold
3 _tide_print_item jobs $tide_jobs_icon' ' $_tide_jobs
4 else
5 _tide_print_item jobs $tide_jobs_icon
6 end
7end
diff --git a/home-config/fish/functions/_tide_item_kubectl.fish b/home-config/fish/functions/_tide_item_kubectl.fish
new file mode 100644
index 0000000..ab044b3
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_kubectl.fish
@@ -0,0 +1,4 @@
1function _tide_item_kubectl
2 kubectl config view --minify --output 'jsonpath={.current-context}/{..namespace}' 2>/dev/null | read -l context &&
3 _tide_print_item kubectl $tide_kubectl_icon' ' (string replace -r '/(|default)$' '' $context)
4end
diff --git a/home-config/fish/functions/_tide_item_nix_shell.fish b/home-config/fish/functions/_tide_item_nix_shell.fish
new file mode 100644
index 0000000..647f606
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_nix_shell.fish
@@ -0,0 +1,3 @@
1function _tide_item_nix_shell
2 set -q IN_NIX_SHELL && _tide_print_item nix_shell $tide_nix_shell_icon' ' $IN_NIX_SHELL
3end
diff --git a/home-config/fish/functions/_tide_item_node.fish b/home-config/fish/functions/_tide_item_node.fish
new file mode 100644
index 0000000..fc57832
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_node.fish
@@ -0,0 +1,6 @@
1function _tide_item_node
2 if path is $_tide_parent_dirs/package.json
3 node --version | string match -qr "v(?<v>.*)"
4 _tide_print_item node $tide_node_icon' ' $v
5 end
6end
diff --git a/home-config/fish/functions/_tide_item_os.fish b/home-config/fish/functions/_tide_item_os.fish
new file mode 100644
index 0000000..8a6208c
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_os.fish
@@ -0,0 +1,3 @@
1function _tide_item_os
2 _tide_print_item os $tide_os_icon
3end
diff --git a/home-config/fish/functions/_tide_item_php.fish b/home-config/fish/functions/_tide_item_php.fish
new file mode 100644
index 0000000..c8d28d9
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_php.fish
@@ -0,0 +1,6 @@
1function _tide_item_php
2 if path is $_tide_parent_dirs/composer.json
3 php --version | string match -qr "(?<v>[\d.]+)"
4 _tide_print_item php $tide_php_icon' ' $v
5 end
6end
diff --git a/home-config/fish/functions/_tide_item_private_mode.fish b/home-config/fish/functions/_tide_item_private_mode.fish
new file mode 100644
index 0000000..4eb4684
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_private_mode.fish
@@ -0,0 +1,3 @@
1function _tide_item_private_mode
2 set -q _tide_private_mode && _tide_print_item private_mode $tide_private_mode_icon
3end
diff --git a/home-config/fish/functions/_tide_item_pulumi.fish b/home-config/fish/functions/_tide_item_pulumi.fish
new file mode 100644
index 0000000..6302a7e
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_pulumi.fish
@@ -0,0 +1,19 @@
1function _tide_item_pulumi
2 if path filter $_tide_parent_dirs/Pulumi.yaml | read -l yaml_path
3 if command -q sha1sum
4 echo -n "$yaml_path" | sha1sum | string match -qr "(?<path_hash>.{40})"
5 else if command -q shasum
6 echo -n "$yaml_path" | shasum | string match -qr "(?<path_hash>.{40})"
7 else
8 return
9 end
10
11 string match -qr 'name: *(?<project_name>.*)' <$yaml_path
12 set -l workspace_file "$HOME/.pulumi/workspaces/$project_name-$path_hash-workspace.json"
13
14 if test -e $workspace_file
15 string match -qr '"stack": *"(?<stack>.*)"' <$workspace_file
16 _tide_print_item pulumi $tide_pulumi_icon' ' $stack
17 end
18 end
19end
diff --git a/home-config/fish/functions/_tide_item_python.fish b/home-config/fish/functions/_tide_item_python.fish
new file mode 100644
index 0000000..57f7075
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_python.fish
@@ -0,0 +1,27 @@
1function _tide_item_python
2 if test -n "$VIRTUAL_ENV"
3 if command -q python3
4 python3 --version | string match -qr "(?<v>[\d.]+)"
5 else
6 python --version | string match -qr "(?<v>[\d.]+)"
7 end
8 string match -qr "^.*/(?<dir>.*)/(?<base>.*)" $VIRTUAL_ENV
9 # pipenv $VIRTUAL_ENV looks like /home/ilan/.local/share/virtualenvs/pipenv_project-EwRYuc3l
10 # Detect whether we are using pipenv by looking for 'virtualenvs'. If so, remove the hash at the end.
11 if test "$dir" = virtualenvs
12 string match -qr "(?<base>.*)-.*" $base
13 _tide_print_item python $tide_python_icon' ' "$v ($base)"
14 else if contains -- "$base" virtualenv venv .venv env # avoid generic names
15 _tide_print_item python $tide_python_icon' ' "$v ($dir)"
16 else
17 _tide_print_item python $tide_python_icon' ' "$v ($base)"
18 end
19 else if path is .python-version Pipfile __init__.py pyproject.toml requirements.txt setup.py
20 if command -q python3
21 python3 --version | string match -qr "(?<v>[\d.]+)"
22 else
23 python --version | string match -qr "(?<v>[\d.]+)"
24 end
25 _tide_print_item python $tide_python_icon' ' $v
26 end
27end
diff --git a/home-config/fish/functions/_tide_item_ruby.fish b/home-config/fish/functions/_tide_item_ruby.fish
new file mode 100644
index 0000000..bde84eb
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_ruby.fish
@@ -0,0 +1,6 @@
1function _tide_item_ruby
2 if path is $_tide_parent_dirs/{*.gemspec,Gemfile,Rakefile,.ruby-version}
3 ruby --version | string match -qr "(?<v>[\d.]+)"
4 _tide_print_item ruby $tide_ruby_icon' ' $v
5 end
6end
diff --git a/home-config/fish/functions/_tide_item_rustc.fish b/home-config/fish/functions/_tide_item_rustc.fish
new file mode 100644
index 0000000..b46cd99
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_rustc.fish
@@ -0,0 +1,6 @@
1function _tide_item_rustc
2 if path is $_tide_parent_dirs/Cargo.toml
3 rustc --version | string match -qr "(?<v>[\d.]+)"
4 _tide_print_item rustc $tide_rustc_icon' ' $v
5 end
6end
diff --git a/home-config/fish/functions/_tide_item_shlvl.fish b/home-config/fish/functions/_tide_item_shlvl.fish
new file mode 100644
index 0000000..95dd5ff
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_shlvl.fish
@@ -0,0 +1,4 @@
1function _tide_item_shlvl
2 # Non-interactive shells do not increment SHLVL, so we don't need to subtract 1
3 test $SHLVL -gt $tide_shlvl_threshold && _tide_print_item shlvl $tide_shlvl_icon' ' $SHLVL
4end
diff --git a/home-config/fish/functions/_tide_item_status.fish b/home-config/fish/functions/_tide_item_status.fish
new file mode 100644
index 0000000..3a040fd
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_status.fish
@@ -0,0 +1,15 @@
1function _tide_item_status
2 if string match -qv 0 $_tide_pipestatus # If there is a failure anywhere in the pipestatus
3 if test "$_tide_pipestatus" = 1 # If simple failure
4 contains character $_tide_left_items || tide_status_bg_color=$tide_status_bg_color_failure \
5 tide_status_color=$tide_status_color_failure _tide_print_item status $tide_status_icon_failure' ' 1
6 else
7 fish_status_to_signal $_tide_pipestatus | string replace SIG '' | string join '|' | read -l out
8 test $_tide_status = 0 && _tide_print_item status $tide_status_icon' ' $out ||
9 tide_status_bg_color=$tide_status_bg_color_failure tide_status_color=$tide_status_color_failure \
10 _tide_print_item status $tide_status_icon_failure' ' $out
11 end
12 else if not contains character $_tide_left_items
13 _tide_print_item status $tide_status_icon
14 end
15end
diff --git a/home-config/fish/functions/_tide_item_terraform.fish b/home-config/fish/functions/_tide_item_terraform.fish
new file mode 100644
index 0000000..c079ce3
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_terraform.fish
@@ -0,0 +1,5 @@
1function _tide_item_terraform
2 path is $_tide_parent_dirs/.terraform &&
3 terraform workspace show | string match -v default | read -l w &&
4 _tide_print_item terraform $tide_terraform_icon' ' $w
5end
diff --git a/home-config/fish/functions/_tide_item_time.fish b/home-config/fish/functions/_tide_item_time.fish
new file mode 100644
index 0000000..b8522bc
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_time.fish
@@ -0,0 +1,3 @@
1function _tide_item_time
2 _tide_print_item time (date +$tide_time_format)
3end
diff --git a/home-config/fish/functions/_tide_item_toolbox.fish b/home-config/fish/functions/_tide_item_toolbox.fish
new file mode 100644
index 0000000..0b33f29
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_toolbox.fish
@@ -0,0 +1,4 @@
1function _tide_item_toolbox
2 test -e /run/.toolboxenv &&
3 _tide_print_item toolbox $tide_toolbox_icon' ' (string match -rg 'name="(.*)"' </run/.containerenv)
4end
diff --git a/home-config/fish/functions/_tide_item_vi_mode.fish b/home-config/fish/functions/_tide_item_vi_mode.fish
new file mode 100644
index 0000000..582855d
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_vi_mode.fish
@@ -0,0 +1,16 @@
1function _tide_item_vi_mode
2 test "$fish_key_bindings" != fish_default_key_bindings && switch $fish_bind_mode
3 case default
4 tide_vi_mode_bg_color=$tide_vi_mode_bg_color_default tide_vi_mode_color=$tide_vi_mode_color_default \
5 _tide_print_item vi_mode $tide_vi_mode_icon_default
6 case insert
7 tide_vi_mode_bg_color=$tide_vi_mode_bg_color_insert tide_vi_mode_color=$tide_vi_mode_color_insert \
8 _tide_print_item vi_mode $tide_vi_mode_icon_insert
9 case replace replace_one
10 tide_vi_mode_bg_color=$tide_vi_mode_bg_color_replace tide_vi_mode_color=$tide_vi_mode_color_replace \
11 _tide_print_item vi_mode $tide_vi_mode_icon_replace
12 case visual
13 tide_vi_mode_bg_color=$tide_vi_mode_bg_color_visual tide_vi_mode_color=$tide_vi_mode_color_visual \
14 _tide_print_item vi_mode $tide_vi_mode_icon_visual
15 end
16end
diff --git a/home-config/fish/functions/_tide_item_zig.fish b/home-config/fish/functions/_tide_item_zig.fish
new file mode 100644
index 0000000..2ac2741
--- /dev/null
+++ b/home-config/fish/functions/_tide_item_zig.fish
@@ -0,0 +1,6 @@
1function _tide_item_zig
2 if path is $_tide_parent_dirs/build.zig
3 zig version | string match -qr "(?<v>[\d.]+(-dev)?)"
4 _tide_print_item zig $tide_zig_icon' ' $v
5 end
6end
diff --git a/home-config/fish/functions/_tide_parent_dirs.fish b/home-config/fish/functions/_tide_parent_dirs.fish
new file mode 100644
index 0000000..9f31b04
--- /dev/null
+++ b/home-config/fish/functions/_tide_parent_dirs.fish
@@ -0,0 +1,7 @@
1function _tide_parent_dirs --on-variable PWD
2 set -g _tide_parent_dirs (string escape (
3 for dir in (string split / -- $PWD)
4 set -la parts $dir
5 string join / -- $parts
6 end))
7end
diff --git a/home-config/fish/functions/_tide_print_item.fish b/home-config/fish/functions/_tide_print_item.fish
new file mode 100644
index 0000000..db5c98b
--- /dev/null
+++ b/home-config/fish/functions/_tide_print_item.fish
@@ -0,0 +1,22 @@
1function _tide_print_item -a item
2 v=tide_"$item"_bg_color set -f item_bg_color $$v
3
4 if set -e add_prefix
5 set_color $item_bg_color -b normal
6 v=tide_"$_tide_side"_prompt_prefix echo -ns $$v
7 else if test "$item_bg_color" = "$prev_bg_color"
8 v=tide_"$_tide_side"_prompt_separator_same_color echo -ns $_tide_color_separator_same_color$$v
9 else if test $_tide_side = left
10 set_color $prev_bg_color -b $item_bg_color
11 echo -ns $tide_left_prompt_separator_diff_color
12 else
13 set_color $item_bg_color -b $prev_bg_color
14 echo -ns $tide_right_prompt_separator_diff_color
15 end
16
17 v=tide_"$item"_color set_color $$v -b $item_bg_color
18
19 echo -ns $_tide_pad $argv[2..] $_tide_pad
20
21 set -g prev_bg_color $item_bg_color
22end
diff --git a/home-config/fish/functions/_tide_pwd.fish b/home-config/fish/functions/_tide_pwd.fish
new file mode 100644
index 0000000..5447dd4
--- /dev/null
+++ b/home-config/fish/functions/_tide_pwd.fish
@@ -0,0 +1,42 @@
1set_color -o $tide_pwd_color_anchors | read -l color_anchors
2set_color $tide_pwd_color_truncated_dirs | read -l color_truncated
3set -l reset_to_color_dirs (set_color normal -b $tide_pwd_bg_color; set_color $tide_pwd_color_dirs)
4
5set -l unwritable_icon $tide_pwd_icon_unwritable' '
6set -l home_icon $tide_pwd_icon_home' '
7set -l pwd_icon $tide_pwd_icon' '
8
9eval "function _tide_pwd
10 if set -l split_pwd (string replace -r '^$HOME' '~' -- \$PWD | string split /)
11 test -w . && set -f split_output \"$pwd_icon\$split_pwd[1]\" \$split_pwd[2..] ||
12 set -f split_output \"$unwritable_icon\$split_pwd[1]\" \$split_pwd[2..]
13 set split_output[-1] \"$color_anchors\$split_output[-1]$reset_to_color_dirs\"
14 else
15 set -f split_output \"$home_icon$color_anchors~\"
16 end
17
18 string join / -- \$split_output | string length -V | read -g _tide_pwd_len
19
20 i=1 for dir_section in \$split_pwd[2..-2]
21 string join -- / \$split_pwd[..\$i] | string replace '~' $HOME | read -l parent_dir # Uses i before increment
22
23 math \$i+1 | read i
24
25 if path is \$parent_dir/\$dir_section/\$tide_pwd_markers
26 set split_output[\$i] \"$color_anchors\$dir_section$reset_to_color_dirs\"
27 else if test \$_tide_pwd_len -gt \$dist_btwn_sides
28 string match -qr \"(?<trunc>\..|.)\" \$dir_section
29
30 set -l glob \$parent_dir/\$trunc*/
31 set -e glob[(contains -i \$parent_dir/\$dir_section/ \$glob)] # This is faster than inverse string match
32
33 while string match -qr \"^\$parent_dir/\$(string escape --style=regex \$trunc)\" \$glob &&
34 string match -qr \"(?<trunc>\$(string escape --style=regex \$trunc).)\" \$dir_section
35 end
36 test -n \"\$trunc\" && set split_output[\$i] \"$color_truncated\$trunc$reset_to_color_dirs\" &&
37 string join / \$split_output | string length -V | read _tide_pwd_len
38 end
39 end
40
41 string join -- / \"$reset_to_color_dirs\$split_output[1]\" \$split_output[2..]
42end"
diff --git a/home-config/fish/functions/_tide_remove_unusable_items.fish b/home-config/fish/functions/_tide_remove_unusable_items.fish
new file mode 100644
index 0000000..deb4c10
--- /dev/null
+++ b/home-config/fish/functions/_tide_remove_unusable_items.fish
@@ -0,0 +1,25 @@
1function _tide_remove_unusable_items
2 # Remove tool-specific items for tools the machine doesn't have installed
3 set -l removed_items
4 for item in aws crystal direnv distrobox docker elixir gcloud git go java kubectl nix_shell node php pulumi python ruby rustc terraform toolbox zig
5 contains $item $tide_left_prompt_items $tide_right_prompt_items || continue
6
7 set -l cli_names $item
8 switch $item
9 case distrobox # there is no 'distrobox' command inside the container
10 set cli_names distrobox-export # 'distrobox-export' and 'distrobox-host-exec' are available
11 case nix_shell
12 set cli_names nix nix-shell
13 case python
14 set cli_names python python3
15 end
16 type --query $cli_names || set -a removed_items $item
17 end
18
19 set -U _tide_left_items (for item in $tide_left_prompt_items
20 contains $item $removed_items || echo $item
21 end)
22 set -U _tide_right_items (for item in $tide_right_prompt_items
23 contains $item $removed_items || echo $item
24 end)
25end
diff --git a/home-config/fish/functions/_tide_sub_bug-report.fish b/home-config/fish/functions/_tide_sub_bug-report.fish
new file mode 100644
index 0000000..a8065c8
--- /dev/null
+++ b/home-config/fish/functions/_tide_sub_bug-report.fish
@@ -0,0 +1,73 @@
1function _tide_sub_bug-report
2 argparse c/clean v/verbose check -- $argv
3
4 set -l fish_path (status fish-path)
5
6 if set -q _flag_clean
7 HOME=(mktemp -d) $fish_path --init-command "curl --silent \
8 https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish |
9 source && fisher install ilancosman/tide@v6"
10 else if set -q _flag_verbose
11 set --long | string match -r "^_?tide.*" | # Get only tide variables
12 string match -r --invert "^_tide_prompt_var.*" # Remove _tide_prompt_var
13 else
14 set -l fish_version ($fish_path --version | string match -r "fish, version (\d\.\d\.\d)")[2]
15 _tide_check_version Fish fish-shell/fish-shell "(\d\.\d\.\d)" $fish_version || return
16
17 set -l tide_version (tide --version | string match -r "tide, version (\d\.\d\.\d)")[2]
18 _tide_check_version Tide IlanCosman/tide "v(\d\.\d\.\d)" $tide_version || return
19
20 if command --query git
21 test (git --version | string match -r "git version ([\d\.]*)" | string replace --all . '')[2] -gt 2220
22 _tide_check_condition \
23 "Your git version is too old." \
24 "Tide requires at least version 2.22." \
25 "Please update before submitting a bug report." || return
26 end
27
28 # Check that omf is not installed
29 not functions --query omf
30 _tide_check_condition \
31 "Tide does not work with oh-my-fish installed." \
32 "Please uninstall it before submitting a bug report." || return
33
34 if not set -q _flag_check
35 set -l fish_startup_time ($fish_path -ic "time $fish_path -c exit" 2>|
36 string match -r "Executed in(.*)fish" | string trim)[2]
37
38 read --local --prompt-str "What operating system are you using? (e.g Ubuntu 20.04): " os
39 read --local --prompt-str "What terminal emulator are you using? (e.g Kitty): " terminal_emulator
40
41 printf '%b\n' "\nPlease copy the following information into the issue:\n" \
42 "fish version: $fish_version" \
43 "tide version: $tide_version" \
44 "term: $TERM" \
45 "os: $os" \
46 "terminal emulator: $terminal_emulator" \
47 "fish startup: $fish_startup_time" \
48 "fisher plugins: $_fisher_plugins"
49 end
50 end
51end
52
53function _tide_check_version -a program_name repo_name regex_to_get_version current_version
54 curl --silent https://github.com/$repo_name/releases/latest |
55 string match -r ".*$repo_name/releases/tag/$regex_to_get_version.*" |
56 read --local --line __ latestVersion
57
58 string match --quiet -r "^$latestVersion" "$current_version"
59 _tide_check_condition \
60 "Your $program_name version is out of date." \
61 "The latest is $latestVersion. You have $current_version." \
62 "Please update before submitting a bug report."
63end
64
65function _tide_check_condition
66 if test "$status" != 0
67 set_color red
68 printf '%s\n' $argv
69 set_color normal
70 return 1
71 end
72 return 0
73end
diff --git a/home-config/fish/functions/_tide_sub_configure.fish b/home-config/fish/functions/_tide_sub_configure.fish
new file mode 100644
index 0000000..22faf3a
--- /dev/null
+++ b/home-config/fish/functions/_tide_sub_configure.fish
@@ -0,0 +1,156 @@
1set -g _tide_color_dark_blue 0087AF
2set -g _tide_color_dark_green 5FAF00
3set -g _tide_color_gold D7AF00
4set -g _tide_color_green 5FD700
5set -g _tide_color_light_blue 00AFFF
6
7# Create an empty fake function for each item
8for func in _fake(functions --all | string match --entire _tide_item)
9 function $func
10 end
11end
12
13for file in (status dirname)/tide/configure/{choices, functions}/**.fish
14 source $file
15end
16
17function _tide_sub_configure
18 set -l choices (path basename (status dirname)/tide/configure/choices/**.fish | path change-extension '')
19 argparse auto $choices= -- $argv
20
21 for var in (set -l --names | string match -e _flag)
22 set -x $var $$var
23 end
24
25 if set -q _flag_auto
26 set -fx _flag_finish 'Overwrite your current tide config'
27 else if test $COLUMNS -lt 55 -o $LINES -lt 21
28 echo 'Terminal size too small; must be at least 55 x 21'
29 return 1
30 end
31
32 _tide_detect_os | read -g --line os_branding_icon os_branding_color os_branding_bg_color
33
34 set -g fake_columns $COLUMNS
35 test $fake_columns -gt 90 && set fake_columns 90
36 set -g fake_lines $LINES
37
38 set -g _tide_selected_option
39 _next_choice all/style
40end
41
42function _next_choice -a nextChoice
43 set -q _tide_selected_option || return 0
44 set -l cmd (string split '/' $nextChoice)[2]
45 $cmd
46end
47
48function _tide_title -a text
49 set -q _flag_auto && return
50
51 command -q clear && clear
52 set_color -o
53 string pad --width (math --scale=0 "$fake_columns/2" + (string length $text)/2) $text
54 set_color normal
55
56 set -g _tide_configure_first_option_after_title
57end
58
59function _tide_option -a symbol text
60 set -ga _tide_symbol_list $symbol
61 set -ga _tide_option_list $text
62
63 if not set -q _flag_auto
64 set -g _tide_configure_first_prompt_after_option
65
66 set_color -o
67 set -e _tide_configure_first_option_after_title || echo
68 echo "($symbol) $text"
69 set_color normal
70 end
71end
72
73function _tide_menu -a func
74 if set -q _flag_auto
75 set -l flag_var_name _flag_$func
76 set -g _tide_selected_option $$flag_var_name
77
78 if test -z "$_tide_selected_option"
79 echo "Missing input for choice '$func'"
80 _tide_exit_configure
81 else if not contains $_tide_selected_option $_tide_option_list
82 echo "Invalid input '$_tide_selected_option' for choice '$func'"
83 _tide_exit_configure
84 else
85 set -e _tide_symbol_list
86 set -e _tide_option_list
87 end
88 return
89 end
90
91 argparse no-restart -- $argv # Add no-restart option for first menu
92
93 echo
94 if not set -q _flag_no_restart
95 set -f r r
96 echo '(r) Restart from the beginning'
97 end
98 echo '(q) Quit and do nothing'\n
99
100 while read --nchars 1 --prompt-str \
101 "$(set_color -o)Choice [$(string join '/' $_tide_symbol_list $r q)] $(set_color normal)" input
102 switch $input
103 case r
104 set -q _flag_no_restart && continue
105 set -e _tide_symbol_list
106 set -e _tide_option_list
107 _next_choice all/style
108 break
109 case q
110 _tide_exit_configure
111 set -e _tide_symbol_list
112 set -e _tide_option_list
113 command -q clear && clear
114 break
115 case $_tide_symbol_list
116 set -g _tide_selected_option $_tide_option_list[(contains -i $input $_tide_symbol_list)]
117 test "$func" != finish &&
118 set -a _tide_configure_current_options --$func=(string escape $_tide_selected_option)
119 set -e _tide_symbol_list
120 set -e _tide_option_list
121 break
122 end
123 end
124end
125
126function _tide_display_prompt
127 set -q _flag_auto && return
128
129 _fake_tide_cache_variables
130 set -l prompt (_fake_tide_prompt)
131
132 set -l bottom_left_prompt_string_length (string length --visible $prompt[-1])
133 set -l right_prompt_string (string pad --width (math $fake_columns-$bottom_left_prompt_string_length) $prompt[1])
134 set -l prompt[-1] "$prompt[-1]$right_prompt_string"
135
136 if set -q _configure_transient
137 if contains newline $fake_tide_left_prompt_items
138 string unescape $prompt[3..]
139 else
140 _fake_tide_item_character
141 echo
142 end
143 else
144 if not set -q _tide_configure_first_prompt_after_option
145 test "$fake_tide_prompt_add_newline_before" = true && echo
146 end
147 string unescape $prompt[2..]
148 end
149
150 set -e _tide_configure_first_prompt_after_option
151 set_color normal
152end
153
154function _tide_exit_configure
155 set -e _tide_selected_option # Skip through all switch and _next_choice
156end
diff --git a/home-config/fish/functions/_tide_sub_reload.fish b/home-config/fish/functions/_tide_sub_reload.fish
new file mode 100644
index 0000000..5a45fbd
--- /dev/null
+++ b/home-config/fish/functions/_tide_sub_reload.fish
@@ -0,0 +1,3 @@
1function _tide_sub_reload
2 source (functions --details fish_prompt)
3end
diff --git a/home-config/fish/functions/fish_mode_prompt.fish b/home-config/fish/functions/fish_mode_prompt.fish
new file mode 100644
index 0000000..f37cf7d
--- /dev/null
+++ b/home-config/fish/functions/fish_mode_prompt.fish
@@ -0,0 +1 @@
# Disable default vi prompt
diff --git a/home-config/fish/functions/fish_prompt.fish b/home-config/fish/functions/fish_prompt.fish
new file mode 100644
index 0000000..3b58b7b
--- /dev/null
+++ b/home-config/fish/functions/fish_prompt.fish
@@ -0,0 +1,171 @@
1function fish_prompt
2end # In case this file gets loaded non-interactively, e.g by conda
3status is-interactive || exit
4
5_tide_remove_unusable_items
6_tide_cache_variables
7_tide_parent_dirs
8source (functions --details _tide_pwd)
9
10set -l prompt_var _tide_prompt_$fish_pid
11set -U $prompt_var # Set var here so if we erase $prompt_var, bg job won't set a uvar
12
13set_color normal | read -l color_normal
14status fish-path | read -l fish_path
15
16# _tide_repaint prevents us from creating a second background job
17function _tide_refresh_prompt --on-variable $prompt_var --on-variable COLUMNS
18 set -g _tide_repaint
19 commandline -f repaint
20end
21
22if contains newline $_tide_left_items # two line prompt initialization
23 test "$tide_prompt_add_newline_before" = true && set -l add_newline '\n'
24
25 set_color $tide_prompt_color_frame_and_connection -b normal | read -l prompt_and_frame_color
26
27 set -l column_offset 5
28 test "$tide_left_prompt_frame_enabled" = true &&
29 set -l top_left_frame "$prompt_and_frame_color╭─" &&
30 set -l bot_left_frame "$prompt_and_frame_color╰─" &&
31 set column_offset (math $column_offset-2)
32 test "$tide_right_prompt_frame_enabled" = true &&
33 set -l top_right_frame "$prompt_and_frame_color─╮" &&
34 set -l bot_right_frame "$prompt_and_frame_color─╯" &&
35 set column_offset (math $column_offset-2)
36
37 if test "$tide_prompt_transient_enabled" = true
38 eval "
39function fish_prompt
40 _tide_status=\$status _tide_pipestatus=\$pipestatus if not set -e _tide_repaint
41 jobs -q && jobs -p | count | read -lx _tide_jobs
42 $fish_path -c \"set _tide_pipestatus \$_tide_pipestatus
43set _tide_parent_dirs \$_tide_parent_dirs
44PATH=\$(string escape \"\$PATH\") CMD_DURATION=\$CMD_DURATION fish_bind_mode=\$fish_bind_mode set $prompt_var (_tide_2_line_prompt)\" &
45 builtin disown
46
47 command kill \$_tide_last_pid 2>/dev/null
48 set -g _tide_last_pid \$last_pid
49 end
50
51 if not set -q _tide_transient
52 math \$COLUMNS-(string length -V \"\$$prompt_var[1][1]\$$prompt_var[1][3]\")+$column_offset | read -lx dist_btwn_sides
53
54 echo -n $add_newline'$top_left_frame'(string replace @PWD@ (_tide_pwd) \"\$$prompt_var[1][1]\")'$prompt_and_frame_color'
55 string repeat -Nm(math max 0, \$dist_btwn_sides-\$_tide_pwd_len) '$tide_prompt_icon_connection'
56
57 echo \"\$$prompt_var[1][3]$top_right_frame\"
58 end
59 echo -n \e\[0J\"$bot_left_frame\$$prompt_var[1][2]$color_normal \"
60end
61
62function fish_right_prompt
63 set -e _tide_transient || string unescape \"\$$prompt_var[1][4]$bot_right_frame$color_normal\"
64end"
65 else
66 eval "
67function fish_prompt
68 _tide_status=\$status _tide_pipestatus=\$pipestatus if not set -e _tide_repaint
69 jobs -q && jobs -p | count | read -lx _tide_jobs
70 $fish_path -c \"set _tide_pipestatus \$_tide_pipestatus
71set _tide_parent_dirs \$_tide_parent_dirs
72PATH=\$(string escape \"\$PATH\") CMD_DURATION=\$CMD_DURATION fish_bind_mode=\$fish_bind_mode set $prompt_var (_tide_2_line_prompt)\" &
73 builtin disown
74
75 command kill \$_tide_last_pid 2>/dev/null
76 set -g _tide_last_pid \$last_pid
77 end
78
79 math \$COLUMNS-(string length -V \"\$$prompt_var[1][1]\$$prompt_var[1][3]\")+$column_offset | read -lx dist_btwn_sides
80
81 echo -ns $add_newline'$top_left_frame'(string replace @PWD@ (_tide_pwd) \"\$$prompt_var[1][1]\")'$prompt_and_frame_color'
82 string repeat -Nm(math max 0, \$dist_btwn_sides-\$_tide_pwd_len) '$tide_prompt_icon_connection'
83 echo -ns \"\$$prompt_var[1][3]$top_right_frame\"\n\"$bot_left_frame\$$prompt_var[1][2]$color_normal \"
84end
85
86function fish_right_prompt
87 string unescape \"\$$prompt_var[1][4]$bot_right_frame$color_normal\"
88end"
89 end
90else # one line prompt initialization
91 test "$tide_prompt_add_newline_before" = true && set -l add_newline '\0'
92
93 math 5 -$tide_prompt_min_cols | read -l column_offset
94 test $column_offset -ge 0 && set column_offset "+$column_offset"
95
96 if test "$tide_prompt_transient_enabled" = true
97 eval "
98function fish_prompt
99 set -lx _tide_status \$status
100 _tide_pipestatus=\$pipestatus if not set -e _tide_repaint
101 jobs -q && jobs -p | count | read -lx _tide_jobs
102 $fish_path -c \"set _tide_pipestatus \$_tide_pipestatus
103set _tide_parent_dirs \$_tide_parent_dirs
104PATH=\$(string escape \"\$PATH\") CMD_DURATION=\$CMD_DURATION fish_bind_mode=\$fish_bind_mode set $prompt_var (_tide_1_line_prompt)\" &
105 builtin disown
106
107 command kill \$_tide_last_pid 2>/dev/null
108 set -g _tide_last_pid \$last_pid
109 end
110
111 if set -q _tide_transient
112 echo -n \e\[0J
113 add_prefix= _tide_item_character
114 echo -n '$color_normal '
115 else
116 math \$COLUMNS-(string length -V \"\$$prompt_var[1][1]\$$prompt_var[1][2]\")$column_offset | read -lx dist_btwn_sides
117 string replace @PWD@ (_tide_pwd) $add_newline \$$prompt_var[1][1]'$color_normal '
118 end
119end
120
121function fish_right_prompt
122 set -e _tide_transient || string unescape \"\$$prompt_var[1][2]$color_normal\"
123end"
124 else
125 eval "
126function fish_prompt
127 _tide_status=\$status _tide_pipestatus=\$pipestatus if not set -e _tide_repaint
128 jobs -q && jobs -p | count | read -lx _tide_jobs
129 $fish_path -c \"set _tide_pipestatus \$_tide_pipestatus
130set _tide_parent_dirs \$_tide_parent_dirs
131PATH=\$(string escape \"\$PATH\") CMD_DURATION=\$CMD_DURATION fish_bind_mode=\$fish_bind_mode set $prompt_var (_tide_1_line_prompt)\" &
132 builtin disown
133
134 command kill \$_tide_last_pid 2>/dev/null
135 set -g _tide_last_pid \$last_pid
136 end
137
138 math \$COLUMNS-(string length -V \"\$$prompt_var[1][1]\$$prompt_var[1][2]\")$column_offset | read -lx dist_btwn_sides
139 string replace @PWD@ (_tide_pwd) $add_newline \$$prompt_var[1][1]'$color_normal '
140end
141
142function fish_right_prompt
143 string unescape \"\$$prompt_var[1][2]$color_normal\"
144end"
145 end
146end
147
148eval "function _tide_on_fish_exit --on-event fish_exit
149 set -e $prompt_var
150end"
151
152if test "$tide_prompt_transient_enabled" = true
153 function _tide_enter_transient
154 # If the commandline will be executed, or is empty
155 if commandline --is-valid || test -z "$(commandline)"
156 # Pager open usually means selecting, not running
157 # Can be untrue, but it's better than the alternative
158 if not commandline --paging-mode
159 set -g _tide_transient
160 set -g _tide_repaint
161 commandline -f repaint
162 end
163 end
164 commandline -f execute
165 end
166
167 bind \r _tide_enter_transient
168 bind \n _tide_enter_transient
169 bind -M insert \r _tide_enter_transient
170 bind -M insert \n _tide_enter_transient
171end
diff --git a/home-config/fish/functions/fisher.fish b/home-config/fish/functions/fisher.fish
new file mode 100644
index 0000000..b1513d3
--- /dev/null
+++ b/home-config/fish/functions/fisher.fish
@@ -0,0 +1,240 @@
1function fisher --argument-names cmd --description "A plugin manager for Fish"
2 set --query fisher_path || set --local fisher_path $__fish_config_dir
3 set --local fisher_version 4.4.4
4 set --local fish_plugins $__fish_config_dir/fish_plugins
5
6 switch "$cmd"
7 case -v --version
8 echo "fisher, version $fisher_version"
9 case "" -h --help
10 echo "Usage: fisher install <plugins...> Install plugins"
11 echo " fisher remove <plugins...> Remove installed plugins"
12 echo " fisher update <plugins...> Update installed plugins"
13 echo " fisher update Update all installed plugins"
14 echo " fisher list [<regex>] List installed plugins matching regex"
15 echo "Options:"
16 echo " -v, --version Print version"
17 echo " -h, --help Print this help message"
18 echo "Variables:"
19 echo " \$fisher_path Plugin installation path. Default: $__fish_config_dir" | string replace --regex -- $HOME \~
20 case ls list
21 string match --entire --regex -- "$argv[2]" $_fisher_plugins
22 case install update remove
23 isatty || read --local --null --array stdin && set --append argv $stdin
24
25 set --local install_plugins
26 set --local update_plugins
27 set --local remove_plugins
28 set --local arg_plugins $argv[2..-1]
29 set --local old_plugins $_fisher_plugins
30 set --local new_plugins
31
32 test -e $fish_plugins && set --local file_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins)
33
34 if ! set --query argv[2]
35 if test "$cmd" != update
36 echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1
37 else if ! set --query file_plugins
38 echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1
39 end
40 set arg_plugins $file_plugins
41 end
42
43 for plugin in $arg_plugins
44 set plugin (test -e "$plugin" && realpath $plugin || string lower -- $plugin)
45 contains -- "$plugin" $new_plugins || set --append new_plugins $plugin
46 end
47
48 if set --query argv[2]
49 for plugin in $new_plugins
50 if contains -- "$plugin" $old_plugins
51 test "$cmd" = remove &&
52 set --append remove_plugins $plugin ||
53 set --append update_plugins $plugin
54 else if test "$cmd" = install
55 set --append install_plugins $plugin
56 else
57 echo "fisher: Plugin not installed: \"$plugin\"" >&2 && return 1
58 end
59 end
60 else
61 for plugin in $new_plugins
62 contains -- "$plugin" $old_plugins &&
63 set --append update_plugins $plugin ||
64 set --append install_plugins $plugin
65 end
66
67 for plugin in $old_plugins
68 contains -- "$plugin" $new_plugins || set --append remove_plugins $plugin
69 end
70 end
71
72 set --local pid_list
73 set --local source_plugins
74 set --local fetch_plugins $update_plugins $install_plugins
75 set --local fish_path (status fish-path)
76
77 echo (set_color --bold)fisher $cmd version $fisher_version(set_color normal)
78
79 for plugin in $fetch_plugins
80 set --local source (command mktemp -d)
81 set --append source_plugins $source
82
83 command mkdir -p $source/{completions,conf.d,themes,functions}
84
85 $fish_path --command "
86 if test -e $plugin
87 command cp -Rf $plugin/* $source
88 else
89 set temp (command mktemp -d)
90 set repo (string split -- \@ $plugin) || set repo[2] HEAD
91
92 if set path (string replace --regex -- '^(https://)?gitlab.com/' '' \$repo[1])
93 set name (string split -- / \$path)[-1]
94 set url https://gitlab.com/\$path/-/archive/\$repo[2]/\$name-\$repo[2].tar.gz
95 else
96 set url https://api.github.com/repos/\$repo[1]/tarball/\$repo[2]
97 end
98
99 echo Fetching (set_color --underline)\$url(set_color normal)
100
101 if command curl -q --silent -L \$url | command tar -xzC \$temp -f - 2>/dev/null
102 command cp -Rf \$temp/*/* $source
103 else
104 echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2
105 command rm -rf $source
106 end
107
108 command rm -rf \$temp
109 end
110
111 set files $source/* && string match --quiet --regex -- .+\.fish\\\$ \$files
112 " &
113
114 set --append pid_list (jobs --last --pid)
115 end
116
117 wait $pid_list 2>/dev/null
118
119 for plugin in $fetch_plugins
120 if set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] && test ! -e $source
121 if set --local index (contains --index -- "$plugin" $install_plugins)
122 set --erase install_plugins[$index]
123 else
124 set --erase update_plugins[(contains --index -- "$plugin" $update_plugins)]
125 end
126 end
127 end
128
129 for plugin in $update_plugins $remove_plugins
130 if set --local index (contains --index -- "$plugin" $_fisher_plugins)
131 set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
132
133 if contains -- "$plugin" $remove_plugins
134 for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var)
135 emit {$name}_uninstall
136 end
137 printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~
138 set --erase _fisher_plugins[$index]
139 end
140
141 command rm -rf (string replace -- \~ ~ $$plugin_files_var)
142
143 functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var)
144
145 for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var)
146 complete --erase --command $name
147 end
148
149 set --erase $plugin_files_var
150 end
151 end
152
153 if set --query update_plugins[1] || set --query install_plugins[1]
154 command mkdir -p $fisher_path/{functions,themes,conf.d,completions}
155 end
156
157 for plugin in $update_plugins $install_plugins
158 set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)]
159 set --local files $source/{functions,themes,conf.d,completions}/*
160
161 if set --local index (contains --index -- $plugin $install_plugins)
162 set --local user_files $fisher_path/{functions,themes,conf.d,completions}/*
163 set --local conflict_files
164
165 for file in (string replace -- $source/ $fisher_path/ $files)
166 contains -- $file $user_files && set --append conflict_files $file
167 end
168
169 if set --query conflict_files[1] && set --erase install_plugins[$index]
170 echo -s "fisher: Cannot install \"$plugin\": please remove or move conflicting files first:" \n" "$conflict_files >&2
171 continue
172 end
173 end
174
175 for file in (string replace -- $source/ "" $files)
176 command cp -RLf $source/$file $fisher_path/$file
177 end
178
179 set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
180
181 set --query files[1] && set --universal $plugin_files_var (string replace -- $source $fisher_path $files | string replace -- ~ \~)
182
183 contains -- $plugin $_fisher_plugins || set --universal --append _fisher_plugins $plugin
184 contains -- $plugin $install_plugins && set --local event install || set --local event update
185
186 printf "%s\n" Installing\ (set_color --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~
187
188 for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var | string replace -- \~ ~)
189 source $file
190 if set --local name (string replace --regex -- '.+conf\.d/([^/]+)\.fish$' '$1' $file)
191 emit {$name}_$event
192 end
193 end
194 end
195
196 command rm -rf $source_plugins
197
198 if set --query _fisher_plugins[1]
199 set --local commit_plugins
200
201 for plugin in $file_plugins
202 contains -- (string lower -- $plugin) (string lower -- $_fisher_plugins) && set --append commit_plugins $plugin
203 end
204
205 for plugin in $_fisher_plugins
206 contains -- (string lower -- $plugin) (string lower -- $commit_plugins) || set --append commit_plugins $plugin
207 end
208
209 printf "%s\n" $commit_plugins >$fish_plugins
210 else
211 set --erase _fisher_plugins
212 command rm -f $fish_plugins
213 end
214
215 set --local total (count $install_plugins) (count $update_plugins) (count $remove_plugins)
216
217 test "$total" != "0 0 0" && echo (string join ", " (
218 test $total[1] = 0 || echo "Installed $total[1]") (
219 test $total[2] = 0 || echo "Updated $total[2]") (
220 test $total[3] = 0 || echo "Removed $total[3]")
221 ) plugin/s
222 case \*
223 echo "fisher: Unknown command: \"$cmd\"" >&2 && return 1
224 end
225end
226
227if ! set --query _fisher_upgraded_to_4_4
228 set --universal _fisher_upgraded_to_4_4
229 if functions --query _fisher_list
230 set --query XDG_DATA_HOME[1] || set --local XDG_DATA_HOME ~/.local/share
231 command rm -rf $XDG_DATA_HOME/fisher
232 functions --erase _fisher_{list,plugin_parse}
233 fisher update >/dev/null 2>/dev/null
234 else
235 for var in (set --names | string match --entire --regex '^_fisher_.+_files$')
236 set $var (string replace -- ~ \~ $$var)
237 end
238 functions --erase _fisher_fish_postexec
239 end
240end
diff --git a/home-config/fish/functions/fzf_configure_bindings.fish b/home-config/fish/functions/fzf_configure_bindings.fish
new file mode 100644
index 0000000..4b4e7a2
--- /dev/null
+++ b/home-config/fish/functions/fzf_configure_bindings.fish
@@ -0,0 +1,46 @@
1# Always installs bindings for insert and default mode for simplicity and b/c it has almost no side-effect
2# https://gitter.im/fish-shell/fish-shell?at=60a55915ee77a74d685fa6b1
3function fzf_configure_bindings --description "Installs the default key bindings for fzf.fish with user overrides passed as options."
4 # no need to install bindings if not in interactive mode or running tests
5 status is-interactive || test "$CI" = true; or return
6
7 set -f options_spec h/help 'directory=?' 'git_log=?' 'git_status=?' 'history=?' 'processes=?' 'variables=?'
8 argparse --max-args=0 --ignore-unknown $options_spec -- $argv 2>/dev/null
9 if test $status -ne 0
10 echo "Invalid option or a positional argument was provided." >&2
11 _fzf_configure_bindings_help
12 return 22
13 else if set --query _flag_help
14 _fzf_configure_bindings_help
15 return
16 else
17 # Initialize with default key sequences and then override or disable them based on flags
18 # index 1 = directory, 2 = git_log, 3 = git_status, 4 = history, 5 = processes, 6 = variables
19 set -f key_sequences \e\cf \e\cl \e\cs \cr \e\cp \cv # \c = control, \e = escape
20 set --query _flag_directory && set key_sequences[1] "$_flag_directory"
21 set --query _flag_git_log && set key_sequences[2] "$_flag_git_log"
22 set --query _flag_git_status && set key_sequences[3] "$_flag_git_status"
23 set --query _flag_history && set key_sequences[4] "$_flag_history"
24 set --query _flag_processes && set key_sequences[5] "$_flag_processes"
25 set --query _flag_variables && set key_sequences[6] "$_flag_variables"
26
27 # If fzf bindings already exists, uninstall it first for a clean slate
28 if functions --query _fzf_uninstall_bindings
29 _fzf_uninstall_bindings
30 end
31
32 for mode in default insert
33 test -n $key_sequences[1] && bind --mode $mode $key_sequences[1] _fzf_search_directory
34 test -n $key_sequences[2] && bind --mode $mode $key_sequences[2] _fzf_search_git_log
35 test -n $key_sequences[3] && bind --mode $mode $key_sequences[3] _fzf_search_git_status
36 test -n $key_sequences[4] && bind --mode $mode $key_sequences[4] _fzf_search_history
37 test -n $key_sequences[5] && bind --mode $mode $key_sequences[5] _fzf_search_processes
38 test -n $key_sequences[6] && bind --mode $mode $key_sequences[6] "$_fzf_search_vars_command"
39 end
40
41 function _fzf_uninstall_bindings --inherit-variable key_sequences
42 bind --erase -- $key_sequences
43 bind --erase --mode insert -- $key_sequences
44 end
45 end
46end
diff --git a/home-config/fish/functions/tide.fish b/home-config/fish/functions/tide.fish
new file mode 100644
index 0000000..092a722
--- /dev/null
+++ b/home-config/fish/functions/tide.fish
@@ -0,0 +1,28 @@
1function tide --description 'Manage your Tide prompt'
2 argparse --stop-nonopt v/version h/help -- $argv
3
4 if set -q _flag_version
5 echo 'tide, version 6.1.1'
6 else if set -q _flag_help
7 _tide_help
8 else if functions --query _tide_sub_$argv[1]
9 _tide_sub_$argv[1] $argv[2..]
10 else
11 _tide_help
12 return 1
13 end
14end
15
16function _tide_help
17 printf %s\n \
18 'Usage: tide [options] subcommand [options]' \
19 '' \
20 'Options:' \
21 ' -v or --version print tide version number' \
22 ' -h or --help print this help message' \
23 '' \
24 'Subcommands:' \
25 ' configure run interactive configuration wizard' \
26 ' reload reload tide configuration' \
27 ' bug-report print info for use in bug reports'
28end
diff --git a/home-config/fish/functions/tide/configure/choices/all/finish.fish b/home-config/fish/functions/tide/configure/choices/all/finish.fish
new file mode 100644
index 0000000..f670b1e
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/choices/all/finish.fish
@@ -0,0 +1,46 @@
1function finish
2 _tide_title Finish
3
4 echo
5 set_color red
6 _tide_option y 'Overwrite your current tide config'
7 set_color normal
8 echo
9
10 _tide_option p 'Exit and print the config you just generated'
11 echo
12
13 _tide_menu (status function)
14 switch $_tide_selected_option
15 case 'Overwrite your current tide config'
16 _tide_finish
17 command -q clear && clear
18 set -q _flag_auto || _tide_print_configure_current_options
19 case 'Exit and print the config you just generated'
20 _tide_exit_configure
21 command -q clear && clear
22 _tide_print_configure_current_options
23 end
24end
25
26function _tide_finish
27 _tide_exit_configure
28
29 # Deal with prompt char/vi mode
30 contains character $fake_tide_left_prompt_items || set -p fake_tide_left_prompt_items vi_mode
31
32 # Set the real variables
33 for fakeVar in (set --names | string match -r "^fake_tide.*")
34 set -U (string replace 'fake_' '' $fakeVar) $$fakeVar
35 end
36
37 # Make sure old prompt won't display
38 set -e $_tide_prompt_var 2>/dev/null
39
40 # Re-initialize the prompt
41 tide reload
42end
43
44function _tide_print_configure_current_options
45 _tide_fish_colorize "tide configure --auto $_tide_configure_current_options"
46end
diff --git a/home-config/fish/functions/tide/configure/choices/all/icons.fish b/home-config/fish/functions/tide/configure/choices/all/icons.fish
new file mode 100644
index 0000000..be167bb
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/choices/all/icons.fish
@@ -0,0 +1,33 @@
1function icons
2 _tide_title Icons
3
4 _tide_option 1 'Few icons'
5 _tide_display_prompt
6
7 _tide_option 2 'Many icons'
8 _enable_icons
9 _tide_display_prompt
10
11 _tide_menu (status function)
12 switch $_tide_selected_option
13 case 'Few icons'
14 _disable_icons
15 end
16 _next_choice all/transient
17end
18
19function _enable_icons
20 set -p fake_tide_left_prompt_items os
21 set -g fake_tide_pwd_icon 
22 set -g fake_tide_pwd_icon_home 
23 set -g fake_tide_cmd_duration_icon 
24 set -g fake_tide_git_icon 
25end
26
27function _disable_icons
28 _tide_find_and_remove os fake_tide_left_prompt_items
29 set fake_tide_pwd_icon
30 set fake_tide_pwd_icon_home
31 set fake_tide_cmd_duration_icon
32 set fake_tide_git_icon
33end
diff --git a/home-config/fish/functions/tide/configure/choices/all/prompt_colors.fish b/home-config/fish/functions/tide/configure/choices/all/prompt_colors.fish
new file mode 100644
index 0000000..247ef4e
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/choices/all/prompt_colors.fish
@@ -0,0 +1,26 @@
1function prompt_colors
2 _tide_title 'Prompt Colors'
3
4 _tide_option 1 'True color'
5 _tide_display_prompt
6
7 _tide_option 2 '16 colors'
8 _load_config "$_tide_configure_style"_16color
9 set -g _tide_16color true
10 _tide_display_prompt
11
12 _tide_menu (status function)
13 switch $_tide_selected_option
14 case 'True color'
15 _load_config "$_tide_configure_style"
16 set -e _tide_16color
17 switch $_tide_configure_style
18 case lean rainbow
19 _next_choice all/show_time
20 case classic
21 _next_choice classic/classic_prompt_color
22 end
23 case '16 colors'
24 _next_choice all/show_time
25 end
26end
diff --git a/home-config/fish/functions/tide/configure/choices/all/prompt_connection.fish b/home-config/fish/functions/tide/configure/choices/all/prompt_connection.fish
new file mode 100644
index 0000000..ff76546
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/choices/all/prompt_connection.fish
@@ -0,0 +1,31 @@
1function prompt_connection
2 _tide_title 'Prompt Connection'
3
4 _tide_option 1 Disconnected
5 set -g fake_tide_prompt_icon_connection ' '
6 _tide_display_prompt
7
8 _tide_option 2 Dotted
9 set -g fake_tide_prompt_icon_connection '·'
10 _tide_display_prompt
11
12 _tide_option 3 Solid
13 set -g fake_tide_prompt_icon_connection '─'
14 _tide_display_prompt
15
16 _tide_menu (status function)
17 switch $_tide_selected_option
18 case Disconnected
19 set -g fake_tide_prompt_icon_connection ' '
20 case Dotted
21 set -g fake_tide_prompt_icon_connection '·'
22 case Solid
23 set -g fake_tide_prompt_icon_connection '─'
24 end
25 switch $_tide_configure_style
26 case lean
27 _next_choice all/prompt_connection_andor_frame_color
28 case classic rainbow
29 _next_choice powerline/powerline_right_prompt_frame
30 end
31end
diff --git a/home-config/fish/functions/tide/configure/choices/all/prompt_connection_andor_frame_color.fish b/home-config/fish/functions/tide/configure/choices/all/prompt_connection_andor_frame_color.fish
new file mode 100644
index 0000000..cefbf2c
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/choices/all/prompt_connection_andor_frame_color.fish
@@ -0,0 +1,40 @@
1function prompt_connection_andor_frame_color
2 if test "$_tide_16color" = true ||
3 test "$fake_tide_left_prompt_frame_enabled" = false -a \
4 "$fake_tide_right_prompt_frame_enabled" = false -a \
5 "$fake_tide_prompt_icon_connection" = ' '
6 _next_choice all/prompt_spacing
7 return 0
8 end
9
10 _tide_title "Connection & Frame Color"
11
12 _tide_option 1 Lightest
13 set -g fake_tide_prompt_color_frame_and_connection 808080
14 _tide_display_prompt
15
16 _tide_option 2 Light
17 set -g fake_tide_prompt_color_frame_and_connection 6C6C6C
18 _tide_display_prompt
19
20 _tide_option 3 Dark
21 set -g fake_tide_prompt_color_frame_and_connection 585858
22 _tide_display_prompt
23
24 _tide_option 4 Darkest
25 set -g fake_tide_prompt_color_frame_and_connection 444444
26 _tide_display_prompt
27
28 _tide_menu (status function)
29 switch $_tide_selected_option
30 case Lightest
31 set -g fake_tide_prompt_color_frame_and_connection 808080
32 case Light
33 set -g fake_tide_prompt_color_frame_and_connection 6C6C6C
34 case Dark
35 set -g fake_tide_prompt_color_frame_and_connection 585858
36 case Darkest
37 set -g fake_tide_prompt_color_frame_and_connection 444444
38 end
39 _next_choice all/prompt_spacing
40end
diff --git a/home-config/fish/functions/tide/configure/choices/all/prompt_spacing.fish b/home-config/fish/functions/tide/configure/choices/all/prompt_spacing.fish
new file mode 100644
index 0000000..f68be68
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/choices/all/prompt_spacing.fish
@@ -0,0 +1,22 @@
1function prompt_spacing
2 _tide_title 'Prompt Spacing'
3
4 _tide_option 1 Compact
5 set -g fake_tide_prompt_add_newline_before false
6 _tide_display_prompt
7 _tide_display_prompt
8
9 _tide_option 2 Sparse
10 set -g fake_tide_prompt_add_newline_before true
11 _tide_display_prompt
12 _tide_display_prompt
13
14 _tide_menu (status function)
15 switch $_tide_selected_option
16 case Compact
17 set -g fake_tide_prompt_add_newline_before false
18 case Sparse
19 set -g fake_tide_prompt_add_newline_before true
20 end
21 _next_choice all/icons
22end
diff --git a/home-config/fish/functions/tide/configure/choices/all/show_time.fish b/home-config/fish/functions/tide/configure/choices/all/show_time.fish
new file mode 100644
index 0000000..b66c785
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/choices/all/show_time.fish
@@ -0,0 +1,33 @@
1function show_time
2 _tide_title 'Show current time?'
3
4 _tide_option 1 No
5 _tide_display_prompt
6
7 set -a fake_tide_right_prompt_items time
8
9 _tide_option 2 '24-hour format'
10 set -g fake_tide_time_format %T
11 _tide_display_prompt
12
13 _tide_option 3 '12-hour format'
14 set -g fake_tide_time_format %r
15 _tide_display_prompt
16
17 _tide_menu (status function)
18 switch $_tide_selected_option
19 case No
20 set -g fake_tide_time_format ''
21 set -e fake_tide_right_prompt_items[-1]
22 case '24-hour format'
23 set -g fake_tide_time_format %T
24 case '12-hour format'
25 set -g fake_tide_time_format %r
26 end
27 switch $_tide_configure_style
28 case lean
29 _next_choice "$_tide_configure_style"/"$_tide_configure_style"_prompt_height
30 case classic rainbow
31 _next_choice "$_tide_configure_style"/"$_tide_configure_style"_prompt_separators
32 end
33end
diff --git a/home-config/fish/functions/tide/configure/choices/all/style.fish b/home-config/fish/functions/tide/configure/choices/all/style.fish
new file mode 100644
index 0000000..fe9a58f
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/choices/all/style.fish
@@ -0,0 +1,36 @@
1function style
2 set -g _tide_configure_current_options
3
4 _tide_title 'Prompt Style'
5
6 _tide_option 1 Lean
7 _load_config lean
8 _tide_display_prompt
9
10 _tide_option 2 Classic
11 _load_config classic
12 _tide_display_prompt
13
14 _tide_option 3 Rainbow
15 _load_config rainbow
16 _tide_display_prompt
17
18 _tide_menu (status function) --no-restart
19 switch $_tide_selected_option
20 case Lean
21 _load_config lean
22 set -g _tide_configure_style lean
23 case Classic
24 _load_config classic
25 set -g _tide_configure_style classic
26 case Rainbow
27 _load_config rainbow
28 set -g _tide_configure_style rainbow
29 end
30 _next_choice all/prompt_colors
31end
32
33function _load_config -a name
34 string replace -r '^' 'set -g fake_' <(status dirname)/../../icons.fish | source
35 string replace -r '^' 'set -g fake_' <(status dirname)/../../configs/$name.fish | source
36end
diff --git a/home-config/fish/functions/tide/configure/choices/all/transient.fish b/home-config/fish/functions/tide/configure/choices/all/transient.fish
new file mode 100644
index 0000000..df2b6b6
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/choices/all/transient.fish
@@ -0,0 +1,22 @@
1function transient
2 _tide_title 'Enable transient prompt?'
3
4 _tide_option 1 No
5 _tide_display_prompt
6 _tide_display_prompt
7 _tide_display_prompt
8
9 _tide_option 2 Yes
10 _configure_transient= _tide_display_prompt
11 _configure_transient= _tide_display_prompt
12 _tide_display_prompt
13
14 _tide_menu (status function)
15 switch $_tide_selected_option
16 case No
17 set fake_tide_prompt_transient_enabled false
18 case Yes
19 set fake_tide_prompt_transient_enabled true
20 end
21 _next_choice all/finish
22end
diff --git a/home-config/fish/functions/tide/configure/choices/classic/classic_prompt_color.fish b/home-config/fish/functions/tide/configure/choices/classic/classic_prompt_color.fish
new file mode 100644
index 0000000..77ceeaf
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/choices/classic/classic_prompt_color.fish
@@ -0,0 +1,38 @@
1function classic_prompt_color
2 _tide_title 'Prompt Color'
3
4 _tide_option 1 Lightest
5 _set_all_items_bg_color 585858
6 _tide_display_prompt
7
8 _tide_option 2 Light
9 _set_all_items_bg_color 444444
10 _tide_display_prompt
11
12 _tide_option 3 Dark
13 _set_all_items_bg_color 303030
14 _tide_display_prompt
15
16 _tide_option 4 Darkest
17 _set_all_items_bg_color 1C1C1C
18 _tide_display_prompt
19
20 _tide_menu (status function)
21 switch $_tide_selected_option
22 case Lightest
23 _set_all_items_bg_color 585858
24 case Light
25 _set_all_items_bg_color 444444
26 case Dark
27 _set_all_items_bg_color 303030
28 case Darkest
29 _set_all_items_bg_color 1C1C1C
30 end
31 _next_choice all/show_time
32end
33
34function _set_all_items_bg_color -a color
35 for var in (set --names | string match -r "fake_.*_bg_color.*")
36 set $var $color
37 end
38end
diff --git a/home-config/fish/functions/tide/configure/choices/classic/classic_prompt_separators.fish b/home-config/fish/functions/tide/configure/choices/classic/classic_prompt_separators.fish
new file mode 100644
index 0000000..20af6cd
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/choices/classic/classic_prompt_separators.fish
@@ -0,0 +1,40 @@
1function classic_prompt_separators
2 _tide_title 'Prompt Separators'
3
4 _tide_option 1 Angled
5 set -g fake_tide_left_prompt_separator_same_color 
6 set -g fake_tide_right_prompt_separator_same_color 
7 _tide_display_prompt
8
9 _tide_option 2 Vertical
10 set -g fake_tide_left_prompt_separator_same_color │
11 set -g fake_tide_right_prompt_separator_same_color │
12 _tide_display_prompt
13
14 _tide_option 3 Slanted
15 set -g fake_tide_left_prompt_separator_same_color ╱
16 set -g fake_tide_right_prompt_separator_same_color ╱
17 _tide_display_prompt
18
19 _tide_option 4 Round
20 set -g fake_tide_left_prompt_separator_same_color 
21 set -g fake_tide_right_prompt_separator_same_color 
22 _tide_display_prompt
23
24 _tide_menu (status function)
25 switch $_tide_selected_option
26 case Angled
27 set -g fake_tide_left_prompt_separator_same_color 
28 set -g fake_tide_right_prompt_separator_same_color 
29 case Vertical
30 set -g fake_tide_left_prompt_separator_same_color │
31 set -g fake_tide_right_prompt_separator_same_color │
32 case Slanted
33 set -g fake_tide_left_prompt_separator_same_color ╱
34 set -g fake_tide_right_prompt_separator_same_color ╱
35 case Round
36 set -g fake_tide_left_prompt_separator_same_color 
37 set -g fake_tide_right_prompt_separator_same_color 
38 end
39 _next_choice powerline/powerline_prompt_heads
40end
diff --git a/home-config/fish/functions/tide/configure/choices/lean/lean_prompt_height.fish b/home-config/fish/functions/tide/configure/choices/lean/lean_prompt_height.fish
new file mode 100644
index 0000000..2077241
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/choices/lean/lean_prompt_height.fish
@@ -0,0 +1,26 @@
1function lean_prompt_height
2 _tide_title 'Prompt Height'
3
4 _tide_option 1 'One line'
5 _tide_find_and_remove newline fake_tide_left_prompt_items
6 set -g fake_tide_left_prompt_suffix ''
7 _tide_display_prompt
8
9 _tide_option 2 'Two lines'
10 set -g fake_tide_left_prompt_items $fake_tide_left_prompt_items[1..-2] newline $fake_tide_left_prompt_items[-1]
11 set -g fake_tide_left_prompt_suffix ' '
12 _tide_display_prompt
13
14 _tide_menu (status function)
15 switch $_tide_selected_option
16 case 'One line'
17 _tide_find_and_remove newline fake_tide_left_prompt_items
18 set fake_tide_left_prompt_suffix ''
19 _next_choice all/prompt_connection_andor_frame_color
20 case 'Two lines'
21 _tide_find_and_remove newline fake_tide_left_prompt_items
22 set -g fake_tide_left_prompt_items $fake_tide_left_prompt_items[1..-2] newline $fake_tide_left_prompt_items[-1]
23 set -g fake_tide_left_prompt_suffix ' '
24 _next_choice all/prompt_connection
25 end
26end
diff --git a/home-config/fish/functions/tide/configure/choices/powerline/powerline_prompt_heads.fish b/home-config/fish/functions/tide/configure/choices/powerline/powerline_prompt_heads.fish
new file mode 100644
index 0000000..0030cad
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/choices/powerline/powerline_prompt_heads.fish
@@ -0,0 +1,32 @@
1function powerline_prompt_heads
2 _tide_title 'Prompt Heads'
3
4 _tide_option 1 Sharp
5 set -g fake_tide_left_prompt_suffix 
6 set -g fake_tide_right_prompt_prefix 
7 _tide_display_prompt
8
9 _tide_option 2 Slanted
10 set -g fake_tide_left_prompt_suffix 
11 set -g fake_tide_right_prompt_prefix 
12 _tide_display_prompt
13
14 _tide_option 3 Round
15 set -g fake_tide_left_prompt_suffix 
16 set -g fake_tide_right_prompt_prefix 
17 _tide_display_prompt
18
19 _tide_menu (status function)
20 switch $_tide_selected_option
21 case Sharp
22 set -g fake_tide_left_prompt_suffix 
23 set -g fake_tide_right_prompt_prefix 
24 case Slanted
25 set -g fake_tide_left_prompt_suffix 
26 set -g fake_tide_right_prompt_prefix 
27 case Round
28 set -g fake_tide_left_prompt_suffix 
29 set -g fake_tide_right_prompt_prefix 
30 end
31 _next_choice powerline/powerline_prompt_tails
32end
diff --git a/home-config/fish/functions/tide/configure/choices/powerline/powerline_prompt_style.fish b/home-config/fish/functions/tide/configure/choices/powerline/powerline_prompt_style.fish
new file mode 100644
index 0000000..b374757
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/choices/powerline/powerline_prompt_style.fish
@@ -0,0 +1,51 @@
1function powerline_prompt_style
2 _tide_title 'Powerline Prompt Style'
3
4 _tide_option 1 'One line'
5 _tide_find_and_remove newline fake_tide_left_prompt_items
6 _tide_find_and_remove character fake_tide_left_prompt_items
7 set fake_tide_left_prompt_frame_enabled false
8 set fake_tide_right_prompt_frame_enabled false
9 _tide_display_prompt
10
11 set -a fake_tide_left_prompt_items newline
12
13 _tide_option 2 'Two lines, character'
14 set -a fake_tide_left_prompt_items character
15 set fake_tide_left_prompt_frame_enabled false
16 set fake_tide_right_prompt_frame_enabled false
17 _tide_display_prompt
18
19 _tide_option 3 'Two lines, frame'
20 _tide_find_and_remove character fake_tide_left_prompt_items
21 set fake_tide_left_prompt_frame_enabled true
22 set fake_tide_right_prompt_frame_enabled true
23 _tide_display_prompt
24
25 _tide_option 4 'Two lines, character and frame'
26 set -a fake_tide_left_prompt_items character
27 set fake_tide_left_prompt_frame_enabled true
28 set fake_tide_right_prompt_frame_enabled true
29 _tide_display_prompt
30
31 _tide_menu (status function)
32 switch $_tide_selected_option
33 case 'One line'
34 _tide_find_and_remove newline fake_tide_left_prompt_items
35 _tide_find_and_remove character fake_tide_left_prompt_items
36 set fake_tide_left_prompt_frame_enabled false
37 set fake_tide_right_prompt_frame_enabled false
38 _next_choice all/prompt_connection_andor_frame_color
39 case 'Two lines, character'
40 set fake_tide_left_prompt_frame_enabled false
41 set fake_tide_right_prompt_frame_enabled false
42 _next_choice all/prompt_connection
43 case 'Two lines, frame'
44 _tide_find_and_remove character fake_tide_left_prompt_items
45 set fake_tide_left_prompt_frame_enabled true
46 set fake_tide_right_prompt_frame_enabled true
47 _next_choice all/prompt_connection
48 case 'Two lines, character and frame'
49 _next_choice all/prompt_connection
50 end
51end
diff --git a/home-config/fish/functions/tide/configure/choices/powerline/powerline_prompt_tails.fish b/home-config/fish/functions/tide/configure/choices/powerline/powerline_prompt_tails.fish
new file mode 100644
index 0000000..6b1574b
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/choices/powerline/powerline_prompt_tails.fish
@@ -0,0 +1,40 @@
1function powerline_prompt_tails
2 _tide_title 'Prompt Tails'
3
4 _tide_option 1 Flat
5 set -g fake_tide_left_prompt_prefix ''
6 set -g fake_tide_right_prompt_suffix ''
7 _tide_display_prompt
8
9 _tide_option 2 Sharp
10 set -g fake_tide_left_prompt_prefix 
11 set -g fake_tide_right_prompt_suffix 
12 _tide_display_prompt
13
14 _tide_option 3 Slanted
15 set -g fake_tide_left_prompt_prefix 
16 set -g fake_tide_right_prompt_suffix 
17 _tide_display_prompt
18
19 _tide_option 4 Round
20 set -g fake_tide_left_prompt_prefix 
21 set -g fake_tide_right_prompt_suffix 
22 _tide_display_prompt
23
24 _tide_menu (status function)
25 switch $_tide_selected_option
26 case Flat
27 set -g fake_tide_left_prompt_prefix ''
28 set -g fake_tide_right_prompt_suffix ''
29 case Sharp
30 set -g fake_tide_left_prompt_prefix 
31 set -g fake_tide_right_prompt_suffix 
32 case Slanted
33 set -g fake_tide_left_prompt_prefix 
34 set -g fake_tide_right_prompt_suffix 
35 case Round
36 set -g fake_tide_left_prompt_prefix 
37 set -g fake_tide_right_prompt_suffix 
38 end
39 _next_choice powerline/powerline_prompt_style
40end
diff --git a/home-config/fish/functions/tide/configure/choices/powerline/powerline_right_prompt_frame.fish b/home-config/fish/functions/tide/configure/choices/powerline/powerline_right_prompt_frame.fish
new file mode 100644
index 0000000..a2d0a5b
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/choices/powerline/powerline_right_prompt_frame.fish
@@ -0,0 +1,20 @@
1function powerline_right_prompt_frame
2 _tide_title 'Right Prompt Frame'
3
4 _tide_option 1 No
5 set fake_tide_right_prompt_frame_enabled false
6 _tide_display_prompt
7
8 _tide_option 2 Yes
9 set fake_tide_right_prompt_frame_enabled true
10 _tide_display_prompt
11
12 _tide_menu (status function)
13 switch $_tide_selected_option
14 case No
15 set fake_tide_right_prompt_frame_enabled false
16 case Yes
17 set fake_tide_right_prompt_frame_enabled true
18 end
19 _next_choice all/prompt_connection_andor_frame_color
20end
diff --git a/home-config/fish/functions/tide/configure/choices/rainbow/rainbow_prompt_separators.fish b/home-config/fish/functions/tide/configure/choices/rainbow/rainbow_prompt_separators.fish
new file mode 100644
index 0000000..14b9319
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/choices/rainbow/rainbow_prompt_separators.fish
@@ -0,0 +1,40 @@
1function rainbow_prompt_separators
2 _tide_title 'Prompt Separators'
3
4 _tide_option 1 Angled
5 set -g fake_tide_left_prompt_separator_diff_color 
6 set -g fake_tide_right_prompt_separator_diff_color 
7 _tide_display_prompt
8
9 _tide_option 2 Vertical
10 set -g fake_tide_left_prompt_separator_diff_color ''
11 set -g fake_tide_right_prompt_separator_diff_color ''
12 _tide_display_prompt
13
14 _tide_option 3 Slanted
15 set -g fake_tide_left_prompt_separator_diff_color ''
16 set -g fake_tide_right_prompt_separator_diff_color ''
17 _tide_display_prompt
18
19 _tide_option 4 Round
20 set -g fake_tide_left_prompt_separator_diff_color ''
21 set -g fake_tide_right_prompt_separator_diff_color ''
22 _tide_display_prompt
23
24 _tide_menu (status function)
25 switch $_tide_selected_option
26 case Angled
27 set -g fake_tide_left_prompt_separator_diff_color 
28 set -g fake_tide_right_prompt_separator_diff_color 
29 case Vertical
30 set -g fake_tide_left_prompt_separator_diff_color ''
31 set -g fake_tide_right_prompt_separator_diff_color ''
32 case Slanted
33 set -g fake_tide_left_prompt_separator_diff_color ''
34 set -g fake_tide_right_prompt_separator_diff_color ''
35 case Round
36 set -g fake_tide_left_prompt_separator_diff_color ''
37 set -g fake_tide_right_prompt_separator_diff_color ''
38 end
39 _next_choice powerline/powerline_prompt_heads
40end
diff --git a/home-config/fish/functions/tide/configure/configs/classic.fish b/home-config/fish/functions/tide/configure/configs/classic.fish
new file mode 100644
index 0000000..8973cbc
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/configs/classic.fish
@@ -0,0 +1,116 @@
1tide_aws_bg_color 444444
2tide_aws_color FF9900
3tide_character_color $_tide_color_green
4tide_character_color_failure FF0000
5tide_cmd_duration_bg_color 444444
6tide_cmd_duration_color 87875F
7tide_cmd_duration_decimals 0
8tide_cmd_duration_threshold 3000
9tide_context_always_display false
10tide_context_bg_color 444444
11tide_context_color_default D7AF87
12tide_context_color_root $_tide_color_gold
13tide_context_color_ssh D7AF87
14tide_context_hostname_parts 1
15tide_crystal_bg_color 444444
16tide_crystal_color FFFFFF
17tide_direnv_bg_color 444444
18tide_direnv_bg_color_denied 444444
19tide_direnv_color $_tide_color_gold
20tide_direnv_color_denied FF0000
21tide_distrobox_bg_color 444444
22tide_distrobox_color FF00FF
23tide_docker_bg_color 444444
24tide_docker_color 2496ED
25tide_docker_default_contexts default colima
26tide_elixir_bg_color 444444
27tide_elixir_color 4E2A8E
28tide_gcloud_bg_color 444444
29tide_gcloud_color 4285F4
30tide_git_bg_color 444444
31tide_git_bg_color_unstable 444444
32tide_git_bg_color_urgent 444444
33tide_git_color_branch $_tide_color_green
34tide_git_color_conflicted FF0000
35tide_git_color_dirty $_tide_color_gold
36tide_git_color_operation FF0000
37tide_git_color_staged $_tide_color_gold
38tide_git_color_stash $_tide_color_green
39tide_git_color_untracked $_tide_color_light_blue
40tide_git_color_upstream $_tide_color_green
41tide_git_truncation_length 24
42tide_git_truncation_strategy
43tide_go_bg_color 444444
44tide_go_color 00ACD7
45tide_java_bg_color 444444
46tide_java_color ED8B00
47tide_jobs_bg_color 444444
48tide_jobs_color $_tide_color_dark_green
49tide_jobs_number_threshold 1000
50tide_kubectl_bg_color 444444
51tide_kubectl_color 326CE5
52tide_left_prompt_frame_enabled true
53tide_left_prompt_items pwd git newline
54tide_left_prompt_prefix ''
55tide_left_prompt_separator_diff_color 
56tide_left_prompt_separator_same_color 
57tide_left_prompt_suffix 
58tide_nix_shell_bg_color 444444
59tide_nix_shell_color 7EBAE4
60tide_node_bg_color 444444
61tide_node_color 44883E
62tide_os_bg_color 444444
63tide_os_color EEEEEE
64tide_php_bg_color 444444
65tide_php_color 617CBE
66tide_private_mode_bg_color 444444
67tide_private_mode_color FFFFFF
68tide_prompt_add_newline_before true
69tide_prompt_color_frame_and_connection 6C6C6C
70tide_prompt_color_separator_same_color 949494
71tide_prompt_min_cols 34
72tide_prompt_pad_items true
73tide_prompt_transient_enabled false
74tide_pulumi_bg_color 444444
75tide_pulumi_color F7BF2A
76tide_pwd_bg_color 444444
77tide_pwd_color_anchors $_tide_color_light_blue
78tide_pwd_color_dirs $_tide_color_dark_blue
79tide_pwd_color_truncated_dirs 8787AF
80tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform Cargo.toml composer.json CVS go.mod package.json build.zig
81tide_python_bg_color 444444
82tide_python_color 00AFAF
83tide_right_prompt_frame_enabled true
84tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir zig
85tide_right_prompt_prefix 
86tide_right_prompt_separator_diff_color 
87tide_right_prompt_separator_same_color 
88tide_right_prompt_suffix ''
89tide_ruby_bg_color 444444
90tide_ruby_color B31209
91tide_rustc_bg_color 444444
92tide_rustc_color F74C00
93tide_shlvl_bg_color 444444
94tide_shlvl_color d78700
95tide_shlvl_threshold 1
96tide_status_bg_color 444444
97tide_status_bg_color_failure 444444
98tide_status_color $_tide_color_dark_green
99tide_status_color_failure D70000
100tide_terraform_bg_color 444444
101tide_terraform_color 844FBA
102tide_time_bg_color 444444
103tide_time_color 5F8787
104tide_time_format %T
105tide_toolbox_bg_color 444444
106tide_toolbox_color 613583
107tide_vi_mode_bg_color_default 444444
108tide_vi_mode_bg_color_insert 444444
109tide_vi_mode_bg_color_replace 444444
110tide_vi_mode_bg_color_visual 444444
111tide_vi_mode_color_default 949494
112tide_vi_mode_color_insert 87AFAF
113tide_vi_mode_color_replace 87AF87
114tide_vi_mode_color_visual FF8700
115tide_zig_bg_color 444444
116tide_zig_color F7A41D
diff --git a/home-config/fish/functions/tide/configure/configs/classic_16color.fish b/home-config/fish/functions/tide/configure/configs/classic_16color.fish
new file mode 100644
index 0000000..670170f
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/configs/classic_16color.fish
@@ -0,0 +1,89 @@
1tide_aws_bg_color black
2tide_aws_color yellow
3tide_character_color brgreen
4tide_character_color_failure brred
5tide_cmd_duration_bg_color black
6tide_cmd_duration_color brblack
7tide_context_bg_color black
8tide_context_color_default yellow
9tide_context_color_root bryellow
10tide_context_color_ssh yellow
11tide_crystal_bg_color black
12tide_crystal_color brwhite
13tide_direnv_bg_color black
14tide_direnv_bg_color_denied black
15tide_direnv_color bryellow
16tide_direnv_color_denied brred
17tide_distrobox_bg_color black
18tide_distrobox_color brmagenta
19tide_docker_bg_color black
20tide_docker_color blue
21tide_elixir_bg_color black
22tide_elixir_color magenta
23tide_gcloud_bg_color black
24tide_gcloud_color blue
25tide_git_bg_color black
26tide_git_bg_color_unstable black
27tide_git_bg_color_urgent black
28tide_git_color_branch brgreen
29tide_git_color_conflicted brred
30tide_git_color_dirty bryellow
31tide_git_color_operation brred
32tide_git_color_staged bryellow
33tide_git_color_stash brgreen
34tide_git_color_untracked brblue
35tide_git_color_upstream brgreen
36tide_go_bg_color black
37tide_go_color brcyan
38tide_java_bg_color black
39tide_java_color yellow
40tide_jobs_bg_color black
41tide_jobs_color green
42tide_kubectl_bg_color black
43tide_kubectl_color blue
44tide_nix_shell_bg_color black
45tide_nix_shell_color brblue
46tide_node_bg_color black
47tide_node_color green
48tide_os_bg_color black
49tide_os_color brwhite
50tide_php_bg_color black
51tide_php_color blue
52tide_private_mode_bg_color black
53tide_private_mode_color brwhite
54tide_prompt_color_frame_and_connection brblack
55tide_prompt_color_separator_same_color brblack
56tide_pulumi_bg_color black
57tide_pulumi_color yellow
58tide_pwd_bg_color black
59tide_pwd_color_anchors brcyan
60tide_pwd_color_dirs cyan
61tide_pwd_color_truncated_dirs magenta
62tide_python_bg_color black
63tide_python_color cyan
64tide_ruby_bg_color black
65tide_ruby_color red
66tide_rustc_bg_color black
67tide_rustc_color red
68tide_shlvl_bg_color black
69tide_shlvl_color yellow
70tide_status_bg_color black
71tide_status_bg_color_failure black
72tide_status_color green
73tide_status_color_failure red
74tide_terraform_bg_color black
75tide_terraform_color magenta
76tide_time_bg_color black
77tide_time_color brblack
78tide_toolbox_bg_color black
79tide_toolbox_color magenta
80tide_vi_mode_bg_color_default black
81tide_vi_mode_bg_color_insert black
82tide_vi_mode_bg_color_replace black
83tide_vi_mode_bg_color_visual black
84tide_vi_mode_color_default white
85tide_vi_mode_color_insert cyan
86tide_vi_mode_color_replace green
87tide_vi_mode_color_visual yellow
88tide_zig_bg_color black
89tide_zig_color yellow
diff --git a/home-config/fish/functions/tide/configure/configs/lean.fish b/home-config/fish/functions/tide/configure/configs/lean.fish
new file mode 100644
index 0000000..a958a17
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/configs/lean.fish
@@ -0,0 +1,116 @@
1tide_aws_bg_color normal
2tide_aws_color FF9900
3tide_character_color $_tide_color_green
4tide_character_color_failure FF0000
5tide_cmd_duration_bg_color normal
6tide_cmd_duration_color 87875F
7tide_cmd_duration_decimals 0
8tide_cmd_duration_threshold 3000
9tide_context_always_display false
10tide_context_bg_color normal
11tide_context_color_default D7AF87
12tide_context_color_root $_tide_color_gold
13tide_context_color_ssh D7AF87
14tide_context_hostname_parts 1
15tide_crystal_bg_color normal
16tide_crystal_color FFFFFF
17tide_direnv_bg_color normal
18tide_direnv_bg_color_denied normal
19tide_direnv_color $_tide_color_gold
20tide_direnv_color_denied FF0000
21tide_distrobox_bg_color normal
22tide_distrobox_color FF00FF
23tide_docker_bg_color normal
24tide_docker_color 2496ED
25tide_docker_default_contexts default colima
26tide_elixir_bg_color normal
27tide_elixir_color 4E2A8E
28tide_gcloud_bg_color normal
29tide_gcloud_color 4285F4
30tide_git_bg_color normal
31tide_git_bg_color_unstable normal
32tide_git_bg_color_urgent normal
33tide_git_color_branch $_tide_color_green
34tide_git_color_conflicted FF0000
35tide_git_color_dirty $_tide_color_gold
36tide_git_color_operation FF0000
37tide_git_color_staged $_tide_color_gold
38tide_git_color_stash $_tide_color_green
39tide_git_color_untracked $_tide_color_light_blue
40tide_git_color_upstream $_tide_color_green
41tide_git_truncation_length 24
42tide_git_truncation_strategy
43tide_go_bg_color normal
44tide_go_color 00ACD7
45tide_java_bg_color normal
46tide_java_color ED8B00
47tide_jobs_bg_color normal
48tide_jobs_color $_tide_color_dark_green
49tide_jobs_number_threshold 1000
50tide_kubectl_bg_color normal
51tide_kubectl_color 326CE5
52tide_left_prompt_frame_enabled false
53tide_left_prompt_items pwd git newline character
54tide_left_prompt_prefix ''
55tide_left_prompt_separator_diff_color ' '
56tide_left_prompt_separator_same_color ' '
57tide_left_prompt_suffix ' '
58tide_nix_shell_bg_color normal
59tide_nix_shell_color 7EBAE4
60tide_node_bg_color normal
61tide_node_color 44883E
62tide_os_bg_color normal
63tide_os_color normal
64tide_php_bg_color normal
65tide_php_color 617CBE
66tide_private_mode_bg_color normal
67tide_private_mode_color FFFFFF
68tide_prompt_add_newline_before true
69tide_prompt_color_frame_and_connection 6C6C6C
70tide_prompt_color_separator_same_color 949494
71tide_prompt_min_cols 34
72tide_prompt_pad_items false
73tide_prompt_transient_enabled false
74tide_pulumi_bg_color normal
75tide_pulumi_color F7BF2A
76tide_pwd_bg_color normal
77tide_pwd_color_anchors $_tide_color_light_blue
78tide_pwd_color_dirs $_tide_color_dark_blue
79tide_pwd_color_truncated_dirs 8787AF
80tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform Cargo.toml composer.json CVS go.mod package.json build.zig
81tide_python_bg_color normal
82tide_python_color 00AFAF
83tide_right_prompt_frame_enabled false
84tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir zig
85tide_right_prompt_prefix ' '
86tide_right_prompt_separator_diff_color ' '
87tide_right_prompt_separator_same_color ' '
88tide_right_prompt_suffix ''
89tide_ruby_bg_color normal
90tide_ruby_color B31209
91tide_rustc_bg_color normal
92tide_rustc_color F74C00
93tide_shlvl_bg_color normal
94tide_shlvl_color d78700
95tide_shlvl_threshold 1
96tide_status_bg_color normal
97tide_status_bg_color_failure normal
98tide_status_color $_tide_color_dark_green
99tide_status_color_failure D70000
100tide_terraform_bg_color normal
101tide_terraform_color 844FBA
102tide_time_bg_color normal
103tide_time_color 5F8787
104tide_time_format %T
105tide_toolbox_bg_color normal
106tide_toolbox_color 613583
107tide_vi_mode_bg_color_default normal
108tide_vi_mode_bg_color_insert normal
109tide_vi_mode_bg_color_replace normal
110tide_vi_mode_bg_color_visual normal
111tide_vi_mode_color_default 949494
112tide_vi_mode_color_insert 87AFAF
113tide_vi_mode_color_replace 87AF87
114tide_vi_mode_color_visual FF8700
115tide_zig_bg_color normal
116tide_zig_color F7A41D
diff --git a/home-config/fish/functions/tide/configure/configs/lean_16color.fish b/home-config/fish/functions/tide/configure/configs/lean_16color.fish
new file mode 100644
index 0000000..16c2511
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/configs/lean_16color.fish
@@ -0,0 +1,89 @@
1tide_aws_bg_color normal
2tide_aws_color yellow
3tide_character_color brgreen
4tide_character_color_failure brred
5tide_cmd_duration_bg_color normal
6tide_cmd_duration_color brblack
7tide_context_bg_color normal
8tide_context_color_default yellow
9tide_context_color_root bryellow
10tide_context_color_ssh yellow
11tide_crystal_bg_color normal
12tide_crystal_color brwhite
13tide_direnv_bg_color normal
14tide_direnv_bg_color_denied normal
15tide_direnv_color bryellow
16tide_direnv_color_denied brred
17tide_distrobox_bg_color normal
18tide_distrobox_color brmagenta
19tide_docker_bg_color normal
20tide_docker_color blue
21tide_elixir_bg_color normal
22tide_elixir_color magenta
23tide_gcloud_bg_color normal
24tide_gcloud_color blue
25tide_git_bg_color normal
26tide_git_bg_color_unstable normal
27tide_git_bg_color_urgent normal
28tide_git_color_branch brgreen
29tide_git_color_conflicted brred
30tide_git_color_dirty bryellow
31tide_git_color_operation brred
32tide_git_color_staged bryellow
33tide_git_color_stash brgreen
34tide_git_color_untracked brblue
35tide_git_color_upstream brgreen
36tide_go_bg_color normal
37tide_go_color brcyan
38tide_java_bg_color normal
39tide_java_color yellow
40tide_jobs_bg_color normal
41tide_jobs_color green
42tide_kubectl_bg_color normal
43tide_kubectl_color blue
44tide_nix_shell_bg_color normal
45tide_nix_shell_color brblue
46tide_node_bg_color normal
47tide_node_color green
48tide_os_bg_color normal
49tide_os_color brwhite
50tide_php_bg_color normal
51tide_php_color blue
52tide_private_mode_bg_color normal
53tide_private_mode_color brwhite
54tide_prompt_color_frame_and_connection brblack
55tide_prompt_color_separator_same_color brblack
56tide_pulumi_bg_color normal
57tide_pulumi_color yellow
58tide_pwd_bg_color normal
59tide_pwd_color_anchors brcyan
60tide_pwd_color_dirs cyan
61tide_pwd_color_truncated_dirs magenta
62tide_python_bg_color normal
63tide_python_color cyan
64tide_ruby_bg_color normal
65tide_ruby_color red
66tide_rustc_bg_color normal
67tide_rustc_color red
68tide_shlvl_bg_color normal
69tide_shlvl_color yellow
70tide_status_bg_color normal
71tide_status_bg_color_failure normal
72tide_status_color green
73tide_status_color_failure red
74tide_terraform_bg_color normal
75tide_terraform_color magenta
76tide_time_bg_color normal
77tide_time_color brblack
78tide_toolbox_bg_color normal
79tide_toolbox_color magenta
80tide_vi_mode_bg_color_default normal
81tide_vi_mode_bg_color_insert normal
82tide_vi_mode_bg_color_replace normal
83tide_vi_mode_bg_color_visual normal
84tide_vi_mode_color_default white
85tide_vi_mode_color_insert cyan
86tide_vi_mode_color_replace green
87tide_vi_mode_color_visual yellow
88tide_zig_bg_color normal
89tide_zig_color yellow
diff --git a/home-config/fish/functions/tide/configure/configs/rainbow.fish b/home-config/fish/functions/tide/configure/configs/rainbow.fish
new file mode 100644
index 0000000..60c1592
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/configs/rainbow.fish
@@ -0,0 +1,116 @@
1tide_aws_bg_color FF9900
2tide_aws_color 232F3E
3tide_character_color $_tide_color_green
4tide_character_color_failure FF0000
5tide_cmd_duration_bg_color C4A000
6tide_cmd_duration_color 000000
7tide_cmd_duration_decimals 0
8tide_cmd_duration_threshold 3000
9tide_context_always_display false
10tide_context_bg_color 444444
11tide_context_color_default D7AF87
12tide_context_color_root $_tide_color_gold
13tide_context_color_ssh D7AF87
14tide_context_hostname_parts 1
15tide_crystal_bg_color FFFFFF
16tide_crystal_color 000000
17tide_direnv_bg_color $_tide_color_gold
18tide_direnv_bg_color_denied FF0000
19tide_direnv_color 000000
20tide_direnv_color_denied 000000
21tide_distrobox_bg_color FF00FF
22tide_distrobox_color 000000
23tide_docker_bg_color 2496ED
24tide_docker_color 000000
25tide_docker_default_contexts default colima
26tide_elixir_bg_color 4E2A8E
27tide_elixir_color 000000
28tide_gcloud_bg_color 4285F4
29tide_gcloud_color 000000
30tide_git_bg_color 4E9A06
31tide_git_bg_color_unstable C4A000
32tide_git_bg_color_urgent CC0000
33tide_git_color_branch 000000
34tide_git_color_conflicted 000000
35tide_git_color_dirty 000000
36tide_git_color_operation 000000
37tide_git_color_staged 000000
38tide_git_color_stash 000000
39tide_git_color_untracked 000000
40tide_git_color_upstream 000000
41tide_git_truncation_length 24
42tide_git_truncation_strategy
43tide_go_bg_color 00ACD7
44tide_go_color 000000
45tide_java_bg_color ED8B00
46tide_java_color 000000
47tide_jobs_bg_color 444444
48tide_jobs_color 4E9A06
49tide_jobs_number_threshold 1000
50tide_kubectl_bg_color 326CE5
51tide_kubectl_color 000000
52tide_left_prompt_frame_enabled true
53tide_left_prompt_items pwd git newline
54tide_left_prompt_prefix ''
55tide_left_prompt_separator_diff_color 
56tide_left_prompt_separator_same_color 
57tide_left_prompt_suffix 
58tide_nix_shell_bg_color 7EBAE4
59tide_nix_shell_color 000000
60tide_node_bg_color 44883E
61tide_node_color 000000
62tide_os_bg_color $os_branding_bg_color
63tide_os_color $os_branding_color
64tide_php_bg_color 617CBE
65tide_php_color 000000
66tide_private_mode_bg_color F1F3F4
67tide_private_mode_color 000000
68tide_prompt_add_newline_before true
69tide_prompt_color_frame_and_connection 6C6C6C
70tide_prompt_color_separator_same_color 949494
71tide_prompt_min_cols 34
72tide_prompt_pad_items true
73tide_prompt_transient_enabled false
74tide_pulumi_bg_color F7BF2A
75tide_pulumi_color 000000
76tide_pwd_bg_color 3465A4
77tide_pwd_color_anchors E4E4E4
78tide_pwd_color_dirs E4E4E4
79tide_pwd_color_truncated_dirs BCBCBC
80tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform Cargo.toml composer.json CVS go.mod package.json build.zig
81tide_python_bg_color 444444
82tide_python_color 00AFAF
83tide_right_prompt_frame_enabled true
84tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir zig
85tide_right_prompt_prefix 
86tide_right_prompt_separator_diff_color 
87tide_right_prompt_separator_same_color 
88tide_right_prompt_suffix ''
89tide_ruby_bg_color B31209
90tide_ruby_color 000000
91tide_rustc_bg_color F74C00
92tide_rustc_color 000000
93tide_shlvl_bg_color 808000
94tide_shlvl_color 000000
95tide_shlvl_threshold 1
96tide_status_bg_color 2E3436
97tide_status_bg_color_failure CC0000
98tide_status_color 4E9A06
99tide_status_color_failure FFFF00
100tide_terraform_bg_color 800080
101tide_terraform_color 000000
102tide_time_bg_color D3D7CF
103tide_time_color 000000
104tide_time_format %T
105tide_toolbox_bg_color 613583
106tide_toolbox_color 000000
107tide_vi_mode_bg_color_default 949494
108tide_vi_mode_bg_color_insert 87AFAF
109tide_vi_mode_bg_color_replace 87AF87
110tide_vi_mode_bg_color_visual FF8700
111tide_vi_mode_color_default 000000
112tide_vi_mode_color_insert 000000
113tide_vi_mode_color_replace 000000
114tide_vi_mode_color_visual 000000
115tide_zig_bg_color F7A41D
116tide_zig_color 000000
diff --git a/home-config/fish/functions/tide/configure/configs/rainbow_16color.fish b/home-config/fish/functions/tide/configure/configs/rainbow_16color.fish
new file mode 100644
index 0000000..a040f58
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/configs/rainbow_16color.fish
@@ -0,0 +1,93 @@
1tide_aws_bg_color yellow
2tide_aws_color brblack
3tide_character_color brgreen
4tide_character_color_failure brred
5tide_cmd_duration_bg_color yellow
6tide_cmd_duration_color black
7tide_context_bg_color brblack
8tide_context_color_default yellow
9tide_context_color_root yellow
10tide_context_color_ssh yellow
11tide_crystal_bg_color brwhite
12tide_crystal_color black
13tide_direnv_bg_color bryellow
14tide_direnv_bg_color_denied brred
15tide_direnv_color black
16tide_direnv_color_denied black
17tide_distrobox_bg_color brmagenta
18tide_distrobox_color black
19tide_docker_bg_color blue
20tide_docker_color black
21tide_elixir_bg_color magenta
22tide_elixir_color black
23tide_gcloud_bg_color blue
24tide_gcloud_color black
25tide_git_bg_color green
26tide_git_bg_color_unstable yellow
27tide_git_bg_color_urgent red
28tide_git_color_branch black
29tide_git_color_conflicted black
30tide_git_color_dirty black
31tide_git_color_operation black
32tide_git_color_staged black
33tide_git_color_stash black
34tide_git_color_untracked black
35tide_git_color_upstream black
36tide_go_bg_color brcyan
37tide_go_color black
38tide_java_bg_color yellow
39tide_java_color black
40tide_jobs_bg_color brblack
41tide_jobs_color green
42tide_kubectl_bg_color blue
43tide_kubectl_color black
44tide_nix_shell_bg_color brblue
45tide_nix_shell_color black
46tide_node_bg_color green
47tide_node_color black
48tide_os_bg_color white
49tide_os_color black
50tide_php_bg_color blue
51tide_php_color black
52tide_private_mode_bg_color brwhite
53tide_private_mode_color black
54tide_prompt_color_frame_and_connection brblack
55tide_prompt_color_separator_same_color brblack
56tide_pulumi_bg_color yellow
57tide_pulumi_color black
58tide_pwd_bg_color blue
59tide_pwd_color_anchors brwhite
60tide_pwd_color_dirs brwhite
61tide_pwd_color_truncated_dirs white
62tide_python_bg_color brblack
63tide_python_color cyan
64tide_ruby_bg_color red
65tide_ruby_color black
66tide_rustc_bg_color red
67tide_rustc_color black
68tide_shlvl_bg_color yellow
69tide_shlvl_color black
70tide_status_bg_color black
71tide_status_bg_color_failure red
72tide_status_color green
73tide_status_color_failure bryellow
74tide_terraform_bg_color magenta
75tide_terraform_color black
76tide_time_bg_color white
77tide_time_color black
78tide_toolbox_bg_color magenta
79tide_toolbox_color black
80tide_vi_mode_bg_color_default white
81tide_vi_mode_bg_color_insert cyan
82tide_vi_mode_bg_color_replace green
83tide_vi_mode_bg_color_visual yellow
84tide_vi_mode_color_default black
85tide_vi_mode_color_insert black
86tide_vi_mode_color_replace black
87tide_vi_mode_color_visual black
88tide_vi_mode_icon_default D
89tide_vi_mode_icon_insert I
90tide_vi_mode_icon_replace R
91tide_vi_mode_icon_visual V
92tide_zig_bg_color yellow
93tide_zig_color black
diff --git a/home-config/fish/functions/tide/configure/functions/_fake_tide_cache_variables.fish b/home-config/fish/functions/tide/configure/functions/_fake_tide_cache_variables.fish
new file mode 100644
index 0000000..4661ab1
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/functions/_fake_tide_cache_variables.fish
@@ -0,0 +1,41 @@
1function _fake_tide_cache_variables
2 # pwd
3 set_color -o $fake_tide_pwd_color_anchors | read -gx _fake_tide_color_anchors
4 set -gx _fake_tide_color_truncated_dirs "$(set_color $fake_tide_pwd_color_truncated_dirs)"
5 set -gx _fake_tide_reset_to_color_dirs (set_color normal -b $fake_tide_pwd_bg_color; set_color $fake_tide_pwd_color_dirs)
6
7 # git
8 contains git $fake_tide_left_prompt_items $fake_tide_right_prompt_items &&
9 set -gx _fake_tide_location_color "$(set_color $fake_tide_git_color_branch)"
10
11 # private_mode
12 if contains private_mode $fake_tide_left_prompt_items $fake_tide_right_prompt_items && test -n "$fish_private_mode"
13 set -gx _fake_tide_private_mode
14 else
15 set -e _fake_tide_private_mode
16 end
17
18 # Same-color-separator color
19 set -gx _fake_tide_color_separator_same_color "$(set_color $fake_tide_prompt_color_separator_same_color)"
20
21 # two line prompt
22 if contains newline $fake_tide_left_prompt_items
23 set_color $fake_tide_prompt_color_frame_and_connection -b normal | read -gx _fake_tide_prompt_and_frame_color
24 else
25 set -e _fake_tide_prompt_and_frame_color
26 end
27
28 # newline before
29 if test "$fake_tide_prompt_add_newline_before" = true
30 set -g _fake_tide_add_newline ''
31 else
32 set -e _fake_tide_add_newline
33 end
34
35 # item padding
36 if test "$fake_tide_prompt_pad_items" = true
37 set -gx _fake_tide_pad ' '
38 else
39 set -e _fake_tide_pad
40 end
41end
diff --git a/home-config/fish/functions/tide/configure/functions/_fake_tide_item_character.fish b/home-config/fish/functions/tide/configure/functions/_fake_tide_item_character.fish
new file mode 100644
index 0000000..94892ec
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/functions/_fake_tide_item_character.fish
@@ -0,0 +1,8 @@
1function _fake_tide_item_character
2 set_color $fake_tide_character_color
3 if contains newline $fake_tide_left_prompt_items || set -q _configure_transient
4 echo -ns $fake_tide_character_icon
5 else
6 echo -ns ' '$fake_tide_character_icon
7 end
8end
diff --git a/home-config/fish/functions/tide/configure/functions/_fake_tide_item_cmd_duration.fish b/home-config/fish/functions/tide/configure/functions/_fake_tide_item_cmd_duration.fish
new file mode 100644
index 0000000..5aa13b2
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/functions/_fake_tide_item_cmd_duration.fish
@@ -0,0 +1,3 @@
1function _fake_tide_item_cmd_duration
2 _fake_tide_print_item cmd_duration $fake_tide_cmd_duration_icon' ' 5s
3end
diff --git a/home-config/fish/functions/tide/configure/functions/_fake_tide_item_git.fish b/home-config/fish/functions/tide/configure/functions/_fake_tide_item_git.fish
new file mode 100644
index 0000000..fb5b957
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/functions/_fake_tide_item_git.fish
@@ -0,0 +1,3 @@
1function _fake_tide_item_git
2 _fake_tide_print_item git (set_color $fake_tide_git_color_branch) $fake_tide_git_icon' ' main
3end
diff --git a/home-config/fish/functions/tide/configure/functions/_fake_tide_item_newline.fish b/home-config/fish/functions/tide/configure/functions/_fake_tide_item_newline.fish
new file mode 100644
index 0000000..c614bab
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/functions/_fake_tide_item_newline.fish
@@ -0,0 +1,5 @@
1function _fake_tide_item_newline
2 set_color $prev_bg_color -b normal
3 var=fake_tide_"$_fake_tide_side"_prompt_suffix echo $$var
4 set -g add_prefix
5end
diff --git a/home-config/fish/functions/tide/configure/functions/_fake_tide_item_os.fish b/home-config/fish/functions/tide/configure/functions/_fake_tide_item_os.fish
new file mode 100644
index 0000000..5255721
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/functions/_fake_tide_item_os.fish
@@ -0,0 +1,3 @@
1function _fake_tide_item_os
2 _fake_tide_print_item os $fake_tide_os_icon
3end
diff --git a/home-config/fish/functions/tide/configure/functions/_fake_tide_item_time.fish b/home-config/fish/functions/tide/configure/functions/_fake_tide_item_time.fish
new file mode 100644
index 0000000..bbce0b5
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/functions/_fake_tide_item_time.fish
@@ -0,0 +1,3 @@
1function _fake_tide_item_time
2 _fake_tide_print_item time (date +$fake_tide_time_format)
3end
diff --git a/home-config/fish/functions/tide/configure/functions/_fake_tide_print_item.fish b/home-config/fish/functions/tide/configure/functions/_fake_tide_print_item.fish
new file mode 100644
index 0000000..30cd024
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/functions/_fake_tide_print_item.fish
@@ -0,0 +1,22 @@
1function _fake_tide_print_item -a item
2 var=fake_tide_"$item"_bg_color set -f item_bg_color $$var
3
4 if set -e add_prefix
5 set_color $item_bg_color -b normal
6 var=fake_tide_"$_fake_tide_side"_prompt_prefix echo -ns $$var
7 else if test "$item_bg_color" = "$prev_bg_color"
8 var=fake_tide_"$_fake_tide_side"_prompt_separator_same_color echo -ns $_fake_tide_color_separator_same_color$$var
9 else if test "$_fake_tide_side" = left
10 set_color $prev_bg_color -b $item_bg_color
11 echo -ns $fake_tide_left_prompt_separator_diff_color
12 else
13 set_color $item_bg_color -b $prev_bg_color
14 echo -ns $fake_tide_right_prompt_separator_diff_color
15 end
16
17 var=fake_tide_"$item"_color set_color $$var -b $item_bg_color
18
19 echo -ns $_fake_tide_pad $argv[2..] $_fake_tide_pad
20
21 set -g prev_bg_color $item_bg_color
22end
diff --git a/home-config/fish/functions/tide/configure/functions/_fake_tide_prompt.fish b/home-config/fish/functions/tide/configure/functions/_fake_tide_prompt.fish
new file mode 100644
index 0000000..11f20ca
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/functions/_fake_tide_prompt.fish
@@ -0,0 +1,42 @@
1function _fake_tide_prompt
2 set -g add_prefix
3 _fake_tide_side=left set -f left (for item in $fake_tide_left_prompt_items
4 _fake_tide_item_$item
5 end
6 if not set -e add_prefix
7 set_color $prev_bg_color -b normal
8 echo -ns $fake_tide_left_prompt_suffix
9 end)
10
11 set -g add_prefix
12 _fake_tide_side=right set -f right (for item in $fake_tide_right_prompt_items
13 _fake_tide_item_$item
14 end
15 if not set -e add_prefix
16 set_color $prev_bg_color -b normal
17 echo -ns $fake_tide_right_prompt_suffix
18 end)
19
20 if set -q _fake_tide_prompt_and_frame_color # If prompt is two lines
21 test "$fake_tide_left_prompt_frame_enabled" = true &&
22 set left[1] "$_fake_tide_prompt_and_frame_color╭─$left[1]" &&
23 set left[2] "$_fake_tide_prompt_and_frame_color╰─$left[2]"
24 test "$fake_tide_right_prompt_frame_enabled" = true &&
25 set right[1] "$right[1]$_fake_tide_prompt_and_frame_color─╮" &&
26 set right[2] "$right[2]$_fake_tide_prompt_and_frame_color─╯"
27
28 # 5 = @PWD@ length which will be replaced
29 math $fake_columns+5-(string length --visible "$left[1]$right[1]") | read -lx dist_btwn_sides
30 echo -ns "$right[2]"\n(string replace @PWD@ (_fake_tide_pwd) "$left[1]")$_fake_tide_prompt_and_frame_color
31
32 string repeat --no-newline --max (math max 0, $dist_btwn_sides-$_tide_pwd_len) $fake_tide_prompt_icon_connection
33 echo -ns "$right[1]"\n"$left[2] "
34 else
35 math $fake_columns+5-(string length --visible "$left[1]$right[1]") -$fake_tide_prompt_min_cols | read -lx dist_btwn_sides
36 string replace @PWD@ (_fake_tide_pwd) "$right[1]" "$left[1] "
37 end
38end
39
40function _fake_tide_item_pwd
41 _fake_tide_print_item pwd @PWD@
42end
diff --git a/home-config/fish/functions/tide/configure/functions/_fake_tide_pwd.fish b/home-config/fish/functions/tide/configure/functions/_fake_tide_pwd.fish
new file mode 100644
index 0000000..433eafa
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/functions/_fake_tide_pwd.fish
@@ -0,0 +1,11 @@
1function _fake_tide_pwd
2 set -l out (
3 set_color $fake_tide_pwd_color_dirs
4 echo -ns $fake_tide_pwd_icon' ' '~/'
5 set_color -o $fake_tide_pwd_color_anchors
6 echo -ns src
7 set_color normal -b $fake_tide_pwd_bg_color
8 )
9 set -g _tide_pwd_len (string length --visible $out)
10 echo -ns $out
11end
diff --git a/home-config/fish/functions/tide/configure/icons.fish b/home-config/fish/functions/tide/configure/icons.fish
new file mode 100644
index 0000000..70611cd
--- /dev/null
+++ b/home-config/fish/functions/tide/configure/icons.fish
@@ -0,0 +1,40 @@
1tide_aws_icon  # Actual aws glyph is harder to see
2tide_character_icon ❯
3tide_character_vi_icon_default ❮
4tide_character_vi_icon_replace ▶
5tide_character_vi_icon_visual V
6tide_cmd_duration_icon
7tide_crystal_icon 
8tide_direnv_icon ▼
9tide_distrobox_icon 󰆧
10tide_docker_icon 
11tide_elixir_icon 
12tide_gcloud_icon 󰊭 # Actual google cloud glyph is harder to see
13tide_git_icon
14tide_go_icon 
15tide_java_icon 
16tide_jobs_icon 
17tide_kubectl_icon 󱃾
18tide_nix_shell_icon 
19tide_node_icon  # Actual nodejs glyph is harder to see
20tide_os_icon $os_branding_icon
21tide_php_icon 
22tide_private_mode_icon 󰗹
23tide_prompt_icon_connection ' '
24tide_pulumi_icon 
25tide_pwd_icon
26tide_pwd_icon_home
27tide_pwd_icon_unwritable 
28tide_python_icon 󰌠
29tide_ruby_icon 
30tide_rustc_icon 
31tide_shlvl_icon 
32tide_status_icon ✔
33tide_status_icon_failure ✘
34tide_terraform_icon 󱁢
35tide_toolbox_icon 
36tide_vi_mode_icon_default D
37tide_vi_mode_icon_insert I
38tide_vi_mode_icon_replace R
39tide_vi_mode_icon_visual V
40tide_zig_icon 