Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Yet another re-org of bash scripts.

  • Loading branch information...
commit 38397a7977906db87f0c33f4f85851154d1b2946 1 parent 2caae1c
@vmt authored
View
2  .gitmodules
@@ -1,3 +1,3 @@
[submodule "vim/pathogen"]
path = vim/pathogen
- url = git://github.com/tpope/vim-pathogen.git
+ url = http://github.com/tpope/vim-pathogen.git
View
82 bash/bashrc
@@ -1,23 +1,40 @@
-#!/bin/bash
-#
-# bashrc by Vivek Thampi
-# ======================
+#!/usr/bin/env bash
+# -------------------------------------------------------------------
+# Bash Settings
+# -------------------------------------------------------------------
-export XAPPLRESDIR=$VIM_ETC/xapplresdir
-export PYTHONPATH=$PYTHONPATH:$VMT_ETC/python
-export PS1="\u@\h:\W$ "
+shopt -s cdable_vars # non directories are assumed to be vars
+
+# -------------------------------------------------------------------
+# Local site scripting
+# -------------------------------------------------------------------
+
+export VMT_ETC_LOCAL=$VMT_ETC/local
+export VMT_ETC_LOCAL_VAR=$VMT_ETC/local/var.d
+mkdir -p $VMT_ETC_LOCAL
+mkdir -p $VMT_ETC_LOCAL_VAR
-# +---------------------------+
-# | Set Environment Variables |
-# +---------------------------+
+# -------------------------------------------------------------------
+# Apps
+# -------------------------------------------------------------------
-# Set Editor
+# vim
+alias v=vim
export EDITOR=vim
-# +-----------------------+
-# | Bash History Facility |
-# +-----------------------+
+# screen
+source $VMT_ETC/screen/utils
+
+# X
+export XAPPLRESDIR=$VMT_ETC/xapplresdir
+
+# Python
+export PYTHONPATH=$PYTHONPATH:$VMT_ETC/python
+
+# -------------------------------------------------------------------
+# HISTORY
+# -------------------------------------------------------------------
# Save Control
# Values:
@@ -37,7 +54,7 @@ export HISTFILE="${HOME}/.bash_history"
# Patterns:
# & - ignore duplicates
# [ \t]* - ignore commands that start with space
-export HISTIGNORE="[ \t]*:&:ls:exit:history.*"
+export HISTIGNORE="&:ls:exit:history.*"
# Maximum commands to remember
export HISTFILESIZE=1000000
@@ -49,30 +66,21 @@ export HISTTIMEFORMAT="%h/%d - %H:%M:%S "
# Save history by appending
shopt -s histappend # Save by appending
-# +-------------+
-# | Miscellany. |
-# +-------------+
-shopt -s cdable_vars # non directories are assumed to be vars
+# -------------------------------------------------------------------
+# MODULES
+# -------------------------------------------------------------------
-# +----------+
-# | Aliases. |
-# +----------+
+source $VMT_ETC/bash/vmtlib.bash
+source $VMT_ETC/bash/goto.bash
-alias v=vim
+# Local rc
+if [ -e $VMT_ETC_LOCAL/bashrc ]; then
+ source $VMT_ETC_LOCAL/bashrc
+fi
-# +--------+
-# | Utils. |
-# +--------+
-#
-# sendScreenCommand <window> <cmd> [args[...]]
-#
-sendScreenCommand() {
- window=$1; shift; cmd=$*$'\n'
- screen -p $win -X stuff "$cmd"
-}
-
-# vim:ts=2
-# vim:sw=2
-# vim:expandtab
+# Set default promp
+vmtSetDefaultPrompt
+
+# vim:ts=2 sw=2 expandtab
View
75 bash/goto
@@ -1,75 +0,0 @@
-# Module: GOTO
-#
-# Dirs
-#
-
-vmtGoto_ModName=goto
-vmtGoto_Ptrs=$VMT_ETC_LOCAL_VAR/$vmtGoto_ModName/ptrs
-vmtGoto_Hooks=$VMT_ETC_LOCAL_VAR/$vmtGoto_ModName/hooks
-
-# Initialization:
-# create ptrs and hooks directory if they don't exist
-if [ ! -d $vmtGoto_Ptrs ]; then
- echo "etc::$vmtGoto_ModName: creating local pointers directory: '$vmtGoto_Ptrs'."
- mkdir -p $vmtGoto_Ptrs
-fi
-if [ ! -d $vmtGoto_Hooks ]; then
- echo "etc::$vmtGoto_ModName: creating local hooks directory: '$vmtGoto_Hooks'."
- mkdir -p $vmtGoto_Hooks
-fi
-
-
-function vmt_Goto
-{
- # behavior depends on the params
- if [ $# -eq 0 ]; then
- # help
- # list all pointers
- echo "etc::$vmtGoto_ModName: Help"
- echo "etc::$vmtGoto_ModName: goto show help"
- echo "etc::$vmtGoto_ModName: goto <name> goto name -> loc"
- echo "etc::$vmtGoto_ModName: goto <name> <loc> assign name -> loc"
- ( cd $vmtGoto_Ptrs && stat -c %N * ) | tr '`' ' ' | tr "'" ' ' | \
- while read link; do
- echo "goto: $link"
- done
- elif [ $# -eq 1 ]; then
- # Check if such a ptr exists
- if [ ! -e $vmtGoto_Ptrs/$1 ]; then
- echo "etc::$vmtGoto_ModName: ptr '$1' not found."
- return 1
- fi
- # goto location
- # deference and change directory
- ptr=$1
- destdir=$( cd -P $vmtGoto_Ptrs/$1 && pwd )
- # run pre-hooks
- for hook in `ls $vmtGoto_Hooks/pre-*`; do
- source $hook $ptr $destdir
- done
- cd -P $vmtGoto_Ptrs/$ptr
- # run post-hooks
- for hook in `ls $vmtGoto_Hooks/post-*`; do
- source $hook $ptr $destdir
- done
- # run dest-hooks
- desthook=`pwd`/.goto-hook
- if [ -e $desthook ]; then
- source $desthook $ptr $destdir
- fi
- elif [ $# -eq 2 ]; then
- if [ -e $vmtGoto_Ptrs/$1 ]; then
- echo "etc::$vmtGoto_ModName: Bookmark '$1' already exists."
- echo "etc::$vmtGoto_ModName: Overwriting."
- fi
- rm -f $vmtGoto_Ptrs/$1
- ln -s $2 $vmtGoto_Ptrs/$1
- ( cd $vmtGoto_Ptrs && stat -c %N $1 ) | tr '`' ' ' | tr "'" ' ' \
- | xargs echo "etc::goto: "
- fi
- return 0
-}
-
-# vim:ts=2
-# vim:sw=2
-# vim:expandtab
View
74 bash/goto.bash
@@ -0,0 +1,74 @@
+# Module: GOTO
+#
+# Dirs
+#
+
+VMTGOTO_PTRS=$VMT_ETC_LOCAL_VAR/goto/ptrs
+VMTGOTO_HOOKS=$VMT_ETC_LOCAL_VAR/goto/hooks
+
+# Initialization:
+# create ptrs and hooks directory if they don't exist
+if [ ! -d $VMTGOTO_PTRS ]; then
+ echo "goto: creating local pointers directory: '$VMTGOTO_PTRS'."
+ mkdir -p $VMTGOTO_PTRS
+fi
+if [ ! -d $VMTGOTO_HOOKS ]; then
+ echo "goto: creating local hooks directory: '$VMTGOTO_HOOKS'."
+ mkdir -p $VMTGOTO_HOOKS
+fi
+
+
+function vmt_Goto
+{
+ # behavior depends on the params
+ if [ $# -eq 0 ]; then
+ # help
+ # list all pointers
+ echo "goto: Help"
+ echo "goto: goto show help"
+ echo "goto: goto <name> goto name -> loc"
+ echo "goto: goto <name> <loc> assign name -> loc"
+ ( cd $VMTGOTO_PTRS && stat -c %N * ) | tr '`' ' ' | tr "'" ' ' | \
+ while read link; do
+ echo "goto: $link"
+ done
+ elif [ $# -eq 1 ]; then
+ # Check if such a ptr exists
+ if [ ! -e $VMTGOTO_PTRS/$1 ]; then
+ echo "goto: ptr '$1' not found."
+ return 1
+ fi
+ # goto location
+ # deference and change directory
+ ptr=$1
+ destdir=$( cd -P $VMTGOTO_PTRS/$1 && pwd )
+ # run pre-hooks
+ for hook in `ls $VMTGOTO_HOOKS/pre-*`; do
+ source $hook $ptr $destdir
+ done
+ cd -P $VMTGOTO_PTRS/$ptr
+ # run post-hooks
+ for hook in `ls $VMTGOTO_HOOKS/post-*`; do
+ source $hook $ptr $destdir
+ done
+ # run dest-hooks
+ desthook=`pwd`/.goto-hook
+ if [ -e $desthook ]; then
+ source $desthook $ptr $destdir
+ fi
+ elif [ $# -eq 2 ]; then
+ if [ -e $VMTGOTO_PTRS/$1 ]; then
+ echo "goto: Bookmark '$1' already exists."
+ echo "goto: Overwriting."
+ fi
+ rm -f $VMTGOTO_PTRS/$1
+ ln -s $2 $VMTGOTO_PTRS/$1
+ ( cd $VMTGOTO_PTRS && stat -c %N $1 ) | tr '`' ' ' | tr "'" ' ' \
+ | xargs echo "etc::goto: "
+ fi
+ return 0
+}
+
+# vim:ts=2
+# vim:sw=2
+# vim:expandtab
View
44 bash/vmtlib.bash
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+
+# -------------------------------------------------------------------
+# vmtSetPrompt --
+# vmtSetDefaultPrompt --
+#
+# Set PS1 for Bash Prompt
+# Set to VMT_DEFAULTPROMPT or user@host:directory
+#
+# -------------------------------------------------------------------
+function vmtSetPrompt {
+ export PS1=$1
+}
+
+function vmtSetDefaultPrompt {
+ if [ ! -z "$VMT_DEFAULTPS1" ]; then
+ vmtSetPrompt "$VMT_DEFAULTPS1"
+ else
+ vmtSetPrompt "\u@\h:\W$ "
+ fi
+}
+
+
+# -------------------------------------------------------------------
+# vmtSetScreenTitle --
+# vmtSetDefaultScreenTitle --
+#
+# Set GNU Screen Title
+# Set Screen Title to VMT_DEFAULTSCREENTITLE or nothing
+#
+# -------------------------------------------------------------------
+function vmtSetScreenTitle {
+ if [ "x$STY" != "x" ]; then
+ screen -X title "$1"
+ fi
+}
+
+function vmtSetDefaultScreenTitle {
+ if [ ! -z "$VMT_DEFAULTSCREENTITLE" ]; then
+ vmtSetScreenTitle $VMT_DEFAULTSCREENTITLE
+ fi
+}
+
+
View
0  init.d/01-dirs
No changes.
View
35 init.d/10-history
@@ -1,35 +0,0 @@
-#!/usr/bin/env bash
-
-# +-----------------------+
-# | Bash History Facility |
-# +-----------------------+
-
-# Save Control
-# Values:
-# ignorespace - ignore lines which begin with space
-# ignoredups - ignore consecutive duplicates
-# ignoreboth = ignorespace:ignoredups
-# erasedups - all duplicates removed
-export HISTCONTROL="ignoreboth:erasedups"
-
-# Save File
-export HISTFILE="${HOME}/.bash_history"
-
-# History Patterns to Ingore
-#
-# Reference:
-# http://www.gnu.org/software/bash/manual/bashref.html#index-HISTIGNORE-199
-# Patterns:
-# & - ignore duplicates
-# [ \t]* - ignore commands that start with space
-export HISTIGNORE="&:ls:exit:history.*"
-
-# Maximum commands to remember
-export HISTFILESIZE=1000000
-export HISTSIZE=10000
-
-# Time Format
-export HISTTIMEFORMAT="%h/%d - %H:%M:%S "
-
-# Save history by appending
-shopt -s histappend # Save by appending
View
42 init.d/10-misc
@@ -1,42 +0,0 @@
-export XAPPLRESDIR=$VMT_ETC/xapplresdir
-export PYTHONPATH=$PYTHONPATH:$VMT_ETC/python
-export PS1="\u@\h:\W$ "
-
-# +---------------------------+
-# | Set Environment Variables |
-# +---------------------------+
-
-# Set Editor
-export EDITOR=vim
-
-# +-------------+
-# | Miscellany. |
-# +-------------+
-shopt -s cdable_vars # non directories are assumed to be vars
-
-
-# +----------+
-# | Aliases. |
-# +----------+
-
-alias v=vim
-
-# +--------+
-# | Utils. |
-# +--------+
-
-#
-# sendScreenCommand <window> <cmd> [args[...]]
-#
-sendScreenCommand() {
- window=$1; shift; cmd=$*$'\n'
- screen -p $win -X stuff "$cmd"
-}
-
-function vmt-set-screen-title {
- if [ "x$STY" != "x" ]; then
- screen -X title "$1"
- fi
-}
-
-source $VMT_ETC/screen/utils
View
1  init.d/20-goto
@@ -1 +0,0 @@
-source $VMT_ETC/bash/goto
View
1  init.d/21-path
@@ -1 +0,0 @@
-export PATH=$PATH:$VMT_ETC/bin
View
1  init.d/90-aliases
@@ -1 +0,0 @@
-alias trun=vmt_SetTitleAndRun
View
16 init.d/99-local
@@ -1,16 +0,0 @@
-#!/usr/bin/env bash
-
-# local directories
-export VMT_ETC_LOCAL=$VMT_ETC/local
-export VMT_ETC_LOCAL_VAR=$VMT_ETC/local/var.d
-
-# local initialization
-mkdir -p $VMT_ETC_LOCAL
-if [ -d "$VMT_ETC_LOCAL/init.d" ]; then
- for init in `ls $VMT_ETC_LOCAL/init.d/*`; do
- vmtLog 2 "etc::local-init:" `basename $init`
- source $init
- done
-fi
-
-# vim:ts=2 sw=2 expandtab
View
47 screen/screenrc
@@ -1,18 +1,15 @@
-shell -${SHELL} # dash (-) is for login shells
-shelltitle ''
-autodetach on
+shell -${SHELL} # dash (-) is for login shells
+shelltitle '>|'
startup_message off
-defscrollback 8192
-caption splitonly
-
-## Bell
-bell_msg "Zounds!"
-vbell off
-
-
-hardstatus alwayslastline
-hardstatus string "%{= ky}%-Lw%{=r}%20>%n %t%{= ky}%+Lw %{= ky}%-=| %{= kw}%M%d %c%{-} %{=r} ${USER}@%H "
+defscrollback 8192
+bell_msg "Zounds!"
+vbell off
+altscreen on
+autodetach on
+# -----------------------------------------------------------
+# Caption
+#
# %{= ky} set color to yellow on black.
# %{= yk} set color to black on yellow.
# %{=r} reverse the color attrs
@@ -23,13 +20,35 @@ hardstatus string "%{= ky}%-Lw%{=r}%20>%n %t%{= ky}%+Lw %{= ky}%-=| %{= kw}%M%d
# %M%d month and day, like MmmDD.
# %c current time, like HH:MM.
# %H hostname
+# hardstatus alwayslastline
+# hardstatus string "%{= ky}%-Lw%{=r}%20>%n %t%{= ky}%+Lw %{= ky}%-=| %{= kw}%M%d %c%{-} %{=r} ${USER}@%H "
+#
+# caption always "%{= ky}%-Lw%{=r}%20>%n %t%{= ky}%+Lw %{= ky}%-="
+# caption always "%{= ky}%n %t %?%F****%?"
+caption always "%n %t %?%F****%?"
# terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
attrcolor b ".I"
+
# tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
+termcapinfo xterm*|Eterm|mlterm "hs:ts=\E]0;:fs=\007:ds=\E]0;screen\007"
+hardstatus off
+hardstatus string "screen %n (%t)%? [%h]%?"
+
# erase background with current bg color
defbce "on"
+
# set TERM
-term screen-256color-bce
+term screen-256color-bce
+
+# -----------------------------------------------------------
+# Key bindings
+#
+escape ^Bb
+bind ' ' windowlist -b
+bind j focus down
+bind k focus up
+bind t focus top
+bind b focus bottom
View
4 vim/vimrc
@@ -47,3 +47,7 @@ autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
+
+" Bash doesn't load your bashrc unless it's in interactive
+" mode.
+" set shellcmdflag=-ic
View
10 xapplresdir/XTerm
@@ -3,6 +3,8 @@
! http://ggellner.wordpress.com/2006/08/12/desert-xterm/
! ---------------------------------------------------------------------
+XTerm*metaSendsEscape: true
+
*underLine: on
*colorMode: on
@@ -52,8 +54,10 @@
!set the font, and font size
! this also uses a antialias/scalable font
-!*faceName: Courier New
-!*faceSize: 9
+*faceName: Liberation MOno
+*faceSize: 9
+*faceName: ProggyCleanTT
+*faceSize: 12
!set the window geometry
-!*geometry: 80x25
+*geometry: 80x25
Please sign in to comment.
Something went wrong with that request. Please try again.