From a18342f7751c11fadd0417f6808744383cb8532b Mon Sep 17 00:00:00 2001 From: Christopher Hall Date: Tue, 22 Dec 2009 09:50:57 +0800 Subject: [PATCH] Initial creation of dotfiles repository Signed-off-by: Christopher Hall --- bash_aliases | 53 ++++++++++ git-global-ignore | 15 +++ gitconfig | 109 ++++++++++++++++++++ install.sh | 72 +++++++++++++ joverc | 21 ++++ tcshrc | 251 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 521 insertions(+) create mode 100644 bash_aliases create mode 100644 git-global-ignore create mode 100644 gitconfig create mode 100755 install.sh create mode 100644 joverc create mode 100644 tcshrc diff --git a/bash_aliases b/bash_aliases new file mode 100644 index 0000000..dd89bd9 --- /dev/null +++ b/bash_aliases @@ -0,0 +1,53 @@ +# .bash_aliases + +alias ll='ls -l' +alias la='ls -A' +alias lc='ls -CF' + +# gnu diff does not have DIFFOPTIONS like FreeBSD so: +alias diff='diff -u' + +alias reb='find . -name \*~ -print -delete' + +export LESS="-iR" + +if which eie > /dev/null 2>&1 +then + alias edit="eie --no-frame" + alias ed="eie --no-wait" + export EDITOR="eie" +elif which jove > /dev/null 2>&1 +then + alias edit="jove" + alias ed="jove" + export EDITOR="jove" +fi + +# give lynx a custom configuration +alias lynx='lynx -nopause' + +mkcd() +{ + local dir + dir="$1"; shift + + if [ -z "${dir}" ] + then + pwd + elif [ -d "${dir}" ] + then + cd "${dir}" + elif [ -f "${dir}" ] + then + echo A file of that name already exists + return 1 + else + mkdir -p "${dir}" + cd "${dir}" + fi + return 0 +} + +if [ -f ~/.bash_aliases_extra ]; then + . ~/.bash_aliases_extra +fi diff --git a/git-global-ignore b/git-global-ignore new file mode 100644 index 0000000..8115670 --- /dev/null +++ b/git-global-ignore @@ -0,0 +1,15 @@ +# .git-global-ignore + +# ignore emacs backups +*~ + +# object files +*.o + +# library files +*.so +*.a + +# other repositories +CVS +.svn diff --git a/gitconfig b/gitconfig new file mode 100644 index 0000000..b500baa --- /dev/null +++ b/gitconfig @@ -0,0 +1,109 @@ +# .gitconfig + +[user] + email = @EMAIL@ + name = @NAME@ + +[alias] + ci = commit --signoff + co = checkout + st = status + br = branch + praise = blame + sa = stash apply + sc = stash clear + ss = stash save + + l1 = !git --no-pager log --max-count=1 HEAD + l3 = !git --no-pager log --max-count=3 HEAD + l5 = log --max-count=5 HEAD + +# git-svn commands +# ================ + + up = svn rebase + dc = svn dcommit + +# handling a local transient branch +# ================================= + +# the intended sequence is: +# git co master # if not already there +# git pull # update +# git today # create local today branch +# while work +# edit ${file} +# git add ${file} +# git ci +# gitk # see the state +# git fetch +# git rebase master +# git tidy # more than once +# git done + + today = checkout -b today + tidy = rebase -i master + done = rebase today master + +# rewrite history +# =============== + + last10 = rebase -i HEAD~10 + last5 = rebase -i HEAD~5 + last2 = rebase -i HEAD~2 + last1 = rebase -i HEAD + + # and the last 10 commits will appear in your favourite $EDITOR. A sample excerpt: + # pick 5c6eb73 Added repo.or.cz link + # pick a311a64 Reordered analogies in "Work How You Want" + # pick 100834f Added push target to Makefile + + # Then: + # Remove commits by deleting lines. + # Reorder commits by reordering lines. + # Replace "pick" with "edit" to mark a commit for amending. + # Replace "pick" with "squash" to merge a commit with the previous one. + + # If you marked a commit for editing, then run: + amend = commit --amend + + # otherwise, run: + cont = rebase --continue + + +# sending patches +# =============== + + fp = format-patch -C +# sm = send-email --compose --no-chain-reply-to --suppress-from --to list@project.tld 00*.patch + sm = send-email --compose --no-chain-reply-to --suppress-from --bcc @EMAIL@ + + +[sendemail] +# identity +# aliasesfile +# aliasfiletype +# to = devel@lists.openmoko.org +# cccmd + bcc = @EMAIL@ + chainreplyto = false +# smtpserver = +# smtpuser = +# smtppass = + smtpssl = false + +[apply] + whitespace = strip + +[diff] + color = auto + rename = copy + +[pager] + color = true + +[status] + color = auto + +[core] + excludesfile = @HOME@.git-global-ignore diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..c2903bb --- /dev/null +++ b/install.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +list_sed='' +list_copy='' + +SED() +{ + list_sed="${list_sed} $*" +} + +COPY() +{ + list_copy="${list_copy} $*" +} + +# list the files to install +# SED substitutes @NAME@ type of entries +# COPY just copies the file + +SED gitconfig + +COPY bashrc +COPY joverc +COPY tcshrc + + +# end of list +# =========== + +ERROR() +{ + echo error: $* 1>&2 + exit 1 +} + +# get a string escaping / & for later sed substitution +# usage: var=$(get prompt message here) || exit 1 +# note: need the exit as the ERROR only terminates the $() sub-shell +get() +{ + local prompt data + read -p "$*: " -r data + [ -z "${data}" ] && ERROR field cannot be blank + printf '%s' "${data}" | sed 's/\\/\\\\/g;s,/,\\/,g;s,&,\\\&,g' +} + + +# main +# ==== + +echo this will install the files to: ${HOME} +echo Ctrl-C to abort + + +echo Enter some data for substitutions + +name=$(get Enter full name) || exit 1 +email=$(get Enter email address) || exit 1 + +for f in ${list_sed} +do + d="${HOME}/.${f}" + echo Substitute ${f} to ${d} + sed "s,@HOME@,${HOME}/,g;s/@EMAIL@/${email}/g;s/@NAME@/${name}/g;" "${f}" Z "${d}" +done + +for f in ${list_copy} +do + d="${HOME}/.${f}" + echo Copy ${f} to ${d} + cp -p "${f}" "${d}" +done diff --git a/joverc b/joverc new file mode 100644 index 0000000..fb46f37 --- /dev/null +++ b/joverc @@ -0,0 +1,21 @@ +# .joverc + +bind-to-key beginning-of-line ^[OH +bind-to-key beginning-of-line ^[[1~ +bind-to-key end-of-line ^[OF +bind-to-key end-of-line ^[[4~ + +bind-to-key delete-next-character ^[[3~ +bind-to-key save-file ^[OQ +bind-to-key save-file ^[[[B +bind-to-key delete-buffer ^[OR +bind-to-key delete-buffer ^[[[C +bind-to-key exit-jove ^[[23~ +bind-to-key execute-kbd-macro ^[[19~ + +bind-to-key query-replace-string ^[% + +bind-to-key previous-page ^[[5~ +bind-to-key next-page ^[[6~ + +set case-ignore-search on diff --git a/tcshrc b/tcshrc new file mode 100644 index 0000000..5c75037 --- /dev/null +++ b/tcshrc @@ -0,0 +1,251 @@ +# .tcshrc + +# A righteous umask +umask 22 + +# KDE sets IFS to a spurious value +unsetenv IFS + +# basic stuff + +#set path = ($HOME/bin /sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin /usr/X11R6/bin) +set path = ($HOME/bin /sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin) + +# lang should be set be login.conf or ~/.login_conf +#setenv LANG "en_GB.UTF-8" +#setenv LC_ALL "${LANG}" + +#give lynx a custom configuration +alias lynx 'lynx -nopause -cfg=~/.lynxcfg' + +# Remove Emacs Backups +alias reb 'find . -name "*~" -print -exec rm -f {} \;' + +# make a directory and change to it +alias mkcd 'mkdir -p \!:1; cd \!:1' + +switch (`uname -s`) +case "NetBSD": + alias la 'ls -la' + alias ll 'ls -l' + alias lc 'ls -CF' + setenv DIFF_OPTIONS -urN + set path = ($HOME/bin /sbin /bin /usr/sbin /usr/bin /usr/pkg/sbin /usr/pkg/bin /usr/X11R6/bin) + breaksw +case "FreeBSD": + alias la 'ls -laG' + alias ll 'ls -lG' + alias lc 'ls -CFG' + alias lycd 'lynx /host/localhost/cd/' + alias lycf 'lynx /host/localhost/cf/' + setenv DIFF_OPTIONS -urN + setenv GREP_OPTIONS --colour=auto + breaksw +case "Linux": + alias la 'ls -la --color=auto' + alias ll 'ls -l --color=auto' + alias lc 'ls -CF --color=auto' + alias diff 'diff -urN' + setenv GREP_OPTIONS --colour=auto + breaksw +case "SunOS": + alias la 'ls -la' + alias ll 'ls -l' + alias lc 'ls -CF' + alias diff 'diff -ur' + breaksw +default: + echo Unrecognised system: \"`uname -s`\" +endsw + + +# some other users (the cd . uses the special alias to reset xterm title) +setenv am_root "NO" +which whoami >/dev/null +if ($? == 0) then + if (`whoami` == root) then + setenv am_root "YES" + endif +endif + +if ("${am_root}" == "NO") then + switch (`uname -s`) + case "NetBSD": + case "FreeBSD": +# alias toor 'su -l toor; cd .' + alias toor 'exec su -l toor' + alias root 'exec su -l root' + breaksw + case "Linux": + alias toor 'exec su - toor' + alias root 'exec su - root' + breaksw + case "SunOS": + alias toor 'exec su - toor' + alias root 'exec su - root -c /bin/bash' + breaksw + endsw +endif +unsetenv am_root + +alias su 'su \!* ; cd .' + +#if (-x `which xcin`) then +# setenv XMODIFIERS "@im=xcin" +# setenv LC_ALL zh_TW.Big5 +#endif + +alias edit "eie --no-frame" +alias ed "eie --no-wait" +setenv EDITOR "eie" + +foreach value (less more zile ex) + setenv PAGER `which $value` + if (-x "$PAGER") then + if ($value != less) then + alias less "$PAGER" + endif + break + endif +end + +setenv BLOCKSIZE M + +setenv LESS '-i -R' +setenv LYNX CFG=~/.lynxcfg +foreach certdir (/usr/certs /usr/local/certs) + if (-d "$certdir") then + setenv SSL_CERT_DIR $certdir + endif +end + +# cvs environment + +#setenv CVSROOT /home/ncvs +setenv CVS_RSH `which ssh` + + +# text processing + +setenv SGML_ROOT /usr/local/share/sgml +setenv SGML_CATALOG_FILES ${SGML_ROOT}/jade/catalog +setenv SGML_CATALOG_FILES ${SGML_ROOT}/iso8879/catalog:$SGML_CATALOG_FILES +setenv SGML_CATALOG_FILES ${SGML_ROOT}/html/catalog:$SGML_CATALOG_FILES +setenv SGML_CATALOG_FILES ${SGML_ROOT}/docbook/catalog:$SGML_CATALOG_FILES +setenv SGML_CATALOG_FILES /usr/doc/share/sgml/catalog:$SGML_CATALOG_FILES + + +if (-x `which kpsexpand` && -d ${HOME}/sgml) then + #setenv SGML_PATH /usr/local/share/sgml:${HOME}/sgml + setenv SGML_CATALOG_FILES ${SGML_ROOT}/linuxdoc/catalog:$SGML_CATALOG_FILES + setenv SGML_CATALOG_FILES ${HOME}/sgml/CATALOG:$SGML_CATALOG_FILES + setenv TEXINPUTS .:${HOME}/sgml/latex:${HOME}/latex:`kpsexpand -n latex -p tex` + # ${HOME}/latex/graphics:/usr/local/share/texmf/tex:/usr/local/share/texmf/tex/latex + setenv TPT_LIB ${HOME}/sgml/transpec +endif + + +# for my pcemu/dos comand line compilers + +if (-d ~/dos) then + setenv DOS_STARTUP_DRIVE D: + setenv DOS_STARTUP_DIRECTORY ~/dos + setenv DOS_DATA_DRIVE E: + setenv DOS_STARTUP_FILE ${DOS_STARTUP_DIRECTORY}/startup.bat +endif + + +# java + +#setenv JAVA HOME=/usr/local/java +#setenv CLASSPATH .:${CLASSPATH} +#setenv PATH ${PATH}:/usr/local/java/bin + + +# command line completion + +set fignore = (.o \~) + + +# sort out if interactive + +if ($?prompt) then + # An interactive shell -- set some stuff up + set filec + set history = 1000 + set savehist = 1000 + set mail = (/var/mail/$USER) + set autolist + + #Keys 2=Insert 3=Delete 5=Page Up 6=Page Down 7=Home 8=End + # normal=~ control=^ + +# bindkey "^[[2~" delete-char + bindkey "^[[3~" delete-char + + bindkey "^[[5~" i-search-back + bindkey "^[[6~" i-search-fwd + + bindkey "^[[7~" beginning-of-line + bindkey "^[[8~" end-of-line + + bindkey "^R" i-search-back + + if (${TERM} == "cons25") then + bindkey "^?" delete-char + endif + + set prompt = '%S%m%s:%B%c2%b%% ' + which whoami >/dev/null + if ($? == 0) then + if (`whoami` == root) then + set prompt = '%S%m%s:%B%c2%b[%UROOT%u]# ' + endif + endif + + if (-f /etc/termcap && ${TERM} == "xterm-color" ) then + if (`grep 'xterm-color[:|]' /etc/termcap` == "") then + setenv TERMCAP \ + "xterm-color:pa#64:Co#8:AF=\E[3%dm:AB=\E[4%dm:op=\E[39;49m:tc=vt220:" + endif + endif + + if (${TERM} != "cons25" && ${TERM} != "linux") then + # auto executes when cd is used + alias cwdcmd 'echo -n "]2;tcsh: ${USER}@${HOST}: $cwd]1;${HOST}"' + + cwdcmd + endif + + complete dd c/--/"(help version)"/ c/\[io\]f=/f/ \ + c/conv=\*,/"(ascii ebcdic ibm block unblock lcase notrunc ucase swab noerror sync)"/,\ + c/conv=/"(ascii ebcdic ibm block unblock \ + lcase notrunc ucase swab noerror sync)"/,\ + c/\*=/x:''/ \ + n/\*/"(if of conv ibs obs bs cbs files skip file seek count)"/= + + + # darcs configuration + setenv DARCS_EDITOR $EDITOR + setenv DARCS_PAGER $PAGER + complete darcs 'p/1/(initialize get add remove mv whatsnew record unrecord \ + amend-record revert unrevert pull unpull rollback send \ + apply push replace tag setpref diff changes annotate \ + optimize check resolve dist trackdown repair query)/' \ + 'n/query/(manifest tags)/' \ + 'n/whatsnew/(-ls)/' \ + 'p/2/f/' + + complete git 'p/1/(status add commit)/' \ + 'n/commit/(-a)/' + + + # for fun + test -x /usr/games/pom && /usr/games/pom + +endif + +# additional customisation +foreach script (${HOME}/bin/AutoStart.*) + source ${script} +end