@heyitsiveen/dotfiles 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +10 -7
- package/dotfiles/macos/.config/fish/completions/fisher.fish +7 -0
- package/dotfiles/macos/.config/fish/completions/tide.fish +13 -0
- package/dotfiles/macos/.config/fish/conf.d/_tide_init.fish +44 -0
- package/dotfiles/macos/.config/fish/fish_plugins +2 -0
- package/dotfiles/macos/.config/fish/functions/_tide_1_line_prompt.fish +19 -0
- package/dotfiles/macos/.config/fish/functions/_tide_2_line_prompt.fish +31 -0
- package/dotfiles/macos/.config/fish/functions/_tide_cache_variables.fish +17 -0
- package/dotfiles/macos/.config/fish/functions/_tide_detect_os.fish +76 -0
- package/dotfiles/macos/.config/fish/functions/_tide_find_and_remove.fish +3 -0
- package/dotfiles/macos/.config/fish/functions/_tide_fish_colorize.fish +7 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_aws.fish +11 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_bun.fish +6 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_character.fish +17 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_cmd_duration.fish +12 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_context.fish +14 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_crystal.fish +6 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_direnv.fish +7 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_distrobox.fish +4 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_docker.fish +5 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_elixir.fish +4 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_gcloud.fish +8 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_git.fish +72 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_go.fish +6 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_java.fish +6 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_jobs.fish +7 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_kubectl.fish +4 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_nix_shell.fish +3 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_node.fish +6 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_os.fish +3 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_php.fish +6 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_private_mode.fish +3 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_pulumi.fish +19 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_python.fish +27 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_ruby.fish +6 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_rustc.fish +6 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_shlvl.fish +4 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_status.fish +15 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_terraform.fish +5 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_time.fish +3 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_toolbox.fish +4 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_vi_mode.fish +16 -0
- package/dotfiles/macos/.config/fish/functions/_tide_item_zig.fish +6 -0
- package/dotfiles/macos/.config/fish/functions/_tide_parent_dirs.fish +10 -0
- package/dotfiles/macos/.config/fish/functions/_tide_print_item.fish +22 -0
- package/dotfiles/macos/.config/fish/functions/_tide_pwd.fish +42 -0
- package/dotfiles/macos/.config/fish/functions/_tide_remove_unusable_items.fish +25 -0
- package/dotfiles/macos/.config/fish/functions/_tide_sub_bug-report.fish +73 -0
- package/dotfiles/macos/.config/fish/functions/_tide_sub_configure.fish +156 -0
- package/dotfiles/macos/.config/fish/functions/_tide_sub_reload.fish +3 -0
- package/dotfiles/macos/.config/fish/functions/fish_greeting.fish +1 -4
- package/dotfiles/macos/.config/fish/functions/fish_mode_prompt.fish +1 -0
- package/dotfiles/macos/.config/fish/functions/fish_prompt.fish +170 -0
- package/dotfiles/macos/.config/fish/functions/fisher.fish +251 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/choices/all/finish.fish +46 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/choices/all/icons.fish +33 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/choices/all/prompt_colors.fish +26 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/choices/all/prompt_connection.fish +31 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/choices/all/prompt_connection_andor_frame_color.fish +40 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/choices/all/prompt_spacing.fish +22 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/choices/all/show_time.fish +33 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/choices/all/style.fish +36 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/choices/all/transient.fish +22 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/choices/classic/classic_prompt_color.fish +38 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/choices/classic/classic_prompt_separators.fish +40 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/choices/lean/lean_prompt_height.fish +26 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/choices/powerline/powerline_prompt_heads.fish +32 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/choices/powerline/powerline_prompt_style.fish +51 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/choices/powerline/powerline_prompt_tails.fish +40 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/choices/powerline/powerline_right_prompt_frame.fish +20 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/choices/rainbow/rainbow_prompt_separators.fish +40 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/configs/classic.fish +118 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/configs/classic_16color.fish +91 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/configs/lean.fish +118 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/configs/lean_16color.fish +91 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/configs/rainbow.fish +118 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/configs/rainbow_16color.fish +95 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/functions/_fake_tide_cache_variables.fish +41 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/functions/_fake_tide_item_character.fish +8 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/functions/_fake_tide_item_cmd_duration.fish +3 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/functions/_fake_tide_item_git.fish +3 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/functions/_fake_tide_item_newline.fish +5 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/functions/_fake_tide_item_os.fish +3 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/functions/_fake_tide_item_time.fish +3 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/functions/_fake_tide_print_item.fish +22 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/functions/_fake_tide_prompt.fish +42 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/functions/_fake_tide_pwd.fish +11 -0
- package/dotfiles/macos/.config/fish/functions/tide/configure/icons.fish +41 -0
- package/dotfiles/macos/.config/fish/functions/tide.fish +28 -0
- package/dotfiles/windows/powershell/Profile.ps1 +0 -4
- package/dotfiles/windows/powershell/functions/Switch-PromptPalette.ps1 +1 -1
- package/dotfiles/windows/powershell/modules/prompt.ps1 +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function _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
|
|
16
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function _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
|
|
22
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
set_color -o $tide_pwd_color_anchors | read -l color_anchors
|
|
2
|
+
set_color $tide_pwd_color_truncated_dirs | read -l color_truncated
|
|
3
|
+
set -l reset_to_color_dirs (set_color normal -b $tide_pwd_bg_color; set_color $tide_pwd_color_dirs)
|
|
4
|
+
|
|
5
|
+
set -l unwritable_icon $tide_pwd_icon_unwritable' '
|
|
6
|
+
set -l home_icon $tide_pwd_icon_home' '
|
|
7
|
+
set -l pwd_icon $tide_pwd_icon' '
|
|
8
|
+
|
|
9
|
+
eval "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..]
|
|
42
|
+
end"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function _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 bun 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)
|
|
25
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
function _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
|
+
$fish_path --version | string match -qr "fish, version (?<fish_version>.*)"
|
|
15
|
+
_tide_check_version Fish fish-shell/fish-shell "(?<v>[\d.]+)" $fish_version || return
|
|
16
|
+
|
|
17
|
+
tide --version | string match -qr "tide, version (?<tide_version>.*)"
|
|
18
|
+
_tide_check_version Tide IlanCosman/tide "v(?<v>[\d.]+)" $tide_version || return
|
|
19
|
+
|
|
20
|
+
if command --query git
|
|
21
|
+
test (path sort (git --version) "git version 2.22.0")[1] = "git version 2.22.0"
|
|
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
|
+
$fish_path -ic "time $fish_path -c exit" 2>|
|
|
36
|
+
string match -rg "Executed in(.*)fish" |
|
|
37
|
+
string trim | read -l fish_startup_time
|
|
38
|
+
|
|
39
|
+
read -l --prompt-str "What operating system are you using? (e.g Ubuntu 20.04): " os
|
|
40
|
+
read -l --prompt-str "What terminal emulator are you using? (e.g Kitty): " terminal_emulator
|
|
41
|
+
|
|
42
|
+
printf '%b\n' "\nPlease copy the following information into the issue:\n" \
|
|
43
|
+
"fish version: $fish_version" \
|
|
44
|
+
"tide version: $tide_version" \
|
|
45
|
+
"term: $TERM" \
|
|
46
|
+
"os: $os" \
|
|
47
|
+
"terminal emulator: $terminal_emulator" \
|
|
48
|
+
"fish startup: $fish_startup_time" \
|
|
49
|
+
"fisher plugins: $_fisher_plugins"
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
function _tide_check_version -a program_name repo_name regex_to_get_v installed_version
|
|
55
|
+
curl -sL https://github.com/$repo_name/releases/latest |
|
|
56
|
+
string match -qr "https://github.com/$repo_name/releases/tag/$regex_to_get_v"
|
|
57
|
+
|
|
58
|
+
string match -qr "^$v" "$installed_version" # Allow git versions, e.g 3.3.1-701-gceade1629
|
|
59
|
+
_tide_check_condition \
|
|
60
|
+
"Your $program_name version is out of date." \
|
|
61
|
+
"The latest is $v. You have $installed_version." \
|
|
62
|
+
"Please update before submitting a bug report."
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
function _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
|
|
73
|
+
end
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
set -g _tide_color_dark_blue 0087AF
|
|
2
|
+
set -g _tide_color_dark_green 5FAF00
|
|
3
|
+
set -g _tide_color_gold D7AF00
|
|
4
|
+
set -g _tide_color_green 5FD700
|
|
5
|
+
set -g _tide_color_light_blue 00AFFF
|
|
6
|
+
|
|
7
|
+
# Create an empty fake function for each item
|
|
8
|
+
for func in _fake(functions --all | string match --entire _tide_item)
|
|
9
|
+
function $func
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
for file in (status dirname)/tide/configure/{choices, functions}/**.fish
|
|
14
|
+
source $file
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
function _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
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
function _next_choice -a nextChoice
|
|
43
|
+
set -q _tide_selected_option || return 0
|
|
44
|
+
set -l cmd (string split '/' $nextChoice)[2]
|
|
45
|
+
$cmd
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
function _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
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
function _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
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
function _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
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
function _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
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
function _tide_exit_configure
|
|
155
|
+
set -e _tide_selected_option # Skip through all switch and _next_choice
|
|
156
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Disable default vi prompt
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
function fish_prompt
|
|
2
|
+
end # In case this file gets loaded non-interactively, e.g by conda
|
|
3
|
+
status is-interactive || exit
|
|
4
|
+
|
|
5
|
+
_tide_remove_unusable_items
|
|
6
|
+
_tide_cache_variables
|
|
7
|
+
_tide_parent_dirs
|
|
8
|
+
source (functions --details _tide_pwd)
|
|
9
|
+
|
|
10
|
+
set -l prompt_var _tide_prompt_$fish_pid
|
|
11
|
+
set -U $prompt_var # Set var here so if we erase $prompt_var, bg job won't set a uvar
|
|
12
|
+
|
|
13
|
+
set_color normal | read -l color_normal
|
|
14
|
+
status fish-path | read -l fish_path
|
|
15
|
+
|
|
16
|
+
# _tide_repaint prevents us from creating a second background job
|
|
17
|
+
function _tide_refresh_prompt --on-variable $prompt_var --on-variable COLUMNS
|
|
18
|
+
set -g _tide_repaint
|
|
19
|
+
commandline -f repaint
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
if 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 3
|
|
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 "
|
|
39
|
+
function 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
|
|
43
|
+
set _tide_parent_dirs \$_tide_parent_dirs
|
|
44
|
+
PATH=\$(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 \"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
function fish_right_prompt
|
|
63
|
+
set -e _tide_transient || string unescape \"\$$prompt_var[1][4]$bot_right_frame$color_normal\"
|
|
64
|
+
end"
|
|
65
|
+
else
|
|
66
|
+
eval "
|
|
67
|
+
function 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
|
|
71
|
+
set _tide_parent_dirs \$_tide_parent_dirs
|
|
72
|
+
PATH=\$(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 \"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
function fish_right_prompt
|
|
87
|
+
string unescape \"\$$prompt_var[1][4]$bot_right_frame$color_normal\"
|
|
88
|
+
end"
|
|
89
|
+
end
|
|
90
|
+
else # 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 "
|
|
98
|
+
function 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
|
|
103
|
+
set _tide_parent_dirs \$_tide_parent_dirs
|
|
104
|
+
PATH=\$(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
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
function fish_right_prompt
|
|
122
|
+
set -e _tide_transient || string unescape \"\$$prompt_var[1][2]$color_normal\"
|
|
123
|
+
end"
|
|
124
|
+
else
|
|
125
|
+
eval "
|
|
126
|
+
function 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
|
|
130
|
+
set _tide_parent_dirs \$_tide_parent_dirs
|
|
131
|
+
PATH=\$(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 '
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
function fish_right_prompt
|
|
143
|
+
string unescape \"\$$prompt_var[1][2]$color_normal\"
|
|
144
|
+
end"
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Inheriting instead of evaling because here load time is more important than runtime
|
|
149
|
+
function _tide_on_fish_exit --on-event fish_exit --inherit-variable prompt_var
|
|
150
|
+
set -e $prompt_var
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if test "$tide_prompt_transient_enabled" = true
|
|
154
|
+
function _tide_enter_transient
|
|
155
|
+
# If the commandline will be executed or is empty, and the pager is not open
|
|
156
|
+
# Pager open usually means selecting, not running
|
|
157
|
+
# Can be untrue, but it's better than the alternative
|
|
158
|
+
if commandline --is-valid || test -z "$(commandline)" && not commandline --paging-mode
|
|
159
|
+
set -g _tide_transient
|
|
160
|
+
set -g _tide_repaint
|
|
161
|
+
commandline -f repaint
|
|
162
|
+
end
|
|
163
|
+
commandline -f execute
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
bind \r _tide_enter_transient
|
|
167
|
+
bind \n _tide_enter_transient
|
|
168
|
+
bind -M insert \r _tide_enter_transient
|
|
169
|
+
bind -M insert \n _tide_enter_transient
|
|
170
|
+
end
|