Squashed down
This commit is contained in:
commit
be71e93eeb
|
@ -0,0 +1,14 @@
|
|||
# Lots of junk goes in here.
|
||||
/caches/
|
||||
/backups/
|
||||
|
||||
# Top secret stuff!
|
||||
/link/.ssh/authorized_keys
|
||||
/link/.ssh/id_*
|
||||
/link/.ssh/known_hosts
|
||||
|
||||
# Don't commit Vim plugins, vim-plug will install them.
|
||||
/link/.vim/plugged
|
||||
|
||||
# Ignore any file with LOCAL in the name (good for per-machine vars/functions)
|
||||
*LOCAL*
|
|
@ -0,0 +1,3 @@
|
|||
[submodule "vendor/bash-git-prompt"]
|
||||
path = vendor/bash-git-prompt
|
||||
url = https://github.com/magicmonty/bash-git-prompt.git
|
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) 2014 "Cowboy" Ben Alman
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,8 @@
|
|||
# Dave's dotfiles
|
||||
|
||||
A customized version of https://github.com/cowboy/dotfiles
|
||||
|
||||
## Original License
|
||||
Copyright (c) 2014 "Cowboy" Ben Alman
|
||||
Licensed under the MIT license.
|
||||
<http://benalman.com/about/license/>
|
|
@ -0,0 +1,329 @@
|
|||
#!/usr/bin/env bash
|
||||
[[ "$1" == "source" ]] || \
|
||||
|
||||
echo 'Dotfiles - "Cowboy" Ben Alman - http://benalman.com/'
|
||||
|
||||
if [[ "$1" == "-h" || "$1" == "--help" ]]; then cat <<HELP
|
||||
|
||||
Usage: $(basename "$0")
|
||||
|
||||
See the README for documentation.
|
||||
https://github.com/cowboy/dotfiles
|
||||
|
||||
Copyright (c) 2014 "Cowboy" Ben Alman
|
||||
Licensed under the MIT license.
|
||||
http://benalman.com/about/license/
|
||||
HELP
|
||||
exit; fi
|
||||
|
||||
###########################################
|
||||
# GENERAL PURPOSE EXPORTED VARS / FUNCTIONS
|
||||
###########################################
|
||||
|
||||
# Where the magic happens.
|
||||
export DOTFILES=~/.dotfiles
|
||||
|
||||
# Logging stuff.
|
||||
function e_header() { echo -e "\n\033[1m$@\033[0m"; }
|
||||
function e_success() { echo -e " \033[1;32m✔\033[0m $@"; }
|
||||
function e_error() { echo -e " \033[1;31m✖\033[0m $@"; }
|
||||
function e_arrow() { echo -e " \033[1;34m➜\033[0m $@"; }
|
||||
|
||||
# For testing.
|
||||
function assert() {
|
||||
local success modes equals actual expected
|
||||
modes=(e_error e_success); equals=("!=" "=="); expected="$1"; shift
|
||||
actual="$("$@")"
|
||||
[[ "$actual" == "$expected" ]] && success=1 || success=0
|
||||
${modes[success]} "\"$actual\" ${equals[success]} \"$expected\""
|
||||
}
|
||||
|
||||
# OS detection
|
||||
function is_osx() {
|
||||
[[ "$OSTYPE" =~ ^darwin ]] || return 1
|
||||
}
|
||||
function is_ubuntu() {
|
||||
[[ "$(cat /etc/issue 2> /dev/null)" =~ Ubuntu ]] || return 1
|
||||
}
|
||||
function get_os() {
|
||||
for os in osx ubuntu; do
|
||||
is_$os; [[ $? == ${1:-0} ]] && echo $os
|
||||
done
|
||||
}
|
||||
|
||||
# Remove an entry from $PATH
|
||||
# Based on http://stackoverflow.com/a/2108540/142339
|
||||
function path_remove() {
|
||||
local arg path
|
||||
path=":$PATH:"
|
||||
for arg in "$@"; do path="${path//:$arg:/:}"; done
|
||||
path="${path%:}"
|
||||
path="${path#:}"
|
||||
echo "$path"
|
||||
}
|
||||
|
||||
# Display a fancy multi-select menu.
|
||||
# Inspired by http://serverfault.com/a/298312
|
||||
function prompt_menu() {
|
||||
local exitcode prompt choices nums i n
|
||||
exitcode=0
|
||||
if [[ "$2" ]]; then
|
||||
_prompt_menu_draws "$1"
|
||||
read -t $2 -n 1 -sp "To edit this list, press any key within $2 seconds. "
|
||||
exitcode=$?
|
||||
echo ""
|
||||
fi 1>&2
|
||||
if [[ "$exitcode" == 0 ]]; then
|
||||
prompt="Toggle options (Separate options with spaces, ENTER when done): "
|
||||
while _prompt_menu_draws "$1" 1 && read -rp "$prompt" nums && [[ "$nums" ]]; do
|
||||
_prompt_menu_adds $nums
|
||||
done
|
||||
fi 1>&2
|
||||
_prompt_menu_adds
|
||||
}
|
||||
|
||||
function _prompt_menu_iter() {
|
||||
local i sel state
|
||||
local fn=$1; shift
|
||||
for i in "${!menu_options[@]}"; do
|
||||
state=0
|
||||
for sel in "${menu_selects[@]}"; do
|
||||
[[ "$sel" == "${menu_options[i]}" ]] && state=1 && break
|
||||
done
|
||||
$fn $state $i "$@"
|
||||
done
|
||||
}
|
||||
|
||||
function _prompt_menu_draws() {
|
||||
e_header "$1"
|
||||
_prompt_menu_iter _prompt_menu_draw "$2"
|
||||
}
|
||||
|
||||
function _prompt_menu_draw() {
|
||||
local modes=(error success)
|
||||
if [[ "$3" ]]; then
|
||||
e_${modes[$1]} "$(printf "%2d) %s\n" $(($2+1)) "${menu_options[$2]}")"
|
||||
else
|
||||
e_${modes[$1]} "${menu_options[$2]}"
|
||||
fi
|
||||
}
|
||||
|
||||
function _prompt_menu_adds() {
|
||||
_prompt_menu_result=()
|
||||
_prompt_menu_iter _prompt_menu_add "$@"
|
||||
menu_selects=("${_prompt_menu_result[@]}")
|
||||
}
|
||||
|
||||
function _prompt_menu_add() {
|
||||
local state i n keep match
|
||||
state=$1; shift
|
||||
i=$1; shift
|
||||
for n in "$@"; do
|
||||
if [[ $n =~ ^[0-9]+$ ]] && (( n-1 == i )); then
|
||||
match=1; [[ "$state" == 0 ]] && keep=1
|
||||
fi
|
||||
done
|
||||
[[ ! "$match" && "$state" == 1 || "$keep" ]] || return
|
||||
_prompt_menu_result=("${_prompt_menu_result[@]}" "${menu_options[i]}")
|
||||
}
|
||||
|
||||
# Given strings containing space-delimited words A and B, "setdiff A B" will
|
||||
# return all words in A that do not exist in B. Arrays in bash are insane
|
||||
# (and not in a good way).
|
||||
# From http://stackoverflow.com/a/1617303/142339
|
||||
function setdiff() {
|
||||
local debug skip a b
|
||||
if [[ "$1" == 1 ]]; then debug=1; shift; fi
|
||||
if [[ "$1" ]]; then
|
||||
local setdiffA setdiffB setdiffC
|
||||
setdiffA=($1); setdiffB=($2)
|
||||
fi
|
||||
setdiffC=()
|
||||
for a in "${setdiffA[@]}"; do
|
||||
skip=
|
||||
for b in "${setdiffB[@]}"; do
|
||||
[[ "$a" == "$b" ]] && skip=1 && break
|
||||
done
|
||||
[[ "$skip" ]] || setdiffC=("${setdiffC[@]}" "$a")
|
||||
done
|
||||
[[ "$debug" ]] && for a in setdiffA setdiffB setdiffC; do
|
||||
echo "$a ($(eval echo "\${#$a[*]}")) $(eval echo "\${$a[*]}")" 1>&2
|
||||
done
|
||||
[[ "$1" ]] && echo "${setdiffC[@]}"
|
||||
}
|
||||
|
||||
# If this file was being sourced, exit now.
|
||||
[[ "$1" == "source" ]] && return
|
||||
|
||||
|
||||
###########################################
|
||||
# INTERNAL DOTFILES "INIT" VARS / FUNCTIONS
|
||||
###########################################
|
||||
|
||||
# Initialize.
|
||||
init_file=$DOTFILES/caches/init/selected
|
||||
function init_files() {
|
||||
local i f dirname oses os opt remove
|
||||
dirname="$(dirname "$1")"
|
||||
f=("$@")
|
||||
menu_options=(); menu_selects=()
|
||||
for i in "${!f[@]}"; do menu_options[i]="$(basename "${f[i]}")"; done
|
||||
if [[ -e "$init_file" ]]; then
|
||||
# Read cache file if possible
|
||||
IFS=$'\n' read -d '' -r -a menu_selects < "$init_file"
|
||||
else
|
||||
# Otherwise default to all scripts not specifically for other OSes
|
||||
oses=($(get_os 1))
|
||||
for opt in "${menu_options[@]}"; do
|
||||
remove=
|
||||
for os in "${oses[@]}"; do
|
||||
[[ "$opt" =~ (^|[^a-z])$os($|[^a-z]) ]] && remove=1 && break
|
||||
done
|
||||
[[ "$remove" ]] || menu_selects=("${menu_selects[@]}" "$opt")
|
||||
done
|
||||
fi
|
||||
prompt_menu "Run the following init scripts?" $prompt_delay
|
||||
# Write out cache file for future reading.
|
||||
rm "$init_file" 2>/dev/null
|
||||
for i in "${!menu_selects[@]}"; do
|
||||
echo "${menu_selects[i]}" >> "$init_file"
|
||||
echo "$dirname/${menu_selects[i]}"
|
||||
done
|
||||
}
|
||||
function init_do() {
|
||||
e_header "Sourcing $(basename "$2")"
|
||||
source "$2"
|
||||
}
|
||||
|
||||
# Copy files.
|
||||
function copy_header() { e_header "Copying files into home directory"; }
|
||||
function copy_test() {
|
||||
if [[ -e "$2" && ! "$(cmp "$1" "$2" 2> /dev/null)" ]]; then
|
||||
echo "same file"
|
||||
elif [[ "$1" -ot "$2" ]]; then
|
||||
echo "destination file newer"
|
||||
fi
|
||||
}
|
||||
function copy_do() {
|
||||
e_success "Copying ~/$1."
|
||||
cp "$2" ~/
|
||||
}
|
||||
|
||||
# Link files.
|
||||
function link_header() { e_header "Linking files into home directory"; }
|
||||
function link_test() {
|
||||
[[ "$1" -ef "$2" ]] && echo "same file"
|
||||
}
|
||||
function link_do() {
|
||||
e_success "Linking ~/$1."
|
||||
ln -sf ${2#$HOME/} ~/
|
||||
}
|
||||
|
||||
# Copy, link, init, etc.
|
||||
function do_stuff() {
|
||||
local base dest skip
|
||||
local files=($DOTFILES/$1/*)
|
||||
[[ $(declare -f "$1_files") ]] && files=($($1_files "${files[@]}"))
|
||||
# No files? abort.
|
||||
if (( ${#files[@]} == 0 )); then return; fi
|
||||
# Run _header function only if declared.
|
||||
[[ $(declare -f "$1_header") ]] && "$1_header"
|
||||
# Iterate over files.
|
||||
for file in "${files[@]}"; do
|
||||
base="$(basename $file)"
|
||||
dest="$HOME/$base"
|
||||
# Run _test function only if declared.
|
||||
if [[ $(declare -f "$1_test") ]]; then
|
||||
# If _test function returns a string, skip file and print that message.
|
||||
skip="$("$1_test" "$file" "$dest")"
|
||||
if [[ "$skip" ]]; then
|
||||
e_error "Skipping ~/$base, $skip."
|
||||
continue
|
||||
fi
|
||||
# Destination file already exists in ~/. Back it up!
|
||||
if [[ -e "$dest" ]]; then
|
||||
e_arrow "Backing up ~/$base."
|
||||
# Set backup flag, so a nice message can be shown at the end.
|
||||
backup=1
|
||||
# Create backup dir if it doesn't already exist.
|
||||
[[ -e "$backup_dir" ]] || mkdir -p "$backup_dir"
|
||||
# Backup file / link / whatever.
|
||||
mv "$dest" "$backup_dir"
|
||||
fi
|
||||
fi
|
||||
# Do stuff.
|
||||
"$1_do" "$base" "$file"
|
||||
done
|
||||
}
|
||||
|
||||
# Enough with the functions, let's do stuff.
|
||||
|
||||
export prompt_delay=5
|
||||
|
||||
# Ensure that we can actually, like, compile anything.
|
||||
if [[ ! "$(type -P gcc)" ]] && is_osx; then
|
||||
e_error "XCode or the Command Line Tools for XCode must be installed first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If Git is not installed, install it (Ubuntu only, since Git comes standard
|
||||
# with recent XCode or CLT)
|
||||
if [[ ! "$(type -P git)" ]] && is_ubuntu; then
|
||||
e_header "Installing Git"
|
||||
sudo apt-get -qq install git-core
|
||||
fi
|
||||
|
||||
# If Git isn't installed by now, something exploded. We gots to quit!
|
||||
if [[ ! "$(type -P git)" ]]; then
|
||||
e_error "Git should be installed. It isn't. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Initialize.
|
||||
if [[ ! -d $DOTFILES ]]; then
|
||||
# $DOTFILES directory doesn't exist? Clone it!
|
||||
new_dotfiles_install=1
|
||||
prompt_delay=15
|
||||
e_header "Downloading dotfiles"
|
||||
git clone --recursive git://github.com/${github_user:-cowboy}/dotfiles.git $DOTFILES
|
||||
cd $DOTFILES
|
||||
elif [[ "$1" != "restart" ]]; then
|
||||
# Make sure we have the latest files.
|
||||
e_header "Updating dotfiles"
|
||||
cd $DOTFILES
|
||||
prev_head="$(git rev-parse HEAD)"
|
||||
git pull
|
||||
git submodule update --init --recursive --quiet
|
||||
if [[ "$(git rev-parse HEAD)" != "$prev_head" ]]; then
|
||||
e_header "Changes detected, restarting script"
|
||||
exec "$0" "restart"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Add binaries into the path
|
||||
[[ -d $DOTFILES/bin ]] && PATH=$DOTFILES/bin:$PATH
|
||||
export PATH
|
||||
|
||||
# Tweak file globbing.
|
||||
shopt -s dotglob
|
||||
shopt -s nullglob
|
||||
|
||||
# Create caches dir and init subdir, if they don't already exist.
|
||||
mkdir -p "$DOTFILES/caches/init"
|
||||
|
||||
# If backups are needed, this is where they'll go.
|
||||
backup_dir="$DOTFILES/backups/$(date "+%Y_%m_%d-%H_%M_%S")/"
|
||||
backup=
|
||||
|
||||
# Execute code for each file in these subdirectories.
|
||||
do_stuff "copy"
|
||||
do_stuff "link"
|
||||
do_stuff "init"
|
||||
|
||||
# Alert if backups were made.
|
||||
if [[ "$backup" ]]; then
|
||||
echo -e "\nBackups were moved to ~/${backup_dir#$HOME/}"
|
||||
fi
|
||||
|
||||
# All done!
|
||||
e_header "All done!"
|
|
@ -0,0 +1,91 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
function _eachdir() {
|
||||
|
||||
if [[ "$1" == "-h" || "$1" == "--help" ]]; then cat <<HELP
|
||||
eachdir
|
||||
http://benalman.com/
|
||||
|
||||
Usage: eachdir [dirs --] commands
|
||||
|
||||
Run one or more commands in one or more dirs.
|
||||
|
||||
By default, all subdirs of the current dir will be iterated over, but if --
|
||||
is specified as an arg, the dirs list will be made up of all args specified
|
||||
before it. All remaining args are the command(s) to be executed for each dir.
|
||||
|
||||
Multiple commands must be specified as a single string argument.
|
||||
|
||||
In bash, aliasing like this allows you to specify aliases/functions:
|
||||
alias eachdir=". eachdir"
|
||||
|
||||
Both of these print the working directory of every subdir of the current dir:
|
||||
eachdir pwd
|
||||
eachdir * -- pwd
|
||||
|
||||
Perform a "git pull" inside all subdirs starting with repo-:
|
||||
eachdir repo-* -- git pull
|
||||
|
||||
Perform a few git-related commands inside all subdirs starting with repo-:
|
||||
eachdir repo-* -- 'git fetch && git merge'
|
||||
|
||||
Copyright (c) 2012 "Cowboy" Ben Alman
|
||||
Licensed under the MIT license.
|
||||
http://benalman.com/about/license/
|
||||
HELP
|
||||
return; fi
|
||||
|
||||
if [ ! "$1" ]; then
|
||||
echo 'You must specify one or more commands to run.'
|
||||
return 1
|
||||
fi
|
||||
|
||||
# For underlining headers.
|
||||
local h1="$(tput smul)"
|
||||
local h2="$(tput rmul)"
|
||||
|
||||
# Store any dirs passed before -- in an array.
|
||||
local dashes d
|
||||
local dirs=()
|
||||
for d in "$@"; do
|
||||
if [[ "$d" == "--" ]]; then
|
||||
dashes=1
|
||||
shift $(( ${#dirs[@]} + 1 ))
|
||||
break
|
||||
fi
|
||||
dirs=("${dirs[@]}" "$d")
|
||||
done
|
||||
|
||||
# If -- wasn't specified, default to all subdirs of the current dir.
|
||||
[[ "$dashes" ]] || dirs=(*/)
|
||||
|
||||
local nops=()
|
||||
# Do stuff for each specified dir, in each dir. Non-dirs are ignored.
|
||||
for d in "${dirs[@]}"; do
|
||||
# Skip non-dirs.
|
||||
[[ ! -d "$d" ]] && continue
|
||||
# If the dir isn't /, strip the trailing /.
|
||||
[[ "$d" != "/" ]] && d="${d%/}"
|
||||
# Execute the command, grabbing all stdout and stderr.
|
||||
output="$( (cd "$d"; eval "$@") 2>&1 )"
|
||||
if [[ "$output" ]]; then
|
||||
# If the command had output, display a header and that output.
|
||||
echo -e "${h1}${d}${h2}\n$output\n"
|
||||
else
|
||||
# Otherwise push it onto an array for later display.
|
||||
nops=("${nops[@]}" "$d")
|
||||
fi
|
||||
done
|
||||
|
||||
# List any dirs that had no output.
|
||||
if [[ ${#nops[@]} > 0 ]]; then
|
||||
echo "${h1}no output from${h2}"
|
||||
for d in "${nops[@]}"; do echo "$d"; done
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# By putting the above code inside a function, if this file is sourced (which
|
||||
# is required for external aliases/functions to be used as commands), vars
|
||||
# can be local and return can be used to exit.
|
||||
_eachdir "$@"
|
|
@ -0,0 +1,182 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
function help() {
|
||||
cat <<HELP
|
||||
Git Jump (Forward & Back)
|
||||
http://benalman.com/
|
||||
|
||||
Usage: $(basename "$0") [command]
|
||||
|
||||
Commands:
|
||||
next Jump forward to the next commit in this branch
|
||||
prev Jump backward to the next commit in this branch
|
||||
clean Remove current unstaged changes/untracked files**
|
||||
cleanall Remove all saved tags, unstaged changes and untracked files**
|
||||
|
||||
** This action is destructive and cannot be undone!
|
||||
|
||||
Git config:
|
||||
git-jump.branch Branch to jump through. If not set, defaults to master
|
||||
|
||||
Description:
|
||||
"Replay" Git commits by moving forward / backward through a branch's
|
||||
history. Before jumping, any current unstaged changes and untracked
|
||||
files are saved in a tag for later retrieval, which is restored when
|
||||
jumped back to.
|
||||
|
||||
Copyright (c) 2014 "Cowboy" Ben Alman
|
||||
Licensed under the MIT license.
|
||||
http://benalman.com/about/license/
|
||||
HELP
|
||||
}
|
||||
|
||||
function usage() {
|
||||
echo "Usage: $(basename "$0") [next | prev | clean | cleanall]"
|
||||
}
|
||||
|
||||
# Get branch stored in Git config or default to master
|
||||
git_branch="$(git config git-jump.branch || echo "master")"
|
||||
|
||||
# Get some (short) SHAs
|
||||
function git_branch_sha() {
|
||||
git rev-parse --short "$git_branch"
|
||||
}
|
||||
function git_head_sha() {
|
||||
git rev-parse --short HEAD
|
||||
}
|
||||
function git_prev_sha() {
|
||||
git log --format='%h' "$git_branch" "$@" | awk "/^$(git_head_sha)/{getline; print}"
|
||||
}
|
||||
function git_next_sha() {
|
||||
git_prev_sha --reverse
|
||||
}
|
||||
|
||||
# Get absolute path to root of Git repo
|
||||
function git_repo_toplevel() {
|
||||
git rev-parse --show-toplevel
|
||||
}
|
||||
|
||||
# Get subject of specified commit
|
||||
function git_commit_subject() {
|
||||
git log --format='%s' -n 1 $1
|
||||
}
|
||||
|
||||
# Save changes for later retrieval
|
||||
function save() {
|
||||
local status=""
|
||||
local head_sha=$(git_head_sha)
|
||||
# Checkout current HEAD by SHA to force detached state
|
||||
git checkout -q $head_sha
|
||||
# Add all files in repo
|
||||
git add "$(git_repo_toplevel)"
|
||||
# Commit changes (if there were any)
|
||||
git commit --no-verify -m "Git Jump: saved changes for $head_sha" >/dev/null
|
||||
# If the commit was successful, tag it (overwriting any previous tag)
|
||||
if [[ $? == 0 ]]; then
|
||||
status="*"
|
||||
git tag -f "git-jump-$head_sha" >/dev/null
|
||||
fi
|
||||
echo "Previous HEAD was $head_sha$status, $(git_commit_subject $head_sha)"
|
||||
}
|
||||
|
||||
# Restore previously-saved changes
|
||||
function restore() {
|
||||
local status=""
|
||||
# Save current changes before restoring
|
||||
save
|
||||
# Attempt to restore saved changes for specified commit
|
||||
git checkout "git-jump-$1" 2>/dev/null
|
||||
if [[ $? == 0 ]]; then
|
||||
# If the restore was successful, figure out exactly what was saved, check
|
||||
# out the original commit, then restore the saved changes on top of it
|
||||
status="*"
|
||||
local patch="$(git format-patch HEAD^ --stdout)"
|
||||
git checkout HEAD^ 2>/dev/null
|
||||
echo "$patch" | git apply -
|
||||
else
|
||||
# Otherwise, just restore the original commit
|
||||
git checkout "$1" 2>/dev/null
|
||||
fi
|
||||
echo "HEAD is now $1$status, $(git_commit_subject $1)"
|
||||
}
|
||||
|
||||
# Clean (permanently) current changes and remove the current saved tag
|
||||
function clean() {
|
||||
local head_sha=$(git_head_sha)
|
||||
git tag -d "git-jump-$head_sha" &>/dev/null
|
||||
if [[ $? == 0 ]]; then
|
||||
echo "Removed stored data for commit $head_sha."
|
||||
fi
|
||||
local repo_root="$(git_repo_toplevel)"
|
||||
git reset HEAD "$repo_root" >/dev/null
|
||||
git clean -f -d -q -- "$repo_root" >/dev/null
|
||||
git checkout -- "$repo_root" >/dev/null
|
||||
echo "Unstaged changes and untracked files removed."
|
||||
}
|
||||
|
||||
# Remove (permanently) all saved tags
|
||||
function clean_all_tags() {
|
||||
git for-each-ref refs/tags --format='%(refname:short)' | \
|
||||
while read tag; do
|
||||
if [[ "$tag" =~ ^git-jump- ]]; then
|
||||
git tag -d "$tag"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Jump to next commit
|
||||
function next() {
|
||||
local next_sha=$(git_next_sha)
|
||||
if [[ "$next_sha" == "$(git_head_sha)" ]]; then
|
||||
# Abort if no more commits
|
||||
echo "Already at last commit in $git_branch. Congratulations!"
|
||||
else
|
||||
# Checkout branch by name if at its HEAD
|
||||
if [[ "$next_sha" == "$(git_branch_sha)" ]]; then
|
||||
next_sha="$git_branch"
|
||||
fi
|
||||
echo "Jumping ahead to next commit."
|
||||
restore $next_sha
|
||||
fi
|
||||
}
|
||||
|
||||
# Jump to previous commit
|
||||
function prev() {
|
||||
local prev_sha=$(git_prev_sha)
|
||||
if [[ "$prev_sha" == "$(git_head_sha)" ]]; then
|
||||
# Abort if no more commits
|
||||
echo "Already at first commit in $git_branch."
|
||||
else
|
||||
echo "Jumping back to previous commit."
|
||||
restore $prev_sha
|
||||
fi
|
||||
}
|
||||
|
||||
# Show help if requested
|
||||
if [[ "$1" == "--help" || "$1" == "-h" ]]; then
|
||||
help
|
||||
exit
|
||||
fi
|
||||
|
||||
# Check if branch is valid
|
||||
git rev-parse "$git_branch" &>/dev/null
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Error: Branch \"$git_branch\" does not appear to be valid."
|
||||
echo "Try $(basename "$0") --help for more information."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Handle CLI arguments
|
||||
if [[ "$1" == "next" ]]; then
|
||||
next
|
||||
elif [[ "$1" == "prev" ]]; then
|
||||
prev
|
||||
elif [[ "$1" == "clean" ]]; then
|
||||
clean
|
||||
elif [[ "$1" == "cleanall" ]]; then
|
||||
clean_all_tags
|
||||
clean
|
||||
else
|
||||
usage
|
||||
exit 1
|
||||
fi
|
|
@ -0,0 +1,280 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
function help() {
|
||||
pr=123
|
||||
local_ref=foo
|
||||
script="$(basename "$0") $pr"
|
||||
cat <<HELP
|
||||
-=[ GitHub Pull Request Helper - "Cowboy" Ben Alman - http://benalman.com/ ]=-
|
||||
|
||||
Usage: $(basename "$0") pull_request_id [ step ]
|
||||
|
||||
-=[ Description ]============================================================-
|
||||
|
||||
The "step" argument can be used to force execution of a particular step,
|
||||
but by default this script will automatically choose the next step, from
|
||||
STEP 1 to STEP 2 and finally to STEP 3. You'll have to execute STEP 4
|
||||
manually, once everything is done.
|
||||
|
||||
-=[ Detailed workflow example ]==============================================-
|
||||
|
||||
For this example, assume PR $pr has been filed against the "$local_ref" branch.
|
||||
|
||||
-=[ STEP 1 ]=-
|
||||
|
||||
You run "$script" and this executes:
|
||||
|
||||
$(help_step1)
|
||||
|
||||
-=[ STEP 2 ]=-
|
||||
|
||||
You run "$script" and this executes:
|
||||
|
||||
$(help_step2)
|
||||
|
||||
-=[ STEP 3 ]=-
|
||||
|
||||
You run "$script" and this executes:
|
||||
|
||||
$(help_step3)
|
||||
|
||||
-=[ STEP 4 ]=-
|
||||
|
||||
You run "$script 4" (explicitly specifying the 4) and this executes:
|
||||
|
||||
$(help_step4)
|
||||
|
||||
-=[ Very important notes ]===================================================-
|
||||
|
||||
Before running this script, ensure that your local "$local_ref" branch is
|
||||
up-to-date!
|
||||
|
||||
At the beginning of STEP 1, any existing "pr$pr" and "pr$pr-squash"
|
||||
branches will be deleted.
|
||||
|
||||
At the beginning of STEP 2, any existing pr$pr-squash" branch will be
|
||||
deleted.
|
||||
|
||||
If you want to hide per-step explanations, set ENV var GPR_SHH=1. For
|
||||
example, create an alias like: alias gpr='GPR_SHH=1 gpr'
|
||||
|
||||
-=[ License ]================================================================-
|
||||
|
||||
Copyright (c) 2012 "Cowboy" Ben Alman
|
||||
Licensed under the MIT license.
|
||||
http://benalman.com/about/license/
|
||||
HELP
|
||||
[[ "$1" ]]; exit
|
||||
}
|
||||
|
||||
function help_step1() {
|
||||
echo " Fetch and rebase PR $pr into \"pr$pr\" branch"
|
||||
[[ "$1" ]] && return
|
||||
cat <<HELP
|
||||
1. Fetch the repo and branch associated with PR $pr.
|
||||
2. Checkout a new "pr$pr" branch at the HEAD of the fetched branch.
|
||||
3. Rebase "$local_ref" branch onto "pr$pr" branch.
|
||||
4. Display a list of files changed in the PR.
|
||||
|
||||
Note that you may need to resolve conflicts. If the rebase is successful,
|
||||
test the PR and commit fixes. Commit as many times as necessary; It doesn't
|
||||
matter because all PR-related commits will be squash merged in STEP 2.
|
||||
HELP
|
||||
}
|
||||
|
||||
function help_step2() {
|
||||
echo " Perform squash merge into \"pr$pr-squash\" branch"
|
||||
[[ "$1" ]] && return
|
||||
cat <<HELP
|
||||
1. Checkout a new "pr$pr-squash" branch from "$local_ref" branch.
|
||||
2. Squash merge "pr$pr" branch into "pr$pr-squash" branch. (no commit)
|
||||
3. Append "Closes gh-$pr." to SQUASH_MSG.
|
||||
4. Commit using the PR branch's HEAD author name.
|
||||
|
||||
Since all the commits in the PR have been squashed into one commit, you will
|
||||
need to edit the commit message. When done, inspect the commit log, ensuring
|
||||
everything is perfect; you should see a single, beautiful commit.
|
||||
HELP
|
||||
}
|
||||
|
||||
function help_step3() {
|
||||
echo " Perform final merge into \"$local_ref\" branch"
|
||||
[[ "$1" ]] && return
|
||||
cat <<HELP
|
||||
1. Checkout "$local_ref" branch.
|
||||
2. Merge "$pr-squash" branch into "$local_ref" branch.
|
||||
|
||||
If STEP 2 was successful, there should be no conflicts here. If there are,
|
||||
you're doing it wrong. Just double-check the commit log and push when done.
|
||||
HELP
|
||||
}
|
||||
|
||||
function help_step4() {
|
||||
echo " Cleanup temporary branches and tags"
|
||||
[[ "$1" ]] && return
|
||||
cat <<HELP
|
||||
1. Temporary "pr$pr" and "pr$pr-squash" branches are deleted.
|
||||
2. Temporary "_pr${pr}_author_head" tag is deleted.
|
||||
HELP
|
||||
}
|
||||
|
||||
function header() {
|
||||
if [[ "$GPR_SHH" ]]; then
|
||||
echo "-=[ STEP $1 ]=================================================================-"
|
||||
else
|
||||
echo "-=[ STEP $1 Overview ]========================================================-"
|
||||
help_step$1
|
||||
echo
|
||||
echo "-=[ Actual ]=================================================================-"
|
||||
fi
|
||||
}
|
||||
|
||||
[[ ! "$1" || "$1" == "-h" || "$1" == "--help" ]] && help $1
|
||||
|
||||
# Generate and store an OAUTH token.
|
||||
if [[ "$1" == "auth" ]]; then
|
||||
read -p 'Enter GitHub username: '
|
||||
json="$(curl -fsSL --data '{"note":"gpr","scopes":["repo"]}' https://api.github.com/authorizations -u "$REPLY")"
|
||||
if [[ "$json" ]]; then
|
||||
token="$(node -pe "($json).token")"
|
||||
git config --global --remove-section gpr 2>/dev/null
|
||||
git config --global --add gpr.token $token
|
||||
echo "Authorization successful, token saved."
|
||||
exit
|
||||
else
|
||||
echo "Error authorizing with GitHub, please try again."
|
||||
exit 5
|
||||
fi
|
||||
fi
|
||||
|
||||
pr="$1"; shift
|
||||
script="$(basename "$0") $pr"
|
||||
branch="pr$pr"
|
||||
|
||||
repo="$(git remote show -n origin | perl -ne '/Fetch URL: .*github\.com[:\/](.*\/.*)\.git/ && print $1')"
|
||||
|
||||
# Let's fetch some JSON.
|
||||
token="$(git config --get gpr.token)"
|
||||
json="$(curl -fsSL "https://api.github.com/repos/$repo/pulls/$pr?access_token=$token" 2>/dev/null)"
|
||||
if [[ $? != 0 || ! "$json" ]]; then
|
||||
echo "Error fetching GitHub API data for $repo PR $pr!"
|
||||
echo "If you're trying to access a private repo and haven't yet done so, please run"
|
||||
echo "the \"$(basename "$0") auth\" command to generate a GitHub auth token."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Let's parse some JSON.
|
||||
remote_url="$(node -pe "($json).head.repo.git_url")"
|
||||
remote_ref="$(node -pe "($json).head.ref")"
|
||||
local_url="$(node -pe "($json).base.repo.git_url")"
|
||||
local_ref="$(node -pe "($json).base.ref")"
|
||||
num_commits="$(node -pe "($json).commits")"
|
||||
|
||||
# Let's get the project's .git folder.
|
||||
git_dir="$(git rev-parse --show-toplevel)/.git"
|
||||
|
||||
function del_branch() {
|
||||
if [[ "$(git branch | grep " $1\$")" ]]; then
|
||||
git checkout "$local_ref" 2>/dev/null
|
||||
git branch -D "$1" 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
# Use the specified step, otherwise attempt to auto-detect it.
|
||||
if [[ "$1" ]]; then
|
||||
step=$1
|
||||
elif [[ "$(git branch | grep " $branch-squash\$")" ]]; then
|
||||
# STEP 3 should never auto-execute twice.
|
||||
if [[ "$(git branch --contains "$(git rev-parse $branch-squash)" | grep " $local_ref\$")" ]]; then
|
||||
echo "Error merging branch \"$branch-squash\" into \"$local_ref\" branch! (already done)"
|
||||
echo
|
||||
echo "Redo the last step with: $script 3"
|
||||
exit 4
|
||||
fi
|
||||
step=3
|
||||
elif [[ "$(git branch | grep " $branch\$")" ]]; then
|
||||
step=2
|
||||
else
|
||||
step=1
|
||||
fi
|
||||
|
||||
# Let's do some stuff.
|
||||
if [[ $step == 1 ]]; then
|
||||
header 1
|
||||
|
||||
# Clean up any prior work on this PR.
|
||||
del_branch "$branch"
|
||||
del_branch "$branch-squash"
|
||||
|
||||
# Fetch remote, create a branch, etc.
|
||||
if [[ "$remote_url" == "$local_url" ]]; then
|
||||
git fetch origin "$remote_ref"
|
||||
else
|
||||
git fetch "$remote_url" "$remote_ref"
|
||||
fi
|
||||
git checkout -b "$branch" FETCH_HEAD
|
||||
|
||||
# Save ref to last PR author commit for later use
|
||||
git tag --force "_${branch}_author_head" FETCH_HEAD
|
||||
|
||||
# Rebase!
|
||||
git rebase "$local_ref"
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Error while attempting rebase!"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Changed files in HEAD~$num_commits:"
|
||||
git --no-pager diff --name-only HEAD~"$num_commits"
|
||||
|
||||
echo
|
||||
echo "-=[ Next Steps ]=============================================================-"
|
||||
echo "$(help_step2 1) with: $script"
|
||||
echo " Or redo the current step with: $script 1"
|
||||
|
||||
elif [[ $step == 2 ]]; then
|
||||
header 2
|
||||
|
||||
# Clean up any prior squashes for this PR.
|
||||
del_branch "$branch-squash"
|
||||
|
||||
# Create branch and squash merge all commits.
|
||||
git checkout -b "$branch-squash" "$local_ref"
|
||||
git merge --squash "$branch"
|
||||
|
||||
# Append useful information to commit message.
|
||||
squash_msg_file="$git_dir/SQUASH_MSG"
|
||||
echo -e "\nCloses gh-$pr." >> "$squash_msg_file"
|
||||
|
||||
# Retrieve author name and email from stored commit, and commit.
|
||||
author="$(git log "_${branch}_author_head" -n1 --format="%an <%ae>")"
|
||||
git commit --author="$author"
|
||||
|
||||
echo
|
||||
echo "-=[ Next Steps ]=============================================================-"
|
||||
echo "$(help_step3 1) with: $script"
|
||||
echo " Or redo the current step with: $script 2"
|
||||
|
||||
elif [[ $step == 3 ]]; then
|
||||
header 3
|
||||
|
||||
# Actually merge squashed commits into branch.
|
||||
git checkout "$local_ref"
|
||||
git merge "$branch-squash"
|
||||
|
||||
echo
|
||||
echo "-=[ Next Steps ]=============================================================-"
|
||||
echo "$(help_step4 1) with: $script 4"
|
||||
echo " Or redo the current step with: $script 3"
|
||||
|
||||
elif [[ $step == 4 ]]; then
|
||||
header 4
|
||||
|
||||
del_branch "$branch"
|
||||
del_branch "$branch-squash"
|
||||
git tag -d "_${branch}_author_head" 2>/dev/null
|
||||
|
||||
echo
|
||||
echo "All done."
|
||||
fi
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ "$1" == "-h" || "$1" == "--help" ]]; then cat <<HELP
|
||||
Get all bound IPs
|
||||
http://benalman.com/
|
||||
|
||||
Usage: $(basename "$0") [IP]
|
||||
|
||||
If an IP is specified and it is bound to a network interface, echo it,
|
||||
otherwise echo nothing.
|
||||
|
||||
Copyright (c) 2012 "Cowboy" Ben Alman
|
||||
Licensed under the MIT license.
|
||||
http://benalman.com/about/license/
|
||||
HELP
|
||||
exit; fi
|
||||
|
||||
iplist=$(ifconfig -a | perl -nle'/inet (?:addr:)?(\d+\.\d+\.\d+\.\d+)/ && print $1')
|
||||
|
||||
if [ "$1" ]; then
|
||||
if [ "$(echo $iplist | grep -w $1)" ]; then
|
||||
echo $1
|
||||
fi
|
||||
else
|
||||
echo $iplist
|
||||
fi
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ "$1" == "-h" || "$1" == "--help" ]]; then cat <<HELP
|
||||
Manpage-as-HTML Viewer
|
||||
http://benalman.com/
|
||||
|
||||
Usage: $(basename "$0") [section] name
|
||||
|
||||
View a manpage as HTML in the default viewer. Because sometimes
|
||||
you don't want to view manpages in the terminal.
|
||||
|
||||
Copyright (c) 2012 "Cowboy" Ben Alman
|
||||
Licensed under the MIT license.
|
||||
http://benalman.com/about/license/
|
||||
HELP
|
||||
exit; fi
|
||||
|
||||
if [ ! "$1" ]; then
|
||||
echo 'What manual page do you want?!'
|
||||
exit
|
||||
fi
|
||||
|
||||
cache_dir=$DOTFILES/caches/manh
|
||||
|
||||
# Figure out what the filename should be.
|
||||
file="$cache_dir/${2:+$2.}$1.html"
|
||||
|
||||
# Create directory if it doesn't exist.
|
||||
[[ -e "$cache_dir" ]] || mkdir -p "$cache_dir"
|
||||
|
||||
# Create HTML if it doesn't exist.
|
||||
[[ ! -e "$file" ]] && man "$@" >/dev/null && cat > "$file" <<EOF
|
||||
<!doctype html>
|
||||
<html>
|
||||
<link rel="stylesheet" href="../../conf/manh/styles.css">
|
||||
<body>
|
||||
$(man "$@" 2>/dev/null | man2html -bare -nodepage)
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
||||
|
||||
# Open HTML (if it does exist).
|
||||
[[ -e "$file" ]] && open "$file"
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ "$1" == "-h" || "$1" == "--help" ]]; then cat <<HELP
|
||||
Manpage-as-PDF Viewer
|
||||
http://benalman.com/
|
||||
|
||||
Usage: $(basename "$0") [section] name
|
||||
|
||||
View a manpage as PDF in the default viewer (Preview.app). Because sometimes
|
||||
you don't want to view manpages in the terminal.
|
||||
|
||||
Copyright (c) 2012 "Cowboy" Ben Alman
|
||||
Licensed under the MIT license.
|
||||
http://benalman.com/about/license/
|
||||
HELP
|
||||
exit; fi
|
||||
|
||||
if [ ! "$1" ]; then
|
||||
echo 'What manual page do you want?!'
|
||||
exit
|
||||
fi
|
||||
|
||||
cache_dir=$DOTFILES/caches/manpdf
|
||||
|
||||
# Figure out what the filename should be.
|
||||
file="$cache_dir/${2:+$2.}$1.pdf"
|
||||
|
||||
# Create directory if it doesn't exist.
|
||||
[[ -e "$cache_dir" ]] || mkdir -p "$cache_dir"
|
||||
|
||||
# Create PDF if it doesn't exist.
|
||||
[[ -e "$file" ]] || man -t "$@" | pstopdf -i -o "$file" >/dev/null 2>&1
|
||||
|
||||
# Open PDF (if it does exist).
|
||||
[[ -e "$file" ]] && open "$file"
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
# Export all .org to GFM and dokuwiki via pandoc
|
||||
find ~/Org/ -iname "*.org" -type f -exec sh -c 'pandoc "${0}" -t "markdown_github" --atx-headers -o "${0%.org}.md"' {} \;
|
||||
find ~/Org/ -iname "*.org" -type f -exec sh -c 'pandoc "${0}" -t "dokuwiki" -o "${0%.org}.dokuwiki"' {} \;
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ "$1" == "-h" || "$1" == "--help" ]]; then cat <<HELP
|
||||
Get PIDs
|
||||
http://benalman.com/
|
||||
|
||||
Usage: $(basename "$0") [processname [processname ...]]
|
||||
|
||||
Get the PIDs of all matching processes for all specified processnames.
|
||||
If no arguments are passed, list processes by PID, TTY, USER, COMMAND.
|
||||
|
||||
Copyright (c) 2012 "Cowboy" Ben Alman
|
||||
Licensed under the MIT license.
|
||||
http://benalman.com/about/license/
|
||||
HELP
|
||||
exit; fi
|
||||
|
||||
if [ ! "$1" ]; then
|
||||
ps axo pid,tty,user,command
|
||||
else
|
||||
args="$1"; shift; for arg in "$@"; do args="${args}|${arg}"; done
|
||||
echo $(ps axo pid,tty,user,command | perl -nle"m#^\s*(\d+).*(?:$args)# && !m#.dotfiles/bin/pid# && print \$1")
|
||||
fi
|
|
@ -0,0 +1,310 @@
|
|||
#!/usr/bin/perl
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
rename - renames multiple files
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
F<rename>
|
||||
S<B<-h>>
|
||||
|
||||
F<rename>
|
||||
S<B<--man>>
|
||||
|
||||
F<rename>
|
||||
S<B<[ -0 ]>>
|
||||
S<B<[ -c ]>>
|
||||
S<B<[ -C ]>>
|
||||
S<B<[ -e code ]>>
|
||||
S<B<[ -f ]>>
|
||||
S<B<[ -i ]>>
|
||||
S<B<[ -l | -L ]>>
|
||||
S<B<[ -n ]>>
|
||||
S<B<[ -s from to ]>>
|
||||
S<B<[ -v ]>>
|
||||
S<B<[ files ]>>
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
C<rename> renames the filenames supplied according to the rules specified. If a given filename is not modified, it will not be renamed. If no filenames are given on the command line, filenames will be read via standard input.
|
||||
|
||||
For example, to rename all files matching C<*.bak> to strip the extension, you might say
|
||||
|
||||
rename 's/\.bak$//' *.bak
|
||||
|
||||
If are confident that none of the filenames has C<.bak> anywhere else than at the end, you can also use the much easier typed
|
||||
|
||||
rename -s .bak '' *.bak
|
||||
|
||||
You can always do multiple changes in one ago:
|
||||
|
||||
rename -s .tgz .tar.gz -s .tbz2 .tar.bz2 *.tar.*
|
||||
|
||||
Note however that expressive options are order sensitive. The following would probably surprise you:
|
||||
|
||||
rename -s foo bar -s bar baz *
|
||||
|
||||
Since operations are cumulative, this would end up substituting (some of) the F<foo> matches in filenames with F<baz>! So pay attention to order. You may want to request a verbose dry run with C<-nv> for the first stab at a complex rename operation.
|
||||
|
||||
rename -nv -s bar baz -s foo bar *
|
||||
|
||||
You can combine the various expressive options to suit your needs. F.ex files from Microsoft(tm) Windows systems often have blanks and (sometimes nothing but) capital letters in their names. Let's say you have a bunch of such files to clean up, and you also want to move them to subdirectories based on extension. The following command should help, provided all directories already exist:
|
||||
|
||||
rename -cz -e '$_ = "$1/$_" if /(\..*)\z/' *
|
||||
|
||||
Again you need to pay attention to order sensitivity for expressive options. If you placed the C<-c> after the C<-e> in the above example, files with F<.zip> and F<.ZIP> extensions would be (attempted to be) moved to different directories because the directory name prefix would be added before the filenames were normalized. Once again, use verbose dry run requested using C<-nv> to get an idea of what exactly a complex rename operation is going to do.
|
||||
|
||||
=head1 ARGUMENTS
|
||||
|
||||
=over 4
|
||||
|
||||
=item B<-h>, B<--help>
|
||||
|
||||
See a synopsis.
|
||||
|
||||
=item B<--man>
|
||||
|
||||
Browse the manpage.
|
||||
|
||||
=back
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 4
|
||||
|
||||
=item B<-0>, B<--null>
|
||||
|
||||
When reading file names from C<STDIN>, split on NUL bytes instead of newlines. This is useful in combination with GNU find's C<-print0> option, GNU grep's C<-Z> option, and GNU sort's C<-z> option, to name just a few. B<Only valid if no filenames have been given on the commandline.>
|
||||
|
||||
=item B<-c>, B<--lower-case>
|
||||
|
||||
Converts file names to all lower case.
|
||||
|
||||
=item B<-C>, B<--upper-case>
|
||||
|
||||
Converts file names to all upper case.
|
||||
|
||||
=item B<-e>, B<--expr>
|
||||
|
||||
The C<code> argument to this option should be a Perl expression that assumes the filename in the C<$_> variable and modifies it for the filenames to be renamed. When no other C<-c>, C<-C>, C<-e>, C<-s>, or C<-z> options are given, you can omit the C<-e> from infront of the code.
|
||||
|
||||
=item B<-g>, B<--glob>
|
||||
|
||||
Glob filename arguments. This is useful if you're using a braindead shell such as F<cmd.exe> which won't expand wildcards on behalf of the user.
|
||||
|
||||
=item B<-f>, B<--force>
|
||||
|
||||
Rename even when a file with the destination name already exists.
|
||||
|
||||
=item B<-i>, B<--interactive>
|
||||
|
||||
Ask the user to confirm every action before it is taken.
|
||||
|
||||
=item B<-k>, B<--backwards>, B<--reverse-order>
|
||||
|
||||
Process the list of files in reverse order, last file first. This prevents conflicts when renaming files to names which are currently taken but would be freed later during the process of renaming.
|
||||
|
||||
=item B<-l>, B<--symlink>
|
||||
|
||||
Create symlinks from the new names to the existing ones, instead of renaming the files. B<Cannot be used in conjunction with C<-L>.>
|
||||
|
||||
=item B<-L>, B<--hardlink>
|
||||
|
||||
Create hard links from the new names to the existing ones, instead of renaming the files. B<Cannot be used in conjunction with C<-l>.>
|
||||
|
||||
=item B<-n>, B<--dry-run>, B<--just-print>
|
||||
|
||||
Show how the files would be renamed, but don't actually do anything.
|
||||
|
||||
=item B<-s>, B<--subst>, B<--simple>
|
||||
|
||||
Perform a simple textual substitution of C<from> to C<to>. The C<from> and C<to> parameters must immediately follow the argument.
|
||||
|
||||
Quoting issues aside, this is equivalent to supplying a C<-e 's/\Qfrom/to/'>.
|
||||
|
||||
=item B<-v>, B<--verbose>
|
||||
|
||||
Print additional information about the operations (not) executed.
|
||||
|
||||
=item B<-z>, B<--sanitize>
|
||||
|
||||
Replaces consecutive blanks, shell meta characters, and control characters in filenames with underscores.
|
||||
|
||||
=back
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
mv(1), perl(1), find(1), grep(1), sort(1)
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
None currently known.
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Aristotle Pagaltzis
|
||||
|
||||
Idea, inspiration and original code from Larry Wall and Robin Barker.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|
||||
|
||||
=cut
|
||||
|
||||
use Pod::Usage;
|
||||
use Getopt::Long 2.24, qw(:config bundling no_ignore_case no_auto_abbrev);
|
||||
|
||||
use constant ERROR => do { bless \(my $l = 0), 'LOGLEVEL' };
|
||||
use constant INFO => do { bless \(my $l = 1), 'LOGLEVEL' };
|
||||
use constant DEBUG => do { bless \(my $l = 2), 'LOGLEVEL' };
|
||||
use constant VERB_FOR => {
|
||||
link => {
|
||||
inf => 'link',
|
||||
pastp => 'linked',
|
||||
exec => sub { link shift, shift or die },
|
||||
},
|
||||
symlink => {
|
||||
inf => 'symlink',
|
||||
pastp => 'symlinked',
|
||||
exec => sub { symlink shift, shift or die },
|
||||
},
|
||||
rename => {
|
||||
inf => 'rename',
|
||||
pastp => 'renamed',
|
||||
exec => sub { rename shift, shift or die },
|
||||
},
|
||||
};
|
||||
|
||||
sub argv_to_subst_expr {
|
||||
my $modifier = shift || '';
|
||||
pod2usage( -verbose => 1 ) if @ARGV < 2;
|
||||
my ($from, $to) = map quotemeta, splice @ARGV, 0, 2;
|
||||
# the ugly \${\""} construct is necessary because unknown backslash escapes are
|
||||
# not treated the same in pattern- vs doublequote-quoting context; only the
|
||||
# latter lets us do the right thing with problematic input like
|
||||
# ']{ool(haracter$' or maybe '>><//((/>'
|
||||
sprintf 's/\Q${\"%s"}/%s/%s', $from, $to, $modifier;
|
||||
}
|
||||
|
||||
my @EXPR;
|
||||
|
||||
GetOptions(
|
||||
'h|help' => sub { pod2usage( -verbose => 1 ) },
|
||||
'man' => sub { pod2usage( -verbose => 2 ) },
|
||||
'0|null' => \my $opt_null,
|
||||
'c|lower-case' => sub { push @EXPR, 's/([[:upper:]]+)/\L$1/g' },
|
||||
'C|upper-case' => sub { push @EXPR, 's/([[:lower:]]+)/\U$1/g' },
|
||||
'e|expr=s' => \@EXPR,
|
||||
'f|force' => \my $opt_force,
|
||||
'g|glob' => \my $opt_glob,
|
||||
'i|interactive' => \my $opt_interactive,
|
||||
'k|backwards|reverse-order' => \my $opt_backwards,
|
||||
'l|symlink' => \my $opt_symlink,
|
||||
'L|hardlink' => \my $opt_hardlink,
|
||||
'n|just-print|dry-run' => \my $opt_dryrun,
|
||||
'p|mkpath|make-dirs' => \my $opt_mkpath,
|
||||
'v|verbose+' => \(my $opt_verbose = 0),
|
||||
'z|sanitize' => sub { push @EXPR, 's/[!"\$&()=?`*\';<>|_[:cntrl:][:blank:]]+/_/g' },
|
||||
's|subst|simple' => sub { push @EXPR, argv_to_subst_expr },
|
||||
'S|subst-global' => sub { push @EXPR, argv_to_subst_expr('g') },
|
||||
) or pod2usage( -verbose => 1 );
|
||||
|
||||
die "TODO" if $opt_mkpath;
|
||||
|
||||
if(not @EXPR) {
|
||||
pod2usage( -verbose => 1 ) if not @ARGV or -e $ARGV[0];
|
||||
push @EXPR, shift;
|
||||
}
|
||||
|
||||
pod2usage( -verbose => 1 )
|
||||
if ($opt_hardlink and $opt_symlink)
|
||||
or ($opt_null and @ARGV);
|
||||
|
||||
++$opt_verbose if $opt_dryrun;
|
||||
|
||||
BEGIN {
|
||||
*CORE::GLOBAL::warn = sub {
|
||||
if(ref $_[0] eq 'LOGLEVEL') {
|
||||
my $msglevel = ${(shift)};
|
||||
print "@_\n" if $opt_verbose >= $msglevel;
|
||||
return;
|
||||
}
|
||||
warn @_;
|
||||
};
|
||||
}
|
||||
|
||||
my $code = do {
|
||||
my $cat = "sub { ".join('; ', @EXPR)." }";
|
||||
warn DEBUG, "Using expression: $cat";
|
||||
|
||||
my $evaled = eval $cat;
|
||||
die $@ if $@;
|
||||
die "Evaluation to subref failed. Check expression using -vn\n"
|
||||
unless 'CODE' eq ref $evaled;
|
||||
|
||||
$evaled;
|
||||
};
|
||||
|
||||
my $verb = VERB_FOR->{
|
||||
$opt_hardlink ? 'link' :
|
||||
$opt_symlink ? 'symlink' :
|
||||
do { 'rename' }
|
||||
};
|
||||
|
||||
if (!@ARGV) {
|
||||
warn INFO, "Reading filenames from STDIN";
|
||||
@ARGV = do {
|
||||
if($opt_null) {
|
||||
warn INFO, "Splitting on NUL bytes";
|
||||
local $/ = "\0";
|
||||
}
|
||||
<STDIN>;
|
||||
};
|
||||
chomp @ARGV;
|
||||
}
|
||||
|
||||
@ARGV = map glob, @ARGV if $opt_glob;
|
||||
|
||||
@ARGV = reverse @ARGV if $opt_backwards;
|
||||
|
||||
for (@ARGV) {
|
||||
my $old = $_;
|
||||
|
||||
$code->();
|
||||
|
||||
if($old eq $_) {
|
||||
warn DEBUG, "'$old' unchanged";
|
||||
next;
|
||||
}
|
||||
|
||||
if(!$opt_force and -e) {
|
||||
warn ERROR, "'$old' not $verb->{pastp}: '$_' already exists";
|
||||
next;
|
||||
}
|
||||
|
||||
if($opt_dryrun) {
|
||||
warn INFO, "'$old' would be $verb->{pastp} to '$_'";
|
||||
next;
|
||||
}
|
||||
|
||||
if($opt_interactive) {
|
||||
print "\u$verb->{inf} '$old' to '$_'? [n] ";
|
||||
if(<STDIN> !~ /^y(?:es)?$/i) {
|
||||
warn DEBUG, "Skipping '$old'.";
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
eval { $verb->{exec}($old, $_) };
|
||||
|
||||
if($@) {
|
||||
warn ERROR, "Can't $verb->{inf} '$old' to '$_': $!";
|
||||
next;
|
||||
}
|
||||
|
||||
warn INFO, "'$old' $verb->{pastp} to '$_'";
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ ! "$1" || "$1" == "-h" || "$1" == "--help" ]]; then cat <<HELP
|
||||
Resample specified images to 72 DPI
|
||||
http://benalman.com/
|
||||
|
||||
Usage: $(basename "$0") [img [img ...]]
|
||||
|
||||
The new MacBook Pro retina display is amazing, but screengrabs taken on
|
||||
one using the screencapture utility aren't scaled to 72 DPI by default.
|
||||
This script scales those images to 72 DPI, making them viewable at a sane
|
||||
resolution in web browsers.
|
||||
|
||||
Copyright (c) 2012 "Cowboy" Ben Alman
|
||||
Licensed under the MIT license.
|
||||
http://benalman.com/about/license/
|
||||
HELP
|
||||
[[ "$1" ]]; exit; fi
|
||||
|
||||
while [[ "$1" ]]; do
|
||||
file="$1"; shift
|
||||
|
||||
dpiWidth=$(sips "$file" -g dpiWidth | awk '/:/ {print $2}')
|
||||
dpiHeight=$(sips "$file" -g dpiHeight | awk '/:/ {print $2}')
|
||||
pixelWidth=$(sips "$file" -g pixelWidth | awk '/:/ {print $2}')
|
||||
pixelHeight=$(sips "$file" -g pixelHeight | awk '/:/ {print $2}')
|
||||
|
||||
if [[ "$(echo "$dpiWidth - 72" | bc)" == "0" || "$(echo "$dpiHeight - 72" | bc)" == "0" ]]; then
|
||||
echo "File $(basename "$file") already ${pixelWidth}x${pixelHeight} pixels @ 72 DPI."
|
||||
continue
|
||||
fi
|
||||
|
||||
w=$(echo "$pixelWidth * 72 / $dpiWidth" | bc)
|
||||
h=$(echo "$pixelHeight * 72 / $dpiHeight" | bc)
|
||||
|
||||
echo "Resampling $(basename "$file") to ${w}x${h} pixels @ 72 DPI."
|
||||
sips "$file" -s dpiWidth 72 -s dpiHeight 72 -z $h $w >/dev/null 2>&1
|
||||
done
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ "$1" == "-h" || "$1" == "--help" ]]; then cat <<HELP
|
||||
Get WiFi SSID
|
||||
http://benalman.com/
|
||||
|
||||
Usage: $(basename "$0")
|
||||
|
||||
If an SSID is specified and it is the current WiFi network's SSID, echo it,
|
||||
otherwise echo nothing.
|
||||
|
||||
Copyright (c) 2012 "Cowboy" Ben Alman
|
||||
Licensed under the MIT license.
|
||||
http://benalman.com/about/license/
|
||||
HELP
|
||||
exit; fi
|
||||
|
||||
ssid=$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I | grep " SSID" | sed "s/.*: //")
|
||||
|
||||
if [ "$1" ]; then
|
||||
if [ "$(echo $ssid | grep -w $1)" ]; then
|
||||
echo $1
|
||||
fi
|
||||
else
|
||||
echo $ssid
|
||||
fi
|
|
@ -0,0 +1,37 @@
|
|||
/* Colors from http://ethanschoonover.com/solarized */
|
||||
/* Fonts from http://mplus-fonts.sourceforge.jp/mplus-outline-fonts/design/index-en.html */
|
||||
|
||||
body {
|
||||
color: #839496;
|
||||
background: #002b36;
|
||||
padding: 0;
|
||||
margin: 0 0 3em 1.5em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #2aa198;
|
||||
}
|
||||
|
||||
b {
|
||||
color: #93a1a1;
|
||||
}
|
||||
|
||||
i {
|
||||
font-style: normal;
|
||||
text-decoration: underline;
|
||||
color: #b58900;
|
||||
}
|
||||
|
||||
h2,
|
||||
pre {
|
||||
font-family: mplus-2m-regular, Monaco, monospace;
|
||||
}
|
||||
|
||||
pre {
|
||||
margin: -0.5em 0 -1.5em;
|
||||
}
|
||||
|
||||
body > hr,
|
||||
body > address {
|
||||
display: none;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
[user]
|
||||
name = David Trudgian
|
||||
email = EMAIL
|
||||
[core]
|
||||
excludesfile = ~/.gitignore_global
|
||||
[color]
|
||||
ui = auto
|
||||
[color "branch"]
|
||||
current = yellow reverse
|
||||
local = yellow
|
||||
remote = green
|
||||
[color "diff"]
|
||||
meta = yellow bold
|
||||
frag = magenta bold
|
||||
old = red bold
|
||||
new = green bold
|
||||
[color "status"]
|
||||
added = yellow
|
||||
changed = green
|
||||
untracked = cyan
|
|
@ -0,0 +1,205 @@
|
|||
# Server Options
|
||||
# --------------
|
||||
set spoolfile="~/Maildir/INBOX"
|
||||
set folder="~/Maildir"
|
||||
set smtp_url=""
|
||||
set from=""
|
||||
set realname=""
|
||||
|
||||
# Paths
|
||||
# -----
|
||||
#set header_cache=~/.mutt/cache/headers
|
||||
set message_cachedir=~/.mutt/cache/bodies
|
||||
|
||||
# Mailboxes
|
||||
# ---------
|
||||
set record="=Sent Items"
|
||||
set postponed="=Drafts"
|
||||
set trash="=Trash"
|
||||
mailboxes =INBOX =INBOX.Tickets =INBOX.Lists
|
||||
|
||||
# Signatures
|
||||
# ----------
|
||||
set sig_dashes
|
||||
set signature="~/.signature"
|
||||
|
||||
# EMACS
|
||||
# -----
|
||||
set editor = emacsclient
|
||||
|
||||
# Status Bar
|
||||
# ----------
|
||||
set status_chars=" *%A"
|
||||
set status_format="───[ Folder: %f ]───[%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]───%>─%?p?( %p postponed )?───"
|
||||
|
||||
# Message Index
|
||||
# -------------
|
||||
set sort='threads'
|
||||
set sort_aux = reverse-last-date-received
|
||||
set uncollapse_jump
|
||||
set date_format="%e %b %Y %H:%M"
|
||||
set index_format="%3C|%Z|%d| %-20.20F (%-4.4c) %s"
|
||||
|
||||
# Message Viewing
|
||||
# ---------------
|
||||
set pipe_decode
|
||||
set thorough_search
|
||||
auto_view text/html
|
||||
alternative_order text/plain text/enriched text/html
|
||||
ignore *
|
||||
unignore from: to: cc: date: subject:
|
||||
unhdr_order *
|
||||
hdr_order from: to: cc: date: subject:
|
||||
|
||||
# Composing
|
||||
# ---------
|
||||
set edit_headers
|
||||
set fast_reply
|
||||
set askcc
|
||||
set fcc_attach
|
||||
unset mime_forward
|
||||
set forward_format="Fwd: %s"
|
||||
set forward_decode
|
||||
set attribution="On %d, %n wrote:"
|
||||
set reply_to
|
||||
set reverse_name
|
||||
set include
|
||||
set forward_quote
|
||||
|
||||
set pager_index_lines=10
|
||||
set pager_context=3
|
||||
set pager_stop
|
||||
set menu_scroll
|
||||
set tilde
|
||||
unset markers
|
||||
|
||||
set quote_regexp = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"
|
||||
|
||||
macro pager \Cu "|urlview<enter>" "call urlview to open links"
|
||||
|
||||
# Don't ask for everything
|
||||
# ------------------------
|
||||
set delete
|
||||
unset confirmappend
|
||||
set quit
|
||||
|
||||
# Sidebar Patch
|
||||
# -------------
|
||||
set sidebar_visible = yes
|
||||
set sidebar_width = 20
|
||||
bind index,pager CP sidebar-next
|
||||
bind index,pager CN sidebar-prev
|
||||
bind index,pager CO sidebar-open
|
||||
set sidebar_short_path = yes
|
||||
set sidebar_delim_chars = '/.'
|
||||
set sidebar_folder_indent = yes
|
||||
set sidebar_indent_string = ' '
|
||||
set sidebar_divider_char = '|'
|
||||
set mail_check_stats
|
||||
set sidebar_format = '%B%?F? [%F]?%* %?N?%N/?%S'
|
||||
|
||||
# Notifications for new mail
|
||||
set new_mail_command="notify-send 'New Email in %f' '%n new messages, %u unread.' &"
|
||||
|
||||
# Compose a new email (not a reply) to the sender
|
||||
bind index,pager @ compose-to-sender
|
||||
|
||||
# for background in 16 color terminal, valid background colors include:
|
||||
# base03, bg, black, any of the non brights
|
||||
|
||||
# basic colors ---------------------------------------------------------
|
||||
color normal brightyellow default
|
||||
color error red default
|
||||
color tilde black default
|
||||
color message cyan default
|
||||
color markers red white
|
||||
color attachment white default
|
||||
color search brightmagenta default
|
||||
#color status J_black J_status
|
||||
color status brightyellow black
|
||||
color indicator brightblack yellow
|
||||
color tree yellow default # arrow in threads
|
||||
|
||||
# basic monocolor screen
|
||||
mono bold bold
|
||||
mono underline underline
|
||||
mono indicator reverse
|
||||
mono error bold
|
||||
|
||||
# index ----------------------------------------------------------------
|
||||
color index red default "~A" # all messages
|
||||
color index brightred default "~E" # expired messages
|
||||
color index blue default "~N" # new messages
|
||||
color index blue default "~O" # old messages
|
||||
color index brightmagenta default "~Q" # messages that have been replied to
|
||||
color index brightgreen default "~R" # read messages
|
||||
color index blue default "~U" # unread messages
|
||||
color index blue default "~U~$" # unread, unreferenced messages
|
||||
color index brightyellow default "~v" # messages part of a collapsed thread
|
||||
color index brightyellow default "~P" # messages from me
|
||||
color index cyan default "~p!~F" # messages to me
|
||||
color index cyan default "~N~p!~F" # new messages to me
|
||||
color index cyan default "~U~p!~F" # unread messages to me
|
||||
color index brightgreen default "~R~p!~F" # messages to me
|
||||
color index red default "~F" # flagged messages
|
||||
color index red default "~F~p" # flagged messages to me
|
||||
color index red default "~N~F" # new flagged messages
|
||||
color index red default "~N~F~p" # new flagged messages to me
|
||||
color index red default "~U~F~p" # new flagged messages to me
|
||||
color index black red "~D" # deleted messages
|
||||
color index brightcyan default "~v~(!~N)" # collapsed thread with no unread
|
||||
color index yellow default "~v~(~N)" # collapsed thread with some unread
|
||||
color index green default "~N~v~(~N)" # collapsed thread with unread parent
|
||||
# statusbg used to indicated flagged when foreground color shows other status
|
||||
# for collapsed thread
|
||||
color index red black "~v~(~F)!~N" # collapsed thread with flagged, no unread
|
||||
color index yellow black "~v~(~F~N)" # collapsed thread with some unread & flagged
|
||||
color index green black "~N~v~(~F~N)" # collapsed thread with unread parent & flagged
|
||||
color index green black "~N~v~(~F)" # collapsed thread with unread parent, no unread inside, but some flagged
|
||||
color index cyan black "~v~(~p)" # collapsed thread with unread parent, no unread inside, some to me directly
|
||||
color index yellow red "~v~(~D)" # thread with deleted (doesn't differentiate between all or partial)
|
||||
|
||||
# message headers ------------------------------------------------------
|
||||
#color header brightgreen default "^"
|
||||
color hdrdefault brightgreen default
|
||||
color header brightyellow default "^(From)"
|
||||
color header blue default "^(Subject)"
|
||||
|
||||
# body -----------------------------------------------------------------
|
||||
color quoted blue default
|
||||
color quoted1 cyan default
|
||||
color quoted2 yellow default
|
||||
color quoted3 red default
|
||||
color quoted4 brightred default
|
||||
|
||||
color signature brightgreen default
|
||||
color bold black default
|
||||
color underline black default
|
||||
color normal default default
|
||||
#
|
||||
color body brightcyan default "[;:][-o][)/(|]" # emoticons
|
||||
color body brightcyan default "[;:][)(|]" # emoticons
|
||||
color body brightcyan default "[*]?((N)?ACK|CU|LOL|SCNR|BRB|BTW|CWYL|\
|
||||
|FWIW|vbg|GD&R|HTH|HTHBE|IMHO|IMNSHO|\
|
||||
|IRL|RTFM|ROTFL|ROFL|YMMV)[*]?"
|
||||
color body brightcyan default "[ ][*][^*]*[*][ ]?" # more emoticon?
|
||||
color body brightcyan default "[ ]?[*][^*]*[*][ ]" # more emoticon?
|
||||
|
||||
## pgp
|
||||
|
||||
color body red default "(BAD signature)"
|
||||
color body cyan default "(Good signature)"
|
||||
color body brightblack default "^gpg: Good signature .*"
|
||||
color body brightyellow default "^gpg: "
|
||||
color body brightyellow red "^gpg: BAD signature from.*"
|
||||
mono body bold "^gpg: Good signature"
|
||||
mono body bold "^gpg: BAD signature from.*"
|
||||
|
||||
# yes, an insance URL regex
|
||||
color body red default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]"
|
||||
# and a heavy handed email regex
|
||||
color body red default "((@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\]),)*@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\]):)?[0-9a-z_.+%$-]+@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\])"
|
||||
|
||||
# Border lines.
|
||||
color body blue default "( *[-+=#*~_]){6,}"
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
Host *
|
||||
|
||||
# Forward ssh agent to the remote machine.
|
||||
ForwardAgent yes
|
||||
|
||||
# Automatically add all common hosts to the host file as they are connected to.
|
||||
StrictHostKeyChecking no
|
|
@ -0,0 +1,9 @@
|
|||
# OSX-only stuff. Abort if not OSX.
|
||||
is_osx || return 1
|
||||
|
||||
# Some tools look for XCode, even though they don't need it.
|
||||
# https://github.com/joyent/node/issues/3681
|
||||
# https://github.com/mxcl/homebrew/issues/10245
|
||||
if [[ ! -d "$('xcode-select' -print-path 2>/dev/null)" ]]; then
|
||||
sudo xcode-select -switch /usr/bin
|
||||
fi
|
|
@ -0,0 +1,39 @@
|
|||
# OSX-only stuff. Abort if not OSX.
|
||||
is_osx || return 1
|
||||
|
||||
# Install Homebrew.
|
||||
if [[ ! "$(type -P brew)" ]]; then
|
||||
e_header "Installing Homebrew"
|
||||
true | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
fi
|
||||
|
||||
# Exit if, for some reason, Homebrew is not installed.
|
||||
[[ ! "$(type -P brew)" ]] && e_error "Homebrew failed to install." && return 1
|
||||
|
||||
e_header "Updating Homebrew"
|
||||
brew doctor
|
||||
brew update
|
||||
|
||||
# Functions used in subsequent init scripts.
|
||||
|
||||
# Tap Homebrew kegs.
|
||||
function brew_tap_kegs() {
|
||||
kegs=($(setdiff "${kegs[*]}" "$(brew tap)"))
|
||||
if (( ${#kegs[@]} > 0 )); then
|
||||
e_header "Tapping Homebrew kegs: ${kegs[*]}"
|
||||
for keg in "${kegs[@]}"; do
|
||||
brew tap $keg
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# Install Homebrew recipes.
|
||||
function brew_install_recipes() {
|
||||
recipes=($(setdiff "${recipes[*]}" "$(brew list)"))
|
||||
if (( ${#recipes[@]} > 0 )); then
|
||||
e_header "Installing Homebrew recipes: ${recipes[*]}"
|
||||
for recipe in "${recipes[@]}"; do
|
||||
brew install $recipe
|
||||
done
|
||||
fi
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
# OSX-only stuff. Abort if not OSX.
|
||||
is_osx || return 1
|
||||
|
||||
# Exit if Homebrew is not installed.
|
||||
[[ ! "$(type -P brew)" ]] && e_error "Brew casks need Homebrew to install." && return 1
|
||||
|
||||
# Ensure the cask keg and recipe are installed.
|
||||
kegs=(caskroom/cask)
|
||||
brew_tap_kegs
|
||||
recipes=(brew-cask)
|
||||
brew_install_recipes
|
||||
|
||||
# Exit if, for some reason, cask is not installed.
|
||||
[[ ! "$(brew ls --versions brew-cask)" ]] && e_error "Brew-cask failed to install." && return 1
|
||||
|
||||
# Hack to show the first-run brew-cask password prompt immediately.
|
||||
brew cask info this-is-somewhat-annoying 2>/dev/null
|
||||
|
||||
# Homebrew casks
|
||||
casks=(
|
||||
# Applications
|
||||
adobe-reader
|
||||
boot2docker
|
||||
firefox
|
||||
google-chrome
|
||||
iterm2
|
||||
macvim
|
||||
remote-desktop-connection
|
||||
spotify
|
||||
vagrant
|
||||
virtualbox
|
||||
)
|
||||
|
||||
# Install Homebrew casks.
|
||||
casks=($(setdiff "${casks[*]}" "$(brew cask list 2>/dev/null)"))
|
||||
if (( ${#casks[@]} > 0 )); then
|
||||
e_header "Installing Homebrew casks: ${casks[*]}"
|
||||
for cask in "${casks[@]}"; do
|
||||
brew cask install $cask
|
||||
done
|
||||
brew cask cleanup
|
||||
fi
|
||||
|
||||
# Work around colorPicker symlink issue.
|
||||
# https://github.com/caskroom/homebrew-cask/issues/7004
|
||||
cps=()
|
||||
for f in ~/Library/ColorPickers/*.colorPicker; do
|
||||
[[ -L "$f" ]] && cps=("${cps[@]}" "$f")
|
||||
done
|
||||
|
||||
if (( ${#cps[@]} > 0 )); then
|
||||
e_header "Fixing colorPicker symlinks"
|
||||
for f in "${cps[@]}"; do
|
||||
target="$(readlink "$f")"
|
||||
e_arrow "$(basename "$f")"
|
||||
rm "$f"
|
||||
cp -R "$target" ~/Library/ColorPickers/
|
||||
done
|
||||
fi
|
|
@ -0,0 +1,41 @@
|
|||
# OSX-only stuff. Abort if not OSX.
|
||||
is_osx || return 1
|
||||
|
||||
# Exit if Homebrew is not installed.
|
||||
[[ ! "$(type -P brew)" ]] && e_error "Brew recipes need Homebrew to install." && return 1
|
||||
|
||||
# Homebrew recipes
|
||||
recipes=(
|
||||
ansible
|
||||
bash
|
||||
git
|
||||
htop-osx
|
||||
man2html
|
||||
mercurial
|
||||
ssh-copy-id
|
||||
)
|
||||
|
||||
brew_install_recipes
|
||||
|
||||
# Misc cleanup!
|
||||
|
||||
# This is where brew stores its binary symlinks
|
||||
local binroot="$(brew --config | awk '/HOMEBREW_PREFIX/ {print $2}')"/bin
|
||||
|
||||
# htop
|
||||
if [[ "$(type -P $binroot/htop)" ]] && [[ "$(stat -L -f "%Su:%Sg" "$binroot/htop")" != "root:wheel" || ! "$(($(stat -L -f "%DMp" "$binroot/htop") & 4))" ]]; then
|
||||
e_header "Updating htop permissions"
|
||||
sudo chown root:wheel "$binroot/htop"
|
||||
sudo chmod u+s "$binroot/htop"
|
||||
fi
|
||||
|
||||
# bash
|
||||
if [[ "$(type -P $binroot/bash)" && "$(cat /etc/shells | grep -q "$binroot/bash")" ]]; then
|
||||
e_header "Adding $binroot/bash to the list of acceptable shells"
|
||||
echo "$binroot/bash" | sudo tee -a /etc/shells >/dev/null
|
||||
fi
|
||||
if [[ "$(dscl . -read ~ UserShell | awk '{print $2}')" != "$binroot/bash" ]]; then
|
||||
e_header "Making $binroot/bash your default shell"
|
||||
sudo chsh -s "$binroot/bash" "$USER" >/dev/null 2>&1
|
||||
e_arrow "Please exit and restart all your shells."
|
||||
fi
|
|
@ -0,0 +1,8 @@
|
|||
# Backups, swaps and undos are stored here.
|
||||
mkdir -p $DOTFILES/caches/vim
|
||||
|
||||
# Download Vim plugins.
|
||||
if [[ "$(type -P vim)" ]]; then
|
||||
vim +PlugUpgrade +PlugUpdate +qall
|
||||
fi
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
!Fonts
|
||||
Xterm*faceName: Source Code Pro,Source Code Pro Semibold
|
||||
XTerm*faceSize: 14
|
||||
|
||||
UXterm*faceName: Source Code Pro, Source Code Pro Semibold
|
||||
UXterm*faceSize: 14
|
||||
|
||||
!Colors
|
||||
*foreground: #000000
|
||||
*background: #ffffff
|
||||
*color0: #2E3436
|
||||
*color1: #CC0000
|
||||
*color2: #4E9A06
|
||||
*color3: #C4A000
|
||||
*color4: #3465A4
|
||||
*color5: #75507B
|
||||
*color6: #06989A
|
||||
*color7: #D3D7CF
|
||||
*color8: #555753
|
||||
*color9: #EF2929
|
||||
*color10: #8AE234
|
||||
*color11: #FCE94F
|
||||
*color12: #729FCF
|
||||
*color13: #AD7FA8
|
||||
*color14: #34E2E2
|
||||
*color15: #EEEEEC
|
|
@ -0,0 +1,4 @@
|
|||
if [ -f ~/.bashrc ]; then
|
||||
source ~/.bashrc
|
||||
fi
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
if [ -z "$PS1" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
# Where the magic happens.
|
||||
export DOTFILES=~/.dotfiles
|
||||
|
||||
# Add binaries into the path
|
||||
PATH=$DOTFILES/bin:$PATH
|
||||
export PATH
|
||||
|
||||
# Source all files in "source"
|
||||
function src() {
|
||||
local file
|
||||
if [[ "$1" ]]; then
|
||||
source "$DOTFILES/source/$1.sh"
|
||||
else
|
||||
for file in $DOTFILES/source/*; do
|
||||
source "$file"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# Run dotfiles script, then source.
|
||||
function dotfiles() {
|
||||
$DOTFILES/bin/dotfiles "$@" && src
|
||||
}
|
||||
|
||||
src
|
|
@ -0,0 +1,475 @@
|
|||
# Exact Solarized Dark color theme for the color GNU ls utility.
|
||||
# Designed for dircolors (GNU coreutils) 5.97
|
||||
#
|
||||
# This simple theme was simultaneously designed for these terminal color schemes:
|
||||
# - Solarized dark (best)
|
||||
# - Solarized light
|
||||
# - default dark
|
||||
# - default light
|
||||
# with a slight optimization for Solarized Dark.
|
||||
#
|
||||
# How the colors were selected:
|
||||
# - Terminal emulators often have an option typically enabled by default that makes
|
||||
# bold a different color. It is important to leave this option enabled so that
|
||||
# you can access the entire 16-color Solarized palette, and not just 8 colors.
|
||||
# - We favor universality over a greater number of colors. So we limit the number
|
||||
# of colors so that this theme will work out of the box in all terminals,
|
||||
# Solarized or not, dark or light.
|
||||
# - We choose to have the following category of files:
|
||||
# NORMAL & FILE, DIR, LINK, EXEC and
|
||||
# editable text including source, unimportant text, binary docs & multimedia source
|
||||
# files, viewable multimedia, archived/compressed, and unimportant non-text
|
||||
# - For uniqueness, we stay away from the Solarized foreground colors are -- either
|
||||
# base00 (brightyellow) or base0 (brightblue). However, they can be used if
|
||||
# you know what the bg/fg colors of your terminal are, in order to optimize the display.
|
||||
# - 3 different options are provided: universal, solarized dark, and solarized light.
|
||||
# The only difference between the universal scheme and one that's optimized for
|
||||
# dark/light is the color of "unimportant" files, which should blend more with the
|
||||
# background
|
||||
# - We note that blue is the hardest color to see on dark bg and yellow is the hardest
|
||||
# color to see on light bg (with blue being particularly bad). So we choose yellow
|
||||
# for multimedia files which are usually accessed in a GUI folder browser anyway.
|
||||
# And blue is kept for custom use of this scheme's user.
|
||||
# - See table below to see the assignments.
|
||||
|
||||
|
||||
# Installation instructions:
|
||||
# This file goes in the /etc directory, and must be world readable.
|
||||
# You can copy this file to .dir_colors in your $HOME directory to override
|
||||
# the system defaults.
|
||||
|
||||
# COLOR needs one of these arguments: 'tty' colorizes output to ttys, but not
|
||||
# pipes. 'all' adds color characters to all output. 'none' shuts colorization
|
||||
# off.
|
||||
COLOR tty
|
||||
|
||||
# Below, there should be one TERM entry for each termtype that is colorizable
|
||||
TERM ansi
|
||||
TERM color_xterm
|
||||
TERM color-xterm
|
||||
TERM con132x25
|
||||
TERM con132x30
|
||||
TERM con132x43
|
||||
TERM con132x60
|
||||
TERM con80x25
|
||||
TERM con80x28
|
||||
TERM con80x30
|
||||
TERM con80x43
|
||||
TERM con80x50
|
||||
TERM con80x60
|
||||
TERM cons25
|
||||
TERM console
|
||||
TERM cygwin
|
||||
TERM dtterm
|
||||
TERM dvtm
|
||||
TERM dvtm-256color
|
||||
TERM Eterm
|
||||
TERM eterm-color
|
||||
TERM fbterm
|
||||
TERM gnome
|
||||
TERM gnome-256color
|
||||
TERM jfbterm
|
||||
TERM konsole
|
||||
TERM konsole-256color
|
||||
TERM kterm
|
||||
TERM linux
|
||||
TERM linux-c
|
||||
TERM mach-color
|
||||
TERM mlterm
|
||||
TERM nxterm
|
||||
TERM putty
|
||||
TERM putty-256color
|
||||
TERM rxvt
|
||||
TERM rxvt-256color
|
||||
TERM rxvt-cygwin
|
||||
TERM rxvt-cygwin-native
|
||||
TERM rxvt-unicode
|
||||
TERM rxvt-unicode256
|
||||
TERM rxvt-unicode-256color
|
||||
TERM screen
|
||||
TERM screen-16color
|
||||
TERM screen-16color-bce
|
||||
TERM screen-16color-s
|
||||
TERM screen-16color-bce-s
|
||||
TERM screen-256color
|
||||
TERM screen-256color-bce
|
||||
TERM screen-256color-s
|
||||
TERM screen-256color-bce-s
|
||||
TERM screen-256color-italic
|
||||
TERM screen-bce
|
||||
TERM screen-w
|
||||
TERM screen.linux
|
||||
TERM screen.xterm-256color
|
||||
TERM screen.xterm-new
|
||||
TERM st
|
||||
TERM st-meta
|
||||
TERM st-256color
|
||||
TERM st-meta-256color
|
||||
TERM tmux
|
||||
TERM tmux-256color
|
||||
TERM vt100
|
||||
TERM xterm
|
||||
TERM xterm-new
|
||||
TERM xterm-16color
|
||||
TERM xterm-256color
|
||||
TERM xterm-256color-italic
|
||||
TERM xterm-88color
|
||||
TERM xterm-color
|
||||
TERM xterm-debian
|
||||
TERM xterm-termite
|
||||
|
||||
# EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output)
|
||||
EIGHTBIT 1
|
||||
|
||||
#############################################################################
|
||||
# Below are the color init strings for the basic file types. A color init
|
||||
# string consists of one or more of the following numeric codes:
|
||||
#
|
||||
# Attribute codes:
|
||||
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
|
||||
# Text color codes:
|
||||
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
|
||||
# Background color codes:
|
||||
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
|
||||
#
|
||||
# NOTES:
|
||||
# - See http://www.oreilly.com/catalog/wdnut/excerpt/color_names.html
|
||||
# - Color combinations
|
||||
# ANSI Color code Solarized Notes Universal SolDark SolLight
|
||||
# ~~~~~~~~~~~~~~~ ~~~~~~~~~ ~~~~~ ~~~~~~~~~ ~~~~~~~ ~~~~~~~~
|
||||
# 00 none NORMAL, FILE <SAME> <SAME>
|
||||
# 30 black base02
|
||||
# 01;30 bright black base03 bg of SolDark
|
||||
# 31 red red docs & mm src <SAME> <SAME>
|
||||
# 01;31 bright red orange EXEC <SAME> <SAME>
|
||||
# 32 green green editable text <SAME> <SAME>
|
||||
# 01;32 bright green base01 unimportant text <SAME>
|
||||
# 33 yellow yellow unclear in light bg multimedia <SAME> <SAME>
|
||||
# 01;33 bright yellow base00 fg of SolLight unimportant non-text
|
||||
# 34 blue blue unclear in dark bg user customized <SAME> <SAME>
|
||||
# 01;34 bright blue base0 fg in SolDark unimportant text
|
||||
# 35 magenta magenta LINK <SAME> <SAME>
|
||||
# 01;35 bright magenta violet archive/compressed <SAME> <SAME>
|
||||
# 36 cyan cyan DIR <SAME> <SAME>
|
||||
# 01;36 bright cyan base1 unimportant non-text <SAME>
|
||||
# 37 white base2
|
||||
# 01;37 bright white base3 bg in SolLight
|
||||
# 05;37;41 unclear in Putty dark
|
||||
|
||||
|
||||
### By file type
|
||||
|
||||
# global default
|
||||
NORMAL 00
|
||||
# normal file
|
||||
FILE 00
|
||||
# directory
|
||||
DIR 34
|
||||
# 777 directory
|
||||
OTHER_WRITABLE 34;40
|
||||
# symbolic link
|
||||
LINK 35
|
||||
|
||||
# pipe, socket, block device, character device (blue bg)
|
||||
FIFO 30;44
|
||||
SOCK 35;44
|
||||
DOOR 35;44 # Solaris 2.5 and later
|
||||
BLK 33;44
|
||||
CHR 37;44
|
||||
|
||||
|
||||
#############################################################################
|
||||
### By file attributes
|
||||
|
||||
# Orphaned symlinks (blinking white on red)
|
||||
# Blink may or may not work (works on iTerm dark or light, and Putty dark)
|
||||
ORPHAN 05;37;41
|
||||
# ... and the files that orphaned symlinks point to (blinking white on red)
|
||||
MISSING 05;37;41
|
||||
|
||||
# files with execute permission
|
||||
EXEC 01;31 # Unix
|
||||
.cmd 01;31 # Win
|
||||
.exe 01;31 # Win
|
||||
.com 01;31 # Win
|
||||
.bat 01;31 # Win
|
||||
.reg 01;31 # Win
|
||||
.app 01;31 # OSX
|
||||
|
||||
#############################################################################
|
||||
### By extension
|
||||
|
||||
# List any file extensions like '.gz' or '.tar' that you would like ls
|
||||
# to colorize below. Put the extension, a space, and the color init string.
|
||||
# (and any comments you want to add after a '#')
|
||||
|
||||
### Text formats
|
||||
|
||||
# Text that we can edit with a regular editor
|
||||
.txt 32
|
||||
.org 32
|
||||
.md 32
|
||||
.mkd 32
|
||||
|
||||
# Source text
|
||||
.h 32
|
||||
.hpp 32
|
||||
.c 32
|
||||
.C 32
|
||||
.cc 32
|
||||
.cpp 32
|
||||
.cxx 32
|
||||
.objc 32
|
||||
.cl 32
|
||||
.sh 32
|
||||
.bash 32
|
||||
.csh 32
|
||||
.zsh 32
|
||||
.el 32
|
||||
.vim 32
|
||||
.java 32
|
||||
.pl 32
|
||||
.pm 32
|
||||
.py 32
|
||||
.rb 32
|
||||
.hs 32
|
||||
.php 32
|
||||
.htm 32
|
||||
.html 32
|
||||
.shtml 32
|
||||
.erb 32
|
||||
.haml 32
|
||||
.xml 32
|
||||
.rdf 32
|
||||
.css 32
|
||||
.sass 32
|
||||
.scss 32
|
||||
.less 32
|
||||
.js 32
|
||||
.coffee 32
|
||||
.man 32
|
||||
.0 32
|
||||
.1 32
|
||||
.2 32
|
||||
.3 32
|
||||
.4 32
|
||||
.5 32
|
||||
.6 32
|
||||
.7 32
|
||||
.8 32
|
||||
.9 32
|
||||
.l 32
|
||||
.n 32
|
||||
.p 32
|
||||
.pod 32
|
||||
.tex 32
|
||||
.go 32
|
||||
.sql 32
|
||||
.csv 32
|
||||
|
||||
### Multimedia formats
|
||||
|
||||
# Image
|
||||
.bmp 33
|
||||
.cgm 33
|
||||
.dl 33
|
||||
.dvi 33
|
||||
.emf 33
|
||||
.eps 33
|
||||
.gif 33
|
||||
.jpeg 33
|
||||
.jpg 33
|
||||
.JPG 33
|
||||
.mng 33
|
||||
.pbm 33
|
||||
.pcx 33
|
||||
.pdf 33
|
||||
.pgm 33
|
||||
.png 33
|
||||
.PNG 33
|
||||
.ppm 33
|
||||
.pps 33
|
||||
.ppsx 33
|
||||
.ps 33
|
||||
.svg 33
|
||||
.svgz 33
|
||||
.tga 33
|
||||
.tif 33
|
||||
.tiff 33
|
||||
.xbm 33
|
||||
.xcf 33
|
||||
.xpm 33
|
||||
.xwd 33
|
||||
.xwd 33
|
||||
.yuv 33
|
||||
|
||||
# Audio
|
||||
.aac 33
|
||||
.au 33
|
||||
.flac 33
|
||||
.m4a 33
|
||||
.mid 33
|
||||
.midi 33
|
||||
.mka 33
|
||||
.mp3 33
|
||||
.mpa 33
|
||||
.mpeg 33
|
||||
.mpg 33
|
||||
.ogg 33
|
||||
.opus 33
|
||||
.ra 33
|
||||
.wav 33
|
||||
|
||||
# Video
|
||||
.anx 33
|
||||
.asf 33
|
||||
.avi 33
|
||||
.axv 33
|
||||
.flc 33
|
||||
.fli 33
|
||||
.flv 33
|
||||
.gl 33
|
||||
.m2v 33
|
||||
.m4v 33
|
||||
.mkv 33
|
||||
.mov 33
|
||||
.MOV 33
|
||||
.mp4 33
|
||||
.mp4v 33
|
||||
.mpeg 33
|
||||
.mpg 33
|
||||
.nuv 33
|
||||
.ogm 33
|
||||
.ogv 33
|
||||
.ogx 33
|
||||
.qt 33
|
||||
.rm 33
|
||||
.rmvb 33
|
||||
.swf 33
|
||||
.vob 33
|
||||
.webm 33
|
||||
.wmv 33
|
||||
|
||||
### Misc
|
||||
|
||||
# Binary document formats and multimedia source
|
||||
.doc 31
|
||||
.docx 31
|
||||
.rtf 31
|
||||
.odt 31
|
||||
.dot 31
|
||||
.dotx 31
|
||||
.ott 31
|
||||
.xls 31
|
||||
.xlsx 31
|
||||
.ods 31
|
||||
.ots 31
|
||||
.ppt 31
|
||||
.pptx 31
|
||||
.odp 31
|
||||
.otp 31
|
||||
.fla 31
|
||||
.psd 31
|
||||
|
||||
# Archives, compressed
|
||||
.7z 1;35
|
||||
.apk 1;35
|
||||
.arj 1;35
|
||||
.bin 1;35
|
||||
.bz 1;35
|
||||
.bz2 1;35
|
||||
.cab 1;35 # Win
|
||||
.deb 1;35
|
||||
.dmg 1;35 # OSX
|
||||
.gem 1;35
|
||||
.gz 1;35
|
||||
.iso 1;35
|
||||
.jar 1;35
|
||||
.msi 1;35 # Win
|
||||
.rar 1;35
|
||||
.rpm 1;35
|
||||
.tar 1;35
|
||||
.tbz 1;35
|
||||
.tbz2 1;35
|
||||
.tgz 1;35
|
||||
.tx 1;35
|
||||
.war 1;35
|
||||
.xpi 1;35
|
||||
.xz 1;35
|
||||
.z 1;35
|
||||
.Z 1;35
|
||||
.zip 1;35
|
||||
|
||||
# For testing
|
||||
.ANSI-30-black 30
|
||||
.ANSI-01;30-brblack 01;30
|
||||
.ANSI-31-red 31
|
||||
.ANSI-01;31-brred 01;31
|
||||
.ANSI-32-green 32
|
||||
.ANSI-01;32-brgreen 01;32
|
||||
.ANSI-33-yellow 33
|
||||
.ANSI-01;33-bryellow 01;33
|
||||
.ANSI-34-blue 34
|
||||
.ANSI-01;34-brblue 01;34
|
||||
.ANSI-35-magenta 35
|
||||
.ANSI-01;35-brmagenta 01;35
|
||||
.ANSI-36-cyan 36
|
||||
.ANSI-01;36-brcyan 01;36
|
||||
.ANSI-37-white 37
|
||||
.ANSI-01;37-brwhite 01;37
|
||||
|
||||
#############################################################################
|
||||
# Your customizations
|
||||
|
||||
# Unimportant text files
|
||||
# For universal scheme, use brightgreen 01;32
|
||||
# For optimal on light bg (but too prominent on dark bg), use white 01;34
|
||||
.log 01;32
|
||||
*~ 01;32
|
||||
*# 01;32
|
||||
#.log 01;34
|
||||
#*~ 01;34
|
||||
#*# 01;34
|
||||
|
||||
# Unimportant non-text files
|
||||
# For universal scheme, use brightcyan 01;36
|
||||
# For optimal on dark bg (but too prominent on light bg), change to 01;33
|
||||
#.bak 01;36
|
||||
#.BAK 01;36
|
||||
#.old 01;36
|
||||
#.OLD 01;36
|
||||
#.org_archive 01;36
|
||||
#.off 01;36
|
||||
#.OFF 01;36
|
||||
#.dist 01;36
|
||||
#.DIST 01;36
|
||||
#.orig 01;36
|
||||
#.ORIG 01;36
|
||||
#.swp 01;36
|
||||
#.swo 01;36
|
||||
#*,v 01;36
|
||||
.bak 01;33
|
||||
.BAK 01;33
|
||||
.old 01;33
|
||||
.OLD 01;33
|
||||
.org_archive 01;33
|
||||
.off 01;33
|
||||
.OFF 01;33
|
||||
.dist 01;33
|
||||
.DIST 01;33
|
||||
.orig 01;33
|
||||
.ORIG 01;33
|
||||
.swp 01;33
|
||||
.swo 01;33
|
||||
*,v 01;33
|
||||
|
||||
# The brightmagenta (Solarized: purple) color is free for you to use for your
|
||||
# custom file type
|
||||
.gpg 34
|
||||
.gpg 34
|
||||
.pgp 34
|
||||
.asc 34
|
||||
.3des 34
|
||||
.aes 34
|
||||
.enc 34
|
||||
.sqlite 34
|
|
@ -0,0 +1,65 @@
|
|||
# Compiled source #
|
||||
###################
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.so
|
||||
|
||||
# Packages #
|
||||
############
|
||||
# It's better to unpack these files and commit the raw source because
|
||||
# git has its own built in compression methods.
|
||||
*.7z
|
||||
*.jar
|
||||
*.rar
|
||||
*.zip
|
||||
*.gz
|
||||
*.bzip
|
||||
*.xz
|
||||
*.lzma
|
||||
|
||||
#packing-only formats
|
||||
*.iso
|
||||
*.tar
|
||||
|
||||
#package management formats
|
||||
*.dmg
|
||||
*.xpi
|
||||
*.gem
|
||||
*.egg
|
||||
*.deb
|
||||
*.rpm
|
||||
|
||||
# Logs and databases #
|
||||
######################
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
.DS_Store
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear on external disk
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# NPM
|
||||
.npmignore
|
||||
|
||||
# Vim
|
||||
.swp
|
||||
.swo
|
||||
.*.swp
|
||||
.*.swo
|
|
@ -0,0 +1,24 @@
|
|||
BoldAsFont=no
|
||||
Font=Consolas
|
||||
FontHeight=12
|
||||
|
||||
ForegroundColour=248,248,242
|
||||
BackgroundColour=39,40,34
|
||||
CursorColour=253,157,79
|
||||
Black=39,40,34
|
||||
BoldBlack=117,113,94
|
||||
Red=249,38,114
|
||||
BoldRed=204,6,78
|
||||
Green=166,226,46
|
||||
BoldGreen=122,172,24
|
||||
Yellow=244,191,117
|
||||
BoldYellow=240,169,69
|
||||
Blue=102,217,239
|
||||
BoldBlue=33,199,233
|
||||
Magenta=174,129,255
|
||||
BoldMagenta=126,51,255
|
||||
Cyan=161,239,228
|
||||
BoldCyan=95,227,210
|
||||
White=248,248,242
|
||||
BoldWhite=249,248,245
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
# the following two lines give a two-line status, with the current window highlighted
|
||||
hardstatus alwayslastline
|
||||
hardstatus string '%{= kG}[%{G}%H%? %1`%?%{g}][%= %{= kw}%-w%{+b yk} %n*%t%?(%u)%? %{-}%+w %=%{g}][%{B}%m/%d %{W}%C%A%{g}]'
|
||||
|
||||
# huge scrollback buffer
|
||||
defscrollback 5000
|
||||
|
||||
# 256 colors
|
||||
attrcolor b ".I"
|
||||
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
|
||||
defbce on
|
||||
|
||||
# default windows
|
||||
screen -t Local 0 bash
|
||||
|
|
@ -0,0 +1,537 @@
|
|||
;; -*- mode: emacs-lisp -*-
|
||||
;; This file is loaded by Spacemacs at startup.
|
||||
;; It must be stored in your home directory.
|
||||
|
||||
(defun dotspacemacs/layers ()
|
||||
"Configuration Layers declaration.
|
||||
You should not put any user code in this function besides modifying the variable
|
||||
values."
|
||||
(setq-default
|
||||
;; Base distribution to use. This is a layer contained in the directory
|
||||
;; `+distribution'. For now available distributions are `spacemacs-base'
|
||||
;; or `spacemacs'. (default 'spacemacs)
|
||||
dotspacemacs-distribution 'spacemacs
|
||||
;; List of additional paths where to look for configuration layers.
|
||||
;; Paths must have a trailing slash (i.e. `~/.mycontribs/')
|
||||
dotspacemacs-configuration-layer-path '()
|
||||
;; List of configuration layers to load. If it is the symbol `all' instead
|
||||
;; of a list then all discovered layers will be installed.
|
||||
dotspacemacs-configuration-layers
|
||||
'(
|
||||
;; ----------------------------------------------------------------
|
||||
;; Example of useful layers you may want to use right away.
|
||||
;; Uncomment some layer names and press <SPC f e R> (Vim style) or
|
||||
;; <M-m f e R> (Emacs style) to install them.
|
||||
;; ----------------------------------------------------------------
|
||||
(auto-completion :variables
|
||||
auto-completion-return-key-behavior nil
|
||||
auto-completion-tab-key-behavior 'complete
|
||||
)
|
||||
c-c++
|
||||
docker
|
||||
django
|
||||
emacs-lisp
|
||||
(git :variables
|
||||
git-gutter-use-fringe t)
|
||||
html
|
||||
(ibuffer :variables ibuffer-group-buffers-by 'projects)
|
||||
java
|
||||
javascript
|
||||
markdown
|
||||
org
|
||||
puppet
|
||||
python
|
||||
(shell :variables
|
||||
shell-default-shell 'ansi-term
|
||||
shell-default-height 30
|
||||
shell-default-position 'bottom
|
||||
)
|
||||
shell-scripts
|
||||
spell-checking
|
||||
syntax-checking
|
||||
vagrant
|
||||
version-control
|
||||
windows-scripts
|
||||
yaml
|
||||
;; private layers
|
||||
tabbar
|
||||
)
|
||||
;; List of additional packages that will be installed without being
|
||||
;; wrapped in a layer. If you need some configuration for these
|
||||
;; packages, then consider creating a layer. You can also put the
|
||||
;; configuration in `dotspacemacs/user-config'.
|
||||
dotspacemacs-additional-packages '(
|
||||
groovy-mode
|
||||
all-the-icons
|
||||
dokuwiki-mode
|
||||
)
|
||||
;; A list of packages and/or extensions that will not be install and loaded.
|
||||
dotspacemacs-excluded-packages '(
|
||||
)
|
||||
;; If non-nil spacemacs will delete any orphan packages, i.e. packages that
|
||||
;; are declared in a layer which is not a member of
|
||||
;; the list `dotspacemacs-configuration-layers'. (default t)
|
||||
dotspacemacs-delete-orphan-packages t))
|
||||
|
||||
(defun dotspacemacs/init ()
|
||||
"Initialization function.
|
||||
This function is called at the very startup of Spacemacs initialization
|
||||
before layers configuration.
|
||||
You should not put any user code in there besides modifying the variable
|
||||
values."
|
||||
;; This setq-default sexp is an exhaustive list of all the supported
|
||||
;; spacemacs settings.
|
||||
(setq-default
|
||||
;; If non nil ELPA repositories are contacted via HTTPS whenever it's
|
||||
;; possible. Set it to nil if you have no way to use HTTPS in your
|
||||
;; environment, otherwise it is strongly recommended to let it set to t.
|
||||
;; This variable has no effect if Emacs is launched with the parameter
|
||||
;; `--insecure' which forces the value of this variable to nil.
|
||||
;; (default t)
|
||||
dotspacemacs-elpa-https t
|
||||
;; Maximum allowed time in seconds to contact an ELPA repository.
|
||||
dotspacemacs-elpa-timeout 5
|
||||
;; If non nil then spacemacs will check for updates at startup
|
||||
;; when the current branch is not `develop'. (default t)
|
||||
dotspacemacs-check-for-update t
|
||||
;; One of `vim', `emacs' or `hybrid'. Evil is always enabled but if the
|
||||
;; variable is `emacs' then the `holy-mode' is enabled at startup. `hybrid'
|
||||
;; uses emacs key bindings for vim's insert mode, but otherwise leaves evil
|
||||
;; unchanged. (default 'vim)
|
||||
dotspacemacs-editing-style 'vim
|
||||
;; If non nil output loading progress in `*Messages*' buffer. (default nil)
|
||||
dotspacemacs-verbose-loading nil
|
||||
;; Specify the startup banner. Default value is `official', it displays
|
||||
;; the official spacemacs logo. An integer value is the index of text
|
||||
;; banner, `random' chooses a random text banner in `core/banners'
|
||||
;; directory. A string value must be a path to an image format supported
|
||||
;; by your Emacs build.
|
||||
;; If the value is nil then no banner is displayed. (default 'official)
|
||||
dotspacemacs-startup-banner 'official
|
||||
;; List of items to show in the startup buffer. If nil it is disabled.
|
||||
;; Possible values are: `recents' `bookmarks' `projects'.
|
||||
;; (default '(recents projects))
|
||||
dotspacemacs-startup-lists '(recents projects)
|
||||
;; Number of recent files to show in the startup buffer. Ignored if
|
||||
;; `dotspacemacs-startup-lists' doesn't include `recents'. (default 5)
|
||||
dotspacemacs-startup-recent-list-size 5
|
||||
;; Default major mode of the scratch buffer (default `text-mode')
|
||||
dotspacemacs-scratch-mode 'org-mode
|
||||
;; List of themes, the first of the list is loaded when spacemacs starts.
|
||||
;; Press <SPC> T n to cycle to the next theme in the list (works great
|
||||
;; with 2 themes variants, one dark and one light)
|
||||
dotspacemacs-themes '(monokai)
|
||||
;; If non nil the cursor color matches the state color in GUI Emacs.
|
||||
dotspacemacs-colorize-cursor-according-to-state t
|
||||
;; Default font. `powerline-scale' allows to quickly tweak the mode-line
|
||||
;; size to make separators look not too crappy.
|
||||
dotspacemacs-default-font '("Roboto Mono for Powerline"
|
||||
:size 16
|
||||
:weight normal
|
||||
:width normal
|
||||
:powerline-scale 1.1)
|
||||
;; The leader key
|
||||
dotspacemacs-leader-key "SPC"
|
||||
;; The leader key accessible in `emacs state' and `insert state'
|
||||
;; (default "M-m")
|
||||
dotspacemacs-emacs-leader-key "M-m"
|
||||
;; Major mode leader key is a shortcut key which is the equivalent of
|
||||
;; pressing `<leader> m`. Set it to `nil` to disable it. (default ",")
|
||||
dotspacemacs-major-mode-leader-key ","
|
||||
;; Major mode leader key accessible in `emacs state' and `insert state'.
|
||||
;; (default "C-M-m)
|
||||
dotspacemacs-major-mode-emacs-leader-key "C-M-m"
|
||||
;; These variables control whether separate commands are bound in the GUI to
|
||||
;; the key pairs C-i, TAB and C-m, RET.
|
||||
;; Setting it to a non-nil value, allows for separate commands under <C-i>
|
||||
;; and TAB or <C-m> and RET.
|
||||
;; In the terminal, these pairs are generally indistinguishable, so this only
|
||||
;; works in the GUI. (default nil)
|
||||
dotspacemacs-distinguish-gui-tab nil
|
||||
;; (Not implemented) dotspacemacs-distinguish-gui-ret nil
|
||||
;; The command key used for Evil commands (ex-commands) and
|
||||
;; Emacs commands (M-x).
|
||||
;; By default the command key is `:' so ex-commands are executed like in Vim
|
||||
;; with `:' and Emacs commands are executed with `<leader> :'.
|
||||
dotspacemacs-command-key ":"
|
||||
;; If non nil `Y' is remapped to `y$'. (default t)
|
||||
dotspacemacs-remap-Y-to-y$ t
|
||||
;; Name of the default layout (default "Default")
|
||||
dotspacemacs-default-layout-name "Default"
|
||||
;; If non nil the default layout name is displayed in the mode-line.
|
||||
;; (default nil)
|
||||
dotspacemacs-display-default-layout nil
|
||||
;; If non nil then the last auto saved layouts are resume automatically upon
|
||||
;; start. (default nil)
|
||||
dotspacemacs-auto-resume-layouts nil
|
||||
;; Location where to auto-save files. Possible values are `original' to
|
||||
;; auto-save the file in-place, `cache' to auto-save the file to another
|
||||
;; file stored in the cache directory and `nil' to disable auto-saving.
|
||||
;; (default 'cache)
|
||||
dotspacemacs-auto-save-file-location 'cache
|
||||
;; Maximum number of rollback slots to keep in the cache. (default 5)
|
||||
dotspacemacs-max-rollback-slots 5
|
||||
;; If non nil then `ido' replaces `helm' for some commands. For now only
|
||||
;; `find-files' (SPC f f), `find-spacemacs-file' (SPC f e s), and
|
||||
;; `find-contrib-file' (SPC f e c) are replaced. (default nil)
|
||||
dotspacemacs-use-ido nil
|
||||
;; If non nil, `helm' will try to minimize the space it uses. (default nil)
|
||||
dotspacemacs-helm-resize nil
|
||||
;; if non nil, the helm header is hidden when there is only one source.
|
||||
;; (default nil)
|
||||
dotspacemacs-helm-no-header nil
|
||||
;; define the position to display `helm', options are `bottom', `top',
|
||||
;; `left', or `right'. (default 'bottom)
|
||||
dotspacemacs-helm-position 'bottom
|
||||
;; If non nil the paste micro-state is enabled. When enabled pressing `p`
|
||||
;; several times cycle between the kill ring content. (default nil)
|
||||
dotspacemacs-enable-paste-micro-state nil
|
||||
;; Which-key delay in seconds. The which-key buffer is the popup listing
|
||||
;; the commands bound to the current keystroke sequence. (default 0.4)
|
||||
dotspacemacs-which-key-delay 0.4
|
||||
;; Which-key frame position. Possible values are `right', `bottom' and
|
||||
;; `right-then-bottom'. right-then-bottom tries to display the frame to the
|
||||
;; right; if there is insufficient space it displays it at the bottom.
|
||||
;; (default 'bottom)
|
||||
dotspacemacs-which-key-position 'bottom
|
||||
;; If non nil a progress bar is displayed when spacemacs is loading. This
|
||||
;; may increase the boot time on some systems and emacs builds, set it to
|
||||
;; nil to boost the loading time. (default t)
|
||||
dotspacemacs-loading-progress-bar t
|
||||
;; If non nil the frame is fullscreen when Emacs starts up. (default nil)
|
||||
;; (Emacs 24.4+ only)
|
||||
dotspacemacs-fullscreen-at-startup nil
|
||||
;; If non nil `spacemacs/toggle-fullscreen' will not use native fullscreen.
|
||||
;; Use to disable fullscreen animations in OSX. (default nil)
|
||||
dotspacemacs-fullscreen-use-non-native nil
|
||||
;; If non nil the frame is maximized when Emacs starts up.
|
||||
;; Takes effect only if `dotspacemacs-fullscreen-at-startup' is nil.
|
||||
;; (default nil) (Emacs 24.4+ only)
|
||||
dotspacemacs-maximized-at-startup nil
|
||||
;; A value from the range (0..100), in increasing opacity, which describes
|
||||
;; the transparency level of a frame when it's active or selected.
|
||||
;; Transparency can be toggled through `toggle-transparency'. (default 90)
|
||||
dotspacemacs-active-transparency 90
|
||||
;; A value from the range (0..100), in increasing opacity, which describes
|
||||
;; the transparency level of a frame when it's inactive or deselected.
|
||||
;; Transparency can be toggled through `toggle-transparency'. (default 90)
|
||||
dotspacemacs-inactive-transparency 90
|
||||
;; If non nil unicode symbols are displayed in the mode line. (default t)
|
||||
dotspacemacs-mode-line-unicode-symbols t
|
||||
;; If non nil smooth scrolling (native-scrolling) is enabled. Smooth
|
||||
;; scrolling overrides the default behavior of Emacs which recenters the
|
||||
;; point when it reaches the top or bottom of the screen. (default t)
|
||||
dotspacemacs-smooth-scrolling t
|
||||
;; If non nil line numbers are turned on in all `prog-mode' and `text-mode'
|
||||
;; derivatives. If set to `relative', also turns on relative line numbers.
|
||||
;; (default nil)
|
||||
dotspacemacs-line-numbers t
|
||||
;; If non-nil smartparens-strict-mode will be enabled in programming modes.
|
||||
;; (default nil)
|
||||
dotspacemacs-smartparens-strict-mode nil
|
||||
;; Select a scope to highlight delimiters. Possible values are `any',
|
||||
;; `current', `all' or `nil'. Default is `all' (highlight any scope and
|
||||
;; emphasis the current one). (default 'all)
|
||||
dotspacemacs-highlight-delimiters 'all
|
||||
;; If non nil advises quit functions to keep server open when quitting.
|
||||
;; (default nil)
|
||||
dotspacemacs-persistent-server nil
|
||||
;; List of search tool executable names. Spacemacs uses the first installed
|
||||
;; tool of the list. Supported tools are `ag', `pt', `ack' and `grep'.
|
||||
;; (default '("ag" "pt" "ack" "grep"))
|
||||
dotspacemacs-search-tools '("ag" "pt" "ack" "grep")
|
||||
;; The default package repository used if no explicit repository has been
|
||||
;; specified with an installed package.
|
||||
;; Not used for now. (default nil)
|
||||
dotspacemacs-default-package-repository nil
|
||||
;; Delete whitespace while saving buffer. Possible values are `all'
|
||||
;; to aggressively delete empty line and long sequences of whitespace,
|
||||
;; `trailing' to delete only the whitespace at end of lines, `changed'to
|
||||
;; delete only whitespace for changed lines or `nil' to disable cleanup.
|
||||
;; (default nil)
|
||||
dotspacemacs-whitespace-cleanup nil
|
||||
))
|
||||
|
||||
(defun dotspacemacs/user-init ()
|
||||
"Initialization function for user code.
|
||||
It is called immediately after `dotspacemacs/init', before layer configuration
|
||||
executes.
|
||||
This function is mostly useful for variables that need to be set
|
||||
before packages are loaded. If you are unsure, you should try in setting them in
|
||||
`dotspacemacs/user-config' first."
|
||||
)
|
||||
|
||||
(defun dotspacemacs/user-config ()
|
||||
"Configuration function for user code.
|
||||
This function is called at the very end of Spacemacs initialization after
|
||||
layers configuration.
|
||||
This is the place where most of your configurations should be done. Unless it is
|
||||
explicitly specified that a variable should be set before a package is loaded,
|
||||
you should place your code here."
|
||||
|
||||
;; Open new files (dropped onto emacs) in a new frame/window
|
||||
(setq ns-pop-up-frames t)
|
||||
|
||||
;; When drag/dropping files onto emacs, don't insert into the buffer,
|
||||
;; but open the file
|
||||
(global-set-key [ns-drag-file] 'ns-find-file)
|
||||
|
||||
;; Org mode
|
||||
(setq org-startup-indented t)
|
||||
|
||||
;; Use jk as escape
|
||||
(setq-default evil-escape-key-sequence "jk")
|
||||
|
||||
;; search in directory on RET by default (instead of opening dired)
|
||||
(require 'helm)
|
||||
(defun helm-find-files-navigate-forward (orig-fun &rest args)
|
||||
(if (file-directory-p (helm-get-selection))
|
||||
(apply orig-fun args)
|
||||
(helm-maybe-exit-minibuffer)))
|
||||
(advice-add 'helm-execute-persistent-action :around #'helm-find-files-navigate-forward)
|
||||
(define-key helm-find-files-map (kbd "<return>") 'helm-execute-persistent-action)
|
||||
|
||||
;; Neotree smart open, and no hidden files showing
|
||||
(setq neo-smart-open t)
|
||||
(setq-default neo-show-hidden-files nil)
|
||||
;; Neotree nice icons and smaller text
|
||||
(setq neo-theme 'icons)
|
||||
|
||||
;; EMACS for mutt editing
|
||||
(add-to-list 'auto-mode-alist '("/mutt" . mail-mode))
|
||||
|
||||
;; emacsclient in a new frame
|
||||
(add-hook 'server-switch-hook
|
||||
(lambda nil
|
||||
(let ((server-buf (current-buffer)))
|
||||
(bury-buffer)
|
||||
(switch-to-buffer-other-frame server-buf))))
|
||||
|
||||
;; close the emacsclient frame when done
|
||||
(add-hook 'server-done-hook 'delete-frame)
|
||||
(add-hook 'server-done-hook (lambda nil (kill-buffer nil)))
|
||||
|
||||
|
||||
;; Follow symlinks to git repo files by default
|
||||
(setq vc-follow-symlinks t)
|
||||
|
||||
;; Org and Deft settings
|
||||
|
||||
;; Note are under "~/Org" and look in subdirs too
|
||||
(setq deft-directory "~/Org")
|
||||
(setq deft-recursive t)
|
||||
(setq deft-extensions '("org" "md"))
|
||||
(setq deft-text-mode 'org-mode)
|
||||
(setq deft-use-filename-as-title t)
|
||||
(global-set-key [f8] 'deft)
|
||||
|
||||
;; Use same location for Org agenda
|
||||
(setq org-agenda-directory "~/Org/")
|
||||
(setq org-agenda-files (directory-files (expand-file-name org-agenda-directory) t
|
||||
"^[^\.][^#][[:alnum:]]+\.org$"))
|
||||
|
||||
;; Exports don't have TOC or numbering by default
|
||||
(setq org-export-with-toc nil)
|
||||
(setq org-export-with-creator nil)
|
||||
(setq org-export-with-section-numbers nil)
|
||||
|
||||
;; Show everything by default on open
|
||||
(setq org-startup-folded "showall")
|
||||
|
||||
;; Full width styling for titles
|
||||
(setq org-fontify-whole-heading-line t)
|
||||
|
||||
;open agenda in current window
|
||||
(setq org-agenda-window-setup (quote current-window))
|
||||
;;warn me of any deadlines in next 7 days
|
||||
(setq org-deadline-warning-days 7)
|
||||
;;show me tasks scheduled or due in next fortnight
|
||||
(setq org-agenda-span (quote fortnight))
|
||||
;;don't show tasks as scheduled if they are already shown as a deadline
|
||||
(setq org-agenda-skip-scheduled-if-deadline-is-shown t)
|
||||
;;don't give awarning colour to tasks with impending deadlines
|
||||
;;if they are scheduled to be done
|
||||
(setq org-agenda-skip-deadline-prewarning-if-scheduled (quote pre-scheduled))
|
||||
;;don't show tasks that are scheduled or have deadlines in the
|
||||
;;normal todo list
|
||||
(setq org-agenda-todo-ignore-deadlines (quote all))
|
||||
(setq org-agenda-todo-ignore-scheduled (quote all))
|
||||
;;sort tasks in order of when they are due and then by priority
|
||||
(setq org-agenda-sorting-strategy
|
||||
(quote
|
||||
((agenda deadline-up priority-down)
|
||||
(todo priority-down category-keep)
|
||||
(tags priority-down category-keep)
|
||||
(search category-keep))))
|
||||
|
||||
;; Org capture setup
|
||||
(setq org-default-notes-file "~/Org/refile.org")
|
||||
|
||||
;; Capture templates for: TODO tasks, Notes, appointments, phone calls, meetings, and org-protocol
|
||||
(setq org-capture-templates
|
||||
(quote (("t" "todo" entry (file "~/Org/refile.org")
|
||||
"* TODO %?\n%U\n%a\n")
|
||||
("r" "respond" entry (file "~/Org/refile.org")
|
||||
"* NEXT Respond to %:from on %:subject\nSCHEDULED: %t\n%U\n%a\n")
|
||||
("n" "note" entry (file "~/Org/refile.org")
|
||||
"* %? :NOTE:\n%U\n%a\n")
|
||||
("j" "Journal" entry (file+datetree "~/Org/journal.org")
|
||||
"* %?\n%U\n")
|
||||
("w" "org-protocol" entry (file "~/Org/refile.org")
|
||||
"* TODO Review %c\n%U\n" :immediate-finish t)
|
||||
("m" "Meeting" entry (file "~/Org/refile.org")
|
||||
"* MEETING with %? :MEETING:\n%U")
|
||||
("p" "Phone call" entry (file "~/Org/refile.org")
|
||||
"* PHONE %? :PHONE:\n%U")
|
||||
("h" "Habit" entry (file "~/Org/refile.org")
|
||||
"* NEXT %?\n%U\n%a\nSCHEDULED: %(format-time-string \"%<<%Y-%m-%d %a .+1d/3d>>\")\n:PROPERTIES:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\n"))))
|
||||
|
||||
(setq org-refile-targets '((nil :maxlevel . 9)
|
||||
(org-agenda-files :maxlevel . 9)))
|
||||
(setq org-outline-path-complete-in-steps nil) ; Refile in a single go
|
||||
(setq org-refile-use-outline-path t) ; Show full paths for refiling
|
||||
|
||||
;; mobileorg settings
|
||||
(setq org-directory "~/Org")
|
||||
(setq org-mobile-inbox-for-pull "~/Org/refile.org")
|
||||
(setq org-mobile-directory "~/MobileOrg")
|
||||
(setq org-mobile-files '("~/Org"))
|
||||
|
||||
;; Fix powerline colors on mac
|
||||
(setq ns-use-srgb-colorspace nil)
|
||||
|
||||
;; org-mode fontified headings
|
||||
(setq org-fontify-whole-heading-line t)
|
||||
|
||||
;; org-mode override themes and don't scale headings too much
|
||||
(custom-set-faces
|
||||
'(org-level-1 ((t (:inherit outline-1 :height 1.2))))
|
||||
'(org-level-2 ((t (:inherit outline-2 :height 1.1))))
|
||||
'(org-level-3 ((t (:inherit outline-3 :height 1.0))))
|
||||
'(org-level-4 ((t (:inherit outline-4 :height 1.0))))
|
||||
'(org-level-5 ((t (:inherit outline-5 :height 1.0))))
|
||||
)
|
||||
|
||||
;; markdown mode override themes and don't scale headings too much
|
||||
(custom-set-faces
|
||||
'(markdown-header-face-1 ((t (:inherit markdown-header-face :height 1.2))))
|
||||
'(markdown-header-face-2 ((t (:inherit markdown-header-face :height 1.1))))
|
||||
'(markdown-header-face-3 ((t (:inherit markdown-header-face :height 1.0))))
|
||||
'(markdown-header-face-4 ((t (:inherit markdown-header-face :height 1.0))))
|
||||
'(markdown-header-face-5 ((t (:inherit markdown-header-face :height 1.0))))
|
||||
'(markdown-header-face-6 ((t (:inherit markdown-header-face :height 1.0))))
|
||||
)
|
||||
|
||||
;; fill-mode in org-mode and markdown-mode, and mail-mode, and dokuwiki-mode
|
||||
(add-hook 'org-mode-hook 'turn-on-auto-fill)
|
||||
(add-hook 'org-mode-hook
|
||||
(lambda() (set-fill-column 80)))
|
||||
|
||||
(add-hook 'markdown-mode-hook 'turn-on-auto-fill)
|
||||
(add-hook 'markdown-mode-hook
|
||||
(lambda() (set-fill-column 80))
|
||||
)
|
||||
|
||||
(add-hook 'mail-mode-hook 'turn-on-auto-fill)
|
||||
(add-hook 'mail-mode-hook
|
||||
(lambda() (set-fill-column 80))
|
||||
)
|
||||
(add-hook 'dokuwiki-mode-hook 'turn-on-auto-fill)
|
||||
(add-hook 'dokuwiki-mode-hook
|
||||
(lambda() (set-fill-column 80))
|
||||
)
|
||||
|
||||
(defun fill-buffer ()
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(fill-region (point-min) (point-max)))))
|
||||
|
||||
;; OSX style cut paste everywhere
|
||||
(define-key global-map [?\s-x] 'kill-region)
|
||||
(define-key global-map [?\s-c] 'kill-ring-save)
|
||||
(define-key global-map [?\s-v] 'yank)
|
||||
(define-key global-map [?\s-z] 'undo)
|
||||
|
||||
;; groovy-mode for nextflow
|
||||
(add-to-list 'auto-mode-alist '("\\.nf\\'" . groovy-mode))
|
||||
|
||||
)
|
||||
|
||||
;; Do not write anything past this comment. This is where Emacs will
|
||||
;; auto-generate custom variable definitions.
|
||||
(custom-set-variables
|
||||
;; custom-set-variables was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(compilation-message-face (quote default))
|
||||
'(custom-safe-hemes
|
||||
(quote
|
||||
("889a93331bc657c0f05a04b8665b78b3c94a12ca76771342cee27d6605abcd0e" "70403e220d6d7100bae7775b3334eddeb340ba9c37f4b39c189c2c29d458543b" "c1390663960169cd92f58aad44ba3253227d8f715c026438303c09b9fb66cdfb" "357d5abe6f693f2875bb3113f5c031b7031f21717e8078f90d9d9bc3a14bcbd8" "3632cf223c62cb7da121be0ed641a2243f7ec0130178722554e613c9ab3131de" "bffa9739ce0752a37d9b1eee78fc00ba159748f50dc328af4be661484848e476" "c7a9a68bd07e38620a5508fef62ec079d274475c8f92d75ed0c33c45fbe306bc" default)))
|
||||
'(evil-want-Y-yank-to-eol t)
|
||||
'(fci-rule-color "#3C3D37" t)
|
||||
'(highlight-changes-colors (quote ("#FD5FF0" "#AE81FF")))
|
||||
'(highlight-tail-colors
|
||||
(quote
|
||||
(("#3C3D37" . 0)
|
||||
("#679A01" . 20)
|
||||
("#4BBEAE" . 30)
|
||||
("#1DB4D0" . 50)
|
||||
("#9A8F21" . 60)
|
||||
("#A75B00" . 70)
|
||||
("#F309DF" . 85)
|
||||
("#3C3D37" . 100))))
|
||||
'(magit-diff-use-overlays nil)
|
||||
'(org-agenda-files (quote ("~/Org/TODO.org")))
|
||||
'(package-selected-packages
|
||||
(quote
|
||||
(company-emacs-eclim eclim tabbar dokuwiki-mode all-the-icons memoize font-lock+ solarized-theme madhat2r-theme color-theme-sanityinc-solarized pandoc-mode ox-pandoc ht org-category-capture groovy-mode vagrant-tramp vagrant ibuffer-projectile mu4e-maildirs-extension mu4e-alert winum unfill fuzzy sanityinc-tomoorow-day-theme sanityinc-tomorrow-dayi-theme zonokai-theme zenburn-theme zen-and-art-theme yapfify xterm-color uuidgen underwater-theme ujelly-theme twilight-theme twilight-bright-theme twilight-anti-bright-theme tronesque-theme toxi-theme tao-theme tangotango-theme tango-plus-theme tango-2-theme sunny-day-theme sublime-themes subatomic256-theme subatomic-theme spacegray-theme soothe-theme soft-stone-theme soft-morning-theme soft-charcoal-theme smyx-theme shell-pop seti-theme rvm ruby-tools ruby-test-mode rubocop rspec-mode robe reverse-theme rbenv rake railscasts-theme py-isort purple-haze-theme pug-mode professional-theme powershell planet-theme phoenix-dark-pink-theme phoenix-dark-mono-theme pastels-on-dark-theme organic-green-theme org-projectile org-download org-caldav org omtose-phellack-theme oldlace-theme occidental-theme obsidian-theme noctilux-theme niflheim-theme naquadah-theme mwim mustang-theme multi-term monokai-theme monochrome-theme molokai-theme moe-theme minitest minimal-theme material-theme majapahit-theme lush-theme livid-mode skewer-mode simple-httpd live-py-mode link-hint light-soap-theme jbeans-theme jazz-theme ir-black-theme insert-shebang inkpot-theme hide-comnt heroku-theme hemisu-theme hc-zenburn-theme gruvbox-theme gruber-darker-theme grandshell-theme gotham-theme git-link gandalf-theme flyspell-correct-helm flyspell-correct flatui-theme flatland-theme firebelly-theme farmhouse-theme eyebrowse evil-visual-mark-mode evil-unimpaired evil-ediff goto-chg undo-tree espresso-theme eshell-z eshell-prompt-extras esh-help dumb-jump dracula-theme docker tablist docker-tramp django-theme disaster diminish deft darktooth-theme autothemer darkokai-theme darkmine-theme darkburn-theme dakrone-theme cyberpunk-theme company-shell company-c-headers column-enforce-mode color-theme-sanityinc-tomorrow cmake-mode clues-theme clang-format chruby cherry-blossom-theme busybee-theme bundler inf-ruby bubbleberry-theme birds-of-paradise-plus-theme badwolf-theme apropospriate-theme anti-zenburn-theme ample-zen-theme ample-theme alect-themes afternoon-theme yaml-mode puppet-mode pony-mode fish-mode dockerfile-mode web-mode web-beautify toc-org tagedit smeargle slim-mode scss-mode sass-mode pyvenv pytest pyenv-mode py-yapf pip-requirements orgit org-repo-todo org-present org-pomodoro alert log4e gntp org-plus-contrib org-bullets mmm-mode markdown-toc markdown-mode magit-gitflow less-css-mode json-mode json-snatcher json-reformat js2-refactor multiple-cursors js2-mode js-doc jade-mode hy-mode htmlize helm-pydoc helm-gitignore request helm-flyspell helm-css-scss helm-company helm-c-yasnippet haml-mode gnuplot gitignore-mode gitconfig-mode gitattributes-mode git-timemachine git-messenger git-gutter-fringe+ git-gutter-fringe fringe-helper git-gutter+ git-gutter gh-md flycheck-pos-tip flycheck evil-magit magit magit-popup git-commit with-editor emmet-mode diff-hl cython-mode company-web web-completion-data company-tern dash-functional tern company-statistics company-quickhelp pos-tip company-anaconda company coffee-mode auto-yasnippet yasnippet auto-dictionary anaconda-mode pythonic f ac-ispell auto-complete ws-butler window-numbering volatile-highlights vi-tilde-fringe spaceline s powerline smooth-scrolling restart-emacs rainbow-delimiters popwin persp-mode pcre2el paradox hydra spinner page-break-lines open-junk-file neotree move-text macrostep lorem-ipsum linum-relative leuven-theme info+ indent-guide ido-vertical-mode hungry-delete hl-todo highlight-parentheses highlight-numbers parent-mode highlight-indentation help-fns+ helm-themes helm-swoop helm-projectile helm-mode-manager helm-make projectile pkg-info epl helm-flx helm-descbinds helm-ag google-translate golden-ratio flx-ido flx fill-column-indicator fancy-battery expand-region exec-path-from-shell evil-visualstar evil-tutor evil-surround evil-search-highlight-persist evil-numbers evil-nerd-commenter evil-mc evil-matchit evil-lisp-state smartparens evil-indent-plus evil-iedit-state iedit evil-exchange evil-escape evil-args evil-anzu anzu eval-sexp-fu highlight elisp-slime-nav define-word clean-aindent-mode buffer-move bracketed-paste auto-highlight-symbol auto-compile packed dash aggressive-indent adaptive-wrap ace-window ace-link ace-jump-helm-line helm avy helm-core popup async quelpa package-build use-package which-key bind-key bind-map evil spacemacs-theme)))
|
||||
'(pos-tip-background-color "#A6E22E")
|
||||
'(pos-tip-foreground-color "#272822")
|
||||
'(tabbar-separator (quote (0.5)))
|
||||
'(tramp-copy-size-limit 10000000)
|
||||
'(tramp-inline-compress-start-size 1000000)
|
||||
'(tramp-persistency-file-name "/home2/dtrudgian/.emacs.d/.cache/tramp")
|
||||
'(vc-annotate-background nil)
|
||||
'(vc-annotate-color-map
|
||||
(quote
|
||||
((20 . "#F92672")
|
||||
(40 . "#CF4F1F")
|
||||
(60 . "#C26C0F")
|
||||
(80 . "#E6DB74")
|
||||
(100 . "#AB8C00")
|
||||
(120 . "#A18F00")
|
||||
(140 . "#989200")
|
||||
(160 . "#8E9500")
|
||||
(180 . "#A6E22E")
|
||||
(200 . "#729A1E")
|
||||
(220 . "#609C3C")
|
||||
(240 . "#4E9D5B")
|
||||
(260 . "#3C9F79")
|
||||
(280 . "#A1EFE4")
|
||||
(300 . "#299BA6")
|
||||
(320 . "#2896B5")
|
||||
(340 . "#2790C3")
|
||||
(360 . "#66D9EF"))))
|
||||
'(vc-annotate-very-old-color nil)
|
||||
'(weechat-color-list
|
||||
(unspecified "#272822" "#3C3D37" "#F70057" "#F92672" "#86C30D" "#A6E22E" "#BEB244" "#E6DB74" "#40CAE4" "#66D9EF" "#FB35EA" "#FD5FF0" "#74DBCD" "#A1EFE4" "#F8F8F2" "#F8F8F0")))
|
||||
(custom-set-faces
|
||||
;; custom-set-faces was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(default ((((class color) (min-colors 257)) (:foreground "#F8F8F2" :background "#272822")) (((class color) (min-colors 89)) (:foreground "#F5F5F5" :background "#1B1E1C"))))
|
||||
'(markdown-header-face-1 ((t (:inherit markdown-header-face :height 1.2))))
|
||||
'(markdown-header-face-2 ((t (:inherit markdown-header-face :height 1.1))))
|
||||
'(markdown-header-face-3 ((t (:inherit markdown-header-face :height 1.0))))
|
||||
'(markdown-header-face-4 ((t (:inherit markdown-header-face :height 1.0))))
|
||||
'(markdown-header-face-5 ((t (:inherit markdown-header-face :height 1.0))))
|
||||
'(markdown-header-face-6 ((t (:inherit markdown-header-face :height 1.0))))
|
||||
'(org-level-1 ((t (:inherit outline-1 :height 1.2))))
|
||||
'(org-level-2 ((t (:inherit outline-2 :height 1.1))))
|
||||
'(org-level-3 ((t (:inherit outline-3 :height 1.0))))
|
||||
'(org-level-4 ((t (:inherit outline-4 :height 1.0))))
|
||||
'(org-level-5 ((t (:inherit outline-5 :height 1.0)))))
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,109 @@
|
|||
" Vim color file
|
||||
" Converted from Textmate theme Monokai using Coloration v0.3.2 (http://github.com/sickill/coloration)
|
||||
|
||||
set background=dark
|
||||
highlight clear
|
||||
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
|
||||
set t_Co=256
|
||||
let g:colors_name = "monokai"
|
||||
|
||||
hi Cursor ctermfg=235 ctermbg=231 cterm=NONE guifg=#272822 guibg=#f8f8f0 gui=NONE
|
||||
hi Visual ctermfg=NONE ctermbg=59 cterm=NONE guifg=NONE guibg=#49483e gui=NONE
|
||||
hi CursorLine ctermfg=NONE ctermbg=237 cterm=NONE guifg=NONE guibg=#3c3d37 gui=NONE
|
||||
hi CursorColumn ctermfg=NONE ctermbg=237 cterm=NONE guifg=NONE guibg=#3c3d37 gui=NONE
|
||||
hi ColorColumn ctermfg=NONE ctermbg=237 cterm=NONE guifg=NONE guibg=#3c3d37 gui=NONE
|
||||
hi LineNr ctermfg=102 ctermbg=237 cterm=NONE guifg=#90908a guibg=#3c3d37 gui=NONE
|
||||
hi VertSplit ctermfg=241 ctermbg=241 cterm=NONE guifg=#64645e guibg=#64645e gui=NONE
|
||||
hi MatchParen ctermfg=197 ctermbg=NONE cterm=underline guifg=#f92672 guibg=NONE gui=underline
|
||||
hi StatusLine ctermfg=231 ctermbg=241 cterm=bold guifg=#f8f8f2 guibg=#64645e gui=bold
|
||||
hi StatusLineNC ctermfg=231 ctermbg=241 cterm=NONE guifg=#f8f8f2 guibg=#64645e gui=NONE
|
||||
hi Pmenu ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
|
||||
hi PmenuSel ctermfg=NONE ctermbg=59 cterm=NONE guifg=NONE guibg=#49483e gui=NONE
|
||||
hi IncSearch ctermfg=235 ctermbg=186 cterm=NONE guifg=#272822 guibg=#e6db74 gui=NONE
|
||||
hi Search ctermfg=NONE ctermbg=NONE cterm=underline guifg=NONE guibg=NONE gui=underline
|
||||
hi Directory ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
|
||||
hi Folded ctermfg=242 ctermbg=235 cterm=NONE guifg=#75715e guibg=#272822 gui=NONE
|
||||
hi SignColumn ctermfg=NONE ctermbg=237 cterm=NONE guifg=NONE guibg=#3c3d37 gui=NONE
|
||||
hi Normal ctermfg=231 ctermbg=235 cterm=NONE guifg=#f8f8f2 guibg=#272822 gui=NONE
|
||||
hi Boolean ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
|
||||
hi Character ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
|
||||
hi Comment ctermfg=242 ctermbg=NONE cterm=NONE guifg=#75715e guibg=NONE gui=NONE
|
||||
hi Conditional ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
|
||||
hi Constant ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
|
||||
hi Define ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
|
||||
hi DiffAdd ctermfg=231 ctermbg=64 cterm=bold guifg=#f8f8f2 guibg=#46830c gui=bold
|
||||
hi DiffDelete ctermfg=88 ctermbg=NONE cterm=NONE guifg=#8b0807 guibg=NONE gui=NONE
|
||||
hi DiffChange ctermfg=NONE ctermbg=NONE cterm=NONE guifg=#f8f8f2 guibg=#243955 gui=NONE
|
||||
hi DiffText ctermfg=231 ctermbg=24 cterm=bold guifg=#f8f8f2 guibg=#204a87 gui=bold
|
||||
hi ErrorMsg ctermfg=231 ctermbg=197 cterm=NONE guifg=#f8f8f0 guibg=#f92672 gui=NONE
|
||||
hi WarningMsg ctermfg=231 ctermbg=197 cterm=NONE guifg=#f8f8f0 guibg=#f92672 gui=NONE
|
||||
hi Float ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
|
||||
hi Function ctermfg=148 ctermbg=NONE cterm=NONE guifg=#a6e22e guibg=NONE gui=NONE
|
||||
hi Identifier ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic
|
||||
hi Keyword ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
|
||||
hi Label ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE
|
||||
hi NonText ctermfg=59 ctermbg=236 cterm=NONE guifg=#49483e guibg=#31322c gui=NONE
|
||||
hi Number ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
|
||||
hi Operator ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
|
||||
hi PreProc ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
|
||||
hi Special ctermfg=231 ctermbg=NONE cterm=NONE guifg=#f8f8f2 guibg=NONE gui=NONE
|
||||
hi SpecialComment ctermfg=242 ctermbg=NONE cterm=NONE guifg=#75715e guibg=NONE gui=NONE
|
||||
hi SpecialKey ctermfg=59 ctermbg=237 cterm=NONE guifg=#49483e guibg=#3c3d37 gui=NONE
|
||||
hi Statement ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
|
||||
hi StorageClass ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic
|
||||
hi String ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE
|
||||
hi Tag ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
|
||||
hi Title ctermfg=231 ctermbg=NONE cterm=bold guifg=#f8f8f2 guibg=NONE gui=bold
|
||||
hi Todo ctermfg=95 ctermbg=NONE cterm=inverse,bold guifg=#75715e guibg=NONE gui=inverse,bold
|
||||
hi Type ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
|
||||
hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline guifg=NONE guibg=NONE gui=underline
|
||||
hi rubyClass ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
|
||||
hi rubyFunction ctermfg=148 ctermbg=NONE cterm=NONE guifg=#a6e22e guibg=NONE gui=NONE
|
||||
hi rubyInterpolationDelimiter ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
|
||||
hi rubySymbol ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
|
||||
hi rubyConstant ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic
|
||||
hi rubyStringDelimiter ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE
|
||||
hi rubyBlockParameter ctermfg=208 ctermbg=NONE cterm=NONE guifg=#fd971f guibg=NONE gui=italic
|
||||
hi rubyInstanceVariable ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
|
||||
hi rubyInclude ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
|
||||
hi rubyGlobalVariable ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
|
||||
hi rubyRegexp ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE
|
||||
hi rubyRegexpDelimiter ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE
|
||||
hi rubyEscape ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
|
||||
hi rubyControl ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
|
||||
hi rubyClassVariable ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
|
||||
hi rubyOperator ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
|
||||
hi rubyException ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
|
||||
hi rubyPseudoVariable ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
|
||||
hi rubyRailsUserClass ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic
|
||||
hi rubyRailsARAssociationMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
|
||||
hi rubyRailsARMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
|
||||
hi rubyRailsRenderMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
|
||||
hi rubyRailsMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
|
||||
hi erubyDelimiter ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
|
||||
hi erubyComment ctermfg=95 ctermbg=NONE cterm=NONE guifg=#75715e guibg=NONE gui=NONE
|
||||
hi erubyRailsMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
|
||||
hi htmlTag ctermfg=148 ctermbg=NONE cterm=NONE guifg=#a6e22e guibg=NONE gui=NONE
|
||||
hi htmlEndTag ctermfg=148 ctermbg=NONE cterm=NONE guifg=#a6e22e guibg=NONE gui=NONE
|
||||
hi htmlTagName ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
|
||||
hi htmlArg ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
|
||||
hi htmlSpecialChar ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
|
||||
hi javaScriptFunction ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic
|
||||
hi javaScriptRailsFunction ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
|
||||
hi javaScriptBraces ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
|
||||
hi yamlKey ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
|
||||
hi yamlAnchor ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
|
||||
hi yamlAlias ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
|
||||
hi yamlDocumentHeader ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE
|
||||
hi cssURL ctermfg=208 ctermbg=NONE cterm=NONE guifg=#fd971f guibg=NONE gui=italic
|
||||
hi cssFunctionName ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
|
||||
hi cssColor ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
|
||||
hi cssPseudoClassId ctermfg=148 ctermbg=NONE cterm=NONE guifg=#a6e22e guibg=NONE gui=NONE
|
||||
hi cssClassName ctermfg=148 ctermbg=NONE cterm=NONE guifg=#a6e22e guibg=NONE gui=NONE
|
||||
hi cssValueLength ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
|
||||
hi cssCommonAttr ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
|
||||
hi cssBraces ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
|
|
@ -0,0 +1,46 @@
|
|||
" expanderrific.vim
|
||||
" https://github.com/cowboy/dotfiles
|
||||
"
|
||||
" Allow right/left to expand/collapse NERDTree dirs in a more meaningful way.
|
||||
|
||||
" Ben Alman
|
||||
" http://benalman.com/
|
||||
|
||||
if exists("g:loaded_nerdtree_expanderrific")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_nerdtree_expanderrific = 1
|
||||
|
||||
let expanderrific_expand = ['l', '<Right>']
|
||||
let expanderrific_collapse = ['h', '<Left>']
|
||||
|
||||
for key in expanderrific_expand
|
||||
call NERDTreeAddKeyMap({'key': key, 'scope': 'DirNode', 'callback': 'NERDTreeExpanderrificExpand'})
|
||||
endfor
|
||||
|
||||
for key in expanderrific_collapse
|
||||
call NERDTreeAddKeyMap({'key': key, 'scope': 'Node', 'callback': 'NERDTreeExpanderrificCollapse'})
|
||||
endfor
|
||||
|
||||
function! NERDTreeExpanderrificExpand(dir)
|
||||
let opts = {'reuse': 1}
|
||||
if g:NERDTreeCascadeOpenSingleChildDir == 0
|
||||
call a:dir.open(opts)
|
||||
else
|
||||
call a:dir.openAlong(opts)
|
||||
endif
|
||||
call b:NERDTree.render()
|
||||
endfunction
|
||||
|
||||
function! NERDTreeExpanderrificCollapse(node)
|
||||
let node = a:node
|
||||
if !a:node.path.isDirectory || !a:node.isOpen
|
||||
let node = a:node.parent
|
||||
endif
|
||||
if node != b:NERDTreeRoot
|
||||
call node.close()
|
||||
call b:NERDTree.render()
|
||||
call node.putCursorHere(0, 0)
|
||||
endif
|
||||
endfunction
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
" Modified to use :BD or :BD! as the command, and to prevent 'Press ENTER'
|
||||
" prompt when run the first time (sometimes) - Cowboy
|
||||
|
||||
" Delete buffer while keeping window layout (don't close buffer's windows).
|
||||
" Version 2008-11-18 from http://vim.wikia.com/wiki/VimTip165
|
||||
if v:version < 700 || exists('loaded_bclose') || &cp
|
||||
finish
|
||||
endif
|
||||
let loaded_bclose = 1
|
||||
if !exists('bclose_multiple')
|
||||
let bclose_multiple = 1
|
||||
endif
|
||||
|
||||
" Display an error message.
|
||||
function! s:Warn(msg)
|
||||
echohl ErrorMsg
|
||||
echomsg a:msg
|
||||
echohl NONE
|
||||
endfunction
|
||||
|
||||
" Command ':Bclose' executes ':bd' to delete buffer in current window.
|
||||
" The window will show the alternate buffer (Ctrl-^) if it exists,
|
||||
" or the previous buffer (:bp), or a blank buffer if no previous.
|
||||
" Command ':Bclose!' is the same, but executes ':bd!' (discard changes).
|
||||
" An optional argument can specify which buffer to close (name or number).
|
||||
function! s:Bclose(bang, buffer)
|
||||
if empty(a:buffer)
|
||||
let btarget = bufnr('%')
|
||||
elseif a:buffer =~ '^\d\+$'
|
||||
let btarget = bufnr(str2nr(a:buffer))
|
||||
else
|
||||
let btarget = bufnr(a:buffer)
|
||||
endif
|
||||
if btarget < 0
|
||||
call s:Warn('No matching buffer for '.a:buffer)
|
||||
return
|
||||
endif
|
||||
if empty(a:bang) && getbufvar(btarget, '&modified')
|
||||
call s:Warn('No write since last change for buffer '.btarget.' (use :BD!)')
|
||||
return
|
||||
endif
|
||||
" Numbers of windows that view target buffer which we will delete.
|
||||
let wnums = filter(range(1, winnr('$')), 'winbufnr(v:val) == btarget')
|
||||
if !g:bclose_multiple && len(wnums) > 1
|
||||
call s:Warn('Buffer is in multiple windows (use ":let bclose_multiple=1")')
|
||||
return
|
||||
endif
|
||||
let wcurrent = winnr()
|
||||
for w in wnums
|
||||
execute w.'wincmd w'
|
||||
let prevbuf = bufnr('#')
|
||||
if prevbuf > 0 && buflisted(prevbuf) && prevbuf != w
|
||||
buffer #
|
||||
else
|
||||
silent bprevious
|
||||
endif
|
||||
if btarget == bufnr('%')
|
||||
" Numbers of listed buffers which are not the target to be deleted.
|
||||
let blisted = filter(range(1, bufnr('$')), 'buflisted(v:val) && v:val != btarget')
|
||||
" Listed, not target, and not displayed.
|
||||
let bhidden = filter(copy(blisted), 'bufwinnr(v:val) < 0')
|
||||
" Take the first buffer, if any (could be more intelligent).
|
||||
let bjump = (bhidden + blisted + [-1])[0]
|
||||
if bjump > 0
|
||||
execute 'buffer '.bjump
|
||||
else
|
||||
execute 'enew'.a:bang
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
execute 'bdelete'.a:bang.' '.btarget
|
||||
execute wcurrent.'wincmd w'
|
||||
endfunction
|
||||
command! -bang -complete=buffer -nargs=? BD call s:Bclose('<bang>', '<args>')
|
||||
" nnoremap <silent> <Leader>bd :Bclose<CR>
|
|
@ -0,0 +1,233 @@
|
|||
" Change mapleader
|
||||
let mapleader=","
|
||||
|
||||
" Now ; works just like : but with 866% less keypresses!
|
||||
nnoremap ; :
|
||||
|
||||
" Move more naturally up/down when wrapping is enabled.
|
||||
nnoremap j gj
|
||||
nnoremap k gk
|
||||
|
||||
" Local dirs
|
||||
set backupdir=$DOTFILES/caches/vim
|
||||
set directory=$DOTFILES/caches/vim
|
||||
let g:netrw_home = expand('$DOTFILES/caches/vim')
|
||||
|
||||
" Visual settings
|
||||
set cursorline " Highlight current line
|
||||
set number " Enable line numbers.
|
||||
set showtabline=2 " Always show tab bar.
|
||||
set title " Show the filename in the window titlebar.
|
||||
set noshowmode " Don't show the current mode (airline.vim takes care of us)
|
||||
set laststatus=2 " Always show status line
|
||||
|
||||
" Make it obvious where 80 characters is
|
||||
set textwidth=80
|
||||
" Don't always wrap at 80
|
||||
set formatoptions-=t
|
||||
|
||||
|
||||
" Scrolling
|
||||
set scrolloff=3 " Start scrolling three lines before horizontal border of window.
|
||||
set sidescrolloff=3 " Start scrolling three columns before vertical border of window.
|
||||
|
||||
" Indentation
|
||||
" Defaults
|
||||
set autoindent " Copy indent from last line when starting new line.
|
||||
set shiftwidth=4 " The # of spaces for indenting.
|
||||
set smarttab " At start of line, <Tab> inserts shiftwidth spaces, <Bs> deletes shiftwidth spaces.
|
||||
set softtabstop=4 " Tab key results in 4 spaces
|
||||
set tabstop=4 " Tabs indent only 4 spaces
|
||||
set expandtab " Expand tabs to spaces
|
||||
|
||||
" Python PEP8
|
||||
au BufNewFile,BufRead *.py
|
||||
\ set tabstop=4 |
|
||||
\ set softtabstop=4 |
|
||||
\ set shiftwidth=4 |
|
||||
\ set textwidth=79 |
|
||||
\ set expandtab |
|
||||
\ set autoindent |
|
||||
\ set fileformat=unix
|
||||
|
||||
" Web
|
||||
au BufNewFile,BufRead *.js, *.html, *.css
|
||||
\ set tabstop=2 |
|
||||
\ set softtabstop=2 |
|
||||
\ set shiftwidth=2
|
||||
|
||||
" Reformatting
|
||||
set nojoinspaces " Only insert single space after a '.', '?' and '!' with a join command.
|
||||
|
||||
" Toggle show tabs and trailing spaces (,c)
|
||||
set listchars=tab:▸\ ,trail:·,eol:¬,nbsp:_,extends:>,precedes:<
|
||||
"set listchars=tab:>\ ,trail:.,eol:$,nbsp:_,extends:>,precedes:<
|
||||
"set fillchars=fold:-
|
||||
nnoremap <silent> <leader>v :call ToggleInvisibles()<CR>
|
||||
|
||||
" Extra whitespace
|
||||
augroup highlight_extra_whitespace
|
||||
autocmd!
|
||||
autocmd BufWinEnter * :2match ExtraWhitespaceMatch /\s\+$/
|
||||
autocmd InsertEnter * :2match ExtraWhitespaceMatch /\s\+\%#\@<!$/
|
||||
autocmd InsertLeave * :2match ExtraWhitespaceMatch /\s\+$/
|
||||
augroup END
|
||||
|
||||
" Toggle Invisibles / Show extra whitespace
|
||||
function! ToggleInvisibles()
|
||||
set nolist!
|
||||
if &list
|
||||
hi! link ExtraWhitespaceMatch ExtraWhitespace
|
||||
else
|
||||
hi! link ExtraWhitespaceMatch NONE
|
||||
endif
|
||||
endfunction
|
||||
|
||||
set nolist
|
||||
call ToggleInvisibles()
|
||||
|
||||
" Trim extra whitespace
|
||||
function! StripExtraWhiteSpace()
|
||||
let l = line(".")
|
||||
let c = col(".")
|
||||
%s/\s\+$//e
|
||||
call cursor(l, c)
|
||||
endfunction
|
||||
noremap <leader>ss :call StripExtraWhiteSpace()<CR>
|
||||
|
||||
" Search / replace
|
||||
set gdefault " By default add g flag to search/replace. Add g to toggle.
|
||||
set hlsearch " Highlight searches
|
||||
set incsearch " Highlight dynamically as pattern is typed.
|
||||
set ignorecase " Ignore case of searches.
|
||||
set smartcase " Ignore 'ignorecase' if search pattern contains uppercase characters.
|
||||
|
||||
" Clear last search
|
||||
map <silent> <leader>/ <Esc>:nohlsearch<CR>
|
||||
|
||||
" Ignore things
|
||||
set wildignore+=*.jpg,*.jpeg,*.gif,*.png,*.gif,*.psd,*.o,*.obj,*.min.js
|
||||
set wildignore+=*/bower_components/*,*/node_modules/*
|
||||
set wildignore+=*/vendor/*,*/.git/*,*/.hg/*,*/.svn/*,*/log/*,*/tmp/*
|
||||
|
||||
" Vim commands
|
||||
set hidden " When a buffer is brought to foreground, remember undo history and marks.
|
||||
set report=0 " Show all changes.
|
||||
set mouse=a " Enable mouse in all modes.
|
||||
set shortmess+=I " Hide intro menu.
|
||||
|
||||
" Splits
|
||||
set splitbelow " New split goes below
|
||||
set splitright " New split goes right
|
||||
|
||||
" Ctrl-J/K/L/H select split
|
||||
nnoremap <C-J> <C-W>j
|
||||
nnoremap <C-K> <C-W>k
|
||||
nnoremap <C-L> <C-W>l
|
||||
nnoremap <C-H> <C-W>h
|
||||
|
||||
" Buffer navigation
|
||||
nnoremap <leader>b :CtrlPBuffer<CR> " List other buffers
|
||||
map <leader><leader> :b#<CR> " Switch between the last two files
|
||||
map gb :bnext<CR> " Next buffer
|
||||
map gB :bprev<CR> " Prev buffer
|
||||
|
||||
" Jump to buffer number 1-9 with ,<N> or 1-99 with <N>gb
|
||||
let c = 1
|
||||
while c <= 99
|
||||
if c < 10
|
||||
execute "nnoremap <silent> <leader>" . c . " :" . c . "b<CR>"
|
||||
endif
|
||||
execute "nnoremap <silent> " . c . "gb :" . c . "b<CR>"
|
||||
let c += 1
|
||||
endwhile
|
||||
|
||||
" Fix page up and down
|
||||
map <PageUp> <C-U>
|
||||
map <PageDown> <C-D>
|
||||
imap <PageUp> <C-O><C-U>
|
||||
imap <PageDown> <C-O><C-D>
|
||||
|
||||
" Use Q for formatting the current paragraph (or selection)
|
||||
" vmap Q gq
|
||||
" nmap Q gqap
|
||||
|
||||
" When editing a file, always jump to the last known cursor position. Don't do
|
||||
" it for commit messages, when the position is invalid, or when inside an event
|
||||
" handler (happens when dropping a file on gvim).
|
||||
augroup vimrcEx
|
||||
autocmd!
|
||||
autocmd BufReadPost *
|
||||
\ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") |
|
||||
\ exe "normal g`\"" |
|
||||
\ endif
|
||||
augroup END
|
||||
|
||||
" F12: Source .vimrc & .gvimrc files
|
||||
nmap <F12> :call SourceConfigs()<CR>
|
||||
|
||||
if !exists("*SourceConfigs")
|
||||
function! SourceConfigs()
|
||||
let files = ".vimrc"
|
||||
source $MYVIMRC
|
||||
if has("gui_running")
|
||||
let files .= ", .gvimrc"
|
||||
source $MYGVIMRC
|
||||
endif
|
||||
echom "Sourced " . files
|
||||
endfunction
|
||||
endif
|
||||
|
||||
"" FILE TYPES
|
||||
augroup file_types
|
||||
autocmd!
|
||||
|
||||
" vim
|
||||
autocmd BufRead .vimrc,*.vim set keywordprg=:help
|
||||
|
||||
augroup END
|
||||
|
||||
" PLUGINS
|
||||
|
||||
" Airline
|
||||
let g:airline#extensions#tabline#enabled = 1
|
||||
let g:airline#extensions#tabline#buffer_nr_format = '%s '
|
||||
let g:airline#extensions#tabline#buffer_nr_show = 1
|
||||
let g:airline_theme='papercolor'
|
||||
let g:airline_powerline_fonts = 1
|
||||
|
||||
" CtrlP.vim
|
||||
map <leader>p <C-P>
|
||||
map <leader>r :CtrlPMRUFiles<CR>
|
||||
"let g:ctrlp_match_window_bottom = 0 " Show at top of window
|
||||
|
||||
" https://github.com/junegunn/vim-plug
|
||||
" Reload .vimrc and :PlugInstall to install plugins.
|
||||
let g:plug_threads = 1
|
||||
call plug#begin('~/.vim/plugged')
|
||||
Plug 'vim-airline/vim-airline'
|
||||
Plug 'vim-airline/vim-airline-themes'
|
||||
Plug 'tpope/vim-sensible'
|
||||
Plug 'ctrlpvim/ctrlp.vim'
|
||||
Plug 'plasticboy/vim-markdown'
|
||||
Plug 'vim-scripts/indentpython.vim'
|
||||
Plug 'scrooloose/syntastic'
|
||||
Plug 'jistr/vim-nerdtree-tabs'
|
||||
Plug 'airblade/vim-gitgutter'
|
||||
Plug 'tpope/vim-commentary'
|
||||
call plug#end()
|
||||
|
||||
" MacVim Font
|
||||
set gfn=Monaco:h14
|
||||
|
||||
" Color scheme
|
||||
set background=dark
|
||||
colorscheme monokai
|
||||
|
||||
" Better Python Highlighting
|
||||
let python_highlight_all=1
|
||||
syntax enable
|
||||
|
||||
" Markdown do not fold
|
||||
let g:vim_markdown_folding_disabled = 1
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"bootstrapped": true,
|
||||
"in_process_packages":
|
||||
[
|
||||
],
|
||||
"installed_packages":
|
||||
[
|
||||
"A File Icon",
|
||||
"ApacheConf.tmLanguage",
|
||||
"AutoPEP8",
|
||||
"BracketHighlighter",
|
||||
"Color Highlighter",
|
||||
"DocBlockr",
|
||||
"Dockerfile Syntax Highlighting",
|
||||
"Emmet",
|
||||
"GitGutter",
|
||||
"Markdown Preview",
|
||||
"MarkdownEditing",
|
||||
"Package Control",
|
||||
"Puppet",
|
||||
"Python Fix Imports",
|
||||
"SideBarEnhancements",
|
||||
"SublimeCodeIntel",
|
||||
"SublimeLinter",
|
||||
"SublimeLinter-contrib-eslint",
|
||||
"SublimeLinter-contrib-markdownlint",
|
||||
"SublimeLinter-csslint",
|
||||
"SublimeLinter-flake8",
|
||||
"SublimeLinter-pyyaml",
|
||||
"SublimeLinter-shellcheck",
|
||||
"SublimeREPL",
|
||||
"Sync Settings",
|
||||
"Theme - Soda",
|
||||
"Vagrant"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"color_scheme": "Packages/User/SublimeLinter/Monokai Bright (SL).tmTheme",
|
||||
"font_face": "Roboto Mono for Powerline",
|
||||
"font_options": "subpixel_antialiase",
|
||||
"font_size": 11,
|
||||
"highlight_line": true,
|
||||
"highlight_modified_tabs": true,
|
||||
"ignored_packages":
|
||||
[
|
||||
"Markdown",
|
||||
"Vintage"
|
||||
],
|
||||
"indent_guide_options":
|
||||
[
|
||||
"draw_normal",
|
||||
"draw_active"
|
||||
],
|
||||
"rulers":
|
||||
[
|
||||
80,
|
||||
100
|
||||
],
|
||||
"tab_size": 4,
|
||||
"theme": "Soda Light.sublime-theme",
|
||||
"translate_tabs_to_spaces": true,
|
||||
"trim_trailing_white_space_on_save": true
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
# Passing the "source" arg tells it to only define functions, then quit.
|
||||
source $DOTFILES/bin/dotfiles "source"
|
|
@ -0,0 +1,3 @@
|
|||
export PATH="$HOME/bin:$HOME/.local/bin:$PATH:$HOME/.npm-packages/bin"
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
if [ -d $HOME/.linuxbrew ]; then
|
||||
|
||||
green='\033[0;32m'
|
||||
NC='\033[0m' # No Color
|
||||
echo -e "${green}[dotfiles] linuxbrew available to activate - abrew${NC}"
|
||||
|
||||
abrew ()
|
||||
{
|
||||
|
||||
export PATH="$HOME/.linuxbrew/bin:$HOME/.linuxbrew/sbin:$PATH"
|
||||
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
|
||||
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
|
||||
|
||||
}
|
||||
|
||||
fi
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
# anaconda
|
||||
|
||||
if [ -d "$HOME/anaconda/bin" ]; then
|
||||
|
||||
green='\033[0;32m'
|
||||
NC='\033[0m' # No Color
|
||||
echo -e "${green}[dotfiles] anaconda available to activate - aconda{NC}"
|
||||
|
||||
|
||||
export PATH="$HOME/anaconda/bin:$PATH"
|
||||
|
||||
fi
|
||||
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
if hash dircolors 2>/dev/null; then
|
||||
eval `dircolors $HOME/.dircolors`
|
||||
fi
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# Editing
|
||||
|
||||
export EDITOR='vim'
|
||||
export VISUAL="$EDITOR"
|
||||
alias q="$EDITOR"
|
|
@ -0,0 +1,42 @@
|
|||
# Files will be created with these permissions:
|
||||
# files 644 -rw-r--r-- (666 minus 022)
|
||||
# dirs 755 drwxr-xr-x (777 minus 022)
|
||||
umask 022
|
||||
|
||||
# Always use color output for `ls`
|
||||
if is_osx; then
|
||||
alias ls="command ls -G"
|
||||
else
|
||||
alias ls="command ls --color"
|
||||
export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:'
|
||||
fi
|
||||
|
||||
# Directory listing
|
||||
if [[ "$(type -P tree)" ]]; then
|
||||
alias ll='tree --dirsfirst -aLpughDFiC 1'
|
||||
alias lsd='ll -d'
|
||||
else
|
||||
alias ll='ls -al'
|
||||
alias lsd='CLICOLOR_FORCE=1 ll | grep --color=never "^d"'
|
||||
fi
|
||||
|
||||
# Easier navigation: .., ..., -
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../..'
|
||||
alias -- -='cd -'
|
||||
|
||||
# File size
|
||||
alias fs="stat -f '%z bytes'"
|
||||
alias df="df -h"
|
||||
|
||||
# Recursively delete `.DS_Store` files
|
||||
alias dsstore="find . -name '*.DS_Store' -type f -ls -delete"
|
||||
|
||||
# Aliasing eachdir like this allows you to use aliases/functions as commands.
|
||||
alias eachdir=". eachdir"
|
||||
|
||||
# Create a new directory and enter it
|
||||
function md() {
|
||||
mkdir -p "$@" && cd "$@"
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# History settings
|
||||
|
||||
# Allow use to re-edit a faild history substitution.
|
||||
shopt -s histreedit
|
||||
# History expansions will be verified before execution.
|
||||
shopt -s histverify
|
||||
|
||||
# Entries beginning with space aren't added into history, and duplicate
|
||||
# entries will be erased (leaving the most recent entry).
|
||||
export HISTCONTROL="ignorespace:erasedups"
|
||||
# Give history timestamps.
|
||||
export HISTTIMEFORMAT="[%F %T] "
|
||||
# Lots o' history.
|
||||
export HISTSIZE=10000
|
||||
export HISTFILESIZE=10000
|
||||
|
||||
# Easily re-execute the last history command.
|
||||
alias r="fc -s"
|
|
@ -0,0 +1,22 @@
|
|||
# Case-insensitive globbing (used in pathname expansion)
|
||||
shopt -s nocaseglob
|
||||
|
||||
# Check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
|
||||
# Prevent less from clearing the screen while still showing colors.
|
||||
export LESS=-XR
|
||||
|
||||
# Set the terminal's title bar.
|
||||
function titlebar() {
|
||||
echo -n $'\e]0;'"$*"$'\a'
|
||||
}
|
||||
|
||||
# SSH auto-completion based on entries in known_hosts.
|
||||
if [[ -e ~/.ssh/known_hosts ]]; then
|
||||
complete -o default -W "$(cat ~/.ssh/known_hosts | sed 's/[, ].*//' | sort | uniq | grep -v '[0-9]')" ssh scp sftp
|
||||
fi
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
# OSX-only stuff. Abort if not OSX.
|
||||
is_osx || return 1
|
||||
|
||||
# APPLE, Y U PUT /usr/bin B4 /usr/local/bin?!
|
||||
PATH="/usr/local/bin:/usr/local/sbin:$(path_remove /usr/local/bin)"
|
||||
export PATH
|
||||
|
||||
# Trim new lines and copy to clipboard
|
||||
alias c="tr -d '\n' | pbcopy"
|
||||
|
||||
# Make 'less' more.
|
||||
[[ "$(type -P lesspipe.sh)" ]] && eval "$(lesspipe.sh)"
|
||||
|
||||
# Start ScreenSaver. This will lock the screen if locking is enabled.
|
||||
alias ss="open /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app"
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
export PS1="\[\e[33m\]\u\[\e[35m\]@\[\e[31m\]\h\[\e[m\]:\[\e[34m\]\w\[\e[m\]\n\[\e[36m\]\@\[\e[m\] $ "
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#pyenv
|
||||
|
||||
if [ -d "$HOME/.pyenv" ]; then
|
||||
|
||||
green='\033[0;32m'
|
||||
NC='\033[0m' # No Color
|
||||
echo -e "${green}[dotfiles] pyenv available to activate - pyenv${NC}"
|
||||
|
||||
pyenv ()
|
||||
{
|
||||
export PATH="$HOME/.pyenv/bin:$PATH"
|
||||
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
|
||||
}
|
||||
|
||||
fi
|
|
@ -0,0 +1,16 @@
|
|||
# rbenv
|
||||
|
||||
if [ -d "$HOME/.rbenv" ]; then
|
||||
|
||||
green='\033[0;32m'
|
||||
NC='\033[0m' # No Color
|
||||
echo -e "${green}[dotfiles] rbenv available to activate - arbenv${NC}"
|
||||
|
||||
arbenv ()
|
||||
{
|
||||
export PATH="$HOME/.rbenv/bin:$PATH"
|
||||
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
|
||||
}
|
||||
fi
|
||||
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
# Things that should only and always run on UTSW biohpc systems
|
||||
# Looks for a file named '.biohpchost' in user home directory
|
||||
# rather than checking hostnames which are complex across the
|
||||
# different biohpc systems.
|
||||
|
||||
if [ -f $HOME/.biohpchost ]; then
|
||||
|
||||
green='\033[0;32m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo -e "${green}[dotfiles] BioHPC host - $BASH_SOURCE${NC}"
|
||||
|
||||
# BioHPC Global bashrc
|
||||
if [ -f /etc/bashrc ]; then
|
||||
. /etc/bashrc
|
||||
fi
|
||||
|
||||
# UTSW Proxies
|
||||
export http_proxy="http://proxy.swmed.edu:3128"
|
||||
export https_proxy="http://proxy.swmed.edu:3128"
|
||||
export all_proxy="http://proxy.swmed.edu:3128"
|
||||
|
||||
# Modules
|
||||
module load shared slurm git/v2.5.3 python/2.7.x-anaconda
|
||||
|
||||
# Default python environment
|
||||
source activate dct_default
|
||||
|
||||
# Convenience Aliases
|
||||
export WORK="/work/biohpcadmin/dtrudgian"
|
||||
export WORK_SHARED="/work/biohpcadmin/shared"
|
||||
export PROJECT="/project/biohpcadmin/dtrudgian"
|
||||
export PROJECT_SHARED="/project/biohpcadmin/shared"
|
||||
export ARCHIVE="/archive/biohpcadmin/dtrudgian"
|
||||
export ARCHIVE_SHARED="/archive/biohpcadmin/shared"
|
||||
|
||||
alias cdp="cd $PROJECT"
|
||||
alias cdps="cd $PROJECT_SHARED"
|
||||
alias cdw="cd $WORK"
|
||||
alias cdws="cd $WORK_SHARED"
|
||||
alias cda="cd $ARCHIVE"
|
||||
alias cdas="cd $ARCHIVE_SHARED"
|
||||
|
||||
alias aconda="module load python/2.7.x-anaconda"
|
||||
alias dconda="module rm python/2.7.x-anaconda"
|
||||
|
||||
alias screenws="screen -c ~/.screenrc-ws"
|
||||
|
||||
if [ "$COLORTERM" = "gnome-terminal" ]; then
|
||||
export TERM="xterm-256color"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
rename 0.1.3
|
||||
Wednesday, Nov 4, 2009, 00:35
|
||||
Aristotle Pagaltzis
|
||||
http://plasmasturm.org/code/rename/
|
||||
|
||||
Note: downloaded directly because there's no repo to include.
|
|
@ -0,0 +1,310 @@
|
|||
#!/usr/bin/perl
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
rename - renames multiple files
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
F<rename>
|
||||
S<B<-h>>
|
||||
|
||||
F<rename>
|
||||
S<B<--man>>
|
||||
|
||||
F<rename>
|
||||
S<B<[ -0 ]>>
|
||||
S<B<[ -c ]>>
|
||||
S<B<[ -C ]>>
|
||||
S<B<[ -e code ]>>
|
||||
S<B<[ -f ]>>
|
||||
S<B<[ -i ]>>
|
||||
S<B<[ -l | -L ]>>
|
||||
S<B<[ -n ]>>
|
||||
S<B<[ -s from to ]>>
|
||||
S<B<[ -v ]>>
|
||||
S<B<[ files ]>>
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
C<rename> renames the filenames supplied according to the rules specified. If a given filename is not modified, it will not be renamed. If no filenames are given on the command line, filenames will be read via standard input.
|
||||
|
||||
For example, to rename all files matching C<*.bak> to strip the extension, you might say
|
||||
|
||||
rename 's/\.bak$//' *.bak
|
||||
|
||||
If are confident that none of the filenames has C<.bak> anywhere else than at the end, you can also use the much easier typed
|
||||
|
||||
rename -s .bak '' *.bak
|
||||
|
||||
You can always do multiple changes in one ago:
|
||||
|
||||
rename -s .tgz .tar.gz -s .tbz2 .tar.bz2 *.tar.*
|
||||
|
||||
Note however that expressive options are order sensitive. The following would probably surprise you:
|
||||
|
||||
rename -s foo bar -s bar baz *
|
||||
|
||||
Since operations are cumulative, this would end up substituting (some of) the F<foo> matches in filenames with F<baz>! So pay attention to order. You may want to request a verbose dry run with C<-nv> for the first stab at a complex rename operation.
|
||||
|
||||
rename -nv -s bar baz -s foo bar *
|
||||
|
||||
You can combine the various expressive options to suit your needs. F.ex files from Microsoft(tm) Windows systems often have blanks and (sometimes nothing but) capital letters in their names. Let's say you have a bunch of such files to clean up, and you also want to move them to subdirectories based on extension. The following command should help, provided all directories already exist:
|
||||
|
||||
rename -cz -e '$_ = "$1/$_" if /(\..*)\z/' *
|
||||
|
||||
Again you need to pay attention to order sensitivity for expressive options. If you placed the C<-c> after the C<-e> in the above example, files with F<.zip> and F<.ZIP> extensions would be (attempted to be) moved to different directories because the directory name prefix would be added before the filenames were normalized. Once again, use verbose dry run requested using C<-nv> to get an idea of what exactly a complex rename operation is going to do.
|
||||
|
||||
=head1 ARGUMENTS
|
||||
|
||||
=over 4
|
||||
|
||||
=item B<-h>, B<--help>
|
||||
|
||||
See a synopsis.
|
||||
|
||||
=item B<--man>
|
||||
|
||||
Browse the manpage.
|
||||
|
||||
=back
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 4
|
||||
|
||||
=item B<-0>, B<--null>
|
||||
|
||||
When reading file names from C<STDIN>, split on NUL bytes instead of newlines. This is useful in combination with GNU find's C<-print0> option, GNU grep's C<-Z> option, and GNU sort's C<-z> option, to name just a few. B<Only valid if no filenames have been given on the commandline.>
|
||||
|
||||
=item B<-c>, B<--lower-case>
|
||||
|
||||
Converts file names to all lower case.
|
||||
|
||||
=item B<-C>, B<--upper-case>
|
||||
|
||||
Converts file names to all upper case.
|
||||
|
||||
=item B<-e>, B<--expr>
|
||||
|
||||
The C<code> argument to this option should be a Perl expression that assumes the filename in the C<$_> variable and modifies it for the filenames to be renamed. When no other C<-c>, C<-C>, C<-e>, C<-s>, or C<-z> options are given, you can omit the C<-e> from infront of the code.
|
||||
|
||||
=item B<-g>, B<--glob>
|
||||
|
||||
Glob filename arguments. This is useful if you're using a braindead shell such as F<cmd.exe> which won't expand wildcards on behalf of the user.
|
||||
|
||||
=item B<-f>, B<--force>
|
||||
|
||||
Rename even when a file with the destination name already exists.
|
||||
|
||||
=item B<-i>, B<--interactive>
|
||||
|
||||
Ask the user to confirm every action before it is taken.
|
||||
|
||||
=item B<-k>, B<--backwards>, B<--reverse-order>
|
||||
|
||||
Process the list of files in reverse order, last file first. This prevents conflicts when renaming files to names which are currently taken but would be freed later during the process of renaming.
|
||||
|
||||
=item B<-l>, B<--symlink>
|
||||
|
||||
Create symlinks from the new names to the existing ones, instead of renaming the files. B<Cannot be used in conjunction with C<-L>.>
|
||||
|
||||
=item B<-L>, B<--hardlink>
|
||||
|
||||
Create hard links from the new names to the existing ones, instead of renaming the files. B<Cannot be used in conjunction with C<-l>.>
|
||||
|
||||
=item B<-n>, B<--dry-run>, B<--just-print>
|
||||
|
||||
Show how the files would be renamed, but don't actually do anything.
|
||||
|
||||
=item B<-s>, B<--subst>, B<--simple>
|
||||
|
||||
Perform a simple textual substitution of C<from> to C<to>. The C<from> and C<to> parameters must immediately follow the argument.
|
||||
|
||||
Quoting issues aside, this is equivalent to supplying a C<-e 's/\Qfrom/to/'>.
|
||||
|
||||
=item B<-v>, B<--verbose>
|
||||
|
||||
Print additional information about the operations (not) executed.
|
||||
|
||||
=item B<-z>, B<--sanitize>
|
||||
|
||||
Replaces consecutive blanks, shell meta characters, and control characters in filenames with underscores.
|
||||
|
||||
=back
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
mv(1), perl(1), find(1), grep(1), sort(1)
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
None currently known.
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Aristotle Pagaltzis
|
||||
|
||||
Idea, inspiration and original code from Larry Wall and Robin Barker.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|
||||
|
||||
=cut
|
||||
|
||||
use Pod::Usage;
|
||||
use Getopt::Long 2.24, qw(:config bundling no_ignore_case no_auto_abbrev);
|
||||
|
||||
use constant ERROR => do { bless \(my $l = 0), 'LOGLEVEL' };
|
||||
use constant INFO => do { bless \(my $l = 1), 'LOGLEVEL' };
|
||||
use constant DEBUG => do { bless \(my $l = 2), 'LOGLEVEL' };
|
||||
use constant VERB_FOR => {
|
||||
link => {
|
||||
inf => 'link',
|
||||
pastp => 'linked',
|
||||
exec => sub { link shift, shift or die },
|
||||
},
|
||||
symlink => {
|
||||
inf => 'symlink',
|
||||
pastp => 'symlinked',
|
||||
exec => sub { symlink shift, shift or die },
|
||||
},
|
||||
rename => {
|
||||
inf => 'rename',
|
||||
pastp => 'renamed',
|
||||
exec => sub { rename shift, shift or die },
|
||||
},
|
||||
};
|
||||
|
||||
sub argv_to_subst_expr {
|
||||
my $modifier = shift || '';
|
||||
pod2usage( -verbose => 1 ) if @ARGV < 2;
|
||||
my ($from, $to) = map quotemeta, splice @ARGV, 0, 2;
|
||||
# the ugly \${\""} construct is necessary because unknown backslash escapes are
|
||||
# not treated the same in pattern- vs doublequote-quoting context; only the
|
||||
# latter lets us do the right thing with problematic input like
|
||||
# ']{ool(haracter$' or maybe '>><//((/>'
|
||||
sprintf 's/\Q${\"%s"}/%s/%s', $from, $to, $modifier;
|
||||
}
|
||||
|
||||
my @EXPR;
|
||||
|
||||
GetOptions(
|
||||
'h|help' => sub { pod2usage( -verbose => 1 ) },
|
||||
'man' => sub { pod2usage( -verbose => 2 ) },
|
||||
'0|null' => \my $opt_null,
|
||||
'c|lower-case' => sub { push @EXPR, 's/([[:upper:]]+)/\L$1/g' },
|
||||
'C|upper-case' => sub { push @EXPR, 's/([[:lower:]]+)/\U$1/g' },
|
||||
'e|expr=s' => \@EXPR,
|
||||
'f|force' => \my $opt_force,
|
||||
'g|glob' => \my $opt_glob,
|
||||
'i|interactive' => \my $opt_interactive,
|
||||
'k|backwards|reverse-order' => \my $opt_backwards,
|
||||
'l|symlink' => \my $opt_symlink,
|
||||
'L|hardlink' => \my $opt_hardlink,
|
||||
'n|just-print|dry-run' => \my $opt_dryrun,
|
||||
'p|mkpath|make-dirs' => \my $opt_mkpath,
|
||||
'v|verbose+' => \(my $opt_verbose = 0),
|
||||
'z|sanitize' => sub { push @EXPR, 's/[!"\$&()=?`*\';<>|_[:cntrl:][:blank:]]+/_/g' },
|
||||
's|subst|simple' => sub { push @EXPR, argv_to_subst_expr },
|
||||
'S|subst-global' => sub { push @EXPR, argv_to_subst_expr('g') },
|
||||
) or pod2usage( -verbose => 1 );
|
||||
|
||||
die "TODO" if $opt_mkpath;
|
||||
|
||||
if(not @EXPR) {
|
||||
pod2usage( -verbose => 1 ) if not @ARGV or -e $ARGV[0];
|
||||
push @EXPR, shift;
|
||||
}
|
||||
|
||||
pod2usage( -verbose => 1 )
|
||||
if ($opt_hardlink and $opt_symlink)
|
||||
or ($opt_null and @ARGV);
|
||||
|
||||
++$opt_verbose if $opt_dryrun;
|
||||
|
||||
BEGIN {
|
||||
*CORE::GLOBAL::warn = sub {
|
||||
if(ref $_[0] eq 'LOGLEVEL') {
|
||||
my $msglevel = ${(shift)};
|
||||
print "@_\n" if $opt_verbose >= $msglevel;
|
||||
return;
|
||||
}
|
||||
warn @_;
|
||||
};
|
||||
}
|
||||
|
||||
my $code = do {
|
||||
my $cat = "sub { ".join('; ', @EXPR)." }";
|
||||
warn DEBUG, "Using expression: $cat";
|
||||
|
||||
my $evaled = eval $cat;
|
||||
die $@ if $@;
|
||||
die "Evaluation to subref failed. Check expression using -vn\n"
|
||||
unless 'CODE' eq ref $evaled;
|
||||
|
||||
$evaled;
|
||||
};
|
||||
|
||||
my $verb = VERB_FOR->{
|
||||
$opt_hardlink ? 'link' :
|
||||
$opt_symlink ? 'symlink' :
|
||||
do { 'rename' }
|
||||
};
|
||||
|
||||
if (!@ARGV) {
|
||||
warn INFO, "Reading filenames from STDIN";
|
||||
@ARGV = do {
|
||||
if($opt_null) {
|
||||
warn INFO, "Splitting on NUL bytes";
|
||||
local $/ = "\0";
|
||||
}
|
||||
<STDIN>;
|
||||
};
|
||||
chomp @ARGV;
|
||||
}
|
||||
|
||||
@ARGV = map glob, @ARGV if $opt_glob;
|
||||
|
||||
@ARGV = reverse @ARGV if $opt_backwards;
|
||||
|
||||
for (@ARGV) {
|
||||
my $old = $_;
|
||||
|
||||
$code->();
|
||||
|
||||
if($old eq $_) {
|
||||
warn DEBUG, "'$old' unchanged";
|
||||
next;
|
||||
}
|
||||
|
||||
if(!$opt_force and -e) {
|
||||
warn ERROR, "'$old' not $verb->{pastp}: '$_' already exists";
|
||||
next;
|
||||
}
|
||||
|
||||
if($opt_dryrun) {
|
||||
warn INFO, "'$old' would be $verb->{pastp} to '$_'";
|
||||
next;
|
||||
}
|
||||
|
||||
if($opt_interactive) {
|
||||
print "\u$verb->{inf} '$old' to '$_'? [n] ";
|
||||
if(<STDIN> !~ /^y(?:es)?$/i) {
|
||||
warn DEBUG, "Skipping '$old'.";
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
eval { $verb->{exec}($old, $_) };
|
||||
|
||||
if($@) {
|
||||
warn ERROR, "Can't $verb->{inf} '$old' to '$_': $!";
|
||||
next;
|
||||
}
|
||||
|
||||
warn INFO, "'$old' $verb->{pastp} to '$_'";
|
||||
}
|
Loading…
Reference in New Issue