Reorganize files to use stow for installation #dotfiles
This commit is contained in:
1
fish/.config/fish/completions/a.fish
Normal file
1
fish/.config/fish/completions/a.fish
Normal file
@ -0,0 +1 @@
|
||||
complete -c a -a "(__fasd_print_completion -a)" -f
|
||||
70
fish/.config/fish/completions/asdf.bash
Normal file
70
fish/.config/fish/completions/asdf.bash
Normal file
@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
_asdf () {
|
||||
local cur
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
local cmd
|
||||
cmd=${COMP_WORDS[1]}
|
||||
local prev
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local plugins
|
||||
plugins=$(asdf plugin-list 2> /dev/null | tr '\n' ' ')
|
||||
|
||||
# We can safely ignore warning SC2207 since it warns that it will uses the
|
||||
# shell's sloppy word splitting and globbing. The possible commands here are
|
||||
# all single words, and most likely won't contain special chars the shell will
|
||||
# expand.
|
||||
COMPREPLY=()
|
||||
|
||||
case "$cmd" in
|
||||
plugin-update)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$plugins --all" -- "$cur"))
|
||||
;;
|
||||
plugin-remove|current|list|list-all)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$plugins" -- "$cur"))
|
||||
;;
|
||||
plugin-add)
|
||||
local available_plugins
|
||||
available_plugins=$( (asdf plugin-list 2> /dev/null && asdf plugin-list-all 2> /dev/null) | sort | uniq -u)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$available_plugins" -- "$cur"))
|
||||
;;
|
||||
install)
|
||||
if [[ "$plugins" == *"$prev"* ]] ; then
|
||||
local versions
|
||||
versions=$(asdf list-all "$prev" 2> /dev/null)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$versions" -- "$cur"))
|
||||
else
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$plugins" -- "$cur"))
|
||||
fi
|
||||
;;
|
||||
update)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "--head" -- "$cur"))
|
||||
;;
|
||||
uninstall|where|reshim|local|global)
|
||||
if [[ "$plugins" == *"$prev"* ]] ; then
|
||||
local versions
|
||||
versions=$(asdf list "$prev" 2> /dev/null)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$versions" -- "$cur"))
|
||||
else
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$plugins" -- "$cur"))
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
local cmds='current global help install list list-all local plugin-add plugin-list plugin-list-all plugin-remove plugin-update reshim uninstall update where which '
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$cmds" -- "$cur"))
|
||||
;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
complete -F _asdf asdf
|
||||
110
fish/.config/fish/completions/asdf.fish
Normal file
110
fish/.config/fish/completions/asdf.fish
Normal file
@ -0,0 +1,110 @@
|
||||
function __fish_asdf_needs_command
|
||||
set -l cmd (commandline -opc)
|
||||
if test (count $cmd) -eq 1
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
function __fish_asdf_using_command -a current_command
|
||||
set -l cmd (commandline -opc)
|
||||
if test (count $cmd) -gt 1
|
||||
if test $current_command = $cmd[2]
|
||||
return 0
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
function __fish_asdf_arg_number -a number
|
||||
set -l cmd (commandline -opc)
|
||||
test (count $cmd) -eq $number
|
||||
end
|
||||
|
||||
function __fish_asdf_arg_at -a number
|
||||
set -l cmd (commandline -opc)
|
||||
echo $cmd[$number]
|
||||
end
|
||||
|
||||
function __fish_asdf_list_versions -a plugin
|
||||
asdf list $plugin 2> /dev/null | sed -e 's/^\s*//'
|
||||
end
|
||||
|
||||
function __fish_asdf_list_all -a plugin
|
||||
asdf list-all $plugin 2> /dev/null
|
||||
end
|
||||
|
||||
function __fish_asdf_plugin_list
|
||||
asdf plugin-list 2> /dev/null
|
||||
end
|
||||
|
||||
function __fish_asdf_plugin_list_all
|
||||
asdf plugin-list-all 2> /dev/null
|
||||
end
|
||||
|
||||
# plugin-add completion
|
||||
complete -f -c asdf -n '__fish_asdf_needs_command' -a plugin-add -d "Add git repo as plugin"
|
||||
complete -f -c asdf -n '__fish_asdf_using_command plugin-add; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list_all | grep -v \'*\' | awk \'{ print $1 }\')'
|
||||
complete -f -c asdf -n '__fish_asdf_using_command plugin-add; and __fish_asdf_arg_number 3' -a '(__fish_asdf_plugin_list_all | grep (__fish_asdf_arg_at 3) | awk \'{ print $2 }\')'
|
||||
complete -f -c asdf -n '__fish_asdf_using_command plugin-add; and __fish_asdf_arg_number 4'
|
||||
|
||||
# plugin-list completion
|
||||
complete -f -c asdf -n '__fish_asdf_needs_command' -a plugin-list -d "List installed plugins"
|
||||
|
||||
# plugin-list-all completion
|
||||
complete -f -c asdf -n '__fish_asdf_needs_command' -a plugin-list-all -d "List all existing plugins"
|
||||
|
||||
# plugin-remove completion
|
||||
complete -f -c asdf -n '__fish_asdf_needs_command' -a plugin-remove -d "Remove plugin and package versions"
|
||||
complete -f -c asdf -n '__fish_asdf_using_command plugin-remove; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
|
||||
|
||||
# plugin-update completion
|
||||
complete -f -c asdf -n '__fish_asdf_needs_command' -a plugin-update -d "Update plugin"
|
||||
complete -f -c asdf -n '__fish_asdf_using_command plugin-update; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
|
||||
complete -f -c asdf -n '__fish_asdf_using_command plugin-update; and __fish_asdf_arg_number 2' -a --all
|
||||
|
||||
# install completion
|
||||
complete -f -c asdf -n '__fish_asdf_needs_command' -a install -d "Install a specific version of a package"
|
||||
complete -f -c asdf -n '__fish_asdf_using_command install; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
|
||||
complete -f -c asdf -n '__fish_asdf_using_command install; and __fish_asdf_arg_number 3' -a '(__fish_asdf_list_all (__fish_asdf_arg_at 3))'
|
||||
|
||||
# uninstall completion
|
||||
complete -f -c asdf -n '__fish_asdf_needs_command' -a uninstall -d "Remove a specific version of a package"
|
||||
complete -f -c asdf -n '__fish_asdf_using_command uninstall; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
|
||||
complete -f -c asdf -n '__fish_asdf_using_command uninstall; and __fish_asdf_arg_number 3' -a '(__fish_asdf_list_versions (__fish_asdf_arg_at 3))'
|
||||
|
||||
# current completion
|
||||
complete -f -c asdf -n '__fish_asdf_needs_command' -a current -d "Display version set or being used for package"
|
||||
complete -f -c asdf -n '__fish_asdf_using_command current; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
|
||||
|
||||
# where completion
|
||||
complete -f -c asdf -n '__fish_asdf_needs_command' -a where -d "Display install path for an installed version"
|
||||
complete -f -c asdf -n '__fish_asdf_using_command where; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
|
||||
complete -f -c asdf -n '__fish_asdf_using_command where; and __fish_asdf_arg_number 3' -a '(__fish_asdf_list_versions (__fish_asdf_arg_at 3))'
|
||||
|
||||
# list completion
|
||||
complete -f -c asdf -n '__fish_asdf_needs_command' -a list -d "List installed versions of a package"
|
||||
complete -f -c asdf -n '__fish_asdf_using_command list; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
|
||||
|
||||
# list-all completion
|
||||
complete -f -c asdf -n '__fish_asdf_needs_command' -a list-all -d "List all versions of a package"
|
||||
complete -f -c asdf -n '__fish_asdf_using_command list-all; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
|
||||
|
||||
# reshim completion
|
||||
complete -f -c asdf -n '__fish_asdf_needs_command' -a reshim -d "Recreate shims for version of a package"
|
||||
complete -f -c asdf -n '__fish_asdf_using_command reshim; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
|
||||
complete -f -c asdf -n '__fish_asdf_using_command reshim; and __fish_asdf_arg_number 3' -a '(__fish_asdf_list_versions (__fish_asdf_arg_at 3))'
|
||||
|
||||
# local completion
|
||||
complete -f -c asdf -n '__fish_asdf_needs_command' -a local -d "Set local version for a plugin"
|
||||
complete -f -c asdf -n '__fish_asdf_using_command local; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
|
||||
complete -f -c asdf -n '__fish_asdf_using_command local; and test (count (commandline -opc)) -gt 2' -a '(__fish_asdf_list_versions (__fish_asdf_arg_at 3)) system'
|
||||
|
||||
# global completion
|
||||
complete -f -c asdf -n '__fish_asdf_needs_command' -a global -d "Set global version for a plugin"
|
||||
complete -f -c asdf -n '__fish_asdf_using_command global; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
|
||||
complete -f -c asdf -n '__fish_asdf_using_command global; and test (count (commandline -opc)) -gt 2' -a '(__fish_asdf_list_versions (__fish_asdf_arg_at 3)) system'
|
||||
|
||||
# misc
|
||||
complete -f -c asdf -n '__fish_asdf_needs_command' -l "help" -d "Displays help"
|
||||
complete -f -c asdf -n '__fish_asdf_needs_command' -l "version" -d "Displays asdf version"
|
||||
1
fish/.config/fish/completions/d.fish
Normal file
1
fish/.config/fish/completions/d.fish
Normal file
@ -0,0 +1 @@
|
||||
complete -c d -a "(__fasd_print_completion -d)" -f
|
||||
1
fish/.config/fish/completions/f.fish
Normal file
1
fish/.config/fish/completions/f.fish
Normal file
@ -0,0 +1 @@
|
||||
complete -c f -a "(__fasd_print_completion -f)" -f
|
||||
18
fish/.config/fish/completions/fasd.fish
Normal file
18
fish/.config/fish/completions/fasd.fish
Normal file
@ -0,0 +1,18 @@
|
||||
# suggest paths
|
||||
complete -c fasd -a "(__fasd_print_completion)" -f
|
||||
|
||||
# suggest args
|
||||
complete -c fasd -s s -d "List all paths and scores" -f
|
||||
complete -c fasd -s l -d "List paths without scores" -f
|
||||
complete -c fasd -s i -d "Interactive mode" -f
|
||||
complete -c fasd -s e -a (echo subl atom) -d "Set command to execute on the result file" -f
|
||||
complete -c fasd -s b -a (echo spotlight viminfo recently-used current) -d "Only use given backend" -f
|
||||
complete -c fasd -s B -a (echo spotlight viminfo recently-used current) -d "Add additional backend" -f
|
||||
complete -c fasd -s a -d "Match files and directories" -f
|
||||
complete -c fasd -s d -d "Match directories only" -f
|
||||
complete -c fasd -s f -d "Match files only" -f
|
||||
complete -c fasd -s r -d "Match by rank only" -f
|
||||
complete -c fasd -s t -d "Match by recent access only" -f
|
||||
complete -c fasd -s R -d "Reverse listing order" -f
|
||||
complete -c fasd -s h -d "Show a brief help message" -f
|
||||
# complete -c fasd -s [0-9] "Select the nth entry"
|
||||
1
fish/.config/fish/completions/fisher.fish
Normal file
1
fish/.config/fish/completions/fisher.fish
Normal file
@ -0,0 +1 @@
|
||||
fisher self-complete
|
||||
1
fish/.config/fish/completions/s.fish
Normal file
1
fish/.config/fish/completions/s.fish
Normal file
@ -0,0 +1 @@
|
||||
complete -c s -a "(__fasd_print_completion)" -f
|
||||
1
fish/.config/fish/completions/sd.fish
Normal file
1
fish/.config/fish/completions/sd.fish
Normal file
@ -0,0 +1 @@
|
||||
complete -c sd -a "(__fasd_print_completion -d)" -f
|
||||
1
fish/.config/fish/completions/sf.fish
Normal file
1
fish/.config/fish/completions/sf.fish
Normal file
@ -0,0 +1 @@
|
||||
complete -c sf -a "(__fasd_print_completion -f)" -f
|
||||
1
fish/.config/fish/completions/z.fish
Normal file
1
fish/.config/fish/completions/z.fish
Normal file
@ -0,0 +1 @@
|
||||
complete -c z -a "(__fasd_print_completion -d)" -f
|
||||
1
fish/.config/fish/completions/zz.fish
Normal file
1
fish/.config/fish/completions/zz.fish
Normal file
@ -0,0 +1 @@
|
||||
complete -c zz -a "(__fasd_print_completion -d)" -f
|
||||
6
fish/.config/fish/conf.d/__fasd_run.fish
Normal file
6
fish/.config/fish/conf.d/__fasd_run.fish
Normal file
@ -0,0 +1,6 @@
|
||||
function __fasd_run -e fish_postexec -d "fasd takes record of the directories changed into"
|
||||
set -lx RETVAL $status
|
||||
if test $RETVAL -eq 0 # if there was no error
|
||||
command fasd --proc (command fasd --sanitize (eval echo "$argv") | tr -s " " \n) > "/dev/null" 2>&1 &
|
||||
end
|
||||
end
|
||||
3
fish/.config/fish/conf.d/aliases.fish
Normal file
3
fish/.config/fish/conf.d/aliases.fish
Normal file
@ -0,0 +1,3 @@
|
||||
# support oldschool autojump user
|
||||
alias j z
|
||||
alias jj zz
|
||||
1
fish/.config/fish/conf.d/fish-gpg-tty_init.fish
Normal file
1
fish/.config/fish/conf.d/fish-gpg-tty_init.fish
Normal file
@ -0,0 +1 @@
|
||||
export GPG_TTY=(tty)
|
||||
1
fish/.config/fish/conf.d/fisher.fish
Normal file
1
fish/.config/fish/conf.d/fisher.fish
Normal file
@ -0,0 +1 @@
|
||||
fisher copy-user-key-bindings
|
||||
13
fish/.config/fish/conf.d/fzf.fish
Normal file
13
fish/.config/fish/conf.d/fzf.fish
Normal file
@ -0,0 +1,13 @@
|
||||
set -q FZF_TMUX_HEIGHT; or set -U FZF_TMUX_HEIGHT "40%"
|
||||
set -q FZF_DEFAULT_OPTS; or set -U FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT"
|
||||
set -q FZF_LEGACY_KEYBINDINGS; or set -U FZF_LEGACY_KEYBINDINGS 1
|
||||
set -q FZF_PREVIEW_FILE_CMD; or set -U FZF_PREVIEW_FILE_CMD "head -n 10"
|
||||
set -q FZF_PREVIEW_DIR_CMD; or set -U FZF_PREVIEW_DIR_CMD "ls"
|
||||
|
||||
function fzf_uninstall -e fzf_uninstall
|
||||
set -l _vars (set | command grep -E "^FZF.*\$" | command awk '{print $1;}')
|
||||
for var in $_vars
|
||||
echo $var
|
||||
eval (set -e $var)
|
||||
end
|
||||
end
|
||||
44
fish/.config/fish/conf.d/fzf_key_bindings.fish
Normal file
44
fish/.config/fish/conf.d/fzf_key_bindings.fish
Normal file
@ -0,0 +1,44 @@
|
||||
if test "$FZF_LEGACY_KEYBINDINGS" -eq 1
|
||||
bind \ct '__fzf_find_file'
|
||||
bind \cr '__fzf_reverse_isearch'
|
||||
bind \ec '__fzf_cd'
|
||||
bind \eC '__fzf_cd --hidden'
|
||||
bind \cg '__fzf_open'
|
||||
bind \co '__fzf_open --editor'
|
||||
|
||||
if bind -M insert >/dev/null 2>/dev/null
|
||||
bind -M insert \ct '__fzf_find_file'
|
||||
bind -M insert \cr '__fzf_reverse_isearch'
|
||||
bind -M insert \ec '__fzf_cd'
|
||||
bind -M insert \eC '__fzf_cd --hidden'
|
||||
bind -M insert \cg '__fzf_open'
|
||||
bind -M insert \co '__fzf_open --editor'
|
||||
end
|
||||
else
|
||||
bind \cf '__fzf_find_file'
|
||||
bind \cr '__fzf_reverse_isearch'
|
||||
bind \eo '__fzf_cd'
|
||||
bind \eO '__fzf_cd --hidden'
|
||||
bind \cg '__fzf_open'
|
||||
bind \co '__fzf_open --editor'
|
||||
|
||||
if bind -M insert >/dev/null 2>/dev/null
|
||||
bind -M insert \cf '__fzf_find_file'
|
||||
bind -M insert \cr '__fzf_reverse_isearch'
|
||||
bind -M insert \eo '__fzf_cd'
|
||||
bind -M insert \eO '__fzf_cd --hidden'
|
||||
bind -M insert \cg '__fzf_open'
|
||||
bind -M insert \co '__fzf_open --editor'
|
||||
end
|
||||
end
|
||||
|
||||
if set -q FZF_COMPLETE
|
||||
bind \t '__fzf_complete'
|
||||
end
|
||||
|
||||
function fzf_key_bindings_uninstall -e fzf_key_bindings_uninstall
|
||||
set -l _bindings (bind -a | sed -En "s/(')?__fzf.*\$//p" | sed 's/bind/bind -e/')
|
||||
for binding in $_bindings
|
||||
eval $binding
|
||||
end
|
||||
end
|
||||
8
fish/.config/fish/conf.d/plugin-direnv_init.fish
Normal file
8
fish/.config/fish/conf.d/plugin-direnv_init.fish
Normal file
@ -0,0 +1,8 @@
|
||||
if type -q direnv
|
||||
function __direnv_export_eval --on-variable PWD
|
||||
status --is-command-substitution; and return
|
||||
eval (direnv export fish)
|
||||
end
|
||||
else
|
||||
echo "Install direnv first! Check http://direnv.net" ^&1
|
||||
end
|
||||
44
fish/.config/fish/conf.d/z.fish
Normal file
44
fish/.config/fish/conf.d/z.fish
Normal file
@ -0,0 +1,44 @@
|
||||
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
|
||||
end
|
||||
|
||||
# Setup completions once first
|
||||
__z_complete
|
||||
|
||||
function __z_on_variable_pwd --on-variable PWD
|
||||
__z_add
|
||||
end
|
||||
2
fish/.config/fish/config.fish
Normal file
2
fish/.config/fish/config.fish
Normal file
@ -0,0 +1,2 @@
|
||||
source ~/.asdf/asdf.fish
|
||||
thefuck --alias | source
|
||||
60
fish/.config/fish/fish_variables
Normal file
60
fish/.config/fish/fish_variables
Normal file
@ -0,0 +1,60 @@
|
||||
# This file contains fish universal variable definitions.
|
||||
# VERSION: 3.0
|
||||
SETUVAR FZF_DEFAULT_OPTS:\x2d\x2dheight\x2040\x25
|
||||
SETUVAR FZF_LEGACY_KEYBINDINGS:1
|
||||
SETUVAR FZF_PREVIEW_DIR_CMD:ls
|
||||
SETUVAR FZF_PREVIEW_FILE_CMD:head\x20\x2dn\x2010
|
||||
SETUVAR FZF_TMUX_HEIGHT:40\x25
|
||||
SETUVAR --export TERM:screen\x2d256color
|
||||
SETUVAR THEME_EDEN_PROMPT_CHAR:\u00bb
|
||||
SETUVAR ZO_CMD:zo
|
||||
SETUVAR Z_CMD:z
|
||||
SETUVAR Z_DATA:/Users/colinpowell/\x2elocal/share/z/data
|
||||
SETUVAR Z_DATA_DIR:/Users/colinpowell/\x2elocal/share/z
|
||||
SETUVAR Z_EXCLUDE:/Users/colinpowell
|
||||
SETUVAR __fish_init_2_39_8:\x1d
|
||||
SETUVAR __fish_init_2_3_0:\x1d
|
||||
SETUVAR __fish_init_3_x:\x1d
|
||||
SETUVAR __tf_func:function\x20__tf_alias\x20\x2dd\x20\x22Correct\x20your\x20previous\x20console\x20command\x22\x3b\x20\x20set\x20\x2dl\x20fucked_up_command\x20\x24history\x5b1\x5d\x3b\x20\x20env\x20TF_SHELL\x3dfish\x20TF_ALIAS\x3d__tf_alias\x20PYTHONIOENCODING\x3dutf\x2d8\x20thefuck\x20\x24fucked_up_command\x20\x7c\x20read\x20\x2dl\x20unfucked_command\x3b\x20\x20if\x20\x5b\x20\x22\x24unfucked_command\x22\x20\x21\x3d\x20\x22\x22\x20\x5d\x3b\x20\x20\x20\x20eval\x20\x24unfucked_command\x3b\x20\x20\x20\x20builtin\x20history\x20delete\x20\x2d\x2dexact\x20\x2d\x2dcase\x2dsensitive\x20\x2d\x2d\x20\x24fucked_up_command\x3b\x20\x20\x20\x20builtin\x20history\x20merge\x20\x5e\x20/dev/null\x3b\x20\x20end\x3bend\x3b
|
||||
SETUVAR __tf_vers:The\x20Fuck\x203\x2e28\x20using\x20Python\x203\x2e7\x2e1\x20and\x20Fish\x20Shell\x202\x2e7\x2e1
|
||||
SETUVAR budspencer_colors:000000\x1e083743\x1e445659\x1efdf6e3\x1eb58900\x1ecb4b16\x1edc121f\x1eaf005f\x1e6c71c4\x1e268bd2\x1e2aa198\x1e859900
|
||||
SETUVAR budspencer_cursors:\x5c033\x5d12\x3b\x23268bd2\x5c007\x1e\x5c033\x5d12\x3b\x23b58900\x5c007\x1e\x5c033\x5d12\x3b\x23af005f\x5c007\x1e\x5c033\x5d12\x3b\x236c71c4\x5c007
|
||||
SETUVAR budspencer_day:000000\x1e333333\x1e666666\x1effffff\x1effff00\x1eff6600\x1eff0000\x1eff0033\x1e3300ff\x1e00aaff\x1e00ffff\x1e00ff00
|
||||
SETUVAR budspencer_night:000000\x1e083743\x1e445659\x1efdf6e3\x1eb58900\x1ecb4b16\x1edc121f\x1eaf005f\x1e6c71c4\x1e268bd2\x1e2aa198\x1e859900
|
||||
SETUVAR budspencer_nocmdhist:c\x1ed\x1ell\x1els\x1em\x1es
|
||||
SETUVAR budspencer_pwdstyle:short\x1elong\x1enone
|
||||
SETUVAR budspencer_sessions_active:\x1d
|
||||
SETUVAR budspencer_sessions_active_pid:\x1d
|
||||
SETUVAR chain_links:chain\x2elinks\x2eroot\x1echain\x2elinks\x2ejobs\x1echain\x2elinks\x2epwd\x1echain\x2elinks\x2evcs_branch\x1echain\x2elinks\x2evcs_dirty\x1echain\x2elinks\x2evcs_stashed
|
||||
SETUVAR dangerous_nocmdhist:c\x1ed\x1ell\x1els\x1em\x1es
|
||||
SETUVAR dangerous_pwdstyle:short\x1elong\x1enone
|
||||
SETUVAR dangerous_sessions_active:\x1d
|
||||
SETUVAR dangerous_sessions_active_pid:\x1d
|
||||
SETUVAR fish_color_autosuggestion:555\x1ebrblack
|
||||
SETUVAR fish_color_cancel:\x2dr
|
||||
SETUVAR fish_color_command:\x2d\x2dbold
|
||||
SETUVAR fish_color_comment:red
|
||||
SETUVAR fish_color_cwd:green
|
||||
SETUVAR fish_color_cwd_root:red
|
||||
SETUVAR fish_color_end:brmagenta
|
||||
SETUVAR fish_color_error:brred
|
||||
SETUVAR fish_color_escape:bryellow\x1e\x2d\x2dbold
|
||||
SETUVAR fish_color_history_current:\x2d\x2dbold
|
||||
SETUVAR fish_color_host:normal
|
||||
SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue
|
||||
SETUVAR fish_color_normal:normal
|
||||
SETUVAR fish_color_operator:bryellow
|
||||
SETUVAR fish_color_param:cyan
|
||||
SETUVAR fish_color_quote:yellow
|
||||
SETUVAR fish_color_redirection:brblue
|
||||
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SETUVAR fish_color_user:brgreen
|
||||
SETUVAR fish_color_valid_path:\x2d\x2dunderline
|
||||
SETUVAR fish_greeting:\x1d
|
||||
SETUVAR fish_key_bindings:fish_vi_key_bindings
|
||||
SETUVAR fish_pager_color_completion:\x1d
|
||||
SETUVAR fish_pager_color_description:B3A06D\x1eyellow
|
||||
SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
||||
SETUVAR yimmy_solarized:true
|
||||
59
fish/.config/fish/fishd.8c85907056c9
Normal file
59
fish/.config/fish/fishd.8c85907056c9
Normal file
@ -0,0 +1,59 @@
|
||||
# This file is automatically generated by the fish.
|
||||
# Do NOT edit it directly, your changes will be overwritten.
|
||||
SET FZF_DEFAULT_OPTS:\x2d\x2dheight\x2040\x25
|
||||
SET FZF_LEGACY_KEYBINDINGS:1
|
||||
SET FZF_PREVIEW_DIR_CMD:ls
|
||||
SET FZF_PREVIEW_FILE_CMD:head\x20\x2dn\x2010
|
||||
SET FZF_TMUX_HEIGHT:40\x25
|
||||
SET_EXPORT TERM:screen\x2d256color
|
||||
SET THEME_EDEN_PROMPT_CHAR:\u00bb
|
||||
SET ZO_CMD:zo
|
||||
SET Z_CMD:z
|
||||
SET Z_DATA:/Users/colinpowell/\x2elocal/share/z/data
|
||||
SET Z_DATA_DIR:/Users/colinpowell/\x2elocal/share/z
|
||||
SET Z_EXCLUDE:/Users/colinpowell
|
||||
SET __fish_init_2_39_8:\x1d
|
||||
SET __fish_init_2_3_0:\x1d
|
||||
SET __tf_func:function\x20__tf_alias\x20\x2dd\x20\x22Correct\x20your\x20previous\x20console\x20command\x22\x3b\x20\x20set\x20\x2dl\x20fucked_up_command\x20\x24history\x5b1\x5d\x3b\x20\x20env\x20TF_SHELL\x3dfish\x20TF_ALIAS\x3d__tf_alias\x20PYTHONIOENCODING\x3dutf\x2d8\x20thefuck\x20\x24fucked_up_command\x20\x7c\x20read\x20\x2dl\x20unfucked_command\x3b\x20\x20if\x20\x5b\x20\x22\x24unfucked_command\x22\x20\x21\x3d\x20\x22\x22\x20\x5d\x3b\x20\x20\x20\x20eval\x20\x24unfucked_command\x3b\x20\x20\x20\x20builtin\x20history\x20delete\x20\x2d\x2dexact\x20\x2d\x2dcase\x2dsensitive\x20\x2d\x2d\x20\x24fucked_up_command\x3b\x20\x20\x20\x20builtin\x20history\x20merge\x20\x5e\x20/dev/null\x3b\x20\x20end\x3bend\x3b
|
||||
SET __tf_vers:The\x20Fuck\x203\x2e28\x20using\x20Python\x203\x2e7\x2e1\x20and\x20Fish\x20Shell\x202\x2e7\x2e1
|
||||
SET budspencer_colors:000000\x1e083743\x1e445659\x1efdf6e3\x1eb58900\x1ecb4b16\x1edc121f\x1eaf005f\x1e6c71c4\x1e268bd2\x1e2aa198\x1e859900
|
||||
SET budspencer_cursors:\x5c033\x5d12\x3b\x23268bd2\x5c007\x1e\x5c033\x5d12\x3b\x23b58900\x5c007\x1e\x5c033\x5d12\x3b\x23af005f\x5c007\x1e\x5c033\x5d12\x3b\x236c71c4\x5c007
|
||||
SET budspencer_day:000000\x1e333333\x1e666666\x1effffff\x1effff00\x1eff6600\x1eff0000\x1eff0033\x1e3300ff\x1e00aaff\x1e00ffff\x1e00ff00
|
||||
SET budspencer_night:000000\x1e083743\x1e445659\x1efdf6e3\x1eb58900\x1ecb4b16\x1edc121f\x1eaf005f\x1e6c71c4\x1e268bd2\x1e2aa198\x1e859900
|
||||
SET budspencer_nocmdhist:c\x1ed\x1ell\x1els\x1em\x1es
|
||||
SET budspencer_pwdstyle:short\x1elong\x1enone
|
||||
SET budspencer_sessions_active:\x1d
|
||||
SET budspencer_sessions_active_pid:\x1d
|
||||
SET chain_links:chain\x2elinks\x2eroot\x1echain\x2elinks\x2ejobs\x1echain\x2elinks\x2epwd\x1echain\x2elinks\x2evcs_branch\x1echain\x2elinks\x2evcs_dirty\x1echain\x2elinks\x2evcs_stashed
|
||||
SET dangerous_nocmdhist:c\x1ed\x1ell\x1els\x1em\x1es
|
||||
SET dangerous_pwdstyle:short\x1elong\x1enone
|
||||
SET dangerous_sessions_active:\x1d
|
||||
SET dangerous_sessions_active_pid:\x1d
|
||||
SET fish_color_autosuggestion:555\x1ebrblack
|
||||
SET fish_color_cancel:\x2dr
|
||||
SET fish_color_command:\x2d\x2dbold
|
||||
SET fish_color_comment:red
|
||||
SET fish_color_cwd:green
|
||||
SET fish_color_cwd_root:red
|
||||
SET fish_color_end:brmagenta
|
||||
SET fish_color_error:brred
|
||||
SET fish_color_escape:bryellow\x1e\x2d\x2dbold
|
||||
SET fish_color_history_current:\x2d\x2dbold
|
||||
SET fish_color_host:normal
|
||||
SET fish_color_match:\x2d\x2dbackground\x3dbrblue
|
||||
SET fish_color_normal:normal
|
||||
SET fish_color_operator:bryellow
|
||||
SET fish_color_param:cyan
|
||||
SET fish_color_quote:yellow
|
||||
SET fish_color_redirection:brblue
|
||||
SET fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SET fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SET fish_color_user:brgreen
|
||||
SET fish_color_valid_path:\x2d\x2dunderline
|
||||
SET fish_greeting:\x1d
|
||||
SET fish_key_bindings:fish_vi_key_bindings
|
||||
SET fish_pager_color_completion:\x1d
|
||||
SET fish_pager_color_description:B3A06D\x1eyellow
|
||||
SET fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||
SET fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
||||
SET yimmy_solarized:true
|
||||
41
fish/.config/fish/fishd.auklet
Normal file
41
fish/.config/fish/fishd.auklet
Normal file
@ -0,0 +1,41 @@
|
||||
# This file is automatically generated by the fish.
|
||||
# Do NOT edit it directly, your changes will be overwritten.
|
||||
SET FZF_DEFAULT_OPTS:\x2d\x2dheight\x2040\x25
|
||||
SET FZF_LEGACY_KEYBINDINGS:1
|
||||
SET FZF_PREVIEW_DIR_CMD:ls
|
||||
SET FZF_PREVIEW_FILE_CMD:head\x20\x2dn\x2010
|
||||
SET FZF_TMUX_HEIGHT:40\x25
|
||||
SET ZO_CMD:zo
|
||||
SET Z_CMD:z
|
||||
SET Z_DATA:/home/powellc/\x2elocal/share/z/data
|
||||
SET Z_DATA_DIR:/home/powellc/\x2elocal/share/z
|
||||
SET Z_EXCLUDE:/home/powellc
|
||||
SET __fish_init_2_39_8:\x1d
|
||||
SET __fish_init_2_3_0:\x1d
|
||||
SET fish_color_autosuggestion:555\x1ebrblack
|
||||
SET fish_color_cancel:\x2dr
|
||||
SET fish_color_command:\x2d\x2dbold
|
||||
SET fish_color_comment:red
|
||||
SET fish_color_cwd:green
|
||||
SET fish_color_cwd_root:red
|
||||
SET fish_color_end:brmagenta
|
||||
SET fish_color_error:brred
|
||||
SET fish_color_escape:bryellow\x1e\x2d\x2dbold
|
||||
SET fish_color_history_current:\x2d\x2dbold
|
||||
SET fish_color_host:normal
|
||||
SET fish_color_match:\x2d\x2dbackground\x3dbrblue
|
||||
SET fish_color_normal:normal
|
||||
SET fish_color_operator:bryellow
|
||||
SET fish_color_param:cyan
|
||||
SET fish_color_quote:yellow
|
||||
SET fish_color_redirection:brblue
|
||||
SET fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SET fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SET fish_color_user:brgreen
|
||||
SET fish_color_valid_path:\x2d\x2dunderline
|
||||
SET fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell
|
||||
SET fish_key_bindings:fish_default_key_bindings
|
||||
SET fish_pager_color_completion:\x1d
|
||||
SET fish_pager_color_description:B3A06D\x1eyellow
|
||||
SET fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||
SET fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
||||
43
fish/.config/fish/fishd.galah
Normal file
43
fish/.config/fish/fishd.galah
Normal file
@ -0,0 +1,43 @@
|
||||
# This file is automatically generated by the fish.
|
||||
# Do NOT edit it directly, your changes will be overwritten.
|
||||
SET FZF_DEFAULT_OPTS:\x2d\x2dheight\x2040\x25
|
||||
SET FZF_LEGACY_KEYBINDINGS:1
|
||||
SET FZF_PREVIEW_DIR_CMD:ls
|
||||
SET FZF_PREVIEW_FILE_CMD:head\x20\x2dn\x2010
|
||||
SET FZF_TMUX_HEIGHT:40\x25
|
||||
SET_EXPORT TERM:xterm\x2d256color
|
||||
SET ZO_CMD:zo
|
||||
SET Z_CMD:z
|
||||
SET Z_DATA:/home/powellc/\x2elocal/share/z/data
|
||||
SET Z_DATA_DIR:/home/powellc/\x2elocal/share/z
|
||||
SET Z_EXCLUDE:/home/powellc
|
||||
SET __fish_init_2_39_8:\x1d
|
||||
SET __fish_init_2_3_0:\x1d
|
||||
SET fish_color_autosuggestion:555\x1ebrblack
|
||||
SET fish_color_cancel:\x2dr
|
||||
SET fish_color_command:\x2d\x2dbold
|
||||
SET fish_color_comment:red
|
||||
SET fish_color_cwd:green
|
||||
SET fish_color_cwd_root:red
|
||||
SET fish_color_end:brmagenta
|
||||
SET fish_color_error:brred
|
||||
SET fish_color_escape:bryellow\x1e\x2d\x2dbold
|
||||
SET fish_color_history_current:\x2d\x2dbold
|
||||
SET fish_color_host:normal
|
||||
SET fish_color_match:\x2d\x2dbackground\x3dbrblue
|
||||
SET fish_color_normal:normal
|
||||
SET fish_color_operator:bryellow
|
||||
SET fish_color_param:cyan
|
||||
SET fish_color_quote:yellow
|
||||
SET fish_color_redirection:brblue
|
||||
SET fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SET fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SET fish_color_user:brgreen
|
||||
SET fish_color_valid_path:\x2d\x2dunderline
|
||||
SET fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell
|
||||
SET fish_key_bindings:fish_default_key_bindings
|
||||
SET fish_pager_color_completion:\x1d
|
||||
SET fish_pager_color_description:B3A06D\x1eyellow
|
||||
SET fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||
SET fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
||||
SET fish_user_paths:/home/powellc/\x2efzf/bin
|
||||
42
fish/.config/fish/fishd.kestrel
Normal file
42
fish/.config/fish/fishd.kestrel
Normal file
@ -0,0 +1,42 @@
|
||||
# This file is automatically generated by the fish.
|
||||
# Do NOT edit it directly, your changes will be overwritten.
|
||||
SET FZF_DEFAULT_OPTS:\x2d\x2dheight\x2040\x25
|
||||
SET FZF_LEGACY_KEYBINDINGS:1
|
||||
SET FZF_PREVIEW_DIR_CMD:ls
|
||||
SET FZF_PREVIEW_FILE_CMD:head\x20\x2dn\x2010
|
||||
SET FZF_TMUX_HEIGHT:40\x25
|
||||
SET ZO_CMD:zo
|
||||
SET Z_CMD:z
|
||||
SET Z_DATA:/home/powellc/\x2elocal/share/z/data
|
||||
SET Z_DATA_DIR:/home/powellc/\x2elocal/share/z
|
||||
SET Z_EXCLUDE:/home/powellc
|
||||
SET __fish_init_2_39_8:\x1d
|
||||
SET __fish_init_2_3_0:\x1d
|
||||
SET fish_color_autosuggestion:555\x1ebrblack
|
||||
SET fish_color_cancel:\x2dr
|
||||
SET fish_color_command:\x2d\x2dbold
|
||||
SET fish_color_comment:red
|
||||
SET fish_color_cwd:green
|
||||
SET fish_color_cwd_root:red
|
||||
SET fish_color_end:brmagenta
|
||||
SET fish_color_error:brred
|
||||
SET fish_color_escape:bryellow\x1e\x2d\x2dbold
|
||||
SET fish_color_history_current:\x2d\x2dbold
|
||||
SET fish_color_host:normal
|
||||
SET fish_color_match:\x2d\x2dbackground\x3dbrblue
|
||||
SET fish_color_normal:normal
|
||||
SET fish_color_operator:bryellow
|
||||
SET fish_color_param:cyan
|
||||
SET fish_color_quote:yellow
|
||||
SET fish_color_redirection:brblue
|
||||
SET fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SET fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SET fish_color_user:brgreen
|
||||
SET fish_color_valid_path:\x2d\x2dunderline
|
||||
SET fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell
|
||||
SET fish_key_bindings:fish_default_key_bindings
|
||||
SET fish_pager_color_completion:\x1d
|
||||
SET fish_pager_color_description:B3A06D\x1eyellow
|
||||
SET fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||
SET fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
||||
SET fish_user_paths:/home/powellc/\x2efzf/bin
|
||||
41
fish/.config/fish/fishd.rhea
Normal file
41
fish/.config/fish/fishd.rhea
Normal file
@ -0,0 +1,41 @@
|
||||
# This file is automatically generated by the fish.
|
||||
# Do NOT edit it directly, your changes will be overwritten.
|
||||
SET FZF_DEFAULT_OPTS:\x2d\x2dheight\x2040\x25
|
||||
SET FZF_LEGACY_KEYBINDINGS:1
|
||||
SET FZF_PREVIEW_DIR_CMD:ls
|
||||
SET FZF_PREVIEW_FILE_CMD:head\x20\x2dn\x2010
|
||||
SET FZF_TMUX_HEIGHT:40\x25
|
||||
SET ZO_CMD:zo
|
||||
SET Z_CMD:z
|
||||
SET Z_DATA:/home/powellc/\x2elocal/share/z/data
|
||||
SET Z_DATA_DIR:/home/powellc/\x2elocal/share/z
|
||||
SET Z_EXCLUDE:/home/powellc
|
||||
SET __fish_init_2_39_8:\x1d
|
||||
SET __fish_init_2_3_0:\x1d
|
||||
SET fish_color_autosuggestion:555\x1ebrblack
|
||||
SET fish_color_cancel:\x2dr
|
||||
SET fish_color_command:\x2d\x2dbold
|
||||
SET fish_color_comment:red
|
||||
SET fish_color_cwd:green
|
||||
SET fish_color_cwd_root:red
|
||||
SET fish_color_end:brmagenta
|
||||
SET fish_color_error:brred
|
||||
SET fish_color_escape:bryellow\x1e\x2d\x2dbold
|
||||
SET fish_color_history_current:\x2d\x2dbold
|
||||
SET fish_color_host:normal
|
||||
SET fish_color_match:\x2d\x2dbackground\x3dbrblue
|
||||
SET fish_color_normal:normal
|
||||
SET fish_color_operator:bryellow
|
||||
SET fish_color_param:cyan
|
||||
SET fish_color_quote:yellow
|
||||
SET fish_color_redirection:brblue
|
||||
SET fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SET fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SET fish_color_user:brgreen
|
||||
SET fish_color_valid_path:\x2d\x2dunderline
|
||||
SET fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell
|
||||
SET fish_key_bindings:fish_default_key_bindings
|
||||
SET fish_pager_color_completion:\x1d
|
||||
SET fish_pager_color_description:B3A06D\x1eyellow
|
||||
SET fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||
SET fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
||||
9
fish/.config/fish/fishfile
Normal file
9
fish/.config/fish/fishfile
Normal file
@ -0,0 +1,9 @@
|
||||
jethrokuan/z
|
||||
jethrokuan/fzf
|
||||
adityavm/fasd
|
||||
2m/fish-gpg-tty
|
||||
asdf-vm/asdf
|
||||
edc/bass
|
||||
oh-my-fish/plugin-direnv
|
||||
oh-my-fish/theme-agnoster
|
||||
oh-my-fish/theme-bobthefish
|
||||
98
fish/.config/fish/functions/__bass.py
Normal file
98
fish/.config/fish/functions/__bass.py
Normal file
@ -0,0 +1,98 @@
|
||||
"""
|
||||
To be used with a companion fish function like this:
|
||||
|
||||
function refish
|
||||
set -l _x (python /tmp/bass.py source ~/.nvm/nvim.sh ';' nvm use iojs); source $_x; and rm -f $_x
|
||||
end
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
|
||||
BASH = 'bash'
|
||||
|
||||
def comment(string):
|
||||
return '\n'.join(['# ' + line for line in string.split('\n')])
|
||||
|
||||
def gen_script():
|
||||
divider = '-__-__-__bass___-env-output-__bass_-__-__-__-__'
|
||||
|
||||
# Use the following instead of /usr/bin/env to read environment so we can
|
||||
# deal with multi-line environment variables (and other odd cases).
|
||||
env_reader = "python -c 'import os,json; print(json.dumps({k:v for k,v in os.environ.items()}))'"
|
||||
args = [BASH, '-c', env_reader]
|
||||
output = subprocess.check_output(args, universal_newlines=True)
|
||||
old_env = output.strip()
|
||||
|
||||
command = '{} && (echo "{}"; {}; echo "{}"; alias)'.format(
|
||||
' '.join(sys.argv[1:]).rstrip().rstrip(';'),
|
||||
divider,
|
||||
env_reader,
|
||||
divider,
|
||||
)
|
||||
args = [BASH, '-c', command]
|
||||
output = subprocess.check_output(args, universal_newlines=True)
|
||||
stdout, new_env, alias = output.split(divider, 2)
|
||||
new_env = new_env.strip()
|
||||
|
||||
old_env = json.loads(old_env)
|
||||
new_env = json.loads(new_env)
|
||||
|
||||
script_lines = []
|
||||
|
||||
for line in stdout.splitlines():
|
||||
# some outputs might use documentation about the shell usage with dollar signs
|
||||
line = line.replace(r'$', r'\$')
|
||||
script_lines.append("printf %s;printf '\\n'" % json.dumps(line))
|
||||
for k, v in new_env.items():
|
||||
if k in ['PS1', 'SHLVL', 'XPC_SERVICE_NAME'] or k.startswith("BASH_FUNC"):
|
||||
continue
|
||||
v1 = old_env.get(k)
|
||||
if not v1:
|
||||
script_lines.append(comment('adding %s=%s' % (k, v)))
|
||||
elif v1 != v:
|
||||
script_lines.append(comment('updating %s=%s -> %s' % (k, v1, v)))
|
||||
# process special variables
|
||||
if k == 'PWD':
|
||||
script_lines.append('cd %s' % json.dumps(v))
|
||||
continue
|
||||
else:
|
||||
continue
|
||||
if k == 'PATH':
|
||||
# use json.dumps to reliably escape quotes and backslashes
|
||||
value = ' '.join([json.dumps(directory)
|
||||
for directory in v.split(':')])
|
||||
else:
|
||||
# use json.dumps to reliably escape quotes and backslashes
|
||||
value = json.dumps(v)
|
||||
script_lines.append('set -g -x %s %s' % (k, value))
|
||||
|
||||
for var in set(old_env.keys()) - set(new_env.keys()):
|
||||
script_lines.append(comment('removing %s' % var))
|
||||
script_lines.append('set -e %s' % var)
|
||||
|
||||
script = '\n'.join(script_lines)
|
||||
|
||||
return script + '\n' + alias
|
||||
|
||||
if not sys.argv[1:]:
|
||||
print('__usage', end='')
|
||||
sys.exit(0)
|
||||
|
||||
try:
|
||||
script = gen_script()
|
||||
except subprocess.CalledProcessError as e:
|
||||
print('exit code:', e.returncode, file=sys.stderr)
|
||||
print('__error', e.returncode, end='')
|
||||
except Exception as e:
|
||||
print('unknown error:', str(e), file=sys.stderr)
|
||||
traceback.print_exc(10, file=sys.stderr)
|
||||
print('__error', end='')
|
||||
else:
|
||||
print(script, end='')
|
||||
575
fish/.config/fish/functions/__bobthefish_colors.fish
Normal file
575
fish/.config/fish/functions/__bobthefish_colors.fish
Normal file
@ -0,0 +1,575 @@
|
||||
function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthefish'
|
||||
switch "$color_scheme"
|
||||
case 'user'
|
||||
__bobthefish_user_color_scheme_deprecated
|
||||
return
|
||||
|
||||
case 'terminal' 'terminal-dark*'
|
||||
set -l colorfg black
|
||||
[ "$color_scheme" = 'terminal-dark-white' ]; and set colorfg white
|
||||
set -x color_initial_segment_exit white red --bold
|
||||
set -x color_initial_segment_su white green --bold
|
||||
set -x color_initial_segment_jobs white blue --bold
|
||||
|
||||
set -x color_path black white
|
||||
set -x color_path_basename black white --bold
|
||||
set -x color_path_nowrite magenta $colorfg
|
||||
set -x color_path_nowrite_basename magenta $colorfg --bold
|
||||
|
||||
set -x color_repo green $colorfg
|
||||
set -x color_repo_work_tree black $colorfg --bold
|
||||
set -x color_repo_dirty brred $colorfg
|
||||
set -x color_repo_staged yellow $colorfg
|
||||
|
||||
set -x color_vi_mode_default brblue $colorfg --bold
|
||||
set -x color_vi_mode_insert brgreen $colorfg --bold
|
||||
set -x color_vi_mode_visual bryellow $colorfg --bold
|
||||
|
||||
set -x color_vagrant brcyan $colorfg
|
||||
set -x color_k8s magenta white --bold
|
||||
set -x color_username white black --bold
|
||||
set -x color_hostname white black
|
||||
set -x color_rvm brmagenta $colorfg --bold
|
||||
set -x color_virtualfish brblue $colorfg --bold
|
||||
set -x color_virtualgo brblue $colorfg --bold
|
||||
set -x color_desk brblue $colorfg --bold
|
||||
|
||||
case 'terminal-light*'
|
||||
set -l colorfg white
|
||||
[ "$color_scheme" = 'terminal-light-black' ]; and set colorfg black
|
||||
set -x color_initial_segment_exit black red --bold
|
||||
set -x color_initial_segment_su black green --bold
|
||||
set -x color_initial_segment_jobs black blue --bold
|
||||
|
||||
set -x color_path white black
|
||||
set -x color_path_basename white black --bold
|
||||
set -x color_path_nowrite magenta $colorfg
|
||||
set -x color_path_nowrite_basename magenta $colorfg --bold
|
||||
|
||||
set -x color_repo green $colorfg
|
||||
set -x color_repo_work_tree white $colorfg --bold
|
||||
set -x color_repo_dirty brred $colorfg
|
||||
set -x color_repo_staged yellow $colorfg
|
||||
|
||||
set -x color_vi_mode_default brblue $colorfg --bold
|
||||
set -x color_vi_mode_insert brgreen $colorfg --bold
|
||||
set -x color_vi_mode_visual bryellow $colorfg --bold
|
||||
|
||||
set -x color_vagrant brcyan $colorfg
|
||||
set -x color_k8s magenta white --bold
|
||||
set -x color_username black white --bold
|
||||
set -x color_hostname black white
|
||||
set -x color_rvm brmagenta $colorfg --bold
|
||||
set -x color_virtualfish brblue $colorfg --bold
|
||||
set -x color_virtualgo brblue $colorfg --bold
|
||||
set -x color_desk brblue $colorfg --bold
|
||||
|
||||
case 'terminal2' 'terminal2-dark*'
|
||||
set -l colorfg black
|
||||
[ "$color_scheme" = 'terminal2-dark-white' ]; and set colorfg white
|
||||
set -x color_initial_segment_exit grey red --bold
|
||||
set -x color_initial_segment_su grey green --bold
|
||||
set -x color_initial_segment_jobs grey blue --bold
|
||||
|
||||
set -x color_path brgrey white
|
||||
set -x color_path_basename brgrey white --bold
|
||||
set -x color_path_nowrite magenta $colorfg
|
||||
set -x color_path_nowrite_basename magenta $colorfg --bold
|
||||
|
||||
set -x color_repo green $colorfg
|
||||
set -x color_repo_work_tree brgrey $colorfg --bold
|
||||
set -x color_repo_dirty brred $colorfg
|
||||
set -x color_repo_staged yellow $colorfg
|
||||
|
||||
set -x color_vi_mode_default brblue $colorfg --bold
|
||||
set -x color_vi_mode_insert brgreen $colorfg --bold
|
||||
set -x color_vi_mode_visual bryellow $colorfg --bold
|
||||
|
||||
set -x color_vagrant brcyan $colorfg
|
||||
set -x color_k8s magenta white --bold
|
||||
set -x color_username brgrey white --bold
|
||||
set -x color_hostname brgrey white
|
||||
set -x color_rvm brmagenta $colorfg --bold
|
||||
set -x color_virtualfish brblue $colorfg --bold
|
||||
set -x color_virtualgo brblue $colorfg --bold
|
||||
set -x color_desk brblue $colorfg --bold
|
||||
|
||||
case 'terminal2-light*'
|
||||
set -l colorfg white
|
||||
[ "$color_scheme" = 'terminal2-light-black' ]; and set colorfg black
|
||||
set -x color_initial_segment_exit brgrey red --bold
|
||||
set -x color_initial_segment_su brgrey green --bold
|
||||
set -x color_initial_segment_jobs brgrey blue --bold
|
||||
|
||||
set -x color_path grey black
|
||||
set -x color_path_basename grey black --bold
|
||||
set -x color_path_nowrite magenta $colorfg
|
||||
set -x color_path_nowrite_basename magenta $colorfg --bold
|
||||
|
||||
set -x color_repo green $colorfg
|
||||
set -x color_repo_work_tree grey $colorfg --bold
|
||||
set -x color_repo_dirty brred $colorfg
|
||||
set -x color_repo_staged yellow $colorfg
|
||||
|
||||
set -x color_vi_mode_default brblue $colorfg --bold
|
||||
set -x color_vi_mode_insert brgreen $colorfg --bold
|
||||
set -x color_vi_mode_visual bryellow $colorfg --bold
|
||||
|
||||
set -x color_vagrant brcyan $colorfg
|
||||
set -x color_k8s magenta white --bold
|
||||
set -x color_username grey black --bold
|
||||
set -x color_hostname grey black
|
||||
set -x color_rvm brmagenta $colorfg --bold
|
||||
set -x color_virtualfish brblue $colorfg --bold
|
||||
set -x color_virtualgo brblue $colorfg --bold
|
||||
set -x color_desk brblue $colorfg --bold
|
||||
|
||||
case 'zenburn'
|
||||
set -l grey 333333 # a bit darker than normal zenburn grey
|
||||
set -l red CC9393
|
||||
set -l green 7F9F7F
|
||||
set -l yellow E3CEAB
|
||||
set -l orange DFAF8F
|
||||
set -l blue 8CD0D3
|
||||
set -l white DCDCCC
|
||||
|
||||
set -x color_initial_segment_exit $white $red --bold
|
||||
set -x color_initial_segment_su $white $green --bold
|
||||
set -x color_initial_segment_jobs $white $blue --bold
|
||||
|
||||
set -x color_path $grey $white
|
||||
set -x color_path_basename $grey $white --bold
|
||||
set -x color_path_nowrite $grey $red
|
||||
set -x color_path_nowrite_basename $grey $red --bold
|
||||
|
||||
set -x color_repo $green $grey
|
||||
set -x color_repo_work_tree $grey $grey --bold
|
||||
set -x color_repo_dirty $red $grey
|
||||
set -x color_repo_staged $yellow $grey
|
||||
|
||||
set -x color_vi_mode_default $grey $yellow --bold
|
||||
set -x color_vi_mode_insert $green $white --bold
|
||||
set -x color_vi_mode_visual $yellow $grey --bold
|
||||
|
||||
set -x color_vagrant $blue $green --bold
|
||||
set -x color_k8s $green $white --bold
|
||||
set -x color_username $grey $blue --bold
|
||||
set -x color_hostname $grey $blue
|
||||
set -x color_rvm $red $grey --bold
|
||||
set -x color_virtualfish $blue $grey --bold
|
||||
set -x color_virtualgo $blue $grey --bold
|
||||
set -x color_desk $blue $grey --bold
|
||||
|
||||
case 'base16-light'
|
||||
set -l base00 181818
|
||||
set -l base01 282828
|
||||
set -l base02 383838
|
||||
set -l base03 585858
|
||||
set -l base04 b8b8b8
|
||||
set -l base05 d8d8d8
|
||||
set -l base06 e8e8e8
|
||||
set -l base07 f8f8f8
|
||||
set -l base08 ab4642 # red
|
||||
set -l base09 dc9656 # orange
|
||||
set -l base0A f7ca88 # yellow
|
||||
set -l base0B a1b56c # green
|
||||
set -l base0C 86c1b9 # cyan
|
||||
set -l base0D 7cafc2 # blue
|
||||
set -l base0E ba8baf # violet
|
||||
set -l base0F a16946 # brown
|
||||
|
||||
set -l colorfg $base00
|
||||
|
||||
set -x color_initial_segment_exit $base02 $base08 --bold
|
||||
set -x color_initial_segment_su $base02 $base0B --bold
|
||||
set -x color_initial_segment_jobs $base02 $base0D --bold
|
||||
|
||||
set -x color_path $base06 $base02
|
||||
set -x color_path_basename $base06 $base01 --bold
|
||||
set -x color_path_nowrite $base06 $base08
|
||||
set -x color_path_nowrite_basename $base06 $base08 --bold
|
||||
|
||||
set -x color_repo $base0B $colorfg
|
||||
set -x color_repo_work_tree $base06 $colorfg --bold
|
||||
set -x color_repo_dirty $base08 $colorfg
|
||||
set -x color_repo_staged $base09 $colorfg
|
||||
|
||||
set -x color_vi_mode_default $base04 $colorfg --bold
|
||||
set -x color_vi_mode_insert $base0B $colorfg --bold
|
||||
set -x color_vi_mode_visual $base09 $colorfg --bold
|
||||
|
||||
set -x color_vagrant $base0C $colorfg --bold
|
||||
set -x color_k8s $base06 $colorfg --bold
|
||||
set -x color_username $base02 $base0D --bold
|
||||
set -x color_hostname $base02 $base0D
|
||||
set -x color_rvm $base08 $colorfg --bold
|
||||
set -x color_virtualfish $base0D $colorfg --bold
|
||||
set -x color_virtualgo $base0D $colorfg --bold
|
||||
set -x color_desk $base0D $colorfg --bold
|
||||
|
||||
case 'base16' 'base16-dark'
|
||||
set -l base00 181818
|
||||
set -l base01 282828
|
||||
set -l base02 383838
|
||||
set -l base03 585858
|
||||
set -l base04 b8b8b8
|
||||
set -l base05 d8d8d8
|
||||
set -l base06 e8e8e8
|
||||
set -l base07 f8f8f8
|
||||
set -l base08 ab4642 # red
|
||||
set -l base09 dc9656 # orange
|
||||
set -l base0A f7ca88 # yellow
|
||||
set -l base0B a1b56c # green
|
||||
set -l base0C 86c1b9 # cyan
|
||||
set -l base0D 7cafc2 # blue
|
||||
set -l base0E ba8baf # violet
|
||||
set -l base0F a16946 # brown
|
||||
|
||||
set -l colorfg $base07
|
||||
|
||||
set -x color_initial_segment_exit $base05 $base08 --bold
|
||||
set -x color_initial_segment_su $base05 $base0B --bold
|
||||
set -x color_initial_segment_jobs $base05 $base0D --bold
|
||||
|
||||
set -x color_path $base02 $base05
|
||||
set -x color_path_basename $base02 $base06 --bold
|
||||
set -x color_path_nowrite $base02 $base08
|
||||
set -x color_path_nowrite_basename $base02 $base08 --bold
|
||||
|
||||
set -x color_repo $base0B $colorfg
|
||||
set -x color_repo_work_tree $base02 $colorfg --bold
|
||||
set -x color_repo_dirty $base08 $colorfg
|
||||
set -x color_repo_staged $base09 $colorfg
|
||||
|
||||
set -x color_vi_mode_default $base03 $colorfg --bold
|
||||
set -x color_vi_mode_insert $base0B $colorfg --bold
|
||||
set -x color_vi_mode_visual $base09 $colorfg --bold
|
||||
|
||||
set -x color_vagrant $base0C $colorfg --bold
|
||||
set -x color_k8s $base0B $colorfg --bold
|
||||
set -x color_username $base02 $base0D --bold
|
||||
set -x color_hostname $base02 $base0D
|
||||
set -x color_rvm $base08 $colorfg --bold
|
||||
set -x color_virtualfish $base0D $colorfg --bold
|
||||
set -x color_virtualgo $base0D $colorfg --bold
|
||||
set -x color_desk $base0D $colorfg --bold
|
||||
|
||||
case 'solarized-light'
|
||||
set -l base03 002b36
|
||||
set -l base02 073642
|
||||
set -l base01 586e75
|
||||
set -l base00 657b83
|
||||
set -l base0 839496
|
||||
set -l base1 93a1a1
|
||||
set -l base2 eee8d5
|
||||
set -l base3 fdf6e3
|
||||
set -l yellow b58900
|
||||
set -l orange cb4b16
|
||||
set -l red dc322f
|
||||
set -l magenta d33682
|
||||
set -l violet 6c71c4
|
||||
set -l blue 268bd2
|
||||
set -l cyan 2aa198
|
||||
set -l green 859900
|
||||
|
||||
set colorfg $base03
|
||||
|
||||
set -x color_initial_segment_exit $base02 $red --bold
|
||||
set -x color_initial_segment_su $base02 $green --bold
|
||||
set -x color_initial_segment_jobs $base02 $blue --bold
|
||||
|
||||
set -x color_path $base2 $base00
|
||||
set -x color_path_basename $base2 $base01 --bold
|
||||
set -x color_path_nowrite $base2 $orange
|
||||
set -x color_path_nowrite_basename $base2 $orange --bold
|
||||
|
||||
set -x color_repo $green $colorfg
|
||||
set -x color_repo_work_tree $base2 $colorfg --bold
|
||||
set -x color_repo_dirty $red $colorfg
|
||||
set -x color_repo_staged $yellow $colorfg
|
||||
|
||||
set -x color_vi_mode_default $blue $colorfg --bold
|
||||
set -x color_vi_mode_insert $green $colorfg --bold
|
||||
set -x color_vi_mode_visual $yellow $colorfg --bold
|
||||
|
||||
set -x color_vagrant $violet $colorfg --bold
|
||||
set -x color_k8s $green $colorfg --bold
|
||||
set -x color_username $base2 $blue --bold
|
||||
set -x color_hostname $base2 $blue
|
||||
set -x color_rvm $red $colorfg --bold
|
||||
set -x color_virtualfish $cyan $colorfg --bold
|
||||
set -x color_virtualgo $cyan $colorfg --bold
|
||||
set -x color_desk $cyan $colorfg --bold
|
||||
|
||||
case 'solarized' 'solarized-dark'
|
||||
set -l base03 002b36
|
||||
set -l base02 073642
|
||||
set -l base01 586e75
|
||||
set -l base00 657b83
|
||||
set -l base0 839496
|
||||
set -l base1 93a1a1
|
||||
set -l base2 eee8d5
|
||||
set -l base3 fdf6e3
|
||||
set -l yellow b58900
|
||||
set -l orange cb4b16
|
||||
set -l red dc322f
|
||||
set -l magenta d33682
|
||||
set -l violet 6c71c4
|
||||
set -l blue 268bd2
|
||||
set -l cyan 2aa198
|
||||
set -l green 859900
|
||||
|
||||
set colorfg $base3
|
||||
|
||||
set -x color_initial_segment_exit $base2 $red --bold
|
||||
set -x color_initial_segment_su $base2 $green --bold
|
||||
set -x color_initial_segment_jobs $base2 $blue --bold
|
||||
|
||||
set -x color_path $base02 $base0
|
||||
set -x color_path_basename $base02 $base1 --bold
|
||||
set -x color_path_nowrite $base02 $orange
|
||||
set -x color_path_nowrite_basename $base02 $orange --bold
|
||||
|
||||
set -x color_repo $green $colorfg
|
||||
set -x color_repo_work_tree $base02 $colorfg --bold
|
||||
set -x color_repo_dirty $red $colorfg
|
||||
set -x color_repo_staged $yellow $colorfg
|
||||
|
||||
set -x color_vi_mode_default $blue $colorfg --bold
|
||||
set -x color_vi_mode_insert $green $colorfg --bold
|
||||
set -x color_vi_mode_visual $yellow $colorfg --bold
|
||||
|
||||
set -x color_vagrant $violet $colorfg --bold
|
||||
set -x color_k8s $green $colorfg --bold
|
||||
set -x color_username $base02 $blue --bold
|
||||
set -x color_hostname $base02 $blue
|
||||
set -x color_rvm $red $colorfg --bold
|
||||
set -x color_virtualfish $cyan $colorfg --bold
|
||||
set -x color_virtualgo $cyan $colorfg --bold
|
||||
set -x color_desk $cyan $colorfg --bold
|
||||
|
||||
case 'light'
|
||||
# light medium dark
|
||||
# ------ ------ ------
|
||||
set -l red cc9999 ce000f 660000
|
||||
set -l green addc10 189303 0c4801
|
||||
set -l blue 48b4fb 005faf 255e87
|
||||
set -l orange f6b117 unused 3a2a03
|
||||
set -l brown bf5e00 803f00 4d2600
|
||||
set -l grey cccccc 999999 333333
|
||||
set -l white ffffff
|
||||
set -l black 000000
|
||||
set -l ruby_red af0000
|
||||
|
||||
set -x color_initial_segment_exit $grey[3] $red[2] --bold
|
||||
set -x color_initial_segment_su $grey[3] $green[2] --bold
|
||||
set -x color_initial_segment_jobs $grey[3] $blue[3] --bold
|
||||
|
||||
set -x color_path $grey[1] $grey[2]
|
||||
set -x color_path_basename $grey[1] $grey[3] --bold
|
||||
set -x color_path_nowrite $red[1] $red[3]
|
||||
set -x color_path_nowrite_basename $red[1] $red[3] --bold
|
||||
|
||||
set -x color_repo $green[1] $green[3]
|
||||
set -x color_repo_work_tree $grey[1] $white --bold
|
||||
set -x color_repo_dirty $red[2] $white
|
||||
set -x color_repo_staged $orange[1] $orange[3]
|
||||
|
||||
set -x color_vi_mode_default $grey[2] $grey[3] --bold
|
||||
set -x color_vi_mode_insert $green[2] $grey[3] --bold
|
||||
set -x color_vi_mode_visual $orange[1] $orange[3] --bold
|
||||
|
||||
set -x color_vagrant $blue[1] $white --bold
|
||||
set -x color_k8s $green[1] $colorfg --bold
|
||||
set -x color_username $grey[1] $blue[3] --bold
|
||||
set -x color_hostname $grey[1] $blue[3]
|
||||
set -x color_rvm $ruby_red $grey[1] --bold
|
||||
set -x color_virtualfish $blue[2] $grey[1] --bold
|
||||
set -x color_virtualgo $blue[2] $grey[1] --bold
|
||||
set -x color_desk $blue[2] $grey[1] --bold
|
||||
|
||||
case 'gruvbox'
|
||||
# light medium dark darkest
|
||||
# ------ ------ ------ -------
|
||||
set -l red fb4934 cc241d
|
||||
set -l green b8bb26 98971a
|
||||
set -l yellow fabd2f d79921
|
||||
set -l aqua 8ec07c 689d6a
|
||||
set -l blue 83a598 458588
|
||||
set -l grey cccccc 999999 333333
|
||||
set -l fg fbf1c7 ebdbb2 d5c4a1 a89984
|
||||
set -l bg 504945 282828
|
||||
|
||||
set -x color_initial_segment_exit $fg[1] $red[2] --bold
|
||||
set -x color_initial_segment_su $fg[1] $green[2] --bold
|
||||
set -x color_initial_segment_jobs $fg[1] $aqua[2] --bold
|
||||
|
||||
set -x color_path $bg[1] $fg[2]
|
||||
set -x color_path_basename $bg[1] $fg[2] --bold
|
||||
set -x color_path_nowrite $red[1] $fg[2]
|
||||
set -x color_path_nowrite_basename $red[1] $fg[2] --bold
|
||||
|
||||
set -x color_repo $green[2] $bg[1]
|
||||
set -x color_repo_work_tree $bg[1] $fg[2] --bold
|
||||
set -x color_repo_dirty $red[2] $fg[2]
|
||||
set -x color_repo_staged $yellow[1] $bg[1]
|
||||
|
||||
set -x color_vi_mode_default $fg[4] $bg[2] --bold
|
||||
set -x color_vi_mode_insert $blue[1] $bg[2] --bold
|
||||
set -x color_vi_mode_visual $yellow[1] $bg[2] --bold
|
||||
|
||||
set -x color_vagrant $blue[2] $fg[2] --bold
|
||||
set -x color_k8s $green[2] $fg[2] --bold
|
||||
set -x color_username $fg[3] $blue[2] --bold
|
||||
set -x color_hostname $fg[3] $blue[2]
|
||||
set -x color_rvm $red[2] $fg[2] --bold
|
||||
set -x color_virtualfish $blue[2] $fg[2] --bold
|
||||
set -x color_virtualgo $blue[2] $fg[2] --bold
|
||||
set -x color_desk $blue[2] $fg[2] --bold
|
||||
|
||||
case 'dracula' # https://draculatheme.com
|
||||
set -l bg 282a36
|
||||
set -l current_line 44475a
|
||||
set -l selection 44475a
|
||||
set -l fg f8f8f2
|
||||
set -l comment 6272a4
|
||||
set -l cyan 8be9fd
|
||||
set -l green 50fa7b
|
||||
set -l orange ffb86c
|
||||
set -l pink ff79c6
|
||||
set -l purple bd93f9
|
||||
set -l red ff5555
|
||||
set -l yellow f1fa8c
|
||||
|
||||
set -x color_initial_segment_exit $fg $red --bold
|
||||
set -x color_initial_segment_su $fg $purple --bold
|
||||
set -x color_initial_segment_jobs $fg $comment --bold
|
||||
|
||||
set -x color_path $selection $fg
|
||||
set -x color_path_basename $selection $fg --bold
|
||||
set -x color_path_nowrite $selection $red
|
||||
set -x color_path_nowrite_basename $selection $red --bold
|
||||
|
||||
set -x color_repo $green $bg
|
||||
set -x color_repo_work_tree $selection $fg --bold
|
||||
set -x color_repo_dirty $red $bg
|
||||
set -x color_repo_staged $yellow $bg
|
||||
|
||||
set -x color_vi_mode_default $bg $yellow --bold
|
||||
set -x color_vi_mode_insert $green $bg --bold
|
||||
set -x color_vi_mode_visual $orange $bg --bold
|
||||
|
||||
set -x color_vagrant $pink $bg --bold
|
||||
set -x color_k8s $green $fg --bold
|
||||
set -x color_username $selection $cyan --bold
|
||||
set -x color_hostname $selection $cyan
|
||||
set -x color_rvm $red $bg --bold
|
||||
set -x color_virtualfish $comment $bg --bold
|
||||
set -x color_virtualgo $cyan $bg --bold
|
||||
set -x color_desk $comment $bg --bold
|
||||
|
||||
case '*' # default dark theme
|
||||
# light medium dark
|
||||
# ------ ------ ------
|
||||
set -l red cc9999 ce000f 660000
|
||||
set -l green addc10 189303 0c4801
|
||||
set -l blue 48b4fb 005faf 255e87
|
||||
set -l orange f6b117 unused 3a2a03
|
||||
set -l brown bf5e00 803f00 4d2600
|
||||
set -l grey cccccc 999999 333333
|
||||
set -l white ffffff
|
||||
set -l black 000000
|
||||
set -l ruby_red af0000
|
||||
set -l go_blue 00d7d7
|
||||
|
||||
set -x color_initial_segment_exit $white $red[2] --bold
|
||||
set -x color_initial_segment_su $white $green[2] --bold
|
||||
set -x color_initial_segment_jobs $white $blue[3] --bold
|
||||
|
||||
set -x color_path $grey[3] $grey[2]
|
||||
set -x color_path_basename $grey[3] $white --bold
|
||||
set -x color_path_nowrite $red[3] $red[1]
|
||||
set -x color_path_nowrite_basename $red[3] $red[1] --bold
|
||||
|
||||
set -x color_repo $green[1] $green[3]
|
||||
set -x color_repo_work_tree $grey[3] $white --bold
|
||||
set -x color_repo_dirty $red[2] $white
|
||||
set -x color_repo_staged $orange[1] $orange[3]
|
||||
|
||||
set -x color_vi_mode_default $grey[2] $grey[3] --bold
|
||||
set -x color_vi_mode_insert $green[2] $grey[3] --bold
|
||||
set -x color_vi_mode_visual $orange[1] $orange[3] --bold
|
||||
|
||||
set -x color_vagrant $blue[1] $white --bold
|
||||
set -x color_k8s $green[2] $white --bold
|
||||
set -x color_username $grey[1] $blue[3] --bold
|
||||
set -x color_hostname $grey[1] $blue[3]
|
||||
set -x color_rvm $ruby_red $grey[1] --bold
|
||||
set -x color_virtualfish $blue[2] $grey[1] --bold
|
||||
set -x color_virtualgo $go_blue $black --bold
|
||||
set -x color_desk $blue[2] $grey[1] --bold
|
||||
end
|
||||
end
|
||||
|
||||
function __bobthefish_user_color_scheme_deprecated
|
||||
set -q __color_initial_segment_exit; or set -l __color_initial_segment_exit ffffff ce000f --bold
|
||||
set -q __color_initial_segment_su; or set -l __color_initial_segment_su ffffff 189303 --bold
|
||||
set -q __color_initial_segment_jobs; or set -l __color_initial_segment_jobs ffffff 255e87 --bold
|
||||
set -q __color_path; or set -l __color_path 333333 999999
|
||||
set -q __color_path_basename; or set -l __color_path_basename 333333 ffffff --bold
|
||||
set -q __color_path_nowrite; or set -l __color_path_nowrite 660000 cc9999
|
||||
set -q __color_path_nowrite_basename; or set -l __color_path_nowrite_basename 660000 cc9999 --bold
|
||||
set -q __color_repo; or set -l __color_repo addc10 0c4801
|
||||
set -q __color_repo_work_tree; or set -l __color_repo_work_tree 333333 ffffff --bold
|
||||
set -q __color_repo_dirty; or set -l __color_repo_dirty ce000f ffffff
|
||||
set -q __color_repo_staged; or set -l __color_repo_staged f6b117 3a2a03
|
||||
set -q __color_vi_mode_default; or set -l __color_vi_mode_default 999999 333333 --bold
|
||||
set -q __color_vi_mode_insert; or set -l __color_vi_mode_insert 189303 333333 --bold
|
||||
set -q __color_vi_mode_visual; or set -l __color_vi_mode_visual f6b117 3a2a03 --bold
|
||||
set -q __color_vagrant; or set -l __color_vagrant 48b4fb ffffff --bold
|
||||
set -q __color_username; or set -l __color_username cccccc 255e87 --bold
|
||||
set -q __color_hostname; or set -l __color_hostname cccccc 255e87
|
||||
set -q __color_rvm; or set -l __color_rvm af0000 cccccc --bold
|
||||
set -q __color_virtualfish; or set -l __color_virtualfish 005faf cccccc --bold
|
||||
set -q __color_virtualgo; or set -l __color_virtualgo 005faf cccccc --bold
|
||||
set -q __color_desk; or set -l __color_desk 005faf cccccc --bold
|
||||
|
||||
set_color black -b red --bold
|
||||
echo "The 'user' color scheme is deprecated."
|
||||
set_color normal
|
||||
set_color black -b red
|
||||
echo "To define a custom color scheme, create a 'bobthefish_colors' function:"
|
||||
set_color normal
|
||||
echo
|
||||
|
||||
echo "function bobthefish_colors -S -d 'Define a custom bobthefish color scheme'
|
||||
|
||||
# optionally include a base color scheme...
|
||||
___bobthefish_colors default
|
||||
|
||||
# then override everything you want! note that these must be defined with `set -x`
|
||||
set -x color_initial_segment_exit $__color_initial_segment_exit
|
||||
set -x color_initial_segment_su $__color_initial_segment_su
|
||||
set -x color_initial_segment_jobs $__color_initial_segment_jobs
|
||||
set -x color_path $__color_path
|
||||
set -x color_path_basename $__color_path_basename
|
||||
set -x color_path_nowrite $__color_path_nowrite
|
||||
set -x color_path_nowrite_basename $__color_path_nowrite_basename
|
||||
set -x color_repo $__color_repo
|
||||
set -x color_repo_work_tree $__color_repo_work_tree
|
||||
set -x color_repo_dirty $__color_repo_dirty
|
||||
set -x color_repo_staged $__color_repo_staged
|
||||
set -x color_vi_mode_default $__color_vi_mode_default
|
||||
set -x color_vi_mode_insert $__color_vi_mode_insert
|
||||
set -x color_vi_mode_visual $__color_vi_mode_visual
|
||||
set -x color_vagrant $__color_vagrant
|
||||
set -x color_username $__color_username
|
||||
set -x color_hostname $__color_hostname
|
||||
set -x color_rvm $__color_rvm
|
||||
set -x color_virtualfish $__color_virtualfish
|
||||
set -x color_virtualgo $__color_virtualgo
|
||||
set -x color_desk $__color_desk
|
||||
end"
|
||||
|
||||
echo
|
||||
end
|
||||
@ -0,0 +1,3 @@
|
||||
function __bobthefish_display_colors -d 'Print example prompts using the current color scheme'
|
||||
bobthefish_display_colors
|
||||
end
|
||||
89
fish/.config/fish/functions/__bobthefish_glyphs.fish
Normal file
89
fish/.config/fish/functions/__bobthefish_glyphs.fish
Normal file
@ -0,0 +1,89 @@
|
||||
function __bobthefish_glyphs -S -d 'Define glyphs used by bobthefish'
|
||||
# Powerline glyphs
|
||||
set -x branch_glyph \uE0A0
|
||||
set -x right_black_arrow_glyph \uE0B0
|
||||
set -x right_arrow_glyph \uE0B1
|
||||
set -x left_black_arrow_glyph \uE0B2
|
||||
set -x left_arrow_glyph \uE0B3
|
||||
|
||||
# Additional glyphs
|
||||
set -x detached_glyph \u27A6
|
||||
set -x tag_glyph \u2302
|
||||
set -x nonzero_exit_glyph '! '
|
||||
set -x superuser_glyph '$ '
|
||||
set -x bg_job_glyph '% '
|
||||
set -x hg_glyph \u263F
|
||||
|
||||
# Python glyphs
|
||||
set -x superscript_glyph \u00B9 \u00B2 \u00B3
|
||||
set -x virtualenv_glyph \u25F0
|
||||
set -x pypy_glyph \u1D56
|
||||
|
||||
set -x ruby_glyph ''
|
||||
set -x go_glyph ''
|
||||
|
||||
# Desk glyphs
|
||||
set -x desk_glyph \u25F2
|
||||
|
||||
# Vagrant glyphs
|
||||
set -x vagrant_running_glyph \u2191 # ↑ 'running'
|
||||
set -x vagrant_poweroff_glyph \u2193 # ↓ 'poweroff'
|
||||
set -x vagrant_aborted_glyph \u2715 # ✕ 'aborted'
|
||||
set -x vagrant_saved_glyph \u21E1 # ⇡ 'saved'
|
||||
set -x vagrant_stopping_glyph \u21E3 # ⇣ 'stopping'
|
||||
set -x vagrant_unknown_glyph '!' # strange cases
|
||||
|
||||
# Git glyphs
|
||||
set -x git_dirty_glyph '*'
|
||||
set -x git_staged_glyph '~'
|
||||
set -x git_stashed_glyph '$'
|
||||
set -x git_untracked_glyph '…'
|
||||
set -x git_ahead_glyph \u2191 # '↑'
|
||||
set -x git_behind_glyph \u2193 # '↓'
|
||||
set -x git_plus_glyph '+'
|
||||
set -x git_minus_glyph '-'
|
||||
set -x git_plus_minus_glyph '±'
|
||||
|
||||
# Disable Powerline fonts
|
||||
if [ "$theme_powerline_fonts" = "no" ]
|
||||
set branch_glyph \u2387
|
||||
set right_black_arrow_glyph ''
|
||||
set right_arrow_glyph ''
|
||||
set left_black_arrow_glyph ''
|
||||
set left_arrow_glyph ''
|
||||
end
|
||||
|
||||
# Use prettier Nerd Fonts glyphs
|
||||
if [ "$theme_nerd_fonts" = "yes" ]
|
||||
set branch_glyph \uF418
|
||||
set detached_glyph \uF417
|
||||
set tag_glyph \uF412
|
||||
|
||||
set virtualenv_glyph \uE73C ' '
|
||||
set ruby_glyph \uE791 ' '
|
||||
set go_glyph \uE626 ' '
|
||||
|
||||
set vagrant_running_glyph \uF431 # ↑ 'running'
|
||||
set vagrant_poweroff_glyph \uF433 # ↓ 'poweroff'
|
||||
set vagrant_aborted_glyph \uF468 # ✕ 'aborted'
|
||||
set vagrant_unknown_glyph \uF421 # strange cases
|
||||
|
||||
set git_dirty_glyph \uF448 '' # nf-oct-pencil
|
||||
set git_staged_glyph \uF0C7 '' # nf-fa-save
|
||||
set git_stashed_glyph \uF0C6 '' # nf-fa-paperclip
|
||||
set git_untracked_glyph \uF128 '' # nf-fa-question
|
||||
# set git_untracked_glyph \uF141 '' # nf-fa-ellipsis_h
|
||||
|
||||
set git_ahead_glyph \uF47B # nf-oct-chevron_up
|
||||
set git_behind_glyph \uF47C # nf-oct-chevron_down
|
||||
|
||||
set git_plus_glyph \uF0DE # fa-sort-asc
|
||||
set git_minus_glyph \uF0DD # fa-sort-desc
|
||||
set git_plus_minus_glyph \uF0DC # fa-sort
|
||||
end
|
||||
|
||||
# Avoid ambiguous glyphs
|
||||
if [ "$theme_avoid_ambiguous_glyphs" = "yes" ]
|
||||
set git_untracked_glyph '...'
|
||||
end
|
||||
end
|
||||
5
fish/.config/fish/functions/__fasd_print_completion.fish
Normal file
5
fish/.config/fish/functions/__fasd_print_completion.fish
Normal file
@ -0,0 +1,5 @@
|
||||
# suggest paths for current args as completion
|
||||
function __fasd_print_completion
|
||||
set cmd (commandline -po)
|
||||
test (count $cmd) -ge 2; and fasd $argv $cmd[2..-1] -l
|
||||
end
|
||||
49
fish/.config/fish/functions/__fzf_cd.fish
Normal file
49
fish/.config/fish/functions/__fzf_cd.fish
Normal file
@ -0,0 +1,49 @@
|
||||
function __fzf_cd -d "Change directory"
|
||||
set -l commandline (__fzf_parse_commandline)
|
||||
set -l dir $commandline[1]
|
||||
set -l fzf_query $commandline[2]
|
||||
|
||||
if not type -q argparse
|
||||
# Fallback for fish shell version < 2.7
|
||||
function argparse
|
||||
functions -e argparse # deletes itself
|
||||
end
|
||||
if contains -- --hidden $argv; or contains -- -h $argv
|
||||
set _flag_hidden "yes"
|
||||
end
|
||||
end
|
||||
|
||||
# Fish shell version >= v2.7, use argparse
|
||||
set -l options "h/hidden"
|
||||
argparse $options -- $argv
|
||||
|
||||
set -l COMMAND
|
||||
|
||||
set -q FZF_CD_COMMAND
|
||||
or set -l FZF_CD_COMMAND "
|
||||
command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \
|
||||
-o -type d -print 2> /dev/null | sed 's@^\./@@'"
|
||||
|
||||
set -q FZF_CD_WITH_HIDDEN_COMMAND
|
||||
or set -l FZF_CD_WITH_HIDDEN_COMMAND "
|
||||
command find -L \$dir \
|
||||
\\( -path '*/\\.git*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \
|
||||
-o -type d -print 2> /dev/null | sed 1d | cut -b3-"
|
||||
|
||||
if set -q _flag_hidden
|
||||
set COMMAND $FZF_CD_WITH_HIDDEN_COMMAND
|
||||
else
|
||||
set COMMAND $FZF_CD_COMMAND
|
||||
end
|
||||
|
||||
eval "$COMMAND | "(__fzfcmd)" +m $FZF_DEFAULT_OPTS $FZF_CD_OPTS --query \"$fzf_query\"" | read -l select
|
||||
|
||||
if not test -z "$select"
|
||||
builtin cd "$select"
|
||||
|
||||
# Remove last token from commandline.
|
||||
commandline -t ""
|
||||
end
|
||||
|
||||
commandline -f repaint
|
||||
end
|
||||
162
fish/.config/fish/functions/__fzf_complete.fish
Normal file
162
fish/.config/fish/functions/__fzf_complete.fish
Normal file
@ -0,0 +1,162 @@
|
||||
##
|
||||
# Use fzf as fish completion widget.
|
||||
#
|
||||
#
|
||||
# When FZF_COMPLETE variable is set, fzf is used as completion
|
||||
# widget for the fish shell by binding the TAB key.
|
||||
#
|
||||
# FZF_COMPLETE can have some special numeric values:
|
||||
#
|
||||
# `set FZF_COMPLETE 0` basic widget accepts with TAB key
|
||||
# `set FZF_COMPLETE 1` extends 0 with candidate preview window
|
||||
# `set FZF_COMPLETE 2` same as 1 but TAB walks on candidates
|
||||
# `set FZF_COMPLETE 3` multi TAB selection, RETURN accepts selected ones.
|
||||
#
|
||||
# Any other value of FZF_COMPLETE is given directly as options to fzf.
|
||||
#
|
||||
# If you prefer to set more advanced options, take a look at the
|
||||
# `__fzf_complete_opts` function and override that in your environment.
|
||||
|
||||
|
||||
# modified from https://github.com/junegunn/fzf/wiki/Examples-(fish)#completion
|
||||
function __fzf_complete -d 'fzf completion and print selection back to commandline'
|
||||
# As of 2.6, fish's "complete" function does not understand
|
||||
# subcommands. Instead, we use the same hack as __fish_complete_subcommand and
|
||||
# extract the subcommand manually.
|
||||
set -l cmd (commandline -co) (commandline -ct)
|
||||
|
||||
switch $cmd[1]
|
||||
case env sudo
|
||||
for i in (seq 2 (count $cmd))
|
||||
switch $cmd[$i]
|
||||
case '-*'
|
||||
case '*=*'
|
||||
case '*'
|
||||
set cmd $cmd[$i..-1]
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
set -l cmd_lastw $cmd[-1]
|
||||
set cmd (string join -- ' ' $cmd)
|
||||
|
||||
set -l initial_query ''
|
||||
test -n "$cmd_lastw"; and set initial_query --query="$cmd_lastw"
|
||||
|
||||
set -l complist (complete -C$cmd)
|
||||
set -l result
|
||||
|
||||
# do nothing if there is nothing to select from
|
||||
test -z "$complist"; and return
|
||||
|
||||
set -l compwc (echo $complist | wc -w)
|
||||
if test $compwc -eq 1
|
||||
# if there is only one option dont open fzf
|
||||
set result "$complist"
|
||||
else
|
||||
|
||||
set -l query
|
||||
string join -- \n $complist \
|
||||
| sort \
|
||||
| eval (__fzfcmd) $initial_query --print-query (__fzf_complete_opts) \
|
||||
| cut -f1 \
|
||||
| while read -l r
|
||||
# first line is the user entered query
|
||||
if test -z "$query"
|
||||
set query $r
|
||||
# rest of lines are selected candidates
|
||||
else
|
||||
set result $result $r
|
||||
end
|
||||
end
|
||||
|
||||
# exit if user canceled
|
||||
if test -z "$query" ;and test -z "$result"
|
||||
return
|
||||
end
|
||||
|
||||
# if user accepted but no candidate matches, use the input as result
|
||||
if test -z "$result"
|
||||
set result $query
|
||||
end
|
||||
end
|
||||
|
||||
set prefix (string sub -s 1 -l 1 -- (commandline -t))
|
||||
for i in (seq (count $result))
|
||||
set -l r $result[$i]
|
||||
switch $prefix
|
||||
case "'"
|
||||
commandline -t -- (string escape -- $r)
|
||||
case '"'
|
||||
if string match '*"*' -- $r >/dev/null
|
||||
commandline -t -- (string escape -- $r)
|
||||
else
|
||||
commandline -t -- '"'$r'"'
|
||||
end
|
||||
case '~'
|
||||
commandline -t -- (string sub -s 2 (string escape -n -- $r))
|
||||
case '*'
|
||||
commandline -t -- (string escape -n -- $r)
|
||||
end
|
||||
[ $i -lt (count $result) ]; and commandline -i ' '
|
||||
end
|
||||
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
function __fzf_complete_opts_common
|
||||
echo --cycle --reverse --inline-info
|
||||
end
|
||||
|
||||
function __fzf_complete_opts_tab_accepts
|
||||
echo --bind tab:accept,btab:cancel
|
||||
end
|
||||
|
||||
function __fzf_complete_opts_tab_walks
|
||||
echo --bind tab:down,btab:up
|
||||
end
|
||||
|
||||
function __fzf_complete_opts_preview
|
||||
set -l file (status -f)
|
||||
echo --with-nth=1 --preview-window=right:wrap --preview="fish\ '$file'\ __fzf_complete_preview\ '{1}'\ '{2..}'"
|
||||
end
|
||||
|
||||
test "$argv[1]" = "__fzf_complete_preview"; and __fzf_complete_preview $argv[2..3]
|
||||
|
||||
function __fzf_complete_opts_0 -d 'basic single selection with tab accept'
|
||||
__fzf_complete_opts_common
|
||||
echo --no-multi
|
||||
__fzf_complete_opts_tab_accepts
|
||||
end
|
||||
|
||||
function __fzf_complete_opts_1 -d 'single selection with preview and tab accept'
|
||||
__fzf_complete_opts_0
|
||||
__fzf_complete_opts_preview
|
||||
end
|
||||
|
||||
function __fzf_complete_opts_2 -d 'single selection with preview and tab walks'
|
||||
__fzf_complete_opts_1
|
||||
__fzf_complete_opts_tab_walks
|
||||
end
|
||||
|
||||
function __fzf_complete_opts_3 -d 'multi selection with preview'
|
||||
__fzf_complete_opts_common
|
||||
echo --multi
|
||||
__fzf_complete_opts_preview
|
||||
end
|
||||
|
||||
function __fzf_complete_opts -d 'fzf options for fish tab completion'
|
||||
switch $FZF_COMPLETE
|
||||
case 0
|
||||
__fzf_complete_opts_0
|
||||
case 1
|
||||
__fzf_complete_opts_1
|
||||
case 2
|
||||
__fzf_complete_opts_2
|
||||
case 3
|
||||
__fzf_complete_opts_3
|
||||
case '*'
|
||||
echo $FZF_COMPLETE
|
||||
end
|
||||
end
|
||||
29
fish/.config/fish/functions/__fzf_complete_preview.fish
Normal file
29
fish/.config/fish/functions/__fzf_complete_preview.fish
Normal file
@ -0,0 +1,29 @@
|
||||
function __fzf_complete_preview -d 'generate preview for completion widget.
|
||||
argv[1] is the currently selected candidate in fzf
|
||||
argv[2] is a string containing the rest of the output produced by `complete -Ccmd`
|
||||
'
|
||||
|
||||
if test "$argv[2]" = "Redefine variable"
|
||||
# show environment variables current value
|
||||
set -l evar (echo $argv[1] | cut -d= -f1)
|
||||
echo $argv[1]$$evar
|
||||
else
|
||||
echo $argv[1]
|
||||
end
|
||||
|
||||
# list directories on preview
|
||||
if test -d "$argv[1]"
|
||||
eval $FZF_PREVIEW_DIR_CMD (string escape $argv[1])
|
||||
end
|
||||
|
||||
# show ten lines of non-binary files preview
|
||||
if test -f "$argv[1]"; and grep -qI . "$argv[1]"
|
||||
eval $FZF_PREVIEW_FILE_CMD (string escape $argv[1])
|
||||
end
|
||||
|
||||
# if fish knows about it, let it show info
|
||||
type -q "$argv[1]" 2>/dev/null; and type -a "$argv[1]"
|
||||
|
||||
# show aditional data
|
||||
echo $argv[2]
|
||||
end
|
||||
29
fish/.config/fish/functions/__fzf_find_file.fish
Normal file
29
fish/.config/fish/functions/__fzf_find_file.fish
Normal file
@ -0,0 +1,29 @@
|
||||
function __fzf_find_file -d "List files and folders"
|
||||
set -l commandline (__fzf_parse_commandline)
|
||||
set -l dir $commandline[1]
|
||||
set -l fzf_query $commandline[2]
|
||||
|
||||
set -q FZF_FIND_FILE_COMMAND
|
||||
or set -l FZF_FIND_FILE_COMMAND "
|
||||
command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \
|
||||
-o -type f -print \
|
||||
-o -type d -print \
|
||||
-o -type l -print 2> /dev/null | sed 's@^\./@@'"
|
||||
|
||||
begin
|
||||
eval "$FZF_FIND_FILE_COMMAND | "(__fzfcmd) "-m $FZF_DEFAULT_OPTS $FZF_FIND_FILE_OPTS --query \"$fzf_query\"" | while read -l s; set results $results $s; end
|
||||
end
|
||||
|
||||
if test -z "$results"
|
||||
commandline -f repaint
|
||||
return
|
||||
else
|
||||
commandline -t ""
|
||||
end
|
||||
|
||||
for result in $results
|
||||
commandline -it -- (string escape $result)
|
||||
commandline -it -- " "
|
||||
end
|
||||
commandline -f repaint
|
||||
end
|
||||
17
fish/.config/fish/functions/__fzf_get_dir.fish
Normal file
17
fish/.config/fish/functions/__fzf_get_dir.fish
Normal file
@ -0,0 +1,17 @@
|
||||
function __fzf_get_dir -d 'Find the longest existing filepath from input string'
|
||||
set dir $argv
|
||||
|
||||
# Strip all trailing slashes. Ignore if $dir is root dir (/)
|
||||
if [ (string length $dir) -gt 1 ]
|
||||
set dir (string replace -r '/*$' '' $dir)
|
||||
end
|
||||
|
||||
# Iteratively check if dir exists and strip tail end of path
|
||||
while [ ! -d "$dir" ]
|
||||
# If path is absolute, this can keep going until ends up at /
|
||||
# If path is relative, this can keep going until entire input is consumed, dirname returns "."
|
||||
set dir (dirname "$dir")
|
||||
end
|
||||
|
||||
echo $dir
|
||||
end
|
||||
63
fish/.config/fish/functions/__fzf_open.fish
Normal file
63
fish/.config/fish/functions/__fzf_open.fish
Normal file
@ -0,0 +1,63 @@
|
||||
function __fzf_open -d "Open files and directories."
|
||||
function __fzf_open_get_open_cmd -d "Find appropriate open command."
|
||||
if type -q xdg-open
|
||||
echo "xdg-open"
|
||||
else if type -q open
|
||||
echo "open"
|
||||
end
|
||||
end
|
||||
|
||||
set -l commandline (__fzf_parse_commandline)
|
||||
set -l dir $commandline[1]
|
||||
set -l fzf_query $commandline[2]
|
||||
|
||||
if not type -q argparse
|
||||
set created_argparse
|
||||
function argparse
|
||||
functions -e argparse # deletes itself
|
||||
end
|
||||
if contains -- --editor $argv; or contains -- -e $argv
|
||||
set _flag_editor "yes"
|
||||
end
|
||||
if contains -- --preview $argv; or contains -- -p $argv
|
||||
set _flag_preview "yes"
|
||||
end
|
||||
end
|
||||
|
||||
set -l options "e/editor" "p/preview=?"
|
||||
argparse $options -- $argv
|
||||
|
||||
set -l preview_cmd
|
||||
if set -q FZF_ENABLE_OPEN_PREVIEW
|
||||
set preview_cmd "--preview-window=right:wrap --preview='fish -c \"__fzf_complete_preview {}\"'"
|
||||
end
|
||||
|
||||
set -q FZF_OPEN_COMMAND
|
||||
or set -l FZF_OPEN_COMMAND "
|
||||
command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \
|
||||
-o -type f -print \
|
||||
-o -type d -print \
|
||||
-o -type l -print 2> /dev/null | sed 's@^\./@@'"
|
||||
|
||||
eval "$FZF_OPEN_COMMAND | "(__fzfcmd) $preview_cmd "-m $FZF_DEFAULT_OPTS $FZF_OPEN_OPTS --query \"$fzf_query\"" | read -l select
|
||||
|
||||
# set how to open
|
||||
set -l open_cmd
|
||||
if set -q _flag_editor
|
||||
set open_cmd "$EDITOR"
|
||||
else
|
||||
set open_cmd (__fzf_open_get_open_cmd)
|
||||
if test -z "$open_cmd"
|
||||
echo "Couldn't find appropriate open command to use. Do you have 'xdg-open' or 'open' installed?"; and return 1
|
||||
end
|
||||
end
|
||||
|
||||
set -l open_status 0
|
||||
if not test -z "$select"
|
||||
commandline "$open_cmd \"$select\"" ;and commandline -f execute
|
||||
set open_status $status
|
||||
end
|
||||
|
||||
commandline -f repaint
|
||||
return $open_status
|
||||
end
|
||||
23
fish/.config/fish/functions/__fzf_parse_commandline.fish
Normal file
23
fish/.config/fish/functions/__fzf_parse_commandline.fish
Normal file
@ -0,0 +1,23 @@
|
||||
function __fzf_parse_commandline -d 'Parse the current command line token and return split of existing filepath and rest of token'
|
||||
# eval is used to do shell expansion on paths
|
||||
set -l commandline (eval "printf '%s' "(commandline -t))
|
||||
|
||||
if [ -z $commandline ]
|
||||
# Default to current directory with no --query
|
||||
set dir '.'
|
||||
set fzf_query ''
|
||||
else
|
||||
set dir (__fzf_get_dir $commandline)
|
||||
|
||||
if [ "$dir" = "." -a (string sub -l 1 $commandline) != '.' ]
|
||||
# if $dir is "." but commandline is not a relative path, this means no file path found
|
||||
set fzf_query $commandline
|
||||
else
|
||||
# Also remove trailing slash after dir, to "split" input properly
|
||||
set fzf_query (string replace -r "^$dir/?" '' "$commandline")
|
||||
end
|
||||
end
|
||||
|
||||
echo $dir
|
||||
echo $fzf_query
|
||||
end
|
||||
5
fish/.config/fish/functions/__fzf_reverse_isearch.fish
Normal file
5
fish/.config/fish/functions/__fzf_reverse_isearch.fish
Normal file
@ -0,0 +1,5 @@
|
||||
function __fzf_reverse_isearch
|
||||
history -z | eval (__fzfcmd) --read0 --tiebreak=index --toggle-sort=ctrl-r $FZF_DEFAULT_OPTS $FZF_REVERSE_ISEARCH_OPTS -q '(commandline)' | perl -pe 'chomp if eof' | read -lz result
|
||||
and commandline -- $result
|
||||
commandline -f repaint
|
||||
end
|
||||
9
fish/.config/fish/functions/__fzfcmd.fish
Normal file
9
fish/.config/fish/functions/__fzfcmd.fish
Normal file
@ -0,0 +1,9 @@
|
||||
function __fzfcmd
|
||||
set -q FZF_TMUX; or set FZF_TMUX 0
|
||||
set -q FZF_TMUX_HEIGHT; or set FZF_TMUX_HEIGHT 40%
|
||||
if [ $FZF_TMUX -eq 1 ]
|
||||
echo "fzf-tmux -d$FZF_TMUX_HEIGHT"
|
||||
else
|
||||
echo "fzf"
|
||||
end
|
||||
end
|
||||
151
fish/.config/fish/functions/__z.fish
Normal file
151
fish/.config/fish/functions/__z.fish
Normal file
@ -0,0 +1,151 @@
|
||||
function __z -d "Jump to a recent directory."
|
||||
function __print_help -d "Print z help."
|
||||
printf "Usage: $Z_CMD [-celrth] regex1 regex2...\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"
|
||||
|
||||
if type -q fisher
|
||||
printf "Run `fisher help z` for more information.\n"
|
||||
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
|
||||
}
|
||||
}
|
||||
if( common ) {
|
||||
printf "%-10s %s\n", "common:", common > "/dev/stderr"
|
||||
}
|
||||
} 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 {
|
||||
gsub(" ", ".*", q)
|
||||
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))
|
||||
}
|
||||
}
|
||||
'
|
||||
|
||||
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="$argv" -F "|" $z_script "$Z_DATA"
|
||||
else
|
||||
set target (command awk -v t=(date +%s) -v typ="$typ" -v q="$argv" -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_list
|
||||
echo "$target" | tr ";" "\n" | sort -nr
|
||||
return 0
|
||||
end
|
||||
|
||||
if set -q _flag_echo
|
||||
printf "%s\n" "$target"
|
||||
else if set -q _flag_directory
|
||||
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;
|
||||
else
|
||||
pushd "$target"
|
||||
end
|
||||
end
|
||||
end
|
||||
48
fish/.config/fish/functions/__z_add.fish
Normal file
48
fish/.config/fish/functions/__z_add.fish
Normal file
@ -0,0 +1,48 @@
|
||||
function __z_add -d "Add PATH to .z file"
|
||||
for i in $Z_EXCLUDE
|
||||
if contains -- $PWD $i
|
||||
return 0 #Path excluded
|
||||
end
|
||||
end
|
||||
|
||||
set -l tmpfile (mktemp $Z_DATA.XXXXXX)
|
||||
|
||||
if test -f $tmpfile
|
||||
command awk -v path="$PWD" -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
|
||||
|
||||
__z_complete
|
||||
end
|
||||
10
fish/.config/fish/functions/__z_clean.fish
Normal file
10
fish/.config/fish/functions/__z_clean.fish
Normal file
@ -0,0 +1,10 @@
|
||||
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
|
||||
command awk -F "|" 'system("test -d \"" $1 "\"") == 0 { print $0 }' $Z_DATA > $tmpfile
|
||||
command mv -f $tmpfile $Z_DATA
|
||||
end
|
||||
|
||||
__z_complete
|
||||
end
|
||||
14
fish/.config/fish/functions/__z_complete.fish
Normal file
14
fish/.config/fish/functions/__z_complete.fish
Normal file
@ -0,0 +1,14 @@
|
||||
function __z_complete -d "add completions"
|
||||
set -l __z_marks (string replace -r '\|.*' '' < $Z_DATA | string escape)
|
||||
|
||||
complete -c $Z_CMD -a "$__z_marks" -f
|
||||
complete -c $ZO_CMD -a "$__z_marks" -f
|
||||
|
||||
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"
|
||||
end
|
||||
3
fish/.config/fish/functions/a.fish
Normal file
3
fish/.config/fish/functions/a.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function a -d "Match files and directories"
|
||||
fasd -a $argv
|
||||
end
|
||||
15
fish/.config/fish/functions/asdf.fish
Normal file
15
fish/.config/fish/functions/asdf.fish
Normal file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
set -l asdf_dir (dirname (status -f))
|
||||
set -l asdf_data_dir (
|
||||
if test -n "$ASDF_DATA_DIR"; echo $ASDF_DATA_DIR;
|
||||
else; echo $HOME/.asdf; end)
|
||||
|
||||
# Add asdf to PATH
|
||||
set -l asdf_bin_dirs $asdf_dir/bin $asdf_dir/shims $asdf_data_dir/shims
|
||||
|
||||
for x in $asdf_bin_dirs
|
||||
if begin not contains $x $fish_user_paths; and test -d $x; end
|
||||
set -gx fish_user_paths $fish_user_paths $x
|
||||
end
|
||||
end
|
||||
27
fish/.config/fish/functions/bass.fish
Normal file
27
fish/.config/fish/functions/bass.fish
Normal file
@ -0,0 +1,27 @@
|
||||
function bass
|
||||
set __bash_args $argv
|
||||
if test "$__bash_args[1]_" = '-d_'
|
||||
set __bass_debug
|
||||
set -e __bash_args[1]
|
||||
end
|
||||
|
||||
python (dirname (status -f))/__bass.py $__bash_args | read -z __script
|
||||
set __errorflag (string sub -s 1 -l 7 "$__script")
|
||||
if test "$__script" = '__usage'
|
||||
echo "Usage: bass [-d] <bash-command>"
|
||||
else if test "x$__errorflag" = 'x__error'
|
||||
echo "Bass encountered an error!"
|
||||
set __exitcode (string sub -s 9 "$__script")
|
||||
set __exitcode (string trim $__exitcode)
|
||||
if test -z $__exitcode
|
||||
return 1
|
||||
else
|
||||
return $__exitcode
|
||||
end
|
||||
else
|
||||
echo -e "$__script" | source -
|
||||
if set -q __bass_debug
|
||||
echo "$__script"
|
||||
end
|
||||
end
|
||||
end
|
||||
133
fish/.config/fish/functions/bobthefish_display_colors.fish
Normal file
133
fish/.config/fish/functions/bobthefish_display_colors.fish
Normal file
@ -0,0 +1,133 @@
|
||||
function bobthefish_display_colors -a color_scheme -d 'Print example prompt color schemes'
|
||||
|
||||
set -l color_schemes default light \
|
||||
solarized solarized-light \
|
||||
base16 base16-light \
|
||||
gruvbox zenburn \
|
||||
dracula \
|
||||
terminal terminal-dark-white \
|
||||
terminal-light terminal-light-black \
|
||||
terminal2 terminal2-dark-white \
|
||||
terminal2-light terminal2-light-black
|
||||
|
||||
switch "$color_scheme"
|
||||
case '--all'
|
||||
for scheme in $color_schemes
|
||||
echo
|
||||
echo "$scheme:"
|
||||
bobthefish_display_colors $scheme
|
||||
end
|
||||
return
|
||||
|
||||
case $color_schemes
|
||||
__bobthefish_colors $color_scheme
|
||||
|
||||
case ''
|
||||
__bobthefish_colors $theme_color_scheme
|
||||
type -q bobthefish_colors
|
||||
and bobthefish_colors
|
||||
|
||||
case '*'
|
||||
echo 'usage: bobthefish_display_colors [--all] [color_scheme]'
|
||||
return
|
||||
end
|
||||
|
||||
__bobthefish_glyphs
|
||||
|
||||
echo
|
||||
set_color normal
|
||||
|
||||
__bobthefish_start_segment $color_initial_segment_exit
|
||||
echo -n exit $nonzero_exit_glyph
|
||||
set_color -b $color_initial_segment_su
|
||||
echo -n su $superuser_glyph
|
||||
set_color -b $color_initial_segment_jobs
|
||||
echo -n jobs $bg_job_glyph
|
||||
__bobthefish_finish_segments
|
||||
set_color normal
|
||||
echo -n "(<- initial_segment)"
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_path
|
||||
echo -n /color/path/
|
||||
set_color -b $color_path_basename
|
||||
echo -ns basename ' '
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_path_nowrite
|
||||
echo -n /color/path/nowrite/
|
||||
set_color -b $color_path_nowrite_basename
|
||||
echo -ns basename ' '
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_path
|
||||
echo -n /color/path/
|
||||
set_color -b $color_path_basename
|
||||
echo -ns basename ' '
|
||||
__bobthefish_start_segment $color_repo
|
||||
echo -n "$branch_glyph repo $git_stashed_glyph "
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_path
|
||||
echo -n /color/path/
|
||||
set_color -b $color_path_basename
|
||||
echo -ns basename ' '
|
||||
__bobthefish_start_segment $color_repo_dirty
|
||||
echo -n "$tag_glyph repo_dirty $git_dirty_glyph "
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_path
|
||||
echo -n /color/path/
|
||||
set_color -b $color_path_basename
|
||||
echo -ns basename ' '
|
||||
__bobthefish_start_segment $color_repo_staged
|
||||
echo -n "$detached_glyph repo_staged $git_staged_glyph "
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_vi_mode_default
|
||||
echo -ns vi_mode_default ' '
|
||||
__bobthefish_finish_segments
|
||||
__bobthefish_start_segment $color_vi_mode_insert
|
||||
echo -ns vi_mode_insert ' '
|
||||
__bobthefish_finish_segments
|
||||
__bobthefish_start_segment $color_vi_mode_visual
|
||||
echo -ns vi_mode_visual ' '
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_vagrant
|
||||
echo -ns $vagrant_running_glyph ' ' vagrant ' '
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_username
|
||||
echo -n username
|
||||
set_color normal
|
||||
set_color -b $color_hostname[1] $color_hostname[2..-1]
|
||||
echo -ns @hostname ' '
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_rvm
|
||||
echo -ns $ruby_glyph rvm ' '
|
||||
__bobthefish_finish_segments
|
||||
|
||||
__bobthefish_start_segment $color_virtualfish
|
||||
echo -ns $virtualenv_glyph virtualfish ' '
|
||||
__bobthefish_finish_segments
|
||||
|
||||
__bobthefish_start_segment $color_virtualgo
|
||||
echo -ns $go_glyph virtualgo ' '
|
||||
__bobthefish_finish_segments
|
||||
|
||||
__bobthefish_start_segment $color_desk
|
||||
echo -ns $desk_glyph desk ' '
|
||||
__bobthefish_finish_segments
|
||||
|
||||
echo -e "\n"
|
||||
end
|
||||
3
fish/.config/fish/functions/curln.fish
Normal file
3
fish/.config/fish/functions/curln.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function curln
|
||||
gpg --batch -q -d ~/.netrc.gpg | curl --netrc-file /dev/stdin $argv
|
||||
end
|
||||
3
fish/.config/fish/functions/d.fish
Normal file
3
fish/.config/fish/functions/d.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function d -d "Match directories only"
|
||||
fasd -d $argv
|
||||
end
|
||||
5
fish/.config/fish/functions/de.fish
Normal file
5
fish/.config/fish/functions/de.fish
Normal file
@ -0,0 +1,5 @@
|
||||
function de
|
||||
pushd ~/devel/elationemr/hippo-local
|
||||
docker-compose $argv
|
||||
popd
|
||||
end
|
||||
3
fish/.config/fish/functions/e.fish
Normal file
3
fish/.config/fish/functions/e.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function e
|
||||
emacsclient --no-wait $argv
|
||||
end
|
||||
3
fish/.config/fish/functions/el8aws.fish
Normal file
3
fish/.config/fish/functions/el8aws.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function el8aws
|
||||
aws ecr get-login --no-include-email --region us-west-1 | source
|
||||
end
|
||||
5
fish/.config/fish/functions/el8clog.fish
Normal file
5
fish/.config/fish/functions/el8clog.fish
Normal file
@ -0,0 +1,5 @@
|
||||
function el8clog
|
||||
pushd ~/devel/elationemr/hippo/
|
||||
docker-compose logs --tail=50 -f celery
|
||||
popd
|
||||
end
|
||||
5
fish/.config/fish/functions/el8down.fish
Normal file
5
fish/.config/fish/functions/el8down.fish
Normal file
@ -0,0 +1,5 @@
|
||||
function el8down
|
||||
pushd ~/devel/elationemr/hippo
|
||||
docker-compose down
|
||||
popd
|
||||
end
|
||||
5
fish/.config/fish/functions/el8log.fish
Normal file
5
fish/.config/fish/functions/el8log.fish
Normal file
@ -0,0 +1,5 @@
|
||||
function el8log
|
||||
pushd ~/devel/elationemr/hippo/
|
||||
docker-compose logs --tail=50 -f hippo
|
||||
popd
|
||||
end
|
||||
5
fish/.config/fish/functions/el8sh.fish
Normal file
5
fish/.config/fish/functions/el8sh.fish
Normal file
@ -0,0 +1,5 @@
|
||||
function el8up
|
||||
pushd ~/devel/elationemr/hippo
|
||||
docker-compose exec hippo bash
|
||||
popd
|
||||
end
|
||||
5
fish/.config/fish/functions/el8up.fish
Normal file
5
fish/.config/fish/functions/el8up.fish
Normal file
@ -0,0 +1,5 @@
|
||||
function el8up
|
||||
pushd ~/devel/elationemr/hippo
|
||||
docker-compose up -d
|
||||
popd
|
||||
end
|
||||
5
fish/.config/fish/functions/esync.fish
Normal file
5
fish/.config/fish/functions/esync.fish
Normal file
@ -0,0 +1,5 @@
|
||||
function esync
|
||||
pushd ~/hippo-sync
|
||||
docker-compose $argv
|
||||
popd
|
||||
end
|
||||
5
fish/.config/fish/functions/esyncdj.fish
Normal file
5
fish/.config/fish/functions/esyncdj.fish
Normal file
@ -0,0 +1,5 @@
|
||||
function esyncdj
|
||||
pushd ~/hippo-sync
|
||||
docker-compose exec hippo django-admin $argv
|
||||
popd
|
||||
end
|
||||
3
fish/.config/fish/functions/evpn.fish
Normal file
3
fish/.config/fish/functions/evpn.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function evpn
|
||||
sudo openvpn --config ~/Nextcloud/vpns/elation.ovpn
|
||||
end
|
||||
3
fish/.config/fish/functions/f.fish
Normal file
3
fish/.config/fish/functions/f.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function f -d "Match files only"
|
||||
fasd -f $argv
|
||||
end
|
||||
9
fish/.config/fish/functions/fasd_cd.fish
Normal file
9
fish/.config/fish/functions/fasd_cd.fish
Normal file
@ -0,0 +1,9 @@
|
||||
function fasd_cd -d "fasd builtin cd"
|
||||
if test (count $argv) -le 1
|
||||
command fasd "$argv"
|
||||
else
|
||||
set -l ret (command fasd -e 'printf %s' $argv)
|
||||
test -z "$ret"; and return
|
||||
test -d "$ret"; and cd "$ret"; or printf "%s\n" $ret
|
||||
end
|
||||
end
|
||||
6
fish/.config/fish/functions/fish_greeting.fish
Normal file
6
fish/.config/fish/functions/fish_greeting.fish
Normal file
@ -0,0 +1,6 @@
|
||||
function fish_greeting -d "What's up, fish?"
|
||||
set_color $fish_color_autosuggestion
|
||||
uname -nmsr
|
||||
uptime
|
||||
set_color normal
|
||||
end
|
||||
8
fish/.config/fish/functions/fish_mode_prompt.fish
Normal file
8
fish/.config/fish/functions/fish_mode_prompt.fish
Normal file
@ -0,0 +1,8 @@
|
||||
# This is handled inside fish_mode_prompt (see `__bobthefish_prompt_vi`)
|
||||
#
|
||||
# If you want to override this with your own mode prompt, disable bobthefish's
|
||||
# built-in mode prompt in your fish config:
|
||||
#
|
||||
# set -g theme_display_vi no
|
||||
|
||||
function fish_mode_prompt; end
|
||||
926
fish/.config/fish/functions/fish_prompt.fish
Normal file
926
fish/.config/fish/functions/fish_prompt.fish
Normal file
@ -0,0 +1,926 @@
|
||||
# name: bobthefish
|
||||
#
|
||||
# bobthefish is a Powerline-style, Git-aware fish theme optimized for awesome.
|
||||
#
|
||||
# You will need a Powerline-patched font for this to work:
|
||||
#
|
||||
# https://powerline.readthedocs.org/en/master/installation.html#patched-fonts
|
||||
#
|
||||
# I recommend picking one of these:
|
||||
#
|
||||
# https://github.com/Lokaltog/powerline-fonts
|
||||
#
|
||||
# For more advanced awesome, install a nerd fonts patched font (and be sure to
|
||||
# enable nerd fonts support with `set -g theme_nerd_fonts yes`):
|
||||
#
|
||||
# https://github.com/ryanoasis/nerd-fonts
|
||||
#
|
||||
# You can override some default prompt options in your config.fish:
|
||||
#
|
||||
# set -g theme_display_git no
|
||||
# set -g theme_display_git_dirty no
|
||||
# set -g theme_display_git_untracked no
|
||||
# set -g theme_display_git_ahead_verbose yes
|
||||
# set -g theme_display_git_dirty_verbose yes
|
||||
# set -g theme_display_git_master_branch yes
|
||||
# set -g theme_git_worktree_support yes
|
||||
# set -g theme_display_vagrant yes
|
||||
# set -g theme_display_docker_machine no
|
||||
# set -g theme_display_k8s_context yes
|
||||
# set -g theme_display_hg yes
|
||||
# set -g theme_display_virtualenv no
|
||||
# set -g theme_display_ruby no
|
||||
# set -g theme_display_user ssh
|
||||
# set -g theme_display_hostname ssh
|
||||
# set -g theme_display_vi no
|
||||
# set -g theme_avoid_ambiguous_glyphs yes
|
||||
# set -g theme_powerline_fonts no
|
||||
# set -g theme_nerd_fonts yes
|
||||
# set -g theme_show_exit_status yes
|
||||
# set -g default_user your_normal_user
|
||||
# set -g theme_color_scheme dark
|
||||
# set -g fish_prompt_pwd_dir_length 0
|
||||
# set -g theme_project_dir_length 1
|
||||
# set -g theme_newline_cursor yes
|
||||
|
||||
|
||||
# ==============================
|
||||
# Helper methods
|
||||
# ==============================
|
||||
|
||||
function __bobthefish_basename -d 'basically basename, but faster'
|
||||
string replace -r '^.*/' '' -- $argv
|
||||
end
|
||||
|
||||
function __bobthefish_dirname -d 'basically dirname, but faster'
|
||||
string replace -r '/[^/]+/?$' '' -- $argv
|
||||
end
|
||||
|
||||
function __bobthefish_git_branch -S -d 'Get the current git branch (or commitish)'
|
||||
set -l ref (command git symbolic-ref HEAD 2>/dev/null); and begin
|
||||
[ "$theme_display_git_master_branch" != 'yes' -a "$ref" = 'refs/heads/master' ]
|
||||
and echo $branch_glyph
|
||||
and return
|
||||
|
||||
string replace 'refs/heads/' "$branch_glyph " $ref
|
||||
and return
|
||||
end
|
||||
|
||||
set -l tag (command git describe --tags --exact-match 2>/dev/null)
|
||||
and echo "$tag_glyph $tag"
|
||||
and return
|
||||
|
||||
set -l branch (command git show-ref --head -s --abbrev | head -n1 2>/dev/null)
|
||||
echo "$detached_glyph $branch"
|
||||
end
|
||||
|
||||
function __bobthefish_hg_branch -S -d 'Get the current hg branch'
|
||||
set -l branch (command hg branch 2>/dev/null)
|
||||
set -l book (command hg book | command grep \* | cut -d\ -f3)
|
||||
echo "$branch_glyph $branch @ $book"
|
||||
end
|
||||
|
||||
function __bobthefish_pretty_parent -S -a current_dir -d 'Print a parent directory, shortened to fit the prompt'
|
||||
set -q fish_prompt_pwd_dir_length
|
||||
or set -l fish_prompt_pwd_dir_length 1
|
||||
|
||||
# Replace $HOME with ~
|
||||
set -l real_home ~
|
||||
set -l parent_dir (string replace -r '^'"$real_home"'($|/)' '~$1' (__bobthefish_dirname $current_dir))
|
||||
|
||||
# Must check whether `$parent_dir = /` if using native dirname
|
||||
if [ -z "$parent_dir" ]
|
||||
echo -n /
|
||||
return
|
||||
end
|
||||
|
||||
if [ $fish_prompt_pwd_dir_length -eq 0 ]
|
||||
echo -n "$parent_dir/"
|
||||
return
|
||||
end
|
||||
|
||||
string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' "$parent_dir/"
|
||||
end
|
||||
|
||||
function __bobthefish_ignore_vcs_dir -d 'Check whether the current directory should be ignored as a VCS segment'
|
||||
for p in $theme_vcs_ignore_paths
|
||||
set ignore_path (realpath $p 2>/dev/null)
|
||||
switch $PWD/
|
||||
case $ignore_path/\*
|
||||
echo 1
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function __bobthefish_git_project_dir -S -d 'Print the current git project base directory'
|
||||
[ "$theme_display_git" = 'no' ]; and return
|
||||
|
||||
set -q theme_vcs_ignore_paths
|
||||
and [ (__bobthefish_ignore_vcs_dir) ]
|
||||
and return
|
||||
|
||||
if [ "$theme_git_worktree_support" != 'yes' ]
|
||||
command git rev-parse --show-toplevel 2>/dev/null
|
||||
return
|
||||
end
|
||||
|
||||
set -l git_dir (command git rev-parse --git-dir 2>/dev/null); or return
|
||||
|
||||
pushd $git_dir
|
||||
set git_dir $PWD
|
||||
popd
|
||||
|
||||
switch $PWD/
|
||||
case $git_dir/\*
|
||||
# Nothing works quite right if we're inside the git dir
|
||||
# TODO: fix the underlying issues then re-enable the stuff below
|
||||
|
||||
# # if we're inside the git dir, sweet. just return that.
|
||||
# set -l toplevel (command git rev-parse --show-toplevel 2>/dev/null)
|
||||
# if [ "$toplevel" ]
|
||||
# switch $git_dir/
|
||||
# case $toplevel/\*
|
||||
# echo $git_dir
|
||||
# end
|
||||
# end
|
||||
return
|
||||
end
|
||||
|
||||
set -l project_dir (__bobthefish_dirname $git_dir)
|
||||
|
||||
switch $PWD/
|
||||
case $project_dir/\*
|
||||
echo $project_dir
|
||||
return
|
||||
end
|
||||
|
||||
set project_dir (command git rev-parse --show-toplevel 2>/dev/null)
|
||||
switch $PWD/
|
||||
case $project_dir/\*
|
||||
echo $project_dir
|
||||
end
|
||||
end
|
||||
|
||||
function __bobthefish_hg_project_dir -S -d 'Print the current hg project base directory'
|
||||
[ "$theme_display_hg" = 'yes' ]; or return
|
||||
|
||||
set -q theme_vcs_ignore_paths
|
||||
and [ (__bobthefish_ignore_vcs_dir) ]
|
||||
and return
|
||||
|
||||
set -l d $PWD
|
||||
while not [ -z "$d" ]
|
||||
if [ -e $d/.hg ]
|
||||
command hg root --cwd "$d" 2>/dev/null
|
||||
return
|
||||
end
|
||||
[ "$d" = '/' ]; and return
|
||||
set d (__bobthefish_dirname $d)
|
||||
end
|
||||
end
|
||||
|
||||
function __bobthefish_project_pwd -S -a current_dir -d 'Print the working directory relative to project root'
|
||||
set -q theme_project_dir_length
|
||||
or set -l theme_project_dir_length 0
|
||||
|
||||
set -l project_dir (string replace -r '^'"$current_dir"'($|/)' '' $PWD)
|
||||
|
||||
if [ $theme_project_dir_length -eq 0 ]
|
||||
echo -n $project_dir
|
||||
return
|
||||
end
|
||||
|
||||
string replace -ar '(\.?[^/]{'"$theme_project_dir_length"'})[^/]*/' '$1/' $project_dir
|
||||
end
|
||||
|
||||
function __bobthefish_git_ahead -S -d 'Print the ahead/behind state for the current branch'
|
||||
if [ "$theme_display_git_ahead_verbose" = 'yes' ]
|
||||
__bobthefish_git_ahead_verbose
|
||||
return
|
||||
end
|
||||
|
||||
set -l ahead 0
|
||||
set -l behind 0
|
||||
for line in (command git rev-list --left-right '@{upstream}...HEAD' 2>/dev/null)
|
||||
switch "$line"
|
||||
case '>*'
|
||||
if [ $behind -eq 1 ]
|
||||
echo '±'
|
||||
return
|
||||
end
|
||||
set ahead 1
|
||||
case '<*'
|
||||
if [ $ahead -eq 1 ]
|
||||
echo "$git_plus_minus_glyph"
|
||||
return
|
||||
end
|
||||
set behind 1
|
||||
end
|
||||
end
|
||||
|
||||
if [ $ahead -eq 1 ]
|
||||
echo "$git_plus_glyph"
|
||||
else if [ $behind -eq 1 ]
|
||||
echo "$git_minus_glyph"
|
||||
end
|
||||
end
|
||||
|
||||
function __bobthefish_git_ahead_verbose -S -d 'Print a more verbose ahead/behind state for the current branch'
|
||||
set -l commits (command git rev-list --left-right '@{upstream}...HEAD' 2>/dev/null)
|
||||
or return
|
||||
|
||||
set -l behind (count (for arg in $commits; echo $arg; end | command grep '^<'))
|
||||
set -l ahead (count (for arg in $commits; echo $arg; end | command grep -v '^<'))
|
||||
|
||||
switch "$ahead $behind"
|
||||
case '' # no upstream
|
||||
case '0 0' # equal to upstream
|
||||
return
|
||||
case '* 0' # ahead of upstream
|
||||
echo "$git_ahead_glyph$ahead"
|
||||
case '0 *' # behind upstream
|
||||
echo "$git_behind_glyph$behind"
|
||||
case '*' # diverged from upstream
|
||||
echo "$git_ahead_glyph$ahead$git_behind_glyph$behind"
|
||||
end
|
||||
end
|
||||
|
||||
function __bobthefish_git_dirty_verbose -S -d 'Print a more verbose dirty state for the current working tree'
|
||||
set -l changes (command git diff --numstat | awk '{ added += $1; removed += $2 } END { print "+" added "/-" removed }')
|
||||
or return
|
||||
|
||||
echo "$changes " | string replace -r '(\+0/(-0)?|/-0)' ''
|
||||
end
|
||||
|
||||
|
||||
# ==============================
|
||||
# Segment functions
|
||||
# ==============================
|
||||
|
||||
function __bobthefish_start_segment -S -d 'Start a prompt segment'
|
||||
set -l bg $argv[1]
|
||||
set -e argv[1]
|
||||
set -l fg $argv[1]
|
||||
set -e argv[1]
|
||||
|
||||
set_color normal # clear out anything bold or underline...
|
||||
set_color -b $bg $fg $argv
|
||||
|
||||
switch "$__bobthefish_current_bg"
|
||||
case ''
|
||||
# If there's no background, just start one
|
||||
echo -n ' '
|
||||
case "$bg"
|
||||
# If the background is already the same color, draw a separator
|
||||
echo -ns $right_arrow_glyph ' '
|
||||
case '*'
|
||||
# otherwise, draw the end of the previous segment and the start of the next
|
||||
set_color $__bobthefish_current_bg
|
||||
echo -ns $right_black_arrow_glyph ' '
|
||||
set_color $fg $argv
|
||||
end
|
||||
|
||||
set __bobthefish_current_bg $bg
|
||||
end
|
||||
|
||||
function __bobthefish_path_segment -S -a current_dir -d 'Display a shortened form of a directory'
|
||||
set -l segment_color $color_path
|
||||
set -l segment_basename_color $color_path_basename
|
||||
|
||||
if not [ -w "$current_dir" ]
|
||||
set segment_color $color_path_nowrite
|
||||
set segment_basename_color $color_path_nowrite_basename
|
||||
end
|
||||
|
||||
__bobthefish_start_segment $segment_color
|
||||
|
||||
set -l directory
|
||||
set -l parent
|
||||
|
||||
switch "$current_dir"
|
||||
case /
|
||||
set directory '/'
|
||||
case "$HOME"
|
||||
set directory '~'
|
||||
case '*'
|
||||
set parent (__bobthefish_pretty_parent "$current_dir")
|
||||
set directory (__bobthefish_basename "$current_dir")
|
||||
end
|
||||
|
||||
echo -n $parent
|
||||
set_color -b $segment_basename_color
|
||||
echo -ns $directory ' '
|
||||
end
|
||||
|
||||
function __bobthefish_finish_segments -S -d 'Close open prompt segments'
|
||||
if [ -n "$__bobthefish_current_bg" ]
|
||||
set_color normal
|
||||
set_color $__bobthefish_current_bg
|
||||
echo -ns $right_black_arrow_glyph ' '
|
||||
end
|
||||
|
||||
if [ "$theme_newline_cursor" = 'yes' ]
|
||||
echo -ens "\n"
|
||||
set_color $fish_color_autosuggestion
|
||||
if [ "$theme_powerline_fonts" = "no" ]
|
||||
echo -ns '> '
|
||||
else
|
||||
echo -ns "$right_arrow_glyph "
|
||||
end
|
||||
else if [ "$theme_newline_cursor" = 'clean' ]
|
||||
echo -ens "\n"
|
||||
end
|
||||
|
||||
set_color normal
|
||||
set __bobthefish_current_bg
|
||||
end
|
||||
|
||||
|
||||
# ==============================
|
||||
# Status and input mode segments
|
||||
# ==============================
|
||||
|
||||
function __bobthefish_prompt_status -S -a last_status -d 'Display flags for a non-zero exit status, root user, and background jobs'
|
||||
set -l nonzero
|
||||
set -l superuser
|
||||
set -l bg_jobs
|
||||
|
||||
# Last exit was nonzero
|
||||
[ $last_status -ne 0 ]
|
||||
and set nonzero 1
|
||||
|
||||
# If superuser (uid == 0)
|
||||
#
|
||||
# Note that iff the current user is root and '/' is not writeable by root this
|
||||
# will be wrong. But I can't think of a single reason that would happen, and
|
||||
# it is literally 99.5% faster to check it this way, so that's a tradeoff I'm
|
||||
# willing to make.
|
||||
[ -w / ]
|
||||
and [ (id -u) -eq 0 ]
|
||||
and set superuser 1
|
||||
|
||||
# Jobs display
|
||||
jobs -p >/dev/null
|
||||
and set bg_jobs 1
|
||||
|
||||
if [ "$nonzero" -o "$superuser" -o "$bg_jobs" ]
|
||||
__bobthefish_start_segment $color_initial_segment_exit
|
||||
if [ "$nonzero" ]
|
||||
set_color normal
|
||||
set_color -b $color_initial_segment_exit
|
||||
if [ "$theme_show_exit_status" = 'yes' ]
|
||||
echo -ns $last_status ' '
|
||||
else
|
||||
echo -n $nonzero_exit_glyph
|
||||
end
|
||||
end
|
||||
|
||||
if [ "$superuser" ]
|
||||
set_color normal
|
||||
if [ -z "$FAKEROOTKEY" ]
|
||||
set_color -b $color_initial_segment_su
|
||||
else
|
||||
set_color -b $color_initial_segment_exit
|
||||
end
|
||||
|
||||
echo -n $superuser_glyph
|
||||
end
|
||||
|
||||
if [ "$bg_jobs" ]
|
||||
set_color normal
|
||||
set_color -b $color_initial_segment_jobs
|
||||
echo -n $bg_job_glyph
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function __bobthefish_prompt_vi -S -d 'Display vi mode'
|
||||
[ "$theme_display_vi" != 'no' ]; or return
|
||||
[ "$fish_key_bindings" = 'fish_vi_key_bindings' \
|
||||
-o "$fish_key_bindings" = 'hybrid_bindings' \
|
||||
-o "$fish_key_bindings" = 'fish_hybrid_key_bindings' \
|
||||
-o "$theme_display_vi" = 'yes' ]; or return
|
||||
switch $fish_bind_mode
|
||||
case default
|
||||
__bobthefish_start_segment $color_vi_mode_default
|
||||
echo -n 'N '
|
||||
case insert
|
||||
__bobthefish_start_segment $color_vi_mode_insert
|
||||
echo -n 'I '
|
||||
case replace_one replace-one
|
||||
__bobthefish_start_segment $color_vi_mode_insert
|
||||
echo -n 'R '
|
||||
case visual
|
||||
__bobthefish_start_segment $color_vi_mode_visual
|
||||
echo -n 'V '
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# ==============================
|
||||
# Container and VM segments
|
||||
# ==============================
|
||||
|
||||
function __bobthefish_prompt_vagrant -S -d 'Display Vagrant status'
|
||||
[ "$theme_display_vagrant" = 'yes' -a -f Vagrantfile ]; or return
|
||||
|
||||
# .vagrant/machines/$machine/$provider/id
|
||||
for file in .vagrant/machines/*/*/id
|
||||
read -l id <"$file"
|
||||
|
||||
if [ -n "$id" ]
|
||||
switch "$file"
|
||||
case '*/virtualbox/id'
|
||||
__bobthefish_prompt_vagrant_vbox $id
|
||||
case '*/vmware_fusion/id'
|
||||
__bobthefish_prompt_vagrant_vmware $id
|
||||
case '*/parallels/id'
|
||||
__bobthefish_prompt_vagrant_parallels $id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function __bobthefish_prompt_vagrant_vbox -S -a id -d 'Display VirtualBox Vagrant status'
|
||||
set -l vagrant_status
|
||||
set -l vm_status (VBoxManage showvminfo --machinereadable $id 2>/dev/null | command grep 'VMState=' | tr -d '"' | cut -d '=' -f 2)
|
||||
switch "$vm_status"
|
||||
case 'running'
|
||||
set vagrant_status "$vagrant_status$vagrant_running_glyph"
|
||||
case 'poweroff'
|
||||
set vagrant_status "$vagrant_status$vagrant_poweroff_glyph"
|
||||
case 'aborted'
|
||||
set vagrant_status "$vagrant_status$vagrant_aborted_glyph"
|
||||
case 'saved'
|
||||
set vagrant_status "$vagrant_status$vagrant_saved_glyph"
|
||||
case 'stopping'
|
||||
set vagrant_status "$vagrant_status$vagrant_stopping_glyph"
|
||||
case ''
|
||||
set vagrant_status "$vagrant_status$vagrant_unknown_glyph"
|
||||
end
|
||||
[ -z "$vagrant_status" ]; and return
|
||||
|
||||
__bobthefish_start_segment $color_vagrant
|
||||
echo -ns $vagrant_status ' '
|
||||
end
|
||||
|
||||
function __bobthefish_prompt_vagrant_vmware -S -a id -d 'Display VMWare Vagrant status'
|
||||
set -l vagrant_status
|
||||
if [ (pgrep -f "$id") ]
|
||||
set vagrant_status "$vagrant_status$vagrant_running_glyph"
|
||||
else
|
||||
set vagrant_status "$vagrant_status$vagrant_poweroff_glyph"
|
||||
end
|
||||
[ -z "$vagrant_status" ]; and return
|
||||
|
||||
__bobthefish_start_segment $color_vagrant
|
||||
echo -ns $vagrant_status ' '
|
||||
end
|
||||
|
||||
function __bobthefish_prompt_vagrant_parallels -S -d 'Display Parallels Vagrant status'
|
||||
set -l vagrant_status
|
||||
set -l vm_status (prlctl list $id -o status 2>/dev/null | command tail -1)
|
||||
switch "$vm_status"
|
||||
case 'running'
|
||||
set vagrant_status "$vagrant_status$vagrant_running_glyph"
|
||||
case 'stopped'
|
||||
set vagrant_status "$vagrant_status$vagrant_poweroff_glyph"
|
||||
case 'paused'
|
||||
set vagrant_status "$vagrant_status$vagrant_saved_glyph"
|
||||
case 'suspended'
|
||||
set vagrant_status "$vagrant_status$vagrant_saved_glyph"
|
||||
case 'stopping'
|
||||
set vagrant_status "$vagrant_status$vagrant_stopping_glyph"
|
||||
case ''
|
||||
set vagrant_status "$vagrant_status$vagrant_unknown_glyph"
|
||||
end
|
||||
[ -z "$vagrant_status" ]; and return
|
||||
|
||||
__bobthefish_start_segment $color_vagrant
|
||||
echo -ns $vagrant_status ' '
|
||||
end
|
||||
|
||||
function __bobthefish_prompt_docker -S -d 'Display Docker machine name'
|
||||
[ "$theme_display_docker_machine" = 'no' -o -z "$DOCKER_MACHINE_NAME" ]; and return
|
||||
__bobthefish_start_segment $color_vagrant
|
||||
echo -ns $DOCKER_MACHINE_NAME ' '
|
||||
end
|
||||
|
||||
function __bobthefish_prompt_k8s_context -S -d 'Show current Kubernetes context'
|
||||
[ "$theme_display_k8s_context" = 'yes' ]; or return
|
||||
|
||||
set -l config_paths "$HOME/.kube/config"
|
||||
[ -n "$KUBECONFIG" ]
|
||||
and set config_paths (string split ':' "$KUBECONFIG") $config_paths
|
||||
|
||||
for file in $config_paths
|
||||
[ -f "$file" ]; or continue
|
||||
|
||||
while read -l key val
|
||||
if [ "$key" = 'current-context:' ]
|
||||
set -l context (string trim -c '"\' ' -- $val)
|
||||
[ -z "$context" ]; and return
|
||||
|
||||
__bobthefish_start_segment $color_k8s
|
||||
echo -ns $context ' '
|
||||
return
|
||||
end
|
||||
end < $file
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# ==============================
|
||||
# User / hostname info segments
|
||||
# ==============================
|
||||
|
||||
# Polyfill for fish < 2.5.0
|
||||
if not type -q prompt_hostname
|
||||
if not set -q __bobthefish_prompt_hostname
|
||||
set -g __bobthefish_prompt_hostname (hostname | string replace -r '\..*' '')
|
||||
end
|
||||
|
||||
function prompt_hostname
|
||||
echo $__bobthefish_prompt_hostname
|
||||
end
|
||||
end
|
||||
|
||||
function __bobthefish_prompt_user -S -d 'Display current user and hostname'
|
||||
[ "$theme_display_user" = 'yes' -o \( "$theme_display_user" != 'no' -a -n "$SSH_CLIENT" \) -o \( -n "$default_user" -a "$USER" != "$default_user" \) ]
|
||||
and set -l display_user
|
||||
[ "$theme_display_hostname" = 'yes' -o \( "$theme_display_hostname" != 'no' -a -n "$SSH_CLIENT" \) ]
|
||||
and set -l display_hostname
|
||||
|
||||
if set -q display_user
|
||||
__bobthefish_start_segment $color_username
|
||||
echo -ns (whoami)
|
||||
end
|
||||
|
||||
if set -q display_hostname
|
||||
if set -q display_user
|
||||
# reset colors without starting a new segment...
|
||||
# (so we can have a bold username and non-bold hostname)
|
||||
set_color normal
|
||||
set_color -b $color_hostname[1] $color_hostname[2..-1]
|
||||
echo -ns '@' (prompt_hostname)
|
||||
else
|
||||
__bobthefish_start_segment $color_hostname
|
||||
echo -ns (prompt_hostname)
|
||||
end
|
||||
end
|
||||
|
||||
set -q display_user
|
||||
or set -q display_hostname
|
||||
and echo -ns ' '
|
||||
end
|
||||
|
||||
|
||||
# ==============================
|
||||
# Virtual environment segments
|
||||
# ==============================
|
||||
|
||||
function __bobthefish_rvm_parse_ruby -S -a ruby_string scope -d 'Parse RVM Ruby string'
|
||||
# Function arguments:
|
||||
# - 'ruby-2.2.3@rails', 'jruby-1.7.19'...
|
||||
# - 'default' or 'current'
|
||||
set -l IFS @
|
||||
echo "$ruby_string" | read __ruby __rvm_{$scope}_ruby_gemset __
|
||||
set IFS -
|
||||
echo "$__ruby" | read __rvm_{$scope}_ruby_interpreter __rvm_{$scope}_ruby_version __
|
||||
set -e __ruby
|
||||
set -e __
|
||||
end
|
||||
|
||||
function __bobthefish_rvm_info -S -d 'Current Ruby information from RVM'
|
||||
# look for rvm install path
|
||||
set -q rvm_path
|
||||
or set -l rvm_path ~/.rvm /usr/local/rvm
|
||||
|
||||
# More `sed`/`grep`/`cut` magic...
|
||||
set -l __rvm_default_ruby (grep GEM_HOME $rvm_path/environments/default 2>/dev/null | sed -e"s/'//g" | sed -e's/.*\///')
|
||||
set -l __rvm_current_ruby (rvm-prompt i v g)
|
||||
[ "$__rvm_default_ruby" = "$__rvm_current_ruby" ]; and return
|
||||
|
||||
set -l __rvm_default_ruby_gemset
|
||||
set -l __rvm_default_ruby_interpreter
|
||||
set -l __rvm_default_ruby_version
|
||||
set -l __rvm_current_ruby_gemset
|
||||
set -l __rvm_current_ruby_interpreter
|
||||
set -l __rvm_current_ruby_version
|
||||
|
||||
# Parse default and current Rubies to global variables
|
||||
__bobthefish_rvm_parse_ruby $__rvm_default_ruby default
|
||||
__bobthefish_rvm_parse_ruby $__rvm_current_ruby current
|
||||
# Show unobtrusive RVM prompt
|
||||
|
||||
# If interpreter differs form default interpreter, show everything:
|
||||
if [ "$__rvm_default_ruby_interpreter" != "$__rvm_current_ruby_interpreter" ]
|
||||
if [ "$__rvm_current_ruby_gemset" = 'global' ]
|
||||
rvm-prompt i v
|
||||
else
|
||||
rvm-prompt i v g
|
||||
end
|
||||
# If version differs form default version
|
||||
else if [ "$__rvm_default_ruby_version" != "$__rvm_current_ruby_version" ]
|
||||
if [ "$__rvm_current_ruby_gemset" = 'global' ]
|
||||
rvm-prompt v
|
||||
else
|
||||
rvm-prompt v g
|
||||
end
|
||||
# If gemset differs form default or 'global' gemset, just show it
|
||||
else if [ "$__rvm_default_ruby_gemset" != "$__rvm_current_ruby_gemset" ]
|
||||
rvm-prompt g
|
||||
end
|
||||
end
|
||||
|
||||
function __bobthefish_prompt_rubies -S -d 'Display current Ruby information'
|
||||
[ "$theme_display_ruby" = 'no' ]; and return
|
||||
|
||||
set -l ruby_version
|
||||
if type -fq rvm-prompt
|
||||
set ruby_version (__bobthefish_rvm_info)
|
||||
else if type -fq rbenv
|
||||
set ruby_version (rbenv version-name)
|
||||
# Don't show global ruby version...
|
||||
set -q RBENV_ROOT
|
||||
or set -l RBENV_ROOT $HOME/.rbenv
|
||||
|
||||
[ -e "$RBENV_ROOT/version" ]
|
||||
and read -l global_ruby_version <"$RBENV_ROOT/version"
|
||||
|
||||
[ "$global_ruby_version" ]
|
||||
or set -l global_ruby_version system
|
||||
|
||||
[ "$ruby_version" = "$global_ruby_version" ]; and return
|
||||
else if type -q chruby # chruby is implemented as a function, so omitting the -f is intentional
|
||||
set ruby_version $RUBY_VERSION
|
||||
else if type -fq asdf
|
||||
asdf current ruby 2>/dev/null | read -l asdf_ruby_version asdf_provenance
|
||||
or return
|
||||
|
||||
# If asdf changes their ruby version provenance format, update this to match
|
||||
[ "$asdf_provenance" = "(set by $HOME/.tool-versions)" ]; and return
|
||||
|
||||
set ruby_version $asdf_ruby_version
|
||||
end
|
||||
[ -z "$ruby_version" ]; and return
|
||||
__bobthefish_start_segment $color_rvm
|
||||
echo -ns $ruby_glyph $ruby_version ' '
|
||||
end
|
||||
|
||||
function __bobthefish_virtualenv_python_version -S -d 'Get current Python version'
|
||||
switch (python --version 2>&1 | tr '\n' ' ')
|
||||
case 'Python 2*PyPy*'
|
||||
echo $pypy_glyph
|
||||
case 'Python 3*PyPy*'
|
||||
echo -s $pypy_glyph $superscript_glyph[3]
|
||||
case 'Python 2*'
|
||||
echo $superscript_glyph[2]
|
||||
case 'Python 3*'
|
||||
echo $superscript_glyph[3]
|
||||
end
|
||||
end
|
||||
|
||||
function __bobthefish_prompt_virtualfish -S -d "Display current Python virtual environment (only for virtualfish, virtualenv's activate.fish changes prompt by itself) or conda environment."
|
||||
[ "$theme_display_virtualenv" = 'no' -o -z "$VIRTUAL_ENV" -a -z "$CONDA_DEFAULT_ENV" ]; and return
|
||||
set -l version_glyph (__bobthefish_virtualenv_python_version)
|
||||
if [ "$version_glyph" ]
|
||||
__bobthefish_start_segment $color_virtualfish
|
||||
echo -ns $virtualenv_glyph $version_glyph ' '
|
||||
end
|
||||
if [ "$VIRTUAL_ENV" ]
|
||||
echo -ns (basename "$VIRTUAL_ENV") ' '
|
||||
else if [ "$CONDA_DEFAULT_ENV" ]
|
||||
echo -ns (basename "$CONDA_DEFAULT_ENV") ' '
|
||||
end
|
||||
end
|
||||
|
||||
function __bobthefish_prompt_virtualgo -S -d 'Display current Go virtual environment'
|
||||
[ "$theme_display_virtualgo" = 'no' -o -z "$VIRTUALGO" ]; and return
|
||||
__bobthefish_start_segment $color_virtualgo
|
||||
echo -ns $go_glyph ' ' (basename "$VIRTUALGO") ' '
|
||||
set_color normal
|
||||
end
|
||||
|
||||
function __bobthefish_prompt_desk -S -d 'Display current desk environment'
|
||||
[ "$theme_display_desk" = 'no' -o -z "$DESK_ENV" ]; and return
|
||||
__bobthefish_start_segment $color_desk
|
||||
echo -ns $desk_glyph ' ' (basename -a -s ".fish" "$DESK_ENV") ' '
|
||||
set_color normal
|
||||
end
|
||||
|
||||
|
||||
# ==============================
|
||||
# VCS segments
|
||||
# ==============================
|
||||
|
||||
function __bobthefish_prompt_hg -S -a current_dir -d 'Display the actual hg state'
|
||||
set -l dirty (command hg stat; or echo -n '*')
|
||||
|
||||
set -l flags "$dirty"
|
||||
[ "$flags" ]
|
||||
and set flags ""
|
||||
|
||||
set -l flag_colors $color_repo
|
||||
if [ "$dirty" ]
|
||||
set flag_colors $color_repo_dirty
|
||||
end
|
||||
|
||||
__bobthefish_path_segment $current_dir
|
||||
|
||||
__bobthefish_start_segment $flag_colors
|
||||
echo -ns $hg_glyph ' '
|
||||
|
||||
__bobthefish_start_segment $flag_colors
|
||||
echo -ns (__bobthefish_hg_branch) $flags ' '
|
||||
set_color normal
|
||||
|
||||
set -l project_pwd (__bobthefish_project_pwd $current_dir)
|
||||
if [ "$project_pwd" ]
|
||||
if [ -w "$PWD" ]
|
||||
__bobthefish_start_segment $color_path
|
||||
else
|
||||
__bobthefish_start_segment $color_path_nowrite
|
||||
end
|
||||
|
||||
echo -ns $project_pwd ' '
|
||||
end
|
||||
end
|
||||
|
||||
function __bobthefish_prompt_git -S -a current_dir -d 'Display the actual git state'
|
||||
set -l dirty ''
|
||||
if [ "$theme_display_git_dirty" != 'no' ]
|
||||
set -l show_dirty (command git config --bool bash.showDirtyState 2>/dev/null)
|
||||
if [ "$show_dirty" != 'false' ]
|
||||
set dirty (command git diff --no-ext-diff --quiet --exit-code 2>/dev/null; or echo -n "$git_dirty_glyph")
|
||||
if [ "$dirty" -a "$theme_display_git_dirty_verbose" = 'yes' ]
|
||||
set dirty "$dirty"(__bobthefish_git_dirty_verbose)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
set -l staged (command git diff --cached --no-ext-diff --quiet --exit-code 2>/dev/null; or echo -n "$git_staged_glyph")
|
||||
set -l stashed (command git rev-parse --verify --quiet refs/stash >/dev/null; and echo -n "$git_stashed_glyph")
|
||||
set -l ahead (__bobthefish_git_ahead)
|
||||
|
||||
set -l new ''
|
||||
if [ "$theme_display_git_untracked" != 'no' ]
|
||||
set -l show_untracked (command git config --bool bash.showUntrackedFiles 2>/dev/null)
|
||||
if [ "$show_untracked" != 'false' ]
|
||||
set new (command git ls-files --other --exclude-standard --directory --no-empty-directory 2>/dev/null)
|
||||
if [ "$new" ]
|
||||
set new "$git_untracked_glyph"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
set -l flags "$dirty$staged$stashed$ahead$new"
|
||||
[ "$flags" ]
|
||||
and set flags " $flags"
|
||||
|
||||
set -l flag_colors $color_repo
|
||||
if [ "$dirty" ]
|
||||
set flag_colors $color_repo_dirty
|
||||
else if [ "$staged" ]
|
||||
set flag_colors $color_repo_staged
|
||||
end
|
||||
|
||||
__bobthefish_path_segment $current_dir
|
||||
|
||||
__bobthefish_start_segment $flag_colors
|
||||
echo -ns (__bobthefish_git_branch) $flags ' '
|
||||
set_color normal
|
||||
|
||||
if [ "$theme_git_worktree_support" != 'yes' ]
|
||||
set -l project_pwd (__bobthefish_project_pwd $current_dir)
|
||||
if [ "$project_pwd" ]
|
||||
if [ -w "$PWD" ]
|
||||
__bobthefish_start_segment $color_path
|
||||
else
|
||||
__bobthefish_start_segment $color_path_nowrite
|
||||
end
|
||||
|
||||
echo -ns $project_pwd ' '
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
set -l project_pwd (command git rev-parse --show-prefix 2>/dev/null | string trim --right --chars=/)
|
||||
set -l work_dir (command git rev-parse --show-toplevel 2>/dev/null)
|
||||
|
||||
# only show work dir if it's a parent…
|
||||
if [ "$work_dir" ]
|
||||
switch $PWD/
|
||||
case $work_dir/\*
|
||||
string match "$current_dir*" $work_dir >/dev/null
|
||||
and set work_dir (string sub -s (math 1 + (string length $current_dir)) $work_dir)
|
||||
case \*
|
||||
set -e work_dir
|
||||
end
|
||||
end
|
||||
|
||||
if [ "$project_pwd" -o "$work_dir" ]
|
||||
set -l colors $color_path
|
||||
if not [ -w "$PWD" ]
|
||||
set colors $color_path_nowrite
|
||||
end
|
||||
|
||||
__bobthefish_start_segment $colors
|
||||
|
||||
# handle work_dir != project dir
|
||||
if [ "$work_dir" ]
|
||||
set -l work_parent (__bobthefish_dirname $work_dir)
|
||||
if [ "$work_parent" ]
|
||||
echo -n "$work_parent/"
|
||||
end
|
||||
set_color normal
|
||||
set_color -b $color_repo_work_tree
|
||||
echo -n (__bobthefish_basename $work_dir)
|
||||
set_color normal
|
||||
set_color -b $colors
|
||||
[ "$project_pwd" ]
|
||||
and echo -n '/'
|
||||
end
|
||||
|
||||
echo -ns $project_pwd ' '
|
||||
else
|
||||
set project_pwd $PWD
|
||||
string match "$current_dir*" $project_pwd >/dev/null
|
||||
and set project_pwd (string sub -s (math 1 + (string length $current_dir)) $project_pwd)
|
||||
set project_pwd (string trim --left --chars=/ -- $project_pwd)
|
||||
|
||||
if [ "$project_pwd" ]
|
||||
set -l colors $color_path
|
||||
if not [ -w "$PWD" ]
|
||||
set colors $color_path_nowrite
|
||||
end
|
||||
|
||||
__bobthefish_start_segment $colors
|
||||
|
||||
echo -ns $project_pwd ' '
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function __bobthefish_prompt_dir -S -d 'Display a shortened form of the current directory'
|
||||
__bobthefish_path_segment "$PWD"
|
||||
end
|
||||
|
||||
|
||||
# ==============================
|
||||
# Apply theme
|
||||
# ==============================
|
||||
|
||||
function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
|
||||
# Save the last status for later (do this before the `set` calls below)
|
||||
set -l last_status $status
|
||||
|
||||
__bobthefish_glyphs
|
||||
__bobthefish_colors $theme_color_scheme
|
||||
type -q bobthefish_colors
|
||||
and bobthefish_colors
|
||||
|
||||
# Start each line with a blank slate
|
||||
set -l __bobthefish_current_bg
|
||||
|
||||
# Status flags and input mode
|
||||
__bobthefish_prompt_status $last_status
|
||||
__bobthefish_prompt_vi
|
||||
|
||||
# Containers and VMs
|
||||
__bobthefish_prompt_vagrant
|
||||
__bobthefish_prompt_docker
|
||||
__bobthefish_prompt_k8s_context
|
||||
|
||||
# User / hostname info
|
||||
__bobthefish_prompt_user
|
||||
|
||||
# Virtual environments
|
||||
__bobthefish_prompt_desk
|
||||
__bobthefish_prompt_rubies
|
||||
__bobthefish_prompt_virtualfish
|
||||
__bobthefish_prompt_virtualgo
|
||||
|
||||
# VCS
|
||||
set -l git_root (__bobthefish_git_project_dir)
|
||||
set -l hg_root (__bobthefish_hg_project_dir)
|
||||
|
||||
if [ "$git_root" -a "$hg_root" ]
|
||||
# only show the closest parent
|
||||
switch $git_root
|
||||
case $hg_root\*
|
||||
__bobthefish_prompt_git $git_root
|
||||
case \*
|
||||
__bobthefish_prompt_hg $hg_root
|
||||
end
|
||||
else if [ "$git_root" ]
|
||||
__bobthefish_prompt_git $git_root
|
||||
else if [ "$hg_root" ]
|
||||
__bobthefish_prompt_hg $hg_root
|
||||
else
|
||||
__bobthefish_prompt_dir
|
||||
end
|
||||
|
||||
__bobthefish_finish_segments
|
||||
end
|
||||
70
fish/.config/fish/functions/fish_right_prompt.fish
Normal file
70
fish/.config/fish/functions/fish_right_prompt.fish
Normal file
@ -0,0 +1,70 @@
|
||||
# You can override some default right prompt options in your config.fish:
|
||||
# set -g theme_date_format "+%a %H:%M"
|
||||
|
||||
function __bobthefish_cmd_duration -S -d 'Show command duration'
|
||||
[ "$theme_display_cmd_duration" = "no" ]; and return
|
||||
[ -z "$CMD_DURATION" -o "$CMD_DURATION" -lt 100 ]; and return
|
||||
|
||||
if [ "$CMD_DURATION" -lt 5000 ]
|
||||
echo -ns $CMD_DURATION 'ms'
|
||||
else if [ "$CMD_DURATION" -lt 60000 ]
|
||||
__bobthefish_pretty_ms $CMD_DURATION s
|
||||
else if [ "$CMD_DURATION" -lt 3600000 ]
|
||||
set_color $fish_color_error
|
||||
__bobthefish_pretty_ms $CMD_DURATION m
|
||||
else
|
||||
set_color $fish_color_error
|
||||
__bobthefish_pretty_ms $CMD_DURATION h
|
||||
end
|
||||
|
||||
set_color $fish_color_normal
|
||||
set_color $fish_color_autosuggestion
|
||||
|
||||
[ "$theme_display_date" = "no" ]
|
||||
or echo -ns ' ' $__bobthefish_left_arrow_glyph
|
||||
end
|
||||
|
||||
function __bobthefish_pretty_ms -S -a ms interval -d 'Millisecond formatting for humans'
|
||||
set -l interval_ms
|
||||
set -l scale 1
|
||||
|
||||
switch $interval
|
||||
case s
|
||||
set interval_ms 1000
|
||||
case m
|
||||
set interval_ms 60000
|
||||
case h
|
||||
set interval_ms 3600000
|
||||
set scale 2
|
||||
end
|
||||
|
||||
switch $FISH_VERSION
|
||||
# Fish 2.3 and lower doesn't know about the -s argument to math.
|
||||
case 2.0.\* 2.1.\* 2.2.\* 2.3.\*
|
||||
math "scale=$scale;$ms/$interval_ms" | string replace -r '\\.?0*$' $interval
|
||||
case \*
|
||||
math -s$scale "$ms/$interval_ms" | string replace -r '\\.?0*$' $interval
|
||||
end
|
||||
end
|
||||
|
||||
function __bobthefish_timestamp -S -d 'Show the current timestamp'
|
||||
[ "$theme_display_date" = "no" ]; and return
|
||||
set -q theme_date_format
|
||||
or set -l theme_date_format "+%c"
|
||||
|
||||
echo -n ' '
|
||||
date $theme_date_format
|
||||
end
|
||||
|
||||
function fish_right_prompt -d 'bobthefish is all about the right prompt'
|
||||
set -l __bobthefish_left_arrow_glyph \uE0B3
|
||||
if [ "$theme_powerline_fonts" = "no" ]
|
||||
set __bobthefish_left_arrow_glyph '<'
|
||||
end
|
||||
|
||||
set_color $fish_color_autosuggestion
|
||||
|
||||
__bobthefish_cmd_duration
|
||||
__bobthefish_timestamp
|
||||
set_color normal
|
||||
end
|
||||
34
fish/.config/fish/functions/fish_title.fish
Normal file
34
fish/.config/fish/functions/fish_title.fish
Normal file
@ -0,0 +1,34 @@
|
||||
# You can override some default title options in your config.fish:
|
||||
# set -g theme_title_display_process no
|
||||
# set -g theme_title_display_path no
|
||||
# set -g theme_title_display_user yes
|
||||
# set -g theme_title_use_abbreviated_path no
|
||||
|
||||
function __bobthefish_title_user -S -d 'Display actual user if different from $default_user'
|
||||
if [ "$theme_title_display_user" = 'yes' ]
|
||||
if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ]
|
||||
set -l IFS .
|
||||
hostname | read -l hostname __
|
||||
echo -ns (whoami) '@' $hostname ' '
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function fish_title
|
||||
__bobthefish_title_user
|
||||
|
||||
if [ "$theme_title_display_process" = 'yes' ]
|
||||
echo $_
|
||||
|
||||
[ "$theme_title_display_path" != 'no' ]
|
||||
and echo ' '
|
||||
end
|
||||
|
||||
if [ "$theme_title_display_path" != 'no' ]
|
||||
if [ "$theme_title_use_abbreviated_path" = 'no' ]
|
||||
echo $PWD
|
||||
else
|
||||
prompt_pwd
|
||||
end
|
||||
end
|
||||
end
|
||||
452
fish/.config/fish/functions/fisher.fish
Normal file
452
fish/.config/fish/functions/fisher.fish
Normal file
@ -0,0 +1,452 @@
|
||||
set -g fisher_version 3.1.1
|
||||
|
||||
type source >/dev/null; or function source; . $argv; end
|
||||
|
||||
switch (command uname)
|
||||
case Darwin FreeBSD
|
||||
function _fisher_now -a elapsed
|
||||
command perl -MTime::HiRes -e 'printf("%.0f\n", (Time::HiRes::time() * 1000) - $ARGV[0])' $elapsed
|
||||
end
|
||||
case \*
|
||||
function _fisher_now -a elapsed
|
||||
command date "+%s%3N" | command awk -v ELAPSED="$elapsed" '{ sub(/%?3N$/, "000") } $0 -= ELAPSED'
|
||||
end
|
||||
end
|
||||
|
||||
function fisher -a cmd -d "fish package manager"
|
||||
if not command which curl >/dev/null
|
||||
echo "curl is required to use fisher -- install curl and try again" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
test -z "$XDG_CACHE_HOME"; and set XDG_CACHE_HOME ~/.cache
|
||||
test -z "$XDG_CONFIG_HOME"; and set XDG_CONFIG_HOME ~/.config
|
||||
|
||||
set -g fish_config $XDG_CONFIG_HOME/fish
|
||||
set -g fisher_cache $XDG_CACHE_HOME/fisher
|
||||
set -g fisher_config $XDG_CONFIG_HOME/fisher
|
||||
|
||||
test -z "$fisher_path"; and set -g fisher_path $fish_config
|
||||
|
||||
command mkdir -p {$fish_config,$fisher_path}/{functions,completions,conf.d} $fisher_cache
|
||||
|
||||
if test ! -e "$fisher_path/completions/fisher.fish"
|
||||
echo "fisher self-complete" > $fisher_path/completions/fisher.fish
|
||||
_fisher_self_complete
|
||||
end
|
||||
|
||||
if test -e "$fisher_path/conf.d/fisher.fish"
|
||||
command rm -f $fisher_path/conf.d/fisher.fish
|
||||
end
|
||||
|
||||
switch "$version"
|
||||
case \*-\*
|
||||
case 2\*
|
||||
echo "fisher copy-user-key-bindings" > $fisher_path/conf.d/fisher.fish
|
||||
end
|
||||
|
||||
switch "$cmd"
|
||||
case self-complete
|
||||
_fisher_self_complete
|
||||
case copy-user-key-bindings
|
||||
_fisher_copy_user_key_bindings
|
||||
case ls
|
||||
_fisher_ls | command sed "s|$HOME|~|"
|
||||
case -v {,--}version
|
||||
_fisher_version (status -f)
|
||||
case -h {,--}help
|
||||
_fisher_help
|
||||
case self-update
|
||||
_fisher_self_update (status -f); or return
|
||||
_fisher_self_complete
|
||||
case self-uninstall
|
||||
_fisher_self_uninstall
|
||||
case add rm ""
|
||||
if test ! -z "$argv"
|
||||
if not isatty
|
||||
while read -l i
|
||||
set argv $argv $i
|
||||
end
|
||||
end
|
||||
end
|
||||
_fisher_commit $argv; or return
|
||||
_fisher_self_complete
|
||||
case \*
|
||||
echo "error: unknown flag or command \"$cmd\"" >&2
|
||||
_fisher_help >&2
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_self_complete
|
||||
complete -c fisher --erase
|
||||
complete -xc fisher -n __fish_use_subcommand -a version -d "Show version"
|
||||
complete -xc fisher -n __fish_use_subcommand -a help -d "Show help"
|
||||
complete -xc fisher -n __fish_use_subcommand -a self-update -d "Update fisher"
|
||||
complete -xc fisher -n __fish_use_subcommand -a ls -d "List installed packages"
|
||||
complete -xc fisher -n __fish_use_subcommand -a rm -d "Remove packages"
|
||||
complete -xc fisher -n __fish_use_subcommand -a add -d "Add packages"
|
||||
for pkg in (_fisher_ls)
|
||||
complete -xc fisher -n "__fish_seen_subcommand_from rm" -a $pkg
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_copy_user_key_bindings
|
||||
if functions -q fish_user_key_bindings
|
||||
functions -c fish_user_key_bindings fish_user_key_bindings_copy
|
||||
end
|
||||
function fish_user_key_bindings
|
||||
for file in $fisher_path/conf.d/*_key_bindings.fish
|
||||
source $file >/dev/null 2>/dev/null
|
||||
end
|
||||
if functions -q fish_user_key_bindings_copy
|
||||
fish_user_key_bindings_copy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_ls
|
||||
set -l pkgs $fisher_config/*/*/*
|
||||
for pkg in $pkgs
|
||||
command readlink $pkg; and continue; or echo $pkg
|
||||
end | command sed "s|$fisher_config/*||;s|github\.com/||"
|
||||
end
|
||||
|
||||
function _fisher_version -a file
|
||||
echo "fisher version $fisher_version $file" | command sed "s|$HOME|~|"
|
||||
end
|
||||
|
||||
function _fisher_help
|
||||
echo "usage: "
|
||||
echo " fisher add <PACKAGES> add packages"
|
||||
echo " fisher rm <PACKAGES> remove packages"
|
||||
echo " fisher update installed packages"
|
||||
echo " fisher ls show installed packages"
|
||||
echo " fisher help show this help"
|
||||
echo " fisher version show version"
|
||||
echo " fisher self-update update fisher"
|
||||
echo " fisher self-uninstall uninstall fisher"
|
||||
echo
|
||||
echo "examples:"
|
||||
echo " fisher add jethrokuan/z rafaelrinaldi/pure"
|
||||
echo " fisher add gitlab.com/owner/foobar@v2"
|
||||
echo " fisher add ~/path/to/myfish/pkg"
|
||||
echo " fisher rm rafaelrinaldi/pure"
|
||||
echo " fisher ls | fisher rm"
|
||||
echo " fisher add < bundle"
|
||||
end
|
||||
|
||||
function _fisher_self_update -a file
|
||||
set -l url "https://raw.githubusercontent.com/jorgebucaran/fisher/master/fisher.fish"
|
||||
echo "fetching $url" >&2
|
||||
|
||||
curl -s "$url?nocache" >$file@
|
||||
|
||||
set -l next_version (awk 'NR == 1 { print $4; exit }' < $file@)
|
||||
switch "$next_version"
|
||||
case "" $fisher_version
|
||||
command rm -f $file@
|
||||
if test -z "$next_version"
|
||||
echo "cannot update fisher -- are you offline?" >&2
|
||||
return 1
|
||||
end
|
||||
echo "fisher is already up-to-date" >&2
|
||||
case \*
|
||||
echo "linking $file" | command sed "s|$HOME|~|" >&2
|
||||
command mv -f $file@ $file
|
||||
source $file
|
||||
echo "updated fisher to $fisher_version -- hooray!" >&2
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_self_uninstall
|
||||
set -l current_pkgs $fisher_config/*/*/*
|
||||
for path in $fisher_cache (_fisher_pkg_remove_all $current_pkgs) $fisher_config $fisher_path/{functions,completions,conf.d}/fisher.fish $fish_config/fishfile
|
||||
echo "removing $path"
|
||||
command rm -rf $path 2>/dev/null
|
||||
end | command sed "s|$HOME|~|" >&2
|
||||
|
||||
set -e fisher_cache
|
||||
set -e fisher_config
|
||||
set -e fisher_path
|
||||
set -e fisher_version
|
||||
|
||||
complete -c fisher --erase
|
||||
functions -e (functions -a | command awk '/^_fisher/') fisher
|
||||
|
||||
echo "done -- see you again!" >&2
|
||||
end
|
||||
|
||||
function _fisher_commit
|
||||
set -l elapsed (_fisher_now)
|
||||
set -l current_pkgs $fisher_config/*/*/*
|
||||
set -l removed_pkgs (_fisher_pkg_remove_all $current_pkgs)
|
||||
command rm -rf $fisher_config
|
||||
command mkdir -p $fisher_config
|
||||
|
||||
set -l fishfile $fish_config/fishfile
|
||||
if test ! -e "$fishfile"
|
||||
command touch $fishfile
|
||||
echo "created empty fishfile in $fishfile" | command sed "s|$HOME|~|" >&2
|
||||
end
|
||||
printf "%s\n" (_fisher_fishfile_format (
|
||||
echo -s $argv\;) (
|
||||
echo -s $removed_pkgs\;
|
||||
) < $fishfile) > $fishfile
|
||||
|
||||
set -l expected_pkgs (_fisher_fishfile_read < $fishfile)
|
||||
set -l added_pkgs (_fisher_pkg_fetch_all $expected_pkgs)
|
||||
set -l updated_pkgs (
|
||||
for pkg in $removed_pkgs
|
||||
set pkg (echo $pkg | command sed "s|$fisher_config/*||")
|
||||
if contains -- $pkg $added_pkgs
|
||||
echo $pkg
|
||||
end
|
||||
end)
|
||||
|
||||
if test -z "$added_pkgs$updated_pkgs$removed_pkgs$expected_pkgs"
|
||||
echo "nothing to commit -- try adding some packages" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
_fisher_status (count $added_pkgs) (count $updated_pkgs) (count $removed_pkgs) (_fisher_now $elapsed) >&2
|
||||
end
|
||||
|
||||
function _fisher_pkg_remove_all
|
||||
for pkg in $argv
|
||||
echo $pkg
|
||||
_fisher_pkg_uninstall $pkg
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_pkg_fetch_all
|
||||
set -l pkg_jobs
|
||||
set -l local_pkgs
|
||||
set -l actual_pkgs
|
||||
set -l expected_pkgs
|
||||
|
||||
for id in $argv
|
||||
switch $id
|
||||
case \~\* /\*
|
||||
set -l path (echo "$id" | command sed "s|~|$HOME|")
|
||||
if test -e "$path"
|
||||
set local_pkgs $local_pkgs $path
|
||||
else
|
||||
echo "cannot install \"$id\" -- is this a valid file?" >&2
|
||||
end
|
||||
continue
|
||||
end
|
||||
|
||||
command awk -v ID=$id -v FS=/ 'BEGIN {
|
||||
if (split(ID, tmp, /@+|:/) > 2) {
|
||||
if (tmp[4]) sub("@"tmp[4], "", ID)
|
||||
print ID "\t" tmp[2]"/"tmp[1]"/"tmp[3] "\t" (tmp[4] ? tmp[4] : "master")
|
||||
} else {
|
||||
pkg = split(ID, _, "/") <= 2 ? "github.com/"tmp[1] : tmp[1]
|
||||
tag = tmp[2] ? tmp[2] : "master"
|
||||
print (\
|
||||
pkg ~ /^github/ ? "https://codeload."pkg"/tar.gz/"tag : \
|
||||
pkg ~ /^gitlab/ ? "https://"pkg"/-/archive/"tag"/"tmp[split(pkg, tmp, "/")]"-"tag".tar.gz" : \
|
||||
pkg ~ /^bitbucket/ ? "https://"pkg"/get/"tag".tar.gz" : pkg \
|
||||
) "\t" pkg
|
||||
}
|
||||
}' | read -l url pkg tag
|
||||
|
||||
if test ! -d "$fisher_config/$pkg"
|
||||
fish -c "
|
||||
echo fetching $url >&2
|
||||
command mkdir -p \"$fisher_config/$pkg\"
|
||||
if test ! -z \"$tag\"
|
||||
command git clone $url \"$fisher_config/$pkg\" --branch $tag --depth 1 2>/dev/null
|
||||
or echo cannot clone \"$url\" -- is this a valid url\? >&2
|
||||
else if command curl -Ss $url 2>&1 | command tar -xzf- -C \"$fisher_config/$pkg\" --strip-components=1 2>/dev/null
|
||||
command mkdir -p \"$fisher_cache/$pkg\"
|
||||
command cp -Rf \"$fisher_config/$pkg\" \"$fisher_cache/$pkg/..\"
|
||||
else if test -d \"$fisher_cache/$pkg\"
|
||||
echo cannot connect to server -- searching in \"$fisher_cache/$pkg\" | command sed 's|$HOME|~|' >&2
|
||||
command cp -Rf \"$fisher_cache/$pkg\" \"$fisher_config/$pkg/..\"
|
||||
else
|
||||
command rm -rf \"$fisher_config/$pkg\"
|
||||
echo cannot install \"$pkg\" -- is this a valid package\? >&2
|
||||
end
|
||||
" >/dev/null &
|
||||
|
||||
set pkg_jobs $pkg_jobs (_fisher_jobs --last)
|
||||
set expected_pkgs $expected_pkgs "$pkg"
|
||||
end
|
||||
end
|
||||
|
||||
if test ! -z "$pkg_jobs"
|
||||
_fisher_wait $pkg_jobs
|
||||
for pkg in $expected_pkgs
|
||||
if test -d "$fisher_config/$pkg"
|
||||
set actual_pkgs $actual_pkgs $pkg
|
||||
_fisher_pkg_install $fisher_config/$pkg
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for pkg in $local_pkgs
|
||||
set -l path local/$USER
|
||||
set -l name (command basename $pkg)
|
||||
command mkdir -p $fisher_config/$path
|
||||
command ln -sf $pkg $fisher_config/$path
|
||||
set actual_pkgs $actual_pkgs $path/$name
|
||||
_fisher_pkg_install $fisher_config/$path/$name
|
||||
end
|
||||
|
||||
if test ! -z "$actual_pkgs"
|
||||
_fisher_pkg_fetch_all (_fisher_pkg_get_deps $actual_pkgs | command sort --unique)
|
||||
printf "%s\n" $actual_pkgs
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_pkg_get_deps
|
||||
for pkg in $argv
|
||||
set -l path $fisher_config/$pkg
|
||||
if test ! -d "$path"
|
||||
echo $pkg
|
||||
else if test -s "$path/fishfile"
|
||||
_fisher_pkg_get_deps (_fisher_fishfile_format < $path/fishfile | _fisher_fishfile_read)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_pkg_install -a pkg
|
||||
set -l name (command basename $pkg)
|
||||
set -l files $pkg/{functions,completions,conf.d}/**.* $pkg/*.fish
|
||||
for source in $files
|
||||
set -l target (command basename $source)
|
||||
switch $source
|
||||
case $pkg/conf.d\*
|
||||
set target $fisher_path/conf.d/$target
|
||||
case $pkg/completions\*
|
||||
set target $fisher_path/completions/$target
|
||||
case $pkg/{functions,}\*
|
||||
switch $target
|
||||
case uninstall.fish
|
||||
continue
|
||||
case init.fish key_bindings.fish
|
||||
set target $fisher_path/conf.d/$name\_$target
|
||||
case \*
|
||||
set target $fisher_path/functions/$target
|
||||
end
|
||||
end
|
||||
echo "linking $target" | command sed "s|$HOME|~|" >&2
|
||||
command cp -f $source $target
|
||||
switch $target
|
||||
case \*.fish
|
||||
source $target >/dev/null 2>/dev/null
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_pkg_uninstall -a pkg
|
||||
set -l name (command basename $pkg)
|
||||
set -l files $pkg/{conf.d,completions,functions}/**.* $pkg/*.fish
|
||||
for source in $files
|
||||
set -l target (command basename $source)
|
||||
set -l filename (command basename $target .fish)
|
||||
switch $source
|
||||
case $pkg/conf.d\*
|
||||
test "$filename.fish" = "$target"; and emit "$filename"_uninstall
|
||||
set target conf.d/$target
|
||||
case $pkg/completions\*
|
||||
test "$filename.fish" = "$target"; and complete -ec $filename
|
||||
set target completions/$target
|
||||
case $pkg/{,functions}\*
|
||||
test "$filename.fish" = "$target"; and functions -e $filename
|
||||
switch $target
|
||||
case uninstall.fish
|
||||
source $source
|
||||
continue
|
||||
case init.fish key_bindings.fish
|
||||
set target conf.d/$name\_$target
|
||||
case \*
|
||||
set target functions/$target
|
||||
end
|
||||
end
|
||||
command rm -f $fisher_path/$target
|
||||
end
|
||||
if not functions -q fish_prompt
|
||||
source "$__fish_datadir$__fish_data_dir/functions/fish_prompt.fish"
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_fishfile_read
|
||||
command awk -v FS=\# '!/^#/ && NF { print $1 }'
|
||||
end
|
||||
|
||||
function _fisher_fishfile_format -a pkgs removed_pkgs
|
||||
command awk -v PWD=$PWD -v HOME=$HOME -v PKGS="$pkgs" -v REMOVED_PKGS="$removed_pkgs" '
|
||||
BEGIN {
|
||||
pkg_count = split(PKGS, pkgs, ";") - 1
|
||||
cmd = pkgs[1]
|
||||
for (i = 2; i <= pkg_count; i++) {
|
||||
pkg_ids[i - 1] = get_pkg_id( pkgs[i] = normalize(pkgs[i]) )
|
||||
}
|
||||
} {
|
||||
if (NF) {
|
||||
$0 = normalize($0)
|
||||
newln = newln > 0 ? "" : newln
|
||||
if (/^#/) print newln$0
|
||||
else if (!seen_pkgs[(pkg_id = get_pkg_id($0))]++) {
|
||||
for (i = 1; i < pkg_count; i++) {
|
||||
if (pkg_ids[i] == pkg_id) {
|
||||
if (cmd == "rm") next
|
||||
$0 = pkgs[i + 1]
|
||||
break
|
||||
}
|
||||
}
|
||||
print newln$0
|
||||
}
|
||||
newln = NF
|
||||
} else if (newln) newln = "\n"(newln > 0 ? "" : newln)
|
||||
}
|
||||
END {
|
||||
if (cmd == "rm" || pkg_count <= 1) {
|
||||
split(REMOVED_PKGS, tmp, ";")
|
||||
for (i in tmp) removed_pkgs[normalize(tmp[i])] = i
|
||||
for (i in pkg_ids) if (!(pkg_ids[i] in removed_pkgs)) {
|
||||
print "cannot remove \"" pkg_ids[i] "\" -- package not found" > "/dev/stderr"
|
||||
}
|
||||
exit
|
||||
}
|
||||
for (i in pkg_ids) if (!seen_pkgs[pkg_ids[i]]) print pkgs[i+1]
|
||||
}
|
||||
function normalize(s) {
|
||||
gsub(/^[ \t]*(https?:\/\/)?(.*github\.com\/)?|[\/ \t]*$/, "", s)
|
||||
sub(/^\.\//, PWD"/", s)
|
||||
sub(HOME, "~", s)
|
||||
return s
|
||||
}
|
||||
function get_pkg_id(s) {
|
||||
return (split(s, tmp, /@+|:/) > 2) ? tmp[2]"/"tmp[1]"/"tmp[3] : tmp[1]
|
||||
}
|
||||
'
|
||||
end
|
||||
|
||||
function _fisher_status -a added updated removed elapsed
|
||||
command awk -v ADDED=$added -v UPDATED=$updated -v REMOVED=$removed -v ELAPSED=$elapsed '
|
||||
BEGIN {
|
||||
if (ADDED = ADDED - UPDATED) res = msg(res, "added", ADDED)
|
||||
if (UPDATED) res = msg(res, "updated", UPDATED)
|
||||
if (REMOVED = REMOVED - UPDATED) res = msg(res, "removed", REMOVED)
|
||||
printf((res ? res : "done") " in %.2fs\n", ELAPSED / 1000)
|
||||
}
|
||||
function msg(res, str, n) {
|
||||
return (res ? res ", " : "") str " " n " package" (n > 1 ? "s" : "")
|
||||
}
|
||||
'
|
||||
end
|
||||
|
||||
function _fisher_jobs
|
||||
jobs $argv | command awk '/[0-9]+\t/ { print $1 }'
|
||||
end
|
||||
|
||||
function _fisher_wait
|
||||
while for job in $argv
|
||||
contains -- $job (_fisher_jobs); and break
|
||||
end
|
||||
end
|
||||
end
|
||||
3
fish/.config/fish/functions/getWanIp.fish
Normal file
3
fish/.config/fish/functions/getWanIp.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function getWanIp
|
||||
dig +short myip.opendns.com @resolver1.opendns.com
|
||||
end
|
||||
3
fish/.config/fish/functions/passe.fish
Normal file
3
fish/.config/fish/functions/passe.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function passe
|
||||
pass -c elation/$argv
|
||||
end
|
||||
3
fish/.config/fish/functions/passp.fish
Normal file
3
fish/.config/fish/functions/passp.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function passp
|
||||
pass -c personal/$argv
|
||||
end
|
||||
5
fish/.config/fish/functions/publish_sites.fish
Normal file
5
fish/.config/fish/functions/publish_sites.fish
Normal file
@ -0,0 +1,5 @@
|
||||
function publish_sites
|
||||
pushd ~/sites
|
||||
make publish
|
||||
popd
|
||||
end
|
||||
3
fish/.config/fish/functions/pvpn.fish
Normal file
3
fish/.config/fish/functions/pvpn.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function pvpn
|
||||
sudo openvpn --config ~/Nextcloud/vpns/protonvpn.ovpn
|
||||
end
|
||||
3
fish/.config/fish/functions/rechunk.fish
Normal file
3
fish/.config/fish/functions/rechunk.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function rechunk
|
||||
brew services restart chunkwm
|
||||
end
|
||||
3
fish/.config/fish/functions/s.fish
Normal file
3
fish/.config/fish/functions/s.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function s -d "Interactively select from all"
|
||||
fasd -is $argv
|
||||
end
|
||||
3
fish/.config/fish/functions/sd.fish
Normal file
3
fish/.config/fish/functions/sd.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function sd -d "Interactively select directory"
|
||||
fasd -isd $argv
|
||||
end
|
||||
3
fish/.config/fish/functions/sf.fish
Normal file
3
fish/.config/fish/functions/sf.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function sf -d "Interactively select file"
|
||||
fasd -isf $argv
|
||||
end
|
||||
6
fish/.config/fish/functions/update_email.fish
Normal file
6
fish/.config/fish/functions/update_email.fish
Normal file
@ -0,0 +1,6 @@
|
||||
function update_email
|
||||
notmuch search --output=files tag:deleted | tr '\n' '\0' | xargs -0 -L 1 rm
|
||||
notmuch new
|
||||
mbsync -a
|
||||
notmuch new
|
||||
end
|
||||
6
fish/.config/fish/functions/updot.fish
Normal file
6
fish/.config/fish/functions/updot.fish
Normal file
@ -0,0 +1,6 @@
|
||||
function updot
|
||||
pushd ~/devel/dotfiles
|
||||
git pull --rebase
|
||||
fisher
|
||||
popd
|
||||
end
|
||||
3
fish/.config/fish/functions/wanip.fish
Normal file
3
fish/.config/fish/functions/wanip.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function wanip
|
||||
dig +short myip.opendns.com @resolver1.opendns.com
|
||||
end
|
||||
3
fish/.config/fish/functions/z.fish
Normal file
3
fish/.config/fish/functions/z.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function z -d "Change directory to first match"
|
||||
fasd_cd -d $argv
|
||||
end
|
||||
11
fish/.config/fish/functions/zd.fish
Normal file
11
fish/.config/fish/functions/zd.fish
Normal file
@ -0,0 +1,11 @@
|
||||
# Function to filter through recently used directories
|
||||
function zd --argument-names 'name'
|
||||
set -l zd_command "command fasd -Rdl $name 2> /dev/null"
|
||||
fish -c "$zd_command" | __fzfcmd -1 -0 --no-sort -m | read -la select
|
||||
if test ! (count $select) -eq 0
|
||||
cd "$select"
|
||||
end
|
||||
end
|
||||
|
||||
# Set above function to even shorter j alias
|
||||
alias j "zd"
|
||||
3
fish/.config/fish/functions/zz.fish
Normal file
3
fish/.config/fish/functions/zz.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function zz -d "Change directory with interactive selection"
|
||||
fasd_cd -id $argv
|
||||
end
|
||||
Reference in New Issue
Block a user