[core]
editor = emacsclient -t
[rerere]
enabled = true
[color]
ui = auto
[merge]
conflictStyle = diff3
[diff]
# Remove `a/` and `b/` prefixes from diffs.
noprefix = true
cd path/to/repo
git filter-branch -f --env-filter '
OLD_EMAIL="my-old-email@someplace.com"
CORRECT_NAME="username"
CORRECT_EMAIL="my-new-email@someplace.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_AUTHOR_NAME="$CORRECT_NAME"
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags
git push --force --tags origin 'refs/heads/*'
ontop
export PATH=~/go/bin:~/stuff/active/code/gopath/bin:~/local/bin:~/miniconda2/bin:$PATH
if [ -f /opt/homebrew/bin/brew ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
if [ -f ~/homebrew/bin/brew ]; then
eval "$(~/homebrew/bin/brew shellenv)"
fi
Tangle .bash_overrides blaock and then execute following block to patch .bash_profile and .bashrc.
export TERM="screen-256color"
### Environment variables ### start
if [[ -z $STUFF_DIR ]]; then
export STUFF_DIR=~/stuff
fi
export PATH=~/go/bin:~/stuff/active/code/gopath/bin:~/local/bin:~/miniconda2/bin:~/homebrew/bin:$PATH
### Environment variables ### end
### Functions ### start
err() {
echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $@">&2
}
get_stuff_dir() {
stuff_dir="${STUFF_DIR}"
if [[ -z ${stuff_dir} ]]; then
err "Error: STUFF_DIR env variable not set."
return
fi
echo "${stuff_dir}"
}
cd_stuff() {
cd $(get_stuff_dir)
}
get_inactive_dir() {
echo "$(get_stuff_dir)/inactive"
}
get_active_dir() {
echo "$(get_stuff_dir)/active"
}
get_downloads_dir() {
echo "$HOME/Downloads"
}
cd_active() {
cd $(get_active_dir)
}
cd_downloads() {
cd $(get_downloads_dir)
}
cd_inactive() {
cd $(get_inactive_dir)
}
if [ -z "$INSIDE_EMACS" ]; then
update_terminal_cwd() {
# Identify the directory using a "file:" scheme URL, including
# the host name to disambiguate local vs. remote paths.
# Percent-encode the pathname.
local url_path=''
{
# Use LC_CTYPE=C to process text byte-by-byte. Ensure that
# LC_ALL isn't set, so it doesn't interfere.
local i ch hexch LC_CTYPE=C LC_ALL=
for ((i = 0; i < ${#PWD}; ++i)); do
ch="${PWD:i:1}"
if [[ "$ch" =~ [/._~A-Za-z0-9-] ]]; then
url_path+="$ch"
else
printf -v hexch "%02X" "'$ch"
# printf treats values greater than 127 as
# negative and pads with "FF", so truncate.
url_path+="%${hexch: -2:2}"
fi
done
}
printf '\e]7;%s\a' "file://$HOSTNAME$url_path"
}
PROMPT_COMMAND="update_terminal_cwd${PROMPT_COMMAND:+; $PROMPT_COMMAND}"
fi
### Functions ### end
### Bash History ### start
# Increase history size.
export HISTSIZE=32768
### Bash History ### end
### Aliases ### start
alias ec="emacsclient -n"
alias a="cd_active"
alias d="cd_downloads"
alias i="cd_inactive"
alias tail_ios="tail -f ~/Library/Logs/iOS\ Simulator/7.1/system.log"
alias grep="grep --color=always"
alias git_gc="git gc --aggressive --prune=now"
### Aliases ### end
Patch .bash_profile and .bashrc.
#!/bin/bash
if ! grep -q 'bash_overrides' ~/.bash_profile; then
echo 'adding .bash_overrides to .bash_profile'
echo 'source ~/.bash_overrides' >> ~/.bash_profile
fi
if ! grep -q 'bash_overrides' ~/.bashrc; then
echo 'adding .bash_overrides to .bashrc'
echo 'source ~/.bash_overrides' >> ~/.bashrc
fi
source ~/.bash_profile
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
"basic.simultaneous_threshold_milliseconds": 50,
"basic.to_delayed_action_delay_milliseconds": 500,
"basic.to_if_alone_timeout_milliseconds": 1000,
"basic.to_if_held_down_threshold_milliseconds": 500,
"mouse_motion_to_scroll.speed": 100
},
"rules": [
{
"description": "Ctrl-p/n/b/f to arrow up/down/left/right",
"manipulators": [
{
"from": {
"key_code": "p",
"modifiers": {
"mandatory": [
"control"
]
}
},
"to": [
{
"key_code": "up_arrow"
}
],
"conditions": [
{
"type": "frontmost_application_unless",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs",
"^com\\.apple\\.Terminal"
]
}
],
"type": "basic"
},
{
"from": {
"key_code": "n",
"modifiers": {
"mandatory": [
"control"
]
}
},
"to": [
{
"key_code": "down_arrow"
}
],
"conditions": [
{
"type": "frontmost_application_unless",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs",
"^com\\.apple\\.Terminal"
]
}
],
"type": "basic"
},
{
"from": {
"key_code": "b",
"modifiers": {
"mandatory": [
"control"
]
}
},
"to": [
{
"key_code": "left_arrow"
}
],
"conditions": [
{
"type": "frontmost_application_unless",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs",
"^com\\.apple\\.Terminal"
]
}
],
"type": "basic"
},
{
"from": {
"key_code": "f",
"modifiers": {
"mandatory": [
"control"
]
}
},
"to": [
{
"key_code": "right_arrow"
}
],
"conditions": [
{
"type": "frontmost_application_unless",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs",
"^com\\.apple\\.Terminal"
]
}
],
"type": "basic"
}
]
},
{
"description": "Ctrl+G to Escape",
"manipulators": [
{
"description": "Emacs-like escape",
"from": {
"key_code": "g",
"modifiers": {
"mandatory": [
"left_control"
]
}
},
"to": [
{
"key_code": "escape"
}
],
"conditions": [
{
"type": "frontmost_application_unless",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs"
]
}
],
"type": "basic"
}
]
},
{
"description": "Emacs-like page scrolling",
"manipulators": [
{
"description": "Page Down with Control-v",
"from": {
"key_code": "v",
"modifiers": {
"mandatory": [
"left_control"
]
}
},
"to": [
{
"key_code": "page_down"
}
],
"conditions": [
{
"type": "frontmost_application_unless",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs"
]
}
],
"type": "basic"
},
{
"description": "Page Up with Control-Shift-v",
"from": {
"key_code": "v",
"modifiers": {
"mandatory": [
"left_control",
"shift"
]
}
},
"to": [
{
"key_code": "page_up"
}
],
"conditions": [
{
"type": "frontmost_application_unless",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs"
]
}
],
"type": "basic"
}
]
}
]
},
"devices": [],
"fn_function_keys": [],
"name": "Emacs life",
"parameters": {
"delay_milliseconds_before_open_device": 1000
},
"selected": true,
"simple_modifications": [],
"virtual_hid_keyboard": {
"country_code": 0,
"mouse_key_xy_scale": 100
}
}
]
}
--langdef=swift
--langmap=swift:+.swift
--kinddef-swift=v,variable,variables
--kinddef-swift=f,function,functions
--kinddef-swift=s,struct,structs
--kinddef-swift=c,class,classes
--kinddef-swift=p,protocol,protocols
--kinddef-swift=e,enum,enums
--kinddef-swift=t,typealias,typealiases
--regex-swift=/(var|let)[ \t]+([^:=]+).*$/\2/v/
--regex-swift=/func[ \t]+([^\(\)]+)\([^\(\)]*\)/\1/f/
--regex-swift=/struct[ \t]+([^:\{]+).*$/\1/s/
--regex-swift=/class[ \t]+([^:\{]+).*$/\1/c/
--regex-swift=/protocol[ \t]+([^:\{]+).*$/\1/p/
--regex-swift=/enum[ \t]+([^:\{]+).*$/\1/e/
--regex-swift=/(typealias)[ \t]+([^:=]+).*$/\2/v/
# Based on https://github.com/michaelx/dotfiles/blob/master/.macos
# Close any open System Preferences panes, to prevent them from overriding
# settings we’re about to change
osascript -e 'tell application "System Preferences" to quit'
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.macos` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# Disable the sound effects on boot
sudo nvram SystemAudioVolume=" "
# Expand save panel by default.
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
# Expand print panel by default.
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
# Save to disk (not to iCloud) by default.
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
# Automatically quit printer app once the print jobs complete.
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
# Reveal IP address, hostname, OS version, etc. when clicking the clock
# in the login window.
sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName
# Restart automatically if the computer freezes.
sudo systemsetup -setrestartfreeze on
# Set a blazingly fast keyboard repeat rate (were 2 and 15).
defaults write NSGlobalDomain KeyRepeat -int 1
defaults write NSGlobalDomain InitialKeyRepeat -int 10
defaults write NSGlobalDomain AppleLanguages -array "en-GB" "en-AU"
defaults write NSGlobalDomain AppleLocale -string "en_GB"
defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters"
defaults write NSGlobalDomain AppleMetricUnits -bool true
# Show language menu in the top right corner of the boot screen
sudo defaults write /Library/Preferences/com.apple.loginwindow showInputMenu -bool true
# Disable shadow in screenshots
defaults write com.apple.screencapture disable-shadow -bool true
# Hide desktop files and icons
defaults write com.apple.finder CreateDesktop false
# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons
#defaults write com.apple.finder QuitMenuItem -bool true
# Set Desktop as the default location for new Finder windows
# For other paths, use `PfLo` and `file:///full/path/here/`
# Computer : `PfCm`
# Volume : `PfVo`
# $HOME : `PfHm`
# Desktop : `PfDe`
# Documents : `PfDo`
# All My Files : `PfAF`
# Other… : `PfLo`
defaults write com.apple.finder NewWindowTarget -string "PfHm"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/"
# Show icons for hard drives, servers, and removable media on the desktop
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool false
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool false
defaults write com.apple.finder ShowMountedServersOnDesktop -bool false
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool false
# Finder: show hidden files by default
defaults write com.apple.finder AppleShowAllFiles -bool true
# Finder: show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# Avoid creating .DS_Store files on network or USB volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
# Automatically open a new Finder window when a volume is mounted
#defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true
#defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true
#defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true
# Show the ~/Library folder
chflags nohidden ~/Library
# Expand the following File Info panes:
# “General”, “Open with”, and “Sharing & Permissions”
defaults write com.apple.finder FXInfoPanesExpanded -dict \
General -bool true \
OpenWith -bool true \
Privileges -bool true
# Automatically hide and show the Dock
defaults write com.apple.dock autohide -bool true
# Add iOS & Watch Simulator to Launchpad
#sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app" "/Applications/Simulator.app"
# Privacy: don’t send search queries to Apple
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true
[FORMAT]
indent-string=' '
# Mac OS setup
# NOTE: /HOMEBREW/INSTALL/DIR must be set!
# brew install --HEAD ctags
# brew install global --with-exuberant-ctags
# Verify support:
# ctags --list-kinds=all
# ctags for Objective-C:
# ctags --langmap=ObjectiveC:.m.h path/to/source/File.h
default:\
:tc=ctags:
ctags:\
:tc=exuberant-ctags:
exuberant-ctags|plugin-example|setting to use Exuberant Ctags plug-in parser:\
:langmap=Java\:.java:\
:langmap=ObjectiveC\:.m.h:\
:langmap=ObjectiveC++\:.mm.hh.h:\
:gtags_parser=Java\:/HOMEBREW/INSTALL/DIR/lib/gtags/exuberant-ctags.la:\
:gtags_parser=ObjectiveC\:/HOMEBREW/INSTALL/DIR/lib/gtags/exuberant-ctags.la:\
:gtags_parser=ObjectiveC++\:/HOMEBREW/INSTALL/DIR/lib/gtags/exuberant-ctags.la:\
# Append libpath if need be. For example:
# export GTAGSLIBPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk