2020-05-11 01:56:27 +00:00
|
|
|
#!/usr/bin/env bash
|
2020-04-07 06:51:07 +00:00
|
|
|
#
|
|
|
|
# check env variables and set default variables
|
|
|
|
#
|
|
|
|
# @params
|
|
|
|
# Globals
|
2020-06-23 07:05:50 +00:00
|
|
|
# ${DOTBARE_DIR}: location of the bare repo
|
2020-05-04 23:45:21 +00:00
|
|
|
# ${DOTBARE_TREE}: which folder is the bare repo tracking
|
|
|
|
# ${DOTBARE_BACKUP}: backup directory for all tracked files
|
|
|
|
# ${DOTBARE_KEY}: defualt key bindings
|
|
|
|
# ${FZF_DEFAULT_OPTS}: update FZF_DEFAULT_OPTS to reflect dotbare changes
|
|
|
|
# ${DOTBARE_FZF_DEFAULT_OPTS}: user custom setting for dotbare
|
2020-04-24 07:26:45 +00:00
|
|
|
# ${EDITOR}: default editor to use
|
2020-04-07 06:51:07 +00:00
|
|
|
|
2020-05-13 11:04:02 +00:00
|
|
|
export DOTBARE_DIR="${DOTBARE_DIR:-$HOME/.cfg/}"
|
|
|
|
export DOTBARE_TREE="${DOTBARE_TREE:-$HOME}"
|
|
|
|
export DOTBARE_BACKUP="${DOTBARE_BACKUP:-${XDG_DATA_HOME:-$HOME/.local/share}/dotbare}"
|
2020-05-04 23:45:21 +00:00
|
|
|
|
2020-05-13 11:04:02 +00:00
|
|
|
export EDITOR="${EDITOR:-vim}"
|
2020-04-07 06:51:07 +00:00
|
|
|
if [[ -z "${DOTBARE_KEY}" ]]; then
|
2020-05-13 11:04:02 +00:00
|
|
|
export DOTBARE_KEY="
|
2020-04-07 06:51:07 +00:00
|
|
|
--bind=alt-a:toggle-all
|
|
|
|
--bind=alt-w:jump
|
|
|
|
--bind=alt-0:top
|
|
|
|
--bind=alt-s:toggle-sort
|
|
|
|
--bind=alt-t:toggle-preview
|
|
|
|
"
|
|
|
|
fi
|
|
|
|
|
2020-05-11 01:45:43 +00:00
|
|
|
[[ -z "${FZF_DEFAULT_OPTS}" ]] && export FZF_DEFAULT_OPTS='--cycle'
|
|
|
|
|
2020-05-13 11:04:02 +00:00
|
|
|
export FZF_DEFAULT_OPTS="
|
2020-04-07 06:51:07 +00:00
|
|
|
$FZF_DEFAULT_OPTS
|
|
|
|
--ansi
|
|
|
|
--cycle
|
|
|
|
--exit-0
|
|
|
|
$DOTBARE_FZF_DEFAULT_OPTS
|
|
|
|
$DOTBARE_KEY
|
|
|
|
"
|
2020-04-17 05:03:49 +00:00
|
|
|
|
|
|
|
#######################################
|
|
|
|
# determine to set multi selection or not
|
|
|
|
# Globals:
|
|
|
|
# ${FZF_DEFAULT_OPTS}: fzf options
|
|
|
|
# Arguments:
|
|
|
|
# $1: if exists, disable multi, set single
|
|
|
|
#######################################
|
|
|
|
function set_fzf_multi() {
|
|
|
|
local no_multi="$1"
|
|
|
|
if [[ -z "${no_multi}" ]]; then
|
2020-05-13 11:04:02 +00:00
|
|
|
export FZF_DEFAULT_OPTS="${FZF_DEFAULT_OPTS} --multi"
|
2020-04-17 05:03:49 +00:00
|
|
|
else
|
2020-05-13 11:04:02 +00:00
|
|
|
export FZF_DEFAULT_OPTS="${FZF_DEFAULT_OPTS} --no-multi"
|
2020-04-17 05:03:49 +00:00
|
|
|
fi
|
|
|
|
}
|