Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1839a5b
Showing
13 changed files
with
274 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
My configuration files. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[user] | ||
name = Ryan Koesters | ||
email = rmkoesters@gmail.com | ||
[help] | ||
format = html | ||
[push] | ||
default = simple |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
case $termprog in | ||
9term|win) | ||
alias ls='ls -F' | ||
;; | ||
*) | ||
alias ls='ls -p --color=auto' | ||
alias tree='_tree' | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
_tree () { | ||
if [ -t 1 ] | ||
then | ||
command tree -C "$@" | ||
else | ||
command tree "$@" | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
PS1='$ ' | ||
PS2='> ' | ||
PS4='+ ' | ||
|
||
if [ x"$BASH_VERSION" = x"" ] | ||
then | ||
PS1='`prompt_command`$ ' | ||
else | ||
PROMPT_COMMAND="prompt_command" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Override the xterm window title. | ||
set_xterm_title () { | ||
printf '\033]0;%s\007' "$@" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
HOSTNAME="`hostname | sed 's/\..*$//'`" | ||
LC_COLLATE="C" | ||
USER="`whoami`" | ||
tabstop="8" | ||
textwidth=72 | ||
|
||
export HOSTNAME LC_COLLATE USER tabstop textwidth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |