remove unnecessary files
This commit is contained in:
parent
96f433bd8a
commit
ec87e04763
64 changed files with 0 additions and 1511 deletions
|
@ -1,7 +0,0 @@
|
||||||
complete --command fisher --exclusive --long help --description "Print help"
|
|
||||||
complete --command fisher --exclusive --long version --description "Print version"
|
|
||||||
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments install --description "Install plugins"
|
|
||||||
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments update --description "Update installed plugins"
|
|
||||||
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments remove --description "Remove installed plugins"
|
|
||||||
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments list --description "List installed plugins matching regex"
|
|
||||||
complete --command fisher --exclusive --condition "__fish_seen_subcommand_from update remove" --arguments "(fisher list)"
|
|
|
@ -1,8 +0,0 @@
|
||||||
complete fzf_configure_bindings --no-files
|
|
||||||
complete fzf_configure_bindings --long help --short h --description "Print help"
|
|
||||||
complete fzf_configure_bindings --long directory --description "Change the key binding for searching directory"
|
|
||||||
complete fzf_configure_bindings --long git_log --description "Change the key binding for searching git log"
|
|
||||||
complete fzf_configure_bindings --long git_status --description "Change the key binding for searching git status"
|
|
||||||
complete fzf_configure_bindings --long history --description "Change the key binding for searching history"
|
|
||||||
complete fzf_configure_bindings --long processes --description "Change the key binding for searching processes"
|
|
||||||
complete fzf_configure_bindings --long variables --description "Change the key binding for searching variables"
|
|
|
@ -1,25 +0,0 @@
|
||||||
# Deactivate the default virtualenv prompt so that we can add our own
|
|
||||||
set --global --export VIRTUAL_ENV_DISABLE_PROMPT 1
|
|
||||||
|
|
||||||
# Whether or not is a fresh session
|
|
||||||
set --global _pure_fresh_session true
|
|
||||||
|
|
||||||
# Register `_pure_prompt_new_line` as an event handler fot `fish_prompt`
|
|
||||||
functions --query _pure_prompt_new_line
|
|
||||||
|
|
||||||
function _pure_uninstall --on-event pure_uninstall
|
|
||||||
# erase _pure* variables
|
|
||||||
set --names \
|
|
||||||
| string replace --filter --regex '(^_?pure)' 'set --erase $1' \
|
|
||||||
| source
|
|
||||||
# erase _pure* functions
|
|
||||||
functions --names --all \
|
|
||||||
| string replace --filter --regex '(^_?pure)' 'functions --erase $1' \
|
|
||||||
| source
|
|
||||||
# delete _pure* files
|
|
||||||
for file in $__fish_config_dir/{functions,conf.d}/_pure_*
|
|
||||||
rm $file
|
|
||||||
end
|
|
||||||
# restore fish_prompt to default
|
|
||||||
cp {$__fish_data_dir,$__fish_config_dir}/functions/fish_prompt.fish
|
|
||||||
end
|
|
|
@ -1,28 +0,0 @@
|
||||||
# fzf.fish is only meant to be used in interactive mode. If not in interactive mode and not in CI, skip the config to speed up shell startup
|
|
||||||
if not status is-interactive && test "$CI" != true
|
|
||||||
exit
|
|
||||||
end
|
|
||||||
|
|
||||||
# Because of scoping rules, to capture the shell variables exactly as they are, we must read
|
|
||||||
# them before even executing _fzf_search_variables. We use psub to store the
|
|
||||||
# variables' info in temporary files and pass in the filenames as arguments.
|
|
||||||
# This variable is global so that it can be referenced by fzf_configure_bindings and in tests
|
|
||||||
set --global _fzf_search_vars_command '_fzf_search_variables (set --show | psub) (set --names | psub)'
|
|
||||||
|
|
||||||
|
|
||||||
# Install the default bindings, which are mnemonic and minimally conflict with fish's preset bindings
|
|
||||||
fzf_configure_bindings
|
|
||||||
|
|
||||||
# Doesn't erase autoloaded _fzf_* functions because they are not easily accessible once key bindings are erased
|
|
||||||
function _fzf_uninstall --on-event fzf_uninstall
|
|
||||||
_fzf_uninstall_bindings
|
|
||||||
|
|
||||||
set --erase _fzf_search_vars_command
|
|
||||||
functions --erase _fzf_uninstall _fzf_migration_message _fzf_uninstall_bindings fzf_configure_bindings
|
|
||||||
complete --erase fzf_configure_bindings
|
|
||||||
|
|
||||||
set_color cyan
|
|
||||||
echo "fzf.fish uninstalled."
|
|
||||||
echo "You may need to manually remove fzf_configure_bindings from your config.fish if you were using custom key bindings."
|
|
||||||
set_color normal
|
|
||||||
end
|
|
|
@ -1,91 +0,0 @@
|
||||||
set --global pure_version 4.4.3 # For bug report and tag-after-merge workflow
|
|
||||||
|
|
||||||
# Base colors
|
|
||||||
_pure_set_default pure_color_primary blue
|
|
||||||
_pure_set_default pure_color_info cyan
|
|
||||||
_pure_set_default pure_color_mute brblack
|
|
||||||
_pure_set_default pure_color_success magenta
|
|
||||||
_pure_set_default pure_color_normal normal
|
|
||||||
_pure_set_default pure_color_danger red
|
|
||||||
_pure_set_default pure_color_light white
|
|
||||||
_pure_set_default pure_color_warning yellow
|
|
||||||
_pure_set_default pure_color_dark black
|
|
||||||
|
|
||||||
# Prompt
|
|
||||||
_pure_set_default pure_symbol_prompt "❯"
|
|
||||||
_pure_set_default pure_symbol_reverse_prompt "❮" # used for VI mode
|
|
||||||
_pure_set_default pure_color_prompt_on_error pure_color_danger
|
|
||||||
_pure_set_default pure_color_prompt_on_success pure_color_success
|
|
||||||
|
|
||||||
# Current Working Directory
|
|
||||||
_pure_set_default pure_color_current_directory pure_color_primary
|
|
||||||
|
|
||||||
# Git
|
|
||||||
_pure_set_default pure_enable_git true
|
|
||||||
_pure_set_default pure_symbol_git_unpulled_commits "⇣"
|
|
||||||
_pure_set_default pure_symbol_git_unpushed_commits "⇡"
|
|
||||||
_pure_set_default pure_symbol_git_dirty "*"
|
|
||||||
_pure_set_default pure_symbol_git_stash "≡"
|
|
||||||
_pure_set_default pure_color_git_unpulled_commits pure_color_info
|
|
||||||
_pure_set_default pure_color_git_unpushed_commits pure_color_info
|
|
||||||
_pure_set_default pure_color_git_branch pure_color_mute
|
|
||||||
_pure_set_default pure_color_git_dirty pure_color_mute
|
|
||||||
_pure_set_default pure_color_git_stash pure_color_info
|
|
||||||
|
|
||||||
# Remote info (user@hostname) for SSH and containers (Docker/LXC)
|
|
||||||
_pure_set_default pure_color_hostname pure_color_mute
|
|
||||||
_pure_set_default pure_color_at_sign pure_color_mute
|
|
||||||
_pure_set_default pure_color_username_normal pure_color_mute
|
|
||||||
_pure_set_default pure_color_username_root pure_color_light
|
|
||||||
|
|
||||||
# Number of running jobs
|
|
||||||
_pure_set_default pure_show_jobs false
|
|
||||||
_pure_set_default pure_color_jobs pure_color_normal
|
|
||||||
|
|
||||||
# Show system time
|
|
||||||
_pure_set_default pure_show_system_time false
|
|
||||||
_pure_set_default pure_color_system_time pure_color_mute
|
|
||||||
|
|
||||||
# Virtualenv for Python
|
|
||||||
_pure_set_default pure_color_virtualenv pure_color_mute
|
|
||||||
|
|
||||||
# Print current working directory at the beginning of prompt
|
|
||||||
# true (default): current directory, git, user@hostname (ssh-only), command duration
|
|
||||||
# false: user@hostname (ssh-only), current directory, git, command duration
|
|
||||||
_pure_set_default pure_begin_prompt_with_current_directory true
|
|
||||||
|
|
||||||
# Show exit code of last command as a separate prompt character (cf. https://github.com/sindresorhus/pure/wiki#show-exit-code-of-last-command-as-a-separate-prompt-character)
|
|
||||||
# false - single prompt character, default
|
|
||||||
# true - separate prompt character
|
|
||||||
_pure_set_default pure_separate_prompt_on_error false
|
|
||||||
|
|
||||||
# Max execution time of a process before its run time is shown when it exits
|
|
||||||
_pure_set_default pure_threshold_command_duration 5
|
|
||||||
_pure_set_default pure_show_subsecond_command_duration false
|
|
||||||
_pure_set_default pure_color_command_duration pure_color_warning
|
|
||||||
|
|
||||||
# VI mode indicator
|
|
||||||
# true (default): indicate a non-insert mode by reversing the prompt symbol (❮)
|
|
||||||
# false: indicate vi mode with [I], [N], [V]
|
|
||||||
_pure_set_default pure_reverse_prompt_symbol_in_vimode true
|
|
||||||
|
|
||||||
# Title
|
|
||||||
_pure_set_default pure_symbol_title_bar_separator -
|
|
||||||
|
|
||||||
# Check for new release on startup
|
|
||||||
_pure_set_default pure_check_for_new_release false
|
|
||||||
|
|
||||||
# Prefix prompt when logged in as root
|
|
||||||
_pure_set_default pure_show_prefix_root_prompt false
|
|
||||||
_pure_set_default pure_symbol_prefix_root_prompt "#"
|
|
||||||
_pure_set_default pure_color_prefix_root_prompt pure_color_danger
|
|
||||||
|
|
||||||
# Compact mode
|
|
||||||
_pure_set_default pure_enable_single_line_prompt false
|
|
||||||
|
|
||||||
# Detect when running in container (e.g. docker, podman, LXC/LXD)
|
|
||||||
_pure_set_default pure_enable_container_detection true
|
|
||||||
_pure_set_default pure_symbol_container_prefix "" # suggestion: '🐋' or '📦'
|
|
||||||
|
|
||||||
# Detect when running in SSH
|
|
||||||
_pure_set_default pure_symbol_ssh_prefix "" # suggestion: 'ssh:/' or '🔗🔐🔒🌐'
|
|
|
@ -1,43 +0,0 @@
|
||||||
function _fzf_configure_bindings_help --description "Prints the help message for fzf_configure_bindings."
|
|
||||||
echo "\
|
|
||||||
USAGE:
|
|
||||||
fzf_configure_bindings [--COMMAND=[KEY_SEQUENCE]...]
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
fzf_configure_bindings installs key bindings for fzf.fish's commands and erases any bindings it
|
|
||||||
previously installed. It installs bindings for both default and insert modes. fzf.fish executes
|
|
||||||
it without options on fish startup to install the out-of-the-box key bindings.
|
|
||||||
|
|
||||||
By default, commands are bound to a mnemonic key sequence, shown below. Each command's binding
|
|
||||||
can be configured using a namesake corresponding option:
|
|
||||||
COMMAND | DEFAULT KEY SEQUENCE | CORRESPONDING OPTION
|
|
||||||
Search Directory | Ctrl+Alt+F (F for file) | --directory
|
|
||||||
Search Git Log | Ctrl+Alt+L (L for log) | --git_log
|
|
||||||
Search Git Status | Ctrl+Alt+S (S for status) | --git_status
|
|
||||||
Search History | Ctrl+R (R for reverse) | --history
|
|
||||||
Search Processes | Ctrl+Alt+P (P for process) | --processes
|
|
||||||
Search Variables | Ctrl+V (V for variable) | --variables
|
|
||||||
Override a command's binding by specifying its corresponding option with the desired key
|
|
||||||
sequence. Disable a command's binding by specifying its corresponding option with no value.
|
|
||||||
|
|
||||||
Because fzf_configure_bindings erases bindings it previously installed, it can be cleanly
|
|
||||||
executed multiple times. Once the desired fzf_configure_bindings command has been found, add it
|
|
||||||
to your config.fish in order to persist the customized bindings.
|
|
||||||
|
|
||||||
In terms of validation, fzf_configure_bindings fails if passed unknown options. It expects an
|
|
||||||
equals sign between an option's name and value. However, it does not validate key sequences.
|
|
||||||
|
|
||||||
Pass -h or --help to print this help message and exit.
|
|
||||||
|
|
||||||
EXAMPLES
|
|
||||||
Default bindings but bind Search Directory to Ctrl+F and Search Variables to Ctrl+Alt+V
|
|
||||||
\$ fzf_configure_bindings --directory=\cf --variables=\e\cv
|
|
||||||
Default bindings but disable Search History
|
|
||||||
\$ fzf_configure_bindings --history=
|
|
||||||
An agglomeration of different options
|
|
||||||
\$ fzf_configure_bindings --git_status=\cg --history=\ch --variables= --processes=
|
|
||||||
|
|
||||||
SEE Also
|
|
||||||
To learn more about fish key bindings, see bind(1) and fish_key_reader(1).
|
|
||||||
"
|
|
||||||
end
|
|
|
@ -1,15 +0,0 @@
|
||||||
# helper function for _fzf_search_variables
|
|
||||||
function _fzf_extract_var_info --argument-names variable_name set_show_output --description "Extract and reformat lines pertaining to \$variable_name from \$set_show_output."
|
|
||||||
# Extract only the lines about the variable, all of which begin with either
|
|
||||||
# $variable_name: ...or... $variable_name[
|
|
||||||
string match --regex "^\\\$$variable_name(?::|\[).*" <$set_show_output |
|
|
||||||
|
|
||||||
# Strip the variable name prefix, including ": " for scope info lines
|
|
||||||
string replace --regex "^\\\$$variable_name(?:: )?" '' |
|
|
||||||
|
|
||||||
# Distill the lines of values, replacing...
|
|
||||||
# [1]: |value|
|
|
||||||
# ...with...
|
|
||||||
# [1] value
|
|
||||||
string replace --regex ": \|(.*)\|" ' $1'
|
|
||||||
end
|
|
|
@ -1,49 +0,0 @@
|
||||||
# helper for _fzf_search_git_status
|
|
||||||
# arg should be a line from git status --short, e.g.
|
|
||||||
# MM functions/_fzf_preview_changed_file.fish
|
|
||||||
# D README.md
|
|
||||||
# R LICENSE -> "New License"
|
|
||||||
function _fzf_preview_changed_file --argument-names path_status --description "Show the git diff of the given file."
|
|
||||||
# remove quotes because they'll be interpreted literally by git diff
|
|
||||||
# no need to requote when referencing $path because fish does not perform word splitting
|
|
||||||
# https://fishshell.com/docs/current/fish_for_bash_users.html
|
|
||||||
set -f path (string unescape (string sub --start 4 $path_status))
|
|
||||||
# first letter of short format shows index, second letter shows working tree
|
|
||||||
# https://git-scm.com/docs/git-status/2.35.0#_short_format
|
|
||||||
set -f index_status (string sub --length 1 $path_status)
|
|
||||||
set -f working_tree_status (string sub --start 2 --length 1 $path_status)
|
|
||||||
|
|
||||||
set -f diff_opts --color=always
|
|
||||||
|
|
||||||
if test $index_status = '?'
|
|
||||||
_fzf_report_diff_type Untracked
|
|
||||||
_fzf_preview_file $path
|
|
||||||
else if contains {$index_status}$working_tree_status DD AU UD UA DU AA UU
|
|
||||||
# Unmerged statuses taken directly from git status help's short format table
|
|
||||||
# Unmerged statuses are mutually exclusive with other statuses, so if we see
|
|
||||||
# these, then safe to assume the path is unmerged
|
|
||||||
_fzf_report_diff_type Unmerged
|
|
||||||
git diff $diff_opts -- $path
|
|
||||||
else
|
|
||||||
if test $index_status != ' '
|
|
||||||
_fzf_report_diff_type Staged
|
|
||||||
|
|
||||||
# renames are only detected in the index, never working tree, so only need to test for it here
|
|
||||||
# https://stackoverflow.com/questions/73954214
|
|
||||||
if test $index_status = R
|
|
||||||
# diff the post-rename path with the original path, otherwise the diff will show the entire file as being added
|
|
||||||
set -f orig_and_new_path (string split --max 1 -- ' -> ' $path)
|
|
||||||
git diff --staged $diff_opts -- $orig_and_new_path[1] $orig_and_new_path[2]
|
|
||||||
# path currently has the form of "original -> current", so we need to correct it before it's used below
|
|
||||||
set path $orig_and_new_path[2]
|
|
||||||
else
|
|
||||||
git diff --staged $diff_opts -- $path
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if test $working_tree_status != ' '
|
|
||||||
_fzf_report_diff_type Unstaged
|
|
||||||
git diff $diff_opts -- $path
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,43 +0,0 @@
|
||||||
# helper function for _fzf_search_directory and _fzf_search_git_status
|
|
||||||
function _fzf_preview_file --description "Print a preview for the given file based on its file type."
|
|
||||||
# because there's no way to guarantee that _fzf_search_directory passes the path to _fzf_preview_file
|
|
||||||
# as one argument, we collect all the arguments into one single variable and treat that as the path
|
|
||||||
set -f file_path $argv
|
|
||||||
|
|
||||||
if test -L "$file_path" # symlink
|
|
||||||
# notify user and recurse on the target of the symlink, which can be any of these file types
|
|
||||||
set -l target_path (realpath "$file_path")
|
|
||||||
|
|
||||||
set_color yellow
|
|
||||||
echo "'$file_path' is a symlink to '$target_path'."
|
|
||||||
set_color normal
|
|
||||||
|
|
||||||
_fzf_preview_file "$target_path"
|
|
||||||
else if test -f "$file_path" # regular file
|
|
||||||
if set --query fzf_preview_file_cmd
|
|
||||||
# need to escape quotes to make sure eval receives file_path as a single arg
|
|
||||||
eval "$fzf_preview_file_cmd '$file_path'"
|
|
||||||
else
|
|
||||||
bat --style=numbers --color=always "$file_path"
|
|
||||||
end
|
|
||||||
else if test -d "$file_path" # directory
|
|
||||||
if set --query fzf_preview_dir_cmd
|
|
||||||
# see above
|
|
||||||
eval "$fzf_preview_dir_cmd '$file_path'"
|
|
||||||
else
|
|
||||||
# -A list hidden files as well, except for . and ..
|
|
||||||
# -F helps classify files by appending symbols after the file name
|
|
||||||
command ls -A -F "$file_path"
|
|
||||||
end
|
|
||||||
else if test -c "$file_path"
|
|
||||||
_fzf_report_file_type "$file_path" "character device file"
|
|
||||||
else if test -b "$file_path"
|
|
||||||
_fzf_report_file_type "$file_path" "block device file"
|
|
||||||
else if test -S "$file_path"
|
|
||||||
_fzf_report_file_type "$file_path" socket
|
|
||||||
else if test -p "$file_path"
|
|
||||||
_fzf_report_file_type "$file_path" "named pipe"
|
|
||||||
else
|
|
||||||
echo "$file_path doesn't exist." >&2
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,18 +0,0 @@
|
||||||
# helper for _fzf_preview_changed_file
|
|
||||||
# prints out something like
|
|
||||||
# ╭────────╮
|
|
||||||
# │ Staged │
|
|
||||||
# ╰────────╯
|
|
||||||
function _fzf_report_diff_type --argument-names diff_type --description "Print a distinct colored header meant to preface a git patch."
|
|
||||||
# number of "-" to draw is the length of the string to box + 2 for padding
|
|
||||||
set -f repeat_count (math 2 + (string length $diff_type))
|
|
||||||
set -f line (string repeat --count $repeat_count ─)
|
|
||||||
set -f top_border ╭$line╮
|
|
||||||
set -f btm_border ╰$line╯
|
|
||||||
|
|
||||||
set_color yellow
|
|
||||||
echo $top_border
|
|
||||||
echo "│ $diff_type │"
|
|
||||||
echo $btm_border
|
|
||||||
set_color normal
|
|
||||||
end
|
|
|
@ -1,6 +0,0 @@
|
||||||
# helper function for _fzf_preview_file
|
|
||||||
function _fzf_report_file_type --argument-names file_path file_type --description "Explain the file type for a file."
|
|
||||||
set_color red
|
|
||||||
echo "Cannot preview '$file_path': it is a $file_type."
|
|
||||||
set_color normal
|
|
||||||
end
|
|
|
@ -1,34 +0,0 @@
|
||||||
function _fzf_search_directory --description "Search the current directory. Replace the current token with the selected file paths."
|
|
||||||
# Directly use fd binary to avoid output buffering delay caused by a fd alias, if any.
|
|
||||||
# Debian-based distros install fd as fdfind and the fd package is something else, so
|
|
||||||
# check for fdfind first. Fall back to "fd" for a clear error message.
|
|
||||||
set -f fd_cmd (command -v fdfind || command -v fd || echo "fd")
|
|
||||||
set -f --append fd_cmd --color=always $fzf_fd_opts
|
|
||||||
|
|
||||||
# $fzf_dir_opts is the deprecated version of $fzf_directory_opts
|
|
||||||
set -f fzf_arguments --multi --ansi $fzf_dir_opts $fzf_directory_opts
|
|
||||||
set -f token (commandline --current-token)
|
|
||||||
# expand any variables or leading tilde (~) in the token
|
|
||||||
set -f expanded_token (eval echo -- $token)
|
|
||||||
# unescape token because it's already quoted so backslashes will mess up the path
|
|
||||||
set -f unescaped_exp_token (string unescape -- $expanded_token)
|
|
||||||
|
|
||||||
# If the current token is a directory and has a trailing slash,
|
|
||||||
# then use it as fd's base directory.
|
|
||||||
if string match --quiet -- "*/" $unescaped_exp_token && test -d "$unescaped_exp_token"
|
|
||||||
set --append fd_cmd --base-directory=$unescaped_exp_token
|
|
||||||
# use the directory name as fzf's prompt to indicate the search is limited to that directory
|
|
||||||
set --prepend fzf_arguments --prompt="Search Directory $unescaped_exp_token> " --preview="_fzf_preview_file $expanded_token{}"
|
|
||||||
set -f file_paths_selected $unescaped_exp_token($fd_cmd 2>/dev/null | _fzf_wrapper $fzf_arguments)
|
|
||||||
else
|
|
||||||
set --prepend fzf_arguments --prompt="Search Directory> " --query="$unescaped_exp_token" --preview='_fzf_preview_file {}'
|
|
||||||
set -f file_paths_selected ($fd_cmd 2>/dev/null | _fzf_wrapper $fzf_arguments)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
if test $status -eq 0
|
|
||||||
commandline --current-token --replace -- (string escape -- $file_paths_selected | string join ' ')
|
|
||||||
end
|
|
||||||
|
|
||||||
commandline --function repaint
|
|
||||||
end
|
|
|
@ -1,30 +0,0 @@
|
||||||
function _fzf_search_git_log --description "Search the output of git log and preview commits. Replace the current token with the selected commit hash."
|
|
||||||
if not git rev-parse --git-dir >/dev/null 2>&1
|
|
||||||
echo '_fzf_search_git_log: Not in a git repository.' >&2
|
|
||||||
else
|
|
||||||
if not set --query fzf_git_log_format
|
|
||||||
# %h gives you the abbreviated commit hash, which is useful for saving screen space, but we will have to expand it later below
|
|
||||||
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)'
|
|
||||||
end
|
|
||||||
set -f selected_log_lines (
|
|
||||||
git log --no-show-signature --color=always --format=format:$fzf_git_log_format --date=short | \
|
|
||||||
_fzf_wrapper --ansi \
|
|
||||||
--multi \
|
|
||||||
--tiebreak=index \
|
|
||||||
--prompt="Search Git Log> " \
|
|
||||||
--preview='git show --color=always --stat --patch {1}' \
|
|
||||||
--query=(commandline --current-token) \
|
|
||||||
$fzf_git_log_opts
|
|
||||||
)
|
|
||||||
if test $status -eq 0
|
|
||||||
for line in $selected_log_lines
|
|
||||||
set -f abbreviated_commit_hash (string split --field 1 " " $line)
|
|
||||||
set -f full_commit_hash (git rev-parse $abbreviated_commit_hash)
|
|
||||||
set -f --append commit_hashes $full_commit_hash
|
|
||||||
end
|
|
||||||
commandline --current-token --replace (string join ' ' $commit_hashes)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
commandline --function repaint
|
|
||||||
end
|
|
|
@ -1,36 +0,0 @@
|
||||||
function _fzf_search_git_status --description "Search the output of git status. Replace the current token with the selected file paths."
|
|
||||||
if not git rev-parse --git-dir >/dev/null 2>&1
|
|
||||||
echo '_fzf_search_git_status: Not in a git repository.' >&2
|
|
||||||
else
|
|
||||||
set -f selected_paths (
|
|
||||||
# Pass configuration color.status=always to force status to use colors even though output is sent to a pipe
|
|
||||||
git -c color.status=always status --short |
|
|
||||||
_fzf_wrapper --ansi \
|
|
||||||
--multi \
|
|
||||||
--prompt="Search Git Status> " \
|
|
||||||
--query=(commandline --current-token) \
|
|
||||||
--preview='_fzf_preview_changed_file {}' \
|
|
||||||
--nth="2.." \
|
|
||||||
$fzf_git_status_opts
|
|
||||||
)
|
|
||||||
if test $status -eq 0
|
|
||||||
# git status --short automatically escapes the paths of most files for us so not going to bother trying to handle
|
|
||||||
# the few edges cases of weird file names that should be extremely rare (e.g. "this;needs;escaping")
|
|
||||||
set -f cleaned_paths
|
|
||||||
|
|
||||||
for path in $selected_paths
|
|
||||||
if test (string sub --length 1 $path) = R
|
|
||||||
# path has been renamed and looks like "R LICENSE -> LICENSE.md"
|
|
||||||
# extract the path to use from after the arrow
|
|
||||||
set --append cleaned_paths (string split -- "-> " $path)[-1]
|
|
||||||
else
|
|
||||||
set --append cleaned_paths (string sub --start=4 $path)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
commandline --current-token --replace -- (string join ' ' $cleaned_paths)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
commandline --function repaint
|
|
||||||
end
|
|
|
@ -1,31 +0,0 @@
|
||||||
function _fzf_search_history --description "Search command history. Replace the command line with the selected command."
|
|
||||||
# history merge incorporates history changes from other fish sessions
|
|
||||||
# it errors out if called in private mode
|
|
||||||
if test -z "$fish_private_mode"
|
|
||||||
builtin history merge
|
|
||||||
end
|
|
||||||
|
|
||||||
# Delinate commands throughout pipeline using null rather than newlines because commands can be multi-line
|
|
||||||
set -f commands_selected (
|
|
||||||
# Reference https://devhints.io/strftime to understand strftime format symbols
|
|
||||||
builtin history --null --show-time="%m-%d %H:%M:%S │ " |
|
|
||||||
_fzf_wrapper --read0 \
|
|
||||||
--print0 \
|
|
||||||
--multi \
|
|
||||||
--tiebreak=index \
|
|
||||||
--prompt="Search History> " \
|
|
||||||
--query=(commandline) \
|
|
||||||
--preview="echo -- {4..} | fish_indent --ansi" \
|
|
||||||
--preview-window="bottom:3:wrap" \
|
|
||||||
$fzf_history_opts |
|
|
||||||
string split0 |
|
|
||||||
# remove timestamps from commands selected
|
|
||||||
string replace --regex '^\d\d-\d\d \d\d:\d\d:\d\d │ ' ''
|
|
||||||
)
|
|
||||||
|
|
||||||
if test $status -eq 0
|
|
||||||
commandline --replace -- $commands_selected
|
|
||||||
end
|
|
||||||
|
|
||||||
commandline --function repaint
|
|
||||||
end
|
|
|
@ -1,29 +0,0 @@
|
||||||
function _fzf_search_processes --description "Search all running processes. Replace the current token with the pid of the selected process."
|
|
||||||
# use all caps to be consistent with ps default format
|
|
||||||
# snake_case because ps doesn't seem to allow spaces in the field names
|
|
||||||
set -f ps_preview_fmt (string join ',' 'pid' 'ppid=PARENT' 'user' '%cpu' 'rss=RSS_IN_KB' 'start=START_TIME' 'command')
|
|
||||||
set -f processes_selected (
|
|
||||||
ps -A -opid,command | \
|
|
||||||
_fzf_wrapper --multi \
|
|
||||||
--prompt="Search Processes> " \
|
|
||||||
--query (commandline --current-token) \
|
|
||||||
--ansi \
|
|
||||||
# first line outputted by ps is a header, so we need to mark it as so
|
|
||||||
--header-lines=1 \
|
|
||||||
# ps uses exit code 1 if the process was not found, in which case show an message explaining so
|
|
||||||
--preview="ps -o '$ps_preview_fmt' -p {1} || echo 'Cannot preview {1} because it exited.'" \
|
|
||||||
--preview-window="bottom:4:wrap" \
|
|
||||||
$fzf_processes_opts
|
|
||||||
)
|
|
||||||
|
|
||||||
if test $status -eq 0
|
|
||||||
for process in $processes_selected
|
|
||||||
set -f --append pids_selected (string split --no-empty --field=1 -- " " $process)
|
|
||||||
end
|
|
||||||
|
|
||||||
# string join to replace the newlines outputted by string split with spaces
|
|
||||||
commandline --current-token --replace -- (string join ' ' $pids_selected)
|
|
||||||
end
|
|
||||||
|
|
||||||
commandline --function repaint
|
|
||||||
end
|
|
|
@ -1,48 +0,0 @@
|
||||||
# This function expects the following two arguments:
|
|
||||||
# argument 1 = output of (set --show | psub), i.e. a file with the scope info and values of all variables
|
|
||||||
# argument 2 = output of (set --names | psub), i.e. a file with all variable names
|
|
||||||
function _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."
|
|
||||||
if test -z "$set_names_output"
|
|
||||||
printf '%s\n' '_fzf_search_variables requires 2 arguments.' >&2
|
|
||||||
|
|
||||||
commandline --function repaint
|
|
||||||
return 22 # 22 means invalid argument in POSIX
|
|
||||||
end
|
|
||||||
|
|
||||||
# Exclude the history variable from being piped into fzf because
|
|
||||||
# 1. it's not included in $set_names_output
|
|
||||||
# 2. it tends to be a very large value => increases computation time
|
|
||||||
# 3._fzf_search_history is a much better way to examine history anyway
|
|
||||||
set -f all_variable_names (string match --invert history <$set_names_output)
|
|
||||||
|
|
||||||
set -f current_token (commandline --current-token)
|
|
||||||
# Use the current token to pre-populate fzf's query. If the current token begins
|
|
||||||
# with a $, remove it from the query so that it will better match the variable names
|
|
||||||
set -f cleaned_curr_token (string replace -- '$' '' $current_token)
|
|
||||||
|
|
||||||
set -f variable_names_selected (
|
|
||||||
printf '%s\n' $all_variable_names |
|
|
||||||
_fzf_wrapper --preview "_fzf_extract_var_info {} $set_show_output" \
|
|
||||||
--prompt="Search Variables> " \
|
|
||||||
--preview-window="wrap" \
|
|
||||||
--multi \
|
|
||||||
--query=$cleaned_curr_token \
|
|
||||||
# $fzf_shell_vars_opts is the deprecated version of $fzf_variables_opts
|
|
||||||
$fzf_shell_vars_opts $fzf_variables_opts
|
|
||||||
)
|
|
||||||
|
|
||||||
if test $status -eq 0
|
|
||||||
# If the current token begins with a $, do not overwrite the $ when
|
|
||||||
# replacing the current token with the selected variable.
|
|
||||||
# Uses brace expansion to prepend $ to each variable name.
|
|
||||||
commandline --current-token --replace (
|
|
||||||
if string match --quiet -- '$*' $current_token
|
|
||||||
string join " " \${$variable_names_selected}
|
|
||||||
else
|
|
||||||
string join " " $variable_names_selected
|
|
||||||
end
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
commandline --function repaint
|
|
||||||
end
|
|
|
@ -1,20 +0,0 @@
|
||||||
function _fzf_wrapper --description "Prepares some environment variables before executing fzf."
|
|
||||||
# Make sure fzf uses fish to execute preview commands, some of which
|
|
||||||
# are autoloaded fish functions so don't exist in other shells.
|
|
||||||
# Use --function so that it doesn't clobber SHELL outside this function.
|
|
||||||
set -f --export SHELL (command --search fish)
|
|
||||||
|
|
||||||
# If FZF_DEFAULT_OPTS is not set, then set some sane defaults.
|
|
||||||
# See https://github.com/junegunn/fzf#environment-variables
|
|
||||||
if not set --query FZF_DEFAULT_OPTS
|
|
||||||
# cycle allows jumping between the first and last results, making scrolling faster
|
|
||||||
# layout=reverse lists results top to bottom, mimicking the familiar layouts of git log, history, and env
|
|
||||||
# border shows where the fzf window begins and ends
|
|
||||||
# height=90% leaves space to see the current command and some scrollback, maintaining context of work
|
|
||||||
# preview-window=wrap wraps long lines in the preview window, making reading easier
|
|
||||||
# marker=* makes the multi-select marker more distinguishable from the pointer (since both default to >)
|
|
||||||
set --export FZF_DEFAULT_OPTS '--cycle --layout=reverse --border --height=90% --preview-window=wrap --marker="*"'
|
|
||||||
end
|
|
||||||
|
|
||||||
fzf $argv
|
|
||||||
end
|
|
|
@ -1,24 +0,0 @@
|
||||||
function _pure_check_for_new_release \
|
|
||||||
--description "Check for new release and show command to install"
|
|
||||||
|
|
||||||
if test "$pure_check_for_new_release" = true
|
|
||||||
echo "🛈 Checking for new release…"
|
|
||||||
set latest (pure_get_latest_release_version "pure-fish/pure")
|
|
||||||
|
|
||||||
if test "v"$pure_version != $latest
|
|
||||||
set --local latest_version (_pure_set_color $pure_color_info)$latest(_pure_set_color $pure_color_normal)
|
|
||||||
echo -e "🔔 New version available!\n"
|
|
||||||
echo -e (_pure_set_color $pure_color_success)"fisher install pure-fish/pure@$latest_version\n"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function pure_get_latest_release_version \
|
|
||||||
--argument-names user_repo
|
|
||||||
|
|
||||||
curl \
|
|
||||||
--silent \
|
|
||||||
"https://api.github.com/repos/$user_repo/releases/latest" \
|
|
||||||
| string match --regex '"tag_name": "\K.*?(?=")'
|
|
||||||
end
|
|
|
@ -1,10 +0,0 @@
|
||||||
function _pure_detect_container_by_cgroup_method \
|
|
||||||
--description "Linux method to detect container using cgroup. see https://stackoverflow.com/a/37015387/802365" \
|
|
||||||
--argument-names cgroup_namespace
|
|
||||||
set --query cgroup_namespace[1]; or set cgroup_namespace /proc/1/cgroup
|
|
||||||
|
|
||||||
string match \
|
|
||||||
--quiet \
|
|
||||||
--entire \
|
|
||||||
--regex '(lxc|docker)' <$cgroup_namespace
|
|
||||||
end
|
|
|
@ -1,14 +0,0 @@
|
||||||
function _pure_detect_container_by_pid_method \
|
|
||||||
--description "Linux method to detect container using /proc. see https://stackoverflow.com/a/37015387/802365" \
|
|
||||||
--argument-names proc_sched
|
|
||||||
|
|
||||||
set --query proc_sched[1]; or set proc_sched /proc/1/sched
|
|
||||||
|
|
||||||
if test -e $proc_sched
|
|
||||||
head -n 1 $proc_sched \
|
|
||||||
| string match \
|
|
||||||
--quiet \
|
|
||||||
--invert \
|
|
||||||
--regex 'init|systemd'
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,49 +0,0 @@
|
||||||
set SUCCESS 0
|
|
||||||
set FAILURE 1
|
|
||||||
|
|
||||||
function _pure_format_time \
|
|
||||||
--description="Format milliseconds to a human readable format" \
|
|
||||||
--argument-names \
|
|
||||||
milliseconds \
|
|
||||||
threshold \
|
|
||||||
show_subsecond
|
|
||||||
|
|
||||||
set --query show_subsecond[1]; or set show_subsecond false
|
|
||||||
test "$milliseconds" -lt 0; and return $FAILURE
|
|
||||||
test "$milliseconds" -lt (math --scale=0 "$threshold * 1000"); and echo; and return $SUCCESS
|
|
||||||
|
|
||||||
set --local time
|
|
||||||
set --local days (math --scale=0 "$milliseconds / 86400000")
|
|
||||||
test "$days" -gt 0; and set --append time (printf "%sd" $days)
|
|
||||||
set --local hours (math --scale=0 "$milliseconds / 3600000 % 24")
|
|
||||||
test "$hours" -gt 0; and set --append time (printf "%sh" $hours)
|
|
||||||
set --local minutes (math --scale=0 "$milliseconds / 60000 % 60")
|
|
||||||
test "$minutes" -gt 0; and set --append time (printf "%sm" $minutes)
|
|
||||||
set --local seconds (math --scale=0 "$milliseconds / 1000 % 60")
|
|
||||||
|
|
||||||
if test "$show_subsecond" = true
|
|
||||||
set --local threshold_as_ms (math --scale=0 "$threshold*1000")
|
|
||||||
set --local subseconds (_pure_format_time_subseconds $milliseconds $threshold_as_ms)
|
|
||||||
set --append time $seconds$subseconds's'
|
|
||||||
else
|
|
||||||
test "$seconds" -gt $threshold; and set --append time (printf "%ss" $seconds)
|
|
||||||
end
|
|
||||||
|
|
||||||
echo -e (string join ' ' $time)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function _pure_format_time_subseconds \
|
|
||||||
--description="Format duration milliseconds to a human readable format" \
|
|
||||||
--argument-names \
|
|
||||||
duration \
|
|
||||||
threshold
|
|
||||||
|
|
||||||
set --local subseconds
|
|
||||||
if test "$duration" -gt $threshold
|
|
||||||
set --local precision 2
|
|
||||||
set --local milliseconds (string sub --start -3 --length $precision $duration)
|
|
||||||
set --append subseconds '.'$milliseconds
|
|
||||||
end
|
|
||||||
echo $subseconds
|
|
||||||
end
|
|
|
@ -1,12 +0,0 @@
|
||||||
function _pure_get_prompt_symbol \
|
|
||||||
--description 'Print prompt symbol' \
|
|
||||||
--argument-names exit_code
|
|
||||||
|
|
||||||
set --local prompt_symbol $pure_symbol_prompt
|
|
||||||
test "$pure_reverse_prompt_symbol_in_vimode" = true
|
|
||||||
and string match -rq "fish_(vi|hybrid)_key_bindings" $fish_key_bindings
|
|
||||||
and not contains "$fish_bind_mode" insert replace
|
|
||||||
and set prompt_symbol $pure_symbol_reverse_prompt
|
|
||||||
|
|
||||||
echo "$prompt_symbol"
|
|
||||||
end
|
|
|
@ -1,26 +0,0 @@
|
||||||
function _pure_is_inside_container \
|
|
||||||
--argument-names cgroup_namespace
|
|
||||||
set --query cgroup_namespace[1]; or set cgroup_namespace /proc/1/cgroup
|
|
||||||
|
|
||||||
if set --query pure_enable_container_detection; and test "$pure_enable_container_detection" = true
|
|
||||||
set --local success 0
|
|
||||||
if test -n "$container"
|
|
||||||
return $success
|
|
||||||
end
|
|
||||||
|
|
||||||
set --local os_name (uname -s)
|
|
||||||
# echo $os_name
|
|
||||||
if test $os_name = Linux
|
|
||||||
if _pure_detect_container_by_cgroup_method $cgroup_namespace
|
|
||||||
return $success
|
|
||||||
end
|
|
||||||
|
|
||||||
if _pure_detect_container_by_pid_method
|
|
||||||
return $success
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
set --local failure 1
|
|
||||||
return $failure
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
function _pure_is_single_line_prompt \
|
|
||||||
--description 'Test if single line prompt feature is enabled'
|
|
||||||
set --query pure_enable_single_line_prompt
|
|
||||||
and test "$pure_enable_single_line_prompt" = true
|
|
||||||
end
|
|
|
@ -1,14 +0,0 @@
|
||||||
function _pure_parse_directory \
|
|
||||||
--description "Replace '$HOME' with '~'" \
|
|
||||||
--argument-names max_path_length
|
|
||||||
|
|
||||||
set --local folder (string replace $HOME '~' $PWD)
|
|
||||||
|
|
||||||
if test -n "$max_path_length";
|
|
||||||
if test (string length $folder) -gt $max_path_length;
|
|
||||||
# If path exceeds maximum symbol limit, use default fish path formating function
|
|
||||||
set folder (prompt_pwd)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
echo $folder
|
|
||||||
end
|
|
|
@ -1,4 +0,0 @@
|
||||||
function _pure_parse_git_branch --description "Parse current Git branch name"
|
|
||||||
command git symbolic-ref --short HEAD 2>/dev/null;
|
|
||||||
or command git name-rev --name-only HEAD 2>/dev/null
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
function _pure_place_iterm2_prompt_mark
|
|
||||||
if functions -q iterm2_prompt_mark
|
|
||||||
iterm2_prompt_mark
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,11 +0,0 @@
|
||||||
function _pure_prefix_root_prompt
|
|
||||||
set --local username (id -u -n) # current user name
|
|
||||||
set --local prefix_root_prompt
|
|
||||||
|
|
||||||
if set --query pure_show_prefix_root_prompt; and test "$pure_show_prefix_root_prompt" = true -a "$username" = "root"
|
|
||||||
set --local prefix_color (_pure_set_color $pure_color_prefix_root_prompt)
|
|
||||||
set prefix_root_prompt "$prefix_color$pure_symbol_prefix_root_prompt"
|
|
||||||
end
|
|
||||||
|
|
||||||
echo "$prefix_root_prompt"
|
|
||||||
end
|
|
|
@ -1,13 +0,0 @@
|
||||||
function _pure_print_prompt \
|
|
||||||
--description 'Concatenate parts single prompt string' \
|
|
||||||
|
|
||||||
set --local prompt
|
|
||||||
|
|
||||||
for prompt_part in $argv
|
|
||||||
if test (_pure_string_width $prompt_part) -gt 0
|
|
||||||
set --append prompt "$prompt_part"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
echo (string trim -l $prompt)
|
|
||||||
end
|
|
|
@ -1,10 +0,0 @@
|
||||||
function _pure_print_prompt_rows \
|
|
||||||
--description "Manage default vs. compact prompt"
|
|
||||||
|
|
||||||
# print current path, git branch/status, command duration
|
|
||||||
if _pure_is_single_line_prompt
|
|
||||||
echo -e -n (_pure_prompt_first_line)
|
|
||||||
else
|
|
||||||
echo -e (_pure_prompt_first_line)
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,27 +0,0 @@
|
||||||
function _pure_prompt \
|
|
||||||
--description 'Print prompt symbol' \
|
|
||||||
--argument-names exit_code
|
|
||||||
|
|
||||||
set --local jobs (_pure_prompt_jobs)
|
|
||||||
set --local virtualenv (_pure_prompt_virtualenv) # Python virtualenv name
|
|
||||||
set --local vimode_indicator (_pure_prompt_vimode) # vi-mode indicator
|
|
||||||
set --local pure_symbol (_pure_prompt_symbol $exit_code)
|
|
||||||
set --local system_time (_pure_prompt_system_time)
|
|
||||||
set --local root_prefix (_pure_prefix_root_prompt)
|
|
||||||
set --local space
|
|
||||||
|
|
||||||
if _pure_is_single_line_prompt
|
|
||||||
set space ' '
|
|
||||||
end
|
|
||||||
|
|
||||||
echo (\
|
|
||||||
_pure_print_prompt \
|
|
||||||
$space \
|
|
||||||
$system_time \
|
|
||||||
$root_prefix \
|
|
||||||
$jobs \
|
|
||||||
$virtualenv \
|
|
||||||
$vimode_indicator \
|
|
||||||
$pure_symbol \
|
|
||||||
)
|
|
||||||
end
|
|
|
@ -1,6 +0,0 @@
|
||||||
function _pure_prompt_beginning
|
|
||||||
# Clear existing line content
|
|
||||||
set --local clear_line "\r\033[K"
|
|
||||||
|
|
||||||
echo $clear_line
|
|
||||||
end
|
|
|
@ -1,11 +0,0 @@
|
||||||
function _pure_prompt_command_duration
|
|
||||||
set --local command_duration
|
|
||||||
|
|
||||||
# Get command execution duration
|
|
||||||
if test -n "$CMD_DURATION"
|
|
||||||
set command_duration (_pure_format_time $CMD_DURATION $pure_threshold_command_duration $pure_show_subsecond_command_duration)
|
|
||||||
end
|
|
||||||
set --local command_duration_color (_pure_set_color $pure_color_command_duration)
|
|
||||||
|
|
||||||
echo "$command_duration_color$command_duration"
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
function _pure_prompt_container
|
|
||||||
if _pure_is_inside_container
|
|
||||||
echo "$pure_symbol_container_prefix"(_pure_user_at_host)
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,11 +0,0 @@
|
||||||
set FAILURE 1
|
|
||||||
|
|
||||||
function _pure_prompt_current_folder --argument-names current_prompt_width
|
|
||||||
|
|
||||||
if test -z "$current_prompt_width"; return $FAILURE; end
|
|
||||||
|
|
||||||
set --local current_folder (_pure_parse_directory (math $COLUMNS - $current_prompt_width - 1))
|
|
||||||
set --local current_folder_color (_pure_set_color $pure_color_current_directory)
|
|
||||||
|
|
||||||
echo "$current_folder_color$current_folder"
|
|
||||||
end
|
|
|
@ -1,3 +0,0 @@
|
||||||
function _pure_prompt_ending
|
|
||||||
echo (set_color normal)" "
|
|
||||||
end
|
|
|
@ -1,37 +0,0 @@
|
||||||
set --global FAILURE 1
|
|
||||||
|
|
||||||
function _pure_prompt_first_line \
|
|
||||||
--description 'Print contextual information before prompt.'
|
|
||||||
|
|
||||||
set --local prompt_ssh (_pure_prompt_ssh)
|
|
||||||
set --local prompt_container (_pure_prompt_container)
|
|
||||||
set --local prompt_git (_pure_prompt_git)
|
|
||||||
set --local prompt_command_duration (_pure_prompt_command_duration)
|
|
||||||
set --local prompt (_pure_print_prompt \
|
|
||||||
$prompt_ssh \
|
|
||||||
$prompt_container \
|
|
||||||
$prompt_git \
|
|
||||||
$prompt_command_duration
|
|
||||||
)
|
|
||||||
set --local prompt_width (_pure_string_width $prompt)
|
|
||||||
set --local current_folder (_pure_prompt_current_folder $prompt_width)
|
|
||||||
|
|
||||||
set --local prompt_components
|
|
||||||
if set --query pure_begin_prompt_with_current_directory; and test "$pure_begin_prompt_with_current_directory" = true
|
|
||||||
set prompt_components \
|
|
||||||
$current_folder \
|
|
||||||
$prompt_git \
|
|
||||||
$prompt_ssh \
|
|
||||||
$prompt_container \
|
|
||||||
$prompt_command_duration
|
|
||||||
else
|
|
||||||
set prompt_components \
|
|
||||||
$prompt_ssh \
|
|
||||||
$prompt_container \
|
|
||||||
$current_folder \
|
|
||||||
$prompt_git \
|
|
||||||
$prompt_command_duration
|
|
||||||
end
|
|
||||||
|
|
||||||
echo (_pure_print_prompt $prompt_components)
|
|
||||||
end
|
|
|
@ -1,26 +0,0 @@
|
||||||
function _pure_prompt_git \
|
|
||||||
--description 'Print git repository informations: branch name, dirty, upstream ahead/behind'
|
|
||||||
|
|
||||||
set ABORT_FEATURE 2
|
|
||||||
|
|
||||||
if set --query pure_enable_git; and test "$pure_enable_git" != true
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if not type -q --no-functions git # skip git-related features when `git` is not available
|
|
||||||
return $ABORT_FEATURE
|
|
||||||
end
|
|
||||||
|
|
||||||
set --local is_git_repository (command git rev-parse --is-inside-work-tree 2>/dev/null)
|
|
||||||
|
|
||||||
if test -n "$is_git_repository"
|
|
||||||
set --local git_prompt (_pure_prompt_git_branch)(_pure_prompt_git_dirty)(_pure_prompt_git_stash)
|
|
||||||
set --local git_pending_commits (_pure_prompt_git_pending_commits)
|
|
||||||
|
|
||||||
if test (_pure_string_width $git_pending_commits) -ne 0
|
|
||||||
set --append git_prompt $git_pending_commits
|
|
||||||
end
|
|
||||||
|
|
||||||
echo $git_prompt
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,6 +0,0 @@
|
||||||
function _pure_prompt_git_branch
|
|
||||||
set --local git_branch (_pure_parse_git_branch) # current git branch
|
|
||||||
set --local git_branch_color (_pure_set_color $pure_color_git_branch)
|
|
||||||
|
|
||||||
echo "$git_branch_color$git_branch"
|
|
||||||
end
|
|
|
@ -1,18 +0,0 @@
|
||||||
function _pure_prompt_git_dirty
|
|
||||||
set --local git_dirty_symbol
|
|
||||||
set --local git_dirty_color
|
|
||||||
|
|
||||||
set --local is_git_dirty (
|
|
||||||
# The first checks for staged changes, the second for unstaged ones.
|
|
||||||
# We put them in this order because checking staged changes is *fast*.
|
|
||||||
not command git diff-index --ignore-submodules --cached --quiet HEAD -- >/dev/null 2>&1
|
|
||||||
or not command git diff --ignore-submodules --no-ext-diff --quiet --exit-code >/dev/null 2>&1
|
|
||||||
and echo "true"
|
|
||||||
)
|
|
||||||
if test -n "$is_git_dirty" # untracked or un-commited files
|
|
||||||
set git_dirty_symbol "$pure_symbol_git_dirty"
|
|
||||||
set git_dirty_color (_pure_set_color $pure_color_git_dirty)
|
|
||||||
end
|
|
||||||
|
|
||||||
echo "$git_dirty_color$git_dirty_symbol"
|
|
||||||
end
|
|
|
@ -1,27 +0,0 @@
|
||||||
function _pure_prompt_git_pending_commits
|
|
||||||
set --local git_unpushed_commits
|
|
||||||
set --local git_unpulled_commits
|
|
||||||
|
|
||||||
set --local has_upstream (command git rev-parse --abbrev-ref '@{upstream}' 2>/dev/null)
|
|
||||||
if test -n "$has_upstream" # check there is an upstream repo configured
|
|
||||||
and test "$has_upstream" != '@{upstream}' # Fixed #179, dont check the empty repo
|
|
||||||
command git rev-list --left-right --count 'HEAD...@{upstream}' \
|
|
||||||
| read --local --array git_status
|
|
||||||
set --local commit_to_push $git_status[1]
|
|
||||||
set --local commit_to_pull $git_status[2]
|
|
||||||
|
|
||||||
if test "$commit_to_push" -gt 0 # upstream is behind local repo
|
|
||||||
set --local git_unpushed_commits_color \
|
|
||||||
(_pure_set_color $pure_color_git_unpushed_commits)
|
|
||||||
set git_unpushed_commits "$git_unpushed_commits_color$pure_symbol_git_unpushed_commits"
|
|
||||||
end
|
|
||||||
|
|
||||||
if test "$commit_to_pull" -gt 0 # upstream is ahead of local repo
|
|
||||||
set --local git_unpulled_commits_color \
|
|
||||||
(_pure_set_color $pure_color_git_unpulled_commits)
|
|
||||||
set git_unpulled_commits "$git_unpulled_commits_color$pure_symbol_git_unpulled_commits"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
echo "$git_unpushed_commits$git_unpulled_commits"
|
|
||||||
end
|
|
|
@ -1,15 +0,0 @@
|
||||||
function _pure_prompt_git_stash
|
|
||||||
set --local git_stash_symbol
|
|
||||||
set --local git_stash_color
|
|
||||||
|
|
||||||
set --local has_stashed_files (
|
|
||||||
command git rev-list --walk-reflogs --count refs/stash >/dev/null 2>&1
|
|
||||||
and echo "true"
|
|
||||||
)
|
|
||||||
if test -n "$has_stashed_files" # untracked or un-commited files
|
|
||||||
set git_stash_symbol " $pure_symbol_git_stash"
|
|
||||||
set git_stash_color (_pure_set_color $pure_color_git_stash)
|
|
||||||
end
|
|
||||||
|
|
||||||
echo "$git_stash_color$git_stash_symbol"
|
|
||||||
end
|
|
|
@ -1,9 +0,0 @@
|
||||||
function _pure_prompt_jobs --description "Display number of running jobs"
|
|
||||||
if set --query pure_show_jobs; and test "$pure_show_jobs" = true
|
|
||||||
set --local njobs (count (jobs -p))
|
|
||||||
set --local jobs_color (_pure_set_color $pure_color_jobs)
|
|
||||||
if test "$njobs" -gt 0
|
|
||||||
echo "$jobs_color"[$njobs]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,11 +0,0 @@
|
||||||
function _pure_prompt_new_line \
|
|
||||||
--description "Do not add a line break to a brand new session" \
|
|
||||||
--on-event fish_prompt
|
|
||||||
|
|
||||||
set --local new_line
|
|
||||||
if not _pure_is_single_line_prompt; and test "$_pure_fresh_session" = false
|
|
||||||
set new_line "\n"
|
|
||||||
end
|
|
||||||
|
|
||||||
echo -e -n "$new_line"
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
function _pure_prompt_ssh
|
|
||||||
if test "$SSH_CONNECTION" != ""
|
|
||||||
echo "$pure_symbol_ssh_prefix"(_pure_user_at_host)
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,20 +0,0 @@
|
||||||
function _pure_prompt_symbol \
|
|
||||||
--description 'Print prompt symbol' \
|
|
||||||
--argument-names exit_code
|
|
||||||
|
|
||||||
set --local prompt_symbol (_pure_get_prompt_symbol)
|
|
||||||
set --local symbol_color_success (_pure_set_color $pure_color_prompt_on_success)
|
|
||||||
set --local symbol_color_error (_pure_set_color $pure_color_prompt_on_error)
|
|
||||||
set --local command_succeed 0
|
|
||||||
|
|
||||||
set --local symbol_color $symbol_color_success # default pure symbol color
|
|
||||||
if set --query exit_code; and test "$exit_code" -ne $command_succeed
|
|
||||||
set symbol_color $symbol_color_error # different pure symbol color when previous command failed
|
|
||||||
|
|
||||||
if set --query pure_separate_prompt_on_error; and test "$pure_separate_prompt_on_error" = true
|
|
||||||
set symbol_color "$symbol_color_error$prompt_symbol$symbol_color_success"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
echo "$symbol_color$prompt_symbol"
|
|
||||||
end
|
|
|
@ -1,6 +0,0 @@
|
||||||
function _pure_prompt_system_time --description "Display system time"
|
|
||||||
if set --query pure_show_system_time; and test "$pure_show_system_time" = true
|
|
||||||
set --local time_color (_pure_set_color $pure_color_system_time)
|
|
||||||
echo "$time_color"(date '+%T')
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,6 +0,0 @@
|
||||||
function _pure_prompt_vimode
|
|
||||||
if set --query pure_reverse_prompt_symbol_in_vimode;
|
|
||||||
and test "$pure_reverse_prompt_symbol_in_vimode" = false
|
|
||||||
echo (fish_default_mode_prompt)
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,13 +0,0 @@
|
||||||
function _pure_prompt_virtualenv --description "Display virtualenv directory"
|
|
||||||
if test -n "$VIRTUAL_ENV"
|
|
||||||
set --local virtualenv (basename "$VIRTUAL_ENV")
|
|
||||||
set --local virtualenv_color (_pure_set_color $pure_color_virtualenv)
|
|
||||||
|
|
||||||
echo "$virtualenv_color$virtualenv"
|
|
||||||
else if test -n "$CONDA_DEFAULT_ENV"
|
|
||||||
set --local virtualenv (basename "$CONDA_DEFAULT_ENV")
|
|
||||||
set --local virtualenv_color (_pure_set_color $pure_color_virtualenv)
|
|
||||||
|
|
||||||
echo "$virtualenv_color$virtualenv"
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,19 +0,0 @@
|
||||||
function _pure_set_color \
|
|
||||||
--description 'Set color' \
|
|
||||||
--argument-names var
|
|
||||||
|
|
||||||
set --local color $var
|
|
||||||
# Backwards compatibility for colors defined as control sequencies instead of fish colors
|
|
||||||
if not string match --quiet --all --regex '\e\[[^m]*m' $color[1]
|
|
||||||
and set -q $color
|
|
||||||
set color $$var
|
|
||||||
end
|
|
||||||
|
|
||||||
set --local result $color
|
|
||||||
if not string match --quiet --all --regex '\e\[[^m]*m' $result[1]
|
|
||||||
and not test -z $result[1]
|
|
||||||
set result (set_color $color)
|
|
||||||
end
|
|
||||||
|
|
||||||
echo "$result"
|
|
||||||
end
|
|
|
@ -1,11 +0,0 @@
|
||||||
function _pure_set_default \
|
|
||||||
--description 'Set default value for configuration variable' \
|
|
||||||
--argument-names var default
|
|
||||||
|
|
||||||
set is_available_universally (not set --query --universal $var; or test -z $$var; echo $status)
|
|
||||||
set is_available_globally (not set --query --global $var; or test -z $$var; echo $status)
|
|
||||||
|
|
||||||
if test "$is_available_universally" -eq 0 -a $is_available_globally -eq 0
|
|
||||||
set --universal $var "$default"
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,9 +0,0 @@
|
||||||
function _pure_string_width \
|
|
||||||
--description 'returns raw string length, i.e. ignore ANSI-color' \
|
|
||||||
--argument-names prompt
|
|
||||||
|
|
||||||
set --local empty ''
|
|
||||||
set --local raw_prompt (string replace --all --regex '\e\[[^m]*m' $empty -- $prompt)
|
|
||||||
|
|
||||||
string length -- $raw_prompt
|
|
||||||
end
|
|
|
@ -1,13 +0,0 @@
|
||||||
function _pure_user_at_host
|
|
||||||
set --local username (id -u -n) # current user name
|
|
||||||
set --local at_sign "@"
|
|
||||||
set --local at_sign_color (_pure_set_color $pure_color_at_sign)
|
|
||||||
set --local hostname_color (_pure_set_color $pure_color_hostname)
|
|
||||||
|
|
||||||
set --local username_color (_pure_set_color $pure_color_username_normal) # default color
|
|
||||||
if test "$username" = root
|
|
||||||
set username_color (_pure_set_color $pure_color_username_root) # different color for root
|
|
||||||
end
|
|
||||||
|
|
||||||
echo "$username_color$username$at_sign_color$at_sign$hostname_color$hostname"
|
|
||||||
end
|
|
|
@ -1,3 +0,0 @@
|
||||||
function fish_greeting
|
|
||||||
_pure_check_for_new_release
|
|
||||||
end
|
|
|
@ -1,2 +0,0 @@
|
||||||
function fish_mode_prompt
|
|
||||||
end
|
|
|
@ -1,12 +0,0 @@
|
||||||
# a called to `_pure_prompt_new_line` is triggered by an event
|
|
||||||
function fish_prompt
|
|
||||||
set --local exit_code $status # save previous exit code
|
|
||||||
|
|
||||||
echo -e -n (_pure_prompt_beginning) # init prompt context (clear current line, etc.)
|
|
||||||
_pure_print_prompt_rows # manage default vs. compact prompt
|
|
||||||
_pure_place_iterm2_prompt_mark # place iTerm shell integration mark
|
|
||||||
echo -e -n (_pure_prompt $exit_code) # print prompt
|
|
||||||
echo -e (_pure_prompt_ending) # reset colors and end prompt
|
|
||||||
|
|
||||||
set _pure_fresh_session false
|
|
||||||
end
|
|
|
@ -1,16 +0,0 @@
|
||||||
function fish_title \
|
|
||||||
--description "Set title to current folder and shell name" \
|
|
||||||
--argument-names last_command
|
|
||||||
|
|
||||||
set --local basename (string replace --regex '^.*/' '' -- $PWD)
|
|
||||||
set --local current_folder (_pure_parse_directory)
|
|
||||||
set --local current_command (status current-command 2>/dev/null; or echo $_)
|
|
||||||
|
|
||||||
set --local prompt "$basename: $last_command $pure_symbol_title_bar_separator $current_command"
|
|
||||||
|
|
||||||
if test -z "$last_command"
|
|
||||||
set prompt "$current_folder $pure_symbol_title_bar_separator $current_command"
|
|
||||||
end
|
|
||||||
|
|
||||||
echo $prompt
|
|
||||||
end
|
|
|
@ -1,240 +0,0 @@
|
||||||
function fisher --argument-names cmd --description "A plugin manager for Fish"
|
|
||||||
set --query fisher_path || set --local fisher_path $__fish_config_dir
|
|
||||||
set --local fisher_version 4.4.3
|
|
||||||
set --local fish_plugins $__fish_config_dir/fish_plugins
|
|
||||||
|
|
||||||
switch "$cmd"
|
|
||||||
case -v --version
|
|
||||||
echo "fisher, version $fisher_version"
|
|
||||||
case "" -h --help
|
|
||||||
echo "Usage: fisher install <plugins...> Install plugins"
|
|
||||||
echo " fisher remove <plugins...> Remove installed plugins"
|
|
||||||
echo " fisher update <plugins...> Update installed plugins"
|
|
||||||
echo " fisher update Update all installed plugins"
|
|
||||||
echo " fisher list [<regex>] List installed plugins matching regex"
|
|
||||||
echo "Options:"
|
|
||||||
echo " -v, --version Print version"
|
|
||||||
echo " -h, --help Print this help message"
|
|
||||||
echo "Variables:"
|
|
||||||
echo " \$fisher_path Plugin installation path. Default: $__fish_config_dir" | string replace --regex -- $HOME \~
|
|
||||||
case ls list
|
|
||||||
string match --entire --regex -- "$argv[2]" $_fisher_plugins
|
|
||||||
case install update remove
|
|
||||||
isatty || read --local --null --array stdin && set --append argv $stdin
|
|
||||||
|
|
||||||
set --local install_plugins
|
|
||||||
set --local update_plugins
|
|
||||||
set --local remove_plugins
|
|
||||||
set --local arg_plugins $argv[2..-1]
|
|
||||||
set --local old_plugins $_fisher_plugins
|
|
||||||
set --local new_plugins
|
|
||||||
|
|
||||||
test -e $fish_plugins && set --local file_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins)
|
|
||||||
|
|
||||||
if ! set --query argv[2]
|
|
||||||
if test "$cmd" != update
|
|
||||||
echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1
|
|
||||||
else if ! set --query file_plugins
|
|
||||||
echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1
|
|
||||||
end
|
|
||||||
set arg_plugins $file_plugins
|
|
||||||
end
|
|
||||||
|
|
||||||
for plugin in $arg_plugins
|
|
||||||
set plugin (test -e "$plugin" && realpath $plugin || string lower -- $plugin)
|
|
||||||
contains -- "$plugin" $new_plugins || set --append new_plugins $plugin
|
|
||||||
end
|
|
||||||
|
|
||||||
if set --query argv[2]
|
|
||||||
for plugin in $new_plugins
|
|
||||||
if contains -- "$plugin" $old_plugins
|
|
||||||
test "$cmd" = remove &&
|
|
||||||
set --append remove_plugins $plugin ||
|
|
||||||
set --append update_plugins $plugin
|
|
||||||
else if test "$cmd" = install
|
|
||||||
set --append install_plugins $plugin
|
|
||||||
else
|
|
||||||
echo "fisher: Plugin not installed: \"$plugin\"" >&2 && return 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
for plugin in $new_plugins
|
|
||||||
contains -- "$plugin" $old_plugins &&
|
|
||||||
set --append update_plugins $plugin ||
|
|
||||||
set --append install_plugins $plugin
|
|
||||||
end
|
|
||||||
|
|
||||||
for plugin in $old_plugins
|
|
||||||
contains -- "$plugin" $new_plugins || set --append remove_plugins $plugin
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
set --local pid_list
|
|
||||||
set --local source_plugins
|
|
||||||
set --local fetch_plugins $update_plugins $install_plugins
|
|
||||||
set --local fish_path (status fish-path)
|
|
||||||
|
|
||||||
echo (set_color --bold)fisher $cmd version $fisher_version(set_color normal)
|
|
||||||
|
|
||||||
for plugin in $fetch_plugins
|
|
||||||
set --local source (command mktemp -d)
|
|
||||||
set --append source_plugins $source
|
|
||||||
|
|
||||||
command mkdir -p $source/{completions,conf.d,themes,functions}
|
|
||||||
|
|
||||||
$fish_path --command "
|
|
||||||
if test -e $plugin
|
|
||||||
command cp -Rf $plugin/* $source
|
|
||||||
else
|
|
||||||
set temp (command mktemp -d)
|
|
||||||
set repo (string split -- \@ $plugin) || set repo[2] HEAD
|
|
||||||
|
|
||||||
if set path (string replace --regex -- '^(https://)?gitlab.com/' '' \$repo[1])
|
|
||||||
set name (string split -- / \$path)[-1]
|
|
||||||
set url https://gitlab.com/\$path/-/archive/\$repo[2]/\$name-\$repo[2].tar.gz
|
|
||||||
else
|
|
||||||
set url https://api.github.com/repos/\$repo[1]/tarball/\$repo[2]
|
|
||||||
end
|
|
||||||
|
|
||||||
echo Fetching (set_color --underline)\$url(set_color normal)
|
|
||||||
|
|
||||||
if curl --silent -L \$url | tar -xzC \$temp -f - 2>/dev/null
|
|
||||||
command cp -Rf \$temp/*/* $source
|
|
||||||
else
|
|
||||||
echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2
|
|
||||||
command rm -rf $source
|
|
||||||
end
|
|
||||||
|
|
||||||
command rm -rf \$temp
|
|
||||||
end
|
|
||||||
|
|
||||||
set files $source/* && string match --quiet --regex -- .+\.fish\\\$ \$files
|
|
||||||
" &
|
|
||||||
|
|
||||||
set --append pid_list (jobs --last --pid)
|
|
||||||
end
|
|
||||||
|
|
||||||
wait $pid_list 2>/dev/null
|
|
||||||
|
|
||||||
for plugin in $fetch_plugins
|
|
||||||
if set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] && test ! -e $source
|
|
||||||
if set --local index (contains --index -- "$plugin" $install_plugins)
|
|
||||||
set --erase install_plugins[$index]
|
|
||||||
else
|
|
||||||
set --erase update_plugins[(contains --index -- "$plugin" $update_plugins)]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for plugin in $update_plugins $remove_plugins
|
|
||||||
if set --local index (contains --index -- "$plugin" $_fisher_plugins)
|
|
||||||
set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
|
|
||||||
|
|
||||||
if contains -- "$plugin" $remove_plugins
|
|
||||||
for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
|
||||||
emit {$name}_uninstall
|
|
||||||
end
|
|
||||||
printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~
|
|
||||||
set --erase _fisher_plugins[$index]
|
|
||||||
end
|
|
||||||
|
|
||||||
command rm -rf (string replace -- \~ ~ $$plugin_files_var)
|
|
||||||
|
|
||||||
functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
|
||||||
|
|
||||||
for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
|
||||||
complete --erase --command $name
|
|
||||||
end
|
|
||||||
|
|
||||||
set --erase $plugin_files_var
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if set --query update_plugins[1] || set --query install_plugins[1]
|
|
||||||
command mkdir -p $fisher_path/{functions,themes,conf.d,completions}
|
|
||||||
end
|
|
||||||
|
|
||||||
for plugin in $update_plugins $install_plugins
|
|
||||||
set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)]
|
|
||||||
set --local files $source/{functions,themes,conf.d,completions}/*
|
|
||||||
|
|
||||||
if set --local index (contains --index -- $plugin $install_plugins)
|
|
||||||
set --local user_files $fisher_path/{functions,themes,conf.d,completions}/*
|
|
||||||
set --local conflict_files
|
|
||||||
|
|
||||||
for file in (string replace -- $source/ $fisher_path/ $files)
|
|
||||||
contains -- $file $user_files && set --append conflict_files $file
|
|
||||||
end
|
|
||||||
|
|
||||||
if set --query conflict_files[1] && set --erase install_plugins[$index]
|
|
||||||
echo -s "fisher: Cannot install \"$plugin\": please remove or move conflicting files first:" \n" "$conflict_files >&2
|
|
||||||
continue
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for file in (string replace -- $source/ "" $files)
|
|
||||||
command cp -RLf $source/$file $fisher_path/$file
|
|
||||||
end
|
|
||||||
|
|
||||||
set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
|
|
||||||
|
|
||||||
set --query files[1] && set --universal $plugin_files_var (string replace -- $source $fisher_path $files | string replace -- ~ \~)
|
|
||||||
|
|
||||||
contains -- $plugin $_fisher_plugins || set --universal --append _fisher_plugins $plugin
|
|
||||||
contains -- $plugin $install_plugins && set --local event install || set --local event update
|
|
||||||
|
|
||||||
printf "%s\n" Installing\ (set_color --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~
|
|
||||||
|
|
||||||
for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var | string replace -- \~ ~)
|
|
||||||
source $file
|
|
||||||
if set --local name (string replace --regex -- '.+conf\.d/([^/]+)\.fish$' '$1' $file)
|
|
||||||
emit {$name}_$event
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
command rm -rf $source_plugins
|
|
||||||
|
|
||||||
if set --query _fisher_plugins[1]
|
|
||||||
set --local commit_plugins
|
|
||||||
|
|
||||||
for plugin in $file_plugins
|
|
||||||
contains -- (string lower -- $plugin) (string lower -- $_fisher_plugins) && set --append commit_plugins $plugin
|
|
||||||
end
|
|
||||||
|
|
||||||
for plugin in $_fisher_plugins
|
|
||||||
contains -- (string lower -- $plugin) (string lower -- $commit_plugins) || set --append commit_plugins $plugin
|
|
||||||
end
|
|
||||||
|
|
||||||
printf "%s\n" $commit_plugins >$fish_plugins
|
|
||||||
else
|
|
||||||
set --erase _fisher_plugins
|
|
||||||
command rm -f $fish_plugins
|
|
||||||
end
|
|
||||||
|
|
||||||
set --local total (count $install_plugins) (count $update_plugins) (count $remove_plugins)
|
|
||||||
|
|
||||||
test "$total" != "0 0 0" && echo (string join ", " (
|
|
||||||
test $total[1] = 0 || echo "Installed $total[1]") (
|
|
||||||
test $total[2] = 0 || echo "Updated $total[2]") (
|
|
||||||
test $total[3] = 0 || echo "Removed $total[3]")
|
|
||||||
) plugin/s
|
|
||||||
case \*
|
|
||||||
echo "fisher: Unknown command: \"$cmd\"" >&2 && return 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if ! set --query _fisher_upgraded_to_4_4
|
|
||||||
set --universal _fisher_upgraded_to_4_4
|
|
||||||
if functions --query _fisher_list
|
|
||||||
set --query XDG_DATA_HOME[1] || set --local XDG_DATA_HOME ~/.local/share
|
|
||||||
command rm -rf $XDG_DATA_HOME/fisher
|
|
||||||
functions --erase _fisher_{list,plugin_parse}
|
|
||||||
fisher update >/dev/null 2>/dev/null
|
|
||||||
else
|
|
||||||
for var in (set --names | string match --entire --regex '^_fisher_.+_files$')
|
|
||||||
set $var (string replace -- ~ \~ $$var)
|
|
||||||
end
|
|
||||||
functions --erase _fisher_fish_postexec
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,46 +0,0 @@
|
||||||
# Always installs bindings for insert and default mode for simplicity and b/c it has almost no side-effect
|
|
||||||
# https://gitter.im/fish-shell/fish-shell?at=60a55915ee77a74d685fa6b1
|
|
||||||
function fzf_configure_bindings --description "Installs the default key bindings for fzf.fish with user overrides passed as options."
|
|
||||||
# no need to install bindings if not in interactive mode or running tests
|
|
||||||
status is-interactive || test "$CI" = true; or return
|
|
||||||
|
|
||||||
set -f options_spec h/help 'directory=?' 'git_log=?' 'git_status=?' 'history=?' 'processes=?' 'variables=?'
|
|
||||||
argparse --max-args=0 --ignore-unknown $options_spec -- $argv 2>/dev/null
|
|
||||||
if test $status -ne 0
|
|
||||||
echo "Invalid option or a positional argument was provided." >&2
|
|
||||||
_fzf_configure_bindings_help
|
|
||||||
return 22
|
|
||||||
else if set --query _flag_help
|
|
||||||
_fzf_configure_bindings_help
|
|
||||||
return
|
|
||||||
else
|
|
||||||
# Initialize with default key sequences and then override or disable them based on flags
|
|
||||||
# index 1 = directory, 2 = git_log, 3 = git_status, 4 = history, 5 = processes, 6 = variables
|
|
||||||
set -f key_sequences \e\cf \e\cl \e\cs \cr \e\cp \cv # \c = control, \e = escape
|
|
||||||
set --query _flag_directory && set key_sequences[1] "$_flag_directory"
|
|
||||||
set --query _flag_git_log && set key_sequences[2] "$_flag_git_log"
|
|
||||||
set --query _flag_git_status && set key_sequences[3] "$_flag_git_status"
|
|
||||||
set --query _flag_history && set key_sequences[4] "$_flag_history"
|
|
||||||
set --query _flag_processes && set key_sequences[5] "$_flag_processes"
|
|
||||||
set --query _flag_variables && set key_sequences[6] "$_flag_variables"
|
|
||||||
|
|
||||||
# If fzf bindings already exists, uninstall it first for a clean slate
|
|
||||||
if functions --query _fzf_uninstall_bindings
|
|
||||||
_fzf_uninstall_bindings
|
|
||||||
end
|
|
||||||
|
|
||||||
for mode in default insert
|
|
||||||
test -n $key_sequences[1] && bind --mode $mode $key_sequences[1] _fzf_search_directory
|
|
||||||
test -n $key_sequences[2] && bind --mode $mode $key_sequences[2] _fzf_search_git_log
|
|
||||||
test -n $key_sequences[3] && bind --mode $mode $key_sequences[3] _fzf_search_git_status
|
|
||||||
test -n $key_sequences[4] && bind --mode $mode $key_sequences[4] _fzf_search_history
|
|
||||||
test -n $key_sequences[5] && bind --mode $mode $key_sequences[5] _fzf_search_processes
|
|
||||||
test -n $key_sequences[6] && bind --mode $mode $key_sequences[6] "$_fzf_search_vars_command"
|
|
||||||
end
|
|
||||||
|
|
||||||
function _fzf_uninstall_bindings --inherit-variable key_sequences
|
|
||||||
bind --erase -- $key_sequences
|
|
||||||
bind --erase --mode insert -- $key_sequences
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,30 +0,0 @@
|
||||||
# name: 'Catppuccin frappe'
|
|
||||||
# url: 'https://github.com/catppuccin/fish'
|
|
||||||
# preferred_background: 303446
|
|
||||||
|
|
||||||
fish_color_normal c6d0f5
|
|
||||||
fish_color_command 8caaee
|
|
||||||
fish_color_param eebebe
|
|
||||||
fish_color_keyword e78284
|
|
||||||
fish_color_quote a6d189
|
|
||||||
fish_color_redirection f4b8e4
|
|
||||||
fish_color_end ef9f76
|
|
||||||
fish_color_comment 838ba7
|
|
||||||
fish_color_error e78284
|
|
||||||
fish_color_gray 737994
|
|
||||||
fish_color_selection --background=414559
|
|
||||||
fish_color_search_match --background=414559
|
|
||||||
fish_color_option a6d189
|
|
||||||
fish_color_operator f4b8e4
|
|
||||||
fish_color_escape ea999c
|
|
||||||
fish_color_autosuggestion 737994
|
|
||||||
fish_color_cancel e78284
|
|
||||||
fish_color_cwd e5c890
|
|
||||||
fish_color_user 81c8be
|
|
||||||
fish_color_host 8caaee
|
|
||||||
fish_color_host_remote a6d189
|
|
||||||
fish_color_status e78284
|
|
||||||
fish_pager_color_progress 737994
|
|
||||||
fish_pager_color_prefix f4b8e4
|
|
||||||
fish_pager_color_completion c6d0f5
|
|
||||||
fish_pager_color_description 737994
|
|
|
@ -1,30 +0,0 @@
|
||||||
# name: 'Catppuccin latte'
|
|
||||||
# url: 'https://github.com/catppuccin/fish'
|
|
||||||
# preferred_background: eff1f5
|
|
||||||
|
|
||||||
fish_color_normal 4c4f69
|
|
||||||
fish_color_command 1e66f5
|
|
||||||
fish_color_param dd7878
|
|
||||||
fish_color_keyword d20f39
|
|
||||||
fish_color_quote 40a02b
|
|
||||||
fish_color_redirection ea76cb
|
|
||||||
fish_color_end fe640b
|
|
||||||
fish_color_comment 8c8fa1
|
|
||||||
fish_color_error d20f39
|
|
||||||
fish_color_gray 9ca0b0
|
|
||||||
fish_color_selection --background=ccd0da
|
|
||||||
fish_color_search_match --background=ccd0da
|
|
||||||
fish_color_option 40a02b
|
|
||||||
fish_color_operator ea76cb
|
|
||||||
fish_color_escape e64553
|
|
||||||
fish_color_autosuggestion 9ca0b0
|
|
||||||
fish_color_cancel d20f39
|
|
||||||
fish_color_cwd df8e1d
|
|
||||||
fish_color_user 179299
|
|
||||||
fish_color_host_remote 40a02b
|
|
||||||
fish_color_host 1e66f5
|
|
||||||
fish_color_status d20f39
|
|
||||||
fish_pager_color_progress 9ca0b0
|
|
||||||
fish_pager_color_prefix ea76cb
|
|
||||||
fish_pager_color_completion 4c4f69
|
|
||||||
fish_pager_color_description 9ca0b0
|
|
|
@ -1,30 +0,0 @@
|
||||||
# name: 'Catppuccin macchiato'
|
|
||||||
# url: 'https://github.com/catppuccin/fish'
|
|
||||||
# preferred_background: 24273a
|
|
||||||
|
|
||||||
fish_color_normal cad3f5
|
|
||||||
fish_color_command 8aadf4
|
|
||||||
fish_color_param f0c6c6
|
|
||||||
fish_color_keyword ed8796
|
|
||||||
fish_color_quote a6da95
|
|
||||||
fish_color_redirection f5bde6
|
|
||||||
fish_color_end f5a97f
|
|
||||||
fish_color_comment 8087a2
|
|
||||||
fish_color_error ed8796
|
|
||||||
fish_color_gray 6e738d
|
|
||||||
fish_color_selection --background=363a4f
|
|
||||||
fish_color_search_match --background=363a4f
|
|
||||||
fish_color_option a6da95
|
|
||||||
fish_color_operator f5bde6
|
|
||||||
fish_color_escape ee99a0
|
|
||||||
fish_color_autosuggestion 6e738d
|
|
||||||
fish_color_cancel ed8796
|
|
||||||
fish_color_cwd eed49f
|
|
||||||
fish_color_user 8bd5ca
|
|
||||||
fish_color_host 8aadf4
|
|
||||||
fish_color_host_remote a6da95
|
|
||||||
fish_color_status ed8796
|
|
||||||
fish_pager_color_progress 6e738d
|
|
||||||
fish_pager_color_prefix f5bde6
|
|
||||||
fish_pager_color_completion cad3f5
|
|
||||||
fish_pager_color_description 6e738d
|
|
|
@ -1,30 +0,0 @@
|
||||||
# name: 'Catppuccin mocha'
|
|
||||||
# url: 'https://github.com/catppuccin/fish'
|
|
||||||
# preferred_background: 1e1e2e
|
|
||||||
|
|
||||||
fish_color_normal cdd6f4
|
|
||||||
fish_color_command 89b4fa
|
|
||||||
fish_color_param f2cdcd
|
|
||||||
fish_color_keyword f38ba8
|
|
||||||
fish_color_quote a6e3a1
|
|
||||||
fish_color_redirection f5c2e7
|
|
||||||
fish_color_end fab387
|
|
||||||
fish_color_comment 7f849c
|
|
||||||
fish_color_error f38ba8
|
|
||||||
fish_color_gray 6c7086
|
|
||||||
fish_color_selection --background=313244
|
|
||||||
fish_color_search_match --background=313244
|
|
||||||
fish_color_option a6e3a1
|
|
||||||
fish_color_operator f5c2e7
|
|
||||||
fish_color_escape eba0ac
|
|
||||||
fish_color_autosuggestion 6c7086
|
|
||||||
fish_color_cancel f38ba8
|
|
||||||
fish_color_cwd f9e2af
|
|
||||||
fish_color_user 94e2d5
|
|
||||||
fish_color_host 89b4fa
|
|
||||||
fish_color_host_remote a6e3a1
|
|
||||||
fish_color_status f38ba8
|
|
||||||
fish_pager_color_progress 6c7086
|
|
||||||
fish_pager_color_prefix f5c2e7
|
|
||||||
fish_pager_color_completion cdd6f4
|
|
||||||
fish_pager_color_description 6c7086
|
|
Loading…
Reference in a new issue