# Eg, to remove ~/bin from $PATH
# pathremove ~/bin PATH
function pathremove {
- local IFS=':'
- local NEWPATH
- local DIR
- local PATHVARIABLE=${2:-PATH}
- for DIR in ${!PATHVARIABLE} ; do
- if [ "${DIR}" != "${1}" ] ; then
- NEWPATH="${NEWPATH:+${NEWPATH}:}${DIR}"
- fi
- done
- export ${PATHVARIABLE}="${NEWPATH}"
+ local IFS=':'
+ local NEWPATH
+ local DIR
+ local PATHVARIABLE=${2:-PATH}
+ for DIR in ${!PATHVARIABLE} ; do
+ if [ "${DIR}" != "${1}" ] ; then
+ NEWPATH="${NEWPATH:+${NEWPATH}:}${DIR}"
+ fi
+ done
+ export ${PATHVARIABLE}="${NEWPATH}"
}
# Usage: pathprepend /path/to/bin [PATH]
# Eg, to prepend ~/bin to $PATH
# pathprepend ~/bin PATH
function pathprepend {
- pathremove "${1}" "${2}"
- [ -d "${1}" ] || return
- local PATHVARIABLE="${2:-PATH}"
- export ${PATHVARIABLE}="${1}${!PATHVARIABLE:+:${!PATHVARIABLE}}"
+ pathremove "${1}" "${2}"
+ [ -d "${1}" ] || return
+ local PATHVARIABLE="${2:-PATH}"
+ export ${PATHVARIABLE}="${1}${!PATHVARIABLE:+:${!PATHVARIABLE}}"
}
# Usage: pathappend /path/to/bin [PATH]
# Eg, to append ~/bin to $PATH
# pathappend ~/bin PATH
function pathappend {
- pathremove "${1}" "${2}"
- [ -d "${1}" ] || return
- local PATHVARIABLE=${2:-PATH}
- export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}${1}"
+ pathremove "${1}" "${2}"
+ [ -d "${1}" ] || return
+ local PATHVARIABLE=${2:-PATH}
+ export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}${1}"
}
# Usage: is_function something
# Check if a function exists
function is_function {
- declare -Ff "$1" > /dev/null
+ declare -Ff "$1" > /dev/null
}
# Usage: find_up_recurse somefile
# Check if a file named somefile exists in this directory or any parent
function find_up_recurse {
- d="$1"
- pushd . > /dev/null
- while [ "$PWD" != "/" ]; do
- if [ -e "$d" ]; then
- popd > /dev/null
- return 0
- fi
- cd ..
- done
- popd > /dev/null
- return 1
+ d="$1"
+ pushd . > /dev/null
+ while [ "$PWD" != "/" ]; do
+ if [ -e "$d" ]; then
+ popd > /dev/null
+ return 0
+ fi
+ cd ..
+ done
+ popd > /dev/null
+ return 1
}
# Load local functions
# Check for unsupported TERM variable
if ! tput init &> /dev/null; then
- echo "Warning! TERM=$TERM unsupported, using TERM=xterm"
- export TERM=xterm
+ echo "Warning! TERM=$TERM unsupported, using TERM=xterm"
+ export TERM=xterm
fi
[ -r /usr/share/git/completion/git-prompt.sh ] && source /usr/share/git/completion/git-prompt.sh
function my_git_ps1 {
- find_up_recurse .git || return
- GIT_PS1_SHOWDIRTYSTATE=1 \
- GIT_PS1_SHOWUNTRACKEDFILES=1 \
- __git_ps1 2> /dev/null
+ find_up_recurse .git || return
+ GIT_PS1_SHOWDIRTYSTATE=1 \
+ GIT_PS1_SHOWUNTRACKEDFILES=1 \
+ __git_ps1 2> /dev/null
}
function my_hg_ps1 {
- find_up_recurse .hg || return
- b="$(hg branch 2>/dev/null)" || return
- s="$(hg status | cut -c1 | sort -u | tr -d " \n")"
- echo -n " ($b"
- [ -n "$s" ] && echo -n " $s"
- echo -n ")"
+ find_up_recurse .hg || return
+ b="$(hg branch 2>/dev/null)" || return
+ s="$(hg status | cut -c1 | sort -u | tr -d " \n")"
+ echo -n " ($b"
+ [ -n "$s" ] && echo -n " $s"
+ echo -n ")"
}
function my_svn_ps1 {
- find_up_recurse .svn || return
- s="$(svn status --ignore-externals 2>/dev/null | cut -c1 | sort -u | tr -d " \n")"
- [ -z "$s" ] && return
- echo -n " ($s)"
+ find_up_recurse .svn || return
+ s="$(svn status --ignore-externals 2>/dev/null | cut -c1 | sort -u | tr -d " \n")"
+ [ -z "$s" ] && return
+ echo -n " ($s)"
}
if [ -z "$debian_chroot" -a -r /etc/debian_chroot ]; then
- debian_chroot=$(cat /etc/debian_chroot)
+ debian_chroot=$(cat /etc/debian_chroot)
fi
PS1='${debian_chroot:+($debian_chroot)}'
PS1="$PS1"'\[\033[00;31m\]\u@\h\[\033[00m\]:\[\033[00;34m\]\w\[\033[00m\]'
# Display return codes on error
function print_exit_code {
- _exit_msg="\033[01;33mexit code: $?\033[00m"
- if [ -z "${BASH_SOURCE[1]}" ]; then
- echo -e "$_exit_msg"
- fi
- unset _exit_msg
+ _exit_msg="\033[01;33mexit code: $?\033[00m"
+ if [ -z "${BASH_SOURCE[1]}" ]; then
+ echo -e "$_exit_msg"
+ fi
+ unset _exit_msg
}
trap print_exit_code ERR
if [ "${DARKTERM:-1}" -eq 1 ]; then
- # Sets colour scheme in apps like Vim
- export COLORFGBG="15;0"
+ # Sets colour scheme in apps like Vim
+ export COLORFGBG="15;0"
- # Bold ls colours
- LS_COLORS="$(echo "${LS_COLORS}" | sed 's/00;/01;/g')"
- LSCOLORS="ExFxCxDxBxEGEDABAGACAD" # BSD ls
- PS1="$(echo "${PS1}" | sed 's/00;/01;/g')"
+ # Bold ls colours
+ LS_COLORS="$(echo "${LS_COLORS}" | sed 's/00;/01;/g')"
+ LSCOLORS="ExFxCxDxBxEGEDABAGACAD" # BSD ls
+ PS1="$(echo "${PS1}" | sed 's/00;/01;/g')"
else
- # Sets colour scheme in apps like Vim
- export COLORFGBG="0;15"
+ # Sets colour scheme in apps like Vim
+ export COLORFGBG="0;15"
- # Unbold ls colours
- LS_COLORS="$(echo "${LS_COLORS}" | sed 's/01;/00;/g')"
- LSCOLORS="exfxcxdxbxegedabagacad" # BSD ls
+ # Unbold ls colours
+ LS_COLORS="$(echo "${LS_COLORS}" | sed 's/01;/00;/g')"
+ LSCOLORS="exfxcxdxbxegedabagacad" # BSD ls
fi
# xterm titlebar displays 'hostname:workingdir'
if tput hs || tput tsl &> /dev/null; then
- PROMPT_COMMAND='tput tsl; echo -n "$(hostname| cut -d. -f1):${PWD/$HOME/~}"; tput fsl;'
+ PROMPT_COMMAND='tput tsl; echo -n "$(hostname| cut -d. -f1):${PWD/$HOME/~}"; tput fsl;'
fi
# screen window displays current command
case "${TERM}" in
screen*)
- PROMPT_COMMAND="$PROMPT_COMMAND echo -ne '\033k\033\\'"
- ;;
+ PROMPT_COMMAND="$PROMPT_COMMAND echo -ne '\033k\033\\'"
+ ;;
esac
# Useful aliases
# Colorful man pages
function man {
env \
- LESS_TERMCAP_md=$'\E[01;38;5;74m' \
- LESS_TERMCAP_me=$'\E[0m' \
- LESS_TERMCAP_us=$'\E[04;38;5;146m' \
- LESS_TERMCAP_ue=$'\E[0m' \
+ LESS_TERMCAP_md=$'\E[01;38;5;74m' \
+ LESS_TERMCAP_me=$'\E[0m' \
+ LESS_TERMCAP_us=$'\E[04;38;5;146m' \
+ LESS_TERMCAP_ue=$'\E[0m' \
man "$@"
}
# Usage: mcd somedir
# Creates the directory if it doesn't exist, and changes into it
function mcd {
- mkdir -p "${1}" &&
- cd "${1}"
+ mkdir -p "${1}" &&
+ cd "${1}"
}
# Usage: vimf somefile
# Does a recursive search of the current directory for somefile, then edits it
function vimf {
- find . -iname "${1}" -exec vim '{}' +
+ find . -iname "${1}" -exec vim '{}' +
}
# Sets the nice and ionice priorities for the current shell to the lowest values
function slowshell {
- ionice -c 3 -p $$
- renice -n 19 -p $$
+ ionice -c 3 -p $$
+ renice -n 19 -p $$
}
# An interactive shell starting bash_profile must be a login shell (man bash)
# We run the login script and the interactive setup
if [ -n "${PS1}" ]; then
- source "${HOME}/.bash/login"
- source "${HOME}/.bash/interactive"
+ source "${HOME}/.bash/login"
+ source "${HOME}/.bash/interactive"
fi
# An interactive shell starting bashrc is not a login shell, just run
# interactive setup
if [ -n "${PS1}" ]; then
- source "${HOME}/.bash/interactive"
+ source "${HOME}/.bash/interactive"
fi
<fontconfig>
<!--
- General settings.
+ General settings.
-->
<match target="font">
- <edit name="antialias" mode="assign"><bool>true</bool></edit>
- <edit name="lcdfilter" mode="assign"><const>lcddefault</const></edit>
- <edit name="embeddedbitmap" mode="assign"><bool>false</bool></edit>
- <edit name="autohint" mode="assign"><bool>false</bool></edit>
- <edit name="hinting" mode="assign"><bool>true</bool></edit>
- <edit name="hintstyle" mode="assign"><const>hintslight</const></edit>
- <edit name="rgba" mode="append"><const>rgb</const></edit>
+ <edit name="antialias" mode="assign"><bool>true</bool></edit>
+ <edit name="lcdfilter" mode="assign"><const>lcddefault</const></edit>
+ <edit name="embeddedbitmap" mode="assign"><bool>false</bool></edit>
+ <edit name="autohint" mode="assign"><bool>false</bool></edit>
+ <edit name="hinting" mode="assign"><bool>true</bool></edit>
+ <edit name="hintstyle" mode="assign"><const>hintslight</const></edit>
+ <edit name="rgba" mode="append"><const>rgb</const></edit>
</match>
<!--
- Ugly fonts to disable. This must come before the default fonts.
+ Ugly fonts to disable. This must come before the default fonts.
-->
<match target="pattern">
- <test qual="any" name="family"><string>Nimbus Mono L</string></test>
- <edit name="family" mode="assign"><string>monospace</string></edit>
+ <test qual="any" name="family"><string>Nimbus Mono L</string></test>
+ <edit name="family" mode="assign"><string>monospace</string></edit>
</match>
<!--
- Default fonts.
+ Default fonts.
-->
<alias>
- <family>serif</family>
- <prefer>
- <family>Georgia</family>
- <family>DejaVu Serif</family>
- </prefer>
+ <family>serif</family>
+ <prefer>
+ <family>Georgia</family>
+ <family>DejaVu Serif</family>
+ </prefer>
</alias>
<alias>
- <family>sans-serif</family>
- <prefer>
- <family>Ubuntu</family>
- <family>Source Sans Pro</family>
- <family>DejaVu Sans</family>
- </prefer>
+ <family>sans-serif</family>
+ <prefer>
+ <family>Ubuntu</family>
+ <family>Source Sans Pro</family>
+ <family>DejaVu Sans</family>
+ </prefer>
</alias>
<alias>
- <family>monospace</family>
- <prefer>
- <family>Ubuntu Mono</family>
- <family>Consolas</family>
- <family>Inconsolata</family>
- <family>DejaVu Sans Mono</family>
- </prefer>
+ <family>monospace</family>
+ <prefer>
+ <family>Ubuntu Mono</family>
+ <family>Consolas</family>
+ <family>Inconsolata</family>
+ <family>DejaVu Sans Mono</family>
+ </prefer>
</alias>
</fontconfig>
[user]
- name = James Bunton
- email = jamesbunton@delx.net.au
+ name = James Bunton
+ email = jamesbunton@delx.net.au
[color]
- ui = always
+ ui = always
[core]
- pager = less -+F -+X
- editor = vim
+ pager = less -+F -+X
+ editor = vim
[log]
- decorate = full
+ decorate = full
[diff]
- renamelimit = 10000
+ renamelimit = 10000
[push]
- # Set to tracking instead of upstream for backwards compatibility
- default = tracking
+ # Set to tracking instead of upstream for backwards compatibility
+ default = tracking
[alias]
- graphlog = log --graph --pretty=format:'%C(bold black)%h%Creset %C(bold red)%ad %C(bold blue)%s%Creset %C(bold yellow)%d%Creset %C(bold black)<%an>%Creset' --date=short
- ci = commit
- co = checkout
- st = status
- di = diff
- diw = diff --color-words
- dic = diff --cached
- dicw = diff --cached --color-words
- ff = merge --ff-only
- ffpull = pull --ff-only
- lso = ls-files -X .gitignore -o
- pushn = !git push origin -u --set-upstream "$(git rev-parse --abbrev-ref HEAD)"
- pushd = !git push origin --delete "$(git rev-parse --abbrev-ref HEAD)"
- cherry-pick = cherry-pick -x
- branches-to-kill = !git branch --merged origin/master|grep -v master|xargs -n1 echo git branch -d
+ graphlog = log --graph --pretty=format:'%C(bold black)%h%Creset %C(bold red)%ad %C(bold blue)%s%Creset %C(bold yellow)%d%Creset %C(bold black)<%an>%Creset' --date=short
+ ci = commit
+ co = checkout
+ st = status
+ di = diff
+ diw = diff --color-words
+ dic = diff --cached
+ dicw = diff --cached --color-words
+ ff = merge --ff-only
+ ffpull = pull --ff-only
+ lso = ls-files -X .gitignore -o
+ pushn = !git push origin -u --set-upstream "$(git rev-parse --abbrev-ref HEAD)"
+ pushd = !git push origin --delete "$(git rev-parse --abbrev-ref HEAD)"
+ cherry-pick = cherry-pick -x
+ branches-to-kill = !git branch --merged origin/master|grep -v master|xargs -n1 echo git branch -d
historyPath = os.path.expanduser("~/.pyhistory")
def myCompleter(text, state):
- if text.strip() == "":
- if state == 0:
- return text + "\t"
- else:
- return None
- else:
- return defaultCompleter.complete(text, state)
+ if text.strip() == "":
+ if state == 0:
+ return text + "\t"
+ else:
+ return None
+ else:
+ return defaultCompleter.complete(text, state)
def save_history(historyPath=historyPath):
import readline
Host *
-#ControlMaster auto
-#ControlPath ~/.ssh/master-%r@%h:%p
-HashKnownHosts no
-SendEnv COLORFGBG
+ HashKnownHosts no
+ SendEnv COLORFGBG
+### ControlMaster auto
+### ControlPath ~/.ssh/master-%r@%h:%p
-<C-R>=strftime("%Y-%m-%d")<CR>
\ No newline at end of file
+<C-R>=strftime("%Y-%m-%d")<CR>
int
main(void)
{
- ___
- return 0;
+ ___
+ return 0;
}
int
main(int argc, char** argv)
{
- ___
- return 0;
+ ___
+ return 0;
}
int
main(void)
{
- ___
- return 0;
+ ___
+ return 0;
}
int
main(int argc, char** argv)
{
- ___
- return 0;
+ ___
+ return 0;
}
public class ___ClassName {
- public static void main(String[] args) {
- // code
- }
+ public static void main(String[] args) {
+ // code
+ }
}
\title{___The Title goes here}
\author{
- ___First Author\\
- (email: \tt{___user@example.com}) \\
+ ___First Author\\
+ (email: \tt{___user@example.com}) \\
}
\begin{document}
import sys
def main():
- ___ pass
+ ___ pass
if __name__ == "__main__":
- main()
+ main()
import sys
def main(___arg):
- ___ pass
+ ___ pass
if __name__ == "__main__":
- try:
- ___arg = sys.argv[1]
- except:
- print >>sys.stderr, "Usage: %s ___arg" % sys.argv[0]
- sys.exit(1)
+ try:
+ ___arg = sys.argv[1]
+ except:
+ print >>sys.stderr, "Usage: %s ___arg" % sys.argv[0]
+ sys.exit(1)
- main(___arg)
+ main(___arg)
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
- <title>___</title>
- <link rel="stylesheet" type="text/css" href="___" />
- <script type="text/javascript" src="___"/>
+ <title>___</title>
+ <link rel="stylesheet" type="text/css" href="___" />
+ <script type="text/javascript" src="___"/>
</head>
<body>
vimdir = os.path.join(os.environ.get("HOME"), ".vim")
try:
- outfilename = os.path.join(vimdir, "abbrsout.vim")
- outfile = open(outfilename, "w")
+ outfilename = os.path.join(vimdir, "abbrsout.vim")
+ outfile = open(outfilename, "w")
except IOError:
- print >> sys.stderr, "Couldn't open output file for writing: %s" % outfilename
- sys.exit(1)
+ print >> sys.stderr, "Couldn't open output file for writing: %s" % outfilename
+ sys.exit(1)
abbrsdir = os.path.join(vimdir, "abbrs")
if not os.path.isdir(abbrsdir):
- print >> sys.stderr, "Could not find directory with abbreviations: %s" % abbrsdir
- sys.exit(1)
+ print >> sys.stderr, "Could not find directory with abbreviations: %s" % abbrsdir
+ sys.exit(1)
for abbrfile in os.listdir(abbrsdir):
- abbr = open(os.path.join(abbrsdir, abbrfile), "r").read()
- for macro in macros.keys():
- if abbr.find(macro) >= 0:
- abbr = abbr.replace(macro, macros[macro]())
- abbr = abbr.replace("\n", "\r")
- # Put into paste mode and take out of paste mode
- abbr = "iab %s \x1b:set paste\ri%s\x1b:set nopaste\r" % (abbrfile.rsplit('.', 1)[0], abbr)
- if abbr.find("___") >= 0:
- # Then search for ___ to place the cursor there
- abbr += "gg\r/___\x1b:nohlsearch\n"
- else:
- # Leave the cursor in insert mode
- abbr += "a\n"
- outfile.write(abbr)
+ abbr = open(os.path.join(abbrsdir, abbrfile), "r").read()
+ for macro in macros.keys():
+ if abbr.find(macro) >= 0:
+ abbr = abbr.replace(macro, macros[macro]())
+ abbr = abbr.replace("\n", "\r")
+ # Put into paste mode and take out of paste mode
+ abbr = "iab %s \x1b:set paste\ri%s\x1b:set nopaste\r" % (abbrfile.rsplit('.', 1)[0], abbr)
+ if abbr.find("___") >= 0:
+ # Then search for ___ to place the cursor there
+ abbr += "gg\r/___\x1b:nohlsearch\n"
+ else:
+ # Leave the cursor in insert mode
+ abbr += "a\n"
+ outfile.write(abbr)
" often as you need.
function! ToggleCommentify()
- let lineString = getline(".")
- if strlen(lineString) == 0
- " don't comment empty lines
- return
- endif
+ let lineString = getline(".")
+ if strlen(lineString) == 0
+ " don't comment empty lines
+ return
+ endif
- let isCommented = strpart(lineString,0,3)
- let commentSymbol = ''
-
- let commentMapping = {
- \'###': [
- \'conf',
- \'debsources',
- \'exports',
- \'fstab',
- \'make',
- \'mplayerconf',
- \'muttrc',
- \'perl',
- \'procmail',
- \'python',
- \'readline',
- \'ruby',
- \'screen',
- \'sh',
- \'sshconfig',
- \'sudoers',
- \'terminfo',
- \'vrml',
- \'xf86conf',
- \],
+ let isCommented = strpart(lineString,0,3)
+ let commentSymbol = ''
+
+ let commentMapping = {
+ \'###': [
+ \'conf',
+ \'debsources',
+ \'exports',
+ \'fstab',
+ \'make',
+ \'mplayerconf',
+ \'muttrc',
+ \'perl',
+ \'procmail',
+ \'python',
+ \'readline',
+ \'ruby',
+ \'screen',
+ \'sh',
+ \'sshconfig',
+ \'sudoers',
+ \'terminfo',
+ \'vrml',
+ \'xf86conf',
+ \],
\
- \'///': [
- \'c',
- \'cpp',
- \'java',
- \'javascript',
- \'objc',
- \'ox',
- \'php',
- \],
+ \'///': [
+ \'c',
+ \'cpp',
+ \'java',
+ \'javascript',
+ \'objc',
+ \'ox',
+ \'php',
+ \],
\
- \'"""': [
- \'vim',
- \],
+ \'"""': [
+ \'vim',
+ \],
\
- \'!!!': [
- \'xdefaults',
- \],
+ \'!!!': [
+ \'xdefaults',
+ \],
\
- \'%%%': [
- \'matlab',
- \'tex',
- \],
+ \'%%%': [
+ \'matlab',
+ \'tex',
+ \],
\
- \'---': [
- \'sql',
- \'haskell',
- \]
- \}
+ \'---': [
+ \'sql',
+ \'haskell',
+ \]
+ \}
- for commentChar in keys(commentMapping)
- for name in commentMapping[commentChar]
- if &filetype == name
- let commentSymbol = commentChar
- endif
- endfor
- endfor
+ for commentChar in keys(commentMapping)
+ for name in commentMapping[commentChar]
+ if &filetype == name
+ let commentSymbol = commentChar
+ endif
+ endfor
+ endfor
- if commentSymbol == ''
- execute 'echo "ToggleCommentify has not (yet) been implemented for the file-type " . &filetype'
- else
- if isCommented == commentSymbol
- " if the line is already commented, uncomment
- call UnCommentify(commentSymbol)
- else
- " if the line is uncommented, comment
- call Commentify(commentSymbol)
- endif
- endif
+ if commentSymbol == ''
+ execute 'echo "ToggleCommentify has not (yet) been implemented for the file-type " . &filetype'
+ else
+ if isCommented == commentSymbol
+ " if the line is already commented, uncomment
+ call UnCommentify(commentSymbol)
+ else
+ " if the line is uncommented, comment
+ call Commentify(commentSymbol)
+ endif
+ endif
endfunction
function! Commentify(commentSymbol)
- execute ':s+^+'.a:commentSymbol.'+'
- nohlsearch
+ execute ':s+^+'.a:commentSymbol.'+'
+ nohlsearch
endfunction
-
+
function! UnCommentify(commentSymbol)
- execute ':s+'.a:commentSymbol.'++'
- nohlsearch
+ execute ':s+'.a:commentSymbol.'++'
+ nohlsearch
endfunction
" Toggle wordwrap
function WrapToggle()
- if &wrap
- call WrapOff()
- echo "Word wrap off"
- else
- call WrapOn()
- echo "Word wrap on"
- endif
+ if &wrap
+ call WrapOff()
+ echo "Word wrap off"
+ else
+ call WrapOn()
+ echo "Word wrap on"
+ endif
endfunction
" Turn word wrap off, reset arrows, home, end, etc to default bindings
function WrapOff()
- setlocal nowrap
- " Go up and down by physical linebreaks when not wordwrapped
- iunmap <buffer> <End>
- iunmap <buffer> <Home>
- iunmap <buffer> <Down>
- iunmap <buffer> <Up>
- nunmap <buffer> <Down>
- nunmap <buffer> <Up>
- nunmap <buffer> <End>
- nunmap <buffer> <Home>
- nunmap <buffer> 0
- nunmap <buffer> ^
- nunmap <buffer> $
- vunmap <buffer> <Down>
- vunmap <buffer> <Up>
- vunmap <buffer> <End>
- vunmap <buffer> <Home>
- vunmap <buffer> 0
- vunmap <buffer> ^
- vunmap <buffer> $
- " Allow only backspace & space
- set whichwrap=b,s
+ setlocal nowrap
+ " Go up and down by physical linebreaks when not wordwrapped
+ iunmap <buffer> <End>
+ iunmap <buffer> <Home>
+ iunmap <buffer> <Down>
+ iunmap <buffer> <Up>
+ nunmap <buffer> <Down>
+ nunmap <buffer> <Up>
+ nunmap <buffer> <End>
+ nunmap <buffer> <Home>
+ nunmap <buffer> 0
+ nunmap <buffer> ^
+ nunmap <buffer> $
+ vunmap <buffer> <Down>
+ vunmap <buffer> <Up>
+ vunmap <buffer> <End>
+ vunmap <buffer> <Home>
+ vunmap <buffer> 0
+ vunmap <buffer> ^
+ vunmap <buffer> $
+ " Allow only backspace & space
+ set whichwrap=b,s
endfunction
" Turn word wrapping on and bind arrows, home, end, etc to display lines
function WrapOn()
- setlocal wrap
- " Go up and down by display lines, not linebreaks when wordwrapped
- imap <buffer> <End> <C-o>g$
- imap <buffer> <Home> <C-o>g0
- imap <buffer> <Down> <C-o>gj
- imap <buffer> <Up> <C-o>gk
- nmap <buffer> <Down> gj
- nmap <buffer> <Up> gk
- nmap <buffer> <End> g$
- nmap <buffer> <Home> g0
- nmap <buffer> 0 g0
- nmap <buffer> ^ g^
- nmap <buffer> $ g$
- vmap <buffer> <Down> gj
- vmap <buffer> <Up> gk
- vmap <buffer> <End> g$
- vmap <buffer> <Home> g0
- vmap <buffer> 0 g0
- vmap <buffer> ^ g^
- vmap <buffer> $ g$
- " Allow backspace, space, left/right keys to move across lines
- set whichwrap=b,s,<,>,[,]
+ setlocal wrap
+ " Go up and down by display lines, not linebreaks when wordwrapped
+ imap <buffer> <End> <C-o>g$
+ imap <buffer> <Home> <C-o>g0
+ imap <buffer> <Down> <C-o>gj
+ imap <buffer> <Up> <C-o>gk
+ nmap <buffer> <Down> gj
+ nmap <buffer> <Up> gk
+ nmap <buffer> <End> g$
+ nmap <buffer> <Home> g0
+ nmap <buffer> 0 g0
+ nmap <buffer> ^ g^
+ nmap <buffer> $ g$
+ vmap <buffer> <Down> gj
+ vmap <buffer> <Up> gk
+ vmap <buffer> <End> g$
+ vmap <buffer> <Home> g0
+ vmap <buffer> 0 g0
+ vmap <buffer> ^ g^
+ vmap <buffer> $ g$
+ " Allow backspace, space, left/right keys to move across lines
+ set whichwrap=b,s,<,>,[,]
endfunction
" Toggle show invisible characters
function InvShow()
- if &list
- echo "Invisible characters off"
- set nolist
- else
- echo "Invisible characters on"
- set listchars=tab:.\ ,trail:!
- set list
- endif
+ if &list
+ echo "Invisible characters off"
+ set nolist
+ else
+ echo "Invisible characters on"
+ set listchars=tab:.\ ,trail:!
+ set list
+ endif
endfunction
" Spell checking mode toggle
function ToggleSpelling()
- if !exists("s:spell_check") || s:spell_check == 0
- echo "Spell check on"
- let s:spell_check = 1
- setlocal spell spelllang=en_au
- else
- echo "Spell check off"
- let s:spell_check = 0
- setlocal spell spelllang=
- endif
+ if !exists("s:spell_check") || s:spell_check == 0
+ echo "Spell check on"
+ let s:spell_check = 1
+ setlocal spell spelllang=en_au
+ else
+ echo "Spell check off"
+ let s:spell_check = 0
+ setlocal spell spelllang=
+ endif
endfunction
" Save using sudo
function SudoWriteFunction()
- :w !sudo tee %
- :e!
+ :w !sudo tee %
+ :e!
endfunction
set backup
" create ~/tmp/vimbak if it doesn't exist and use it to save the backups
if has("unix")
- if !isdirectory(expand("~/tmp/vimbak/."))
- !mkdir -p ~/tmp/vimbak
- endif
- set backupdir=~/tmp/vimbak
+ if !isdirectory(expand("~/tmp/vimbak/."))
+ !mkdir -p ~/tmp/vimbak
+ endif
+ set backupdir=~/tmp/vimbak
endif
" Create backups by copying files to backup directory instead of renaming
source ~/.vim/commenter.vim
source ~/.vim/filetypes.vim
if !filereadable(expand("~/.vim/abbrsout.vim"))
- !python ~/.vim/abbrs2vim.py
+ !python ~/.vim/abbrs2vim.py
endif
source ~/.vim/abbrsout.vim
if filereadable(expand("~/.vim/local.vim"))
- source ~/.vim/local.vim
+ source ~/.vim/local.vim
endif
Config {
- font = "xft:sans-serif:size=10",
- bgColor = "#edeceb",
- fgColor = "black",
- position = TopSize L 80 20,
- commands = [
- Run Cpu ["-t","Cpu:<total>%","-L","3","-H","50","--high","red","-p","3"] 10,
- Run Memory ["-t","Mem:<usedratio>%","-p","3"] 10,
- Run BatteryP ["BAT1"] ["-t","Batt: <acstatus><left>%","-L","25","--low","red","--","-O","+","-o","-","-f","ADP1/online"] 10,
- Run StdinReader
- ],
- sepChar = "%",
- alignSep = "}{",
- template = "%StdinReader% }{ %cpu% | %memory% | %battery% ",
- lowerOnStart = False
+ font = "xft:sans-serif:size=10",
+ bgColor = "#edeceb",
+ fgColor = "black",
+ position = TopSize L 80 20,
+ commands = [
+ Run Cpu ["-t","Cpu:<total>%","-L","3","-H","50","--high","red","-p","3"] 10,
+ Run Memory ["-t","Mem:<usedratio>%","-p","3"] 10,
+ Run BatteryP ["BAT1"] ["-t","Batt: <acstatus><left>%","-L","25","--low","red","--","-O","+","-o","-","-f","ADP1/online"] 10,
+ Run StdinReader
+ ],
+ sepChar = "%",
+ alignSep = "}{",
+ template = "%StdinReader% }{ %cpu% | %memory% | %battery% ",
+ lowerOnStart = False
}
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
- [
- ((modm .|. shiftMask, xK_h), spawn "xfce4-session-logout"),
- ((modm .|. shiftMask, xK_l), spawn "xscreensaver-command --lock"),
-
- ((modm, xK_n), spawn "xfce4-terminal"),
- ((modm, xK_i), spawn "firefox"),
- ((modm, xK_p), spawn "kupfer"),
-
- ((modm .|. shiftMask, xK_c ), kill),
- ((modm, xK_space ), sendMessage NextLayout),
- ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf),
- ((modm, xK_Tab ), windows W.focusDown),
- ((modm, xK_j ), windows W.focusDown),
- ((modm, xK_k ), windows W.focusUp ),
- ((modm, xK_m ), windows W.focusMaster ),
- ((modm, xK_Return), windows W.swapMaster),
- ((modm .|. shiftMask, xK_j ), windows W.swapDown ),
- ((modm .|. shiftMask, xK_k ), windows W.swapUp ),
- ((modm, xK_h ), sendMessage Shrink),
- ((modm, xK_l ), sendMessage Expand),
- ((modm, xK_t ), withFocused $ windows . W.sink),
- ((modm , xK_comma ), sendMessage (IncMasterN 1)),
- ((modm , xK_period), sendMessage (IncMasterN (-1))),
- ((modm , xK_b ), sendMessage ToggleStruts),
- ((modm , xK_z ), sendMessage Mag.Toggle)
- ]
- ++
-
- -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
- -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
- [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
- | (key, sc) <- zip [xK_o, xK_e, xK_u] [0..]
- , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]
- ]
- ++
-
- -- mod-[1..9], Switch to workspace N
- -- mod-shift-[1..9], Move client to workspace N
- [((m .|. modm, k), windows $ f i)
- | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
- , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
- ]
+ [
+ ((modm .|. shiftMask, xK_h), spawn "xfce4-session-logout"),
+ ((modm .|. shiftMask, xK_l), spawn "xscreensaver-command --lock"),
+
+ ((modm, xK_n), spawn "xfce4-terminal"),
+ ((modm, xK_i), spawn "firefox"),
+ ((modm, xK_p), spawn "kupfer"),
+
+ ((modm .|. shiftMask, xK_c ), kill),
+ ((modm, xK_space ), sendMessage NextLayout),
+ ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf),
+ ((modm, xK_Tab ), windows W.focusDown),
+ ((modm, xK_j ), windows W.focusDown),
+ ((modm, xK_k ), windows W.focusUp ),
+ ((modm, xK_m ), windows W.focusMaster ),
+ ((modm, xK_Return), windows W.swapMaster),
+ ((modm .|. shiftMask, xK_j ), windows W.swapDown ),
+ ((modm .|. shiftMask, xK_k ), windows W.swapUp ),
+ ((modm, xK_h ), sendMessage Shrink),
+ ((modm, xK_l ), sendMessage Expand),
+ ((modm, xK_t ), withFocused $ windows . W.sink),
+ ((modm , xK_comma ), sendMessage (IncMasterN 1)),
+ ((modm , xK_period), sendMessage (IncMasterN (-1))),
+ ((modm , xK_b ), sendMessage ToggleStruts),
+ ((modm , xK_z ), sendMessage Mag.Toggle)
+ ]
+ ++
+
+ -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
+ -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
+ [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
+ | (key, sc) <- zip [xK_o, xK_e, xK_u] [0..]
+ , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]
+ ]
+ ++
+
+ -- mod-[1..9], Switch to workspace N
+ -- mod-shift-[1..9], Move client to workspace N
+ [((m .|. modm, k), windows $ f i)
+ | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
+ , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
+ ]
avoidMaster = W.modify' $ \c -> case c of
- W.Stack t [] (r:rs) -> W.Stack t [r] rs
- otherwise -> c
+ W.Stack t [] (r:rs) -> W.Stack t [r] rs
+ otherwise -> c
isTransient = ask >>= \w -> liftX $ do
- r <- getProp32s "WM_TRANSIENT_FOR" w
- return $ case r of
- Just [_] -> True
- _ -> False
+ r <- getProp32s "WM_TRANSIENT_FOR" w
+ return $ case r of
+ Just [_] -> True
+ _ -> False
isSkipTaskBar = isInProperty "_NET_WM_STATE" "_NET_WM_STATE_SKIP_TASKBAR"
myManageHook =
- manageDocks <+>
- composeOne [
- (className =? "Firefox" <&&> resource =? "Navigator" <&&> currentWs =? "1") -?> (doShift "2"),
- (className =? "Kupfer.py" <&&> resource =? "kupfer.py") -?> doFloat,
- (className =? "Xfce4-appfinder" <&&> resource =? "xfce4-appfinder") -?> doFloatAt 0.1 0.1,
- (isSkipTaskBar -?> doFloat),
- (isDialog -?> doFloatAt 0.1 0.1),
- (isTransient -?> doFloatAt 0.1 0.1),
- (isFullscreen -?> doFullFloat),
- (fmap Just $ doF avoidMaster)
- ]
+ manageDocks <+>
+ composeOne [
+ (className =? "Firefox" <&&> resource =? "Navigator" <&&> currentWs =? "1") -?> (doShift "2"),
+ (className =? "Kupfer.py" <&&> resource =? "kupfer.py") -?> doFloat,
+ (className =? "Xfce4-appfinder" <&&> resource =? "xfce4-appfinder") -?> doFloatAt 0.1 0.1,
+ (isSkipTaskBar -?> doFloat),
+ (isDialog -?> doFloatAt 0.1 0.1),
+ (isTransient -?> doFloatAt 0.1 0.1),
+ (isFullscreen -?> doFullFloat),
+ (fmap Just $ doF avoidMaster)
+ ]
myWorkspaces = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
myPP = xmobarPP
- {
- ppCurrent = xmobarColor "#A01010" "" . wrap "[" "]",
- ppTitle = xmobarColor "#10A010" ""
- }
+ {
+ ppCurrent = xmobarColor "#A01010" "" . wrap "[" "]",
+ ppTitle = xmobarColor "#10A010" ""
+ }
myLogHook h1 h2 =
- dynamicLogWithPP myPP { ppOutput = hPutStrLn h1 } >>
- dynamicLogWithPP myPP { ppOutput = hPutStrLn h2 } >>
- takeTopFocus -- fix for Java Swing apps
+ dynamicLogWithPP myPP { ppOutput = hPutStrLn h1 } >>
+ dynamicLogWithPP myPP { ppOutput = hPutStrLn h2 } >>
+ takeTopFocus -- fix for Java Swing apps
myStartupHook =
- setWMName "LG3D" -- fix for Java Swing apps
+ setWMName "LG3D" -- fix for Java Swing apps
goldenRatio = (toRational (2/(1+sqrt(5)::Double)))
myTitleTheme = defaultTheme {
- fontName = "xft:sans-serif:size=10",
- decoHeight = 22
- }
+ fontName = "xft:sans-serif:size=10",
+ decoHeight = 22
+ }
createLayout name layout =
- renamed [Replace name] $
- layoutHints $
- smartBorders $
- layout
+ renamed [Replace name] $
+ layoutHints $
+ smartBorders $
+ layout
myFullLayout = createLayout "Full" $
- Full
+ Full
myTiledLayout = createLayout "Tall" $
- avoidStruts $
- Mag.magnifierOff $
- Tall nMaster ratioIncrement masterRatio
- where
- nMaster = 1
- ratioIncrement = 3/100
- masterRatio = goldenRatio
+ avoidStruts $
+ Mag.magnifierOff $
+ Tall nMaster ratioIncrement masterRatio
+ where
+ nMaster = 1
+ ratioIncrement = 3/100
+ masterRatio = goldenRatio
myTabbedLayout = createLayout "Tab" $
- avoidStruts $
- tabbed shrinkText myTitleTheme
+ avoidStruts $
+ tabbed shrinkText myTitleTheme
myThreeColLayout = createLayout "ThreeCol" $
- avoidStruts $
- Mag.magnifierOff $
- ThreeCol numMaster resizeDelta masterRatio
- where
- resizeDelta = 3/100
- masterRatio = 4/10
- numMaster = 1
+ avoidStruts $
+ Mag.magnifierOff $
+ ThreeCol numMaster resizeDelta masterRatio
+ where
+ resizeDelta = 3/100
+ masterRatio = 4/10
+ numMaster = 1
myMasterTabbedLayout = createLayout "MTab" $
- avoidStruts $
- Mag.magnifierOff $
- mastered resizeDelta masterRatio $
- tabbed shrinkText myTitleTheme
- where
- resizeDelta = 3/100
- masterRatio = goldenRatio
+ avoidStruts $
+ Mag.magnifierOff $
+ mastered resizeDelta masterRatio $
+ tabbed shrinkText myTitleTheme
+ where
+ resizeDelta = 3/100
+ masterRatio = goldenRatio
myImLayout = createLayout "IM" $
- avoidStruts $
- noFrillsDeco shrinkText myTitleTheme $
- withIM rosterRatio roster $
- myTiledLayout
---- myThreeColLayout -- use this on wider screens
- where
- rosterRatio = 1/8
- roster = (Or (Title "Buddy List") (And (Resource "main") (ClassName "psi")))
+ avoidStruts $
+ noFrillsDeco shrinkText myTitleTheme $
+ withIM rosterRatio roster $
+ myTiledLayout
+--- myThreeColLayout -- use this on wider screens
+ where
+ rosterRatio = 1/8
+ roster = (Or (Title "Buddy List") (And (Resource "main") (ClassName "psi")))
myGimpLayout = createLayout "Gimp" $
- avoidStruts $
- withIM (1/6) (Role "gimp-toolbox") $
- reflectHoriz $
- withIM (1/6) (Role "gimp-dock") $
- reflectHoriz $
- tabbed shrinkText myTitleTheme
+ avoidStruts $
+ withIM (1/6) (Role "gimp-toolbox") $
+ reflectHoriz $
+ withIM (1/6) (Role "gimp-dock") $
+ reflectHoriz $
+ tabbed shrinkText myTitleTheme
-- This was the easiest way I found to avoid a compile error when I have
-- an unused layout
referenceAllLayoutsToAvoidErrors =
- myFullLayout |||
- myTiledLayout |||
- myTabbedLayout |||
- myThreeColLayout |||
- myMasterTabbedLayout |||
- myImLayout |||
- myGimpLayout
+ myFullLayout |||
+ myTiledLayout |||
+ myTabbedLayout |||
+ myThreeColLayout |||
+ myMasterTabbedLayout |||
+ myImLayout |||
+ myGimpLayout
myLayout =
- (
- onWorkspace "1" (myImLayout) $
- onWorkspace "2" (myTabbedLayout ||| myMasterTabbedLayout) $
- onWorkspace "9" (myFullLayout ||| myMasterTabbedLayout ||| myTabbedLayout ||| myTiledLayout ||| myGimpLayout) $
- (myMasterTabbedLayout ||| myTabbedLayout ||| myTiledLayout)
- )
+ (
+ onWorkspace "1" (myImLayout) $
+ onWorkspace "2" (myTabbedLayout ||| myMasterTabbedLayout) $
+ onWorkspace "9" (myFullLayout ||| myMasterTabbedLayout ||| myTabbedLayout ||| myTiledLayout ||| myGimpLayout) $
+ (myMasterTabbedLayout ||| myTabbedLayout ||| myTiledLayout)
+ )
main = do
- xmonadDir <- getXMonadDir
- xmobar <- spawnPipe ("xmobar " ++ xmonadDir ++ "/xmobar.hs")
- xmobar2 <- spawnPipe ("xmobar -x 1 " ++ xmonadDir ++ "/xmobar.hs")
- xmonad $ ewmh defaultConfig {
- manageHook = myManageHook,
- layoutHook = myLayout,
- workspaces = myWorkspaces,
- logHook = myLogHook xmobar xmobar2,
- startupHook = myStartupHook,
- keys = myKeys
- }
+ xmonadDir <- getXMonadDir
+ xmobar <- spawnPipe ("xmobar " ++ xmonadDir ++ "/xmobar.hs")
+ xmobar2 <- spawnPipe ("xmobar -x 1 " ++ xmonadDir ++ "/xmobar.hs")
+ xmonad $ ewmh defaultConfig {
+ manageHook = myManageHook,
+ layoutHook = myLayout,
+ workspaces = myWorkspaces,
+ logHook = myLogHook xmobar xmobar2,
+ startupHook = myStartupHook,
+ keys = myKeys
+ }
your system.
Install Git:
- $ sudo aptitude install git-core
+ $ sudo aptitude install git-core
Change into your home directory and make a clone of the repository:
- $ cd
- $ git clone http://delx.net.au/git/dotfiles .dotfiles
+ $ cd
+ $ git clone http://delx.net.au/git/dotfiles .dotfiles
Make a backup of any existing files:
- $ mkdir backup
- $ mv .bash .bash_profile .bashrc .gitconfig .hgrc .inputrc .pythonrc.py .screenrc .terminfo .vim .vimrc backup/
+ $ mkdir backup
+ $ mv .bash .bash_profile .bashrc .gitconfig .hgrc .inputrc .pythonrc.py .screenrc .terminfo .vim .vimrc backup/
Symlink the config files into your home directory:
- $ ln -sf .dotfiles/{.bash,.bash_profile,.bashrc,.gitconfig,.hgrc,.inputrc,.pythonrc.py,.screenrc,.terminfo,.vim,.vimrc} .
- $ ln -s .dotfiles/.ssh/config .ssh/
+ $ ln -sf .dotfiles/{.bash,.bash_profile,.bashrc,.gitconfig,.hgrc,.inputrc,.pythonrc.py,.screenrc,.terminfo,.vim,.vimrc} .
+ $ ln -s .dotfiles/.ssh/config .ssh/
You can add machine specific configs to the bash init scripts by creating files
import binascii, sys
if len(sys.argv) == 2:
- input = sys.argv[1]
+ input = sys.argv[1]
else:
- input = sys.stdin.read()
+ input = sys.stdin.read()
print binascii.unhexlify(hex(int(input, 2))[2:])
rows = list(csv.reader(sys.stdin))
column_widths = list(max((len(str(cell))) for cell in column) for column in zip(*rows))
for row in rows:
- for width, cell in zip(column_widths, row):
- print str(cell).ljust(width),
- print
+ for width, cell in zip(column_widths, row):
+ print str(cell).ljust(width),
+ print
"
for tz in $list; do
- printf "%-25s" "$tz"
- TZ="$tz" date
- echo
+ printf "%-25s" "$tz"
+ TZ="$tz" date
+ echo
done
#!/bin/bash
if [ -z "$1" -o -z "$2" ]; then
- echo "Usage: $0 src dest"
- exit 1
+ echo "Usage: $0 src dest"
+ exit 1
fi
src="$1"
cd "$src"
find . -name '*.class' | while read line; do
- class="$(echo "$line"| sed -e 's|^\./||' -e 's|\.class$||' -e 's|/|.|g')"
- javap -private -c "$class" > "${dest}/${class}.txt"
+ class="$(echo "$line"| sed -e 's|^\./||' -e 's|\.class$||' -e 's|/|.|g')"
+ javap -private -c "$class" > "${dest}/${class}.txt"
done