From 574abe69756c6dd6ae463aea79e2e7247afe2ace Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Fri, 7 Dec 2018 13:38:49 -0500 Subject: [PATCH] Add screen term type and pyenv --- config/fish/completions/pyenv.fish | 24 ++++++++++++++++++++++++ config/fish/conf.d/pyenv.fish | 19 +++++++++++++++++++ config/fish/fishd.8c85907056c9 | 1 + config/fish/fishfile | 1 + config/fish/functions/pyenv.fish | 12 ++++++++++++ 5 files changed, 57 insertions(+) create mode 100644 config/fish/completions/pyenv.fish create mode 100644 config/fish/conf.d/pyenv.fish create mode 100644 config/fish/functions/pyenv.fish diff --git a/config/fish/completions/pyenv.fish b/config/fish/completions/pyenv.fish new file mode 100644 index 0000000..bf59443 --- /dev/null +++ b/config/fish/completions/pyenv.fish @@ -0,0 +1,24 @@ +function __fish_pyenv_needs_command + set cmd (commandline -opc) + if test (count $cmd) -eq 1 -a "$cmd[1]" = "pyenv" + return 0 + end + return 1 +end + +function __fish_pyenv_using_command + set cmd (commandline -opc) + if test (count $cmd) -gt 1 + if test "$argv[1]" = "$cmd[2]" + return 0 + end + end + return 1 +end + +if command -s pyenv > /dev/null + complete -f -c pyenv -n '__fish_pyenv_needs_command' -a '(pyenv commands)' + for cmd in (pyenv commands) + complete -f -c pyenv -n "__fish_pyenv_using_command $cmd" -a "(pyenv completions $cmd)" + end +end diff --git a/config/fish/conf.d/pyenv.fish b/config/fish/conf.d/pyenv.fish new file mode 100644 index 0000000..1e78700 --- /dev/null +++ b/config/fish/conf.d/pyenv.fish @@ -0,0 +1,19 @@ +if not command -s pyenv > /dev/null + echo "Install to use 'pyenv'." + exit 1 +end + +set -l pyenv_root "" + +if test -z "$PYENV_ROOT" + set pyenv_root ~/.pyenv + set -x PYENV_ROOT "$pyenv_root" +else + set pyenv_root "$PYENV_ROOT" +end + +if status --is-login + set -x PATH "$pyenv_root/shims" $PATH + set -x PYENV_SHELL fish +end +command mkdir -p "$pyenv_root/"{shims,versions} diff --git a/config/fish/fishd.8c85907056c9 b/config/fish/fishd.8c85907056c9 index 1f704f9..ffac4cf 100644 --- a/config/fish/fishd.8c85907056c9 +++ b/config/fish/fishd.8c85907056c9 @@ -5,6 +5,7 @@ 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 ZO_CMD:zo SET Z_CMD:z SET Z_DATA:/Users/colinpowell/\x2elocal/share/z/data diff --git a/config/fish/fishfile b/config/fish/fishfile index d941f33..d516033 100644 --- a/config/fish/fishfile +++ b/config/fish/fishfile @@ -4,3 +4,4 @@ simnalamburt/shellder fishgretel/fasd oh-my-fish/theme-bobthefish pyenv +daenney/pyenv diff --git a/config/fish/functions/pyenv.fish b/config/fish/functions/pyenv.fish new file mode 100644 index 0000000..23b9cfd --- /dev/null +++ b/config/fish/functions/pyenv.fish @@ -0,0 +1,12 @@ +function pyenv + set command $argv[1] + set -e argv[1] + + switch "$command" + case rehash shell + source (pyenv "sh-$command" $argv | psub) + + case \* + command pyenv "$command" $argv + end +end