Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial Commit.

  • Loading branch information...
commit 1839a5b5de42ea4df76112744263656fc6b40cfd 0 parents
Ryan Koesters authored
110 INSTALL
@@ -0,0 +1,110 @@
+#!/bin/sh
+set -e
+
+usage () {
+ echo "Usage: $0 [OPTIONS]"
+ echo
+ echo "Options:"
+ echo " -c, --check Check that all source files exist. Implies -n."
+ echo " -n, --noexec Do not execute commands."
+ echo " -v, --verbose Print each command as they are executed."
+ echo " -h, --help Display help message and exit."
+}
+
+# Output arguments as semicolon separated list.
+join () {
+ string="$1"
+ shift
+ for i in "$@"; do
+ string="$string:$i"
+ done
+ echo "$string"
+}
+
+# Run the given command.
+cmd () {
+ if [ "$verbose" = "1" ]; then
+ echo "$@"
+ fi
+
+ if [ "$noexec" != "1" ]; then
+ "$@"
+ fi
+}
+
+
+# Parse arguments.
+while [ $# -gt 0 ]; do
+ case $1 in
+ -c|--check)
+ check=1
+ ;;
+ -n|--noexec)
+ noexec=1
+ ;;
+ -v|--verbose)
+ verbose=1
+ ;;
+ -h|--help)
+ usage >&2
+ exit 0
+ ;;
+ *)
+ echo "unknown option: $1" >&2
+ usage >&2
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+# Create list of directories that will be created.
+dirs=`join \
+ config \
+ config/git \
+ config/sh \
+ config/sh/shrc.d \
+ vim \
+ vim/backup \
+ vim/tmp \
+`
+
+# Create list of files that will be installed.
+files=`join \
+ config/git/config \
+ config/sh/shrc \
+ config/sh/shrc.d/alias.sh \
+ config/sh/shrc.d/defaults.sh \
+ config/sh/shrc.d/functions.sh \
+ config/sh/shrc.d/prompt.sh \
+ config/sh/shrc.d/prompt_command.sh \
+ config/sh/shrc.d/title.sh \
+ config/sh/shrc.d/vars.sh \
+ profile \
+ vimrc \
+`
+
+# Check if all source files exist.
+if [ "$check" = "1" ]; then
+ status=0
+ IFS=':'
+ for i in $files; do
+ if [ ! -f "$i" ]; then
+ echo "missing file: $i" >&2
+ status=1
+ fi
+ done
+ exit $status
+fi
+
+# Create directories.
+IFS=':'
+for i in $dirs; do
+ cmd mkdir "$HOME/.$i"
+done
+
+# Install files.
+IFS=':'
+for i in $files; do
+ cmd cp "$i" "$HOME/.$i"
+done
1  README
@@ -0,0 +1 @@
+My configuration files.
7 config/git/config
@@ -0,0 +1,7 @@
+[user]
+ name = Ryan Koesters
+ email = rmkoesters@gmail.com
+[help]
+ format = html
+[push]
+ default = simple
10 config/sh/shrc
@@ -0,0 +1,10 @@
+#!/bin/sh
+# If not running interactively, don't do anything
+[ -z "$PS1" ] && return
+
+# Source shell scripts in 'shrc.d/'.
+for i in `dirname $ENV`/shrc.d/*.sh
+do
+ . $i
+done
+unset i
9 config/sh/shrc.d/alias.sh
@@ -0,0 +1,9 @@
+case $termprog in
+ 9term|win)
+ alias ls='ls -F'
+ ;;
+ *)
+ alias ls='ls -p --color=auto'
+ alias tree='_tree'
+ ;;
+esac
44 config/sh/shrc.d/defaults.sh
@@ -0,0 +1,44 @@
+# Check if the executable exists.
+check_exist () {
+ which "$@" >/dev/null 2>/dev/null
+ return $?
+}
+
+# Find which web browser to use.
+#if check_exist chromium-browser
+#then
+# BROWSER=chromium-browser
+#else
+# BROWSER=firefox
+#fi
+BROWSER=firefox
+
+# Find EDITOR and PAGER.
+case $termprog in
+ 9term|win)
+ PAGER=cat
+ EDITOR=E
+ ;;
+ *)
+ # Find the text editor.
+ if check_exist vim
+ then
+ EDITOR=vim
+ elif check_exist vi
+ then
+ EDITOR=vi
+ else
+ EDITOR=ed
+ fi
+
+ # Find the pager.
+ if check_exist less
+ then
+ PAGER=less
+ else
+ PAGER=more
+ fi
+ ;;
+esac
+
+export BROWSER EDITOR PAGER
8 config/sh/shrc.d/functions.sh
@@ -0,0 +1,8 @@
+_tree () {
+ if [ -t 1 ]
+ then
+ command tree -C "$@"
+ else
+ command tree "$@"
+ fi
+}
10 config/sh/shrc.d/prompt.sh
@@ -0,0 +1,10 @@
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+if [ x"$BASH_VERSION" = x"" ]
+then
+ PS1='`prompt_command`$ '
+else
+ PROMPT_COMMAND="prompt_command"
+fi
23 config/sh/shrc.d/prompt_command.sh
@@ -0,0 +1,23 @@
+# Runs before every prompt.
+prompt_command () {
+ case $TERM in
+ xterm*|rxvt*|stterm*)
+ set_xterm_title "`get_title_string`"
+ ;;
+ 9term|dumb)
+ # We will get an error if we ever actually use a
+ # dumb terminal, but I think it is safe to assume
+ # that it is Acme or 9term.
+ awd
+ ;;
+ *)
+ ;;
+ esac
+}
+
+# Get string used for terminal title.
+get_title_string () {
+ pwd=`pwd | sed "s#$HOME#~#"`
+
+ echo "$USER@$HOSTNAME:$pwd"
+}
4 config/sh/shrc.d/title.sh
@@ -0,0 +1,4 @@
+# Override the xterm window title.
+set_xterm_title () {
+ printf '\033]0;%s\007' "$@"
+}
7 config/sh/shrc.d/vars.sh
@@ -0,0 +1,7 @@
+HOSTNAME="`hostname | sed 's/\..*$//'`"
+LC_COLLATE="C"
+USER="`whoami`"
+tabstop="8"
+textwidth=72
+
+export HOSTNAME LC_COLLATE USER tabstop textwidth
14 profile
@@ -0,0 +1,14 @@
+export ENV="$HOME/.config/sh/shrc"
+export GOPATH="$HOME/go"
+export PLAN9="/opt/plan9port"
+export PATH="$HOME/.local/bin:$PATH:$GOPATH/bin"
+
+if [ -n "$DISPLAY" ]
+then
+ 9 plumber
+fi
+
+if [ x"$BASH_VERSION" != x"" ]
+then
+ . $ENV
+fi
27 vimrc
@@ -0,0 +1,27 @@
+set nocompatible
+set encoding=utf8
+
+" General settings.
+set autoindent
+set background=dark
+set formatoptions=tcqrnj
+set noexpandtab
+set nowrap
+set scrolloff=2
+set spell
+set title
+
+" These options use environmental variables.
+let &colorcolumn=$textwidth+1
+let &tabstop=$tabstop
+let &textwidth=$textwidth
+
+" Backup.
+set backup
+set backupdir=~/.vim/backup
+set directory=~/.vim/tmp
+
+" Syntax
+syntax on
+au BufRead,BufNewFile *.md set filetype=markdown
+au BufRead,BufNewFile *.vala,*.vapi setfiletype vala
Please sign in to comment.
Something went wrong with that request. Please try again.