Skip to content

Commit

Permalink
Merge branch 'develop' of ssh://github.com/westurner/dotfiles into de…
Browse files Browse the repository at this point in the history
…velop

* 'develop' of ssh://github.com/westurner/dotfiles:
  ENH: venv_relabel.sh: ls -aldZ "${prefix}"/*
  BUG,SEC: scripts/venv_relabel.sh: return -1 if prefix is unset #37
  BUG,SEC: scripts/venv_relabel.sh: ./lib64 symlink before ./lib, quoting #37
  CLN,SEC: usrlog.sh: script variable quoting
  BLD: Makefile: add shortrev to gh-pages commit msg
  ENH,SEC: scripts/venv_relabel.sh: set virtualenv/venv fcontexts [semanage, restorecon]
  DOC,SEC: scripts/whyquote.sh: shell quoting
  ENH: scripts/setup_node.sh: #needstests
  ENH,DOC: xlck.sh: gnome-screensaver support, xlck_install, xlck_lock, usage
  SEC,DOC: 00-bashrc.before.sh: quoting
  BUG,SEC: 29-bashrc.vimpagers.sh: quoting
  DOC: autogenerated usage docs
  • Loading branch information
westurner committed Sep 13, 2015
2 parents b4d87ae + 229511f commit b6ace17
Show file tree
Hide file tree
Showing 11 changed files with 480 additions and 102 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,9 @@ sdist: clean

gh-pages:
# Push docs to gh-pages branch with a .nojekyll file
ghp-import -n -p ./docs/_build/html/
ghp-import -n -p ./docs/_build/html/ \
-m "DOC,RLS: gh-pages from: $(shell git -C $(shell pwd) rev-parse --short HEAD)"


pull:
git pull
Expand Down
5 changes: 3 additions & 2 deletions docs/usage/bash_conf.txt
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,9 @@
# psch -- 'ps uxaw -c | head'
# psm -- 'ps uxaw -m'
# psmh -- 'ps uxaw -m | head'
# pyg -- pygmentize
# shtop -- 'sudo htop'
# pyg -- pygmentize [pip install --user pygments]
# catp -- pygmentize [pip install --user pygments]
# shtop -- 'sudo htop' [apt-get/yum install -y htop]
# t -- 'tail'
# tf -- 'tail -f'
# xclipc -- 'xclip -selection c'
Expand Down
71 changes: 38 additions & 33 deletions etc/bash/00-bashrc.before.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,56 +11,56 @@ function dotfiles_reload {

export __WRK="${HOME}/-wrk"

if [ -n $__DOTFILES ]; then
export __DOTFILES=${__DOTFILES}
if [ -n "${__DOTFILES}" ]; then
export __DOTFILES="${__DOTFILES}"
else
_dotfiles_src=${WORKON_HOME}/dotfiles/src/dotfiles
_dotfiles_link=${HOME}/-dotfiles
_dotfiles_src="${WORKON_HOME}/dotfiles/src/dotfiles"
_dotfiles_link="${HOME}/-dotfiles"

if [ -d $_dotfiles_link ]; then
__DOTFILES=${_dotfiles_link}
elif [ -d $_dotfiles_src ]; then
__DOTFILES=${_dotfiles_src}
if [ -d "${_dotfiles_link}" ]; then
__DOTFILES="${_dotfiles_link}"
elif [ -d "${_dotfiles_src}" ]; then
__DOTFILES="${_dotfiles_src}"
fi
export __DOTFILES=${__DOTFILES}
export __DOTFILES="${__DOTFILES}"
fi

conf=${__DOTFILES}/etc/bash
conf="${__DOTFILES}/etc/bash"

#
## 01-bashrc.lib.sh -- useful bash functions (paths)
# lspath() -- list every file along $PATH
# realpath() -- readlink -f (python os.path.realpath)
# walkpath() -- list every directory along ${1:-"."}
source ${conf}/01-bashrc.lib.sh
source "${conf}/01-bashrc.lib.sh"

#
## 02-bashrc.platform.sh -- platform things
source ${conf}/02-bashrc.platform.sh
source "${conf}/02-bashrc.platform.sh"
detect_platform
# detect_platform() -- set $__IS_MAC or $__IS_LINUX
if [ -n "${__IS_MAC}" ]; then
export PATH=$(echo ${PATH} | sed 's,/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin,/usr/sbin:/sbin:/bin:/usr/local/bin:/usr/bin,')
export PATH="$(echo ${PATH} | sed 's,/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin,/usr/sbin:/sbin:/bin:/usr/local/bin:/usr/bin,')"

## 03-bashrc.darwin.sh
source ${conf}/03-bashrc.darwin.sh
source "${conf}/03-bashrc.darwin.sh"
fi

#
## 04-bashrc.TERM.sh -- set $TERM and $CLICOLOR
source ${conf}/04-bashrc.TERM.sh
source "${conf}/04-bashrc.TERM.sh"

#
## 05-bashrc.dotfiles.sh -- dotfiles
# $__DOTFILES (str): -- path to the dotfiles symlink (~/.dotfiles)
# dotfiles_status() -- print dotfiles variables
# ds() -- print dotfiles variables
source ${conf}/05-bashrc.dotfiles.sh
source "${conf}/05-bashrc.dotfiles.sh"
dotfiles_add_path

#
## 06-bashrc.completion.sh -- configure bash completion
source ${conf}/06-bashrc.completion.sh
source "${conf}/06-bashrc.completion.sh"

#
##
Expand All @@ -75,7 +75,7 @@ function dotfiles_reload {
# _setup_python() -- configure PYTHONSTARTUP
# _setup_pip() -- configure PIP_REQUIRE_VIRTUALENV
# _setup_pyenv() -- setup pyenv PYENV_ROOT and eval (manual)
source ${conf}/07-bashrc.python.sh
source "${conf}/07-bashrc.python.sh"

#
## 08-bashrc.conda.sh -- conda
Expand All @@ -85,7 +85,7 @@ function dotfiles_reload {
# $2 (str): (optional) CONDA_ROOT_PATH (or '27' or '34')
# $CONDA_ROOT (str): path to conda install (~/-wrk/-conda34)
# $CONDA_ENVS_PATH (str): path to condaenvs directory (~/-wrk/-ce34) [conda]
source ${conf}/08-bashrc.conda.sh
source "${conf}/08-bashrc.conda.sh"

#
## 07-bashrc.virtualenvwrapper.sh -- virtualenvwrapper
Expand All @@ -97,12 +97,12 @@ function dotfiles_reload {
# rebuild_virtualenv($VENVSTR) -- rebuild $WORKON_HOME/$VENVSTR
# rebuild_virtualenvs() -- rebuild $WORKON_HOME/*
# TODO: restore_virtualenv($BACKUPVENVSTR, [$NEWVENVSTR])
source ${conf}/07-bashrc.virtualenvwrapper.sh
source "${conf}/07-bashrc.virtualenvwrapper.sh"

#
## 08-bashrc.gcloud.sh -- gcloud: Google Cloud SDK
# _setup_google_cloud() -- setup google cloud paths
source ${conf}/08-bashrc.gcloud.sh
source "${conf}/08-bashrc.gcloud.sh"

#
## 10-bashrc.venv.sh -- venv: virtualenvwrapper extensions
Expand All @@ -117,12 +117,12 @@ function dotfiles_reload {
# we dotfiles
# we dotfiles etc/bash; cdw; ds; # ls -altr; lll; cd ~; ew etc/bash/*.sh
# type workon_venv; which venv.py; venv.py --help
source ${conf}/10-bashrc.venv.sh
source "${conf}/10-bashrc.venv.sh"
#

#
## 11-bashrc.venv.pyramid.sh -- venv-pyramid: pyramid-specific config
source ${conf}/11-bashrc.venv.pyramid.sh
source "${conf}/11-bashrc.venv.pyramid.sh"

#
## 20-bashrc.editor.sh -- $EDITOR configuration
Expand All @@ -131,16 +131,21 @@ function dotfiles_reload {
# e() -- open paths in current EDITOR_ [scripts/e]
# ew() -- open paths relative to $_WRD in current EDITOR_ [scripts/ew]
# (~ cd $_WRD; $EDITOR_ ${@}) + tab completion
source ${conf}/20-bashrc.editor.sh
source "${conf}/20-bashrc.editor.sh"
#
## 20-bashrc.vimpagers.sh -- $PAGER configuration
# $PAGER (str): cmdstring to run pager (less/vim)
# lessv() -- open in vim with less.vim
# VIMPAGER_SYNTAX="python" lessv
# lessg() -- open in a gvim with less.vim
# VIMPAGER_SYNTAX="python" lessv
# lesse() -- open with $EDITOR_
source ${conf}/29-bashrc.vimpagers.sh
# lesse() -- open with $EDITOR_ (~e)
# manv() -- open manpage with vim
# mang() -- open manpage with gvim
# mane() -- open manpage with $EDITOR_ (~e)
#
# TODO: GIT_PAGER="/usr/bin/less -R | /usr/bin/cat"
source "${conf}/29-bashrc.vimpagers.sh"

#
## 30-bashrc.usrlog.sh -- $_USRLOG configuration
Expand All @@ -162,33 +167,33 @@ function dotfiles_reload {
# egrep $@ "${__USRLOG}" "${WORKON_HOME}/*/-usrlog.log"
# ugrin -- grin current usrlog: grin $@ ${_USRLOG}
# ugrinall -- grin $@ "${__USRLOG}" "${WORKON_HOME}/*/-usrlog.log"
source ${conf}/30-bashrc.usrlog.sh
source "${conf}/30-bashrc.usrlog.sh"

#
## 30-bashrc.xlck.sh -- screensaver, (auto) lock, suspend
# _setup_xlck() -- configure xlck
source ${conf}/30-bashrc.xlck.sh
source "${conf}/30-bashrc.xlck.sh"

#
## 40-bashrc.aliases.sh -- aliases
# _setup_venv_aliases() -- source in e, ew, makew, ssv, hgw, gitw
# _setup_supervisord() -- configure _SVCFG
# $1 (str): path to a supervisord.conf file "${1:-${_SVCFG}"
source ${conf}/40-bashrc.aliases.sh
source "${conf}/40-bashrc.aliases.sh"
## 42-bashrc.commands.sh -- example commands
source ${conf}/42-bashrc.commands.sh
source "${conf}/42-bashrc.commands.sh"

#
## 50-bashrc.bashmarks.sh -- bashmarks: local bookmarks
source ${conf}/50-bashrc.bashmarks.sh
source "${conf}/50-bashrc.bashmarks.sh"

#
## 70-bashrc.repos.sh -- repos: $__SRC repos, docs
source ${conf}/70-bashrc.repos.sh
source "${conf}/70-bashrc.repos.sh"

#
## 99-bashrc.after.sh -- after: cleanup
source ${conf}/99-bashrc.after.sh
source "${conf}/99-bashrc.after.sh"
}

function dr {
Expand Down
20 changes: 10 additions & 10 deletions etc/bash/29-bashrc.vimpagers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

_configure_lesspipe() {
# _configure_lesspipe() -- (less <file.zip> | lessv)
lesspipe=$(which lesspipe.sh 2>/dev/null || false)
lesspipe="$(which lesspipe.sh 2>/dev/null)"
if [ -n "${lesspipe}" ]; then
eval "$(${lesspipe})"
fi
Expand All @@ -15,7 +15,7 @@ vimpager() {
# vimpager() -- call vimpager
_PAGER=$(which vimpager)
if [ -x "${_PAGER}" ]; then
${_PAGER} $@
"${_PAGER}" $@
else
echo "error: vimpager not found. (see lessv: 'lessv $@')"
fi
Expand All @@ -28,7 +28,7 @@ lessv () {
if [ $# -eq 0 ]; then
if [ -n "$VIMPAGER_SYNTAX" ]; then
#read stdin
${VIMBIN} --cmd "let g:tinyvim=1" \
"${VIMBIN}" --cmd "let g:tinyvim=1" \
--cmd "runtime! macros/less.vim" \
--cmd "set nomod" \
--cmd "set noswf" \
Expand All @@ -37,7 +37,7 @@ lessv () {
-c "set syntax=${VIMPAGER_SYNTAX}" \
-
else
${VIMBIN} --cmd "let g:tinyvim=1" \
"${VIMBIN}" --cmd "let g:tinyvim=1" \
--cmd "runtime! macros/less.vim" \
--cmd "set nomod" \
--cmd "set noswf" \
Expand All @@ -46,7 +46,7 @@ lessv () {
-
fi
elif [ -n "$VIMPAGER_SYNTAX" ]; then
${VIMBIN} \
"${VIMBIN}" \
--cmd "let g:tinyvim=1" \
--cmd "runtime! macros/less.vim" \
--cmd "set nomod" \
Expand All @@ -57,7 +57,7 @@ lessv () {
${@}

else
${VIMBIN} \
"${VIMBIN}" \
--cmd "let g:tinyvim=1" \
--cmd "runtime! macros/less.vim" \
--cmd "set nomod" \
Expand All @@ -78,12 +78,12 @@ lessv () {

lessg() {
# lessg() -- less with less.vim and gvim / mvim
VIMBIN=${GUIVIMBIN} lessv $@
VIMBIN="${GUIVIMBIN}" lessv $@
}

lesse() {
# lesse() -- less with current venv's vim server
${EDITOR_} $@
"${GUIVIMBIN}" --servername ${VIRTUAL_ENV_NAME:-"/"} --remote-tab ${@};
}

manv() {
Expand All @@ -93,7 +93,7 @@ manv() {
/usr/bin/man
else
#/usr/bin/whatis "$@" >/dev/null
$(which vim) \
"$(which vim)" \
--noplugin \
-c "runtime ftplugin/man.vim" \
-c "Man $*" \
Expand All @@ -109,7 +109,7 @@ mang() {
if [ $# -eq 0 ]; then
/usr/bin/man
else
${GUIVIMBIN} \
"${GUIVIMBIN}" \
--noplugin \
-c "runtime ftplugin/man.vim" \
-c "Man $*" \
Expand Down
Loading

0 comments on commit b6ace17

Please sign in to comment.