Usage¶
- Install the dotfiles with bootstrap_dotfiles.sh
- Develop with the Makefile (Make)
- Shell with Bash (Bash, ZSH)
- Edit text files with Vim (Vim)
- Manage windows on Linux platforms with I3wm (I3wm)
- Script all the things
bootstrap_dotfiles.sh¶
bash scripts/bootstrap_dotfiles.sh -h
:
$ bash $_WRD/scripts/bootstrap_dotfiles.sh -h
bash: /scripts/bootstrap_dotfiles.sh: No such file or directory
Bash¶
make help_bash_rst
:
#### etc/bash/00-bashrc.before.sh
## 00-bashrc.before.sh -- bash dotfiles configuration root
# source ${__DOTFILES}/etc/bash/00-bashrc.before.sh -- dotfiles_reload()
#
# dotfiles_reload() -- (re)load the bash configuration
# $__DOTFILES (str): -- path to the dotfiles symlink (~/.dotfiles)
#
## 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:-"."}
#
## 02-bashrc.platform.sh -- platform things
# detect_platform() -- set $__IS_MAC or $__IS_LINUX
## 03-bashrc.darwin.sh
#
## 04-bashrc.TERM.sh -- set $TERM and $CLICOLOR
#
## 05-bashrc.dotfiles.sh -- dotfiles
# $__DOTFILES (str): -- path to the dotfiles symlink (~/.dotfiles)
# dotfiles_status() -- print dotfiles variables
# ds() -- print dotfiles variables
#
## 06-bashrc.completion.sh -- configure bash completion
#
# python: pip, virtualenv, virtualenvwrapper
# $PROJECT_HOME (str): path to project directory (~/wrk)
# $WORKON_HOME (str): path to virtualenvs directory (~/wrk/.ve)
# $VIRTUAL_ENV (str): path to current $VIRTUAL_ENV
#
## 07-bashrc.python.sh -- python
# _setup_pyenv() -- setup pyenv paths (manual)
# _setup_conda() -- setup conda paths (manual)
#
## 07-bashrc.virtualenvwrapper.sh -- virtualenvwrapper
# backup_virtualenv($VENVSTR) -- backup $WORKON_HOME/$VENVSTR -> ./-bkp/$VENVSTR
# backup_virtualenvs() -- backup $WORKON_HOME/* -> ./-bkp/*
# rebuild_virtualenv($VENVSTR) -- rebuild $WORKON_HOME/$VENVSTR
# rebuild_virtualenvs() -- rebuild $WORKON_HOME/*
# TODO: restore
#
## 08-bashrc.gcloud.sh -- gcloud: Google Cloud SDK
# _setup_google_cloud() -- setup google cloud paths
#
## 10-bashrc.venv.sh -- venv: virtualenvwrapper extensions
# $__PROJECTSRC (str): script to source (${PROJECT_HOME}/.projectsrc.sh)
# $VIRTUAL_ENV_NAME (str): basename of current $VIRTUAL_ENV
# $_APP (str): $VIRTUAL_ENV/src/${_APP}
# we() -- workon a new venv
# $1: VIRTUAL_ENV_NAME [$WORKON_HOME/${VIRTUAL_ENV_NAME}=$VIRTUAL_ENV]
# $2: _APP (optional; defaults to $VIRTUAL_ENV_NAME)
# we dotfiles
# we dotfiles etc/bash; cdw; ds; ls
#
#
## 11-bashrc.venv.pyramid.sh -- venv-pyramid: pyramid-specific config
#
## 20-bashrc.editor.sh -- $EDITOR configuration
# $_EDIT_ (str): cmdstring to open $@ (file list) in current editor
# $EDITOR_ (str): cmdstring to open $@ (file list) in current editor
#
## 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_
#
## 30-bashrc.usrlog.sh -- $_USRLOG configuration
# $_USRLOG (str): path to .usrlog command log
# stid -- set $TERM_ID to a random string
# stid $name -- set $TERM_ID to string
# note -- add a dated note to $_USRLOG [_usrlog_append]
# usrlogv -- open usrlog with vim: $VIMBIN + $_USRLOG
# usrlogg -- open usrlog with gmvim: $GUIVIMBIN + $_USRLOG
# usrloge -- open usrlog with editor:$EDITOR + $_USRLOG
# ut -- tail $_USRLOG
# ug -- egrep current usrlog: egrep $@ $_USRLOG
# ugall -- egrep $@ $__USRLOG ${WORKON_HOME}/*/.usrlog
# ugrin -- grin current usrlog: grin $@ $_USRLOG
# ugrinall -- grin $@ $__USRLOG ${WORKON_HOME}/*/.usrlog
# lsusrlogs -- ls -tr $__USRLOG ${WORKON_HOME}/*/.usrlog
#
## 30-bashrc.xlck.sh -- screensaver, (auto) lock, suspend
#
## 40-bashrc.aliases.sh -- aliases
## 42-bashrc.commands.sh -- example commands
#
## 50-bashrc.bashmarks.sh -- bashmarks: local bookmarks
#
## 70-bashrc.repos.sh -- repos: $__SRC repos, docs
#
## 99-bashrc.after.sh -- after: cleanup
# dr() -- dotfiles_reload
# ds() -- print dotfiles_status()
#### etc/bash/01-bashrc.lib.sh
### bashrc.lib.sh
## bash
# echo_args -- echo $@ (for checking quoting)
# function_exists() -- check whether a bash function exists
# add_to_path -- prepend a directory to $PATH
# instead of:
# export PATH=$dir:$PATH
# add_to_path $dir
# lightpath() -- display $PATH with newlines
# lspath() -- list files in each directory in $PATH
# lspath_less() -- lspath with less (color)
## file paths
# realpath() -- print absolute path (os.path.realpath) to $1
# note: OSX does not have readlink -f
# path() -- realpath()
# walkpath() -- walk down path $1 and $cmd each component
# $1: path (optional; default: pwd)
# $2: cmd (optional; default: 'ls -ald --color=auto')
# ensure_symlink() -- create or update a symlink to $2 from $1
# if $2 exists, backup with suffix $3
# ensure_mkdir() -- create directory $1 if it does not yet exist
#### etc/bash/02-bashrc.platform.sh
### bashrc.platform.sh
# detect_platform() -- set $__IS_MAC or $__IS_LINUX according to $(uname)
# j() -- jobs
# f() -- fg %$1
# b() -- bg %$1
# killjob() -- kill %$1
#### etc/bash/03-bashrc.darwin.sh
### bashrc.darwin.sh
# softwareupdate -- install OSX updates
# | Docs: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/softwareupdate.8.html
# softwareupdate -l # --list
# softwareupdate -i --all # --install --all
# softwareupdate -i -r # --install --recommended
# if __IS_MAC:
# finder() -- open Finder.app
# finder-killall() -- close all Finder.app instances
# finder-restart() -- close all and start Finder.app
# finder-show-hidden() -- show .hidden files in Finder.app
# finder-show-hidden() -- show .hidden files in Finder.app
#### etc/bash/04-bashrc.TERM.sh
### bashrc.TERM.sh
# configure_TERM -- configure the $TERM variable (man terminfo)
# $1: (optional; autodetects if -z)
# configure_TERM_CLICOLOR -- configure $CLICOLOR and $CLICOLOR_256
# CLICOLOR=1
# configure_TERM when sourced
#### etc/bash/05-bashrc.dotfiles.sh
### bashrc.dotfiles.sh
# dotfiles_add_path() -- add ${__DOTFILES}/scripts to $PATH
# dotfiles_status() -- print dotfiles_status
# ds() -- print dotfiles_status
# clr() -- clear scrollback
# osascript -e 'if application "Terminal" is frontmost then tell application "System Events" to keystroke "k" using command down'
# cls() -- clear scrollback and print dotfiles_status()
# echo "## lspath"
# lspath | tee $OUTPUT
# https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html#The-Shopt-Builtin
# debug-on() -- set -x -v
# debug-off() -- set +x +v
# log_dotfiles_state() -- save current environment to logfiles
# XXX:
# XXX:
# dotfiles_initialize() -- virtualenvwrapper initialize
# dotfiles_premkvirtualenv -- virtualenvwrapper premkvirtualenv
# dotfiles_postmkvirtualenv -- virtualenvwrapper postmkvirtualenv
# dotfiles_preactivate() -- virtualenvwrapper preactivate
# dotfiles_postactivate() -- virtualenvwrapper postactivate
# dotfiles_predeactivate() -- virtualenvwrapper predeactivate
# dotfiles_postdeactivate() -- virtualenvwrapper postdeactivate
#### etc/bash/06-bashrc.completion.sh
### bashrc.completion.sh
# _configure_bash_completion() -- configure bash completion
# note: `complete -p` lists completions
#### etc/bash/07-bashrc.python.sh
### bashrc.python.sh
# pypath() -- print python sys.path and site config
# _setup_python() -- configure $PYTHONSTARTUP
# _setup_pip() -- set $PIP_REQUIRE_VIRTUALENV=false
## Pyenv
# _setup_pyvenv() -- set $PYENV_ROOT, add_to_path, and pyenv venvw
## Conda / Anaconda
# _setup_anaconda() -- set $CONDA_ROOT, add_to_path
# workon_conda() -- workon a conda + venv project
# wec() -- workon a conda + venv project
# note: tab-completion only shows regular virtualenvs
# mkvirtualenv_conda() -- mkvirtualenv and conda create
# rmvirtualenv_conda() -- rmvirtualenv conda
# mkvirtualenv_conda_if_available() -- mkvirtualenv_conda OR mkvirtualenv
# workon_conda_if_available() -- workon_conda OR we OR workon
#### etc/bash/07-bashrc.virtualenvwrapper.sh
### bashrc.virtualenvwrapper.sh
# sudo apt-get install virtualenvwrapper || sudo pip install virtualenvwrapper
#
# _setup_virtualenvwrapper() -- configure $VIRTUALENVWRAPPER_*
# lsvirtualenvs() -- list virtualenvs in $WORKON_HOME
# lsve() -- list virtualenvs in $WORKON_HOME
# backup_virtualenv() -- backup VIRTUAL_ENV_NAME $1 to [$2]
# backup_virtualenvs() -- backup all virtualenvs in $WORKON_HOME to [$1]
# rebuild_virtualenv() -- rebuild a virtualenv, leaving pkgs in place
# $1="$VENVSTR"
# $2="$VIRTUAL_ENV"
# TODO: adjust paths beyond the shebang
# rebuild_virtualenv() -- rebuild a virtualenv
# $1="$VENVSTR"
# $2="$VIRTUAL_ENV"
# rebuild_virtualenvs() -- rebuild all virtualenvs in $WORKON_HOME
#### etc/bash/08-bashrc.gcloud.sh
### bashrc.gcloud.sh
# _setup_google_cloud() -- configure gcloud $PATH and bash completions
#### etc/bash/10-bashrc.venv.sh
### bashrc.venv.sh
# note: most of these aliases and functions are overwritten by `we`
## Variables
# __PROJECTSRC -- path to local project settings script
# __SRC -- path/symlink to local repository ($__SRC/hg $__SRC/git)
# PATH="~/.local/bin:$PATH" (if not already there)
# __VENV -- path to local venv config script (executable)
## Functions
# venv $@ -- call $_VENV $@
# venv -h -- print venv --help
# venv --print-bash -- print bash configuration
# venv --print-json -- print IPython configuration as JSON
# _venv <args> -- call $_VENV -E $@ (for the current environment)
# workon_venv() -- workon a virtualenv and load venv (TAB-completion)
# param $1: $VIRTUAL_ENV_NAME ("dotfiles")
# param $2: $_APP ("dotfiles") [default: $1)
# ${WORKON_HOME}/${VIRTUAL_ENV_NAME} # == $VIRTUAL_ENV
# ${VIRTUAL_ENV}/src # == $_SRC
# ${_SRC}/${VIRTUAL_ENV_NAME} # == $_WRD
# examples:
# we dotfiles
# we dotfiles dotfiles
# we() -- workon_venv
# CdAlias functions and completions
## Grin search
# virtualenv / virtualenvwrapper
# grinv() -- grin $VIRTUAL_ENV
# grindv() -- grind $VIRTUAL_ENV
# venv
# grins() -- grin $_SRC
# grinds() -- grind $_SRC
# grinw() -- grin $_WRD
# grindw() -- grind $_WRD
# edit_grin_w() -- edit $(grinw -l $@)
# egw -- edit $(grinw -l $@)
# ctags
# grindctags() -- generate ctags from grind (in ./tags)
# brew install ctags
# apt-get install exuberant-ctags
# grindctagssys() -- generate ctags from grind --sys-path ($_WRD/tags)
# grindctagsw() -- generate ctags from (cd $_WRD; grind) ($_WRD/tags)
# grindctagss() -- generate ctags from (cd $_SRC; grind) ($_SRC/tags)
# _setup_venv_aliases() -- load venv aliases
# note: these are overwritten by `we` [`source <(venv -b)`]
# ssv() -- supervisord -c ${_SVCFG}
# sv() -- supervisorctl -c ${_SVCFG}
# svd() -- supervisorctl -c ${_SVCFG} restart && sv tail -f dev
# svt() -- supervisorctl -c "${_SVCFG}" tail -f
# hgw() -- hg -R ${_WRD}
# hg-() -- hg -R ${_WRD}
# gitw() -- git -C ${_WRD}
# git-() -- git -C ${_WRD}
# serve-() -- ${_SERVE_}
# shell-() -- ${_SHELL_}
# test-() -- cd ${_WRD} && python setup.py test
# testr-() -- reset; cd ${_WRD} && python setup.py test
# makew() -- cd $_WRD && make $@
# make-() -- cd $_WRD && make $@
# mw() -- cd $_WRD && make $@
# venv_set_prompt() -- set PS1 with $WINDOW_TITLE, $VIRTUAL_ENV_NAME,
# and ${debian_chroot}
# "WINDOW_TITLE (venvprompt) [debian_chroot]"
# try: _APP, VIRTUAL_ENV_NAME, $(basename VIRTUAL_ENV)
# TODO: CONDA
# venv_ls() -- list virtualenv directories
# lsvenv() -- venv_ls()
# venv_mkdirs() -- create FSH paths in ${1} or ${VIRTUAL_ENV}
#### etc/bash/11-bashrc.venv.pyramid.sh
### bashrc.venv.pyramid.sh
# workon_pyramid_app() -- $VIRTUAL_ENV_NAME [$_APP] [open_terminals]
#### etc/bash/20-bashrc.editor.sh
### bashrc.editor.sh
# setup_editor() -- configure ${EDITOR}
# VIMBIN (str): /usr/bin/vim
# GVIMBIN (str): /usr/bin/gvim
# MVIMBIN (str): /usr/local/bin/mvim
# GUIVIMBIN (str): $GVIMBIN || $MVIMBIN || ""
# EDITOR (str): $VIMBIN -f || $GUIVIMBIN -f
# EDITOR_ (str): $EDITOR || $GUIVIMBIN $VIMCONF --remote-tab-silent
# VIMCONF (str): --servername ${VIRTUAL_ENV_NAME:-'EDITOR'}
# SUDO_EDITOR (str): $EDITOR
# _setup_pager() -- set PAGER='less'
# ggvim() -- ${EDITOR} $@ 2>&1 >/dev/null
# edits() -- open $@ in ${GUIVIMBIN} --servername $1
# e() -- ${EDITOR_} $@ [ --servername $VIRTUAL_ENV_NAME ]
# edit() -- ${EDITOR_} $@ [ --servername $VIRTUAL_ENV_NAME ]
# editw() -- ${EDITOR_} ${_WRD}/$arg (for arg in $@)
# ew() -- ${EDITOR_} ${_WRD}/$arg (for arg in $@) ('excellent')
# editcfg() -- ${EDITOR_} ${_CFG} [ --servername $VIRTUAL_ENV_NAME ]
# sudoe() -- EDITOR=${SUDO_EDITOR} sudo -e
# sudoe() -- EDITOR=${SUDO_EDITOR} sudo -e
#### etc/bash/29-bashrc.vimpagers.sh
### bashrc.vimpagers.sh
# _configure_lesspipe() -- (less <file.zip> | lessv)
# vimpager() -- call vimpager
# lessv() -- less with less.vim and vim (g:tinyvim=1)
# lessg() -- less with less.vim and gvim / mvim
# lesse() -- less with current venv's vim server
# manv() -- view manpages in vim
# mang() -- view manpages in gvim / mvim
# mane() -- open manpage with venv's vim server
#### etc/bash/30-bashrc.usrlog.sh
### bashrc.usrlog.sh
# _USRLOG (str): path to .usrlog userspace shell command log
# stid() -- set $TERM_ID to a random string
# stid $name -- set $TERM_ID to string
# note() -- add a dated note to $_USRLOG [_usrlog_append]
# usrlogv() -- open usrlog with vim: $VIMBIN + $_USRLOG
# usrlogg() -- open usrlog with gmvim: $GUIVIMBIN + $_USRLOG
# usrloge() -- open usrlog with editor:$EDITOR + $_USRLOG
# ut() -- tail $_USRLOG
# ug() -- egrep current usrlog: egrep $@ $_USRLOG
# ugall() -- egrep $@ $__USRLOG ${WORKON_HOME}/*/.usrlog
# ugrin() -- grin current usrlog: grin $@ $_USRLOG
# ugrinall() -- grin $@ $__USRLOG ${WORKON_HOME}/*/.usrlog
# lsusrlogs() -- ls -tr $__USRLOG ${WORKON_HOME}/*/.usrlog
# _setup_usrlog() -- source ${__DOTFILES}/etc/usrlog.sh
# usrlogv() -- open $_USRLOG w/ $VIMBIN (and skip to end)
# usrlogg() -- open $_USRLOG w/ $GUIVIMBIN (and skip to end)
# usrloge() -- open $_USRLOG w/ $EDITOR_ [ --servername $VIRTUAL_ENV_NAME ]
#### etc/bash/30-bashrc.xlck.sh
### 30-bashrc.xlck.sh
## xlck -- minimal X screensaver
# xlck
# xlck -I -- (I)nstall xlck (apt-get)
# xlck -U -- check stat(U)s (show xautolock processes on this $DISPLAY)
# xlck -S -- (S)tart xlck (start xautolock on this $DISPLAY)
# xlck -P -- sto(P) xlck (stop xautolock on this $DISPLAY)
# xlck -R -- (R)estart xlck
# xlck -M -- suspend to ra(M) (and lock)
# xlck -D -- suspend to (D)isk (and lock)
# xlck -L -- (L)ock
# xlck -X -- shutdown -h now
# xlck -h -- help
# xlck_status_all() -- pgrep 'xautolock|xlock|i3lock', ps ufw
# xlck_status_this_display() -- show status for this $DISPLAY
# _setup_xlck() -- source ${__DOTFILES}/etc/xlck.sh (if -z __IS_MAC)
#### etc/bash/40-bashrc.aliases.sh
### bashrc.aliases.sh
# _load_aliases() -- load aliases
# chmodr -- 'chmod -R'
# chownr -- 'chown -R'
# grep -- 'grep --color=auto'
# egrep -- 'egrep --color=auto'
# fgrep -- 'fgrep --color=auto'
# grindp -- 'grind --sys.path'
# grinp -- 'grin --sys-path'
# fumnt -- 'fusermount -u'
# ga -- 'git add'
# gac() -- 'git diff ${files}; git commit -m $1 ${files}'
# $1 (str): quoted commit message
# $2- (list): file paths
# gb -- 'git branch -v'
# gd -- 'git diff'
# gds -- 'git diff -p --stat'
# gc -- 'git commit'
# gco -- 'git checkout'
# gdc -- 'git diff --cached'
# gl -- 'git log --pretty=format:"%h : %an : %s" --topo-order --graph'
# gr -- 'git remote -v'
# gs -- 'git status'
# gsi -- 'git is; git diff; git diff --cached'
# gsiw -- 'git -C $_WRD gsi'
# gsl -- 'git stash list'
# gsn -- 'git stash save'
# gss -- 'git stash save'
# gitr -- 'git remote -v'
# hga -- 'hg add'
# hgac() -- 'hg add $@[1:]; hg commit $1'
# $1 (str): quoted commit message
# $2- (list): file paths
# hgl -- 'hg glog --pager=yes'
# hgs -- 'hg status'
# hgd -- 'hg diff'
# hgds -- 'hg diff --stat'
# hgdl -- 'hg diff --color=always | less -R'
# hgc -- 'hg commit'
# hgu -- 'hg update'
# hgq -- 'hg qseries'
# hgqd -- 'hg qdiff'
# hgqs -- 'hg qseries'
# hgqn -- 'hg qnew'
# hgr -- 'hg paths'
# __IS_MAC
# la -- 'ls -A -G'
# ll -- 'ls -alF -G'
# ls -- 'ls -G'
# lt -- 'ls -altr -G'
# lll -- 'ls -altr -G'
# else
# la -- 'ls -A --color=auto'
# ll -- 'ls -alF --color=auto'
# ls -- 'ls --color=auto'
# lt -- 'ls -altr --color=auto'
# lll -- 'ls -altr --color=auto'
# __IS_LINUX
# psx -- 'ps uxaw'
# psf -- 'ps uxawf'
# psxs -- 'ps uxawf --sort=tty,ppid,pid'
# psxh -- 'ps uxawf --sort=tty,ppid,pid | head'
# psh -- 'ps uxaw | head'
# psc -- 'ps uxaw --sort=-pcpu'
# psch -- 'ps uxaw --sort=-pcpu | head'
# psm -- 'ps uxaw --sort=-pmem'
# psmh -- 'ps uxaw --sort=-pmem | head'
# __IS_MAC
# psx -- 'ps uxaw'
# psf -- 'ps uxaw' # no -f
# psh -- 'ps uxaw | head'
# psc -- 'ps uxaw -c'
# psch -- 'ps uxaw -c | head'
# psm -- 'ps uxaw -m'
# psmh -- 'ps uxaw -m | head'
# shtop -- 'sudo htop'
# t -- 'tail'
# tf -- 'tail -f'
# xclipc -- 'xclip -selection c'
#### etc/bash/42-bashrc.commands.sh
### bashrc.commands.sh
# usage: bash -c 'source bashrc.commands.sh; funcname <args>'
# chown-me() -- chown -Rv user
# chown-me-mine() -- chown -Rv user:user && chmod -Rv go-rwx
# chown-sme() -- sudo chown -Rv user
# chown-sme-mine() -- sudo chown -Rv user:user && chmod -Rv go-rwx
# chmod-unumask() -- recursively add other+r (files) and other+rx (dirs)
# new-sh() -- create and open a new shell script at $1
# diff-dirs() -- list differences between directories
# diff-stdin() -- diff the output of two commands
# wopen() -- open path/URI/URL $1 in a new browser tab
# see: scripts/x-www-browser
# find-largefiles() -- find files larger than size (default: +10M)
# find-pdf() -- find pdfs and print info with pdfinfo
# find-lately() -- list and sort files in paths $@ by ISO8601 mtime
# stderr > lately.$(date).errors
# stdout > lately.$(date).files
# stdout > lately.$(date).sorted
# note:
# find-setuid() -- find all setuid and setgid files
# stderr > find-setuid.errors
# stdout > find-setuid.files
# find-startup() -- find common startup files in common locations
# find-ssl() -- find .pem and .db files and print their metadata
# find-dpkgfile() -- search dpkgs with apt-file
# find-dpkgfiles() -- sort dpkg /var/lib/dpkg/info/<name>.list
# deb-chksums() -- check dpkg md5 checksums with md5sums
# deb-mkrepo() -- create dpkg Packages.gz and Sources.gz from dir ${1}
# mnt-chroot-bind() -- bind mount linux chroot directories
# mnt-cifs() -- mount a CIFS mount
# mnt-davfs() -- mount a WebDAV mount
# lsof-sh() -- something like lsof
# lsof-net() -- lsof the network things
# net-stat() -- print networking information
# ssh-prx() -- SSH SOCKS
# strace-() -- strace with helpful options
# strace-f() -- strace -e trace=file + helpful options
# strace-f-noeno() -- strace -e trace=file | grep -v ENOENT
# hgst() -- hg diff --stat, hg status, hg diff
#### etc/bash/50-bashrc.bashmarks.sh
### bashrc.bashmarks.sh
## bashmarks
# l() -- list bashmarks
# s() -- save bashmarks as $1
# g() -- goto bashmark $1
# p() -- print bashmark $1
# d() -- delete bashmark $1
# lsbashmarks() -- list Bashmarks (e.g. for NERDTree)
# see also: ${__DOTFILES}/scripts/nerdtree_to_bashmarks.py
#### etc/bash/70-bashrc.repos.sh
### 70-bashrc.repos.sh
#
#
#
# Use Cases
# * Original: a bunch of commands that i was running frequently
# before readthedocs (and hostthedocs)
# * local mirrors (manual, daily?)
# * no internet, outages
# * push -f
# * (~offline) Puppet/Salt source installs
# * bandwidth: testing a recipe that pulls a whole repositor(ies)
# * what's changed in <project>'s source dependencies, since i looked last
#
# Justification
# * very real risks for all development projects
# * we just assume that GitHub etc. are immutable and forever
#
# Features (TODO) [see: pyrpo]
# * Hg <subcommands>
# * Git <subcommands>
# * Bzr <subcommands>
# * periodic backups / mirroring
# * gitweb / hgweb
# * mirror_and_backup <URL>
# * all changes since <date> for <set_of_hg-git-bzr-svn_repositories>
# * ideally: transparent proxy
# * +1: easiest
# * -1: pushing upstream
#
# Caveats
# * pasting / referencing links which are local paths
# * synchronization lag
# * duplication: $__SRC/hg/<pkg> AND $VIRTUAL_ENV/src/<pkg>
#
# setup_dotfiles_docs_venv -- create default 'docs' venv
# setup_dotfiles_src_venv -- create default 'src' venv
#
# __SRC_HG=${WORKON_HOME}/src/src/hg
# __SRC_GIT=${WORKON_HOME}/src/src/git
#
# Hg runs hg commands as user hg
# Git runs git commands as user git
#
# Hgclone will mirror to $__SRC_HG
# Gitclone will mirror to $__SRC_GIT
#
#
# __SRC_GIT_REMOTE_URI_PREFIX -- default git remote uri prefix
# __SRC_GIT_REMOTE_NAME -- name for git remote v
# __SRC_HG_REMOTE_URI_PREFIX -- default hg remote uri prefix
# __SRC_HG_REMOTE_NAME -- name for hg paths
## Create a new hosted repository with gitolite-admin
# $1 -- repo [user/]name (e.g. westurner/dotfiles)
## push a git repository to local git storage
# $1 -- repo [user/]name (e.g. westurner/dotfiles)
# $2 -- path of local repo (e.g. ~/wrk/.ve/dotfiles/src/dotfiles)
## Create a new hosted repository with mercurial-ssh
## push a hg repository to local git storage
# $1 -- repo [user/]name (e.g. westurner/dotfiles)
# $2 -- path of local repo (e.g. ~/wrk/.ve/dotfiles/src/dotfiles)
# fixperms ${path}
# host_docs -- build and host documentation in a local directory
# param $1: <project_name>
# param $2: [<path>]
# param $3: [<docs/Makefile>]
# param $4: [<docs/conf.py>]
# * log documentation builds
# * build a sphinx documentation set with a Makefile and a conf.py
# * rsync to docs webserver
# * set permissions
# this is not readthedocs.org
# note: you must manually install packages into the
# local 'docs' virtualenv'
# TODO: prompt?
# >> 'html_theme = "_-_"
# << 'html_theme = 'default'
#### etc/bash/99-bashrc.after.sh
#### etc/bash/usrlog.sh
## usrlog.sh -- Shell CLI REPL command logs in userspace (per $VIRTUAL_ENV)
#
# __USRLOG (str): default -usrlog.log file (~/-usrlog.log)
# _USRLOG (str): current -usrlog.log file to append REPL command strings to
# _TERM_ID (str): a terminal identifier with which command loglines will
# be appended (default: _usrlog_randstr)
#
# _usrlog_get_prefix() -- get a dirpath for the current usrlog
# (VIRTUAL_ENV or HOME)
# _usrlog_set__USRLOG() -- set $_USRLOG (and $__USRLOG)
# _usrlog_set_HISTFILE() -- configure shell history
# history -a -- append any un-flushed lines to $HISTFILE
# history -c && history -r $HISTFILE -- clear; reload $HISTFILE
# _usrlog_set_HIST() -- set shell $HIST<...> variables
# see HISTSIZE and HISTFILESIZE in bash(1)
# note that HOSTNAME and USER come from the environ
# and MUST be evaluated at the time HISTTIMEFORMAT is set.
# ... or force ignoredups and ignorespace
# HISTCONTROL=ignoredups:ignorespace
# append current lines to history
# append to the history file, don't overwrite it
# https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html#The-Shopt-Builtin
# replace newlines with semicolons
# enable autocd (if available)
# _usrlog_randstr -- Generate a random string
# $1: number of characters
# _usrlog_get__TERM_ID() -- echo the current _TERM_ID and $_USRLOG
# _usrlog_Set__TERM_ID -- set or randomize the $_TERM_ID key
# $1: terminal name
# _usrlog_echo_title -- set window title
# _usrlog_set_title() -- set xterm title
# _usrlog_setup() -- configure usrlog for the current shell
# setup bash
# setup zsh
# _usrlog_append() -- Write a line to $_USRLOG w/ an ISO8601 timestamp
# $1: text (command) to log
# note: _TERM_ID must not contain a tab character (tr '\t' ' ')
# note: _TERM_ID can be a URN, URL, URL, or simple \w+ str key
# example:
# 2014-11-15T06:42:00-0600 dotfiles 8311 ls
# (pwd -p)?
# this from HISTORY
# _usrlog_append_oldstype -- Write a line to $_USRLOG
# $1: text (command) to log
# examples:
# # qMZwZSGvJv8: 10/28/14 17:25.54 ::: 522 histgrep BUG
# #ZbH08n8unY8 2014-11-11T12:27:22-0600 2238 ls
# _usrlog_writecmd() -- write the most recent command to $_USRLOG
# _usrlog_parse_newstyle -- Parse a newstyle HISTTIMEFORMAT usrlog
# with pyline
# TODO: handle HISTTIMEFORMAT="" (" histn <cmd>")
# TODO: handle newlines
# _usrlog_parse_cmds -- Show histcmd or histstr from HISTTIMEFORMAT usrlog
# with pyline
# TODO: handle HISTTIMEFORMAT="" (" histn <cmd>")
# TODO: handle newlines (commands that start on the next line)
# TODO: HISTTIMEFORMAT histn (OSX ) [ 8 ]
# TODO: HISTTIMEFORMAT histn (Linux) [ 7 ]
## usrlog.sh API
# ut() -- show recent commands
# termid() -- echo $_TERM_ID
# set_term_id() -- set $_TERM_ID to a randomstr or $1
# stid() -- set $_TERM_ID to a randomstr or $1
# st() -- set $_TERM_ID to a randomstr or $1
## Old (hist, histgrep, histgrep_session)
# less() -- less the current session log
# histgrep() -- egrep $@ $_USRLOG
# histgrep_session() -- grep for specific sessions
# $1: session name
# $2: don't strip the line prefix
## New (u*, usrlog*)
# usrlog_tail() -- tail -n20 $_USRLOG
# usrlogtf() -- tail -f -n20 $_USRLOG
# utf() -- tail -f -n20 $_USRLOG
# usrlog_grep() -- egrep -n $_USRLOG
# ug() -- egrep -n $_USRLOG
# usrlog_grin() -- grin -s $@ $_USRLOG
# ugrin() -- grin -s $@ $_USRLOG
# lsusrlogs() -- ls $__USRLOG ${WORKON_HOME}/*/.usrlog
# usrlog_lately() -- lsusrlogs by mtime
# ull() -- usrlog_lately() (lsusrlogs by mtime)
# usrlog_grep_all() -- grep usrlogs (drop filenames with -h)
# ugall() -- grep usrlogs (drop filenames with -h)
# usrlog_grin_all() -- grin usrlogs
# usrlog_grin_all() -- grin usrlogs
# note() -- _usrlog_append "#note #note: $@"
# todo() -- _usrlog_append "#note #TODO: $@"
# usrlog_screenrec_ffmpeg() -- record a screencast
# $1: destination directory (use /tmp if possible)
# $2: video name to append to datestamp
# Press "q" to stop recording
# _setup_usrlog() -- call _usrlog_setup $@
## calls _usrlog_setup when sourced
#### etc/bash/xlck.sh
## xlck.sh
## bash script for working with xautolock, xlock, and/or i3lock
## as well as issuing suspend, shutdown, and restart commands
## Requirements:
#
# sudo apt-get install xautolock xlockmore i3lock
# xlck() -- xlck $@
# _xlck_install() -- install xlck dependencies
# bash, pgrep, ps, kill, xautolock, xlock, i3lock, xset
# _xlck_setup_dpms() -- configure display with xset and dpms
# _xlck_setup() -- setup xlck (export _XLCK=(this) && _xlck_setup_dpms)
# _xlck_xlck() -- start xlock (white on black w/ a 3 second delay)
# _xlck_i3lock() -- start i3lock with a dark gray background
# xlock_lock() -- lock the current display
# note: this will be run before suspend to RAM and Disk.
# _suspend_to_ram() -- echo mem > /sys/power/state
# _suspend_to_disk() -- echo disk > /sys/power/state
# note: this does not work on many machines
# _dbus_halt() -- send a dbus stop msg to ConsoleKit
# _dbus_reboot() -- send a dbus reboot msg to ConsoleKit
# _dbus_suspend() -- send a dbus suspend msg to ConsoleKit
# _dbus_hibernate() -- send a dbus hibernate msg to ConsoleKit
# xlck_lock_suspend_ram() -- lock and suspend to RAM
# xlck_lock_suspend_disk() -- lock and suspend to disk
# xlck_suspend_ram() -- lock and suspend to RAM
# xlck_suspend_disk() -- lock and suspend to disk
# xlck_start() -- start xlck
# xlck_stop() -- stop xlck
# xlck_restart() -- stop and start xlck
# xlck_xautolock_pgrep_display()-- find xautolock on this display
# xlck_xautolock_status() -- show xlck status
# xlck_autolock_stop() -- stop autolock on the current $DISPLAY
# xlck_status() -- xlck_xautolock_status
# xlck_status_all() -- pgrep 'xautolock|xlock|i3lock', ps ufw
# xlck_status_this_display() -- show status for this $DISPLAY
# _xlck_xautolock() -- start xautolock (see: xlck_start)
Vim¶
make help_vim_rst
:
# etc/vim/vimrc
" .vimrc
" ==========
" ::
" git clone https://github.com/westurner/dotvim
" git clone ssh://git@github.com/westurner/dotvim
" make help
"
" Vim Reference
" ---------------
" % -- current filename
" %:p -- current filepath
" $VIMRUNTIME -- /{colors,syntax,macros}
" ListMappings -- list commented mappings
" :map -- list actual mappings
" :scriptnames -- list scripts and plugins
" :set -- list all nondefault options
" e <path> -- open file
" e <pa...><tab> -- open file with wildmenu completion
" \e [...] <enter> -- open file
" :tabnew <path> -- open file
" :read filename| -- insert filename at cursor
" :read !cmd -- insert cmd output at cursor
" :%! [cmd] -- buffer > stdin > [cmd] > stdout => buffer.replace
"
" [n]G -- goto line #
" g <C-g> -- whereami
" u -- undo
" ^r -- redo
" :%s:\(.*\):+\1:g -- Regex
"
" Modes
" i -- insert
" I -- insert at beginning of line
" a -- append
" A -- append at end of line
" v -- visual
" c-v -- visual block
" ;; -- command
" <Esc> -- command
"
" Vim Marks
" m[a-z]{1} -- set mark
" `[a-z]{1} -- goto mark
" '[a-z]{1} -- goto mark
"
" Macros
" q[a-z]{1} -- start recording
" q -- stop recording
" @[a-z]{1} -- replay macro
" @@ -- repeat macro
" q2<seq><esc>q;@2 -- record macro to 2 and repeat
"
" Searching
" /<pattern> -- search for term
" * -- search for term under cursor next
" n -- next search ocurrence
" # -- search for term under cursor previous
" N -- previous search ocurrence
"
" :[l][vim]grep <pattern> <file>
"
" :cl :ll -- list list
" :copen :lopen -- open list
" :cw :lw -- toggle show list
" :ccl[ose] :lcl -- close list
" :cn :ln -- next <Enter>
" :cp :lp -- prev <Enter>
" :cc! :lc [nr] -- jump to [nr]
" :cfir :cla -- first, last
"
" Yanking and Pasting
" y[a-z] -- yank to buffer [a-z]
" p[a-z] -- paste from buffer [a-z]
" ]p -- paste to level
"
" Indenting/Shifting Blocks
" [n]< -- shift block left
" [n]> -- shift block right
"
"
" Folding
" :help Fold -- also usr_28
" :set nofen -- stop folding
" zf -- create fold
" zo -- fold open
" zO -- fold open recursive
" zc -- fold close
" zC -- fold close recursive
" zx -- undo manual fold actions
" zX -- undo manual fold actions and recompute
" zM -- fold close all but current (focus)
" zR -- fold open all (review)
"
" :Voom [format] -- open VOom outline sidebar
" <leader> t -- :TagBarToggle " outline sidebar
"
" Etiquette
" <leader> i -- toggle unprintables
" <leader> sd -- toggle highlight EOL whitespace
" <leader> sc -- clear highlighting
"
" set window title to vim title (display full path)
" print the document path
"
" :ListMappings -- list .vimrc mapping comments (n(next) and p(rev))
" <space> -- <leader>
" , -- <leader> == <comma>
" ;; -- <esc> == double semicolon
" jk -- <esc>
" 98 -- <esc> == 98
" :; -- <esc> == colon semicolon
" :; -- <esc> == colon semicolon
" Quickfix
" <leader> q -- toggle quicklist
" <leader> n -- next quicklist item
" <leader> l -- toggle location list
" Workaround vim lp:#572863
" Code Folding
" UTF-8
" TODO XXX
" Code Indenting
" Searching
" set colorcolumn=0 -- clear color column
" Turn Off Visual Bell
" WildMenu
" Spell Checking
" <leader> sp -- toggle spellcheck
" shift-<enter> -- insert new line w/o changing mode
" no error bells
" Jump to last position
" remove trailing whitespace
" filetype extensions
" if &previewwindow
" exec 'setlocal winheight='.&previewheight
" endif
" Auto completion
" CTRL-<space> -- autocomplete menu
" CTRL-<tab> -- autocomplete menu
" close vim if the only window left open is a NERDTree
" Open NERDTree automatically if no files were specified
" Drag and Drop
" :help drag-n-drop
" shift-<drop> -- cd to file's directory
" ctrl-<drop> -- split new window for file
" <drop> -- open file or paste path at cursor
" Fonts
" :PatchFont -- set the font
" GUI Menubar
" :HideMenubar -- hide GUI menubar
" :ShowMenubar -- show GUI menubar
" :Set256 -- set 256 colors (for console vim)
" :Set88 -- set 88 colors (for console vim)
" GUI
" Remove gui scrollbars
" ctrl-z -- undo
" alt-z -- undo
" ctrl-r -- redo
" alt-r -- redo
" ctrl-X -- cut
" alt-x -- cut
" ctrl-c -- copy
" alt-c -- copy
" always call Set256.
" if this causes problems with older terminals
" :Set88
" autocmd! Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/
" <leader> sd -- match EOL whitespace
" <leader> sc -- clear search highlighting
" ctrl-q -- close
" <leader> i -- toggle show invisibles
" ,cd -- :cd %:p:h
" T -- wrap paragram
" Keep search matches in the middle of the window.
" <leader> [ -- toggle cursorline and cursorcolumn
" <leader> hm -- set horizontal line mark
" <leader> hv -- set vertical column mark
" <leader> c -- clear virt marks
" Tab -- Indent Line
" map <Tab> >gb
" Shift-Tab -- Dedent Line
" ctrl-t -- Indent Current Line
" ctrl-d -- Dedent Current Line
" > -- Visual Indent Block
" < -- visual dedent block
" Alternative using Tab/Shift-Tab (for gvim).
" tab -- shift right
" Shift-tab -- shift left
" vnoremap <Tab> >gv
" ctrl-f -- find
" ctrl-alt-A -- copy all
" Paste
" shift-insert -- paste
" ctrl-S -- Save
" ctrl-Alt-W -- Close
" ctrl-Home -- Goto line one
" ctrl-End -- Goto line :-1
" PgUp/PgDn
" K -- PageUp
" J -- PageDown
" Pgup/Down are actually 2*<c-U>
" Buffer Nav
" ctrl-a -- move to beginning of line (^)
" ctrl-e -- move to end of line ($)
" Window Nav (window-move-cursor)
" ctrl-j -- cursor window down
" ctrl-u -- cursor window down
" ctrl-k -- cursor window up
" ctrl-i -- cursor window up
" ctrl-l -- cursor window right
" ctrl-h -- cursor window left
" Window Resize (window-resize)
" ctrl-w _ -- maximize window height
" ctrw-w 1_ -- minimize window height
" ctrl-w | -- maximize window width
" ctrl-w 1| -- minimize window width
" ctrl-w = -- equalize window sizes
" [n]ctrl-w > -- expand width
" [n]ctrl-w < -- contract width
" [n]ctrl-w + -- increase height
" [n]ctrl-w - -- reduce height
" ctrl-w o -- minimze all other windows
" Window Movement (window-move)
" Window Up
" <leader> wk -- move window up
" ctrl-wi -- move window up
" <leader> wi -- move window up
" Window Right
" <leader> wl -- move window right
" Window Down
" <leader> wj -- move window down
" ctrl-wu -- move window down
" <leader> wu -- move window down
" Window Left
" <leader> wj -- move window left
" Window Rotate
" ctrl-w R -- rotate window up
" ctrl-w r -- rotate window down
" Tab Movement (tab-page-commands)
" ctrl-Alt-h -- previous tab
" Alt-u -- previous tab
" ctrl-Alt-l -- next tab
" Alt-i -- next tab
" Man.vim -- view manpages in vim
" :Man man -- view manpage for 'man'
" <leader> o -- Open uri under cursor
" :Ack <term> <path>
" <leader>a -- Ack
" Grin -- Find in Python
" Ctags
" ctrl-[ -- go to tag under cursor
" ctrl-T -- go back #TODO
" sh: ctags -R -f ~/.vim/tags/python-$PYVER.ctags $PYLIBDIR
" Use :make to see syntax errors. (:cn and :cp to move around, :dist to see
" all errors)
" Colors
" :PatchColors -- load local colorizing postsets
" call PatchColors() -- call PatchColors when sourced
" List highlight colors
" Python
" Wrap at 72 chars for comments.
" read virtualenv's site-packages to vim path
" TODO: python regex current buffer
" Tabsetting functions
" :Fourtabs -- set to four (4) soft tabs (Default)
" Default to fourtabs
" :Threetabs -- set to three (3) soft tabs
" :Twotabs -- set to two (2) soft tabs
" :Onetab -- set to one (1) soft tab
" :Hardtabs -- set to hard \t tabs (e.g. for Makefiles)
" :CurrentBuffer -- display number of current buffer
" diff -- vimdiff, Hgvdiff, Gdiff
" :diffget -- get from diff (overwrite or append)
" do -- :diffget other block
" :diffput -- put from diff (overwrite or append)
" dp -- :diffput block
"
" <C-W><C-w> -- cycle between buffers
"
" diffget maps -- 3-way merge buffers
" <leader> 2 -- diffget from bufnr 2
" <leader> 3 -- diffget from bufnr 3
" <leader> 4 -- diffget from bufnr 4
" :Striptrailingwhitespace -- strip spaces at the end of lines
" Adjust font-size
" <C-Up> -- increase font size
" <C-Down> -- decrease font size
" <F3> -- insert ReST date heading
" Trac
" References
"
" - https://dev.launchpad.net/UltimateVimPythonSetup
" - https://github.com/kennethreitz/dotfiles/blob/master/.vimrc
" - https://bitbucket.org/sjl/dotfiles/src/tip/vim/.vimrc#cl-716
" - http://vim.wikia.com/wiki/Highlight_unwanted_spaces
" - http://stackoverflow.com/questions/1551231
" - http://superuser.com/questions/117969/is-there-a-way-to-move-a-split-page-to-a-new-tab-in-vim
" - http://sontek.net/turning-vim-into-a-modern-python-ide
" - http://vim.wikia.com/wiki/VimTip320
# etc/vim/vimrc.full.bundles.vimrc
" Bundle -- Vim bundle manager [help bundle]
" :BundleList - list configured plugins
" :BundleInstall(!) - install (update) plugins
" :BundleSearch(!) foo - search (or refresh cache first) for foo
" :BundleClean(!) - confirm (or auto-approve) removal of unused plugins
"
" The Bundle URLs are intentionally complete https URLs
" * grep '^Bundle \'' vimrc.bundles
" * sed -i 's\https://github.com/\ssh://git@github.com/\g'
" venv.vim -- venv CdAlias commands
" :Cdhome -- Cd_HOME()
" :Cdh -- Cd_HOME()
" :Cdwrk -- Cd___WRK()
" :Cddotfiles -- Cd___DOTFILES()
" :Cdd -- Cd___DOTFILES()
" :Cdprojecthome -- Cd_PROJECT_HOME()
" :Cdp -- Cd_PROJECT_HOME()
" :Cdph -- Cd_PROJECT_HOME()
" :Cdworkonhome -- Cd_WORKON_HOME()
" :Cdwh -- Cd_WORKON_HOME()
" :Cdve -- Cd_WORKON_HOME()
" :Cdcondahome -- Cd_CONDA_HOME()
" :Cda -- Cd_CONDA_HOME()
" :Cdce -- Cd_CONDA_HOME()
" :Cdvirtualenv -- Cd_VIRTUAL_ENV()
" :Cdv -- Cd_VIRTUAL_ENV()
" :Cdsrc -- Cd__SRC()
" :Cds -- Cd__SRC()
" :Cdwrd -- Cd__WRD()
" :Cdw -- Cd__WRD()
" :Cdbin -- Cd__BIN()
" :Cdb -- Cd__BIN()
" :Cdetc -- Cd__ETC()
" :Cde -- Cd__ETC()
" :Cdlib -- Cd__LIB()
" :Cdl -- Cd__LIB()
" :Cdlog -- Cd__LOG()
" :Cdpylib -- Cd__PYLIB()
" :Cdpysite -- Cd__PYSITE()
" :Cdsitepackages -- Cd__PYSITE()
" :Cdvar -- Cd__VAR()
" :Cdwww -- Cd__WWW()
" :Cdww -- Cd__WWW()
" Info.vim -- vim infopages in vim [help info]
" :Info sed -- view infopage for 'sed'
" <Space> -- Scroll forward (page down).
" <Backspace> -- Scroll backward (page up).
" <Tab> -- Move cursor to next hyperlink within this node.
" <Enter>,<C-]> -- Follow hyperlink under cursor.
" ;,<C-T> -- Return to last seen node.
" .,> -- Move to the "next" node of this node.
" p,< -- Move to the "previous" node of this node.
" u -- Move "up" from this node.
" d -- Move to "directory" node.
" t -- Move to the Top node.
" <C-S> -- Search forward within current node only.
" s -- Search forward through all nodes for a specified
" string.
" q -- Quit browser.
"
" Signify -- show git/hg file changes in gutter [help signify]
" <leader>gt -- SignifyToggle
" <leader>gh -- SignifyToggleHighlight
" <leader>gr -- SignifyRefresh
" <leader>gd -- SignifyDebug
" hunk jumping
" <leader>gh -- signify-next-hunk
" <leader>gk -- signify-prev-hunk
" hunk text object
" ic -- signify inner textobj
" ac -- signify outer textobj
" Fugitive -- Git commands and statusline display [help fugitive]
" Lawrencium -- Hg commands [help lawrencium]
" NERDTree -- File browser [help NERDTree]
" <Leader>e -- toggle NERDTree
" ctrl-e -- toggle NERDTree
" <Leader>E -- open nerdtree to current file (:NERDTreeFind %:p:h)
" ctrl-E -- open nerdtree to current file (:NERDTreeFind %:p:h)
" I -- toggle view hidden files
" B -- toggle view bookmarks
" cd -- set vim CWD to selected dir
" C -- refocus view to selected dir
" o -- open
" r -- refresh dir
" R -- refresh root
" t -- open in new tab
" T -- open in new tab silently
" u -- up a dir
" U -- up a dir and leave open
" x -- close node
" X -- close all nodes recursive
" ? -- toggle help
" FindInNERDTree -- NERDTRee show current file [help NERDTreeFind]
" <c-b> -- toggle BufExplorer
" ? -- toggle BufExplorer help
" <leader>b -- toggle BufExplorer
" CtrlP -- file/buffer/mru finder [help ctrlp]
" <C-p> -- CtrlP (fuzzy matching)
" Syntastic -- syntax highlighting [help syntastic]
" NERDCommenter -- commenting [help NERDCommenter]
" ,cm -- minimal comment
" ,cs -- sexy comment
" ,c<space> -- toggle comment
" UltiSnips -- syntax-specific snippets [help ultisnips]
" snippetname<C-CR> -- insert snippet
" <tab> -- next placeholder
" <tab> -- prev placeholder
" ~/.vim/snippets-ulti/python:
" climain -- new cli script
" setuppy -- new setup.py script
" NeoComplCache -- code completion [help neocomplcache]
" unstack.vim -- parse and open stacktrace paths [help unstack]
" <leader> s -- parse part/all of a stacktrace
" accordion.vim -- work w/ a number of vsplits at once [help accordion]
" ViM Airline -- helpful statusbar information w/ vimscript [help airline]
" base16, wombat, luna
" base16, wombat, luna
" EasyMotion -- easy visual motions [help easymotion]
" <Leader>m-w/e -- search forward (beg/end of word)
" <Leader>m-b -- search backward
" <Leader>m-j -- search line down
" <Leader>m-k -- search line up
" Jellybeans -- a good colorscheme w/ sensible diff highlighting
" :colorscheme jellybeans -- switch to the jellybeans colorscheme
" Vim-misc -- functions for colorscheme-switcher and vim-session
" Vim Colorscheme Switcher [help colorscheme-switcher]
" <F8> -- cycle colors forward
" <Shift><F8> -- cycle colors reverse
" HiColors
" call HiTest() -- print highlighting colors
" Pasting -- make paste work normally [help paste]
" Vim Room -- focus just the relevant text [help vimroom]
" VOoM Outline Viewer -- view outlines of code and text [help voom]
" VOoM modes: html, markdown, python, rest,
" thevimoutliner, txt2tags,
" viki, vimwiki, wiki
" :Voom [<format>] -- open Voom outline tab
" :Voom rest -- open ReStructuredText outline
" ggg?G
" <leader> V -- toggle Voom outline sidebar
" TagBar -- source tag browser [help tagbar]
" <leader> t -- toggle TagBar outline sidebar"
" Vim Session -- save and restore sessions between exits [help session]
" :SaveSession <name> -- save a session
" :OpenSession <name> -- open a saved session
" :Restart -- SaveSession restart && exit
" :OpenSession restart -- open the 'restart' saved session
" Vim Unimpaired -- moving between buffers [help unimpaired]
" [a :previous
" ]a :next
" [A :first
" ]A :last
" [b :bprevious
" ]b :bnext
" [B :bfirst
" ]B :blast
" [l :lprevious
" ]l :lnext
" [L :lfirst
" ]L :llast
" [<C-L> :lpfile
" ]<C-L> :lnfile
" [q :cprevious
" ]q :cnext
" [Q :cfirst
" ]Q :clast
" [<C-Q> :cpfile (Note that <C-Q> only works in a terminal if you disable
" ]<C-Q> :cnfile flow control: stty -ixon)
" [t :tprevious
" ]t :tnext
" [T :tfirst
" ]T :tlast
" Ack.vim -- ack through files (instead of grep) [help ack]
" :Ack [options] PATTERN [directory] -- search for pattern
" :AckAdd [options] PATTERN [directory] -- add a search pattern
" :AckWindow [options] PATTERN -- search all visible buffers"
" vim-surround -- add quotes/parenthesis/tags [help surround]
" cs -- change surrounding
" ys -- yank and surround (motion, text object)
" yss -- yank and surround current line
" ds" -- remove double-quotes
" cs'" -- replace single-quotes with double quotes
" cd"<q> -- surround with <q>...<q/>
" dst -- remove surrounding tag
" csapprox -- adapt gvim colorschemes for terminal vim [help csapprox]
" UndoTree -- visualize vim undotree
" <F5> -- Toggle UndoTree (? for help)
" vim-nginx -- nginx ftdetect, indent, and syntax
" n3.vim -- N3/Turtle RDF Syntax
" SPARQL -- SPARQL syntax
" Python-mode -- Python [help pymode]
" :help pymode
" [[ -- Jump to previous class or function
" ]] -- Jump to next class or function
" [M -- Jump to previous class or method
" ]M -- Jump to next class or method
" aC -- Select a class. Ex: vaC, daC, yaC, caC
" iC -- Select inner class. Ex: viC, diC, yiC, ciC
" aM -- Select a function or method. Ex: vaM, daM, yaM, caM
" iM -- Select inner function or method. Ex: viM, diM, yiM, ciM
" g:pymode_python = { 'python', 'python3', 'disable' }
"
" set g:pymode_python 'disable' (start time, occasional completion stall)
" <leader> d -- open pydoc
" :PymodeLintToggle -- toggle lint checking
" :PymodeLintAuto -- autofix current buffer pep8 errors
" - auto-show an error window
" - show lint signs
" - run lint on write
" let g:pymode_lint_ignore = ""
" let g:pymode_lint_select = ""
" Pymode lint line annotation symbols
" XX = TODO
" CC = COMMENT
" RR = VISUAL
" EE = ERROR
" II = INFO
" FF = PYFLAKES
" :PyModeLint -- lint current buffer (once)
" :PyModeLintToggle -- toggle lint
"
" :PyModeLintAuto -- auto-lint the current buffer (once)
" (commit before and after)
"
" <F7> -- set debugger breakpoints
" auto lookup breakpoint cmd (pdb, ipdb, pudb)"
" Searches upward for a .ropeproject file (that should be .vcs-ignored)
" :PymodeRopeNewProject -- Create a new .ropeproject in CWD
" :PymodeRopeRegenerate -- Regenerate rope project cache
" <C-c>d -- show docs for current function w/ pymode
" rope for autocompletion
" <C-Space> -- rope autocomplete
" <leader> j -- :RopeGotoDefinition
" <C-c> ro -- organize Python imports; drop unused (:PymodeRopeAutoImport)
" :PymodeRopeUndo -- Undo last project changes
" :PymodeRopeRedo -- Redo last project changes
" <C-c> rr -- rope rename
" vim-virtualenv -- Python virtualenv [help virtualenv]
" :help
" :VirtualEnvDeactivate
" :VirtualEnvList
" :VirtualEnvActivate <name>
" :VirtualEnvActivate <TAB>
" Sort python imports
" :PyFixImports -- sort import statements
" Pytest.vim -- py.test red/green results [help pytest]
" :Pytest clear -- reset pytest globals
" :Pytest file -- pytest file
" :Pytest class -- pytest class
" :Pytest method -- pytest method
" :Pytest {...} --pdb -- pytest file/class/method with pdb
" <leader>tf -- pytest file
" <leader>tc -- pytest class
" <leader>tm -- pytest method
" " cycle through test errors
" <leader>tn -- pytest next error
" <leader>tp -- pytest prev error
" <leader>te -- pytest error
" Pyrex -- Pyrex syntax
" Jinja -- Jinja Templates syntax
" vim-coffee-script -- CoffeeScript syntax, indent
" vim-haml -- HAML, SASS, SCSS
" vim-css3-syntax -- CSS3
" vim-css-color -- show CSS color codes
" vim-less -- LESS CSS
" vim-jade -- Jade templates
" os.vim -- Operating System [help os]
" clickable.vim -- click-able links
" Bundle 'https://github.com/Rykka/clickable.vim' XXX TODO linux
" Riv.vim -- ReStructuredText [help riv]
" :RivIntro
" :RivQuickStart
" :RivPrimer
" :RivSpecification
" :RivCheatSheet
" let g:riv_fold_level = -1
" Salt -- Salt syntax
" Trac -- Trac [help trac]
" webapi-vim -- vim web API [help webapi[-{html, http, json, xml}]]
" gist-vim -- Create a gist.github.com [help gist-vim]
" github-issues.vim -- autocomplete, CRUD GitHub issues [help Gissues]
" html5.vim -- HTML5, RDFa, microdata, WAI-ARIA
" vim-javascript -- improved Javascript support
" vim-indent-guides -- show indentation levels [help indent_guides]
" rainbow-parentheses -- make nested parenthesis different colors
" :RainbowParenthesesActivate
" :RainbowParenthesesToggle
" :RainbowParenthesesLoadRound
" :RainbowParenthesesLoadSquare
" :RainbowParenthesesLoadBraces
" :RainbowParenthesesLoadChevrons
" :RainbowParenthesesToggleAll
" :RainbowParenthesesActivate
" l9 -- utility library (for FuzzyFinder)
" FuzzyFinder -- find files, buffers, tags, changes [help fuf]
" :FufBuffer
" :FufFile
" :FufDir
" :FufMruFile
" :FufMruCmd
" :FufTag
" :FufJumpList
" :FufChangeList
" :FufQuickfix
" :FufHelp
" abolish.vim -- abbreviations, case-aware replcmnts [help abolish]
" fountain.vim -- fountain.io syntax
" All of your Bundles must be added before the following line
"
# etc/vim/vimrc.tinyvim.bundles.vimrc
" Bundle -- Vim bundle manager [help bundle]
" :BundleList - list configured plugins
" :BundleInstall(!) - install (update) plugins
" :BundleSearch(!) foo - search (or refresh cache first) for foo
" :BundleClean(!) - confirm (or auto-approve) removal of unused plugins
"
" The Bundle URLs are intentionally complete https URLs
" * grep '^Bundle \'' vimrc.bundles
" * sed -i 's\https://github.com/\ssh://git@github.com/\g'
" Info.vim -- vim infopages in vim [help info]
" :Info sed -- view infopage for 'sed'
" <Space> -- Scroll forward (page down).
" <Backspace> -- Scroll backward (page up).
" <Tab> -- Move cursor to next hyperlink within this node.
" <Enter>,<C-]> -- Follow hyperlink under cursor.
" ;,<C-T> -- Return to last seen node.
" .,> -- Move to the "next" node of this node.
" p,< -- Move to the "previous" node of this node.
" u -- Move "up" from this node.
" d -- Move to "directory" node.
" t -- Move to the Top node.
" <C-S> -- Search forward within current node only.
" s -- Search forward through all nodes for a specified
" string.
" q -- Quit browser.
"
" Signify -- show git/hg file changes in gutter [help signify]
" NERDTree -- File browser [help NERDTree]
" <Leader>e -- toggle NERDTree
" ctrl-e -- toggle NERDTree
" <Leader>E -- open nerdtree to current file (:NERDTreeFind %:p:h)
" ctrl-E -- open nerdtree to current file (:NERDTreeFind %:p:h)
" I -- toggle view hidden files
" B -- toggle view bookmarks
" cd -- set vim CWD to selected dir
" C -- refocus view to selected dir
" o -- open
" r -- refresh dir
" R -- refresh root
" t -- open in new tab
" T -- open in new tab silently
" u -- up a dir
" U -- up a dir and leave open
" x -- close node
" X -- close all nodes recursive
" ? -- toggle help
" FindInNERDTree -- NERDTRee show current file [help NERDTreeFind]
" <c-b> -- toggle BufExplorer
" ? -- toggle BufExplorer help
" <leader>b -- toggle BufExplorer
" CtrlP -- file/buffer/mru finder [help ctrlp]
" <C-p> -- CtrlP (fuzzy matching)
" Syntastic -- syntax highlighting [help syntastic]
" EasyMotion -- easy visual motions [help easymotion]
" <Leader>m-w/e -- search forward (beg/end of word)
" <Leader>m-b -- search backward
" <Leader>m-j -- search line down
" <Leader>m-k -- search line up
" Jellybeans -- a good colorscheme w/ sensible diff highlighting
" :colorscheme jellybeans -- switch to the jellybeans colorscheme
" Vim-misc -- functions for colorscheme-switcher and vim-session
" Vim Colorscheme Switcher [help colorscheme-switcher]
" <F8> -- cycle colors forward
" <Shift><F8> -- cycle colors reverse
" vim-nginx -- nginx ftdetect, indent, and syntax
" n3.vim -- N3/Turtle RDF Syntax
" SPARQL -- SPARQL syntax
" Pyrex -- Pyrex syntax
" Jinja -- Jinja Templates syntax
" Salt -- Salt syntax
" All of your Bundles must be added before the following line
"
I3wm¶
make help_i3_rst
:
#
# # Default location: ~/.i3/config
# # List commented command shortcuts with::
#
# # cat ~/.i3/config | egrep '(^(\s+)?##+ |^(\s+)?# )'
#
# #!/bin/sh
# ### .i3/config requirements
#
# ## Ubuntu (12.04)
# # MUST
# apt-get install i3 i3status xautolock xlockmore i3lock
# hg clone https://github.com/westurner/dotfiles ~/.dotfiles # etc/xlck.sh
#
# # SHOULD
# apt-get install gnome-terminal network-manager-gnome thunar pulseaudio-utils
# apt-get install feh # wallpaper
# apt-get install xfce4-screenshooter # screenshots
# mkdir -p ~/pictures/screens # screenshots
# apt-get install xbacklight # brightness
#
# # COULD
# apt-get install vim-gnome # scratchpad
# add-apt-repository ppa:kilian/f.lux # f.lux
# apt-get update # f.lux
# apt-get install fluxgui # http://justgetflux.com
#
# ## References
# * http://i3wm.org/docs/userguide.html
# * https://faq.i3wm.org/question/1425/variable-substitution/
# * i3-config-wizard
#
# ## Notes
# * grab keyboard mappings: xev | grep keycode
# Set i3 modifier keys to variables
# # set $mod to <alt> (<Alt_L> and <Alt_R>)
# # set $mod2 to <Super> (<Super_L> and <Super_R>)
# font for window titles. ISO 10646 = Unicode
# Pango requires i3 version >= TODO
# reload the configuration file
# <alt><shift> c -- reload i3 configuration
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
# <alt><shift> r -- restart i3 (session preserving)
# exit i3 (logs you out of your X session)
# <super><shift> l -- exit i3 (close all and logout of X session)
# <alt><shift> q -- close focused window
# # Hide edge borders
# # Get WM_CLASS with $(xprop WM_CLASS)
# set $set_xwallpaper feh --bg-fill --no-xinerama ~/wallpaper.png
# - Set X background
# - Set X wallaper to (~/wallpaper.png)
# - Start screensaver
# - Launch network applet (optional)
# exec_always --no-startup-id $network_applet # (optional)
# see also: nmcli
# <super> l -- lock screen
# <XF86PowerOff> -- exit
# <XF86Sleep> -- suspend
# <XF86MonBrightnessUp> -- brightness up
# <XF86MonBrightnessDown> -- brightness down
# <XF86AudioRaiseVolume> -- volume up
# <XF86AudioLowerVolume> -- volume down
# <alt> x -- run command
# <super> r -- run command
# <super> e -- launch browser
# <alt><shift> g -- launch editor
# <alt><shift> b -- launch browser
# <alt><shift> t -- launch terminal
# <super> t -- launch terminal
# <alt> <enter> -- launch terminal
# XF86Calculator -- launch calculator
# <alt><shift> w -- launch network manager applet (see also: $(nmcli))
# <PrintScr> -- screenshot (full screen)
# <alt> <PrintScr> -- screenshot (current window)
# <alt> v -- focus nearest: editor
# <alt> t -- focus nearest: terminal
# <alt> b -- focus nearest: browser
# <alt> [ -- start xflux
# <alt> ] -- stop xflux
# <alt><shift> ] -- reset gamma to 1.0
# <alt><shift> [ -- xgamma -bgamma 0.6 -ggamma 0.9 -rgamma 0.9
# <alt><shift> \ -- xgamma -bgamma -0.4 -ggamma 0.4 -rgamma 0.9
# <alt> <space> -- toggle focus mode: tiling / floating
# <alt><shift> <space> -- toggle tiling/floating mode for focused window
# <alt> <backspace> -- toggle tiling/floating mode for focused window
# <alt> <mouse> -- drag floating window to position
# # Note: popups will be hidden below fullscreened windows
# <alt><shift> f -- fullscreen
# # popup during fullscreen exits fullscreen
# Split next window
# <alt><shift> h -- split [next] window horizontally
# <alt><shift> v -- split [next] window vertically
# <alt> w -- tabbed window layout
# <alt> e -- Default window layout
# <alt> s -- stacked window layout
# <alt> a -- focus parent container
# <alt><shift> a -- focus child container
# <alt> Up -- focus up
# <alt> Down -- focus down
# <alt> Left -- focus left
# <alt> Right -- focus right
# <alt> h -- focus left
# <alt> j -- focus down
# <alt> k -- focus up
# <alt> l -- focus right
# Toggle between previous and current workspace
# <alt> 0-9 -- switch to workspace N (repeat to return)
# <super> 0-9 -- switch to workspace N (repeat to return)
# <alt> <F_n> -- switch to workspace N (repeat to return)
# <alt> <Keypad_n> -- switch to workspace N (repeat to return)
# <super> Left -- move to previous workspace
# <super> Right -- move to next workspace
# <super> Up -- move to second most recently focused workspace
# <super> Left -- move container to previous workspace
# <super> Right -- move container to next workspace
# <super> Up -- move container to second most recently focused workspace
# <alt><shift> Up -- move window up
# <alt><shift> Down -- move window down
# <alt><shift> Left -- move window left
# <alt><shift> Right -- move window right
# <alt><shift> h -- move window left
# <alt><shift> j -- move window down
# <alt><shift> k -- move window up
# <alt><shift> l -- move window right
# <alt><shift> [N: 0-9] -- move to workspace N
# <alt><shift> [KP_N: 0-9] -- move to workspace N
# <super> [KP_N: 0-9] -- move to workspace N
# <super><shift> Left -- move workspace to left
# <super><shift> Right -- move workspace to right
# <alt><shift> <minus> -- make the currently focused window a scratchpad
# <alt> <minus> -- show/hide and cycle through scratchpad windows
# <alt><shift> s -- start scratchpad editor
# <alt> <XF86Favorites> -- start scratchpad editor
# <XF86Favorites> -- show the $scratchpad_editor_selector
# <alt> <backspace> -- toggle tiling/floating mode for focused window
# see above.
# # on (re)load, move $scratchpad_editor_selector windows to scratchpad
# <alt> r -- enter resize mode
# These bindings trigger as soon as you enter the resize mode
#
# They resize the border in the direction you pressed, e.g.
# when pressing left, the window is resized so that it has
# more space on its left
# same bindings, but for the arrow keys
# Left -- grow left
# <shift> Left -- shrink left
# Down -- grow down
# <shift> Down -- shrink down
# Up -- grow up
# <shift> Up -- shrink up
# Right -- grow right
# <shift> Right -- shrink right
# h -- grow left
# <shift> h -- shrink left
# j -- grow down
# <shift> j -- shrink down
# k -- grow up
# <shift> k -- shrink up
# l -- grow right
# <shift> l -- shrink right
# back to normal: Enter or Escape
# <enter> -- exit resize mode
# <esc> -- exit resize mode
# color defines for zenburn styled i3 derived from:
# https://faq.i3wm.org/question/2071/how-can-i-change-look-of-windows/?answer=2075
# set some nice colors border background text
# # display i3bar with i3status
# $ xrandr-tool outputs
Scripts¶
In scripts/
- bashmarks_to_nerdtree.sh
Convert bashmarks shortcut variables starting with
DIR_
to NERDTreeBookmarks format:export | grep 'DIR_' l # list bashmarks s awesome # save PWD as 'awesome' bashmark g awesome # goto the 'awesome' bashmark ./bashmarks_to_nerdtree.sh | tee ~/.NERDTreeBookmarks
- bootstrap_dotfiles.sh
Clone, update, and install dotfiles in
$HOME
- compare_installed.py
Compare packages listed in a debian/ubuntu APT
.manifest
with installed packages.- gittagstohgtags.sh
- Convert
git
tags tohgtags
format - pulse.sh
- Setup, configure, start, stop, and restart
pulseaudio
- setup_mathjax.py
- Setup
MathJax
- setup_pandas_notebook_deb.sh
- Setup
IPython Notebook
,Scipy
,Numpy
,Pandas
with Ubuntu packages and pip - setup_pandas_notebook.sh
- Setup
Brew
,IPython Notebook
,scipy
,numpy
, and pandas on OSX - setup_scipy_deb.py
- Install and symlink
scipy
,numpy
, andmatplotlib
fromapt
- deb_deps.py
- Work with debian dependencies
- deb_search.py
- Search for a debian package
- build_docs.py
- Build sets of sphinx documentation projects
- el
Open args from stdin with
EDITOR_
orEDITOR
. Similar toxargs
.grep -l TODO | el
opens files inEDITOR_
grep -l TODO | el -x echo
echos ‘filename1 filename2 filenamen’grep -l TODO | el -v --each -x echo
runs echon
times, verbosely- greppaths.py
- Grep
- lsof.py
- lsof subprocess wrapper
- mactool.py
- MAC address tool
- optimizepath.py
- Work with PATH as an ordered set
- passwordstrength.py
- Gauge password strength
- pipls.py
- Walk and enumerate a pip requirements file
- pycut.py
- Similar to
coreutils
‘cut
: split line-based files into fields. See: pyline.py (pyline 'w[1:2]'
) - py_index.py
- Create a python package index HTML file for a directory of
packages. (
.egg
,.zip
,.tar.gz
,tgz
) - pyline.py
Similar to
sed
andawk
: Execute python expressions over line-based files.- pyren.py
Skeleton regex file rename script
- pyrpo.py
Wrap version control system commandline interfaces
- usrlog.sh
- Log shell output with (by default, unique)
TERM_IDs, PWD, start / finish times
to
~/-usrlog.log
or$VIRTUAL_ENV/-usrlog.log
. - usrlog.py
- Search through
.usrlog
files - xlck.sh
- Wrap
xautolock
for screensaver, shutdown, suspend, resume config (e.g..xinitrc
callsxlck.sh -S
) - x-www-browser
- Launch browser tabs for each argument (OSX, Linux, webbrowser)