pull/2062/merge
John D Pell 2023-03-19 02:44:14 -07:00 committed by GitHub
commit 58c7f62c6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 259 additions and 205 deletions

View File

@ -98,14 +98,18 @@ plugins/available/base.plugin.bash
plugins/available/basher.plugin.bash plugins/available/basher.plugin.bash
plugins/available/battery.plugin.bash plugins/available/battery.plugin.bash
plugins/available/blesh.plugin.bash plugins/available/blesh.plugin.bash
plugins/available/cht.sh.plugin.bash
plugins/available/cmd-returned-notify.plugin.bash plugins/available/cmd-returned-notify.plugin.bash
plugins/available/colors.plugin.bash plugins/available/colors.plugin.bash
plugins/available/direnv.plugin.bash plugins/available/direnv.plugin.bash
plugins/available/dirs.plugin.bash plugins/available/dirs.plugin.bash
plugins/available/docker-machine.plugin.bash plugins/available/docker-machine.plugin.bash
plugins/available/fasd.plugin.bash
plugins/available/fzf.plugin.bash
plugins/available/gif.plugin.bash plugins/available/gif.plugin.bash
plugins/available/git-subrepo.plugin.bash plugins/available/git-subrepo.plugin.bash
plugins/available/git.plugin.bash plugins/available/git.plugin.bash
plugins/available/gitstatus.plugin.bash
plugins/available/go.plugin.bash plugins/available/go.plugin.bash
plugins/available/goenv.plugin.bash plugins/available/goenv.plugin.bash
plugins/available/history-eternal.plugin.bash plugins/available/history-eternal.plugin.bash
@ -115,6 +119,7 @@ plugins/available/history.plugin.bash
plugins/available/hub.plugin.bash plugins/available/hub.plugin.bash
plugins/available/java.plugin.bash plugins/available/java.plugin.bash
plugins/available/jekyll.plugin.bash plugins/available/jekyll.plugin.bash
plugins/available/jenv.plugin.bash
plugins/available/jump.plugin.bash plugins/available/jump.plugin.bash
plugins/available/latex.plugin.bash plugins/available/latex.plugin.bash
plugins/available/less-pretty-cat.plugin.bash plugins/available/less-pretty-cat.plugin.bash
@ -122,10 +127,12 @@ plugins/available/man.plugin.bash
plugins/available/nginx.plugin.bash plugins/available/nginx.plugin.bash
plugins/available/node.plugin.bash plugins/available/node.plugin.bash
plugins/available/nodenv.plugin.bash plugins/available/nodenv.plugin.bash
plugins/available/nvm.plugin.bash
plugins/available/osx-timemachine.plugin.bash plugins/available/osx-timemachine.plugin.bash
plugins/available/osx.plugin.bash plugins/available/osx.plugin.bash
plugins/available/percol.plugin.bash plugins/available/percol.plugin.bash
plugins/available/plenv.plugin.bash plugins/available/plenv.plugin.bash
plugins/available/powerline.plugin.bash
plugins/available/projects.plugin.bash plugins/available/projects.plugin.bash
plugins/available/proxy.plugin.bash plugins/available/proxy.plugin.bash
plugins/available/pyenv.plugin.bash plugins/available/pyenv.plugin.bash
@ -133,6 +140,7 @@ plugins/available/python.plugin.bash
plugins/available/rbenv.plugin.bash plugins/available/rbenv.plugin.bash
plugins/available/ruby.plugin.bash plugins/available/ruby.plugin.bash
plugins/available/textmate.plugin.bash plugins/available/textmate.plugin.bash
plugins/available/thefuck.plugin.bash
plugins/available/todo.plugin.bash plugins/available/todo.plugin.bash
plugins/available/xterm.plugin.bash plugins/available/xterm.plugin.bash
plugins/available/zoxide.plugin.bash plugins/available/zoxide.plugin.bash

View File

@ -1,11 +1,10 @@
# shellcheck shell=bash # shellcheck shell=bash
cite about-plugin
about-plugin 'Autojump configuration, see https://github.com/wting/autojump for more details' about-plugin 'Autojump configuration, see https://github.com/wting/autojump for more details'
# Only supports the Homebrew variant, Debian and Arch at the moment. # Only supports the Homebrew variant, Debian, and Arch at the moment.
# Feel free to provide a PR to support other install locations # Feel free to provide a PR to support other install locations
# shellcheck disable=SC1090 # shellcheck disable=SC1090
if _bash_it_homebrew_check && [[ -s "${BASH_IT_HOMEBREW_PREFIX}/etc/profile.d/autojump.sh" ]]; then if _bash_it_homebrew_check && [[ -s "${BASH_IT_HOMEBREW_PREFIX?}/etc/profile.d/autojump.sh" ]]; then
source "${BASH_IT_HOMEBREW_PREFIX}/etc/profile.d/autojump.sh" source "${BASH_IT_HOMEBREW_PREFIX}/etc/profile.d/autojump.sh"
elif _command_exists dpkg && dpkg -s autojump &> /dev/null; then elif _command_exists dpkg && dpkg -s autojump &> /dev/null; then
source "$(dpkg-query -S autojump.sh | cut -d' ' -f2)" source "$(dpkg-query -S autojump.sh | cut -d' ' -f2)"

View File

@ -1,5 +1,4 @@
# shellcheck shell=bash # shellcheck shell=bash
cite about-plugin
about-plugin 'initializes basher, the shell package manager' about-plugin 'initializes basher, the shell package manager'
# https://github.com/basherpm/basher # https://github.com/basherpm/basher
@ -13,4 +12,5 @@ if ! _command_exists basher; then
fi fi
fi fi
eval "$(basher init - bash)" # shellcheck disable=SC1090
source < <(basher init - bash)

View File

@ -1,21 +1,25 @@
cite about-plugin # shellcheck shell=bash
about-plugin 'Simplify `curl cht.sh/<query>` to `cht.sh <query>`' about-plugin 'Simplify `curl cht.sh/<query>` to `cht.sh <query>`'
# Play nicely if user already installed cht.sh cli tool # Play nicely if user already installed cht.sh cli tool
if ! _command_exists cht.sh ; then if _binary_exists cht.sh ; then
function cht.sh () { _log_warning "You have already installed 'cht.sh', so it's safe to disable this plugin."
about 'Executes a cht.sh curl query using the provided arguments' return 1
param ' [ ( topic [sub-topic] ) | ~keyword ] [ :list | :help | :learn ]'
example '$ cht.sh :help'
example '$ cht.sh :list'
example '$ cht.sh tar'
example '$ cht.sh js "parse json"'
example '$ cht.sh python :learn'
example '$ cht.sh rust :list'
group 'cht-sh'
# Separate arguments with '/', preserving spaces within them
local query=$(IFS=/ ; echo "$*")
curl "cht.sh/${query}"
}
fi fi
function cht.sh () {
about 'Executes a cht.sh curl query using the provided arguments'
param ' [ ( topic [sub-topic] ) | ~keyword ] [ :list | :help | :learn ]'
example '$ cht.sh :help'
example '$ cht.sh :list'
example '$ cht.sh tar'
example '$ cht.sh js "parse json"'
example '$ cht.sh python :learn'
example '$ cht.sh rust :list'
group 'cht-sh'
# Separate arguments with '/', preserving spaces within them
local query
query=$(IFS=/ ; echo "$*")
curl "cht.sh/${query}"
}

View File

@ -1,7 +1,10 @@
# shellcheck shell=bash # shellcheck shell=bash
cite about-plugin
about-plugin 'load direnv, if you are using it: https://direnv.net/' about-plugin 'load direnv, if you are using it: https://direnv.net/'
if _command_exists direnv; then if ! _binary_exists direnv; then
eval "$(direnv hook bash)" _log_warning "Could not find 'direnv'."
return 1
fi fi
# shellcheck disable=SC1090
source < <(direnv hook bash)

View File

@ -1,6 +1,10 @@
cite about-plugin # shellcheck shell=bash
about-plugin 'load fasd, if you are using it' about-plugin 'load fasd, if you are using it'
_command_exists fasd || return if ! _binary_exists fasd; then
_log_warning "Unable to locage 'fasd'."
return 1
fi
eval "$(fasd --init auto)" # shellcheck disable=SC1090
source < <(fasd --init auto)

View File

@ -1,42 +1,43 @@
# Load after the system completion to make sure that the fzf completions are working # shellcheck shell=bash
# BASH_IT_LOAD_PRIORITY: 375
cite about-plugin
about-plugin 'load fzf, if you are using it' about-plugin 'load fzf, if you are using it'
if [ -r ~/.fzf.bash ] ; then # shellcheck source-path=$HOME source-path=$HOME/.config/fzf disable=SC1090 disable=SC1091
source ~/.fzf.bash if [[ -r ~/.fzf.bash ]]; then
elif [ -r "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.bash ] ; then source ~/.fzf.bash
source "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.bash elif [[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/fzf/fzf.bash" ]]; then
source "${XDG_CONFIG_HOME:-$HOME/.config}/fzf/fzf.bash"
fi fi
# No need to continue if the command is not present # No need to continue if the command is not present
_command_exists fzf || return if ! _binary_exists fzf; then
_log_warning "unable to initialize without '$_' installed."
if [ -z ${FZF_DEFAULT_COMMAND+x} ] && _command_exists fd ; then return 1
export FZF_DEFAULT_COMMAND='fd --type f'
fi fi
fe() { if [[ -z ${FZF_DEFAULT_COMMAND+x} ]] && _command_exists fd; then
about "Open the selected file in the default editor" export FZF_DEFAULT_COMMAND='fd --type f'
group "fzf" fi
param "1: Search term"
example "fe foo"
local IFS=$'\n' function fe() {
local files about "Open the selected file in the default editor"
files=($(fzf-tmux --query="$1" --multi --select-1 --exit-0)) group "fzf"
[[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}" param "1: Search term"
example "fe foo"
local IFS=$'\n'
local files
read -ra files < <(fzf-tmux --query="$1" --multi --select-1 --exit-0)
[[ -n "${files[*]}" ]] && "${EDITOR:-${ALTERNATE_EDITOR:-nano}}" "${files[@]}"
} }
fcd() { function fcd() {
about "cd to the selected directory" about "cd to the selected directory"
group "fzf" group "fzf"
param "1: Directory to browse, or . if omitted" param "1: Directory to browse, or . if omitted"
example "fcd aliases" example "fcd aliases"
local dir local dir
dir=$(find ${1:-.} -path '*/\.*' -prune \ dir=$(find "${1:-.}" -path '*/\.*' -prune \
-o -type d -print 2> /dev/null | fzf +m) && -o -type d -print 2> /dev/null | fzf +m) \
cd "$dir" && cd "$dir" || return
} }

View File

@ -1,26 +1,36 @@
cite about-plugin # shellcheck shell=bash
about-plugin 'speeds up your life by using gitstatus for git status calculations. install from https://github.com/romkatv/gitstatus' about-plugin 'speeds up your life by using gitstatus for git status calculations. install from https://github.com/romkatv/gitstatus'
function gitstatus_on_disable() { : "${SCM_GIT_GITSTATUS_DIR:="$HOME/gitstatus"}"
about 'Destructor of gitstatus plugin' if [[ ! -d "${SCM_GIT_GITSTATUS_DIR}" ]] && _bash_it_homebrew_check; then
group 'gitstatus' SCM_GIT_GITSTATUS_DIR="${BASH_IT_HOMEBREW_PREFIX?}/opt/gitstatus"
fi
unset SCM_GIT_USE_GITSTATUS function gitstatus_on_disable() {
_command_exists gitstatus_stop && gitstatus_stop about 'Destructor of gitstatus plugin'
group 'gitstatus'
unset SCM_GIT_USE_GITSTATUS
_command_exists gitstatus_stop && gitstatus_stop
} }
# No scm-check function _bash-it-component-plugin-callback-on-init-gitstatus() {
[[ $SCM_CHECK == "true" ]] || return # No scm-check
[[ ${SCM_CHECK?} == "true" ]] || return
# non-interactive shell # non-interactive shell
[[ $- == *i* ]] || return [[ $- == *i* ]] || return
: "${SCM_GIT_GITSTATUS_DIR:="$HOME/gitstatus"}" if [[ -d "${SCM_GIT_GITSTATUS_DIR?}" ]]; then
if [[ -d ${SCM_GIT_GITSTATUS_DIR} ]]; then # shellcheck source-path=$HOME/gitstatus disable=SC1091
source "${SCM_GIT_GITSTATUS_DIR}/gitstatus.plugin.sh" source "${SCM_GIT_GITSTATUS_DIR}/gitstatus.plugin.sh"
# Start the actual gitstatus binary # Start the actual gitstatus binary
gitstatus_stop && gitstatus_start -s -1 -u -1 -c -1 -d -1 gitstatus_stop && gitstatus_start -s -1 -u -1 -c -1 -d -1
export SCM_GIT_USE_GITSTATUS=true export SCM_GIT_USE_GITSTATUS=true
else else
_log_warning "Could not find gitstatus directory in ${SCM_GIT_GITSTATUS_DIR}. Please specify directory location using SCM_GIT_GITSTATUS_DIR." _log_warning "Could not find gitstatus directory in ${SCM_GIT_GITSTATUS_DIR}. Please specify directory location using SCM_GIT_GITSTATUS_DIR."
fi return 1
fi
}
_bash-it-component-plugin-callback-on-init-gitstatus

View File

@ -1,5 +1,4 @@
# shellcheck shell=bash # shellcheck shell=bash
cite about-plugin
about-plugin 'go environment variables & path configuration' about-plugin 'go environment variables & path configuration'
# Load after basher and goenv # Load after basher and goenv
@ -7,30 +6,30 @@ about-plugin 'go environment variables & path configuration'
# Test `go version` because goenv creates shim scripts that will be found in PATH # Test `go version` because goenv creates shim scripts that will be found in PATH
# but do not always resolve to a working install. # but do not always resolve to a working install.
{ _command_exists go && go version &> /dev/null; } || return 0 if ! _binary_exists go || ! go version &> /dev/null; then
_log_warning "Unable to locate a working 'go'."
return 1
fi
export GOROOT="${GOROOT:-$(go env GOROOT)}" : "${GOROOT:=$(go env GOROOT)}"
export GOPATH="${GOPATH:-$(go env GOPATH)}" : "${GOPATH:=$(go env GOPATH)}"
export GOROOT GOPATH
# $GOPATH/bin is the default location for binaries. Because GOPATH accepts a list of paths and each # $GOPATH/bin is the default location for binaries. Because GOPATH accepts a list of paths and each
# might be managed differently, we add each path's /bin folder to PATH using pathmunge, # might be managed differently, we add each path's /bin folder to PATH using pathmunge,
# while preserving ordering. # while preserving ordering.
# e.g. GOPATH=foo:bar -> PATH=foo/bin:bar/bin # e.g. GOPATH=foo:bar -> PATH=foo/bin:bar/bin
_bash-it-gopath-pathmunge() { function _bash-it-component-plugin-callback-on-init-go() {
_about 'Ensures paths in GOPATH are added to PATH using pathmunge, with /bin appended' _about 'Ensures paths in GOPATH are added to PATH using pathmunge, with /bin appended'
_group 'go' _group 'go'
if [[ -z $GOPATH ]]; then if [[ -z "${GOPATH:-}" ]]; then
echo 'GOPATH empty' >&2 _log_warning 'GOPATH empty'
return 1 return 1
fi fi
local paths i local paths apath
IFS=: read -r -a paths <<< "$GOPATH" IFS=: read -r -a paths <<< "$GOPATH"
i=${#paths[@]} for apath in "${paths[@]}"; do
while [[ $i -gt 0 ]]; do pathmunge "${apath}/bin" || true
i=$((i - 1))
if [[ -n "${paths[i]}" ]]; then
pathmunge "${paths[i]}/bin"
fi
done done
} }
_bash-it-gopath-pathmunge _bash-it-component-plugin-callback-on-init-go

View File

@ -1,5 +1,4 @@
# shellcheck shell=bash # shellcheck shell=bash
cite about-plugin
about-plugin 'load goenv, if you are using it' about-plugin 'load goenv, if you are using it'
# https://github.com/syndbg/goenv # https://github.com/syndbg/goenv
@ -11,29 +10,31 @@ about-plugin 'load goenv, if you are using it'
# - Check if in $PATH already # - Check if in $PATH already
# - Check if installed manually to $GOENV_ROOT # - Check if installed manually to $GOENV_ROOT
# - Check if installed manually to $HOME # - Check if installed manually to $HOME
_command_exists goenv \ if ! _binary_exists goenv || ! [[ -n "${GOENV_ROOT:-}" && -x "$GOENV_ROOT/bin/goenv" ]] || ! [[ -x "$HOME/.goenv/bin/goenv" ]]; then
|| [[ -n "$GOENV_ROOT" && -x "$GOENV_ROOT/bin/goenv" ]] \ _log_warning "Unable to locate 'goenv'."
|| [[ -x "$HOME/.goenv/bin/goenv" ]] \ return 1
|| return 0 fi
# Set GOENV_ROOT, if not already set # Set GOENV_ROOT, if not already set
export GOENV_ROOT="${GOENV_ROOT:-$HOME/.goenv}" : "${GOENV_ROOT:=$HOME/.goenv}"
export GOENV_ROOT
# Add GOENV_ROOT/bin to PATH, if that's where it's installed # Add GOENV_ROOT/bin to PATH, if that's where it's installed
if ! _command_exists goenv && [[ -x "$GOENV_ROOT/bin/goenv" ]]; then if ! _command_exists goenv && [[ -x "$GOENV_ROOT/bin/goenv" ]]; then
pathmunge "$GOENV_ROOT/bin" pathmunge "$GOENV_ROOT/bin"
fi fi
# Initialize goenv # shellcheck disable=SC1090 # Initialize goenv
eval "$(goenv init - bash)" source < <(goenv init - bash)
# If moving to a directory with a goenv version set, reload the shell # If moving to a directory with a goenv version set, reload the shell
# to ensure the shell environment matches expectations. # to ensure the shell environment matches expectations.
_bash-it-goenv-preexec() { function _bash-it-goenv-preexec() {
GOENV_OLD_VERSION="$(goenv version-name)" GOENV_OLD_VERSION="$(goenv version-name)"
} }
_bash-it-goenv-precmd() {
if [[ -n $GOENV_OLD_VERSION ]] && [[ "$GOENV_OLD_VERSION" != "$(goenv version-name)" ]]; then function _bash-it-goenv-precmd() {
if [[ -n "${GOENV_OLD_VERSION:-}" ]] && [[ "$GOENV_OLD_VERSION" != "$(goenv version-name)" ]]; then
exec env -u PATH -u GOROOT -u GOPATH -u GOENV_OLD_VERSION "${0/-/}" --login exec env -u PATH -u GOROOT -u GOPATH -u GOENV_OLD_VERSION "${0/-/}" --login
fi fi
unset GOENV_OLD_VERSION unset GOENV_OLD_VERSION

View File

@ -1,7 +1,9 @@
# shellcheck shell=bash # shellcheck shell=bash
cite about-plugin
about-plugin 'load hub, if you are using it' about-plugin 'load hub, if you are using it'
if _command_exists hub; then if ! _binary_exists hub; then
eval "$(hub alias -s)" _log_warning "Unable to locate 'hub'."
return 1
fi fi
source < <(hub alias -s)

View File

@ -1,22 +1,23 @@
cite about-plugin # shellcheck shell=bash
about-plugin 'load jenv, if you are using it' about-plugin 'load jenv, if you are using it'
# Don't modify the environment if we can't find the tool: # Don't modify the environment if we can't find the tool:
# - Check if in $PATH already # - Check if in $PATH already
# - Check if installed manually to $JENV_ROOT # - Check if installed manually to $JENV_ROOT
# - Check if installed manually to $HOME # - Check if installed manually to $HOME
_command_exists jenv || if ! _binary_exists jenv && ! [[ -n "${JENV_ROOT:-}" && -x "$JENV_ROOT/bin/jenv" ]] && ! [[ -x "$HOME/.jenv/bin/jenv" ]]; then
[[ -n "$JENV_ROOT" && -x "$JENV_ROOT/bin/jenv" ]] || _log_warning "Unable to locate 'jenv'."
[[ -x "$HOME/.jenv/bin/jenv" ]] || return 1
return fi
# Set JENV_ROOT, if not already set # Set JENV_ROOT, if not already set
export JENV_ROOT="${JENV_ROOT:-$HOME/.jenv}" : "${JENV_ROOT:=$HOME/.jenv}"
export JENV_ROOT
# Add JENV_ROOT/bin to PATH, if that's where it's installed # Add JENV_ROOT/bin to PATH, if that's where it's installed
! _command_exists jenv && if ! _command_exists jenv && [[ -x "$JENV_ROOT/bin/jenv" ]]; then
[[ -x "$JENV_ROOT/bin/jenv" ]] && pathmunge "$JENV_ROOT/bin"
pathmunge "$JENV_ROOT/bin" fi
# Initialize jenv # shellcheck disable=SC1090 # Initialize jenv
eval "$(jenv init - bash)" source < <(jenv init - bash)

View File

@ -1,12 +1,11 @@
# shellcheck shell=bash # shellcheck shell=bash
# shellcheck disable=SC2016 # shellcheck disable=SC2016
cite about-plugin
about-plugin 'initialize jump (see https://github.com/gsamokovarov/jump). Add `export JUMP_OPTS=("--bind=z")` to change keybinding' about-plugin 'initialize jump (see https://github.com/gsamokovarov/jump). Add `export JUMP_OPTS=("--bind=z")` to change keybinding'
function __init_jump() { function _bash-it-component-plugin-callback-on-init-jump() {
if _command_exists jump; then if _command_exists jump; then
eval "$(jump shell bash "${JUMP_OPTS[@]}")" source < <(jump shell bash "${JUMP_OPTS[@]:-}")
fi fi
} }
__init_jump _bash-it-component-plugin-callback-on-init-jump

View File

@ -1,8 +1,10 @@
# shellcheck shell=bash # shellcheck shell=bash
cite about-plugin
about-plugin 'pygmentize instead of cat to terminal if possible' about-plugin 'pygmentize instead of cat to terminal if possible'
_command_exists pygmentize || return if ! _binary_exists pygmentize; then
_log_warning "${BASH_SOURCE[0]##*/}: unable to initialize without '$_' installed."
return 1
fi
# pigmentize cat and less outputs - call them ccat and cless to avoid that # pigmentize cat and less outputs - call them ccat and cless to avoid that
# especially cat'ed output in scripts gets mangled with pygemtized meta characters # especially cat'ed output in scripts gets mangled with pygemtized meta characters

View File

@ -1,14 +1,16 @@
# shellcheck shell=bash # shellcheck shell=bash
cite about-plugin
about-plugin 'Node.js helper functions' about-plugin 'Node.js helper functions'
# Check that we have npm # Check that we have npm
_command_exists npm || return if ! _binary_exists npm; then
_log_warning "Unable to locage 'npm'."
return 1
fi
# Ensure local modules are preferred in PATH # Ensure local modules are preferred in PATH
pathmunge "./node_modules/.bin" "after" pathmunge "./node_modules/.bin" "after"
# If not using nodenv, ensure global modules are in PATH # If not using nodenv, ensure global modules are in PATH
if [[ ! "$(type -p npm)" == *"nodenv/shims"* ]]; then if [[ "$(type -p npm)" != *"nodenv/shims"* ]]; then
pathmunge "$(npm config get prefix)/bin" "after" pathmunge "$(npm config get prefix)/bin" "after"
fi fi

View File

@ -1,10 +1,15 @@
# shellcheck shell=bash # shellcheck shell=bash
cite about-plugin
about-plugin 'load nodenv, if you are using it' about-plugin 'load nodenv, if you are using it'
export NODENV_ROOT="$HOME/.nodenv" if [[ -d "${NODENV_ROOT:=$HOME/.nodenv}/bin" ]]; then
pathmunge "$NODENV_ROOT/bin" export NODENV_ROOT
pathmunge "$NODENV_ROOT/bin"
if _command_exists nodenv; then
eval "$(nodenv init - bash)"
fi fi
if ! _binary_exists nodenv; then
_log_warning "Unable to locage 'nodenv'."
return 1
fi
# shellcheck disable=SC1090
source < <(nodenv init - bash)

View File

@ -1,31 +1,25 @@
# shellcheck shell=bash # shellcheck shell=bash
# about-plugin 'node version manager configuration'
# BASH_IT_LOAD_PRIORITY: 225
#
# Bash-it no longer bundles nvm, as this was quickly becoming outdated. # Bash-it no longer bundles nvm, as this was quickly becoming outdated.
# Please install nvm from https://github.com/creationix/nvm.git if you want to use it. # Please install nvm from https://github.com/creationix/nvm.git if you want to use it.
cite about-plugin # BASH_IT_LOAD_PRIORITY: 225
about-plugin 'node version manager configuration'
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}" : "${NVM_DIR:=$HOME/.nvm}"
# This loads nvm export NVM_DIR
if _bash_it_homebrew_check && [[ -s "${BASH_IT_HOMEBREW_PREFIX}/nvm.sh" ]]
then # shellcheck disable=SC1091 # This loads nvm
source "${BASH_IT_HOMEBREW_PREFIX}/nvm.sh" if _bash_it_homebrew_check && [[ -s "${BASH_IT_HOMEBREW_PREFIX?}/opt/nvm/nvm.sh" ]]; then
else mkdir -p "${NVM_DIR}"
[[ -s "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh" source "${BASH_IT_HOMEBREW_PREFIX?}/opt/nvm/nvm.sh"
elif [[ -s "${NVM_DIR}/nvm.sh" ]]; then
source "${NVM_DIR}/nvm.sh"
fi fi
if ! _command_exists nvm if ! _command_exists nvm; then
then _log_warning "Bash-it no longer bundles the nvm script. Please install the latest version from
function nvm() { https://github.com/creationix/nvm.git or Homebrew"
echo "Bash-it no longer bundles the nvm script. Please install the latest version from" _log_warning "if you want to use nvm. You can keep this plugin enabled once you have installed nvm."
echo "" return 1
echo "https://github.com/creationix/nvm.git"
echo ""
echo "if you want to use nvm. You can keep this plugin enabled once you have installed nvm."
}
nvm
fi fi

View File

@ -1,9 +1,8 @@
# shellcheck shell=bash # shellcheck shell=bash
cite about-plugin
about-plugin 'Search&Select history with percol' about-plugin 'Search&Select history with percol'
# Notice # Notice
## You have to upgrade bash to bash 4.x on Mac OS X. ## You have to upgrade bash to bash 4.x or higher
## http://stackoverflow.com/questions/16416195/how-do-i-upgrade-bash-in-mac-osx-mountain-lion-and-set-it-the-correct-path ## http://stackoverflow.com/questions/16416195/how-do-i-upgrade-bash-in-mac-osx-mountain-lion-and-set-it-the-correct-path
# Install # Install
@ -13,12 +12,15 @@ about-plugin 'Search&Select history with percol'
# Usage # Usage
## C-r to search&select from history ## C-r to search&select from history
_command_exists percol || return if ! _binary_exists percol; then
_log_warning "Unable to locate 'percol'."
return 1
fi
if [[ ${BASH_VERSINFO[0]} -lt 4 ]]; then if [[ ${BASH_VERSINFO[0]} -lt 4 ]]; then
_log_warning "You have to upgrade Bash to Bash v4.x to use the 'percol' plugin." _log_warning "You have to upgrade Bash to Bash v4.x to use the 'percol' plugin."
_log_warning "Your current Bash version is $BASH_VERSION." _log_warning "Your current Bash version is $BASH_VERSION."
return return 1
fi fi
function _replace_by_history() { function _replace_by_history() {

View File

@ -1,8 +1,4 @@
# shellcheck shell=bash # shellcheck shell=bash
#
# plugin for plenv
cite about-plugin
about-plugin 'plenv plugin for Perl' about-plugin 'plenv plugin for Perl'
if [[ -d "${HOME}/.plenv/bin" ]]; then if [[ -d "${HOME}/.plenv/bin" ]]; then
@ -10,7 +6,10 @@ if [[ -d "${HOME}/.plenv/bin" ]]; then
pathmunge "${HOME}/.plenv/bin" pathmunge "${HOME}/.plenv/bin"
fi fi
if _command_exists plenv; then if ! _binary_exists plenv; then
# init plenv _log_warning "Unable to locage 'plenv'."
eval "$(plenv init - bash)" return 1
fi fi
# shellcheck disable=SC1090 # init plenv
source < <(plenv init - bash)

View File

@ -1,9 +1,11 @@
# shellcheck shell=bash # shellcheck shell=bash
cite about-plugin
about-plugin 'enables powerline daemon' about-plugin 'enables powerline daemon'
_command_exists powerline-daemon || return if ! _binary_exists powerline-daemon; then
_log_warning "Unable to locate '$_'."
return 1
fi
powerline-daemon -q powerline-daemon -q
#the following should not be executed if bashit powerline themes in use #the following should not be executed if bashit powerline themes in use
@ -12,8 +14,8 @@ case "$BASH_IT_THEME" in
return return
;; ;;
esac esac
POWERLINE_BASH_CONTINUATION=1 export POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1 export POWERLINE_BASH_SELECT=1
bashPowerlineInit="$(python -c \ bashPowerlineInit="$(python -c \
"import os; \ "import os; \
import powerline;\ import powerline;\
@ -22,5 +24,11 @@ bashPowerlineInit="$(python -c \
'bindings', \ 'bindings', \
'bash', \ 'bash', \
'powerline.sh'))")" 'powerline.sh'))")"
[ -e $bashPowerlineInit ] || return
source $bashPowerlineInit if ! [[ -s ${bashPowerlineInit?} ]]; then
_log_warning "Failed to initialize 'powerline'."
return 1
fi
# shellcheck disable=SC1090
source "${bashPowerlineInit?}"

View File

@ -1,5 +1,4 @@
# shellcheck shell=bash # shellcheck shell=bash
cite about-plugin
about-plugin 'load pyenv, if you are using it' about-plugin 'load pyenv, if you are using it'
# https://github.com/pyenv/pyenv # https://github.com/pyenv/pyenv
@ -11,13 +10,14 @@ about-plugin 'load pyenv, if you are using it'
# - Check if in $PATH already # - Check if in $PATH already
# - Check if installed manually to $PYENV_ROOT # - Check if installed manually to $PYENV_ROOT
# - Check if installed manually to $HOME # - Check if installed manually to $HOME
_command_exists pyenv \ if ! _binary_exists pyenv && ! [[ -n "${PYENV_ROOT:-}" && -x "$PYENV_ROOT/bin/pyenv" ]] && ! [[ -x "$HOME/.pyenv/bin/pyenv" ]]; then
|| [[ -n "$PYENV_ROOT" && -x "$PYENV_ROOT/bin/pyenv" ]] \ _log_warning "Unable to locate 'pyenv'."
|| [[ -x "$HOME/.pyenv/bin/pyenv" ]] \ return 1
|| return 0 fi
# Set PYENV_ROOT, if not already set # Set PYENV_ROOT, if not already set
export PYENV_ROOT="${PYENV_ROOT:-$HOME/.pyenv}" : "${PYENV_ROOT:=$HOME/.pyenv}"
export PYENV_ROOT
# Add PYENV_ROOT/bin to PATH, if that's where it's installed # Add PYENV_ROOT/bin to PATH, if that's where it's installed
if ! _command_exists pyenv && [[ -x "$PYENV_ROOT/bin/pyenv" ]]; then if ! _command_exists pyenv && [[ -x "$PYENV_ROOT/bin/pyenv" ]]; then
@ -26,9 +26,11 @@ fi
# Initialize pyenv # Initialize pyenv
pathmunge "$PYENV_ROOT/shims" pathmunge "$PYENV_ROOT/shims"
eval "$(pyenv init - bash)" # shellcheck disable=SC1090
source < <(pyenv init - bash)
# Load pyenv virtualenv if the virtualenv plugin is installed. # Load pyenv virtualenv if the virtualenv plugin is installed.
if pyenv virtualenv-init - &> /dev/null; then if pyenv virtualenv-init - &> /dev/null; then
eval "$(pyenv virtualenv-init - bash)" # shellcheck disable=SC1090
source < <(pyenv virtualenv-init - bash)
fi fi

View File

@ -1,10 +1,13 @@
# shellcheck shell=bash # shellcheck shell=bash
cite about-plugin
about-plugin 'load rbenv, if you are using it' about-plugin 'load rbenv, if you are using it'
export RBENV_ROOT="$HOME/.rbenv" : "${RBENV_ROOT:=$HOME/.rbenv}"
export RBENV_ROOT
pathmunge "$RBENV_ROOT/bin" pathmunge "$RBENV_ROOT/bin"
if _command_exists rbenv; then if ! _binary_exists rbenv; then
eval "$(rbenv init - bash)" _log_warning "Unable to locage 'rbenv'."
return 1
fi fi
source < <(rbenv init - bash)

View File

@ -1,13 +1,15 @@
# shellcheck shell=bash # shellcheck shell=bash
cite about-plugin
about-plugin 'ruby and rubygems specific functions and settings' about-plugin 'ruby and rubygems specific functions and settings'
# Make commands installed with 'gem install --user-install' available # Make commands installed with 'gem install --user-install' available
# ~/.gem/ruby/${RUBY_VERSION}/bin/ # ~/.gem/ruby/${RUBY_VERSION}/bin/
if _command_exists ruby && _command_exists gem; then if ! _binary_exists ruby || ! _binary_exists gem; then
pathmunge "$(ruby -e 'print Gem.user_dir')/bin" after _log_warning "Unable to locate 'gem'."
return 1
fi fi
pathmunge "$(ruby -e 'print Gem.user_dir')/bin" after
function remove_gem() { function remove_gem() {
about 'removes installed gem' about 'removes installed gem'
param '1: installed gem name' param '1: installed gem name'

View File

@ -1,9 +1,10 @@
# shellcheck shell=bash # shellcheck shell=bash
cite about-plugin
about-plugin 'set textmate as a default editor' about-plugin 'set textmate as a default editor'
if _command_exists mate; then if ! _binary_exists mate; then
EDITOR="$(type -p mate) -w" _log_warning "Unable to locage 'mate'."
GIT_EDITOR="$EDITOR" return 1
export EDITOR GIT_EDITOR
fi fi
EDITOR="$(type -p mate) -w"
export EDITOR

View File

@ -1,9 +1,12 @@
cite about-plugin # shellcheck shell=bash
about-plugin 'Initialization for fuck' about-plugin 'Initialization for fuck'
# https://github.com/nvbn/thefuck # https://github.com/nvbn/thefuck
if _command_exists thefuck; then if ! _binary_exists thefuck; then
# shellcheck disable=SC2046 _log_warning "Unable to locate 'thefuck'."
eval $(thefuck --alias) return 1
fi fi
# shellcheck disable=SC1090
source < <(thefuck --alias)

View File

@ -1,9 +1,9 @@
# shellcheck shell=bash # shellcheck shell=bash
cite about-plugin
about-plugin 'zoxide is a smarter cd command for your shell.' about-plugin 'zoxide is a smarter cd command for your shell.'
if _command_exists zoxide; then if ! _binary_exists zoxide; then
eval "$(zoxide init bash)"
else
_log_error 'zoxide not found, please install it from https://github.com/ajeetdsouza/zoxide' _log_error 'zoxide not found, please install it from https://github.com/ajeetdsouza/zoxide'
return 1
fi fi
source < <(zoxide init bash)

View File

@ -19,10 +19,10 @@ function setup_go_path()
# We test `go version` in each test to account for users with goenv and no system go. # We test `go version` in each test to account for users with goenv and no system go.
@test 'ensure _bash-it-gopath-pathmunge is defined' { @test 'ensure _bash-it-component-plugin-callback-on-init-go is defined' {
{ _command_exists go && go version &>/dev/null; } || skip 'golang not found' { _command_exists go && go version &>/dev/null; } || skip 'golang not found'
load ../../plugins/available/go.plugin load ../../plugins/available/go.plugin
run type -t _bash-it-gopath-pathmunge run type -t _bash-it-component-plugin-callback-on-init-go
assert_line 'function' assert_line 'function'
} }
@ -53,7 +53,7 @@ function setup_go_path()
setup_go_path "$BASH_IT/test/fixtures/go/gopath" setup_go_path "$BASH_IT/test/fixtures/go/gopath"
setup_go_path "$BASH_IT/test/fixtures/go/gopath2" setup_go_path "$BASH_IT/test/fixtures/go/gopath2"
load ../../plugins/available/go.plugin load ../../plugins/available/go.plugin
assert_equal "$(cut -d':' -f1,2 <<<$PATH)" "$BASH_IT/test/fixtures/go/gopath2/bin:$BASH_IT/test/fixtures/go/gopath/bin" assert_equal "$(cut -d':' -f1,2 <<<$PATH)" "$BASH_IT/test/fixtures/go/gopath/bin:$BASH_IT/test/fixtures/go/gopath2/bin"
} }
@test 'plugins go: multiple entries in GOPATH, with space' { @test 'plugins go: multiple entries in GOPATH, with space' {
@ -61,7 +61,7 @@ function setup_go_path()
setup_go_path "$BASH_IT/test/fixtures/go/gopath" setup_go_path "$BASH_IT/test/fixtures/go/gopath"
setup_go_path "$BASH_IT/test/fixtures/go/go path" setup_go_path "$BASH_IT/test/fixtures/go/go path"
load ../../plugins/available/go.plugin load ../../plugins/available/go.plugin
assert_equal "$(cut -d':' -f1,2 <<<$PATH)" "$BASH_IT/test/fixtures/go/go path/bin:$BASH_IT/test/fixtures/go/gopath/bin" assert_equal "$(cut -d':' -f1,2 <<<$PATH)" "$BASH_IT/test/fixtures/go/gopath/bin:$BASH_IT/test/fixtures/go/go path/bin"
} }
@test 'plugins go: multiple entries in GOPATH, with escaped space' { @test 'plugins go: multiple entries in GOPATH, with escaped space' {