mirror of
https://github.com/cupcakearmy/dotfiles.git
synced 2024-12-22 16:26:32 +00:00
add z
This commit is contained in:
parent
dce5503eb9
commit
89d80b1698
63
files/fish/conf.d/z.fish
Normal file
63
files/fish/conf.d/z.fish
Normal file
@ -0,0 +1,63 @@
|
||||
if test -z "$Z_DATA"
|
||||
if test -z "$XDG_DATA_HOME"
|
||||
set -U Z_DATA_DIR "$HOME/.local/share/z"
|
||||
else
|
||||
set -U Z_DATA_DIR "$XDG_DATA_HOME/z"
|
||||
end
|
||||
set -U Z_DATA "$Z_DATA_DIR/data"
|
||||
end
|
||||
|
||||
if test ! -e "$Z_DATA"
|
||||
if test ! -e "$Z_DATA_DIR"
|
||||
mkdir -p -m 700 "$Z_DATA_DIR"
|
||||
end
|
||||
touch "$Z_DATA"
|
||||
end
|
||||
|
||||
if test -z "$Z_CMD"
|
||||
set -U Z_CMD z
|
||||
end
|
||||
|
||||
set -U ZO_CMD "$Z_CMD"o
|
||||
|
||||
if test ! -z $Z_CMD
|
||||
function $Z_CMD -d "jump around"
|
||||
__z $argv
|
||||
end
|
||||
end
|
||||
|
||||
if test ! -z $ZO_CMD
|
||||
function $ZO_CMD -d "open target dir"
|
||||
__z -d $argv
|
||||
end
|
||||
end
|
||||
|
||||
if not set -q Z_EXCLUDE
|
||||
set -U Z_EXCLUDE "^$HOME\$"
|
||||
else if contains $HOME $Z_EXCLUDE
|
||||
# Workaround: migrate old default values to a regex (see #90).
|
||||
set Z_EXCLUDE (string replace -r -- "^$HOME\$" '^'$HOME'$$' $Z_EXCLUDE)
|
||||
end
|
||||
|
||||
# Setup completions once first
|
||||
__z_complete
|
||||
|
||||
function __z_on_variable_pwd --on-variable PWD
|
||||
__z_add
|
||||
end
|
||||
|
||||
function __z_uninstall --on-event z_uninstall
|
||||
functions -e __z_on_variable_pwd
|
||||
functions -e $Z_CMD
|
||||
functions -e $ZO_CMD
|
||||
|
||||
if test ! -z "$Z_DATA"
|
||||
printf "To completely erase z's data, remove:\n" >/dev/stderr
|
||||
printf "%s\n" "$Z_DATA" >/dev/stderr
|
||||
end
|
||||
|
||||
set -e Z_CMD
|
||||
set -e ZO_CMD
|
||||
set -e Z_DATA
|
||||
set -e Z_EXCLUDE
|
||||
end
|
@ -1,3 +1,4 @@
|
||||
jorgebucaran/nvm.fish
|
||||
jorgebucaran/fisher
|
||||
ilancosman/tide@v5
|
||||
jethrokuan/z
|
||||
|
@ -1,19 +1,25 @@
|
||||
# This file contains fish universal variable definitions.
|
||||
# VERSION: 3.0
|
||||
SETUVAR VIRTUAL_ENV_DISABLE_PROMPT:true
|
||||
SETUVAR ZO_CMD:zo
|
||||
SETUVAR Z_CMD:z
|
||||
SETUVAR Z_DATA:/Users/niccoloborgioli/\x2elocal/share/z/data
|
||||
SETUVAR Z_DATA_DIR:/Users/niccoloborgioli/\x2elocal/share/z
|
||||
SETUVAR Z_EXCLUDE:\x5e/Users/niccoloborgioli\x24
|
||||
SETUVAR __fish_initialized:3400
|
||||
SETUVAR _fisher_ilancosman_2F_tide_40_v5_files:\x7e/\x2econfig/fish/functions/_tide_1_line_prompt\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_2_line_prompt\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_cache_variables\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_detect_os\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_find_and_remove\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_aws\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_character\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_chruby\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_cmd_duration\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_context\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_crystal\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_docker\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_git\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_go\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_java\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_jobs\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_kubectl\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_nix_shell\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_node\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_os\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_php\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_private_mode\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_rustc\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_shlvl\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_status\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_terraform\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_time\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_toolbox\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_vi_mode\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_item_virtual_env\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_parent_dirs\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_print_item\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_pwd\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_remove_unusable_items\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_sub_bug\x2dreport\x2efish\x1e\x7e/\x2econfig/fish/functions/_tide_sub_configure\x2efish\x1e\x7e/\x2econfig/fish/functions/fish_mode_prompt\x2efish\x1e\x7e/\x2econfig/fish/functions/fish_prompt\x2efish\x1e\x7e/\x2econfig/fish/functions/tide\x1e\x7e/\x2econfig/fish/functions/tide\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/_tide_init\x2efish\x1e\x7e/\x2econfig/fish/completions/tide\x2efish
|
||||
SETUVAR _fisher_jethrokuan_2F_z_files:\x7e/\x2econfig/fish/functions/__z\x2efish\x1e\x7e/\x2econfig/fish/functions/__z_add\x2efish\x1e\x7e/\x2econfig/fish/functions/__z_clean\x2efish\x1e\x7e/\x2econfig/fish/functions/__z_complete\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/z\x2efish
|
||||
SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\x2efish
|
||||
SETUVAR _fisher_jorgebucaran_2F_nvm_2E_fish_files:\x7e/\x2econfig/fish/functions/_nvm_index_update\x2efish\x1e\x7e/\x2econfig/fish/functions/_nvm_list\x2efish\x1e\x7e/\x2econfig/fish/functions/_nvm_version_activate\x2efish\x1e\x7e/\x2econfig/fish/functions/_nvm_version_deactivate\x2efish\x1e\x7e/\x2econfig/fish/functions/nvm\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/nvm\x2efish\x1e\x7e/\x2econfig/fish/completions/nvm\x2efish
|
||||
SETUVAR _fisher_plugins:jorgebucaran/nvm\x2efish\x1ejorgebucaran/fisher\x1eilancosman/tide\x40v5
|
||||
SETUVAR _fisher_plugins:jorgebucaran/nvm\x2efish\x1ejorgebucaran/fisher\x1eilancosman/tide\x40v5\x1ejethrokuan/z
|
||||
SETUVAR _fisher_upgraded_to_4_4:\x1d
|
||||
SETUVAR _tide_left_items:vi_mode\x1eos\x1epwd\x1egit\x1enewline
|
||||
SETUVAR _tide_prompt_38767:\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\ue0b6\x1b\x5b38\x3b2\x3b214\x3b214\x3b214m\x1b\x5b48\x3b2\x3b51\x3b51\x3b51m\x20\uf179\x20\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\ue0b4\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\x20\x40PWD\x40\x20\x1b\x5b38\x3b2\x3b52\x3b101\x3b164m\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\ue0b4\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\x20\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\uf1d3\x20\x1b\x5b37m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0mmain\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\u21e32\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\x211\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b196\x3b160\x3b0m\ue0b4\x1e\x1e\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b204\x3b0\x3b0m\ue0b6\x1b\x5b38\x3b2\x3b255\x3b255\x3b0m\x1b\x5b48\x3b2\x3b204\x3b0\x3b0m\x20\u2718\x201\x20\x1b\x5b38\x3b2\x3b196\x3b160\x3b0m\x1b\x5b48\x3b2\x3b204\x3b0\x3b0m\ue0b6\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\x20\uf252\x207s\x20\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\ue0b6\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b48\x3b2\x3b211\x3b215\x3b207m\x2013\x3a34\x3a54\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\ue0b4
|
||||
SETUVAR _tide_prompt_44117:\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\ue0b6\x1b\x5b38\x3b2\x3b214\x3b214\x3b214m\x1b\x5b48\x3b2\x3b51\x3b51\x3b51m\x20\uf179\x20\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\ue0b4\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\x20\x40PWD\x40\x20\x1b\x5b38\x3b2\x3b52\x3b101\x3b164m\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\ue0b4\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\x20\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\uf1d3\x20\x1b\x5b37m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0mmain\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\u21e34\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\x2a1\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\x211\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b196\x3b160\x3b0m\ue0b4\x1e\x1e\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b204\x3b0\x3b0m\ue0b6\x1b\x5b38\x3b2\x3b255\x3b255\x3b0m\x1b\x5b48\x3b2\x3b204\x3b0\x3b0m\x20\u2718\x201\x20\x1b\x5b38\x3b2\x3b196\x3b160\x3b0m\x1b\x5b48\x3b2\x3b204\x3b0\x3b0m\ue0b6\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\x20\uf252\x204m\x2055s\x20\x1b\x5b38\x3b2\x3b68\x3b136\x3b62m\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\ue0b6\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b48\x3b2\x3b68\x3b136\x3b62m\x20\u2b22\x2018\x2e14\x2e1\x20\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\x1b\x5b48\x3b2\x3b68\x3b136\x3b62m\ue0b6\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b48\x3b2\x3b211\x3b215\x3b207m\x2013\x3a34\x3a54\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\ue0b4
|
||||
SETUVAR _tide_prompt_56860:\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\ue0b6\x1b\x5b38\x3b2\x3b214\x3b214\x3b214m\x1b\x5b48\x3b2\x3b51\x3b51\x3b51m\x20\uf179\x20\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\ue0b4\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\x20\x40PWD\x40\x20\x1b\x5b38\x3b2\x3b52\x3b101\x3b164m\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\ue0b4\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\x20\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\uf1d3\x20\x1b\x5b37m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0mmain\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\x2a1\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\x2111\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\x3f49\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b196\x3b160\x3b0m\ue0b4\x1e\x1e\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b46\x3b52\x3b54m\ue0b6\x1b\x5b38\x3b2\x3b78\x3b154\x3b6m\x1b\x5b48\x3b2\x3b46\x3b52\x3b54m\x20\u2714\x20\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\x1b\x5b48\x3b2\x3b46\x3b52\x3b54m\ue0b6\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b48\x3b2\x3b211\x3b215\x3b207m\x2013\x3a45\x3a12\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\ue0b4
|
||||
SETUVAR _tide_prompt_57925:\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\ue0b6\x1b\x5b38\x3b2\x3b214\x3b214\x3b214m\x1b\x5b48\x3b2\x3b51\x3b51\x3b51m\x20\uf179\x20\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\ue0b4\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\x20\x40PWD\x40\x20\x1b\x5b38\x3b2\x3b52\x3b101\x3b164m\x1b\x5b48\x3b2\x3b78\x3b154\x3b6m\ue0b4\x1b\x5b48\x3b2\x3b78\x3b154\x3b6m\x20\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\uf1d3\x20\x1b\x5b37m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0mmaster\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b78\x3b154\x3b6m\ue0b4\x1e\x1e\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b46\x3b52\x3b54m\ue0b6\x1b\x5b38\x3b2\x3b78\x3b154\x3b6m\x1b\x5b48\x3b2\x3b46\x3b52\x3b54m\x20\u2714\x20\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\x1b\x5b48\x3b2\x3b46\x3b52\x3b54m\ue0b6\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b48\x3b2\x3b211\x3b215\x3b207m\x2013\x3a29\x3a47\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\ue0b4
|
||||
SETUVAR _tide_prompt_58309:\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\ue0b6\x1b\x5b38\x3b2\x3b214\x3b214\x3b214m\x1b\x5b48\x3b2\x3b51\x3b51\x3b51m\x20\uf179\x20\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\ue0b4\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\x20\x40PWD\x40\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b52\x3b101\x3b164m\ue0b4\x1e\x1e\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b46\x3b52\x3b54m\ue0b6\x1b\x5b38\x3b2\x3b78\x3b154\x3b6m\x1b\x5b48\x3b2\x3b46\x3b52\x3b54m\x20\u2714\x20\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\x1b\x5b48\x3b2\x3b46\x3b52\x3b54m\ue0b6\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b48\x3b2\x3b211\x3b215\x3b207m\x2013\x3a32\x3a17\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\ue0b4
|
||||
SETUVAR _tide_right_items:status\x1ecmd_duration\x1econtext\x1ejobs\x1enode\x1evirtual_env\x1erustc\x1ejava\x1ego\x1ekubectl\x1etime
|
||||
SETUVAR _tide_prompt_38767:\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\ue0b6\x1b\x5b38\x3b2\x3b214\x3b214\x3b214m\x1b\x5b48\x3b2\x3b51\x3b51\x3b51m\x20\uf179\x20\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\ue0b4\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\x20\x40PWD\x40\x20\x1b\x5b38\x3b2\x3b52\x3b101\x3b164m\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\ue0b4\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\x20\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\uf1d3\x20\x1b\x5b37m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0mmain\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\x211\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\x3f1\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b196\x3b160\x3b0m\ue0b4\x1e\x1e\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b46\x3b52\x3b54m\ue0b6\x1b\x5b38\x3b2\x3b78\x3b154\x3b6m\x1b\x5b48\x3b2\x3b46\x3b52\x3b54m\x20\u2714\x20\x1b\x5b38\x3b2\x3b196\x3b160\x3b0m\x1b\x5b48\x3b2\x3b46\x3b52\x3b54m\ue0b6\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\x20\uf252\x204m\x2049s\x20\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\ue0b6\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b48\x3b2\x3b211\x3b215\x3b207m\x2014\x3a50\x3a16\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\ue0b4
|
||||
SETUVAR _tide_prompt_62400:\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\ue0b6\x1b\x5b38\x3b2\x3b214\x3b214\x3b214m\x1b\x5b48\x3b2\x3b51\x3b51\x3b51m\x20\uf179\x20\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\ue0b4\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\x20\x40PWD\x40\x20\x1b\x5b38\x3b2\x3b52\x3b101\x3b164m\x1b\x5b48\x3b2\x3b78\x3b154\x3b6m\ue0b4\x1b\x5b48\x3b2\x3b78\x3b154\x3b6m\x20\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\uf1d3\x20\x1b\x5b37m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0mmain\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\u21e33\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\x2a1\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b78\x3b154\x3b6m\ue0b4\x1e\x1e\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b46\x3b52\x3b54m\ue0b6\x1b\x5b38\x3b2\x3b78\x3b154\x3b6m\x1b\x5b48\x3b2\x3b46\x3b52\x3b54m\x20\u2714\x20\x1b\x5b38\x3b2\x3b196\x3b160\x3b0m\x1b\x5b48\x3b2\x3b46\x3b52\x3b54m\ue0b6\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\x20\uf252\x202h\x2016m\x2034s\x20\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\ue0b6\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b48\x3b2\x3b211\x3b215\x3b207m\x2016\x3a18\x3a14\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\ue0b4
|
||||
SETUVAR _tide_prompt_74195:\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\ue0b6\x1b\x5b38\x3b2\x3b214\x3b214\x3b214m\x1b\x5b48\x3b2\x3b51\x3b51\x3b51m\x20\uf179\x20\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\ue0b4\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\x20\x40PWD\x40\x20\x1b\x5b38\x3b2\x3b52\x3b101\x3b164m\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\ue0b4\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\x20\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\uf1d3\x20\x1b\x5b37m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0mmain\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\x211\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\x3f1\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b196\x3b160\x3b0m\ue0b4\x1e\x1e\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b204\x3b0\x3b0m\ue0b6\x1b\x5b38\x3b2\x3b255\x3b255\x3b0m\x1b\x5b48\x3b2\x3b204\x3b0\x3b0m\x20\u2718\x20INT\x20\x1b\x5b38\x3b2\x3b196\x3b160\x3b0m\x1b\x5b48\x3b2\x3b204\x3b0\x3b0m\ue0b6\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\x20\uf252\x206m\x2025s\x20\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\x1b\x5b48\x3b2\x3b196\x3b160\x3b0m\ue0b6\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b48\x3b2\x3b211\x3b215\x3b207m\x2014\x3a46\x3a44\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\ue0b4
|
||||
SETUVAR _tide_prompt_89024:\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\ue0b6\x1b\x5b38\x3b2\x3b214\x3b214\x3b214m\x1b\x5b48\x3b2\x3b51\x3b51\x3b51m\x20\uf179\x20\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\ue0b4\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\x20\x40PWD\x40\x20\x1b\x5b38\x3b2\x3b52\x3b101\x3b164m\x1b\x5b48\x3b2\x3b78\x3b154\x3b6m\ue0b4\x1b\x5b48\x3b2\x3b78\x3b154\x3b6m\x20\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\uf1d3\x20\x1b\x5b37m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0mmain\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\x2a1\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b78\x3b154\x3b6m\ue0b4\x1e\x1e\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b46\x3b52\x3b54m\ue0b6\x1b\x5b38\x3b2\x3b78\x3b154\x3b6m\x1b\x5b48\x3b2\x3b46\x3b52\x3b54m\x20\u2714\x20\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\x1b\x5b48\x3b2\x3b46\x3b52\x3b54m\ue0b6\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b48\x3b2\x3b211\x3b215\x3b207m\x2019\x3a16\x3a58\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\ue0b4
|
||||
SETUVAR _tide_prompt_96527:\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\ue0b6\x1b\x5b38\x3b2\x3b214\x3b214\x3b214m\x1b\x5b48\x3b2\x3b51\x3b51\x3b51m\x20\uf179\x20\x1b\x5b38\x3b2\x3b51\x3b51\x3b51m\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\ue0b4\x1b\x5b48\x3b2\x3b52\x3b101\x3b164m\x20\x40PWD\x40\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b52\x3b101\x3b164m\ue0b4\x1e\x1e\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b46\x3b52\x3b54m\ue0b6\x1b\x5b38\x3b2\x3b78\x3b154\x3b6m\x1b\x5b48\x3b2\x3b46\x3b52\x3b54m\x20\u2714\x20\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\x1b\x5b48\x3b2\x3b46\x3b52\x3b54m\ue0b6\x1b\x5b38\x3b2\x3b0\x3b0\x3b0m\x1b\x5b48\x3b2\x3b211\x3b215\x3b207m\x2019\x3a13\x3a47\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b38\x3b2\x3b211\x3b215\x3b207m\ue0b4
|
||||
SETUVAR _tide_right_items:status\x1ecmd_duration\x1econtext\x1ejobs\x1evirtual_env\x1erustc\x1ejava\x1ego\x1ekubectl\x1etime
|
||||
SETUVAR fish_color_autosuggestion:555\x1ebrblack
|
||||
SETUVAR fish_color_cancel:\x2dr
|
||||
SETUVAR fish_color_command:005fd7
|
||||
|
174
files/fish/functions/__z.fish
Normal file
174
files/fish/functions/__z.fish
Normal file
@ -0,0 +1,174 @@
|
||||
function __z -d "Jump to a recent directory."
|
||||
function __print_help -d "Print z help."
|
||||
printf "Usage: $Z_CMD [-celrth] string1 string2...\n\n"
|
||||
printf " -c --clean Removes directories that no longer exist from $Z_DATA\n"
|
||||
printf " -d --dir Opens matching directory using system file manager.\n"
|
||||
printf " -e --echo Prints best match, no cd\n"
|
||||
printf " -l --list List matches and scores, no cd\n"
|
||||
printf " -p --purge Delete all entries from $Z_DATA\n"
|
||||
printf " -r --rank Search by rank\n"
|
||||
printf " -t --recent Search by recency\n"
|
||||
printf " -x --delete Removes the current directory from $Z_DATA\n"
|
||||
printf " -h --help Print this help\n\n"
|
||||
end
|
||||
function __z_legacy_escape_regex
|
||||
# taken from escape_string_pcre2 in fish
|
||||
# used to provide compatibility with fish 2
|
||||
for c in (string split '' $argv)
|
||||
if contains $c (string split '' '.^$*+()?[{}\\|-]')
|
||||
printf \\
|
||||
end
|
||||
printf '%s' $c
|
||||
end
|
||||
end
|
||||
|
||||
set -l options h/help c/clean e/echo l/list p/purge r/rank t/recent d/directory x/delete
|
||||
|
||||
argparse $options -- $argv
|
||||
|
||||
if set -q _flag_help
|
||||
__print_help
|
||||
return 0
|
||||
else if set -q _flag_clean
|
||||
__z_clean
|
||||
printf "%s cleaned!\n" $Z_DATA
|
||||
return 0
|
||||
else if set -q _flag_purge
|
||||
echo >$Z_DATA
|
||||
printf "%s purged!\n" $Z_DATA
|
||||
return 0
|
||||
else if set -q _flag_delete
|
||||
sed -i -e "\:^$PWD|.*:d" $Z_DATA
|
||||
return 0
|
||||
end
|
||||
|
||||
set -l typ
|
||||
|
||||
if set -q _flag_rank
|
||||
set typ rank
|
||||
else if set -q _flag_recent
|
||||
set typ recent
|
||||
end
|
||||
|
||||
set -l z_script '
|
||||
function frecent(rank, time) {
|
||||
dx = t-time
|
||||
if( dx < 3600 ) return rank*4
|
||||
if( dx < 86400 ) return rank*2
|
||||
if( dx < 604800 ) return rank/2
|
||||
return rank/4
|
||||
}
|
||||
|
||||
function output(matches, best_match, common) {
|
||||
# list or return the desired directory
|
||||
if( list ) {
|
||||
cmd = "sort -nr"
|
||||
for( x in matches ) {
|
||||
if( matches[x] ) {
|
||||
printf "%-10s %s\n", matches[x], x | cmd
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if( common ) best_match = common
|
||||
print best_match
|
||||
}
|
||||
}
|
||||
|
||||
function common(matches) {
|
||||
# find the common root of a list of matches, if it exists
|
||||
for( x in matches ) {
|
||||
if( matches[x] && (!short || length(x) < length(short)) ) {
|
||||
short = x
|
||||
}
|
||||
}
|
||||
if( short == "/" ) return
|
||||
for( x in matches ) if( matches[x] && index(x, short) != 1 ) {
|
||||
return
|
||||
}
|
||||
return short
|
||||
}
|
||||
|
||||
BEGIN {
|
||||
hi_rank = ihi_rank = -9999999999
|
||||
}
|
||||
{
|
||||
if( typ == "rank" ) {
|
||||
rank = $2
|
||||
} else if( typ == "recent" ) {
|
||||
rank = $3 - t
|
||||
} else rank = frecent($2, $3)
|
||||
if( $1 ~ q ) {
|
||||
matches[$1] = rank
|
||||
} else if( tolower($1) ~ tolower(q) ) imatches[$1] = rank
|
||||
if( matches[$1] && matches[$1] > hi_rank ) {
|
||||
best_match = $1
|
||||
hi_rank = matches[$1]
|
||||
} else if( imatches[$1] && imatches[$1] > ihi_rank ) {
|
||||
ibest_match = $1
|
||||
ihi_rank = imatches[$1]
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
# prefer case sensitive
|
||||
if( best_match ) {
|
||||
output(matches, best_match, common(matches))
|
||||
} else if( ibest_match ) {
|
||||
output(imatches, ibest_match, common(imatches))
|
||||
}
|
||||
}
|
||||
'
|
||||
|
||||
set -l qs
|
||||
for arg in $argv
|
||||
set -l escaped $arg
|
||||
if string escape --style=regex '' >/dev/null 2>&1 # use builtin escape if available
|
||||
set escaped (string escape --style=regex $escaped)
|
||||
else
|
||||
set escaped (__z_legacy_escape_regex $escaped)
|
||||
end
|
||||
# Need to escape twice, see https://www.math.utah.edu/docs/info/gawk_5.html#SEC32
|
||||
set escaped (string replace --all \\ \\\\ $escaped)
|
||||
set qs $qs $escaped
|
||||
end
|
||||
set -l q (string join '.*' $qs)
|
||||
|
||||
if set -q _flag_list
|
||||
# Handle list separately as it can print common path information to stderr
|
||||
# which cannot be captured from a subcommand.
|
||||
command awk -v t=(date +%s) -v list="list" -v typ="$typ" -v q="$q" -F "|" $z_script "$Z_DATA"
|
||||
return
|
||||
end
|
||||
|
||||
set target (command awk -v t=(date +%s) -v typ="$typ" -v q="$q" -F "|" $z_script "$Z_DATA")
|
||||
|
||||
if test "$status" -gt 0
|
||||
return
|
||||
end
|
||||
|
||||
if test -z "$target"
|
||||
printf "'%s' did not match any results\n" "$argv"
|
||||
return 1
|
||||
end
|
||||
|
||||
if set -q _flag_echo
|
||||
printf "%s\n" "$target"
|
||||
else if set -q _flag_directory
|
||||
if test -n "$ZO_METHOD"
|
||||
type -q "$ZO_METHOD"; and "$ZO_METHOD" "$target"; and return $status
|
||||
echo "Cannot open with ZO_METHOD set to $ZO_METHOD"; and return 1
|
||||
else if test "$OS" = Windows_NT
|
||||
# Be careful, in msys2, explorer always return 1
|
||||
type -q explorer; and explorer "$target"
|
||||
return 0
|
||||
echo "Cannot open file explorer"
|
||||
return 1
|
||||
else
|
||||
type -q xdg-open; and xdg-open "$target"; and return $status
|
||||
type -q open; and open "$target"; and return $status
|
||||
echo "Not sure how to open file manager"; and return 1
|
||||
end
|
||||
else
|
||||
pushd "$target"
|
||||
end
|
||||
end
|
49
files/fish/functions/__z_add.fish
Normal file
49
files/fish/functions/__z_add.fish
Normal file
@ -0,0 +1,49 @@
|
||||
function __z_add -d "Add PATH to .z file"
|
||||
test -n "$fish_private_mode"; and return 0
|
||||
|
||||
for i in $Z_EXCLUDE
|
||||
if string match -r $i $PWD >/dev/null
|
||||
return 0 #Path excluded
|
||||
end
|
||||
end
|
||||
|
||||
set -l tmpfile (mktemp $Z_DATA.XXXXXX)
|
||||
|
||||
if test -f $tmpfile
|
||||
set -l path (string replace --all \\ \\\\ $PWD)
|
||||
command awk -v path=$path -v now=(date +%s) -F "|" '
|
||||
BEGIN {
|
||||
rank[path] = 1
|
||||
time[path] = now
|
||||
}
|
||||
$2 >= 1 {
|
||||
if( $1 == path ) {
|
||||
rank[$1] = $2 + 1
|
||||
time[$1] = now
|
||||
}
|
||||
else {
|
||||
rank[$1] = $2
|
||||
time[$1] = $3
|
||||
}
|
||||
count += $2
|
||||
}
|
||||
END {
|
||||
if( count > 1000 ) {
|
||||
for( i in rank ) print i "|" 0.9*rank[i] "|" time[i] # aging
|
||||
}
|
||||
else for( i in rank ) print i "|" rank[i] "|" time[i]
|
||||
}
|
||||
' $Z_DATA 2>/dev/null >$tmpfile
|
||||
|
||||
if test ! -z "$Z_OWNER"
|
||||
chown $Z_OWNER:(id -ng $Z_OWNER) $tmpfile
|
||||
end
|
||||
#
|
||||
# Don't use redirection here as it can lead to a race condition where $Z_DATA is clobbered.
|
||||
# Note: There is a still a possible race condition where an old version of $Z_DATA is
|
||||
# read by one instance of Fish before another instance of Fish writes its copy.
|
||||
#
|
||||
command mv $tmpfile $Z_DATA
|
||||
or command rm $tmpfile
|
||||
end
|
||||
end
|
11
files/fish/functions/__z_clean.fish
Normal file
11
files/fish/functions/__z_clean.fish
Normal file
@ -0,0 +1,11 @@
|
||||
function __z_clean -d "Clean up .z file to remove paths no longer valid"
|
||||
set -l tmpfile (mktemp $Z_DATA.XXXXXX)
|
||||
|
||||
if test -f $tmpfile
|
||||
while read line
|
||||
set -l path (string split '|' $line)[1]
|
||||
test -d $path; and echo $line
|
||||
end <$Z_DATA >$tmpfile
|
||||
command mv -f $tmpfile $Z_DATA
|
||||
end
|
||||
end
|
13
files/fish/functions/__z_complete.fish
Normal file
13
files/fish/functions/__z_complete.fish
Normal file
@ -0,0 +1,13 @@
|
||||
function __z_complete -d "add completions"
|
||||
complete -c $Z_CMD -a "(__z -l | string replace -r '^\\S*\\s*' '')" -f -k
|
||||
complete -c $ZO_CMD -a "(__z -l | string replace -r '^\\S*\\s*' '')" -f -k
|
||||
|
||||
complete -c $Z_CMD -s c -l clean -d "Cleans out $Z_DATA"
|
||||
complete -c $Z_CMD -s e -l echo -d "Prints best match, no cd"
|
||||
complete -c $Z_CMD -s l -l list -d "List matches, no cd"
|
||||
complete -c $Z_CMD -s p -l purge -d "Purges $Z_DATA"
|
||||
complete -c $Z_CMD -s r -l rank -d "Searches by rank, cd"
|
||||
complete -c $Z_CMD -s t -l recent -d "Searches by recency, cd"
|
||||
complete -c $Z_CMD -s h -l help -d "Print help"
|
||||
complete -c $Z_CMD -s x -l delete -d "Removes the current directory from $Z_DATA"
|
||||
end
|
Loading…
Reference in New Issue
Block a user