├── fish ├── fishfile ├── functions │ ├── week.fish │ ├── clear.fish │ ├── manp.fish │ ├── mvnpurge.fish │ ├── pubkey.fish │ ├── repo.fish │ ├── ls.fish │ ├── repodir.fish │ ├── update.fish │ ├── forrepos.fish │ ├── emptytrash.fish │ ├── setup.fish │ ├── abbrex.fish │ ├── fish_greeting.fish │ ├── fish_prompt.fish │ └── fisher.fish ├── completions │ ├── repo.fish │ └── repodir.fish ├── config.fish └── setup.sh ├── hammerspoon ├── shortcuts.lua ├── caffeinate.lua ├── minimising.lua ├── init.lua ├── setup.sh ├── hyper.lua ├── README.md └── spectacle.lua ├── packages ├── go get -u.list ├── python -m pip install.list ├── python3 -m pip install copy.list ├── npm install -g.list ├── setup.sh ├── code --install-extension.list └── Brewfile ├── repos ├── chaingrep.list ├── bch.list ├── personal.list ├── gp.list ├── ethereum.list └── setup.sh ├── duti ├── org.videolan.vlc ├── com.microsoft.VSCode └── setup.sh ├── git ├── setup.sh ├── .gitconfig └── .gitignore_global ├── vim ├── setup.sh └── .vimrc ├── bin ├── setup.sh ├── sethidden ├── togglehidden └── imgcat ├── karabiner ├── setup.sh └── karabiner.json ├── vscode ├── setup.sh └── settings.json ├── LICENSE ├── bootstrap.sh ├── scripts └── functions.sh ├── README.md └── macos └── setup.sh /fish/fishfile: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /hammerspoon/shortcuts.lua: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/go get -u.list: -------------------------------------------------------------------------------- 1 | github.com/gcash/meep 2 | -------------------------------------------------------------------------------- /packages/python -m pip install.list: -------------------------------------------------------------------------------- 1 | pip 2 | pipenv 3 | poetry 4 | -------------------------------------------------------------------------------- /packages/python3 -m pip install copy.list: -------------------------------------------------------------------------------- 1 | pip 2 | pipenv 3 | poetry 4 | -------------------------------------------------------------------------------- /fish/functions/week.fish: -------------------------------------------------------------------------------- 1 | # Get week number 2 | function week 3 | date +%V 4 | end 5 | -------------------------------------------------------------------------------- /repos/chaingrep.list: -------------------------------------------------------------------------------- 1 | git@github.com:chaingrep/armada.git 2 | git@github.com:chaingrep/chaingrep.git 3 | -------------------------------------------------------------------------------- /packages/npm install -g.list: -------------------------------------------------------------------------------- 1 | npm 2 | cashc 3 | ganache 4 | ghost-cli 5 | truffle 6 | ts-node 7 | yarn 8 | -------------------------------------------------------------------------------- /fish/functions/clear.fish: -------------------------------------------------------------------------------- 1 | function clear --description 'Clears the screen' 2 | command clear; fish_greeting 3 | end 4 | -------------------------------------------------------------------------------- /fish/functions/manp.fish: -------------------------------------------------------------------------------- 1 | function manp --description 'Opens a manpage in Preview' 2 | man -t $argv[1] | open -f -a Preview 3 | end 4 | -------------------------------------------------------------------------------- /fish/functions/mvnpurge.fish: -------------------------------------------------------------------------------- 1 | function mvnpurge --description 'Purges local mvn repository' 2 | rm -rf ~/.m2/repository/* 3 | end 4 | -------------------------------------------------------------------------------- /hammerspoon/caffeinate.lua: -------------------------------------------------------------------------------- 1 | hyper:bind({}, "l", function() 2 | hs.caffeinate.startScreensaver() 3 | hyper.triggered = true 4 | end) 5 | -------------------------------------------------------------------------------- /fish/functions/pubkey.fish: -------------------------------------------------------------------------------- 1 | function pubkey 2 | cat ~/.ssh/id_ecdsa.pub | pbcopy; and echo '=> Public key copied to pasteboard.' 3 | end 4 | -------------------------------------------------------------------------------- /fish/functions/repo.fish: -------------------------------------------------------------------------------- 1 | function repo 2 | set -l repo_path (repodir $argv) 3 | echo "$repo_path" 4 | cd "$repo_path" 5 | end 6 | -------------------------------------------------------------------------------- /fish/completions/repo.fish: -------------------------------------------------------------------------------- 1 | for repo in (find ~/repos -mindepth 2 -maxdepth 2 -type d) 2 | complete -f -c repo -a "(basename \"$repo\")" 3 | end 4 | -------------------------------------------------------------------------------- /fish/completions/repodir.fish: -------------------------------------------------------------------------------- 1 | for repo in (find ~/repos -mindepth 2 -maxdepth 2 -type d) 2 | complete -f -c repodir -a "(basename \"$repo\")" 3 | end 4 | -------------------------------------------------------------------------------- /fish/functions/ls.fish: -------------------------------------------------------------------------------- 1 | function ls --description 'List contents of directory' 2 | set -l param --color=auto 3 | command ls $param $argv 4 | end 5 | -------------------------------------------------------------------------------- /duti/org.videolan.vlc: -------------------------------------------------------------------------------- 1 | # Audio 2 | .mp3 3 | .mpa 4 | .ogg 5 | .wav 6 | .wma 7 | # Disk Image 8 | .iso 9 | # Video 10 | .avi 11 | .m4v 12 | .mkv 13 | .mov 14 | .mp4 15 | .mpg 16 | .mpeg 17 | .wmv 18 | -------------------------------------------------------------------------------- /duti/com.microsoft.VSCode: -------------------------------------------------------------------------------- 1 | .c 2 | .cpp 3 | .h 4 | .hpp 5 | .hs 6 | .js 7 | .ts 8 | .py 9 | .sh 10 | .fish 11 | .txt 12 | .list 13 | .lua 14 | .applescript 15 | .scpt 16 | .bib 17 | .tex 18 | .json 19 | .php 20 | .cs 21 | .java 22 | -------------------------------------------------------------------------------- /repos/bch.list: -------------------------------------------------------------------------------- 1 | git@github.com:bitauth/libauth.git 2 | git@github.com:Bitcoin-com/cashscript.git 3 | git@github.com:rkalis/cashscript-playground.git 4 | git@gitlab.com:GeneralProtocols/electrum-cash/library.git electrum-cash 5 | git@github.com:rkalis/electrum-cli.git 6 | -------------------------------------------------------------------------------- /fish/functions/repodir.fish: -------------------------------------------------------------------------------- 1 | function repodir 2 | set repo_base ~/repos 3 | set repo_path (find "$repo_base" -mindepth 2 -maxdepth 2 -type d -name "*$argv*" | head -n 1) 4 | if not test "$argv"; or not test "$repo_path" 5 | set repo_path "$repo_base" 6 | end 7 | echo "$repo_path" 8 | end 9 | -------------------------------------------------------------------------------- /fish/functions/update.fish: -------------------------------------------------------------------------------- 1 | function update --description 'Get OS X Software Updates and update Homebrew, mas, and npm packages' 2 | sudo softwareupdate -i -a 3 | brew update 4 | brew upgrade --force --all 5 | brew cleanup 6 | mas upgrade 7 | npm install npm -g 8 | npm update -g 9 | end 10 | -------------------------------------------------------------------------------- /fish/functions/forrepos.fish: -------------------------------------------------------------------------------- 1 | function forrepos --description 'Evaluates $argv for all repo folders' 2 | for d in (find ~/repos -mindepth 2 -maxdepth 2 ! -path . -type d) 3 | pushd $d 4 | set repo (basename $d) 5 | echo $repo 6 | eval (abbrex $argv) 7 | popd > /dev/null 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /git/setup.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env sh 2 | 3 | DIR=$(dirname "$0") 4 | cd "$DIR" 5 | 6 | . ../scripts/functions.sh 7 | 8 | SOURCE="$(realpath -m .)" 9 | DESTINATION="$(realpath -m ~)" 10 | 11 | info "Configuraing git..." 12 | 13 | find . -name ".git*" | while read fn; do 14 | fn=$(basename $fn) 15 | symlink "$SOURCE/$fn" "$DESTINATION/$fn" 16 | done 17 | 18 | success "Finished configuring git." 19 | -------------------------------------------------------------------------------- /vim/setup.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env sh 2 | 3 | DIR=$(dirname "$0") 4 | cd "$DIR" 5 | 6 | . ../scripts/functions.sh 7 | 8 | SOURCE="$(realpath -m .)" 9 | DESTINATION="$(realpath -m ~)" 10 | 11 | info "Setting up Vim..." 12 | 13 | find . -name ".vim*" | while read fn; do 14 | fn=$(basename $fn) 15 | symlink "$SOURCE/$fn" "$DESTINATION/$fn" 16 | done 17 | 18 | success "Finished setting up Vim." 19 | -------------------------------------------------------------------------------- /hammerspoon/minimising.lua: -------------------------------------------------------------------------------- 1 | hyper:bind({}, "m", function() 2 | hs.window.frontmostWindow():minimize() 3 | hyper.triggered = true 4 | end) 5 | 6 | hyper:bind({"alt"}, "m", function() 7 | local wins = hs.window.allWindows() 8 | for _, win in ipairs(wins) do 9 | if win:isMinimized() then 10 | win:unminimize() 11 | break 12 | end 13 | end 14 | hyper.triggered = true 15 | end) 16 | -------------------------------------------------------------------------------- /fish/functions/emptytrash.fish: -------------------------------------------------------------------------------- 1 | # Empty the Trash on all mounted volumes and the main HDD. 2 | # Also, clear Apple’s System Logs to improve shell startup speed. 3 | # Finally, clear download history from quarantine. https://mths.be/bum 4 | function emptytrash 5 | sudo rm -rfv /Volumes/*/.Trashes 6 | sudo rm -rfv ~/.Trash 7 | sudo rm -rfv /private/var/log/asl/*.asl 8 | sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent' 9 | end 10 | -------------------------------------------------------------------------------- /fish/functions/setup.fish: -------------------------------------------------------------------------------- 1 | ## Defines abbreviations 2 | function setup 3 | for abbreviation in (abbr -l) 4 | abbr -e $abbreviation 5 | end 6 | abbr g git 7 | abbr gf git fetch 8 | abbr gs git status 9 | abbr gc git commit 10 | abbr gm git pull --ff-only 11 | abbr gr git rb FETCH_HEAD 12 | abbr ga git add 13 | abbr gp git push 14 | abbr gd git diff 15 | abbr gco git checkout 16 | abbr ll ls -lhA 17 | abbr bs brew services 18 | fisher 19 | end 20 | -------------------------------------------------------------------------------- /bin/setup.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env sh 2 | 3 | DIR=$(dirname "$0") 4 | cd "$DIR" 5 | 6 | . ../scripts/functions.sh 7 | 8 | SOURCE="$(realpath -m .)" 9 | DESTINATION="$(realpath -m ~/bin)" 10 | 11 | info "Setting up user bin..." 12 | 13 | substep_info "Creating user bin folder..." 14 | mkdir -p "$DESTINATION" 15 | 16 | find * -not -name "$(basename ${0})" -type f | while read fn; do 17 | symlink "$SOURCE/$fn" "$DESTINATION/$fn" 18 | done 19 | clear_broken_symlinks "$DESTINATION" 20 | 21 | success "Finished setting up user bin." 22 | -------------------------------------------------------------------------------- /karabiner/setup.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env sh 2 | 3 | DIR=$(dirname "$0") 4 | cd "$DIR" 5 | 6 | . ../scripts/functions.sh 7 | 8 | SOURCE="$(realpath -m .)" 9 | DESTINATION="$(realpath -m ~/.config/karabiner)" 10 | 11 | info "Setting up Karabiner Elements..." 12 | 13 | substep_info "Creating Karabiner Elements folder..." 14 | mkdir -p $DESTINATION 15 | 16 | find * -name "*.json" | while read fn; do 17 | symlink "$SOURCE/$fn" "$DESTINATION/$fn" 18 | done 19 | clear_broken_symlinks "$DESTINATION" 20 | 21 | success "Finished setting up Karabiner Elements." 22 | -------------------------------------------------------------------------------- /vscode/setup.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env sh 2 | 3 | DIR=$(dirname "$0") 4 | cd "$DIR" 5 | 6 | . ../scripts/functions.sh 7 | 8 | SOURCE="$(realpath -m .)" 9 | DESTINATION="$(realpath -m ~/Library/Application\ Support/Code/User)" 10 | 11 | info "Setting up Visual Studio Code..." 12 | 13 | substep_info "Creating Visual Studio Code folders..." 14 | mkdir -p "$DESTINATION" 15 | 16 | find * -not -name "$(basename ${0})" -type f | while read fn; do 17 | symlink "$SOURCE/$fn" "$DESTINATION/$fn" 18 | done 19 | 20 | success "Finished setting up Visual Studio Code" 21 | -------------------------------------------------------------------------------- /repos/personal.list: -------------------------------------------------------------------------------- 1 | git@github.com:rkalis/arkapong.git 2 | git@github.com:rkalis/ayah.today.git 3 | git@github.com:rkalis/ciaokiki.com.git 4 | git@github.com:rkalis/dokkufiles.git 5 | git@github.com:rkalis/dotfiles.git 6 | git@github.com:rkalis/ionic-soundboard.git 7 | git@github.com:rkalis/kindofcabrio.nl.git 8 | git@github.com:rkalis/minesweeper.git 9 | git@github.com:rkalis/roscasper.git 10 | git@github.com:rkalis/salads.git 11 | git@github.com:rkalis/throwback-tetris.git 12 | git@github.com:rkalis/university.git 13 | git@github.com:rkalis/value-investor.git 14 | -------------------------------------------------------------------------------- /duti/setup.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env sh 2 | 3 | DIR=$(dirname "$0") 4 | cd "$DIR" 5 | 6 | COMMENT=\#* 7 | 8 | . ../scripts/functions.sh 9 | 10 | info "Setting default applications using duti..." 11 | 12 | find * -not -name "$(basename ${0})" -type f | while read fn; do 13 | while read ext; do 14 | if [[ $package == $COMMENT ]]; then continue; fi 15 | substep_info "Setting default application for extension $ext to $fn..." 16 | duti -s $fn $ext all 17 | done < $fn 18 | done 19 | 20 | success "Successfully set all default applications." 21 | -------------------------------------------------------------------------------- /hammerspoon/init.lua: -------------------------------------------------------------------------------- 1 | require "hyper" 2 | require "caffeinate" 3 | require "minimising" 4 | require "spectacle" 5 | require "shortcuts" 6 | 7 | ----------------------------------------------- 8 | -- Reload config on write 9 | ----------------------------------------------- 10 | local function reload_config() 11 | hs.reload() 12 | end 13 | 14 | hyper:bind({}, "r", function() 15 | reload_config() 16 | hyper.triggered = true 17 | end) 18 | 19 | hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/", reload_config):start() 20 | hs.alert.show("Config loaded") 21 | -------------------------------------------------------------------------------- /repos/gp.list: -------------------------------------------------------------------------------- 1 | git@gitlab.com:GeneralProtocols/priceoracle/library.git oracle-library 2 | git@gitlab.com:GeneralProtocols/priceoracle/software.git oracle-software 3 | git@gitlab.com:GeneralProtocols/anyhedge/library.git anyhedge-library 4 | git@gitlab.com:GeneralProtocols/anyhedge/contracts.git anyhedge-contracts 5 | git@gitlab.com:GeneralProtocols/anyhedge/settlement-services.git anyhedge-settlement-services 6 | git@gitlab.com:GeneralProtocols/anyhedge/whitelabel/frontend.git anyhedge-whitelabel-frontend 7 | git@gitlab.com:GeneralProtocols/anyhedge/whitelabel/backend.git anyhedge-whitelabel-backend 8 | -------------------------------------------------------------------------------- /hammerspoon/setup.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env sh 2 | 3 | DIR=$(dirname "$0") 4 | cd "$DIR" 5 | 6 | . ../scripts/functions.sh 7 | 8 | SOURCE="$(realpath -m .)" 9 | DESTINATION="$(realpath -m ~/.hammerspoon)" 10 | 11 | info "Setting up Hammerspoon..." 12 | 13 | substep_info "Creating Hammerspoon folder..." 14 | mkdir -p $DESTINATION 15 | 16 | find * -maxdepth 0 -name "*.lua" -o -name "*.applescript" -o -name "*.js" -o -type d | while read fn; do 17 | symlink "$SOURCE/$fn" "$DESTINATION/$fn" 18 | done 19 | clear_broken_symlinks "$DESTINATION" 20 | 21 | success "Finished setting up Hammerspoon." 22 | -------------------------------------------------------------------------------- /fish/functions/abbrex.fish: -------------------------------------------------------------------------------- 1 | function abbrex --description 'Utility for expanding abbreviations' 2 | # Saves all except first arg of expression in args 3 | set argc (count $argv) 4 | if test $argc -gt 1 5 | set args $argv[2..$argc] 6 | end 7 | # Checks if first arg is a known abbreviation 8 | set pattern "abbr -a -U -- $argv[1] " 9 | set abbr (abbr | grep $pattern) 10 | if test $abbr 11 | # Extracts abbreviated expression and replaces it in original expression 12 | set replacement (string replace -a "'" "" (string replace $pattern "" $abbr)) 13 | echo $replacement $args 14 | else 15 | echo $argv 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /repos/ethereum.list: -------------------------------------------------------------------------------- 1 | git@github.com:0xmons/0xmons.git 2 | git@github.com:rkalis/allbastards.com.git 3 | git@github.com:rkalis/cryptotags.git 4 | git@github.com:rkalis/ethroulette.git 5 | git@github.com:rkalis/kalis.art.git 6 | git@github.com:rkalis/liquidefi.git 7 | git@github.com:rkalis/nft-swaps-data.git 8 | git@github.com:rkalis/radical.domains.git 9 | git@github.com:rkalis/revoke.cash.git 10 | git@github.com:0xmons/sudoswap.git 11 | git@github.com:rkalis/symmetries.git 12 | git@github.com:rkalis/symmetries-onchain.git 13 | git@github.com:trufflesuite/truffle.git 14 | git@github.com:rkalis/truffle-assertions.git 15 | git@github.com:rkalis/truffle-plugin-verify.git 16 | git@github.com:trufflesuite/trufflesuite.com.git 17 | -------------------------------------------------------------------------------- /bin/sethidden: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | SCOPE="finder" 4 | ACTION="TRUE" 5 | 6 | while getopts ":gtf" OPTION "$@" ; do 7 | case $OPTION in 8 | g) 9 | SCOPE="global" 10 | ;; 11 | t) 12 | ACTION="TRUE" 13 | ;; 14 | f) 15 | ACTION="FALSE" 16 | ;; 17 | \?) 18 | echo "Usage: ${0##*/} [-g] [-t|-f]" 19 | exit 1 20 | ;; 21 | esac 22 | done 23 | 24 | if [ "$SCOPE" == "global" ]; then 25 | defaults write -g AppleShowAllFiles $ACTION 26 | fi 27 | defaults write com.apple.finder AppleShowAllFiles $ACTION 28 | 29 | echo "Set $SCOPE AppleShowAllFiles to $ACTION" 30 | 31 | killall Finder 32 | -------------------------------------------------------------------------------- /packages/setup.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env sh 2 | 3 | DIR=$(dirname "$0") 4 | cd "$DIR" 5 | 6 | . ../scripts/functions.sh 7 | 8 | COMMENT=\#* 9 | 10 | sudo -v 11 | 12 | info "Installing Brewfile packages..." 13 | brew bundle 14 | success "Finished installing Brewfile packages." 15 | 16 | eval "$(fnm env --use-on-cd)" 17 | fnm use 16 18 | success "Switched to Node v16" 19 | 20 | find * -name "*.list" | while read fn; do 21 | cmd="${fn%.*}" 22 | set -- $cmd 23 | info "Installing $1 packages..." 24 | while read package; do 25 | if [[ $package == $COMMENT ]]; then continue; fi 26 | substep_info "Installing $package..." 27 | $cmd $package 28 | done < "$fn" 29 | success "Finished installing $1 packages." 30 | done 31 | -------------------------------------------------------------------------------- /hammerspoon/hyper.lua: -------------------------------------------------------------------------------- 1 | ----------------------------------------------- 2 | -- Hyper mode 3 | ----------------------------------------------- 4 | 5 | -- A global variable for the Hyper Mode 6 | hyper = hs.hotkey.modal.new({}, "F17") 7 | 8 | -- Enter Hyper Mode when F18 (Hyper/Capslock) is pressed 9 | local function enterHyperMode() 10 | hyper.triggered = false 11 | hyper:enter() 12 | end 13 | 14 | -- Leave Hyper Mode when F18 (Hyper/Capslock) is pressed, 15 | -- send ESCAPE if no other keys are pressed. 16 | local function exitHyperMode() 17 | hyper:exit() 18 | if not hyper.triggered then 19 | hs.eventtap.keyStroke({}, 'ESCAPE') 20 | end 21 | end 22 | 23 | -- Bind the Hyper key 24 | f18 = hs.hotkey.bind({}, 'F18', enterHyperMode, exitHyperMode) 25 | -------------------------------------------------------------------------------- /hammerspoon/README.md: -------------------------------------------------------------------------------- 1 | # Hyper key shortcuts 2 | 3 | ## General 4 | * Hyper + R --> Reload Config 5 | * Hyper + L --> Lock Screen 6 | 7 | ## Window management 8 | * Hyper + F --> Next fullscreen step 9 | * Hyper + ⏎ --> Toggle Full Screen 10 | * Hyper + I --> Show window information 11 | * Hyper + → --> Next right step 12 | * Hyper + ← --> Next left step 13 | * Hyper + ↑ --> Next up step 14 | * Hyper + ↓ --> Next down step 15 | * Hyper + M --> Minimise window 16 | * Hyper + ⌥ + M --> Unminimise last minimised window 17 | 18 | ## Monitor management 19 | * Hyper + ⌘ + → --> Next Monitor 20 | * Hyper + ⌘ + ← --> Previous Monitor 21 | 22 | ## VPN 23 | * Hyper + E --> Toggle Viscosity VPN connection 24 | 25 | ## Bluetooth 26 | * Hyper + B --> Toggle bluetooth 27 | * Hyper + ⌘ + B --> Toggle bluetooth headphone connection 28 | -------------------------------------------------------------------------------- /packages/code --install-extension.list: -------------------------------------------------------------------------------- 1 | 13xforever.language-x86-64-assembly 2 | Angular.ng-template 3 | azemoh.one-monokai 4 | bungcip.better-toml 5 | christian-kohler.path-intellisense 6 | dbaeumer.vscode-eslint 7 | eamodio.gitlens 8 | EditorConfig.EditorConfig 9 | esbenp.prettier-vscode 10 | GraphQL.vscode-graphql 11 | Hyzeta.vscode-theme-github-light 12 | idleberg.applescript 13 | JuanBlanco.solidity 14 | justusadam.language-haskell 15 | letrieu.expand-region 16 | mike-lischke.vscode-antlr4 17 | mikestead.dotenv 18 | ms-azuretools.vscode-docker 19 | ms-python.python 20 | ms-vscode.cpptools 21 | ms-vsliveshare.vsliveshare 22 | NathanielCherian.cashscript 23 | naumovs.color-highlight 24 | octref.vetur 25 | pixelbyte-studios.pixelbyte-love2d 26 | PKief.material-icon-theme 27 | skyapps.fish-vscode 28 | streetsidesoftware.code-spell-checker 29 | sumneko.lua 30 | UCL.haskelly 31 | vincaslt.highlight-matching-tag 32 | -------------------------------------------------------------------------------- /repos/setup.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env sh 2 | 3 | DIR=$(dirname "$0") 4 | cd "$DIR" 5 | 6 | . ../scripts/functions.sh 7 | 8 | COMMENT=\#* 9 | REPO_PATH=$(realpath -m ~/repos) 10 | 11 | find * -name "*.list" | while read fn; do 12 | folder="${fn%.*}" 13 | 14 | info "Cloning $folder repositories..." 15 | 16 | substep_info "Creating $folder folder..." 17 | mkdir -p "$REPO_PATH/$folder" 18 | while read repo; do 19 | if [[ $repo == $COMMENT ]]; 20 | then continue; else 21 | pushd "$REPO_PATH/$folder" &> /dev/null 22 | git clone $repo &> /dev/null 23 | if [[ $? -eq 128 ]]; then 24 | substep_success "$repo already exists." 25 | elif [[ $? -eq 0 ]]; then 26 | substep_success "Cloned $repo." 27 | else 28 | substep_error "Failed to clone $repo." 29 | fi 30 | popd &> /dev/null 31 | fi 32 | done < "$fn" 33 | success "Finished cloning $folder repositories." 34 | done 35 | -------------------------------------------------------------------------------- /bin/togglehidden: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | GLOBAL=false 4 | 5 | while getopts ":gh" OPTION "$@" ; do 6 | case $OPTION in 7 | g) 8 | GLOBAL=true 9 | ;; 10 | h) 11 | echo "Usage: ${0##*/} [-g] [-h]" 12 | exit 0 13 | ;; 14 | \?) 15 | echo "Unknown option: -$OPTARG" 16 | echo "Usage: ${0##*/} [-g] [-h]" 17 | exit 1 18 | ;; 19 | esac 20 | done 21 | 22 | if [ "$GLOBAL" == true ]; then 23 | if [ $(defaults read -g AppleShowAllFiles) = FALSE ]; then 24 | defaults write -g AppleShowAllFiles TRUE 25 | defaults write com.apple.finder AppleShowAllFiles TRUE 26 | else 27 | defaults write -g AppleShowAllFiles FALSE 28 | defaults write com.apple.finder AppleShowAllFiles FALSE 29 | fi 30 | else 31 | if [ $(defaults read com.apple.finder AppleShowAllFiles) = FALSE ]; then 32 | defaults write com.apple.finder AppleShowAllFiles TRUE 33 | else 34 | defaults write com.apple.finder AppleShowAllFiles FALSE 35 | fi 36 | fi 37 | 38 | killall Finder 39 | -------------------------------------------------------------------------------- /fish/config.fish: -------------------------------------------------------------------------------- 1 | set -x -g LS_COLORS "di=38;5;27:fi=38;5;7:ln=38;5;51:pi=40;38;5;11:so=38;5;13:or=38;5;197:mi=38;5;161:ex=38;5;9:" 2 | 3 | set -x -g TERM "xterm-256color" 4 | 5 | set -x -g LC_ALL en_GB.UTF-8 6 | set -x -g LANG en_GB.UTF-8 7 | 8 | # Homebrew paths 9 | set -x -g PATH /usr/local/bin /usr/local/sbin $PATH 10 | set -x -g PATH /opt/homebrew/bin /opt/homebrew/sbin $PATH 11 | 12 | # Coreutils bin and man folders 13 | set -x -g PATH (brew --prefix coreutils)/libexec/gnubin $PATH 14 | # set -x -g MANPATH (brew --prefix coreutils)/libexec/gnuman $MANPATH 15 | 16 | # Findutils bin and man folders 17 | set -x -g PATH (brew --prefix findutils)/libexec/gnubin $PATH 18 | # set -x -g MANPATH (brew --prefix findutils)/libexec/gnuman $MANPATH 19 | 20 | # go bin folder 21 | set -x -g PATH ~/go/bin $PATH 22 | 23 | # User bin folder 24 | set -x -g PATH ~/bin ~/.local/bin $PATH 25 | 26 | # Composer 27 | set -x -g PATH ~/.composer/vendor/bin $PATH 28 | 29 | # fnm 30 | set -x -g PATH /home/rosco/.fnm $PATH 31 | fnm env --use-on-cd | source 32 | 33 | test -e {$HOME}/.iterm2_shell_integration.fish ; and source {$HOME}/.iterm2_shell_integration.fish 34 | 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Rosco Kalis 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /bootstrap.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env sh 2 | 3 | DIR=$(dirname "$0") 4 | cd "$DIR" 5 | 6 | . scripts/functions.sh 7 | 8 | info "Prompting for sudo password..." 9 | if sudo -v; then 10 | # Keep-alive: update existing `sudo` time stamp until `setup.sh` has finished 11 | while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & 12 | success "Sudo credentials updated." 13 | else 14 | error "Failed to obtain sudo credentials." 15 | fi 16 | 17 | info "Installing XCode command line tools..." 18 | if xcode-select --print-path &>/dev/null; then 19 | success "XCode command line tools already installed." 20 | elif xcode-select --install &>/dev/null; then 21 | success "Finished installing XCode command line tools." 22 | else 23 | error "Failed to install XCode command line tools." 24 | fi 25 | 26 | info "Installing Rosetta..." 27 | sudo softwareupdate --install-rosetta 28 | 29 | # Package control must be executed first in order for the rest to work 30 | ./packages/setup.sh 31 | 32 | find * -name "setup.sh" -not -wholename "packages*" | while read setup; do 33 | ./$setup 34 | done 35 | 36 | success "Finished installing Dotfiles" 37 | -------------------------------------------------------------------------------- /git/.gitconfig: -------------------------------------------------------------------------------- 1 | [user] 2 | name = Rosco Kalis 3 | email = roscokalis@gmail.com 4 | [core] 5 | excludesfile = /Users/rosco/.gitignore_global 6 | editor = /usr/bin/vim 7 | ignorecase = false 8 | [difftool "sourcetree"] 9 | cmd = opendiff \"$LOCAL\" \"$REMOTE\" 10 | path = 11 | [mergetool "sourcetree"] 12 | cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\" 13 | trustExitCode = true 14 | [push] 15 | default = current 16 | [alias] 17 | unstage = reset HEAD -- 18 | uncommit = reset --soft HEAD~ 19 | rb = "!f() { \ 20 | echo fetching...; \ 21 | git fetch; \ 22 | if [ $? -eq 0 ]; then \ 23 | last_status=$(git status --untracked-files=no --porcelain); \ 24 | if [ \"$last_status\" != \"\" ]; then \ 25 | echo stashing local changes...; \ 26 | git stash; \ 27 | else \ 28 | echo nothing to stash...; \ 29 | fi;\ 30 | if [ $? -eq 0 ]; then \ 31 | echo rebasing...;\ 32 | git rebase;\ 33 | if [ $? -eq 0 ]; then \ 34 | if [ \"$last_status\" != \"\" ]; then\ 35 | echo applying stashed changes...;\ 36 | git stash pop;\ 37 | if [ $? -ne 0 ]; then \ 38 | echo STASH POP FAIL - you will need to resolve merge conflicts with git mergetool; \ 39 | fi; \ 40 | fi; \ 41 | else \ 42 | echo REBASE FAILED - you will need to manually run stash pop; \ 43 | fi;\ 44 | fi;\ 45 | fi; \ 46 | if [ $? -ne 0 ]; then \ 47 | echo ERROR: Operation failed; \ 48 | fi; \ 49 | }; f" 50 | pull = pull --ff-only 51 | [rerere] 52 | enabled = true 53 | [init] 54 | defaultBranch = main 55 | -------------------------------------------------------------------------------- /fish/functions/fish_greeting.fish: -------------------------------------------------------------------------------- 1 | function fish_greeting 2 | echo ' '(set_color F00)'___ 3 | ___======____='(set_color FF7F00)'-'(set_color FF0)'-'(set_color FF7F00)'-='(set_color F00)') 4 | /T \_'(set_color FF0)'--='(set_color FF7F00)'=='(set_color F00)') 5 | [ \ '(set_color FF7F00)'('(set_color FF0)'0'(set_color FF7F00)') '(set_color F00)'\~ \_'(set_color FF0)'-='(set_color FF7F00)'='(set_color F00)') HERE COME 6 | \ / )J'(set_color FF7F00)'~~ \\'(set_color FF0)'-='(set_color F00)') DAT FISH 7 | \\\\___/ )JJ'(set_color FF7F00)'~'(set_color FF0)'~~ '(set_color F00)'\) 8 | \_____/JJJ'(set_color FF7F00)'~~'(set_color FF0)'~~ '(set_color F00)'\\ 9 | '(set_color FF7F00)'/ '(set_color FF0)'\ '(set_color FF0)', \\'(set_color F00)'J'(set_color FF7F00)'~~~'(set_color FF0)'~~ '(set_color FF7F00)'\\ 10 | (-'(set_color FF0)'\)'(set_color F00)'\='(set_color FF7F00)'|'(set_color FF0)'\\\\\\'(set_color FF7F00)'~~'(set_color FF0)'~~ '(set_color FF7F00)'L_'(set_color FF0)'_ 11 | '(set_color FF7F00)'('(set_color F00)'\\'(set_color FF7F00)'\\) ('(set_color FF0)'\\'(set_color FF7F00)'\\\)'(set_color F00)'_ '(set_color FF0)'\=='(set_color FF7F00)'__ 12 | '(set_color F00)'\V '(set_color FF7F00)'\\\\'(set_color F00)'\) =='(set_color FF7F00)'=_____ '(set_color FF0)'\\\\\\\\'(set_color FF7F00)'\\\\ 13 | '(set_color F00)'\V) \_) '(set_color FF7F00)'\\\\'(set_color FF0)'\\\\JJ\\'(set_color FF7F00)'J\) 14 | O SHIT '(set_color F00)'/'(set_color FF7F00)'J'(set_color FF0)'\\'(set_color FF7F00)'J'(set_color F00)'T\\'(set_color FF7F00)'JJJ'(set_color F00)'J) 15 | WADDUP (J'(set_color FF7F00)'JJ'(set_color F00)'| \UUU) 16 | (UU)'(set_color normal) 17 | end 18 | -------------------------------------------------------------------------------- /fish/setup.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env sh 2 | 3 | DIR=$(dirname "$0") 4 | cd "$DIR" 5 | 6 | . ../scripts/functions.sh 7 | 8 | SOURCE="$(realpath -m .)" 9 | DESTINATION="$(realpath -m ~/.config/fish)" 10 | 11 | info "Setting up fish shell..." 12 | 13 | substep_info "Creating fish config folders..." 14 | mkdir -p "$DESTINATION/functions" 15 | mkdir -p "$DESTINATION/completions" 16 | 17 | find * -name "*.fish" -o -name "fishfile" | while read fn; do 18 | symlink "$SOURCE/$fn" "$DESTINATION/$fn" 19 | done 20 | clear_broken_symlinks "$DESTINATION" 21 | 22 | set_fish_shell() { 23 | if grep --quiet fish <<< "$SHELL"; then 24 | success "Fish shell is already set up." 25 | else 26 | substep_info "Adding fish executable to /etc/shells" 27 | if grep --fixed-strings --line-regexp --quiet "$(which fish)" /etc/shells; then 28 | substep_success "Fish executable already exists in /etc/shells." 29 | else 30 | if sudo bash -c "echo "$(which fish)" >> /etc/shells"; then 31 | substep_success "Fish executable added to /etc/shells." 32 | else 33 | substep_error "Failed adding Fish executable to /etc/shells." 34 | return 1 35 | fi 36 | fi 37 | substep_info "Changing shell to fish" 38 | if chsh -s "$(which fish)"; then 39 | substep_success "Changed shell to fish" 40 | else 41 | substep_error "Failed changing shell to fish" 42 | return 2 43 | fi 44 | substep_info "Running fish initial setup" 45 | fish -c "setup" 46 | fi 47 | } 48 | 49 | if set_fish_shell; then 50 | success "Successfully set up fish shell." 51 | else 52 | error "Failed setting up fish shell." 53 | fi 54 | 55 | -------------------------------------------------------------------------------- /scripts/functions.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env sh 2 | 3 | symlink() { 4 | OVERWRITTEN="" 5 | if [ -e "$2" ] || [ -h "$2" ]; then 6 | OVERWRITTEN="(Overwritten)" 7 | if ! rm -r "$2"; then 8 | substep_error "Failed to remove existing file(s) at $2." 9 | fi 10 | fi 11 | if ln -s "$1" "$2"; then 12 | substep_success "Symlinked $2 to $1. $OVERWRITTEN" 13 | else 14 | substep_error "Symlinking $2 to $1 failed." 15 | fi 16 | } 17 | 18 | clear_broken_symlinks() { 19 | find -L "$1" -type l | while read fn; do 20 | if rm "$fn"; then 21 | substep_success "Removed broken symlink at $fn." 22 | else 23 | substep_error "Failed to remove broken symlink at $fn." 24 | fi 25 | done 26 | } 27 | 28 | # Took these printing functions from https://github.com/Sajjadhosn/dotfiles 29 | coloredEcho() { 30 | local exp="$1"; 31 | local color="$2"; 32 | local arrow="$3"; 33 | if ! [[ $color =~ '^[0-9]$' ]] ; then 34 | case $(echo $color | tr '[:upper:]' '[:lower:]') in 35 | black) color=0 ;; 36 | red) color=1 ;; 37 | green) color=2 ;; 38 | yellow) color=3 ;; 39 | blue) color=4 ;; 40 | magenta) color=5 ;; 41 | cyan) color=6 ;; 42 | white|*) color=7 ;; # white or invalid color 43 | esac 44 | fi 45 | tput bold; 46 | tput setaf "$color"; 47 | echo "$arrow $exp"; 48 | tput sgr0; 49 | } 50 | 51 | info() { 52 | coloredEcho "$1" blue "========>" 53 | } 54 | 55 | success() { 56 | coloredEcho "$1" green "========>" 57 | } 58 | 59 | error() { 60 | coloredEcho "$1" red "========>" 61 | } 62 | 63 | substep_info() { 64 | coloredEcho "$1" magenta "====" 65 | } 66 | 67 | substep_success() { 68 | coloredEcho "$1" cyan "====" 69 | } 70 | 71 | substep_error() { 72 | coloredEcho "$1" red "====" 73 | } 74 | -------------------------------------------------------------------------------- /vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite the default settings 2 | { 3 | "workbench.iconTheme": "material-icon-theme", 4 | "workbench.colorTheme": "One Monokai", 5 | 6 | "editor.rulers": [80, 100, 120], 7 | "editor.roundedSelection": false, 8 | "editor.minimap.enabled": true, 9 | "editor.minimap.renderCharacters": false, 10 | "editor.minimap.maxColumn": 100, 11 | "editor.renderWhitespace": "boundary", 12 | "editor.suggestSelection": "first", 13 | 14 | // Enable bracket pair colorization 15 | "editor.guides.bracketPairs": "active", 16 | "editor.guides.bracketPairsHorizontal": "active", 17 | "editor.guides.highlightActiveIndentation": true, 18 | "editor.bracketPairColorization.enabled": true, 19 | 20 | "files.trimTrailingWhitespace": true, 21 | "files.insertFinalNewline": true, 22 | 23 | "python.linting.pylintEnabled": true, 24 | 25 | "eslint.validate": [ 26 | "javascript", 27 | "javascriptreact", 28 | "typescript", 29 | "typescriptreact", 30 | "vue" 31 | ], 32 | 33 | "[typescript][javascript][typescriptreact][javascriptreact][html][css]": { 34 | "editor.tabSize": 2 35 | }, 36 | "javascript.preferences.quoteStyle": "single", 37 | "typescript.preferences.quoteStyle": "single", 38 | 39 | "Lua.diagnostics.disable": ["undefined-global"], 40 | 41 | "git.autofetch": true, 42 | "typescript.updateImportsOnFileMove.enabled": "always", 43 | "javascript.updateImportsOnFileMove.enabled": "always", 44 | "gitlens.keymap": "alternate", 45 | "workbench.settings.editor": "json", 46 | "workbench.settings.useSplitJSON": true, 47 | "git.confirmSync": false, 48 | 49 | "cSpell.enabled": false, 50 | "diffEditor.ignoreTrimWhitespace": false, 51 | "terminal.integrated.scrollback": 10000, 52 | "emmet.showAbbreviationSuggestions": true, 53 | } 54 | -------------------------------------------------------------------------------- /packages/Brewfile: -------------------------------------------------------------------------------- 1 | tap 'homebrew/cask-versions' 2 | tap 'homebrew/cask-drivers' 3 | tap 'homebrew/services' 4 | tap 'buo/cask-upgrade' 5 | tap 'mongodb/brew' 6 | 7 | cask 'adobe-acrobat-reader' 8 | cask 'adobe-air' 9 | cask 'adoptopenjdk' 10 | cask 'alfred' 11 | cask 'bartender' 12 | cask 'beyond-compare' 13 | cask 'caret' 14 | cask 'daisydisk' 15 | cask 'discord' 16 | cask 'docker' 17 | cask 'electron-cash' 18 | cask 'google-chrome' 19 | cask 'google-drive' 20 | cask 'hammerspoon' 21 | cask 'imageoptim' 22 | cask 'inkscape' 23 | cask 'iterm2' 24 | cask 'karabiner-elements' 25 | cask 'ledger-live' 26 | cask 'logitech-gaming-software' 27 | cask 'love' 28 | cask 'microsoft-office' 29 | cask 'mongodb-compass' 30 | cask 'mysqlworkbench' 31 | cask 'nordvpn' 32 | cask 'paintbrush' 33 | cask 'pgadmin4' 34 | cask 'postman' 35 | cask 'rocket' 36 | cask 'rotki' 37 | cask 'slack' 38 | cask 'sourcetree' 39 | cask 'spotify' 40 | cask 'steam' 41 | cask 'teamspeak-client' 42 | cask 'teamviewer' 43 | cask 'telegram' 44 | cask 'the-unarchiver' 45 | cask 'transmission' 46 | cask 'unity' 47 | cask 'visual-studio-code' 48 | cask 'vlc' 49 | cask 'whatsapp' 50 | cask 'xquartz' 51 | cask 'zoom' 52 | 53 | brew 'act' 54 | brew 'antlr' 55 | brew 'automake' 56 | brew 'brew-cask-completion' 57 | brew 'coreutils' 58 | brew 'deno' 59 | brew 'duti' 60 | brew 'ffmpeg' 61 | brew 'findutils' 62 | brew 'fish' 63 | brew 'fnm' 64 | brew 'gcc' 65 | brew 'gdb' 66 | brew 'gh' 67 | brew 'git' 68 | brew 'glib' 69 | brew 'go' 70 | brew 'gradle' 71 | brew 'imagemagick' 72 | brew 'ipfs' 73 | brew 'libmagic' 74 | brew 'lua' 75 | brew 'luarocks' 76 | brew 'mas' 77 | brew 'maven' 78 | brew 'mongodb-community' 79 | brew 'mysql' 80 | brew 'nginx' 81 | brew 'pipenv' 82 | brew 'postgresql' 83 | brew 'ruby' 84 | brew 'sqlite' 85 | brew 'ssh-copy-id' 86 | brew 'wget' 87 | brew 'youtube-dl' 88 | 89 | mas 'Amphetamine', id: 937984704 90 | mas 'Blackmagic Disk Speed Test', id: 425264550 91 | mas 'HP Easy Scan', id: 967004861 92 | mas 'Shotty', id: 1250306151 93 | mas 'Ulysses | Writing App', id: 1225570693 94 | -------------------------------------------------------------------------------- /bin/imgcat: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # tmux requires unrecognized OSC sequences to be wrapped with DCS tmux; 4 | # ST, and for all ESCs in to be replaced with ESC ESC. It 5 | # only accepts ESC backslash for ST. 6 | function print_osc() { 7 | if [[ $TERM == screen* ]] ; then 8 | printf "\033Ptmux;\033\033]" 9 | else 10 | printf "\033]" 11 | fi 12 | } 13 | 14 | # More of the tmux workaround described above. 15 | function print_st() { 16 | if [[ $TERM == screen* ]] ; then 17 | printf "\a\033\\" 18 | else 19 | printf "\a" 20 | fi 21 | } 22 | 23 | # print_image filename inline base64contents print_filename 24 | # filename: Filename to convey to client 25 | # inline: 0 or 1 26 | # base64contents: Base64-encoded contents 27 | # print_filename: If non-empty, print the filename 28 | # before outputting the image 29 | function print_image() { 30 | print_osc 31 | printf '1337;File=' 32 | if [[ -n "$1" ]]; then 33 | printf 'name='`printf "%s" "$1" | base64`";" 34 | fi 35 | 36 | VERSION=$(base64 --version 2>&1) 37 | if [[ "$VERSION" =~ fourmilab ]]; then 38 | BASE64ARG=-d 39 | elif [[ "$VERSION" =~ GNU ]]; then 40 | BASE64ARG=-di 41 | else 42 | BASE64ARG=-D 43 | fi 44 | 45 | printf "%s" "$3" | base64 $BASE64ARG | wc -c | awk '{printf "size=%d",$1}' 46 | printf ";inline=$2" 47 | printf ":" 48 | printf "%s" "$3" 49 | print_st 50 | printf '\n' 51 | if [[ -n "$4" ]]; then 52 | echo $1 53 | fi 54 | } 55 | 56 | function error() { 57 | echo "ERROR: $*" 1>&2 58 | } 59 | 60 | function show_help() { 61 | echo "Usage: imgcat [-p] filename ..." 1>& 2 62 | echo " or: cat filename | imgcat" 1>& 2 63 | } 64 | 65 | ## Main 66 | 67 | if [ -t 0 ]; then 68 | has_stdin=f 69 | else 70 | has_stdin=t 71 | fi 72 | 73 | # Show help if no arguments and no stdin. 74 | if [ $has_stdin = f -a $# -eq 0 ]; then 75 | show_help 76 | exit 77 | fi 78 | 79 | # Look for command line flags. 80 | while [ $# -gt 0 ]; do 81 | case "$1" in 82 | -h|--h|--help) 83 | show_help 84 | exit 85 | ;; 86 | -p|--p|--print) 87 | print_filename=1 88 | ;; 89 | -*) 90 | error "Unknown option flag: $1" 91 | show_help 92 | exit 1 93 | ;; 94 | *) 95 | if [ -r "$1" ] ; then 96 | has_stdin=f 97 | print_image "$1" 1 "$(base64 < "$1")" "$print_filename" 98 | else 99 | error "imgcat: $1: No such file or directory" 100 | exit 2 101 | fi 102 | ;; 103 | esac 104 | shift 105 | done 106 | 107 | # Read and print stdin 108 | if [ $has_stdin = t ]; then 109 | print_image "" 1 "$(cat | base64)" "" 110 | fi 111 | 112 | exit 0 113 | -------------------------------------------------------------------------------- /fish/functions/fish_prompt.fish: -------------------------------------------------------------------------------- 1 | function fish_prompt --description 'Write out the prompt' 2 | set -l last_status $status 3 | 4 | # Just calculate this once, to save a few cycles when displaying the prompt 5 | if not set -q __fish_prompt_hostname 6 | set -g __fish_prompt_hostname (hostname|cut -d . -f 1) 7 | end 8 | 9 | set -l normal (set_color normal) 10 | 11 | # Hack; fish_config only copies the fish_prompt function (see #736) 12 | if not set -q -g __fish_classic_git_functions_defined 13 | set -g __fish_classic_git_functions_defined 14 | 15 | function __fish_repaint_user --on-variable fish_color_user --description "Event handler, repaint when fish_color_user changes" 16 | if status --is-interactive 17 | commandline -f repaint ^/dev/null 18 | end 19 | end 20 | 21 | function __fish_repaint_host --on-variable fish_color_host --description "Event handler, repaint when fish_color_host changes" 22 | if status --is-interactive 23 | commandline -f repaint ^/dev/null 24 | end 25 | end 26 | 27 | function __fish_repaint_status --on-variable fish_color_status --description "Event handler; repaint when fish_color_status changes" 28 | if status --is-interactive 29 | commandline -f repaint ^/dev/null 30 | end 31 | end 32 | 33 | function __fish_repaint_bind_mode --on-variable fish_key_bindings --description "Event handler; repaint when fish_key_bindings changes" 34 | if status --is-interactive 35 | commandline -f repaint ^/dev/null 36 | end 37 | end 38 | 39 | # initialize our new variables 40 | if not set -q __fish_classic_git_prompt_initialized 41 | set -qU fish_color_user; or set -U fish_color_user -o green 42 | set -qU fish_color_host; or set -U fish_color_host -o cyan 43 | set -qU fish_color_status; or set -U fish_color_status red 44 | set -U __fish_classic_git_prompt_initialized 45 | end 46 | end 47 | 48 | set -l color_cwd 49 | set -l prefix 50 | switch $USER 51 | case root toor 52 | if set -q fish_color_cwd_root 53 | set color_cwd $fish_color_cwd_root 54 | else 55 | set color_cwd $fish_color_cwd 56 | end 57 | set suffix '#' 58 | case '*' 59 | set color_cwd $fish_color_cwd 60 | set suffix '>' 61 | end 62 | 63 | set -l prompt_status 64 | if test $last_status -ne 0 65 | set prompt_status ' ' (set_color $fish_color_status) "[$last_status]" "$normal" 66 | end 67 | 68 | set -l mode_str 69 | switch "$fish_key_bindings" 70 | case '*_vi_*' '*_vi' 71 | # possibly fish_vi_key_bindings, or custom key bindings 72 | # that includes the name "vi" 73 | set mode_str ( 74 | echo -n " " 75 | switch $fish_bind_mode 76 | case default 77 | set_color --bold --background red white 78 | echo -n "[N]" 79 | case insert 80 | set_color --bold green 81 | echo -n "[I]" 82 | case visual 83 | set_color --bold magenta 84 | echo -n "[V]" 85 | end 86 | set_color normal 87 | ) 88 | end 89 | 90 | echo -n -s (set_color $fish_color_user) "$USER" $normal @ (set_color $fish_color_host) "$__fish_prompt_hostname" $normal ' ' (set_color $color_cwd) (prompt_pwd) $normal (__fish_git_prompt) $normal $prompt_status "$mode_str" "> " 91 | end 92 | -------------------------------------------------------------------------------- /git/.gitignore_global: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/osx,windows,intellij,xcode,java 2 | 3 | ### OSX ### 4 | .DS_Store 5 | .AppleDouble 6 | .LSOverride 7 | 8 | # Thumbnails 9 | ._* 10 | 11 | # Files that might appear in the root of a volume 12 | .DocumentRevisions-V100 13 | .fseventsd 14 | .Spotlight-V100 15 | .TemporaryItems 16 | .Trashes 17 | .VolumeIcon.icns 18 | 19 | # Directories potentially created on remote AFP share 20 | .AppleDB 21 | .AppleDesktop 22 | Network Trash Folder 23 | Temporary Items 24 | .apdisk 25 | 26 | 27 | ### Windows ### 28 | # Windows image file caches 29 | Thumbs.db 30 | ehthumbs.db 31 | 32 | # Folder config file 33 | Desktop.ini 34 | 35 | # Recycle Bin used on file shares 36 | $RECYCLE.BIN/ 37 | 38 | # Windows Installer files 39 | *.cab 40 | *.msi 41 | *.msm 42 | *.msp 43 | 44 | # Windows shortcuts 45 | *.lnk 46 | 47 | 48 | ### Intellij ### 49 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio 50 | 51 | *.iml 52 | 53 | ## Directory-based project format: 54 | .idea/ 55 | # if you remove the above rule, at least ignore the following: 56 | 57 | # User-specific stuff: 58 | # .idea/workspace.xml 59 | # .idea/tasks.xml 60 | # .idea/dictionaries 61 | 62 | # Sensitive or high-churn files: 63 | # .idea/dataSources.ids 64 | # .idea/dataSources.xml 65 | # .idea/sqlDataSources.xml 66 | # .idea/dynamic.xml 67 | # .idea/uiDesigner.xml 68 | 69 | # Gradle: 70 | # .idea/gradle.xml 71 | # .idea/libraries 72 | 73 | # Mongo Explorer plugin: 74 | # .idea/mongoSettings.xml 75 | 76 | ## File-based project format: 77 | *.ipr 78 | *.iws 79 | 80 | ## Plugin-specific files: 81 | 82 | # IntelliJ 83 | /out/ 84 | 85 | # mpeltonen/sbt-idea plugin 86 | .idea_modules/ 87 | 88 | # JIRA plugin 89 | atlassian-ide-plugin.xml 90 | 91 | # Crashlytics plugin (for Android Studio and IntelliJ) 92 | com_crashlytics_export_strings.xml 93 | crashlytics.properties 94 | crashlytics-build.properties 95 | 96 | 97 | ### Xcode ### 98 | # Xcode 99 | # 100 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 101 | 102 | ## Build generated 103 | build/ 104 | DerivedData 105 | 106 | ## Various settings 107 | *.pbxuser 108 | !default.pbxuser 109 | *.mode1v3 110 | !default.mode1v3 111 | *.mode2v3 112 | !default.mode2v3 113 | *.perspectivev3 114 | !default.perspectivev3 115 | xcuserdata 116 | 117 | ## Other 118 | *.xccheckout 119 | *.moved-aside 120 | *.xcuserstate 121 | 122 | 123 | ### Java ### 124 | *.class 125 | 126 | # Mobile Tools for Java (J2ME) 127 | .mtj.tmp/ 128 | 129 | # Package Files # 130 | *.jar 131 | *.war 132 | *.ear 133 | 134 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 135 | hs_err_pid* 136 | 137 | ### C ### 138 | 139 | # Prerequisites 140 | *.d 141 | 142 | # Object files 143 | *.o 144 | *.ko 145 | *.obj 146 | *.elf 147 | 148 | # Linker output 149 | *.ilk 150 | *.map 151 | *.exp 152 | 153 | # Precompiled Headers 154 | *.gch 155 | *.pch 156 | 157 | # Libraries 158 | *.lib 159 | *.a 160 | *.la 161 | *.lo 162 | 163 | # Shared objects (inc. Windows DLLs) 164 | *.dll 165 | *.so 166 | *.so.* 167 | *.dylib 168 | 169 | # Executables 170 | *.exe 171 | *.out 172 | *.app 173 | *.i*86 174 | *.x86_64 175 | *.hex 176 | 177 | # Debug files 178 | *.dSYM/ 179 | *.su 180 | *.idb 181 | *.pdb 182 | -------------------------------------------------------------------------------- /karabiner/karabiner.json: -------------------------------------------------------------------------------- 1 | { 2 | "global": { 3 | "check_for_updates_on_startup": true, 4 | "show_in_menu_bar": false, 5 | "show_profile_name_in_menu_bar": false 6 | }, 7 | "profiles": [ 8 | { 9 | "complex_modifications": { 10 | "parameters": { 11 | "basic.to_if_alone_timeout_milliseconds": 1000 12 | }, 13 | "rules": [] 14 | }, 15 | "devices": [], 16 | "fn_function_keys": [ 17 | { 18 | "from": { 19 | "key_code": "f1" 20 | }, 21 | "to": { 22 | "consumer_key_code": "display_brightness_decrement" 23 | } 24 | }, 25 | { 26 | "from": { 27 | "key_code": "f2" 28 | }, 29 | "to": { 30 | "consumer_key_code": "display_brightness_increment" 31 | } 32 | }, 33 | { 34 | "from": { 35 | "key_code": "f3" 36 | }, 37 | "to": { 38 | "key_code": "mission_control" 39 | } 40 | }, 41 | { 42 | "from": { 43 | "key_code": "f4" 44 | }, 45 | "to": { 46 | "key_code": "launchpad" 47 | } 48 | }, 49 | { 50 | "from": { 51 | "key_code": "f5" 52 | }, 53 | "to": { 54 | "key_code": "illumination_decrement" 55 | } 56 | }, 57 | { 58 | "from": { 59 | "key_code": "f6" 60 | }, 61 | "to": { 62 | "key_code": "illumination_increment" 63 | } 64 | }, 65 | { 66 | "from": { 67 | "key_code": "f7" 68 | }, 69 | "to": { 70 | "consumer_key_code": "rewind" 71 | } 72 | }, 73 | { 74 | "from": { 75 | "key_code": "f8" 76 | }, 77 | "to": { 78 | "consumer_key_code": "play_or_pause" 79 | } 80 | }, 81 | { 82 | "from": { 83 | "key_code": "f9" 84 | }, 85 | "to": { 86 | "consumer_key_code": "fastforward" 87 | } 88 | }, 89 | { 90 | "from": { 91 | "key_code": "f10" 92 | }, 93 | "to": { 94 | "consumer_key_code": "mute" 95 | } 96 | }, 97 | { 98 | "from": { 99 | "key_code": "f11" 100 | }, 101 | "to": { 102 | "consumer_key_code": "volume_decrement" 103 | } 104 | }, 105 | { 106 | "from": { 107 | "key_code": "f12" 108 | }, 109 | "to": { 110 | "consumer_key_code": "volume_increment" 111 | } 112 | } 113 | ], 114 | "name": "Default profile", 115 | "selected": true, 116 | "simple_modifications": [ 117 | { 118 | "from": { 119 | "key_code": "caps_lock" 120 | }, 121 | "to": { 122 | "key_code": "f18" 123 | } 124 | } 125 | ], 126 | "virtual_hid_keyboard": { 127 | "caps_lock_delay_milliseconds": 0, 128 | "keyboard_type": "ansi" 129 | } 130 | } 131 | ] 132 | } 133 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dotfiles 2 | 3 | For more information about dotfiles, I wrote these articles on my blog: 4 | * [Dotfiles: automating macOS system configuration](https://kalis.me/dotfiles-automating-macos-system-configuration/) 5 | * [Increasing development productivity with repository management](https://kalis.me/increasing-development-productivity-repository-management/) 6 | * [Set up a Hyper Key with Hammerspoon on macOS](https://kalis.me/setup-hyper-key-hammerspoon-macos/) 7 | 8 | ## Usage 9 | 1. Generate new SSH keys and add them to your GitHub account 10 | 1. Alternatively, restore your safely backed up SSH keys to `~/.ssh/` 11 | 2. Install Homebrew and git 12 | ```bash 13 | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 14 | brew install git 15 | ``` 16 | 3. Clone this repository 17 | ```bash 18 | git clone git@github.com:rkalis/dotfiles.git 19 | ``` 20 | 4. Run the `bootstrap.sh` script 21 | 1. Alternatively, only run the `setup.sh` scripts in specific subfolders if you don't need everything 22 | 5. (Optional) Point your Alfred preference sync to a backed up folder 23 | 6. Login to applications, enter license keys, set preferences 24 | 25 | ## Customisation 26 | I strongly encourage you to play around with the configurations, and add or remove features. 27 | If you would like to use these dotfiles for yourself, I'd recommend changing at least the following: 28 | 29 | #### Git 30 | * The .gitconfig file includes my [user] config, replace these with your own user name and email 31 | 32 | #### OSX 33 | * At the top of the setup.sh file, my computer name is set, replace this with your own computer name 34 | 35 | #### Packages 36 | This folder is a collection of the programs and utilities I use frequently. These lists can easily be amended to your liking. 37 | 38 | #### Repos 39 | This folder is a collection of my own repos, some of which are even private. The existing lists can easily be edited or replaced by custom lists. 40 | 41 | ## Contents 42 | ### Root (/) 43 | * bootstrap.sh - Calls all setup.sh scripts 44 | 45 | ### User Bin (bin/) 46 | * setup.sh - Symlinks the other contents of the folder to `~/bin/` 47 | * imgcat - A utility to display images inline in iTerm 2 48 | * sethidden - A shell script which takes command line arguments to show or hide hidden files 49 | * togglehidden - A shell script that toggles between showing and hiding hidden files 50 | 51 | ### Duti (duti/) 52 | * setup.sh - Sets the defaults set up in the different files 53 | * app.package.id - Contains all extensions for the specified program 54 | 55 | ### Fish (fish/) 56 | * setup.sh - Symlinks all fish files to their corresponding location in `~/.config/fish/` 57 | * config.fish - Global fish configuration (.fishrc) 58 | * fishfile - List of `fisher` plugins 59 | * completions/ 60 | * repo.fish - Contains all repos as completions for the `repo` command 61 | * repodir.fish - Contains all repos as completions for the `repodir` command 62 | * functions/ 63 | * abbrex.fish - Utility for expanding abbreviations in fish-scripts 64 | * clear.fish - Clears the screen and shows fish_greeting 65 | * emptytrash.fish - Empties trash and clears system logs 66 | * fish_greeting.fish - Fish greeting with fish logo 67 | * fish_prompt.fish - The Classic + Git prompt from the fish web config 68 | * fisher.fish - Fish plugin manager 69 | * forrepos.fish - Executes a passed command for all repos in `~/repos` 70 | * ls.fish - Calling ls with parameter --color=auto 71 | * manp.fish - Open a man page in Preview 72 | * mvnpurge.fish - Purge local mvn repository 73 | * pubkey.fish - Copies the SSH public key to the clipboard 74 | * repo.fish - Finds a repository in `~/repos` and jumps to it 75 | * repodir.fish - Finds a repository in `~/repos` and prints its path 76 | * setup.fish - Initial setup for a new fish installation, contains abbreviations 77 | * update.fish - Installs OS X Software Updates, updates Ruby gems, Homebrew, npm, and their installed packages 78 | * week.fish - Returns the current week number 79 | 80 | ### Git (git/) 81 | * setup.sh - Symlinks all git files to `~/` 82 | * .gitignore_global - Contains global gitignores, such as OS-specific files and several compiled files 83 | * .gitconfig - Sets several global Git variables 84 | 85 | ### Hammerspoon (hammerspoon/) 86 | * setup.sh - Symlinks all lua and AppleScript files to `~/.hammerspoon/` 87 | * init.lua - Contains the main Hammerspoon config, importing the others 88 | * bluetooth.lua - Toggles Bluetooth headset connection 89 | * caffeinate.lua - Shortcuts for managing screen state (locking, etc.) 90 | * connect_headphones.applescript - Toggles Bluetooth headset connection 91 | * hyper.lua - Binds the "F18" key to a Hyper mode, which can be used for global commands 92 | * minimising.lua - Shortcuts for minimising and unminimising windows 93 | * shortcuts.lua - Hyper key bindings to existing shortcuts 94 | * spectacle.lua - Window and monitor management using hyper mode 95 | 96 | ### Karabiner (karabiner/) 97 | * setup.sh - Symlinks Karabiner settings to `~/.config/karabiner` 98 | * karabiner.json - Binds the CAPS LOCK key to "F18" to use with hammerspoon 99 | 100 | ### macOS Preferences (macos/) 101 | * setup.sh - Executes a long list of commands pertaining to macOS Preferences 102 | 103 | ### Packages (packages/) 104 | * setup.sh - Installs the contents of the .list files and the Brewfile 105 | 106 | ### Repositories (repos/) 107 | * setup.sh - Clones the repositories in the .list files at the corresponding locations 108 | 109 | ### Helper Scripts (scripts/) 110 | * functions.sh - Contains helper functions for symlinking files and printing progress messages 111 | 112 | ### Vim (vim/) 113 | * setup.sh - Symlinks all vim files to `~/` 114 | * .vimrc - Basic Vim configuration 115 | 116 | ### Visual Studio Code (vscode/) 117 | * setup.sh - Symlinks the settings.json file to `~/Library/Application Support/Code/User` 118 | * settings.json - Contains user settings for Visual Studio Code 119 | -------------------------------------------------------------------------------- /hammerspoon/spectacle.lua: -------------------------------------------------------------------------------- 1 | -- Original Work Copyright (c) 2016 Miro Mannino 2 | -- Modified Work Copyright (c) 2017 Rosco kalis 3 | -- Modifications: 4 | -- - Made original functionality work with Hyper Mode 5 | -- - Added next/previous monitor functionality 6 | -- - Added Fullscreen toggle functionality 7 | 8 | -- Permission is hereby granted, free of charge, to any person obtaining a copy of this 9 | -- software and associated documentation files (the "Software"), to deal in the Software 10 | -- without restriction, including without limitation the rights to use, copy, modify, merge, 11 | -- publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 12 | -- to whom the Software is furnished to do so, subject to the following conditions: 13 | -- 14 | -- The above copyright notice and this permission notice shall be included in all copies 15 | -- or substantial portions of the Software. 16 | -- 17 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 18 | -- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 19 | -- PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 20 | -- FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 21 | -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22 | -- DEALINGS IN THE SOFTWARE. 23 | 24 | hs.window.animationDuration = 0.0 25 | 26 | ----------------------------------------------- 27 | -- Functionality 28 | ----------------------------------------------- 29 | 30 | local sizes = {2, 3, 3/2} 31 | local fullScreenSizes = {1, 4/3, 2} 32 | 33 | local GRID = {w = 24, h = 24} 34 | hs.grid.setGrid(GRID.w .. 'x' .. GRID.h) 35 | hs.grid.MARGINX = 0 36 | hs.grid.MARGINY = 0 37 | 38 | local pressed = { 39 | up = false, 40 | down = false, 41 | left = false, 42 | right = false 43 | } 44 | 45 | function nextStep(dim, offs, cb) 46 | if hs.window.focusedWindow() then 47 | local axis = dim == 'w' and 'x' or 'y' 48 | local oppDim = dim == 'w' and 'h' or 'w' 49 | local oppAxis = dim == 'w' and 'y' or 'x' 50 | local win = hs.window.frontmostWindow() 51 | local id = win:id() 52 | local screen = win:screen() 53 | 54 | cell = hs.grid.get(win, screen) 55 | 56 | local nextSize = sizes[1] 57 | for i=1,#sizes do 58 | if cell[dim] == GRID[dim] / sizes[i] and 59 | (cell[axis] + (offs and cell[dim] or 0)) == (offs and GRID[dim] or 0) 60 | then 61 | nextSize = sizes[(i % #sizes) + 1] 62 | break 63 | end 64 | end 65 | 66 | cb(cell, nextSize) 67 | if cell[oppAxis] ~= 0 and cell[oppAxis] + cell[oppDim] ~= GRID[oppDim] then 68 | cell[oppDim] = GRID[oppDim] 69 | cell[oppAxis] = 0 70 | end 71 | 72 | hs.grid.set(win, cell, screen) 73 | end 74 | end 75 | 76 | function nextFullScreenStep() 77 | if hs.window.focusedWindow() then 78 | local win = hs.window.frontmostWindow() 79 | local id = win:id() 80 | local screen = win:screen() 81 | 82 | cell = hs.grid.get(win, screen) 83 | 84 | local nextSize = fullScreenSizes[1] 85 | for i=1,#fullScreenSizes do 86 | if cell.w == GRID.w / fullScreenSizes[i] and 87 | cell.h == GRID.h / fullScreenSizes[i] and 88 | cell.x == (GRID.w - GRID.w / fullScreenSizes[i]) / 2 and 89 | cell.y == (GRID.h - GRID.h / fullScreenSizes[i]) / 2 then 90 | nextSize = fullScreenSizes[(i % #fullScreenSizes) + 1] 91 | break 92 | end 93 | end 94 | 95 | cell.w = GRID.w / nextSize 96 | cell.h = GRID.h / nextSize 97 | cell.x = (GRID.w - GRID.w / nextSize) / 2 98 | cell.y = (GRID.h - GRID.h / nextSize) / 2 99 | 100 | hs.grid.set(win, cell, screen) 101 | end 102 | end 103 | 104 | function fullDimension(dim) 105 | if hs.window.focusedWindow() then 106 | local win = hs.window.frontmostWindow() 107 | local id = win:id() 108 | local screen = win:screen() 109 | cell = hs.grid.get(win, screen) 110 | 111 | if (dim == 'x') then 112 | cell = '0,0 ' .. GRID.w .. 'x' .. GRID.h 113 | else 114 | cell[dim] = GRID[dim] 115 | cell[dim == 'w' and 'x' or 'y'] = 0 116 | end 117 | 118 | hs.grid.set(win, cell, screen) 119 | end 120 | end 121 | 122 | function prevMonitor() 123 | local win = hs.window.focusedWindow() 124 | local nextScreen = win:screen():previous() 125 | win:moveToScreen(nextScreen) 126 | end 127 | 128 | function nextMonitor() 129 | local win = hs.window.focusedWindow() 130 | local nextScreen = win:screen():next() 131 | win:moveToScreen(nextScreen) 132 | end 133 | 134 | ----------------------------------------------- 135 | -- Shortcut bindings 136 | ----------------------------------------------- 137 | 138 | hyper:bind({}, "down", function() 139 | pressed.down = true 140 | if pressed.up then 141 | fullDimension('h') 142 | else 143 | nextStep('h', true, function(cell, nextSize) 144 | cell.y = GRID.h - GRID.h / nextSize 145 | cell.h = GRID.h / nextSize 146 | end) 147 | end 148 | hyper.triggered = true 149 | end, function() 150 | pressed.down = false 151 | end) 152 | 153 | hyper:bind({}, "right", function() 154 | pressed.right = true 155 | if pressed.left then 156 | fullDimension('w') 157 | else 158 | nextStep('w', true, function(cell, nextSize) 159 | cell.x = GRID.w - GRID.w / nextSize 160 | cell.w = GRID.w / nextSize 161 | end) 162 | end 163 | hyper.triggered = true 164 | end, function() 165 | pressed.right = false 166 | end) 167 | 168 | hyper:bind({}, "left", function() 169 | pressed.left = true 170 | if pressed.right then 171 | fullDimension('w') 172 | else 173 | nextStep('w', false, function(cell, nextSize) 174 | cell.x = 0 175 | cell.w = GRID.w / nextSize 176 | end) 177 | end 178 | hyper.triggered = true 179 | end, function() 180 | pressed.left = false 181 | end) 182 | 183 | hyper:bind({}, "up", function() 184 | pressed.up = true 185 | if pressed.down then 186 | fullDimension('h') 187 | else 188 | nextStep('h', false, function(cell, nextSize) 189 | cell.y = 0 190 | cell.h = GRID.h / nextSize 191 | end) 192 | end 193 | hyper.triggered = true 194 | end, function () 195 | pressed.up = false 196 | end) 197 | 198 | hyper:bind({}, "f", function() 199 | nextFullScreenStep() 200 | hyper.triggered = true 201 | end) 202 | 203 | hyper:bind({"cmd"}, "left", function() 204 | prevMonitor() 205 | hyper.triggered = true 206 | end) 207 | 208 | hyper:bind({"cmd"}, "right", function() 209 | nextMonitor() 210 | hyper.triggered = true 211 | end) 212 | 213 | hyper:bind({}, "return", function() 214 | local win = hs.window.frontmostWindow() 215 | win:setFullscreen(not win:isFullscreen()) 216 | hyper.triggered = true 217 | end) 218 | 219 | -------------------------------------------------------------------------------- /vim/.vimrc: -------------------------------------------------------------------------------- 1 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 2 | " Maintainer: 3 | " Amir Salihefendic 4 | " http://amix.dk - amix@amix.dk 5 | " 6 | " Version: 7 | " 5.0 - 29/05/12 15:43:36 8 | " 9 | " Blog_post: 10 | " http://amix.dk/blog/post/19691#The-ultimate-Vim-configuration-on-Github 11 | " 12 | " Awesome_version: 13 | " Get this config, nice color schemes and lots of plugins! 14 | " 15 | " Install the awesome version from: 16 | " 17 | " https://github.com/amix/vimrc 18 | " 19 | " Syntax_highlighted: 20 | " http://amix.dk/vim/vimrc.html 21 | " 22 | " Raw_version: 23 | " http://amix.dk/vim/vimrc.txt 24 | " 25 | " Sections: 26 | " -> General 27 | " -> VIM user interface 28 | " -> Colors and Fonts 29 | " -> Files and backups 30 | " -> Text, tab and indent related 31 | " -> Visual mode related 32 | " -> Moving around, tabs and buffers 33 | " -> Status line 34 | " -> Editing mappings 35 | " -> vimgrep searching and cope displaying 36 | " -> Spell checking 37 | " -> Misc 38 | " -> Helper functions 39 | " 40 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 41 | 42 | 43 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 44 | " => General 45 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 46 | " Sets how many lines of history VIM has to remember 47 | set history=500 48 | 49 | " Enable filetype plugins 50 | filetype plugin on 51 | filetype indent on 52 | 53 | " Set to auto read when a file is changed from the outside 54 | set autoread 55 | 56 | " Disable modeline as a security precaution 57 | set modelines=0 58 | set nomodeline 59 | 60 | " With a map leader it's possible to do extra key combinations 61 | " like w saves the current file 62 | let mapleader = "," 63 | let g:mapleader = "," 64 | 65 | " Fast saving 66 | nmap w :w! 67 | 68 | " :W sudo saves the file 69 | " (useful for handling the permission-denied error) 70 | command W w !sudo tee % > /dev/null 71 | 72 | 73 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 74 | " => VIM user interface 75 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 76 | " Set 7 lines to the cursor - when moving vertically using j/k 77 | set so=7 78 | 79 | " Avoid garbled characters in Chinese language windows OS 80 | let $LANG='en' 81 | set langmenu=en 82 | source $VIMRUNTIME/delmenu.vim 83 | source $VIMRUNTIME/menu.vim 84 | 85 | " Turn on the WiLd menu 86 | set wildmenu 87 | 88 | " Ignore compiled files 89 | set wildignore=*.o,*~,*.pyc 90 | if has("win16") || has("win32") 91 | set wildignore+=.git\*,.hg\*,.svn\* 92 | else 93 | set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store 94 | endif 95 | 96 | "Always show current position 97 | set ruler 98 | 99 | " Height of the command bar 100 | set cmdheight=2 101 | 102 | " A buffer becomes hidden when it is abandoned 103 | set hid 104 | 105 | " Configure backspace so it acts as it should act 106 | set backspace=eol,start,indent 107 | set whichwrap+=<,>,h,l 108 | 109 | " Ignore case when searching 110 | set ignorecase 111 | 112 | " When searching try to be smart about cases 113 | set smartcase 114 | 115 | " Highlight search results 116 | set hlsearch 117 | 118 | " Makes search act like search in modern browsers 119 | set incsearch 120 | 121 | " Don't redraw while executing macros (good performance config) 122 | set lazyredraw 123 | 124 | " For regular expressions turn magic on 125 | set magic 126 | 127 | " Show matching brackets when text indicator is over them 128 | set showmatch 129 | " How many tenths of a second to blink when matching brackets 130 | set mat=2 131 | 132 | " No annoying sound on errors 133 | set noerrorbells 134 | set novisualbell 135 | set t_vb= 136 | set tm=500 137 | 138 | " Add a bit extra margin to the left 139 | set foldcolumn=1 140 | 141 | 142 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 143 | " => Colors and Fonts 144 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 145 | " Enable syntax highlighting 146 | syntax enable 147 | 148 | try 149 | colorscheme desert 150 | catch 151 | endtry 152 | 153 | set background=dark 154 | 155 | " Set extra options when running in GUI mode 156 | if has("gui_running") 157 | set guioptions-=T 158 | set guioptions-=e 159 | set t_Co=256 160 | set guitablabel=%M\ %t 161 | endif 162 | 163 | " Set utf8 as standard encoding and en_US as the standard language 164 | set encoding=utf8 165 | 166 | " Use Unix as the standard file type 167 | set ffs=unix,dos,mac 168 | 169 | 170 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 171 | " => Files, backups and undo 172 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 173 | " Turn backup off, since most stuff is in SVN, git et.c anyway... 174 | set nobackup 175 | set nowb 176 | set noswapfile 177 | 178 | 179 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 180 | " => Text, tab and indent related 181 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 182 | " Use spaces instead of tabs 183 | set expandtab 184 | 185 | " Be smart when using tabs ;) 186 | set smarttab 187 | 188 | " 1 tab == 4 spaces 189 | set shiftwidth=4 190 | set tabstop=4 191 | 192 | " Linebreak on 500 characters 193 | set lbr 194 | set tw=500 195 | 196 | set ai "Auto indent 197 | set si "Smart indent 198 | set wrap "Wrap lines 199 | 200 | 201 | """""""""""""""""""""""""""""" 202 | " => Visual mode related 203 | """""""""""""""""""""""""""""" 204 | " Visual mode pressing * or # searches for the current selection 205 | " Super useful! From an idea by Michael Naumann 206 | vnoremap * :call VisualSelection('', '')/=@/ 207 | vnoremap # :call VisualSelection('', '')?=@/ 208 | 209 | 210 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 211 | " => Moving around, tabs, windows and buffers 212 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 213 | " Map to / (search) and Ctrl- to ? (backwards search) 214 | map / 215 | map ? 216 | 217 | " Disable highlight when is pressed 218 | map :noh 219 | 220 | " Smart way to move between windows 221 | map j 222 | map k 223 | map h 224 | map l 225 | 226 | " Close the current buffer 227 | map bd :Bclose:tabclosegT 228 | 229 | " Close all the buffers 230 | map ba :bufdo bd 231 | 232 | map l :bnext 233 | map h :bprevious 234 | 235 | " Useful mappings for managing tabs 236 | map tn :tabnew 237 | map to :tabonly 238 | map tc :tabclose 239 | map tm :tabmove 240 | map t :tabnext 241 | 242 | " Let 'tl' toggle between this and the last accessed tab 243 | let g:lasttab = 1 244 | nmap tl :exe "tabn ".g:lasttab 245 | au TabLeave * let g:lasttab = tabpagenr() 246 | 247 | 248 | " Opens a new tab with the current buffer's path 249 | " Super useful when editing files in the same directory 250 | map te :tabedit =expand("%:p:h")/ 251 | 252 | " Switch CWD to the directory of the open buffer 253 | map cd :cd %:p:h:pwd 254 | 255 | " Specify the behavior when switching between buffers 256 | try 257 | set switchbuf=useopen,usetab,newtab 258 | set stal=2 259 | catch 260 | endtry 261 | 262 | " Return to last edit position when opening files (You want this!) 263 | au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif 264 | 265 | 266 | """""""""""""""""""""""""""""" 267 | " => Status line 268 | """""""""""""""""""""""""""""" 269 | " Always show the status line 270 | set laststatus=2 271 | 272 | " Format the status line 273 | set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l\ \ Column:\ %c 274 | 275 | 276 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 277 | " => Editing mappings 278 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 279 | " Remap VIM 0 to first non-blank character 280 | map 0 ^ 281 | 282 | " Move a line of text using ALT+[jk] or Command+[jk] on mac 283 | nmap mz:m+`z 284 | nmap mz:m-2`z 285 | vmap :m'>+`mzgv`yo`z 286 | vmap :m'<-2`>my` 290 | nmap 291 | vmap 292 | vmap 293 | endif 294 | 295 | " Delete trailing white space on save, useful for Python and CoffeeScript ;) 296 | func! DeleteTrailingWS() 297 | exe "normal mz" 298 | %s/\s\+$//ge 299 | exe "normal `z" 300 | endfunc 301 | autocmd BufWrite *.py :call DeleteTrailingWS() 302 | autocmd BufWrite *.coffee :call DeleteTrailingWS() 303 | 304 | 305 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 306 | " => Ag searching and cope displaying 307 | " requires ag.vim - it's much better than vimgrep/grep 308 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 309 | " When you press gv you Ag after the selected text 310 | vnoremap gv :call VisualSelection('gv', '') 311 | 312 | " Open Ag and put the cursor in the right position 313 | map g :Ag 314 | 315 | " When you press r you can search and replace the selected text 316 | vnoremap r :call VisualSelection('replace', '') 317 | 318 | " Do :help cope if you are unsure what cope is. It's super useful! 319 | " 320 | " When you search with Ag, display your results in cope by doing: 321 | " cc 322 | " 323 | " To go to the next search result do: 324 | " n 325 | " 326 | " To go to the previous search results do: 327 | " p 328 | " 329 | map cc :botright cope 330 | map co ggVGy:tabnew:set syntax=qfpgg 331 | map n :cn 332 | map p :cp 333 | 334 | 335 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 336 | " => Spell checking 337 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 338 | " Pressing ,ss will toggle and untoggle spell checking 339 | map ss :setlocal spell! 340 | 341 | " Shortcuts using 342 | map sn ]s 343 | map sp [s 344 | map sa zg 345 | map s? z= 346 | 347 | 348 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 349 | " => Misc 350 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 351 | " Remove the Windows ^M - when the encodings gets messed up 352 | noremap m mmHmt:%s///ge'tzt'm 353 | 354 | " Quickly open a buffer for scribble 355 | map q :e ~/buffer 356 | 357 | " Quickly open a markdown buffer for scribble 358 | map x :e ~/buffer.md 359 | 360 | " Toggle paste mode on and off 361 | map pp :setlocal paste! 362 | 363 | 364 | 365 | 366 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 367 | " => Helper functions 368 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 369 | function! CmdLine(str) 370 | exe "menu Foo.Bar :" . a:str 371 | emenu Foo.Bar 372 | unmenu Foo 373 | endfunction 374 | 375 | function! VisualSelection(direction, extra_filter) range 376 | let l:saved_reg = @" 377 | execute "normal! vgvy" 378 | 379 | let l:pattern = escape(@", '\\/.*$^~[]') 380 | let l:pattern = substitute(l:pattern, "\n$", "", "") 381 | 382 | if a:direction == 'gv' 383 | call CmdLine("Ag \"" . l:pattern . "\" " ) 384 | elseif a:direction == 'replace' 385 | call CmdLine("%s" . '/'. l:pattern . '/') 386 | endif 387 | 388 | let @/ = l:pattern 389 | let @" = l:saved_reg 390 | endfunction 391 | 392 | 393 | " Returns true if paste mode is enabled 394 | function! HasPaste() 395 | if &paste 396 | return 'PASTE MODE ' 397 | endif 398 | return '' 399 | endfunction 400 | 401 | " Don't close window, when deleting a buffer 402 | command! Bclose call BufcloseCloseIt() 403 | function! BufcloseCloseIt() 404 | let l:currentBufNum = bufnr("%") 405 | let l:alternateBufNum = bufnr("#") 406 | 407 | if buflisted(l:alternateBufNum) 408 | buffer # 409 | else 410 | bnext 411 | endif 412 | 413 | if bufnr("%") == l:currentBufNum 414 | new 415 | endif 416 | 417 | if buflisted(l:currentBufNum) 418 | execute("bdelete! ".l:currentBufNum) 419 | endif 420 | endfunction 421 | 422 | " Make VIM remember position in file after reopen 423 | " if has("autocmd") 424 | " au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif 425 | "endif 426 | -------------------------------------------------------------------------------- /fish/functions/fisher.fish: -------------------------------------------------------------------------------- 1 | set -g fisher_version 3.2.11 2 | 3 | function fisher -a cmd -d "fish package manager" 4 | set -q XDG_CACHE_HOME; or set XDG_CACHE_HOME ~/.cache 5 | set -q XDG_CONFIG_HOME; or set XDG_CONFIG_HOME ~/.config 6 | 7 | set -g fish_config $XDG_CONFIG_HOME/fish 8 | set -g fisher_cache $XDG_CACHE_HOME/fisher 9 | set -g fisher_config $XDG_CONFIG_HOME/fisher 10 | 11 | set -q fisher_path; or set -g fisher_path $fish_config 12 | set -g fishfile $fish_config/fishfile 13 | 14 | for path in {$fish_config,$fisher_path}/{functions,completions,conf.d} $fisher_cache 15 | if test ! -d $path 16 | command mkdir -p $path 17 | end 18 | end 19 | 20 | if test ! -e $fisher_path/completions/fisher.fish 21 | echo "fisher complete" >$fisher_path/completions/fisher.fish 22 | _fisher_complete 23 | end 24 | 25 | if test -e $fisher_path/conf.d/fisher.fish 26 | switch "$version" 27 | case \*-\* 28 | command rm -f $fisher_path/conf.d/fisher.fish 29 | case 2\* 30 | case \* 31 | command rm -f $fisher_path/conf.d/fisher.fish 32 | end 33 | else 34 | switch "$version" 35 | case \*-\* 36 | case 2\* 37 | echo "fisher copy-user-key-bindings" >$fisher_path/conf.d/fisher.fish 38 | end 39 | end 40 | 41 | # 2019-10-22: temp code, migrates fishfile from old path back to $fish_config 42 | if test -e "$fisher_path/fishfile"; and test ! -e "$fishfile" 43 | command mv -f "$fisher_path/fishfile" "$fishfile" 44 | end 45 | 46 | switch "$cmd" 47 | case {,self-}complete 48 | _fisher_complete 49 | case copy-user-key-bindings 50 | _fisher_copy_user_key_bindings 51 | case ls 52 | set -e argv[1] 53 | if test -s "$fishfile" 54 | set -l file (_fisher_fmt <$fishfile | _fisher_parse -R | command sed "s|@.*||") 55 | _fisher_ls | _fisher_fmt | command awk -v FILE="$file" " 56 | BEGIN { for (n = split(FILE, f); ++i <= n;) file[f[i]] } \$0 in file && /$argv[1]/ 57 | " | command sed "s|^$HOME|~|" 58 | end 59 | case self-update 60 | _fisher_self_update (status -f) 61 | case self-uninstall 62 | _fisher_self_uninstall 63 | case {,-}-v{ersion,} 64 | echo "fisher version $fisher_version" (status -f | command sed "s|^$HOME|~|") 65 | case {,-}-h{elp,} 66 | _fisher_help 67 | case "" 68 | _fisher_commit -- 69 | case add rm 70 | if not isatty 71 | while read -l arg 72 | set argv $argv $arg 73 | end 74 | end 75 | 76 | if test (count $argv) = 1 77 | echo "fisher: invalid number of arguments" >&2 78 | _fisher_help >&2 79 | return 1 80 | end 81 | 82 | _fisher_commit $argv 83 | case \* 84 | echo "fisher: unknown flag or command \"$cmd\"" >&2 85 | _fisher_help >&2 86 | return 1 87 | end 88 | end 89 | 90 | function _fisher_complete 91 | complete -ec fisher 92 | complete -xc fisher -n __fish_use_subcommand -a add -d "Add packages" 93 | complete -xc fisher -n __fish_use_subcommand -a rm -d "Remove packages" 94 | complete -xc fisher -n __fish_use_subcommand -a ls -d "List installed packages matching REGEX" 95 | complete -xc fisher -n __fish_use_subcommand -a --help -d "Show usage help" 96 | complete -xc fisher -n __fish_use_subcommand -a --version -d "$fisher_version" 97 | complete -xc fisher -n __fish_use_subcommand -a self-update -d "Update to the latest version" 98 | for pkg in (fisher ls) 99 | complete -xc fisher -n "__fish_seen_subcommand_from rm" -a $pkg 100 | end 101 | end 102 | 103 | function _fisher_copy_user_key_bindings 104 | if functions -q fish_user_key_bindings 105 | functions -c fish_user_key_bindings fish_user_key_bindings_copy 106 | end 107 | function fish_user_key_bindings 108 | for file in $fisher_path/conf.d/*_key_bindings.fish 109 | source $file >/dev/null 2>/dev/null 110 | end 111 | if functions -q fish_user_key_bindings_copy 112 | fish_user_key_bindings_copy 113 | end 114 | end 115 | end 116 | 117 | function _fisher_ls 118 | for pkg in $fisher_config/*/*/* 119 | command readlink $pkg; or echo $pkg 120 | end 121 | end 122 | 123 | function _fisher_fmt 124 | command sed "s|^[[:space:]]*||;s|^$fisher_config/||;s|^~|$HOME|;s|^\.\/*|$PWD/|;s|^https*:/*||;s|^github\.com/||;s|/*\$||" 125 | end 126 | 127 | function _fisher_help 128 | echo "usage: fisher add Add packages" 129 | echo " fisher rm Remove packages" 130 | echo " fisher Update all packages" 131 | echo " fisher ls [] List installed packages matching " 132 | echo " fisher --help Show this help" 133 | echo " fisher --version Show the current version" 134 | echo " fisher self-update Update to the latest version" 135 | echo " fisher self-uninstall Uninstall from your system" 136 | echo "examples:" 137 | echo " fisher add jethrokuan/z rafaelrinaldi/pure" 138 | echo " fisher add gitlab.com/foo/bar@v2" 139 | echo " fisher add ~/path/to/local/pkg" 140 | echo " fisher add &2 149 | command curl -s "$url?nocache" >$file. 150 | 151 | set -l next_version (command awk '{ print $4 } { exit }' <$file.) 152 | switch "$next_version" 153 | case "" $fisher_version 154 | command rm -f $file. 155 | if test -z "$next_version" 156 | echo "fisher: cannot update fisher -- are you offline?" >&2 157 | return 1 158 | end 159 | echo "fisher is already up-to-date" >&2 160 | case \* 161 | echo "linking $file" | command sed "s|$HOME|~|" >&2 162 | command mv -f $file. $file 163 | source $file 164 | echo "updated to fisher $fisher_version -- hooray!" >&2 165 | _fisher_complete 166 | end 167 | end 168 | 169 | function _fisher_self_uninstall 170 | for pkg in (_fisher_ls) 171 | _fisher_rm $pkg 172 | end 173 | 174 | for file in $fisher_cache $fisher_config $fisher_path/{functions,completions,conf.d}/fisher.fish $fishfile 175 | echo "removing $file" 176 | command rm -Rf $file 2>/dev/null 177 | end | command sed "s|$HOME|~|" >&2 178 | 179 | for name in (set -n | command awk '/^fisher_/') 180 | set -e "$name" 181 | end 182 | 183 | functions -e (functions -a | command awk '/^_fisher/') fisher 184 | complete -c fisher --erase 185 | end 186 | 187 | function _fisher_commit -a cmd 188 | set -e argv[1] 189 | set -l elapsed (_fisher_now) 190 | 191 | if test ! -e "$fishfile" 192 | command touch $fishfile 193 | echo "created new fishfile in $fishfile" | command sed "s|$HOME|~|" >&2 194 | end 195 | 196 | set -l old_pkgs (_fisher_ls | _fisher_fmt) 197 | for pkg in (_fisher_ls) 198 | _fisher_rm $pkg 199 | end 200 | command rm -Rf $fisher_config 201 | command mkdir -p $fisher_config 202 | 203 | set -l next_pkgs (_fisher_fmt <$fishfile | _fisher_parse -R $cmd (printf "%s\n" $argv | _fisher_fmt)) 204 | set -l actual_pkgs (_fisher_fetch $next_pkgs) 205 | set -l updated_pkgs 206 | for pkg in $old_pkgs 207 | if contains -- $pkg $actual_pkgs 208 | set updated_pkgs $updated_pkgs $pkg 209 | end 210 | end 211 | 212 | if test -z "$actual_pkgs$updated_pkgs$old_pkgs$next_pkgs" 213 | echo "fisher: nothing to commit -- try adding some packages" >&2 214 | return 1 215 | end 216 | 217 | set -l out_pkgs 218 | if test "$cmd" = "rm" 219 | set out_pkgs $next_pkgs 220 | else 221 | for pkg in $next_pkgs 222 | if contains -- (echo $pkg | command sed "s|@.*||") $actual_pkgs 223 | set out_pkgs $out_pkgs $pkg 224 | end 225 | end 226 | end 227 | 228 | printf "%s\n" (_fisher_fmt <$fishfile | _fisher_parse -W $cmd $out_pkgs | command sed "s|^$HOME|~|") >$fishfile 229 | 230 | _fisher_complete 231 | 232 | command awk -v A=(count $actual_pkgs) -v U=(count $updated_pkgs) -v O=(count $old_pkgs) -v E=(_fisher_now $elapsed) ' 233 | BEGIN { 234 | res = fmt("removed", O - U, fmt("updated", U, fmt("added", A - U))) 235 | printf((res ? res : "done") " in %.2fs\n", E / 1000) 236 | } 237 | function fmt(action, n, s) { 238 | return n ? (s ? s ", " : s) action " " n " package" (n > 1 ? "s" : "") : s 239 | } 240 | ' >&2 241 | end 242 | 243 | function _fisher_parse -a mode cmd 244 | set -e argv[1..2] 245 | command awk -v FS="[[:space:]]*#+" -v MODE="$mode" -v CMD="$cmd" -v ARGSTR="$argv" ' 246 | BEGIN { 247 | for (n = split(ARGSTR, a, " "); i++ < n;) pkgs[getkey(a[i])] = a[i] 248 | } 249 | !NF { next } { k = getkey($1) } 250 | MODE == "-R" && !(k in pkgs) && ($0 = $1) 251 | MODE == "-W" && (/^#/ || k in pkgs || CMD != "rm") { print pkgs[k] (sub($1, "") ? $0 : "") } 252 | MODE == "-W" || CMD == "rm" { delete pkgs[k] } 253 | END { 254 | for (k in pkgs) { 255 | if (CMD != "rm" || MODE == "-W") print pkgs[k] 256 | else print "fisher: cannot remove \""k"\" -- package is not in fishfile" > "/dev/stderr" 257 | } 258 | } 259 | function getkey(s, a) { 260 | return (split(s, a, /@+|:/) > 2) ? a[2]"/"a[1]"/"a[3] : a[1] 261 | } 262 | ' 263 | end 264 | 265 | function _fisher_fetch 266 | set -l pkg_jobs 267 | set -l out_pkgs 268 | set -l next_pkgs 269 | set -l local_pkgs 270 | set -q fisher_user_api_token; and set -l curl_opts -u $fisher_user_api_token 271 | 272 | for pkg in $argv 273 | switch $pkg 274 | case \~\* /\* 275 | set -l path (echo "$pkg" | command sed "s|^~|$HOME|") 276 | if test -e "$path" 277 | set local_pkgs $local_pkgs $path 278 | else 279 | echo "fisher: cannot add \"$pkg\" -- is this a valid file?" >&2 280 | end 281 | continue 282 | end 283 | 284 | command awk -v PKG="$pkg" -v FS=/ ' 285 | BEGIN { 286 | if (split(PKG, tmp, /@+|:/) > 2) { 287 | if (tmp[4]) sub("@"tmp[4], "", PKG) 288 | print PKG "\t" tmp[2]"/"tmp[1]"/"tmp[3] "\t" (tmp[4] ? tmp[4] : "master") 289 | } else { 290 | pkg = split(PKG, _, "/") <= 2 ? "github.com/"tmp[1] : tmp[1] 291 | tag = tmp[2] ? tmp[2] : "master" 292 | print (\ 293 | pkg ~ /^github/ ? "https://codeload."pkg"/tar.gz/"tag : \ 294 | pkg ~ /^gitlab/ ? "https://"pkg"/-/archive/"tag"/"tmp[split(pkg, tmp, "/")]"-"tag".tar.gz" : \ 295 | pkg ~ /^bitbucket/ ? "https://"pkg"/get/"tag".tar.gz" : pkg \ 296 | ) "\t" pkg 297 | } 298 | } 299 | ' | read -l url pkg branch 300 | 301 | if test ! -d "$fisher_config/$pkg" 302 | fish -c " 303 | echo fetching $url >&2 304 | command mkdir -p $fisher_config/$pkg $fisher_cache/(command dirname $pkg) 305 | if test ! -z \"$branch\" 306 | command git clone $url $fisher_config/$pkg --branch $branch --depth 1 2>/dev/null 307 | or echo fisher: cannot clone \"$url\" -- is this a valid url\? >&2 308 | else if command curl $curl_opts -Ss -w \"\" $url 2>&1 | command tar -xzf- -C $fisher_config/$pkg 2>/dev/null 309 | command rm -Rf $fisher_cache/$pkg 310 | command mv -f $fisher_config/$pkg/* $fisher_cache/$pkg 311 | command rm -Rf $fisher_config/$pkg 312 | command cp -Rf {$fisher_cache,$fisher_config}/$pkg 313 | else if test -d \"$fisher_cache/$pkg\" 314 | echo fisher: cannot connect to server -- looking in \"$fisher_cache/$pkg\" | command sed 's|$HOME|~|' >&2 315 | command cp -Rf $fisher_cache/$pkg $fisher_config/$pkg/.. 316 | else 317 | command rm -Rf $fisher_config/$pkg 318 | echo fisher: cannot add \"$pkg\" -- is this a valid package\? >&2 319 | end 320 | " >/dev/null & 321 | set pkg_jobs $pkg_jobs (_fisher_jobs --last) 322 | set next_pkgs $next_pkgs "$fisher_config/$pkg" 323 | end 324 | end 325 | 326 | if set -q pkg_jobs[1] 327 | while for job in $pkg_jobs 328 | contains -- $job (_fisher_jobs); and break 329 | end 330 | end 331 | for pkg in $next_pkgs 332 | if test -d "$pkg" 333 | set out_pkgs $out_pkgs $pkg 334 | _fisher_add $pkg 335 | end 336 | end 337 | end 338 | 339 | set -l local_prefix $fisher_config/local/$USER 340 | if test ! -d "$local_prefix" 341 | command mkdir -p $local_prefix 342 | end 343 | for pkg in $local_pkgs 344 | set -l target $local_prefix/(command basename $pkg) 345 | if test ! -L "$target" 346 | command ln -sf $pkg $target 347 | set out_pkgs $out_pkgs $pkg 348 | _fisher_add $pkg --link 349 | end 350 | end 351 | 352 | if set -q out_pkgs[1] 353 | _fisher_fetch ( 354 | for pkg in $out_pkgs 355 | if test -s "$pkg/fishfile" 356 | _fisher_fmt <$pkg/fishfile | _fisher_parse -R 357 | end 358 | end) 359 | printf "%s\n" $out_pkgs | _fisher_fmt 360 | end 361 | end 362 | 363 | function _fisher_add -a pkg opts 364 | for src in $pkg/{functions,completions,conf.d}/**.* $pkg/*.fish 365 | set -l target (command basename $src) 366 | switch $src 367 | case $pkg/conf.d\* 368 | set target $fisher_path/conf.d/$target 369 | case $pkg/completions\* 370 | set target $fisher_path/completions/$target 371 | case $pkg/{functions,}\* 372 | switch $target 373 | case uninstall.fish 374 | continue 375 | case {init,key_bindings}.fish 376 | set target $fisher_path/conf.d/(command basename $pkg)\_$target 377 | case \* 378 | set target $fisher_path/functions/$target 379 | end 380 | end 381 | echo "linking $target" | command sed "s|$HOME|~|" >&2 382 | if set -q opts[1] 383 | command ln -sf $src $target 384 | else 385 | command cp -f $src $target 386 | end 387 | switch $target 388 | case \*.fish 389 | source $target >/dev/null 2>/dev/null 390 | end 391 | end 392 | end 393 | 394 | function _fisher_rm -a pkg 395 | for src in $pkg/{conf.d,completions,functions}/**.* $pkg/*.fish 396 | set -l target (command basename $src) 397 | set -l filename (command basename $target .fish) 398 | switch $src 399 | case $pkg/conf.d\* 400 | test "$filename.fish" = "$target"; and emit "$filename"_uninstall 401 | set target conf.d/$target 402 | case $pkg/completions\* 403 | test "$filename.fish" = "$target"; and complete -ec $filename 404 | set target completions/$target 405 | case $pkg/{,functions}\* 406 | test "$filename.fish" = "$target"; and functions -e $filename 407 | switch $target 408 | case uninstall.fish 409 | source $src 410 | continue 411 | case {init,key_bindings}.fish 412 | set target conf.d/(command basename $pkg)\_$target 413 | case \* 414 | set target functions/$target 415 | end 416 | end 417 | command rm -f $fisher_path/$target 418 | end 419 | if not functions -q fish_prompt 420 | source "$__fish_datadir$__fish_data_dir/functions/fish_prompt.fish" 421 | end 422 | end 423 | 424 | function _fisher_jobs 425 | jobs $argv | command awk '/^[0-9]+\t/ { print $1 }' 426 | end 427 | 428 | function _fisher_now -a elapsed 429 | switch (command uname) 430 | case Darwin \*BSD 431 | command perl -MTime::HiRes -e 'printf("%.0f\n", (Time::HiRes::time() * 1000) - $ARGV[0])' $elapsed 432 | case \* 433 | math (command date "+%s%3N") - "0$elapsed" 434 | end 435 | end 436 | -------------------------------------------------------------------------------- /macos/setup.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # Taken from: 4 | # ~/.macos — https://mths.be/macos 5 | # Amended to work for my personal preferences 6 | 7 | DIR=$(dirname "$0") 8 | cd "$DIR" 9 | 10 | . ../scripts/functions.sh 11 | 12 | info "Setting macOS defaults..." 13 | 14 | # Close any open System Preferences panes, to prevent them from overriding 15 | # settings we’re about to change 16 | osascript -e 'tell application "System Preferences" to quit' 17 | 18 | # Ask for the administrator password upfront 19 | sudo -v 20 | 21 | # Keep-alive: update existing `sudo` time stamp until `.macos` has finished 22 | while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & 23 | 24 | ############################################################################### 25 | # General UI/UX # 26 | ############################################################################### 27 | 28 | # Set computer name (as done via System Preferences → Sharing) 29 | sudo scutil --set ComputerName "rmbp" 30 | sudo scutil --set HostName "rmbp" 31 | sudo scutil --set LocalHostName "rmbp" 32 | sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "rmbp" 33 | 34 | # Disable the sound effects on boot 35 | sudo nvram SystemAudioVolume=" " 36 | 37 | # Disable transparency in the menu bar and elsewhere on Yosemite 38 | # defaults write com.apple.universalaccess reduceTransparency -bool true 39 | 40 | # Set highlight color to green 41 | # defaults write NSGlobalDomain AppleHighlightColor -string "0.764700 0.976500 0.568600" 42 | 43 | # Set sidebar icon size to medium 44 | defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2 45 | 46 | # Always show scrollbars 47 | # defaults write NSGlobalDomain AppleShowScrollBars -string "Always" 48 | # Possible values: `WhenScrolling`, `Automatic` and `Always` 49 | 50 | # Disable the over-the-top focus ring animation 51 | defaults write NSGlobalDomain NSUseAnimatedFocusRing -bool false 52 | 53 | # Adjust toolbar title rollover delay 54 | # defaults write NSGlobalDomain NSToolbarTitleViewRolloverDelay -float 0 55 | 56 | # Disable smooth scrolling 57 | # (Uncomment if you’re on an older Mac that messes up the animation) 58 | #defaults write NSGlobalDomain NSScrollAnimationEnabled -bool false 59 | 60 | # Increase window resize speed for Cocoa applications 61 | defaults write NSGlobalDomain NSWindowResizeTime -float 0.001 62 | 63 | # Expand save panel by default 64 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true 65 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true 66 | 67 | # Expand print panel by default 68 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true 69 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true 70 | 71 | # Save to disk (not to iCloud) by default 72 | defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false 73 | 74 | # Automatically quit printer app once the print jobs complete 75 | defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true 76 | 77 | # Disable the “Are you sure you want to open this application?” dialog 78 | defaults write com.apple.LaunchServices LSQuarantine -bool false 79 | 80 | # Remove duplicates in the “Open With” menu (also see `lscleanup` alias) 81 | /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user 82 | 83 | # Display ASCII control characters using caret notation in standard text views 84 | # Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt` 85 | # defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true 86 | 87 | # Disable Resume system-wide 88 | defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false 89 | 90 | # Disable automatic termination of inactive apps 91 | defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true 92 | 93 | # Disable the crash reporter 94 | defaults write com.apple.CrashReporter DialogType -string "none" 95 | 96 | # Set Help Viewer windows to non-floating mode 97 | defaults write com.apple.helpviewer DevMode -bool true 98 | 99 | # Fix for the ancient UTF-8 bug in QuickLook (https://mths.be/bbo) 100 | # Commented out, as this is known to cause problems in various Adobe apps :( 101 | # See https://github.com/mathiasbynens/dotfiles/issues/237 102 | #echo "0x08000100:0" > ~/.CFUserTextEncoding 103 | 104 | # Reveal IP address, hostname, OS version, etc. when clicking the clock 105 | # in the login window 106 | sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName 107 | 108 | # Disable Notification Center and remove the menu bar icon 109 | launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2> /dev/null 110 | 111 | # Disable automatic capitalization as it’s annoying when typing code 112 | defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false 113 | 114 | # Disable smart dashes as they’re annoying when typing code 115 | defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false 116 | 117 | # Disable automatic period substitution as it’s annoying when typing code 118 | defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false 119 | 120 | # Disable smart quotes as they’re annoying when typing code 121 | defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false 122 | 123 | # Disable auto-correct 124 | defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false 125 | 126 | # Set a custom wallpaper image. `DefaultDesktop.jpg` is already a symlink, and 127 | # all wallpapers are in `/Library/Desktop Pictures/`. The default is `Wave.jpg`. 128 | #rm -rf ~/Library/Application Support/Dock/desktoppicture.db 129 | #sudo rm -rf /System/Library/CoreServices/DefaultDesktop.jpg 130 | #sudo ln -s /path/to/your/image /System/Library/CoreServices/DefaultDesktop.jpg 131 | 132 | ############################################################################### 133 | # Trackpad, mouse, keyboard, Bluetooth accessories, and input # 134 | ############################################################################### 135 | 136 | # Trackpad: enable three finger drag 137 | defaults -currentHost write NSGlobalDomain com.apple.trackpad.threeFingerSwipeGesture -int 1 138 | 139 | # Trackpad: enable tap to click for this user and for the login screen 140 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true 141 | defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 142 | defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 143 | 144 | # Trackpad: map bottom right corner to right-click 145 | # defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 146 | # defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true 147 | # defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 148 | # defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true 149 | 150 | # Enable “natural” (Lion-style) scrolling 151 | defaults write NSGlobalDomain com.apple.swipescrolldirection -bool true 152 | 153 | # Increase sound quality for Bluetooth headphones/headsets 154 | defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 155 | 156 | # Enable full keyboard access for all controls 157 | # (e.g. enable Tab in modal dialogs) 158 | defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 159 | 160 | # Use scroll gesture with the Ctrl (^) modifier key to zoom 161 | # defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true 162 | # defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144 163 | # Follow the keyboard focus while zoomed in 164 | # defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true 165 | 166 | # Disable press-and-hold for keys instead of key repeat 167 | defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false 168 | 169 | # Set a blazingly fast keyboard repeat rate 170 | defaults write NSGlobalDomain KeyRepeat -int 1 171 | defaults write NSGlobalDomain InitialKeyRepeat -int 10 172 | 173 | # Set language and text formats 174 | # Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with 175 | # `Inches`, `en_GB` with `en_US`, and `true` with `false`. 176 | defaults write NSGlobalDomain AppleLanguages -array "en" "nl" "tr" 177 | defaults write NSGlobalDomain AppleLocale -string "en_GB@currency=EUR" 178 | defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" 179 | defaults write NSGlobalDomain AppleMetricUnits -bool true 180 | 181 | # Show language menu in the top right corner of the boot screen 182 | sudo defaults write /Library/Preferences/com.apple.loginwindow showInputMenu -bool true 183 | 184 | # Set the timezone; see `sudo systemsetup -listtimezones` for other values 185 | sudo systemsetup -settimezone "Europe/Amsterdam" > /dev/null 186 | 187 | # Stop iTunes from responding to the keyboard media keys 188 | # UNCOMMENTING THIS DISABLED MEDIA KEYS ALTOGETHER; WOULD NOT RECOMMEND 189 | # launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null 190 | 191 | ############################################################################### 192 | # Energy saving # 193 | ############################################################################### 194 | 195 | # Enable lid wakeup 196 | sudo pmset -a lidwake 1 197 | 198 | # Restart automatically on power loss 199 | sudo pmset -a autorestart 1 200 | 201 | # Restart automatically if the computer freezes 202 | sudo systemsetup -setrestartfreeze on 203 | 204 | # Sleep the display after 15 minutes 205 | # sudo pmset -a displaysleep 15 206 | 207 | # Disable machine sleep while charging 208 | # sudo pmset -c sleep 0 209 | 210 | # Set machine sleep to 5 minutes on battery 211 | # sudo pmset -b sleep 5 212 | 213 | # Set standby delay to 24 hours (default is 1 hour) 214 | # sudo pmset -a standbydelay 86400 215 | 216 | # Never go into computer sleep mode 217 | # sudo systemsetup -setcomputersleep Off > /dev/null 218 | 219 | # Hibernation mode 220 | # 0: Disable hibernation (speeds up entering sleep mode) 221 | # 3: Copy RAM to disk so the system state can still be restored in case of a 222 | # power failure. 223 | sudo pmset -a hibernatemode 0 224 | 225 | # Remove the sleep image file to save disk space 226 | # sudo rm /private/var/vm/sleepimage 227 | # Create a zero-byte file instead… 228 | # sudo touch /private/var/vm/sleepimage 229 | # …and make sure it can’t be rewritten 230 | # sudo chflags uchg /private/var/vm/sleepimage 231 | 232 | ############################################################################### 233 | # Screen # 234 | ############################################################################### 235 | 236 | # Require password immediately after sleep or screen saver begins 237 | defaults write com.apple.screensaver askForPassword -int 1 238 | defaults write com.apple.screensaver askForPasswordDelay -int 0 239 | 240 | # Save screenshots to Google Drive 241 | defaults write com.apple.screencapture location -string "${HOME}/Google Drive/screenshots" 242 | 243 | # Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) 244 | defaults write com.apple.screencapture type -string "png" 245 | 246 | # Enable shadow in screenshots 247 | defaults write com.apple.screencapture disable-shadow -bool false 248 | 249 | # Enable subpixel font rendering on non-Apple LCDs 250 | # Reference: https://github.com/kevinSuttle/macOS-Defaults/issues/17#issuecomment-266633501 251 | defaults write NSGlobalDomain AppleFontSmoothing -int 1 252 | 253 | # Enable HiDPI display modes (requires restart) 254 | sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true 255 | 256 | ############################################################################### 257 | # Finder # 258 | ############################################################################### 259 | 260 | # Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons 261 | defaults write com.apple.finder QuitMenuItem -bool true 262 | 263 | # Finder: disable window animations and Get Info animations 264 | defaults write com.apple.finder DisableAllAnimations -bool true 265 | 266 | # Set Desktop as the default location for new Finder windows 267 | # For other paths, use `PfLo` and `file:///full/path/here/` 268 | # defaults write com.apple.finder NewWindowTarget -string "PfDe" 269 | # defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/" 270 | 271 | # Show icons for hard drives, servers, and removable media on the desktop 272 | defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true 273 | defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true 274 | defaults write com.apple.finder ShowMountedServersOnDesktop -bool true 275 | defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true 276 | 277 | # Finder: show hidden files by default 278 | defaults write com.apple.finder AppleShowAllFiles -bool true 279 | 280 | # Finder: show all filename extensions 281 | defaults write NSGlobalDomain AppleShowAllExtensions -bool true 282 | 283 | # Finder: show status bar 284 | defaults write com.apple.finder ShowStatusBar -bool true 285 | 286 | # Finder: show path bar 287 | defaults write com.apple.finder ShowPathbar -bool true 288 | 289 | # Display full POSIX path as Finder window title 290 | defaults write com.apple.finder _FXShowPosixPathInTitle -bool true 291 | 292 | # Keep folders on top when sorting by name 293 | defaults write com.apple.finder _FXSortFoldersFirst -bool true 294 | 295 | # When performing a search, search the current folder by default 296 | defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" 297 | 298 | # Disable the warning when changing a file extension 299 | defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false 300 | 301 | # Enable spring loading for directories 302 | defaults write NSGlobalDomain com.apple.springing.enabled -bool true 303 | 304 | # Remove the spring loading delay for directories 305 | defaults write NSGlobalDomain com.apple.springing.delay -float 0 306 | 307 | # Avoid creating .DS_Store files on network or USB volumes 308 | defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true 309 | defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true 310 | 311 | # Disable disk image verification 312 | defaults write com.apple.frameworks.diskimages skip-verify -bool true 313 | defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true 314 | defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true 315 | 316 | # Automatically open a new Finder window when a volume is mounted 317 | defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true 318 | defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true 319 | defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true 320 | 321 | # Show item info near icons on the desktop and in other icon views 322 | # /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 323 | # /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 324 | # /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 325 | 326 | # Show item info to the right of the icons on the desktop 327 | # /usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist 328 | 329 | # Enable snap-to-grid for icons on the desktop and in other icon views 330 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 331 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 332 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 333 | 334 | # Increase grid spacing for icons on the desktop and in other icon views 335 | # /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 336 | # /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 337 | # /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 338 | 339 | # Increase the size of icons on the desktop and in other icon views 340 | # /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 341 | # /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 342 | # /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 343 | 344 | # Use column view in all Finder windows by default 345 | # Four-letter codes for the other view modes: `icnv`, `Nlsv`, `glyv` 346 | defaults write com.apple.finder FXPreferredViewStyle -string "clmv" 347 | 348 | # Disable the warning before emptying the Trash 349 | defaults write com.apple.finder WarnOnEmptyTrash -bool false 350 | 351 | # Enable AirDrop over Ethernet and on unsupported Macs running Lion 352 | defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true 353 | 354 | # Show the ~/Library folder (broken on Apple Silicon) 355 | # chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library 356 | 357 | # Show the /Volumes folder 358 | sudo chflags nohidden /Volumes 359 | 360 | # Remove Dropbox’s green checkmark icons in Finder 361 | file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns 362 | [ -e "${file}" ] && mv -f "${file}" "${file}.bak" 363 | 364 | # Expand the following File Info panes: 365 | # “General”, “Open with”, and “Sharing & Permissions” 366 | defaults write com.apple.finder FXInfoPanesExpanded -dict \ 367 | General -bool true \ 368 | OpenWith -bool true \ 369 | Privileges -bool true 370 | 371 | ############################################################################### 372 | # Dock, Dashboard, and hot corners # 373 | ############################################################################### 374 | 375 | # Enable highlight hover effect for the grid view of a stack (Dock) 376 | defaults write com.apple.dock mouse-over-hilite-stack -bool true 377 | 378 | # Set the icon size of Dock items to 64 pixels 379 | defaults write com.apple.dock tilesize -int 64 380 | 381 | # Change minimize/maximize window effect - genie, suck or scale 382 | defaults write com.apple.dock mineffect -string "genie" 383 | 384 | # Don't inimize windows into their application’s icon 385 | defaults write com.apple.dock minimize-to-application -bool false 386 | 387 | # Enable spring loading for all Dock items 388 | defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true 389 | 390 | # Show indicator lights for open applications in the Dock 391 | defaults write com.apple.dock show-process-indicators -bool true 392 | 393 | # Wipe all (default) app icons from the Dock 394 | # This is only really useful when setting up a new Mac, or if you don’t use 395 | # the Dock to launch apps. 396 | defaults write com.apple.dock persistent-apps -array 397 | 398 | # Show only open applications in the Dock 399 | # defaults write com.apple.dock static-only -bool true 400 | 401 | # Animate opening applications from the Dock 402 | defaults write com.apple.dock launchanim -bool true 403 | 404 | # Speed up Mission Control animations 405 | defaults write com.apple.dock expose-animation-duration -float 0.2 406 | 407 | # Group windows by application in Mission Control 408 | defaults write com.apple.dock expose-group-by-app -bool true 409 | 410 | # Disable Dashboard 411 | defaults write com.apple.dashboard mcx-disabled -bool true 412 | 413 | # Don’t show Dashboard as a Space 414 | defaults write com.apple.dock dashboard-in-overlay -bool true 415 | 416 | # Don’t automatically rearrange Spaces based on most recent use 417 | defaults write com.apple.dock mru-spaces -bool false 418 | 419 | # Remove the auto-hiding Dock delay 420 | defaults write com.apple.dock autohide-delay -float 0 421 | # Make the animation when hiding/showing the Dock faster 422 | defaults write com.apple.dock autohide-time-modifier -float 0.15 423 | 424 | # Automatically hide and show the Dock 425 | defaults write com.apple.dock autohide -bool true 426 | 427 | # Make Dock icons of hidden applications translucent 428 | defaults write com.apple.dock showhidden -bool true 429 | 430 | # Don’t show recent applications in Dock 431 | defaults write com.apple.dock show-recents -bool false 432 | 433 | # Disable the Launchpad gesture (pinch with thumb and three fingers) 434 | #defaults write com.apple.dock showLaunchpadGestureEnabled -int 0 435 | 436 | # Reset Launchpad, but keep the desktop wallpaper intact 437 | # find "${HOME}/Library/Application Support/Dock" -name "*-*.db" -maxdepth 1 -delete 438 | 439 | # Add iOS & Watch Simulator to Launchpad 440 | # sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app" "/Applications/Simulator.app" 441 | # sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator (Watch).app" "/Applications/Simulator (Watch).app" 442 | 443 | # Add a spacer to the left side of the Dock (where the applications are) 444 | #defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}' 445 | # Add a spacer to the right side of the Dock (where the Trash is) 446 | #defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}' 447 | 448 | # Hot corners 449 | # Possible values: 450 | # 0: no-op 451 | # 2: Mission Control 452 | # 3: Show application windows 453 | # 4: Desktop 454 | # 5: Start screen saver 455 | # 6: Disable screen saver 456 | # 7: Dashboard 457 | # 10: Put display to sleep 458 | # 11: Launchpad 459 | # 12: Notification Center 460 | # 13: Lock Screen 461 | # Top left screen corner → No op 462 | defaults write com.apple.dock wvous-tl-corner -int 0 463 | defaults write com.apple.dock wvous-tl-modifier -int 0 464 | # Top right screen corner → No op 465 | defaults write com.apple.dock wvous-tr-corner -int 0 466 | defaults write com.apple.dock wvous-tr-modifier -int 0 467 | # Bottom left screen corner → No op 468 | defaults write com.apple.dock wvous-bl-corner -int 0 469 | defaults write com.apple.dock wvous-bl-modifier -int 0 470 | # Bottom right screen corner → No op 471 | defaults write com.apple.dock wvous-br-corner -int 0 472 | defaults write com.apple.dock wvous-br-modifier -int 0 473 | 474 | ############################################################################### 475 | # Terminal & iTerm 2 # 476 | ############################################################################### 477 | 478 | # Only use UTF-8 in Terminal.app 479 | defaults write com.apple.terminal StringEncodings -array 4 480 | 481 | # Enable “focus follows mouse” for Terminal.app and all X11 apps 482 | # i.e. hover over a window and start typing in it without clicking first 483 | #defaults write com.apple.terminal FocusFollowsMouse -bool true 484 | #defaults write org.x.X11 wm_ffm -bool true 485 | 486 | # Enable Secure Keyboard Entry in Terminal.app 487 | # See: https://security.stackexchange.com/a/47786/8918 488 | defaults write com.apple.terminal SecureKeyboardEntry -bool true 489 | 490 | # Disable the annoying line marks 491 | defaults write com.apple.Terminal ShowLineMarks -int 0 492 | 493 | # Don’t display the annoying prompt when quitting iTerm 494 | defaults write com.googlecode.iterm2 PromptOnQuit -bool false 495 | 496 | ############################################################################### 497 | # Time Machine # 498 | ############################################################################### 499 | 500 | # Prevent Time Machine from prompting to use new hard drives as backup volume 501 | defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true 502 | 503 | # Disable local Time Machine backups (broken on Apple Silicon) 504 | # hash tmutil &> /dev/null && sudo tmutil disablelocal 505 | 506 | ############################################################################### 507 | # Activity Monitor # 508 | ############################################################################### 509 | 510 | # Show the main window when launching Activity Monitor 511 | defaults write com.apple.ActivityMonitor OpenMainWindow -bool true 512 | 513 | # Visualize CPU usage in the Activity Monitor Dock icon 514 | defaults write com.apple.ActivityMonitor IconType -int 5 515 | 516 | # Show all processes in Activity Monitor 517 | defaults write com.apple.ActivityMonitor ShowCategory -int 0 518 | 519 | # Sort Activity Monitor results by CPU usage 520 | defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage" 521 | defaults write com.apple.ActivityMonitor SortDirection -int 0 522 | 523 | ############################################################################### 524 | # Address Book, Dashboard, iCal, TextEdit, and Disk Utility # 525 | ############################################################################### 526 | 527 | # Enable the debug menu in Address Book 528 | defaults write com.apple.addressbook ABShowDebugMenu -bool true 529 | 530 | # Enable Dashboard dev mode (allows keeping widgets on the desktop) 531 | defaults write com.apple.dashboard devmode -bool true 532 | 533 | # Enable the debug menu in iCal (pre-10.8) 534 | defaults write com.apple.iCal IncludeDebugMenu -bool true 535 | 536 | # Use plain text mode for new TextEdit documents 537 | defaults write com.apple.TextEdit RichText -int 0 538 | # Open and save files as UTF-8 in TextEdit 539 | defaults write com.apple.TextEdit PlainTextEncoding -int 4 540 | defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 541 | 542 | # Enable the debug menu in Disk Utility 543 | defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true 544 | defaults write com.apple.DiskUtility advanced-image-options -bool true 545 | 546 | # Auto-play videos when opened with QuickTime Player 547 | defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen -bool true 548 | 549 | ############################################################################### 550 | # Mac App Store # 551 | ############################################################################### 552 | 553 | # Enable the WebKit Developer Tools in the Mac App Store 554 | defaults write com.apple.appstore WebKitDeveloperExtras -bool true 555 | 556 | # Enable Debug Menu in the Mac App Store 557 | defaults write com.apple.appstore ShowDebugMenu -bool true 558 | 559 | # Enable the automatic update check 560 | defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true 561 | 562 | # Check for software updates daily, not just once per week 563 | defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 564 | 565 | # Download newly available updates in background 566 | defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1 567 | 568 | # Install System data files & security updates 569 | defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1 570 | 571 | # Automatically download apps purchased on other Macs 572 | defaults write com.apple.SoftwareUpdate ConfigDataInstall -int 1 573 | 574 | # Turn on app auto-update 575 | defaults write com.apple.commerce AutoUpdate -bool true 576 | 577 | # Allow the App Store to reboot machine on macOS updates 578 | defaults write com.apple.commerce AutoUpdateRestartRequired -bool true 579 | 580 | ############################################################################### 581 | # Photos # 582 | ############################################################################### 583 | 584 | # Prevent Photos from opening automatically when devices are plugged in 585 | defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true 586 | 587 | ############################################################################### 588 | # Messages # 589 | ############################################################################### 590 | 591 | # Disable automatic emoji substitution (i.e. use plain text smileys) 592 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false 593 | 594 | # Disable smart quotes as it’s annoying for messages that contain code 595 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false 596 | 597 | # Disable continuous spell checking 598 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false 599 | 600 | ############################################################################### 601 | # Transmission.app # 602 | ############################################################################### 603 | # Use `~/Downloads` to store completed downloads 604 | defaults write org.m0k.transmission DownloadLocationConstant -bool true 605 | 606 | # Don’t prompt for confirmation before downloading 607 | defaults write org.m0k.transmission DownloadAsk -bool false 608 | defaults write org.m0k.transmission MagnetOpenAsk -bool false 609 | 610 | # Don’t prompt for confirmation before removing non-downloading active transfers 611 | defaults write org.m0k.transmission CheckRemoveDownloading -bool true 612 | 613 | # Trash original torrent files 614 | defaults write org.m0k.transmission DeleteOriginalTorrent -bool true 615 | 616 | # Hide the donate message 617 | defaults write org.m0k.transmission WarningDonate -bool false 618 | # Hide the legal disclaimer 619 | defaults write org.m0k.transmission WarningLegal -bool false 620 | 621 | # IP block list. 622 | # Source: https://giuliomac.wordpress.com/2014/02/19/best-blocklist-for-transmission/ 623 | defaults write org.m0k.transmission BlocklistNew -bool true 624 | defaults write org.m0k.transmission BlocklistURL -string "http://john.bitsurge.net/public/biglist.p2p.gz" 625 | defaults write org.m0k.transmission BlocklistAutoUpdate -bool true 626 | 627 | # Randomize port on launch 628 | defaults write org.m0k.transmission RandomPort -bool true 629 | 630 | ############################################################################### 631 | # Kill affected applications # 632 | ############################################################################### 633 | 634 | for app in "Activity Monitor" \ 635 | "Address Book" \ 636 | "Calendar" \ 637 | "cfprefsd" \ 638 | "Contacts" \ 639 | "Dock" \ 640 | "Finder" \ 641 | "Messages" \ 642 | "Photos" \ 643 | "Safari" \ 644 | "SystemUIServer" \ 645 | "Transmission" \ 646 | "iCal"; do 647 | killall "${app}" &> /dev/null 648 | done 649 | 650 | success "Finished setting macOS defaults. Note that some of these changes require a logout/restart to take effect." 651 | --------------------------------------------------------------------------------