├── .ruby-version ├── vim ├── .vim │ ├── ftplugin │ │ ├── .keep │ │ ├── css.vim │ │ ├── ruby.vim │ │ ├── vim.vim │ │ ├── markdown.vim │ │ └── gitcommit.vim │ ├── syntax │ │ └── .keep │ ├── init.vim │ ├── autoload │ │ └── plug.vim │ ├── config │ │ ├── cursor.vim │ │ ├── git_gutter.vim │ │ ├── history.vim │ │ ├── markdown.vim │ │ ├── splitjoin.vim │ │ ├── tags.vim │ │ ├── indenting.vim │ │ ├── osx_iterm_vim_gui │ │ ├── goyo.vim │ │ ├── search.vim │ │ ├── linters.vim │ │ ├── nerdtree.vim │ │ ├── switch.vim │ │ ├── fzf.vim │ │ ├── airline.vim │ │ ├── testing.vim │ │ ├── themes.vim │ │ ├── trailing_whitespace.vim │ │ ├── autocomplete.vim │ │ ├── files.vim │ │ └── shortcuts.vim │ ├── UltiSnips │ │ ├── javascriptreact.snippets │ │ ├── sh.snippets │ │ ├── gitcommit.snippets │ │ ├── haml.snippets │ │ ├── all.snippets │ │ ├── elixir.snippets │ │ ├── eruby.snippets │ │ ├── sass.snippets │ │ ├── html.snippets │ │ ├── rails.snippets │ │ ├── javascript.snippets │ │ └── ruby.snippets │ └── colors │ │ └── twilight.vim ├── .gvimrc └── .vimrc ├── zsh ├── .zsh │ ├── config.zsh │ ├── history.zsh │ ├── key-bindings.zsh │ ├── site-functions │ │ └── _commit_format │ ├── completions.zsh │ ├── theme.zsh │ ├── termsupport.zsh │ ├── aliases.zsh │ └── functions.zsh └── .zshrc ├── ruby ├── bundle │ └── config ├── .gemrc └── .irbrc ├── .ignore ├── .ripgreprc ├── cloc └── options.txt ├── bat └── config ├── hammerspoon ├── todoist_projects.example.lua ├── Spoons │ └── URLDispatcher.spoon │ │ ├── url_patterns.example.lua │ │ ├── init.lua │ │ └── docs.json ├── init.lua ├── auto_muter.lua ├── wifi_control.lua ├── bluetooth_control.lua ├── application_watcher.lua ├── device_watcher.lua ├── todoist.lua ├── keyboards.lua ├── window_management.lua ├── triggers.lua └── keys.lua ├── .gitmodules ├── bin ├── mongo-db-drop-all ├── git-fixup └── retry ├── .gitignore ├── .ignore_global ├── .gnupg ├── gpg.conf └── gpg-agent.conf ├── Brewfile ├── git ├── .gitignore_global └── .tigrc ├── config.ctags ├── install ├── README.md ├── iterm2 ├── colors.itermcolors └── base16-suzume.dark.itermcolors └── .macos /.ruby-version: -------------------------------------------------------------------------------- 1 | 3.1 2 | -------------------------------------------------------------------------------- /vim/.vim/ftplugin/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vim/.vim/syntax/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /zsh/.zsh/config.zsh: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vim/.vim/init.vim: -------------------------------------------------------------------------------- 1 | ../.vimrc -------------------------------------------------------------------------------- /ruby/bundle/config: -------------------------------------------------------------------------------- 1 | --- 2 | BUNDLE_JOBS: "4" 3 | -------------------------------------------------------------------------------- /vim/.vim/autoload/plug.vim: -------------------------------------------------------------------------------- 1 | ../vim-plug/plug.vim -------------------------------------------------------------------------------- /.ignore: -------------------------------------------------------------------------------- 1 | /powerline-fonts/ 2 | /vim/.vim/vim-plug/ 3 | -------------------------------------------------------------------------------- /vim/.vim/ftplugin/css.vim: -------------------------------------------------------------------------------- 1 | setlocal iskeyword+=- 2 | -------------------------------------------------------------------------------- /vim/.vim/ftplugin/ruby.vim: -------------------------------------------------------------------------------- 1 | setlocal omnifunc=ale#completion#OmniFunc 2 | -------------------------------------------------------------------------------- /.ripgreprc: -------------------------------------------------------------------------------- 1 | --type-add 2 | ruby:*.rake 3 | 4 | --smart-case 5 | --hidden 6 | -------------------------------------------------------------------------------- /vim/.vim/ftplugin/vim.vim: -------------------------------------------------------------------------------- 1 | setlocal colorcolumn=80,100 2 | setlocal textwidth=0 3 | -------------------------------------------------------------------------------- /cloc/options.txt: -------------------------------------------------------------------------------- 1 | --vcs=git 2 | --exclude-dir=dist,node_modules,target,tmp,vendor 3 | -------------------------------------------------------------------------------- /bat/config: -------------------------------------------------------------------------------- 1 | --theme="OneHalfDark" 2 | --decorations=never 3 | 4 | --map-syntax "*.gemfile:Ruby" 5 | -------------------------------------------------------------------------------- /hammerspoon/todoist_projects.example.lua: -------------------------------------------------------------------------------- 1 | return { 2 | {0, "Inbox"}, 3 | {1, "Today"}, 4 | } 5 | -------------------------------------------------------------------------------- /vim/.vim/config/cursor.vim: -------------------------------------------------------------------------------- 1 | " Disable blinking of cursor in normal mode 2 | set guicursor+=n:blinkon0 3 | -------------------------------------------------------------------------------- /vim/.vim/UltiSnips/javascriptreact.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | extends javascript 4 | 5 | # vim:ft=snippets: 6 | -------------------------------------------------------------------------------- /vim/.vim/ftplugin/markdown.vim: -------------------------------------------------------------------------------- 1 | setlocal colorcolumn=80 2 | setlocal spell 3 | setlocal tabstop=4 4 | setlocal shiftwidth=4 5 | -------------------------------------------------------------------------------- /vim/.vim/config/git_gutter.vim: -------------------------------------------------------------------------------- 1 | set signcolumn=yes 2 | let g:gitgutter_realtime=0 3 | let g:gitgutter_eager=0 4 | let g:gitgutter_map_keys=0 5 | -------------------------------------------------------------------------------- /vim/.vim/UltiSnips/sh.snippets: -------------------------------------------------------------------------------- 1 | priority -60 2 | 3 | snippet tail "tail -f /dev/null" 4 | tail -f /dev/null 5 | endsnippet 6 | 7 | # vim:ft=snippets: 8 | -------------------------------------------------------------------------------- /ruby/.gemrc: -------------------------------------------------------------------------------- 1 | --- 2 | verbose: true 3 | gem: --no-ri --no-rdoc --no-document 4 | update_sources: true 5 | backtrace: false 6 | bulk_threshold: 1000 7 | benchmark: false 8 | -------------------------------------------------------------------------------- /hammerspoon/Spoons/URLDispatcher.spoon/url_patterns.example.lua: -------------------------------------------------------------------------------- 1 | local url_patterns = { 2 | { "https://%w+.google.com", "com.google.Chrome" } 3 | } 4 | 5 | return url_patterns 6 | -------------------------------------------------------------------------------- /vim/.vim/UltiSnips/gitcommit.snippets: -------------------------------------------------------------------------------- 1 | priority -60 2 | 3 | snippet "co(author)?" "Co-authored-by: name " r 4 | Co-authored-by: ${1:name} <${2:email@domain.com}> 5 | endsnippet 6 | 7 | # vim:ft=snippets: 8 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "powerline-fonts"] 2 | path = powerline-fonts 3 | url = https://github.com/powerline/fonts 4 | [submodule "vim/.vim/vim-plug"] 5 | path = vim/.vim/vim-plug 6 | url = git@github.com:junegunn/vim-plug.git 7 | -------------------------------------------------------------------------------- /vim/.vim/config/history.vim: -------------------------------------------------------------------------------- 1 | if has("persistent_undo") 2 | set undolevels=5000 3 | set undofile 4 | if has("nvim") 5 | set undodir=$HOME/.NVIM_UNDO_FILES 6 | else 7 | set undodir=$HOME/.VIM_UNDO_FILES 8 | end 9 | endif 10 | -------------------------------------------------------------------------------- /bin/mongo-db-drop-all: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cmd="var dbs = db.getMongo().getDBNames(); 4 | for(var i in dbs) { 5 | db = db.getMongo().getDB(dbs[i]); 6 | print('dropping db ' + db.getName()); 7 | db.dropDatabase(); 8 | }" 9 | 10 | echo $cmd | mongo 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .AppleDouble 3 | .LSOverride 4 | Icon 5 | ._* 6 | .netrwhist 7 | vim/.vim/plugged 8 | vim/.vim/spell 9 | zsh/.zsh/.cache 10 | hammerspoon/Spoons/URLDispatcher.spoon/url_patterns.lua 11 | hammerspoon/todoist_projects.lua 12 | Brewfile.lock.json 13 | -------------------------------------------------------------------------------- /vim/.gvimrc: -------------------------------------------------------------------------------- 1 | " Font/Text settings. 2 | let &guifont=g:font_normal 3 | set linespace=1 4 | 5 | " Remove toolbar. 6 | set guioptions-=T 7 | set guioptions-=r 8 | set guioptions-=L 9 | 10 | " Remove OSX dialogs, Use Vim's built-in ones instead. 11 | set guioptions+=c 12 | -------------------------------------------------------------------------------- /vim/.vim/config/markdown.vim: -------------------------------------------------------------------------------- 1 | set nofoldenable 2 | set conceallevel=0 3 | let g:vim_markdown_conceal=0 4 | let g:vim_markdown_folding_disabled=1 " Disable folding for markdown 5 | let g:vim_markdown_frontmatter=1 " Highlight YAML frontmatter 6 | let g:vim_markdown_new_list_item_indent=2 7 | -------------------------------------------------------------------------------- /.ignore_global: -------------------------------------------------------------------------------- 1 | .git 2 | .svn 3 | .hg 4 | /log 5 | /doc 6 | .yarddoc 7 | coverage 8 | _build 9 | deps 10 | tmp 11 | .sass-cache 12 | *.ttf 13 | *.eot 14 | *.woff 15 | *.woff2 16 | !.env 17 | **.js.snap 18 | /tags 19 | tags.lock 20 | tags.temp 21 | *.png 22 | *.jpeg 23 | *.jpg 24 | *.gif 25 | *.svg 26 | *.tiff 27 | -------------------------------------------------------------------------------- /vim/.vim/ftplugin/gitcommit.vim: -------------------------------------------------------------------------------- 1 | " Color column 2 | " - 50 for commit subject 3 | " - 72 for commit message 4 | setlocal colorcolumn=50,72 5 | 6 | " Set max line width to max commit message width 7 | setlocal spell textwidth=72 8 | 9 | " Unset vim-rhubarb autocomplete. It's slow. 10 | setlocal omnifunc& 11 | -------------------------------------------------------------------------------- /vim/.vim/config/splitjoin.vim: -------------------------------------------------------------------------------- 1 | let g:splitjoin_split_mapping='' 2 | let g:splitjoin_join_mapping='' 3 | let g:splitjoin_ruby_hanging_args=0 4 | let g:splitjoin_ruby_curly_braces=0 5 | let g:splitjoin_html_attributes_bracket_on_new_line = 1 6 | 7 | nmap j :SplitjoinJoin 8 | nmap k :SplitjoinSplit 9 | -------------------------------------------------------------------------------- /vim/.vim/config/tags.vim: -------------------------------------------------------------------------------- 1 | let g:gutentags_generate_on_new = 1 2 | let g:gutentags_generate_on_missing = 1 3 | let g:gutentags_generate_on_write = 1 4 | let g:gutentags_generate_on_empty_buffer = 0 5 | let g:gutentags_ctags_executable = '/opt/homebrew/bin/ctags' 6 | let g:gutentags_cache_dir = '/Users/tombruijn/.cache/ctags' 7 | -------------------------------------------------------------------------------- /vim/.vim/config/indenting.vim: -------------------------------------------------------------------------------- 1 | function! FixIndenting() 2 | " Preparation: save cursor position. 3 | let l = line(".") 4 | let c = col(".") 5 | 6 | " Format code 7 | execute "normal! 1G=G" 8 | 9 | " Restore cursor location 10 | call cursor(l, c) 11 | endfunction 12 | 13 | nnoremap i :call FixIndenting() 14 | -------------------------------------------------------------------------------- /vim/.vim/UltiSnips/haml.snippets: -------------------------------------------------------------------------------- 1 | # Haml snippets 2 | 3 | snippet pry "- binding.pry" w 4 | - require "pry"; binding.pry$0 5 | endsnippet 6 | 7 | snippet # "Wrap in #{code}" i 8 | #{${0:${VISUAL:code}}} 9 | endsnippet 10 | 11 | snippet each "each do |variable|" i 12 | each do |${1:variable}| 13 | $0 14 | endsnippet 15 | 16 | # vim:ft=snippets: 17 | -------------------------------------------------------------------------------- /.gnupg/gpg.conf: -------------------------------------------------------------------------------- 1 | # Source: https://gist.github.com/bmhatfield/cc21ec0a3a2df963bffa3c1f884b676b 2 | use-agent 3 | 4 | # This silences the "you need a passphrase" message once the passphrase 5 | # handling is all set. Use at your own discretion - may prevent the successful 6 | # interactive use of some operations. It is working fine for my use cases 7 | # though. 8 | batch 9 | -------------------------------------------------------------------------------- /.gnupg/gpg-agent.conf: -------------------------------------------------------------------------------- 1 | # Source: https://gist.github.com/bmhatfield/cc21ec0a3a2df963bffa3c1f884b676b 2 | 3 | # Connects gpg-agent to the OSX keychain via the brew-installed pinentry 4 | # program from GPGtools. This is the OSX 'magic sauce', allowing the gpg key's 5 | # passphrase to be stored in the login keychain, enabling automatic key 6 | # signing. 7 | pinentry-program /opt/homebrew/bin/pinentry-mac 8 | -------------------------------------------------------------------------------- /vim/.vim/UltiSnips/all.snippets: -------------------------------------------------------------------------------- 1 | priority -60 2 | 3 | snippet lorem "Lorem Ipsum - 50 Words" b 4 | Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod 5 | tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At 6 | vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, 7 | no sea takimata sanctus est Lorem ipsum dolor sit amet. 8 | endsnippet 9 | 10 | # vim:ft=snippets: 11 | -------------------------------------------------------------------------------- /vim/.vim/config/osx_iterm_vim_gui: -------------------------------------------------------------------------------- 1 | #!/usr/bin/osascript 2 | 3 | on run argv 4 | tell application "iTerm2" 5 | set _window to (current window) 6 | if _window is equal to missing value then 7 | create window with default profile 8 | end if 9 | tell current window 10 | tell current session 11 | write text (item 1 of argv) 12 | end tell 13 | end tell 14 | end tell 15 | 16 | tell application "MacVim" 17 | activate 18 | end tell 19 | end run 20 | -------------------------------------------------------------------------------- /zsh/.zsh/history.zsh: -------------------------------------------------------------------------------- 1 | ## Command history configuration 2 | if [ -z $HISTFILE ]; then 3 | HISTFILE=$HOME/.zsh_history 4 | fi 5 | HISTSIZE=10000 6 | SAVEHIST=10000 7 | 8 | alias history="fc -il 1" 9 | 10 | setopt append_history 11 | setopt extended_history 12 | setopt hist_expire_dups_first 13 | setopt hist_ignore_dups # ignore duplication command history list 14 | setopt hist_ignore_space 15 | setopt hist_verify 16 | setopt inc_append_history 17 | setopt share_history # share command history 18 | -------------------------------------------------------------------------------- /hammerspoon/init.lua: -------------------------------------------------------------------------------- 1 | local application = require "hs.application" 2 | local hotkey = require "hs.hotkey" 3 | local alert = require "hs.alert" 4 | 5 | local keys = require "keys" 6 | require "triggers" 7 | require "window_management" 8 | require "auto_muter" 9 | require "application_watcher" 10 | require "device_watcher" 11 | require "keyboards" 12 | 13 | keys.deactivateKeys() 14 | keys.activateKeys() 15 | 16 | hs.loadSpoon("URLDispatcher") 17 | spoon.URLDispatcher:start() 18 | 19 | alert.show("Hammerspoon loaded!") 20 | -------------------------------------------------------------------------------- /bin/git-fixup: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | set -eu 4 | 5 | amount=${1:-10} 6 | array=(${(@f)"$(git --no-pager log -n $amount --pretty=format:%s)"}) 7 | for (( i = 1; i <= $#array; i++ )) do 8 | key="$i" 9 | if [[ $#i == 1 ]]; then 10 | key=" $key" 11 | fi 12 | echo "$key $array[i]" 13 | done 14 | 15 | local choice 16 | echo "" 17 | read "choice?Commit to fixup?: " 18 | if [[ "$choice" -le "0" ]]; then 19 | echo "No commit given.. Exiting." 20 | else 21 | local commits_back=$(($choice - 1)) 22 | git commit --fixup HEAD~$commits_back 23 | fi 24 | -------------------------------------------------------------------------------- /hammerspoon/auto_muter.lua: -------------------------------------------------------------------------------- 1 | local screen = require "hs.screen" 2 | local audiodevice = require "hs.audiodevice" 3 | local alert = require "hs.alert" 4 | local itunes = require "hs.itunes" 5 | 6 | -- Mute everything when a screen gets (dis)connected. 7 | watcher = screen.watcher.new(function() 8 | audioDevices = audiodevice.allOutputDevices() 9 | for i = 1, #audioDevices do 10 | device = audioDevices[i] 11 | device:setVolume(0.0) 12 | device:setMuted(true) 13 | itunes.pause() 14 | end 15 | alert.show("Sound muted!") 16 | end) 17 | watcher:start() 18 | -------------------------------------------------------------------------------- /vim/.vim/config/goyo.vim: -------------------------------------------------------------------------------- 1 | let g:goyo_width=80 2 | let g:goyo_height=90 3 | let g:goyo_linenr=0 4 | 5 | function! s:goyo_enter() 6 | set noshowcmd 7 | set scrolloff=999 8 | set nocursorline 9 | endfunction 10 | 11 | function! s:goyo_leave() 12 | set showcmd 13 | set scrolloff=5 14 | set cursorline 15 | endfunction 16 | 17 | augroup mygoyo 18 | autocmd! 19 | 20 | autocmd User GoyoEnter nested call goyo_enter() 21 | autocmd User GoyoLeave nested call goyo_leave() 22 | augroup END 23 | 24 | " Toggle focus mode 25 | nnoremap F :Goyo 26 | -------------------------------------------------------------------------------- /hammerspoon/wifi_control.lua: -------------------------------------------------------------------------------- 1 | local alert = require "hs.alert" 2 | 3 | WiFiControl = {} 4 | 5 | function WiFiControl.status() 6 | output = io.popen("networksetup -getairportpower en0", "r") 7 | result = output:read() 8 | return result:find(": On") and "on" or "off" 9 | end 10 | 11 | function WiFiControl.toggle() 12 | if WiFiControl.status() == "on" then 13 | alert.show("Wi-Fi: Off") 14 | os.execute("networksetup -setairportpower en0 off") 15 | else 16 | alert.show("Wi-Fi: On") 17 | os.execute("networksetup -setairportpower en0 on") 18 | end 19 | end 20 | 21 | return WiFiControl 22 | -------------------------------------------------------------------------------- /vim/.vim/config/search.vim: -------------------------------------------------------------------------------- 1 | let g:ackprg='rg --vimgrep' 2 | 3 | " Clear current search highlights 4 | nnoremap m :noh 5 | 6 | " Center search results 7 | nnoremap n nzz 8 | nnoremap N Nzz 9 | 10 | " Replace last search 11 | " Shorthand for :$s//replacement/g 12 | " Source: https://github.com/thoughtstream/Damian-Conway-s-Vim-Setup/blob/59981573773d682abb81df209c20e505ae7b703e/.vimrc#L146-L152 13 | nmap R ':%s/' . @/ . '//g' 14 | vmap R ':s/' . @/ . '//g' 15 | 16 | " Enable live search and replace in Neovim 17 | if has("nvim") 18 | set inccommand=nosplit 19 | endif 20 | -------------------------------------------------------------------------------- /ruby/.irbrc: -------------------------------------------------------------------------------- 1 | require "irb/completion" 2 | require "irb/ext/save-history" 3 | 4 | IRB.conf[:SAVE_HISTORY] = 100_000 5 | IRB.conf[:HISTORY_FILE] = "#{ENV["HOME"]}/.irb-save-history" 6 | 7 | IRB.conf[:PROMPT][:CUSTOM] = IRB.conf[:PROMPT][:SIMPLE] 8 | 9 | if defined? Rails 10 | env_prefix = 11 | if Rails.env.production? 12 | "\e[41;97;1m prod \e[0m " 13 | else 14 | "\033[32m#{Rails.env}\033[0m " 15 | end 16 | 17 | IRB.conf[:PROMPT][:CUSTOM] = IRB.conf[:PROMPT][:CUSTOM].merge( 18 | :PROMPT_I => env_prefix + IRB.conf[:PROMPT][:CUSTOM][:PROMPT_I] 19 | ) 20 | end 21 | 22 | IRB.conf[:PROMPT_MODE] = :CUSTOM 23 | -------------------------------------------------------------------------------- /hammerspoon/bluetooth_control.lua: -------------------------------------------------------------------------------- 1 | local alert = require "hs.alert" 2 | local blueutil = "/opt/homebrew/bin/blueutil" 3 | 4 | BluetoothControl = {} 5 | 6 | function BluetoothControl.status() 7 | output = io.popen(blueutil, "r") 8 | result = output:read() 9 | return result:find("Power: 1") and "on" or "off" 10 | end 11 | 12 | function BluetoothControl.toggle() 13 | if BluetoothControl.status() == "on" then 14 | alert.show("Bluetooth: Off") 15 | os.execute(blueutil.." --power 0") 16 | else 17 | alert.show("Bluetooth: On") 18 | os.execute(blueutil.." --power 1") 19 | end 20 | end 21 | 22 | return BluetoothControl 23 | -------------------------------------------------------------------------------- /Brewfile: -------------------------------------------------------------------------------- 1 | tap "lintje/lintje" 2 | tap "universal-ctags/universal-ctags" 3 | 4 | brew "lintje" 5 | 6 | brew "openssl" 7 | brew "openssh" 8 | 9 | brew "git" 10 | brew "tig" 11 | brew "zsh" 12 | brew "fzf" 13 | 14 | brew "universal-ctags/universal-ctags/universal-ctags", :args => ["HEAD"] 15 | brew "ripgrep" 16 | brew "cloc" 17 | brew "tree" 18 | brew "blueutil" 19 | 20 | brew "vim" 21 | brew "neovim" 22 | 23 | brew "chruby" 24 | brew "ruby-install" 25 | brew "pyenv" 26 | 27 | brew "postgresql@14" 28 | brew "redis" 29 | brew "sqlite" 30 | brew "memcached" 31 | 32 | brew "exa" # ls replacement 33 | brew "bat" # cat replacement 34 | brew "git-delta" 35 | brew "shellcheck" 36 | 37 | # GPG 38 | brew "gnupg" 39 | brew "pinentry-mac" 40 | -------------------------------------------------------------------------------- /vim/.vim/config/linters.vim: -------------------------------------------------------------------------------- 1 | let g:ale_lint_on_text_changed='never' 2 | let g:ale_lint_on_save=1 3 | let g:ale_lint_delay=10 4 | let g:ale_completion_delay=50 5 | let g:ale_lint_on_enter=1 6 | let g:ale_sign_column_always=1 7 | let g:ale_sign_error="✕" 8 | let g:ale_sign_warning="△" 9 | let g:ale_linters={ 10 | \ 'sh': ['shell', 'shellcheck'], 11 | \ 'elixir': ['credo'], 12 | \ 'sass': ['sass-lint'], 13 | \ 'javascript': ['eslint'], 14 | \ 'ruby': ['ruby', 'rubocop'], 15 | \ 'erb': ['erb'], 16 | \ 'rust': ['rustc', 'cargo', 'rustfmt', 'analyzer'], 17 | \ 'markdown': ['vale'], 18 | \} 19 | let g:ale_fixers={ 20 | \ 'ruby': ['rubocop'], 21 | \ 'rust': ['rustfmt'] 22 | \ } 23 | let g:ale_ruby_rubocop_executable='bundle' 24 | let g:ale_set_balloons=0 25 | -------------------------------------------------------------------------------- /git/.gitignore_global: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.com 4 | *.class 5 | *.dll 6 | *.exe 7 | *.o 8 | *.so 9 | 10 | # Packages # 11 | ############ 12 | # it's better to unpack these files and commit the raw source 13 | # git has its own built in compression methods 14 | *.7z 15 | *.dmg 16 | *.gz 17 | *.iso 18 | *.jar 19 | *.rar 20 | *.tar 21 | *.zip 22 | 23 | # Logs and databases # 24 | ###################### 25 | *.log 26 | *.sql 27 | *.sqlite 28 | 29 | # OS generated files # 30 | ###################### 31 | .DS_Store 32 | .DS_Store? 33 | ._* 34 | .Spotlight-V100 35 | .Trashes 36 | ehthumbs.dba 37 | .AppleDouble 38 | 39 | # Other 40 | ###################### 41 | .rbx 42 | config/initializers/opensslhack.rb 43 | .yardoc 44 | /tags 45 | tags.lock 46 | tags.temp 47 | .tool-versions 48 | -------------------------------------------------------------------------------- /vim/.vim/config/nerdtree.vim: -------------------------------------------------------------------------------- 1 | let NERDTreeMinimalUI=1 " Hide UI I don't use 2 | let NERDTreeAutoDeleteBuffer=1 " Delete buffers on move 3 | let NERDTreeShowHidden=1 " Show hidden files in NERDTree 4 | 5 | " Ignore certain files in NERDTree 6 | let NERDTreeIgnore=[ 7 | \ '\.git$', 8 | \ '\.DS_Store$', 9 | \ '\.bundle', 10 | \ 'tmp/', 11 | \ 'coverage', 12 | \ '\.sass-cache', 13 | \ '\.capistrano', 14 | \ '\.yardoc', 15 | \ '^_build$', 16 | \ '^node_modules$', 17 | \ '^__snapshots__$' 18 | \ ] 19 | 20 | " Don't open NERDTree if I open a directory with vim 21 | let g:NERDTreeHijackNetrw=0 22 | 23 | " Open/Close the NERDTree using `Ctrl + T` to toggle. 24 | nmap :NERDTreeToggle 25 | " 'Find in Tree' find currently open buffer file in tree 26 | nmap ft :NERDTreeFind 27 | -------------------------------------------------------------------------------- /vim/.vim/config/switch.vim: -------------------------------------------------------------------------------- 1 | augroup switch_filetypes 2 | autocmd! 3 | 4 | " Don't switch _to_ single quotes, only _from_ single quotes to double quotes 5 | autocmd FileType ruby let b:switch_custom_definitions = 6 | \ [ 7 | \ { 8 | \ '\(scenario\|context\|feature\|describe\) "\(.*\)"\%(, :js\)\@! do': '\1 "\2", :js do', 9 | \ '\(scenario\|context\|feature\|describe\) "\(.*\)", :js do': '\1 "\2" do', 10 | \ }, 11 | \ { 12 | \ '"\(\k\+\%([?!]\)\=\)"': ':\1', 13 | \ '''\(\k\+\%([?!]\)\=\)''': '\"\1\"', 14 | \ ':\(\k\+\%([?!]\)\=\)\@>\%(\s*=>\)\@!': '"\1"\2', 15 | \ }, 16 | \ { 17 | \ '\<\(\k\+\): ': ':\1 => ', 18 | \ ':\(\k\+\)\s\+=>': '"\1" =>', 19 | \ }, 20 | \ ] 21 | augroup END 22 | -------------------------------------------------------------------------------- /zsh/.zsh/key-bindings.zsh: -------------------------------------------------------------------------------- 1 | # iTerm keybindings 2 | bindkey -e # Emacs mode 3 | bindkey '\ew' kill-region 4 | 5 | # Ctrl + r/s - incremental search 6 | bindkey "^r" history-incremental-search-backward 7 | 8 | # TODO: document 9 | bindkey "^[[5~" up-line-or-history 10 | bindkey "^[[6~" down-line-or-history 11 | 12 | # Shift tab reverse completes completions 13 | bindkey "^[[Z" reverse-menu-complete 14 | 15 | # Make search up and down work, so partially type and hit up/down to find relevant stuff 16 | bindkey '^[[A' up-line-or-search 17 | bindkey '^[[B' down-line-or-search 18 | 19 | # Jump words with Alt + arrow 20 | bindkey "^[[1;9C" forward-word 21 | bindkey "^[[1;9D" backward-word 22 | 23 | # Backspace deletes character 24 | bindkey '^?' backward-delete-char 25 | # Delete deletes character 26 | # Delete key (or Fn + Delete on the Mac) work instead of outputting a ~ 27 | bindkey "^[[3~" delete-char 28 | -------------------------------------------------------------------------------- /vim/.vim/UltiSnips/elixir.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | snippet defm "defmodule ... do" 4 | defmodule ${1:module_name} do 5 | ${0:${VISUAL:# functions}} 6 | end 7 | endsnippet 8 | 9 | snippet def "def ... do" 10 | def ${1:func_name} do 11 | ${0:${VISUAL:# object}} 12 | end 13 | endsnippet 14 | 15 | snippet defp "defp ... do" 16 | defp ${1:func_name} do 17 | ${0:${VISUAL:# object}} 18 | end 19 | endsnippet 20 | 21 | snippet "des(cribe)?" "describe name do" r 22 | describe "${1:describe name}" do 23 | ${0:${VISUAL:tests}} 24 | end 25 | endsnippet 26 | 27 | snippet test "test name do" 28 | test "${1:test name}" do 29 | ${0:${VISUAL:assertions}} 30 | end 31 | endsnippet 32 | 33 | snippet pry "IEx.pry" 34 | require IEx; IEx.pry 35 | endsnippet 36 | 37 | snippet puts "IO.puts" 38 | IO.puts ${0:${VISUAL:object}} 39 | endsnippet 40 | 41 | snippet inspect "IO.inspect" 42 | IO.inspect ${0:${VISUAL:object}} 43 | endsnippet 44 | -------------------------------------------------------------------------------- /vim/.vim/UltiSnips/eruby.snippets: -------------------------------------------------------------------------------- 1 | # eruby 2 | 3 | extends html 4 | 5 | snippet % "<% {code} %>" i 6 | <% ${1:code} %>$0 7 | endsnippet 8 | 9 | snippet = "<%= {code} %>" i 10 | <%= ${1:code} %>$0 11 | endsnippet 12 | 13 | snippet if "<% if {condition} %>{code}<% end %>" 14 | <% if ${1:condition} %> 15 | ${0:${VISUAL:code}} 16 | <% end %> 17 | endsnippet 18 | 19 | snippet else "<% else %>" 20 | <% else %> 21 | ${0:${VISUAL:code}} 22 | endsnippet 23 | 24 | snippet elsif "<% elsif {condition} %>" 25 | <% elsif ${1:condition} %> 26 | ${0:${VISUAL:code}} 27 | endsnippet 28 | 29 | snippet each "<% variable.each do |variable| %>" 30 | <% ${1:variable}.each do |${2:variable}| %> 31 | ${0:${VISUAL:code}} 32 | <% end %> 33 | endsnippet 34 | 35 | snippet render "<%= render partial %>" 36 | <%= render "${1:partial}" %>$0 37 | endsnippet 38 | 39 | snippet pry "<% binding.pry %>" 40 | <% require "pry"; binding.pry %>$0 41 | endsnippet 42 | 43 | # vim:ft=snippets: 44 | -------------------------------------------------------------------------------- /bin/retry: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Retry a command until it fails 4 | # 5 | # Usage: 6 | # 7 | # $ until-fail true 8 | # # Will repeat forever 9 | # 10 | # $ until-fail false 11 | # # Fails at the first iteration and breaks out of the retry loop 12 | # 13 | # $ until-fail ruby -e "rand(0..1) == 1 ? (puts 'failed'; exit(1)) : (puts 'success')" 14 | # # Fails randomly and breaks out of the retry loop when it fails 15 | # 16 | # Source: https://gist.github.com/tombruijn/0cde5de10e86d91717ed855623929b05 17 | 18 | if [[ -z "$*" ]]; then 19 | echo "ERROR: No command given to retry" 20 | exit 1 # Error status 21 | fi 22 | 23 | i=0 24 | while true; do 25 | i=$((i + 1)) 26 | echo "================================================================================" 27 | echo "Retry #$i: $*" 28 | echo 29 | # Run command and exit only if it fails 30 | if ! "$@"; then 31 | echo 32 | echo "ERROR: Failure on retry #$i" 33 | exit 1 # Exit loop with error status 34 | fi 35 | done 36 | -------------------------------------------------------------------------------- /zsh/.zsh/site-functions/_commit_format: -------------------------------------------------------------------------------- 1 | #compdef commit-format 2 | 3 | # https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org 4 | # https://mrigank11.github.io/2018/03/zsh-auto-completion/ 5 | 6 | # List local branches by last used 7 | local_branches() { 8 | git for-each-ref --sort=-committerdate --format='%(refname:lstrip=2)' refs/heads/ 9 | } 10 | 11 | _commit_format() { 12 | _arguments '1: :->selector' \ 13 | '-b[select the base branch to compare to]: :->base_branch' \ 14 | '--base-branch[select the base branch to compare to]: :->base_branch' \ 15 | '-n[set maximum number of commits to print]' \ 16 | '--max-count[set maximum number of commits to print]' \ 17 | '-h[print help output]' \ 18 | '--help[print help output]' \ 19 | '-v[print version number]' \ 20 | '--version[print version number]' 21 | 22 | case "$state" in 23 | selector) 24 | _values "Branches" $(local_branches) 25 | ;; 26 | base_branch) 27 | _values "Branches" $(local_branches) 28 | ;; 29 | esac 30 | } 31 | 32 | _commit_format 33 | -------------------------------------------------------------------------------- /vim/.vim/config/fzf.vim: -------------------------------------------------------------------------------- 1 | let $FZF_DEFAULT_OPTS="--color=dark --layout=reverse"" 2 | let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.4 } } 3 | let g:fzf_colors = { 4 | \ 'fg': ['fg', 'Normal'], 5 | \ 'bg': ['bg', 'Normal'], 6 | \ 'hl': ['fg', 'String'], 7 | \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], 8 | \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], 9 | \ 'hl+': ['fg', 'rubyClass'], 10 | \ 'info': ['fg', 'PreProc'], 11 | \ 'prompt': ['fg', 'Directory'], 12 | \ 'pointer': ['fg', 'Directory'], 13 | \ 'marker': ['fg', 'Keyword'], 14 | \ 'spinner': ['fg', 'Label'], 15 | \ 'header': ['fg', 'Comment'] 16 | \ } 17 | 18 | " Shortcuts 19 | nnoremap :Files2 20 | nnoremap :Buffers 21 | nnoremap ; :Commands 22 | nnoremap h :Tags 23 | nnoremap :Rg 24 | 25 | " Favor results with matches at the end first, then the shortest results first 26 | command! -bang -nargs=? -complete=dir Files2 27 | \ call fzf#vim#files(, fzf#vim#with_preview({'options': ['--tiebreak=length,end']}), 0) 28 | -------------------------------------------------------------------------------- /hammerspoon/application_watcher.lua: -------------------------------------------------------------------------------- 1 | local hotkey = require "hs.hotkey" 2 | local alert = require "hs.alert" 3 | local application = require "hs.application" 4 | local Todoist = require "todoist" 5 | 6 | auto_hide = true 7 | hotkey.bind({"cmd", "alt", "ctrl"}, "H", function() 8 | auto_hide = not auto_hide 9 | message = "Auto hide disabled" 10 | if auto_hide then 11 | message = "Auto hide enabled" 12 | end 13 | alert.show(message) 14 | end) 15 | 16 | auto_hide_applications = {"Finder", "Safari", "Telegram", "Tweetbot", "Calendar"} 17 | watcher = application.watcher.new(function(name, event, app) 18 | if name == "Todoist" then 19 | if event == application.watcher.activated then 20 | Todoist.enable(true) 21 | elseif event == application.watcher.deactivated then 22 | Todoist.enable(false) 23 | end 24 | end 25 | 26 | if auto_hide then 27 | if event == application.watcher.deactivated then 28 | for _, value in pairs(auto_hide_applications) do 29 | if name == value then 30 | app:hide() 31 | end 32 | end 33 | end 34 | end 35 | end) 36 | watcher:start() 37 | -------------------------------------------------------------------------------- /hammerspoon/device_watcher.lua: -------------------------------------------------------------------------------- 1 | local usb = require "hs.usb" 2 | local caffeinate = require "hs.caffeinate" 3 | local Keys = require "keys" 4 | local Keyboards = require "keyboards" 5 | local watcher = caffeinate.watcher 6 | 7 | usbWatcher = usb.watcher.new(function(event) 8 | print("event: " .. event.productName) 9 | if Keyboards.isErgodoxKeyboard(event.productName) then 10 | if event.eventType == "added" then 11 | Keyboards.enableErgodoxKeyboard() 12 | elseif event.eventType == "removed" then 13 | Keyboards.enableDefaultKeyboard() 14 | end 15 | end 16 | end) 17 | usbWatcher:start() 18 | 19 | caffeinateWathcer = caffeinate.watcher.new(function(event) 20 | print("event:" .. event) 21 | if event == watcher.screensDidWake or event == watcher.screensDidUnlock then 22 | -- Don't show keyboard change message when nothing changes 23 | if Keyboards.keyboardType() == Keyboards.connectedKeyboardType() then 24 | return 25 | end 26 | 27 | if Keyboards.isErgodoxKeyboardConnected() then 28 | Keyboards.enableErgodoxKeyboard() 29 | else 30 | Keyboards.enableDefaultKeyboard() 31 | end 32 | end 33 | end) 34 | caffeinateWathcer:start() 35 | -------------------------------------------------------------------------------- /hammerspoon/todoist.lua: -------------------------------------------------------------------------------- 1 | local hotkey = require "hs.hotkey" 2 | local application = require "hs.application" 3 | 4 | local projects = require "todoist_projects" 5 | Todoist = { 6 | ["projects"] = projects, 7 | ["shortcuts"] = {} 8 | } 9 | 10 | function openTodoistProject(project) 11 | currentApplication = application.frontmostApplication() 12 | if currentApplication:title() == "Todoist" then 13 | hs.eventtap.keyStroke({"cmd"}, "f") -- Focus search field 14 | hs.eventtap.keyStrokes(project) -- Enter project name 15 | hs.eventtap.keyStroke({}, "return") -- Submit by pressing enter 16 | end 17 | end 18 | 19 | function shortcutFor(index, project) 20 | shortcut = hotkey.bind({"cmd"}, "" .. index, function() 21 | openTodoistProject(project) 22 | end) 23 | -- Disable by default 24 | -- Only enable when Todoist app has focus 25 | shortcut:disable() 26 | table.insert(Todoist.shortcuts, shortcut) 27 | end 28 | 29 | for _, project in pairs(Todoist.projects) do 30 | shortcutFor(project[1], project[2]) 31 | end 32 | 33 | function Todoist.enable(enable) 34 | for _, shortcut in pairs(Todoist.shortcuts) do 35 | if enable then 36 | shortcut:enable() 37 | else 38 | shortcut:disable() 39 | end 40 | end 41 | end 42 | 43 | return Todoist 44 | -------------------------------------------------------------------------------- /zsh/.zsh/completions.zsh: -------------------------------------------------------------------------------- 1 | # Source for some of this: 2 | # https://github.com/robbyrussell/oh-my-zsh/blob/a600ab4b8578ca0a8e6c6dae0373033b9d8c201c/lib/completion.zsh 3 | 4 | export FPATH="$HOME/.zsh/site-functions:${FPATH}" 5 | if type brew &>/dev/null; then 6 | export FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" 7 | fi 8 | 9 | autoload -U compinit 10 | compinit -i 11 | zmodload -i zsh/complist 12 | 13 | # Basic autocompletion 14 | zstyle ':completion:*:*:*:*:*' menu select 15 | # Case-insensitive (all), partial-word and then substring completion 16 | zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*' 17 | 18 | # Don't prompt for a huge list use a page or menu 19 | # Source: https://github.com/twe4ked/dotfiles/blob/b97d56982fe93f732e8cd355a2772a261e82addd/shell/zsh/completion.zsh#L22 20 | zstyle ':completion:*:default' list-prompt '%S%M matches%s' 21 | zstyle ':completion:*:default' menu 'select=0' 22 | 23 | # Use caching so that commands like apt and dpkg complete are useable 24 | zstyle ':completion::complete:*' use-cache 1 25 | zstyle ':completion::complete:*' cache-path $ZSH_DIR/.cache/ 26 | 27 | # # Disable named-directories autocompletion 28 | zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories 29 | -------------------------------------------------------------------------------- /vim/.vim/config/airline.vim: -------------------------------------------------------------------------------- 1 | " Airline should always be visible 2 | " Not just when a split has been created 3 | set laststatus=2 4 | 5 | " Enable cache 6 | " Reset with `:AirlineRefresh` 7 | let g:airline_highlighting_cache=1 8 | 9 | " Only load specific airline extensions 10 | let g:airline_extensions=['tabline'] 11 | 12 | let g:airline_powerline_fonts=1 13 | 14 | " Configure bottom/status bar 15 | let g:airline_skip_empty_sections=1 16 | let g:airline_detect_spell=0 17 | 18 | " Remove noisy symbols 19 | if !exists('g:airline_symbols') 20 | let g:airline_symbols={} 21 | endif 22 | let g:airline_symbols.linenr='' 23 | let g:airline_symbols.maxlinenr='' 24 | 25 | " Clean up sections on the right 26 | let g:airline_section_y=[] 27 | let g:airline_section_z=airline#section#create(['linenr', 'maxlinenr', ' :%3v']) 28 | 29 | " Configure top/tab bar 30 | let g:airline#extensions#tabline#enabled=1 31 | let g:airline#extensions#tabline#show_splits=0 32 | let g:airline#extensions#tabline#show_buffers=0 33 | let g:airline#extensions#tabline#show_tabs=1 34 | let g:airline#extensions#tabline#show_tab_nr=0 35 | let g:airline#extensions#tabline#show_tab_type=0 36 | let g:airline#extensions#tabline#show_tab_count = 0 37 | let g:airline#extensions#tabline#show_close_button=0 38 | let g:airline#extensions#tabline#fnamemod=':t' " Only show filename in tab label 39 | -------------------------------------------------------------------------------- /vim/.vim/config/testing.vim: -------------------------------------------------------------------------------- 1 | " vim-test configuration 2 | 3 | "" Custom iTerm testing strategy 4 | "" This strategy will not add the change in directory and echo to the command. 5 | "" This: `cd /my/path; echo 'the test command'; the test command` 6 | "" Becomes: `the test command` 7 | "" Source: https://github.com/janko-m/vim-test/blob/e730ac7bcd3b45faee6ca212459186583f173792/autoload/test/strategy.vim 8 | "" Functions: `test#strategy#iterm` and `s:execute_script` combined. 9 | function! Custom_iterm(cmd) abort 10 | " Point to osx_iterm_vim_gui script in this directory 11 | let name = 'osx_iterm_vim_gui' 12 | let script_path = g:test#plugin_path . '/../../config/' . name 13 | let cmd = join([script_path, shellescape(a:cmd)]) 14 | execute 'silent !'.cmd 15 | endfunction 16 | 17 | let g:test#enabled_runners = ["ruby#rspec", "rust#cargotest", "elixir#exunit", "javascript#jest"] 18 | let g:test#custom_strategies = {'custom_iterm': function('Custom_iterm')} 19 | let g:test#strategy = 'custom_iterm' 20 | let g:test#javascript#jest#executable = "yarn jest" 21 | 22 | "" Configuration 23 | let g:test#ruby#rspec#options = { 24 | \ 'file': '--format documentation' 25 | \} 26 | 27 | "" Mappings 28 | map t :TestFile 29 | map s :TestNearest 30 | map l :TestLast 31 | map a :TestSuite 32 | -------------------------------------------------------------------------------- /vim/.vim/config/themes.vim: -------------------------------------------------------------------------------- 1 | if has("gui_vimr") 2 | nmap :tabn 3 | nmap :tabp 4 | 5 | set linespace=1 6 | 7 | " Remove toolbar. 8 | set guioptions-=T 9 | set guioptions-=r 10 | set guioptions-=L 11 | 12 | " Remove OSX dialogs, Use Vim's built-in ones instead. 13 | set guioptions+=c 14 | endif 15 | 16 | function! Load_default_theme() 17 | let g:my_theme=0 18 | 19 | let g:airline_theme='solarized' 20 | let g:airline_theme#background='dark' 21 | set listchars=nbsp:␣,tab:▸\ ,extends:»,precedes:«,trail:·,space:· 22 | set background=dark 23 | colorscheme twilight 24 | endfunction 25 | 26 | function! Load_writer_theme() 27 | let g:my_theme=1 28 | execute plug#load('vim-colors-pencil') 29 | 30 | let g:airline_theme='pencil' 31 | let g:airline_theme#background='light' 32 | set listchars=nbsp:␣,tab:▸\ ,extends:»,precedes:«,trail:· 33 | set background=light 34 | colorscheme pencil 35 | endfunction 36 | 37 | let g:pencil_higher_contrast_ui = 0 38 | let g:pencil_neutral_headings = 0 39 | let g:pencil_neutral_code_bg = 0 40 | let g:pencil_gutter_color = 1 41 | let g:pencil_spell_undercurl = 0 42 | 43 | function! Toggle_theme() 44 | if g:my_theme 45 | call Load_default_theme() 46 | else 47 | call Load_writer_theme() 48 | endif 49 | endfunction 50 | 51 | nnoremap W :call Toggle_theme() 52 | -------------------------------------------------------------------------------- /vim/.vim/config/trailing_whitespace.vim: -------------------------------------------------------------------------------- 1 | " Create a list and make invisible chars visible 2 | set list 3 | 4 | " Highlight trailing whitespace as an error 5 | " Source: https://github.com/bronson/vim-trailing-whitespace/blob/733fb64337b6da4a51c85a43450cd620d8b617b5/plugin/trailing-whitespace.vim 6 | augroup whitespace 7 | autocmd! 8 | autocmd ColorScheme * highlight default ExtraWhitespace ctermbg=darkred guibg=#902020 9 | autocmd BufRead,BufNew * match ExtraWhitespace /\\\@StripTrailingWhitespace() 17 | " Don't strip any spaces when the filetype is markdown 18 | if &ft =~ 'markdown' 19 | return 20 | endif 21 | 22 | " Preparation: save last search, and cursor position. 23 | let _s=@/ 24 | let l = line(".") 25 | let c = col(".") 26 | 27 | " Do the business: 28 | %s/\s\+$//e 29 | 30 | " Clean up: restore previous search history, and cursor position 31 | let @/=_s 32 | call cursor(l, c) 33 | endfunction 34 | 35 | augroup trimwhitespace 36 | autocmd! 37 | 38 | " Remove trailing whitespace automatically on save 39 | autocmd BufWritePre * :call StripTrailingWhitespace() 40 | augroup END 41 | -------------------------------------------------------------------------------- /vim/.vim/UltiSnips/sass.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | snippet imp "@import ...;" b 4 | @import "${1:file}" 5 | endsnippet 6 | 7 | snippet ext "@extend %placeholder;" b 8 | @extend %${1:%placeholder} 9 | endsnippet 10 | 11 | snippet mixin "@mixin (...) { ... }" b 12 | =mixin ${1:name}(${2}) 13 | ${VISUAL}$0 14 | endsnippet 15 | 16 | snippet func "@function (...) { ... }" b 17 | @function ${1:name}(${2}) 18 | ${VISUAL}$0 19 | endsnippet 20 | 21 | snippet if "@if (...) { ... }" b 22 | @if ${1:condition} 23 | ${VISUAL}$0 24 | endsnippet 25 | 26 | snippet else "@else { ... }" b 27 | @else ${1:condition} 28 | ${VISUAL}$0 29 | endsnippet 30 | 31 | snippet for "@for loop" b 32 | @for ${1:$i} from ${2:1} through ${3:3} 33 | ${VISUAL}$0 34 | endsnippet 35 | 36 | snippet each "@each loop" b 37 | @each ${1:$item} in ${2:item, item, item} 38 | ${VISUAL}$0 39 | endsnippet 40 | 41 | snippet while "@while loop" b 42 | @while ${1:$i} ${2:>} ${3:0} 43 | ${VISUAL}$0 44 | endsnippet 45 | 46 | snippet hover "&:hover" 47 | &:hover 48 | ${VISUAL}$0 49 | endsnippet 50 | 51 | snippet before "&::before" 52 | &::before 53 | content: "" 54 | ${VISUAL}$0 55 | endsnippet 56 | 57 | snippet after "&::after" 58 | &::after 59 | content: "" 60 | ${VISUAL}$0 61 | endsnippet 62 | 63 | snippet fontt "font: nested" 64 | font: 65 | ${VISUAL}$0 66 | endsnippet 67 | 68 | snippet rgba "color rgba" 69 | rgba(${1:255}, ${2:255}, ${3:255}, ${4:0.5})$0 70 | endsnippet 71 | 72 | # vim:ft=snippets: 73 | -------------------------------------------------------------------------------- /config.ctags: -------------------------------------------------------------------------------- 1 | --exclude=*-lock.json 2 | --exclude=*.bak 3 | --exclude=*.bmp 4 | --exclude=*.cache 5 | --exclude=*.class 6 | --exclude=*.css 7 | --exclude=*.dll 8 | --exclude=*.exe 9 | --exclude=*.flac 10 | --exclude=*.gif 11 | --exclude=*.git 12 | --exclude=*.hg 13 | --exclude=*.ico 14 | --exclude=*.jpg 15 | --exclude=*.json 16 | --exclude=*.less 17 | --exclude=*.lock 18 | --exclude=*.map 19 | --exclude=*.md 20 | --exclude=*.min.* 21 | --exclude=*.mp3 22 | --exclude=*.ogg 23 | --exclude=*.pdb 24 | --exclude=*.pdf 25 | --exclude=*.png 26 | --exclude=*.pyc 27 | --exclude=*.rar 28 | --exclude=*.sln 29 | --exclude=*.svg 30 | --exclude=*.swo 31 | --exclude=*.swp 32 | --exclude=*.tar 33 | --exclude=*.tar.bz2 34 | --exclude=*.tar.gz 35 | --exclude=*.tar.xz 36 | --exclude=*.tmp 37 | --exclude=*.yml 38 | --exclude=*.zip 39 | --exclude=*build*.js 40 | --exclude=*bundle*.js 41 | --exclude=.*rc* 42 | --exclude=.git 43 | --exclude=.yardoc 44 | --exclude=_build 45 | --exclude=bin 46 | --exclude=build 47 | --exclude=bundle 48 | --exclude=cache 49 | --exclude=compiled 50 | --exclude=coverage 51 | --exclude=cscope.* 52 | --exclude=deps 53 | --exclude=dist 54 | --exclude=doc 55 | --exclude=docs 56 | --exclude=example 57 | --exclude=frontend/gulp/node_modules 58 | --exclude=log 59 | --exclude=node_modules 60 | --exclude=pkg 61 | --exclude=public/packs 62 | --exclude=public/packs-test 63 | --exclude=spec/fixtures 64 | --exclude=tags* 65 | --exclude=target 66 | --exclude=tmp 67 | --exclude=vendor 68 | --exclude=yarn.lock 69 | 70 | --languages=-html 71 | --languages=+ruby 72 | --extras=+q+f 73 | --tag-relative=yes 74 | --fields=+ailmnS 75 | --sort=foldcase 76 | 77 | --regex-ruby=/(^|;)[ \t]*(class|module)[ \t]+([A-Z][[:alnum:]_]+(::[A-Z][[:alnum:]_]+)+)/\3/c,class,constant/ 78 | -------------------------------------------------------------------------------- /zsh/.zsh/theme.zsh: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Color configuration 3 | export TERM=xterm-256color 4 | autoload colors 5 | colors 6 | 7 | ## Set ls colors 8 | export LSCOLORS="Gxfxcxdxbxegedabagacad" 9 | ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' 10 | 11 | ############################################################################### 12 | # Git helper functions 13 | 14 | ## Show git branch/tag, or name-rev if on detached head 15 | parse_git_branch() { 16 | (command git symbolic-ref -q HEAD || command git name-rev --name-only --no-undefined --always HEAD) 2>/dev/null 17 | } 18 | 19 | ## Show icon when there are uncommitted changes 20 | parse_git_dirty() { 21 | if command git diff-index --quiet HEAD 2> /dev/null; then 22 | echo "$ZSH_THEME_GIT_PROMPT_CLEAN" 23 | else 24 | echo "$ZSH_THEME_GIT_PROMPT_DIRTY" 25 | fi 26 | } 27 | 28 | ## If in a git repo, show dirty indicator + git branch 29 | git_custom_status() { 30 | local git_where="$(parse_git_branch)" 31 | [ -n "$git_where" ] && echo "$ZSH_THEME_GIT_PROMPT_PREFIX${git_where#(refs/heads/|tags/)}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" || echo " " 32 | } 33 | 34 | ############################################################################### 35 | # Prompt definition 36 | 37 | setopt PROMPT_SUBST # Allow prompt configuration 38 | 39 | ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%} " 40 | ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" 41 | ZSH_THEME_GIT_PROMPT_DIRTY="%{%B$fg[yellow]%}‑%B" 42 | ZSH_THEME_GIT_PROMPT_CLEAN=" " 43 | # Left hand side 44 | PROMPT='%{$fg[blue]%}%2~$(git_custom_status)%(?.%{$fg[blue]%}.%{$fg[red]%})› %{$reset_color%}' 45 | # Right hand side 46 | RPS1='' 47 | -------------------------------------------------------------------------------- /zsh/.zsh/termsupport.zsh: -------------------------------------------------------------------------------- 1 | # Set terminal window and tab/icon title 2 | # 3 | # usage: title short_tab_title [long_window_title] 4 | # 5 | # See: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1 6 | # Fully supports screen, iterm, and probably most modern xterm and rxvt 7 | # (In screen, only short_tab_title is used) 8 | # Source: https://github.com/robbyrussell/oh-my-zsh/blob/192de6bcffb0294e19f4203f6f7dc1a7f3e427be/lib/termsupport.zsh 9 | function title { 10 | emulate -L zsh 11 | setopt prompt_subst 12 | 13 | [[ "$EMACS" == *term* ]] && return 14 | 15 | # if $2 is unset use $1 as default 16 | # if it is set and empty, leave it as is 17 | : ${2=$1} 18 | 19 | if [[ "$TERM" == screen* ]]; then 20 | print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars 21 | elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then 22 | print -Pn "\e]2;$2:q\a" #set window name 23 | print -Pn "\e]1;$1:q\a" #set icon (=tab) name 24 | fi 25 | } 26 | 27 | ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" # 15 char left truncated PWD 28 | ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" 29 | 30 | # Appears when you have the prompt 31 | function termsupport_precmd { 32 | title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE 33 | } 34 | 35 | # Appears at the beginning of (and during) of command execution 36 | function termsupport_preexec { 37 | emulate -L zsh 38 | setopt extended_glob 39 | 40 | # cmd name only, or if this is sudo or ssh, the next cmd 41 | local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%} 42 | local LINE="${2:gs/%/%%}" 43 | 44 | title '$CMD' '%100>...>$LINE%<<' 45 | } 46 | 47 | precmd_functions+=(termsupport_precmd) 48 | preexec_functions+=(termsupport_preexec) 49 | -------------------------------------------------------------------------------- /hammerspoon/keyboards.lua: -------------------------------------------------------------------------------- 1 | local usb = require "hs.usb" 2 | local alert = require "hs.alert" 3 | local Keys = require "keys" 4 | 5 | Keyboards = {} 6 | 7 | local ergodoxKeyboardName = "ErgoDox EZ Shine" 8 | 9 | function Keyboards.keyboardType() 10 | if not Keyboards.keyboard then 11 | Keyboards.keyboard = "normal" 12 | end 13 | return Keyboards.keyboard 14 | end 15 | 16 | function Keyboards.isCurrentKeyboardErgodox() 17 | return Keyboards.keyboardType() == "ergodox" 18 | end 19 | 20 | function Keyboards.toggleKeyboard() 21 | if Keyboards.keyboardType() == "normal" then 22 | Keyboards.enableErgodoxKeyboard() 23 | else 24 | Keyboards.enableDefaultKeyboard() 25 | end 26 | end 27 | 28 | function Keyboards.enableErgodoxKeyboard() 29 | Keyboards.keyboard = "ergodox" 30 | Keyboards.updateKeyboardTriggers() 31 | end 32 | 33 | function Keyboards.enableDefaultKeyboard() 34 | Keyboards.keyboard = "normal" 35 | Keyboards.updateKeyboardTriggers() 36 | end 37 | 38 | function Keyboards.updateKeyboardTriggers() 39 | alert.show("Keyboard: " .. Keyboards.keyboardType()) 40 | Keys.deactivateKeys() 41 | Keys.activateKeys() 42 | end 43 | 44 | function Keyboards.isErgodoxKeyboard(deviceName) 45 | return deviceName == ergodoxKeyboardName 46 | end 47 | 48 | function Keyboards.connectedKeyboardType() 49 | local ergodoxFound = false 50 | for _, device in pairs(usb.attachedDevices()) do 51 | if Keyboards.isErgodoxKeyboard(device.productName) then 52 | ergodoxFound = true 53 | end 54 | end 55 | 56 | if ergodoxFound then 57 | return "ergodox" 58 | else 59 | return "normal" 60 | end 61 | end 62 | 63 | function Keyboards.isErgodoxKeyboardConnected() 64 | return Keyboards.connectedKeyboardType() == "ergodox" 65 | end 66 | 67 | if Keyboards.isErgodoxKeyboardConnected() then 68 | Keyboards.enableErgodoxKeyboard() 69 | end 70 | 71 | return Keyboards 72 | -------------------------------------------------------------------------------- /vim/.vim/UltiSnips/html.snippets: -------------------------------------------------------------------------------- 1 | # HTML snippets 2 | 3 | priority -50 4 | 5 | snippet !!! "HTML 5.0 setup" b 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | $0 16 | 17 | 18 | endsnippet 19 | 20 | snippet < "" 21 | <${1:element}>$0 22 | endsnippet 23 | 24 | snippet !c "" 25 | $0 26 | endsnippet 27 | 28 | snippet !t "" 29 | $0 30 | endsnippet 31 | 32 | snippet h1 "

" w 33 |

$0

34 | endsnippet 35 | 36 | snippet h2 "

" w 37 |

$0

38 | endsnippet 39 | 40 | snippet h3 "

" w 41 |

$0

42 | endsnippet 43 | 44 | snippet h4 "

" w 45 |

$0

46 | endsnippet 47 | 48 | snippet p "

" w 49 |

$0

50 | endsnippet 51 | 52 | snippet div "
" w 53 |
$0
54 | endsnippet 55 | 56 | snippet span "" w 57 | $0 58 | endsnippet 59 | 60 | snippet ul "
    " w 61 |
      62 | $0 63 |
    64 | endsnippet 65 | 66 | snippet ol "
      " w 67 |
        68 | $0 69 |
      70 | endsnippet 71 | 72 | snippet li "
    1. " w 73 |
    2. $0
    3. 74 | endsnippet 75 | 76 | snippet table "" w 77 |
      78 | 79 | 80 | 81 | 82 | 83 |
      $0
      84 | endsnippet 85 | 86 | snippet tr "" w 87 | 88 | $0 89 | 90 | endsnippet 91 | 92 | snippet th "" w 93 | 94 | $0 95 | 96 | endsnippet 97 | 98 | snippet td "" w 99 | 100 | $0 101 | 102 | endsnippet 103 | 104 | snippet a "" w 105 | ${0:${VISUAL:Anchor Text}} 106 | endsnippet 107 | 108 | snippet = "attribute" w 109 | ${1:attribute}="${2:value}"$0 110 | endsnippet 111 | 112 | # vim:ft=snippets: 113 | -------------------------------------------------------------------------------- /hammerspoon/window_management.lua: -------------------------------------------------------------------------------- 1 | local hotkey = require "hs.hotkey" 2 | local window = require "hs.window" 3 | local screen = require "hs.screen" 4 | local alert = require "hs.alert" 5 | local keys = require "keys" 6 | 7 | window.animationDuration = 0 8 | 9 | local positions = { 10 | fullscreen = { x = 0.00, y = 0.00, w = 1.00, h = 1.00 }, 11 | 12 | right50 = { x = 0.50, y = 0.00, w = 0.50, h = 1.00 }, 13 | left50 = { x = 0.00, y = 0.00, w = 0.50, h = 1.00 }, 14 | top50 = { x = 0.00, y = 0.00, w = 1.00, h = 0.50 }, 15 | bottom50 = { x = 0.00, y = 0.50, w = 1.00, h = 0.50 }, 16 | right33 = { x = (1 / 3) * 2, y = 0.00, x2 = 1.00, h = 1.00 }, 17 | left33 = { x = 0.00, y = 0.00, w = 1 / 3, h = 1.00 }, 18 | 19 | bottomCenter50 = { x = 0.25, y = 0.50, w = 0.50, h = 0.50 } 20 | } 21 | 22 | function alertCannotManipulateWindow() 23 | alert.show("Can't move window") 24 | end 25 | 26 | function move(position) 27 | local win = window.focusedWindow() 28 | if not win then 29 | alertCannotManipulateWindow() 30 | return 31 | end 32 | win:move(position, nil, true) 33 | end 34 | 35 | keys.bindKeyFor("Fullscreen window", function() 36 | move(positions.fullscreen) 37 | end) 38 | 39 | keys.bindKeyFor("Center window", function() 40 | window.focusedWindow():centerOnScreen(nil, true) 41 | end) 42 | 43 | keys.bindKeyFor("Left 50% window", function() 44 | move(positions.left50) 45 | end) 46 | 47 | keys.bindKeyFor("Right 50% window", function() 48 | move(positions.right50) 49 | end) 50 | 51 | keys.bindKeyFor("Left 33% window", function() 52 | move(positions.left33) 53 | end) 54 | 55 | keys.bindKeyFor("Right 33% window", function() 56 | move(positions.right33) 57 | end) 58 | 59 | keys.bindKeyFor("Bottom center 25% window", function() 60 | move(positions.bottomCenter50) 61 | end) 62 | 63 | keys.bindKeyFor("Move window display left", function() 64 | local win = hs.window.focusedWindow() 65 | if not win then 66 | alertCannotManipulateWindow() 67 | return 68 | end 69 | win:moveOneScreenWest() 70 | end) 71 | 72 | keys.bindKeyFor("Move window display right", function() 73 | local win = hs.window.focusedWindow() 74 | if not win then 75 | alertCannotManipulateWindow() 76 | return 77 | end 78 | win:moveOneScreenEast() 79 | end) 80 | -------------------------------------------------------------------------------- /zsh/.zsh/aliases.zsh: -------------------------------------------------------------------------------- 1 | # Lazy me 2 | alias reload="source $HOME/.zshrc" 3 | alias sudo="nocorrect sudo" 4 | alias vim="nvim" 5 | 6 | alias lock="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend" 7 | alias la="exa -la --group-directories-first --octal-permissions --no-permissions --git --time-style='long-iso'" 8 | alias l="less" 9 | alias lf="less +F" 10 | 11 | alias cop="be rubocop" 12 | alias cov="open coverage/index.html" 13 | 14 | # Directory shortcuts 15 | alias c="cd" 16 | alias desk="cd $HOME/Desktop" 17 | alias tdb="cd $HOME/tombruijn/" 18 | alias pro="cd $HOME/projects/" 19 | alias dot="cd $HOME/tombruijn/dotfiles" 20 | alias exp="cd $HOME/projects/experiments" 21 | 22 | # Small utilities 23 | postgres_path="/opt/homebrew/var/postgresql@14/" 24 | alias flushdns="sudo discoveryutil mdnsflushcache" 25 | alias pgstart="pg_ctl -D $postgres_path -l $postgres_path/server.log start" 26 | alias pgstop="pg_ctl -D $postgres_path stop -s -m fast" 27 | alias redis="redis-server /opt/homebrew/etc/redis.conf" 28 | alias md="open -a \"iA Writer.app\"" 29 | 30 | # Git 31 | alias g="fork open" 32 | alias t="tig" 33 | alias ts="tig status" 34 | alias gs="git status -sb" 35 | alias gdw="git diff --ignore-all-space --word-diff=color" 36 | alias gf="git-fixup" 37 | alias gb="git branch" 38 | alias gc="git checkout" 39 | alias gm="git merge" 40 | alias gpu="git push" 41 | alias gpo="git push origin" 42 | alias gpl="git pull" 43 | alias grv="git remote -v" 44 | alias gri="git rebase --interactive --autosquash" 45 | alias gra="git rebase --abort" 46 | alias grc="git rebase --continue" 47 | alias gsl="git stash list" 48 | alias gsd="git stash drop" 49 | alias gsp="git stash pop" 50 | alias gsa="git stash --include-untracked" 51 | 52 | # Bundle exec 53 | alias be="bundle exec" 54 | alias br="be rspec" 55 | alias cbr="COV=1 be rspec" 56 | alias fs="be foreman start" 57 | 58 | # Rake tasks 59 | alias rake="noglob rake" # allows square brackets for rake task invocation 60 | 61 | # Rails 62 | alias PROD="RAILS_ENV=production" 63 | alias TEST="RAILS_ENV=test" 64 | alias DEV="RAILS_ENV=development" 65 | 66 | alias rs="bundle exec rails server -b 0.0.0.0" 67 | alias rc="bundle exec rails console" 68 | 69 | alias rr="bundle exec rake routes" 70 | alias rdm="bundle exec rake db:migrate" 71 | alias rdr="bundle exec rake db:migrate:reset" 72 | alias rdsd="rdr && SEED_DEMO=1 bundle exec rake db:seed" 73 | -------------------------------------------------------------------------------- /git/.tigrc: -------------------------------------------------------------------------------- 1 | # .tigrc - Configuration for tig - https://github.com/jonas/tig 2 | # Full .tigrc example here: https://github.com/jonas/tig/blob/eecfbda7f510ed0b98d146a1aded7c004d3ddb54/tigrc 3 | 4 | # Views 5 | set main-view = line-number:no id:no date:default,width=17 \ 6 | author:email-user,width=12 \ 7 | commit-title:display=yes,graph=v2,refs=true,overflow=yes 8 | set diff-view = line-number:no text:yes,commit-title-overflow=yes 9 | 10 | # UI display settings 11 | set show-changes = yes 12 | set wrap-lines = yes 13 | set tab-size = 2 14 | set line-graphics = utf-8 15 | 16 | # Settings controlling how content is read from Git 17 | set commit-order = auto 18 | set status-show-untracked-dirs = yes 19 | set show-notes = yes 20 | set diff-context = 5 21 | set log-options = --pretty=raw 22 | set main-options = -n 1000 --all # User-defined options for `tig` (git-log) 23 | 24 | # Misc 25 | set ignore-case = yes # Ignore case in search 26 | set wrap-search = yes # Search entire pane 27 | set focus-child = yes # Focus on new pane when opened 28 | set split-view-height = 70% 29 | set vertical-split = horizontal 30 | set editor-line-number = yes 31 | set mouse = no 32 | 33 | # Custom commands 34 | bind generic F none 35 | bind main F none 36 | bind main Ff :set main-options = -n 1000 37 | bind main Fg :set main-options = -n 1000 --all 38 | 39 | bind status C !git commit --gpg-sign --verbose 40 | bind status A !git commit --gpg-sign --amend --verbose 41 | bind status F !git-fixup 42 | bind generic D none 43 | bind status D none 44 | bind status D ?@rm %(file) 45 | 46 | bind refs C ?git checkout %(branch) 47 | bind refs ! ?git branch -D %(branch) 48 | 49 | # Normal commands 50 | ## Option manipulation 51 | bind generic o enter 52 | 53 | # Colors 54 | color cursor white color235 bold 55 | color status green default 56 | 57 | color "diff --" blue default 58 | color "--- " black default bold 59 | color "+++ " black default bold 60 | color "@@" yellow default 61 | color "index " black default bold 62 | color "diff-tree " blue default 63 | color "Author: " black default bold 64 | color "Commit: " black default bold 65 | color "AuthorDate: " black default bold 66 | color "CommitDate: " black default bold 67 | color "TaggerDate: " black default bold 68 | color "Refs: " black default bold 69 | color "commit " black default bold 70 | color "author " green default 71 | 72 | color title-blur white color25 bold 73 | color title-focus white color237 74 | 75 | color main-tag magenta default bold 76 | color main-ref cyan default 77 | color main-head cyan default bold 78 | color graph-commit blue default 79 | 80 | color stat-none default default 81 | color stat-staged green default 82 | color stat-unstaged yellow default 83 | color stat-untracked magenta default 84 | 85 | color help-action cyan default 86 | 87 | color directory cyan default 88 | -------------------------------------------------------------------------------- /vim/.vim/config/autocomplete.vim: -------------------------------------------------------------------------------- 1 | " Autopairs 2 | let g:AutoPairsMultilineClose=0 3 | 4 | " Snippets config 5 | " Bound to C-J/K because TAB is used by autocomplete. 6 | let g:UltiSnipsExpandTrigger="" 7 | let g:UltiSnipsJumpForwardTrigger="" 8 | let g:UltiSnipsJumpBackwardTrigger="" 9 | 10 | let g:ultisnips_loaded = 0 " Global variable that checks if UltiSnips is loaded or not 11 | " Load UltiSnips when it is not already loaded when is pressed in insert 12 | " mode. 13 | " Source: https://github.com/saaguero/dotvim/blob/44c3bbc9b2996fcf7e86f624785a3a06ca978167/.vimrc#L60-L69 14 | inoremap =LoadUltiSnips() 15 | 16 | function! LoadUltiSnips() 17 | let l:curpos = getcurpos() 18 | if (g:ultisnips_loaded == 0) 19 | execute plug#load('ultisnips') 20 | let g:ultisnips_loaded = 1 21 | end 22 | call cursor(l:curpos[1], l:curpos[2]) 23 | call UltiSnips#ExpandSnippet() 24 | return "" 25 | endfunction 26 | 27 | " Load UltiSnips when is pressed in a visual selection. 28 | " - `` clears the characters at the beginning of the command (:) line. 29 | " Avoids the function being called multiple times (for every line). 30 | " - `call LoadUltiSnipsVisualMode()` loads UltiSnips and makes sure the 31 | " selection is saved for when we call UltiSnips manually. 32 | " - `` Confirms the command line (:) 33 | " - `gv` reselects the selection 34 | " - `s` replaces the selection 35 | " - Now when a snippet alias is typed and is pressed again, the selection 36 | " is wrapped in the snippet. 37 | vnoremap :call LoadUltiSnipsVisualMode()gvs 38 | 39 | function! LoadUltiSnipsVisualMode() 40 | if (g:ultisnips_loaded == 0) 41 | execute plug#load('ultisnips') 42 | call UltiSnips#SaveLastVisualSelection() 43 | let g:ultisnips_loaded = 1 44 | end 45 | endfunction 46 | 47 | " Autocomplete 48 | set wildmenu " Enhanced command line completion. 49 | set wildmode=list:longest " Complete files like a shell. 50 | set shortmess+=c " Turn off completion messages 51 | set completeopt=menu,menuone,preview,noinsert,noselect 52 | " Completion options 53 | " :help cpt 54 | " .: Current buffer 55 | " b: Loaded buffers 56 | " u: Unloaded buffers 57 | " t: Tags 58 | set complete=.,w,b,u,t 59 | 60 | " mucomplete 61 | let g:mucomplete#enable_auto_at_startup = 1 62 | let g:mucomplete#chains = { 63 | \ 'default': ['c-n', 'omni', 'uspl', 'path', 'tags', 'ulti'], 64 | \ 'gitcommit': ['c-n', 'uspl', 'path'] 65 | \ } 66 | let g:mucomplete#no_mappings = 1 67 | let g:mucomplete#no_popup_mappings = 1 68 | let g:mucomplete#spel#max = 10 69 | 70 | " Configure TAB and SHIFT-TAB to also function as CTRL-N and CTRL-P 71 | imap (MUcompleteFwd) 72 | imap (MUcompleteBwd) 73 | 74 | " Cycle completion methods 75 | inoremap (MUcompleteFwdKey) 76 | imap (MUcompleteCycFwd) 77 | -------------------------------------------------------------------------------- /zsh/.zsh/functions.zsh: -------------------------------------------------------------------------------- 1 | # Open things 2 | # 3 | # Usage: 4 | # 5 | # $ o 6 | # # Open the current directory in Finder.app 7 | # 8 | # $ o README.md 9 | # # Open the "README.md" file its the preferred application 10 | function o { 11 | if [[ -n "$1" ]]; then 12 | open $1 13 | else 14 | open . 15 | fi 16 | } 17 | 18 | # Open files in my preferred editor 19 | # 20 | # Usage: 21 | # 22 | # $ e 23 | # # Open the current directly in the editor 24 | # 25 | # $ e README.md 26 | # # Open the "README.md" file in the editor 27 | function e { 28 | /Applications/MacVim.app/Contents/bin/mvim $1 29 | } 30 | 31 | # AppSignal cd + function helper 32 | # 33 | # Usage: 34 | # 35 | # $ a 36 | # # cd to ~/appsignal 37 | # 38 | # $ a server 39 | # # cd to ~/appsignal/server 40 | # 41 | # $ a function 42 | # # perform "function" 43 | function a { 44 | if [[ -n "$1" ]]; then 45 | echo "Error: Use \`c\` instead" 46 | false 47 | else 48 | cd ~/appsignal 49 | fi 50 | } 51 | 52 | # Copy things onto the system clipboard 53 | # 54 | # With the `-s` option it will strip off any newlines from the string. So it's 55 | # not recommended of multi line strings. 56 | # 57 | # Usage: 58 | # 59 | # $ echo "foo" | copy 60 | # $ echo "foo" | copy -s 61 | # 62 | # macOS only 63 | function copy { 64 | strip="false" 65 | option="$1" 66 | if [[ "$option" == "-s" ]]; then 67 | strip="true" 68 | fi 69 | 70 | # Copy STDIN to function to clipboard 71 | if [[ "$strip" == "true" ]]; then 72 | tr -d '\n' | pbcopy 73 | else 74 | pbcopy 75 | fi 76 | 77 | echo "Copied to clipboard: $(pbpaste)" 78 | } 79 | 80 | # Create directory and navigate into it 81 | function mk { 82 | mkdir "$1" && cd "$1" 83 | } 84 | 85 | # Toggle Chrome headless testing with param 86 | function headless { 87 | if [[ "$CHROME_HEADLESS" == "false" ]]; then 88 | echo "🔮😰 Running headless" 89 | unset CHROME_HEADLESS 90 | else 91 | echo "🖥 🍿 Running in foreground" 92 | export CHROME_HEADLESS=false 93 | fi 94 | } 95 | 96 | # Wrapper around the commit_format gem 97 | # 98 | # Make sure commit_format is installed. Use a specific Ruby version so that it 99 | # only needs to be installed once on the system, instead of for whatever Ruby 100 | # version is currently being used. 101 | function cf { 102 | ruby_version="ruby-3.1" 103 | if [ ! chruby-exec "$ruby_version" -- gem list commit_format --installed &> /dev/null ]; then 104 | chruby-exec "$ruby_version" -- gem install commit_format 105 | fi 106 | chruby-exec "$ruby_version" -- commit-format "$@" | pbcopy 107 | } 108 | 109 | # Docker shorthands 110 | # 111 | # Mostly removal commands. 112 | 113 | # Stop all containers 114 | function dstop { 115 | docker stop $(docker ps -a -q) 116 | } 117 | 118 | # Remove all docker containers 119 | function drm { 120 | docker rm $(docker ps -a -q) 121 | } 122 | 123 | # Remove all docker images 124 | function drmi { 125 | docker rmi $(docker images -q) 126 | } 127 | -------------------------------------------------------------------------------- /vim/.vim/config/files.vim: -------------------------------------------------------------------------------- 1 | " Global vim projectionist config. 2 | " Applies to all "projects" that are opened. 3 | let g:projectionist_heuristics = { 4 | \ "Gemfile": { 5 | \ "lib/*.rb": { 6 | \ "type": "source", 7 | \ "alternate": "spec/lib/{dirname}/{basename}_spec.rb" 8 | \ }, 9 | \ "spec/*_spec.rb": { 10 | \ "type": "test", 11 | \ "alternate": "{dirname}/{basename}.rb" 12 | \ } 13 | \ }, 14 | \ "mix.exs": { 15 | \ "lib/*.ex": { 16 | \ "type": "source", 17 | \ "alternate": ["test/lib/{dirname}/{basename}_test.exs", "test/{dirname}/{basename}_test.exs"] 18 | \ }, 19 | \ "test/*_test.exs": { 20 | \ "type": "test", 21 | \ "alternate": "{dirname}/{basename}.ex" 22 | \ } 23 | \ }, 24 | \ "packages/*/tsconfig.json": { 25 | \ "packages/**/__tests__/*.test.ts": { 26 | \ "type": "test", 27 | \ "alternate": "packages/{dirname}/{basename}.ts" 28 | \ }, 29 | \ "*.ts": { 30 | \ "type": "source", 31 | \ "alternate": "{dirname}/__tests__/{basename}.test.ts" 32 | \ }, 33 | \ }, 34 | \ "packages/*/package.json": { 35 | \ "packages/**/__tests__/*.test.js": { 36 | \ "type": "test", 37 | \ "alternate": "packages/{dirname}/{basename}.js" 38 | \ }, 39 | \ "*.js": { 40 | \ "type": "source", 41 | \ "alternate": "{dirname}/__tests__/{basename}.test.js" 42 | \ }, 43 | \ }, 44 | \ "app/frontend/javascripts/": { 45 | \ "app/frontend/javascripts/*.js": { 46 | \ "type": "source", 47 | \ "alternate": "spec/javascripts/{dirname}/{basename}.test.js" 48 | \ }, 49 | \ "spec/javascripts/*.test.js": { 50 | \ "type": "test", 51 | \ "alternate": "app/frontend/javascripts/{dirname}/{basename}.js" 52 | \ } 53 | \ } 54 | \ } 55 | 56 | let g:jsx_ext_required = 0 " Don't require .jsx ext for JSX plugin 57 | let g:ruby_indent_block_style = 'do' " Indent lines by block `do`-statement 58 | let g:ruby_spellcheck_strings = 1 59 | let g:ruby_space_errors = 1 60 | 61 | " Disable auto JavaScript highlighting 62 | " Customized in theme with `jsx*` highlights below 63 | let g:vim_jsx_pretty_enable_jsx_highlight = 0 64 | let g:vim_jsx_pretty_colorful_config = 0 65 | 66 | augroup javascript_jsx_customization 67 | autocmd! 68 | autocmd ColorScheme * hi link jsxTag Function 69 | autocmd ColorScheme * hi link jsxTagName Function 70 | autocmd ColorScheme * hi link jsxCloseTag Function 71 | autocmd ColorScheme * hi link jsxCloseString Function 72 | augroup END 73 | 74 | augroup filetypes 75 | " Clear this group's autocmds if previously set 76 | autocmd! 77 | 78 | " Ruby 79 | autocmd BufRead,BufNewFile {Rakefile,Gemfile,*.gemfile,config.ru,Vagrantfile,Thorfile,Brewfile,*.jpbuilder} 80 | \ set ft=ruby 81 | 82 | " JavaScript 83 | autocmd BufRead,BufNewFile {*/app/frontend/javascripts/components/**/*.js} 84 | \ set ft=javascriptreact 85 | 86 | " Sass/Scss 87 | autocmd BufRead,BufNewFile *.sass set ft=sass.css 88 | autocmd BufRead,BufNewFile *.scss set ft=scss.css 89 | autocmd BufRead,BufNewFile Dockerfile.* set ft=Dockerfile 90 | augroup END 91 | -------------------------------------------------------------------------------- /install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Configure shared config dir 4 | XDG_CONFIG_HOME="$HOME/.config" 5 | mkdir -p "$XDG_CONFIG_HOME" 6 | 7 | # Set up symlinks 8 | ln -nfs "$(pwd)/ruby/.gemrc" "$HOME/.gemrc" 9 | ln -nfs "$(pwd)/ruby/.irbrc" "$HOME/.irbrc" 10 | 11 | ln -nfs "$(pwd)/zsh/.zshrc" "$HOME/.zshrc" 12 | ln -nfs "$(pwd)/zsh/.zsh" "$HOME/.zsh" 13 | ln -nfs "$(pwd)/.ruby-version" "$HOME/.ruby-version" 14 | mkdir -p "$HOME/.bundle" 15 | ln -nfs "$(pwd)/ruby/bundle/config" "$HOME/.bundle/config" 16 | 17 | mkdir -p "$HOME/.bin" 18 | ln -nfs "$(pwd)/bin/git-fixup" "$HOME/.bin/git-fixup" 19 | ln -nfs "$(pwd)/bin/retry" "$HOME/.bin/retry" 20 | 21 | ln -nfs "$(pwd)/vim/.vimrc" "$HOME/.vimrc" 22 | ln -nfs "$(pwd)/vim/.gvimrc" "$HOME/.gvimrc" 23 | ln -nfs "$(pwd)/vim/.vim" "$HOME/.vim" 24 | ln -nfs "$(pwd)/vim/.vim" "$XDG_CONFIG_HOME/nvim" 25 | ln -nfs "$(pwd)/cloc/" "$XDG_CONFIG_HOME/cloc" 26 | ln -nfs "$(pwd)/hammerspoon" "$HOME/.hammerspoon" 27 | 28 | ln -nfs "$(pwd)/.ignore_global" "$HOME/.ignore" 29 | mkdir -p "$XDG_CONFIG_HOME/git" 30 | ln -nfs "$(pwd)/git/.gitignore_global" "$XDG_CONFIG_HOME/git/.gitignore_global" 31 | mkdir -p "$XDG_CONFIG_HOME/tig" 32 | ln -nfs "$(pwd)/git/.tigrc" "$XDG_CONFIG_HOME/tig/config" 33 | mkdir -p "$XDG_CONFIG_HOME/ripgrep" 34 | ln -nfs "$(pwd)/.ripgreprc" "$XDG_CONFIG_HOME/ripgrep/.ripgreprc" 35 | mkdir -p "$XDG_CONFIG_HOME/bat" 36 | ln -nfs "$(pwd)/bat/config" "$XDG_CONFIG_HOME/bat/config" 37 | ln -nfs "$HOME/Library/Mobile Documents/com~apple~CloudDocs/vim/spell" "$HOME/.vim/spell" 38 | mkdir -p "$HOME/.VIM_UNDO_FILES" 39 | 40 | mkdir -p "$HOME/.gnupg" 41 | ln -nfs "$(pwd)/.gnupg/gpg.conf" "$HOME/.gnupg/gpg.conf" 42 | ln -nfs "$(pwd)/.gnupg/gpg-agent.conf" "$HOME/.gnupg/gpg-agent.conf" 43 | 44 | mkdir -p "$HOME/.ctags.d" 45 | ln -nfs "$(pwd)/config.ctags" "$HOME/.ctags.d/config.ctags" 46 | 47 | # Silence login message on Shell start 48 | touch $HOME/.hushlogin 49 | 50 | # Copy powerlines 51 | for file in ./powerline-fonts/Meslo/*.otf; do 52 | cp -f "$file" "$HOME/Library/Fonts/" 53 | done 54 | 55 | # https://github.com/postmodern/chruby/issues/196#issuecomment-23826171 56 | [[ -e /etc/zshenv ]] && sudo mv /etc/zshenv /etc/zprofile 57 | 58 | git config --global user.email "tom@tomdebruijn.com" 59 | git config --global user.name "Tom de Bruijn" 60 | git config --global core.excludesfile "$XDG_CONFIG_HOME/git/.gitignore_global" 61 | git config --global color.diff always 62 | git config --global merge.ff only 63 | git config --global pull.ff only 64 | git config --global push.default current 65 | git config --global remote.origin.prune true 66 | git config --global merge.conflictstyle diff3 67 | git config --global diff.noprefix true 68 | # Allow use of markdown headers before git commit message scissors, after which 69 | # the code starts. 70 | git config --global commit.cleanup scissors 71 | git config --global init.defaultBranch main 72 | git config --global checkout.defaultRemote origin 73 | git config --global push.autoSetupRemote true 74 | 75 | if [ -n "$GPG_SIGNING_KEY" ]; then 76 | git config --global user.signingkey $GPG_SIGNING_KEY 77 | git config --global commit.gpgsign true 78 | else 79 | echo "WARNING: Git GPG configuration skipped. No \$GPG_SIGNING_KEY found." 80 | fi 81 | -------------------------------------------------------------------------------- /vim/.vim/config/shortcuts.vim: -------------------------------------------------------------------------------- 1 | " Reload .vimrc 2 | nnoremap r :source ~/.vimrc:nohl 3 | 4 | " Cycle through splits with tab 5 | nmap w 6 | 7 | " Easier direct split navigation with ctrl + homerow keys 8 | nnoremap 9 | nnoremap 10 | nnoremap 11 | nnoremap 12 | 13 | " Maximize current split 14 | nnoremap - _ 15 | " Equalize splits 16 | nnoremap = = 17 | 18 | " Open Ack search on `Command + /` 19 | nnoremap :Ack! 20 | nnoremap / :Ack! 21 | 22 | " Toggle comments on `Command/Leader + \` 23 | nnoremap :TComment 24 | nnoremap \ :TComment 25 | vnoremap :TComment 26 | vnoremap \ :TComment 27 | 28 | " Toggle spellcheck with F6 29 | noremap :set spell! spell? 30 | 31 | " Navigate to the next-previous ALE error 32 | nmap [w (ale_previous_wrap) 33 | nmap ]w (ale_next_wrap) 34 | 35 | " Easier start/end of line navigation 36 | nnoremap H ^ 37 | nnoremap L g_ 38 | vnoremap H ^ 39 | vnoremap L g_ 40 | 41 | " Copy line without line ending 42 | nmap yl 0y$ 43 | nmap cl 0d$"_dd 44 | 45 | " Remove full line with d 46 | nmap d "_dd 47 | vmap d "_d 48 | 49 | " Use F for formatting the current paragraph (or selection) 50 | " Source: http://nvie.com/posts/how-i-boosted-my-vim/ 51 | vmap F gq 52 | nmap F gqap 53 | 54 | " Go to next editor row instead of wrapped line 55 | " Source: http://nvie.com/posts/how-i-boosted-my-vim/ 56 | nnoremap j gj 57 | nnoremap k gk 58 | 59 | " Map D+[ and D+] to change indenting 60 | " Source: https://github.com/carlhuda/janus/blob/68a5d818d2ef99a2e224657394adc79d909180df/janus/vim/core/before/plugin/mappings.vim#L58-68 61 | vmap >gv 63 | nmap << 64 | nmap >> 65 | " Stay in visual mode while indenting with < and > 66 | vmap < >gv 68 | 69 | " Open previous edited file 70 | nnoremap :e # 71 | 72 | " Quickfix window open and close 73 | nmap fs :cclose 74 | nmap fd :copen 75 | 76 | " EasyAlign shortcuts 77 | xmap ga (EasyAlign) 78 | nmap ga (EasyAlign) 79 | 80 | " Disable K command. Don't use the feature. 81 | map K 82 | 83 | " Paste without overwriting the clipboard with selection 84 | vnoremap p "_dP 85 | 86 | " Send single characters to black hole on deletion 87 | nnoremap x v"_d 88 | " Send selection characters to black hole on deletion 89 | vnoremap x "_d 90 | 91 | " Write buffer on w 92 | nnoremap w :w 93 | 94 | " Jump paragraph by beginning and end rather than the empty lines between them 95 | " Source: https://www.reddit.com/r/vim/comments/458buq/moving_by_paragraph/czvy13u/ 96 | nnoremap { len(getline(line('.')-1)) > 0 ? '{+' : '{-' 97 | nnoremap } len(getline(line('.')+1)) > 0 ? '}-' : '}+' 98 | 99 | " Jump back in tags stack. Reverse `CTRL-]` functionality. 100 | " Remaps built-in CTRL-T to `C-[`. 101 | nmap :po1 102 | 103 | " Open alternative file (usually test file) for Rails projects (vim-rails) 104 | nmap :A 105 | 106 | " Format buffer with JSON 107 | command! FormatJSON %!python3 -m json.tool 108 | 109 | " Close quicklist 110 | nnoremap cq :cclose 111 | 112 | " Open Vista to show functions/methods and such in the file 113 | nmap . :Vista 114 | -------------------------------------------------------------------------------- /vim/.vim/UltiSnips/rails.snippets: -------------------------------------------------------------------------------- 1 | # Rails snippets 2 | 3 | priority -50 4 | 5 | # Routes 6 | snippet res "resources" 7 | resources :${1:posts}${2: do 8 | $3 9 | end} 10 | endsnippet 11 | 12 | snippet nam "namespace" 13 | namespace :${1:api} do 14 | $0 15 | end 16 | endsnippet 17 | 18 | # Controller 19 | snippet redir "redirect_to (redir)" 20 | redirect_to ${1:location} 21 | endsnippet 22 | 23 | snippet redif "redirect_to ..., flash: message (redif)" 24 | redirect_to ${1:location}, ${2:notice}: "${3:message}" 25 | endsnippet 26 | 27 | snippet rn "render nothing (rn)" 28 | render nothing: ${1:true} 29 | endsnippet 30 | 31 | snippet controller "Create controller class (controller)" 32 | class ${1:Model}Controller < ${2:ApplicationController} 33 | ${0:${VISUAL:# code}}${4: 34 | private 35 | 36 | def ${3} 37 | @$3 ||= ${4:$1}.find(params[:id]) 38 | end} 39 | end 40 | endsnippet 41 | 42 | snippet model "class < ActiveRecord::Base ... end" 43 | class ${1:ClassName} < ActiveRecord::Base 44 | scope :list, -> { order(id: :desc) } 45 | 46 | ${0:${VISUAL:# code}} 47 | end 48 | endsnippet 49 | 50 | # Model before callbacks 51 | snippet before_ "before_create" 52 | before_create $0 53 | endsnippet 54 | 55 | snippet before_ "before_destroy" 56 | before_destroy $0 57 | endsnippet 58 | 59 | snippet before_ "before_save" 60 | before_save $0 61 | endsnippet 62 | 63 | snippet before_ "before_update" 64 | before_update $0 65 | endsnippet 66 | 67 | snippet before_ "before_validation" 68 | before_validation $0 69 | endsnippet 70 | 71 | # Model relationships 72 | snippet bt "belongs_to (bt)" 73 | belongs_to :${1:object} 74 | endsnippet 75 | 76 | snippet hm "has_many (hm)" 77 | has_many :${1:object}s 78 | endsnippet 79 | 80 | snippet hmt "has_many through (hmt)" 81 | has_many :${1:objects}, through: :${2:join_association} 82 | endsnippet 83 | 84 | snippet ho "has_one (ho)" 85 | has_one :${1:object} 86 | endsnippet 87 | 88 | # Model other 89 | snippet scope "scope" 90 | scope :${1:name}, -> { ${2:conditions} } 91 | endsnippet 92 | 93 | # Migrations 94 | snippet column "Create column (column)" 95 | t.${1:type} :${2:name} 96 | $0 97 | endsnippet 98 | 99 | snippet t. "t.binary" 100 | t.binary :${1:name}${2:, limit: ${3:2}.megabytes} 101 | endsnippet 102 | 103 | snippet t. "t.boolean" 104 | t.boolean :${1:name} 105 | endsnippet 106 | 107 | snippet t. "t.date" 108 | t.date :${1:name} 109 | endsnippet 110 | 111 | snippet t. "t.datetime" 112 | t.datetime :${1:name} 113 | endsnippet 114 | 115 | snippet t. "t.decimal" 116 | t.decimal :${1:name}${2:${3:, precision: ${4:10}}${5:, scale: ${6:2}}} 117 | endsnippet 118 | 119 | snippet t. "t.float" 120 | t.float :${1:name} 121 | endsnippet 122 | 123 | snippet t. "t.index" 124 | t.index :${1:name} 125 | endsnippet 126 | 127 | snippet t. "t.integer" 128 | t.integer :${1:name} 129 | endsnippet 130 | 131 | snippet t. "t.references" 132 | t.references :${1:taggable}${2:, polymorphic: "${3:Photo}" 133 | endsnippet 134 | 135 | snippet t. "t.rename" 136 | t.rename :${1:old_column_name}, :${2:new_column_name} 137 | endsnippet 138 | 139 | snippet t. "t.string" 140 | t.string :${1:name} 141 | endsnippet 142 | 143 | snippet t. "t.text" 144 | t.text :${1:name} 145 | endsnippet 146 | 147 | snippet t. "t.time" 148 | t.time :${1:name} 149 | endsnippet 150 | 151 | snippet t. "t.timestamp" 152 | t.timestamp :${1:name}, null: false 153 | endsnippet 154 | 155 | snippet t. "t.timestamps" 156 | t.timestamps, null: false 157 | endsnippet 158 | 159 | # vim:ft=snippets: 160 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dotfiles 2 | 3 | These dotfiles contain configuration and installation for: 4 | 5 | - Xcode 6 | - Homebrew 7 | - iTerm 8 | - Zsh 9 | - Dotfiles 10 | - VIM (Neovim and MacVim) 11 | - chruby and ruby-install 12 | - rustup and Rust 13 | - Hammerspoon 14 | - Misc. Utilities 15 | 16 | **This setup is intended for the latest macOS version** 17 | 18 | ## Installation 19 | 20 | This is a step-by-step installation guide. 21 | 22 | ### Xcode 23 | 24 | Install Xcode through the Mac App Store. 25 | 26 | Then run: 27 | 28 | ```sh 29 | xcode-select --install 30 | ``` 31 | 32 | ### Dotfiles installation 33 | 34 | Next, clone this Git repository, initialize/update the submodules and finally 35 | hook everything up by running the install script. 36 | 37 | ```sh 38 | mkdir $HOME/tombruijn 39 | git clone git://github.com:tombruijn/dotfiles.git $HOME/tombruijn/dotfiles 40 | cd $HOME/tombruijn/dotfiles && git submodule init && \ 41 | git submodule update --recursive 42 | ./install 43 | ``` 44 | 45 | This should set up the symlinks from the dotfiles directory to your `$HOME` 46 | directory, do not remove the `dotfiles` directory. 47 | 48 | ### macOS defaults 49 | 50 | Set macOS defaults. 51 | 52 | ```sh 53 | ./.macos 54 | ``` 55 | 56 | ### Homebrew 57 | 58 | Next, install [Homebrew](https://brew.sh/) using the command listed on the website. 59 | 60 | After installing Homebrew, ensure permissions are correct by running the 61 | following. 62 | 63 | ```sh 64 | brew bundle 65 | ``` 66 | 67 | ### Zsh 68 | 69 | #### Private credentials 70 | 71 | To configure credentials that shouldn't be checked into git, create a 72 | `~/.extra` file like the example below. 73 | 74 | ```sh 75 | #!/bin/sh 76 | 77 | export GPG_SIGNING_KEY="KEY_ID" 78 | ``` 79 | 80 | Now refresh you shell sessions either by opening a new pane or by running 81 | `reload`. 82 | 83 | #### GPG configuration 84 | 85 | Transfer your `~/.gnupg` directory to the new machine. You need the following 86 | files: 87 | 88 | ``` 89 | private-keys-v1.d/* 90 | pubring.kbx 91 | ``` 92 | 93 | Fix the permissions of this directory after the move. 94 | 95 | ``` 96 | chmod 600 ~/.gnupg/* 97 | chmod 700 ~/.gnupg 98 | ``` 99 | 100 | ### fzf 101 | 102 | To install [fzf](https://github.com/junegunn/fzf), use the install script 103 | listed in `brew info fzf` after installing it through `brew install fzf`. 104 | 105 | Say yes to "fuzzy auto-completion" and "key bindings". 106 | 107 | ### vim 108 | 109 | Install Neovim. 110 | 111 | ```sh 112 | # Should be installed through the Brewfile, but to do so manually: 113 | brew install neovim 114 | 115 | # Additional packages 116 | # Ruby package for neovim 117 | gem install neovim 118 | # Python package for Python bindings (Python is used by UltiSnips) 119 | pip2 install --upgrade neovim 120 | ``` 121 | 122 | Use [vim-plug](https://github.com/junegunn/vim-plug/) to install vim plugins. 123 | 124 | ```sh 125 | vim +:PlugInstall 126 | ``` 127 | 128 | ### Python 129 | 130 | For neovim to pick up Python support Python and the neovim package need to be 131 | installed. 132 | 133 | ```sh 134 | pyenv install 135 | pyenv global 136 | pip install --upgrade pip # Updating is just good practice 137 | pip install neovim 138 | ``` 139 | 140 | ### chruby and ruby-install 141 | 142 | ```sh 143 | ruby-install ruby [VERSION] 144 | ``` 145 | 146 | ### Rust and rustup 147 | 148 | Install [rustup](https://www.rustup.rs/) and with it Rust. 149 | 150 | Which Rust version to install depends on the project you're working on. 151 | -------------------------------------------------------------------------------- /hammerspoon/triggers.lua: -------------------------------------------------------------------------------- 1 | local application = require "hs.application" 2 | local window = require "hs.window" 3 | local hotkey = require "hs.hotkey" 4 | local alert = require "hs.alert" 5 | local battery = require "hs.battery" 6 | local keys = require "keys" 7 | local Keyboards = require "keyboards" 8 | local wifi_control = require "wifi_control" 9 | local bluetooth_control = require "bluetooth_control" 10 | 11 | function applicationRunning(name) 12 | apps = application.runningApplications() 13 | found = false 14 | for i = 1, #apps do 15 | app = apps[i] 16 | if app:title() == name and (#app:allWindows() > 0 or app:mainWindow()) then 17 | found = true 18 | end 19 | end 20 | 21 | return found 22 | end 23 | 24 | keys.bindKeyFor("ToggleKeyboard", function() 25 | Keyboards.toggleKeyboard() 26 | end) 27 | 28 | -- System management 29 | keys.bindKeyFor("Reload", function() 30 | hs.reload() 31 | end) 32 | keys.bindKeyFor("Console", function() 33 | hs.openConsole() 34 | end) 35 | 36 | -- Lock & sleep 37 | keys.bindKeyFor("Lock", function() 38 | hs.caffeinate.startScreensaver() 39 | end) 40 | keys.bindKeyFor("Sleep", function() 41 | hs.caffeinate.systemSleep() 42 | end) 43 | 44 | -- Show status 45 | keys.bindKeyFor("Status", function() 46 | charging = battery.isCharging() or battery.isCharged() 47 | timeRemaining = battery.timeRemaining() 48 | alert.show( 49 | "Wi-Fi: "..wifi_control.status().. 50 | "\nBluetooth: "..bluetooth_control.status().. 51 | "\nBattery: "..battery.percentage().."% - ".. 52 | (charging and "Charging" or "Not charging").. 53 | "\nTime remaining: "..((timeRemaining == -1 or timeRemaining == -2) and "?" or timeRemaining).." minutes" 54 | , 5) 55 | end) 56 | -- Toggle WiFi on and off 57 | keys.bindKeyFor("WiFi", function() 58 | wifi_control.toggle() 59 | end) 60 | -- Toggle Bluetooth on and off 61 | keys.bindKeyFor("Bluetooth", function() 62 | bluetooth_control.toggle() 63 | end) 64 | 65 | -- MacVim - Start only from terminal 66 | keys.bindKeyFor("MacVim", function() 67 | if applicationRunning("MacVim") then 68 | application.find("MacVim"):activate() 69 | else 70 | alert.show("MacVim not running") 71 | application.launchOrFocus("iTerm") 72 | end 73 | end) 74 | 75 | -- Open screenshots directory 76 | keys.bindKeyFor("Open screenshots", function() 77 | hs.execute("open /Users/tombruijn/Pictures/Monosnap") 78 | end) 79 | 80 | -- Switch between audio output 81 | keys.bindKeyFor("Switch audio", function() 82 | speakersName = "Audioengine HD3" 83 | headphonesName = "WH-1000XM4" 84 | currentAudioDevice = hs.audiodevice.current().name 85 | if currentAudioDevice == speakersName then 86 | setDefaultOutputDevice(headphonesName, "Audio: wireless headphones 🎧") 87 | else 88 | setDefaultOutputDevice(speakersName, "Audio: speakers 🔈") 89 | end 90 | end) 91 | 92 | function setDefaultOutputDevice(audioDevice, label) 93 | local status, _returnValue = pcall(_setDefaultOutputDevice, audioDevice, label) 94 | if status == false then 95 | alert.show("Error switching to \"" .. audioDevice .. "\"") 96 | return status 97 | end 98 | end 99 | 100 | function _setDefaultOutputDevice(audioDevice, label) 101 | if hs.audiodevice.findOutputByName(audioDevice):setDefaultOutputDevice() then 102 | alert.show(label) 103 | else 104 | alert.show("Unable to switch to " .. audioDevice) 105 | end 106 | end 107 | 108 | -- Simple triggers 109 | for applicationName, _ in pairs(keys.triggers) do 110 | keys.bindKeyFor(applicationName, function() 111 | application.launchOrFocus(applicationName) 112 | end) 113 | end 114 | -------------------------------------------------------------------------------- /zsh/.zshrc: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # $PATH configuration 3 | 4 | ## Ensure unique paths within $PATH. Useful on calling `reload` 5 | typeset -U path 6 | 7 | ## Base paths 8 | export PATH="$HOME/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" 9 | ## Homebrew paths 10 | export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:$PATH" 11 | ## Rust paths 12 | export PATH="$HOME/.cargo/bin:$PATH" 13 | ## MongoDB custom path 14 | export PATH="/usr/local/opt/mongodb-community@3.6/bin:/opt/homebrew/opt/mongodb-community@3.6/bin:$PATH" 15 | 16 | ############################################################################### 17 | # Configuration 18 | 19 | ## Set language and encoding 20 | export LANG=en_US.UTF-8 21 | export LC_CTYPE=en_US.UTF-8 22 | export LC_ALL=en_US.UTF-8 23 | export LC_COLLATE=C 24 | 25 | ## Configure Zsh prompt 26 | ## See: man zshoptions 27 | unsetopt menu_complete # do not autoselect the first completion entry 28 | unsetopt flowcontrol 29 | setopt auto_cd # `cd` command not necessary to open a dir 30 | setopt multios # Enable multiple outputs 31 | setopt cdable_vars 32 | setopt extended_glob # Allow special chars as part of filename patterns 33 | setopt auto_menu # Show completion menu on succesive tab press 34 | setopt complete_in_word 35 | setopt always_to_end 36 | 37 | # Tools to use 38 | export EDITOR="nvim" 39 | export PAGER="less" 40 | export LESS="-R" 41 | export MANPAGER="sh -c 'col -bx | bat -l man -p'" 42 | 43 | # Configure shared config dir 44 | export XDG_CONFIG_HOME="$HOME/.config" 45 | export RIPGREP_CONFIG_PATH="$XDG_CONFIG_HOME/ripgrep/.ripgreprc" 46 | 47 | ## Configure cd quick paths 48 | ## `cd` can navigate to subdirectories in these directories from anywhere 49 | cdpath=(. .. ~/tombruijn ~/tombruijn/projects ~/tombruijn/writing ~/appsignal) 50 | 51 | ## Enable Elixir IEX history 52 | export ERL_AFLAGS="-kernel shell_history enabled" 53 | 54 | ## Disable Homebrew analytics 55 | export HOMEBREW_NO_ANALYTICS=1 56 | 57 | ## Load private credentials from ~/.extra file 58 | if [ -f ~/.extra ]; then 59 | source ~/.extra 60 | fi 61 | 62 | ############################################################################### 63 | # Load additional configuration 64 | 65 | ZSH_DIR="$HOME/.zsh" # Path to my custom ZSH directory 66 | 67 | source "$ZSH_DIR/history.zsh" 68 | source "$ZSH_DIR/key-bindings.zsh" 69 | source "$ZSH_DIR/completions.zsh" 70 | source "$ZSH_DIR/functions.zsh" 71 | source "$ZSH_DIR/aliases.zsh" 72 | 73 | # Theme 74 | source "$ZSH_DIR/theme.zsh" 75 | source "$ZSH_DIR/termsupport.zsh" 76 | 77 | ############################################################################### 78 | # Load tools 79 | 80 | ## Configure GPG 81 | export GPG_TTY=$(tty) 82 | 83 | ## Load FZF 84 | [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh 85 | export FZF_DEFAULT_COMMAND='rg --files --hidden' 86 | 87 | ## Load chruby version manager + auto detection 88 | if [ -d /opt/homebrew/opt/chruby/share/chruby/ ]; then 89 | # New homebrew install location 90 | source /opt/homebrew/opt/chruby/share/chruby/chruby.sh 91 | source /opt/homebrew/opt/chruby/share/chruby/auto.sh 92 | else 93 | # Remove this when all laptops have the new homebrew file structure 94 | source /usr/local/opt/chruby/share/chruby/chruby.sh 95 | source /usr/local/opt/chruby/share/chruby/auto.sh 96 | fi 97 | 98 | ## Load ASDF version manager 99 | if [ -d $HOME/.asdf ]; then 100 | . $HOME/.asdf/asdf.sh 101 | fi 102 | 103 | export DISABLE_LIVE_RELOADING=true 104 | 105 | if command -v pyenv >/dev/null; then 106 | export PYENV_ROOT="$HOME/.pyenv" 107 | export PATH="$PYENV_ROOT/bin:$PATH" 108 | eval "$(pyenv init -)" 109 | fi 110 | -------------------------------------------------------------------------------- /vim/.vim/UltiSnips/javascript.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | snippet "im(port)?" "import ... from ..." r 4 | import ${1:module} from "${2:path}" 5 | endsnippet 6 | 7 | snippet $ "${code}" 8 | ${${0:${VISUAL:code}}} 9 | endsnippet 10 | 11 | snippet f "() => {}" 12 | (${1:args}) => { ${2:code} } 13 | endsnippet 14 | 15 | snippet ff "() => ()" 16 | (${1:args}) => (${2:code}) 17 | endsnippet 18 | 19 | snippet wrap "Immediately-Invoked Function Expression" b 20 | (function(${1:parameters}) { 21 | ${VISUAL}$0 22 | }(${2:$1})) 23 | endsnippet 24 | 25 | snippet func "Function" i 26 | function ${1:name}(${2:parameters}) { 27 | ${VISUAL}$0 28 | } 29 | endsnippet 30 | 31 | snippet funcc "Anonymous function" i 32 | function(${2:parameters}) { 33 | ${VISUAL}$0 34 | } 35 | endsnippet 36 | 37 | snippet :, "Object Value JS" 38 | ${1:key}: ${0:value}, 39 | endsnippet 40 | 41 | snippet if "if (...) {...}" b 42 | if (${1:condition}) { 43 | ${VISUAL}$0 44 | } 45 | endsnippet 46 | 47 | snippet elseif "else if (...) {...}" 48 | else if (${1:condition}) { 49 | ${VISUAL}$0 50 | } 51 | endsnippet 52 | 53 | snippet else "else (...) {...}" 54 | else { 55 | ${VISUAL}$0 56 | } 57 | endsnippet 58 | 59 | snippet forin "for (let foo in bar) {...}" b 60 | for (let ${1} in ${2}) { 61 | let ${3:value} = $2[$1] 62 | ${VISUAL}$0 63 | } 64 | endsnippet 65 | 66 | snippet forof "for (let foo of bar) {...}" b 67 | for (let ${1} of ${2}) { 68 | ${VISUAL}$0 69 | } 70 | endsnippet 71 | 72 | snippet for "for (...) {...} (counting up)" b 73 | for (var ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) { 74 | ${VISUAL}$0 75 | } 76 | endsnippet 77 | 78 | snippet ford "for (...) {...} (counting down)" b 79 | for (var ${2:i} = ${1:length} - 1; $2 >= 0; $2--) { 80 | ${VISUAL}$0 81 | } 82 | endsnippet 83 | 84 | snippet timeout "setTimeout function" 85 | setTimeout(function() { 86 | ${VISUAL}$0 87 | }, ${1:10}) 88 | endsnippet 89 | 90 | snippet cl "console.log" b 91 | console.log(${0:${VISUAL:value}}) 92 | endsnippet 93 | 94 | snippet cll "console.log prefilled" b 95 | console.log("${2:$1}", ${1:${VISUAL:value}}) 96 | endsnippet 97 | 98 | snippet ce "console.error" b 99 | console.error(${1:value}) 100 | endsnippet 101 | 102 | snippet cw "console.warn" b 103 | console.warn(${1:value}) 104 | endsnippet 105 | 106 | snippet tstart "console.time" b 107 | console.time("${1:label}") 108 | ${VISUAL}$0 109 | endsnippet 110 | 111 | snippet tend "console.timeEnd" b 112 | console.timeEnd("${1:label}") 113 | ${VISUAL}$0 114 | endsnippet 115 | 116 | snippet que "document.querySelector(...)" b 117 | var ${1:variable} = document.querySelector(".${2:selector}") 118 | ${VISUAL}$0 119 | endsnippet 120 | 121 | snippet query "document.querySelectorAll(...)" b 122 | var ${1:variable} = document.querySelectorAll(".${2:selector}") 123 | ${VISUAL}$0 124 | endsnippet 125 | 126 | # Testing 127 | 128 | snippet "before(all)?" "beforeAll block" r 129 | beforeAll(() => { 130 | ${VISUAL}$0 131 | }) 132 | endsnippet 133 | 134 | snippet "before(each)?" "beforeEach block" r 135 | beforeEach(() => { 136 | ${VISUAL}$0 137 | }) 138 | endsnippet 139 | 140 | snippet "after(all)?" "afterAll block" r 141 | afterAll(() => { 142 | ${VISUAL}$0 143 | }) 144 | endsnippet 145 | 146 | snippet "after(each)?" "afterEach block" r 147 | afterEach(() => { 148 | ${VISUAL}$0 149 | }) 150 | endsnippet 151 | 152 | snippet "des(cribe)?" "describe test block" r 153 | describe("${1:block name}", () => { 154 | ${VISUAL}$0 155 | }) 156 | endsnippet 157 | 158 | snippet test "test block" b 159 | test("${1:test name}", () => { 160 | ${VISUAL}$0 161 | }) 162 | endsnippet 163 | 164 | snippet "ex(pect)?" "expect" r 165 | expect(${1:subject}).to${2:Equal}(${0:${VISUAL:assertion}}) 166 | endsnippet 167 | 168 | # vim:ft=snippets: 169 | -------------------------------------------------------------------------------- /hammerspoon/keys.lua: -------------------------------------------------------------------------------- 1 | local alert = require "hs.alert" 2 | local hotkey = require "hs.hotkey" 3 | 4 | meh = {"ctrl", "alt", "shift"} 5 | hyper = {"cmd", "alt", "ctrl", "shift"} 6 | local shortcuts = { 7 | ["normal"] = {}, 8 | ["ergodox"] = {}, 9 | } 10 | 11 | Keys = { 12 | ["specialTriggers"] = { 13 | ["ToggleKeyboard"] = {{{"ctrl", "alt", "cmd"}, "="}, {{"ctrl", "alt", "cmd"}, "="}}, 14 | ["Lock"] = {{{"ctrl", "alt", "cmd"}, "L"}, {hyper, "9"}}, 15 | ["Sleep"] = {{{"ctrl", "alt", "cmd"}, ";"}, {hyper, "0"}}, 16 | ["Status"] = {{{"ctrl", "alt", "cmd"}, "S"}, {hyper, "\\"}}, 17 | ["Reload"] = {{{"ctrl", "alt", "cmd"}, "R"}, {hyper, "3"}}, 18 | ["Console"] = {{{"ctrl", "alt", "cmd"}, "C"}, {hyper, "4"}}, 19 | ["WiFi"] = {{{"ctrl", "alt", "cmd"}, "W"}, {hyper, "1"}}, 20 | ["Bluetooth"] = {{{"ctrl", "alt", "cmd"}, "E"}, {hyper, "2"}}, 21 | ["MacVim"] = {{{"ctrl"}, "2"}, {hyper, "D"}}, 22 | 23 | ["Open screenshots"] = {{{"cmd", "shift"}, "S"}, {hyper, "M"}}, 24 | ["Switch audio"] = {nil, {hyper, "Z"}}, 25 | 26 | ["Fullscreen window"] = {{{"alt", "cmd"}, "F"}, {meh, "I"}}, 27 | ["Center window"] = {{{"alt", "cmd"}, "C"}, {meh, "K"}}, 28 | ["Left 50% window"] = {{{"alt", "cmd"}, "["}, {meh, "J"}}, 29 | ["Right 50% window"] = {{{"alt", "cmd"}, "]"}, {meh, "L"}}, 30 | ["Left 33% window"] = {nil, {meh, "H"}}, 31 | ["Right 33% window"] = {nil, {meh, ";"}}, 32 | ["Top left 25% window"] = {{{"ctrl", "alt"}, "["}, {meh, "U"}}, 33 | ["Top right 25% window"] = {{{"ctrl", "alt"}, "]"}, {meh, "O"}}, 34 | ["Bottom center 25% window"] = {{{"ctrl", "alt"}, "\\"}, {meh, ","}}, 35 | ["Move window display left"] = {{{"ctrl", "cmd"}, "-"}, {meh, "Y"}}, 36 | ["Move window display right"] = {{{"ctrl", "cmd"}, "="}, {meh, "P"}}, 37 | }, 38 | ["triggers"] = { 39 | ["Activity Monitor"] = {{{"ctrl", "alt", "cmd"}, "A"}, {hyper, "5"}}, 40 | ["iTerm"] = {{{"ctrl"}, "1"}, {hyper, "S"}}, 41 | ["Music"] = {{{"alt"}, "1"}, {hyper, "pad+"}}, 42 | ["Firefox Developer Edition"] = {{{"ctrl"}, "3"}, {hyper, "F"}}, 43 | ["Basecamp 3"] = {{{"alt"}, "3"}, {hyper, "V"}}, 44 | ["Firefox"] = {{{"ctrl"}, "4"}, {hyper, "G"}}, 45 | ["Google Chrome"] = {{{"alt"}, "4"}, {hyper, "C"}}, 46 | ["Tweetbot"] = {{{"ctrl"}, "8"}, {hyper, "W"}}, 47 | ["Safari"] = {{{"alt"}, "8"}, {hyper, "Q"}}, 48 | ["Mail"] = {{{"ctrl"}, "0"}, {hyper, "A"}}, 49 | ["Slack"] = {{{"alt"}, "0"}, {hyper, "B"}}, 50 | ["Calendar"] = {{{"ctrl"}, "-"}, {hyper, "X"}}, 51 | ["iA Writer"] = {{{"ctrl"}, "="}, {hyper, "K"}}, 52 | ["Obsidian"] = {nil, {hyper, "I"}}, 53 | ["Finder"] = {{{"ctrl"}, "TAB"}, {hyper, "R"}}, 54 | ["1Password 7"] = {{{"ctrl"}, "§"}, {hyper, "N"}}, 55 | ["Clockify Desktop"] = {{{"alt"}, "§"}, {hyper, "="}}, 56 | ["Dash"] = {{{"cmd", "shift"}, "E"}, {hyper, "E"}}, 57 | ["zoom.us"] = {{{"ctrl"}, "6"}, {hyper, "Y"}}, 58 | ["Todoist"] = {{{"ctrl"}, "5"}, {hyper, "J"}}, 59 | ["Visual Studio Code"] = {nil, {hyper, "P"}}, 60 | }, 61 | } 62 | 63 | function Keys.keyFor(name) 64 | local keys = Keys.triggers[name] 65 | if not keys then 66 | keys = Keys.specialTriggers[name] 67 | end 68 | 69 | return keys 70 | end 71 | 72 | function Keys.bindKeyFor(appName, fn) 73 | keys = Keys.keyFor(appName) 74 | normalKeys = keys[1] 75 | ergodoxKeys = keys[2] 76 | if normalKeys then 77 | shortcuts["normal"][appName] = hotkey.new(normalKeys[1], normalKeys[2], fn) 78 | end 79 | shortcuts["ergodox"][appName] = hotkey.new(ergodoxKeys[1], ergodoxKeys[2], fn) 80 | end 81 | 82 | function Keys.deactivateKeys() 83 | for _, keys in pairs(shortcuts) do 84 | for __, k in pairs(keys) do 85 | k:disable() 86 | end 87 | end 88 | end 89 | 90 | function Keys.activateKeys() 91 | keys = shortcuts[Keyboards.keyboardType()] 92 | for _, k in pairs(keys) do 93 | k:enable() 94 | end 95 | end 96 | 97 | return Keys 98 | -------------------------------------------------------------------------------- /hammerspoon/Spoons/URLDispatcher.spoon/init.lua: -------------------------------------------------------------------------------- 1 | --- === URLDispatcher === 2 | --- 3 | --- Route URLs to different applications with pattern matching 4 | --- 5 | --- Download: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/URLDispatcher.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/URLDispatcher.spoon.zip) 6 | --- 7 | --- Sets Hammerspoon as the default browser for HTTP/HTTPS links, and 8 | --- dispatches them to different apps according to the patterns defined 9 | --- in the config. If no pattern matches, `default_handler` is used. 10 | 11 | local spoons = require("hs.spoons") 12 | 13 | local obj={} 14 | obj.__index = obj 15 | 16 | -- Metadata 17 | obj.name = "URLDispatcher" 18 | obj.version = "0.1" 19 | obj.author = "Diego Zamboni " 20 | obj.homepage = "https://github.com/Hammerspoon/Spoons" 21 | obj.license = "MIT - https://opensource.org/licenses/MIT" 22 | 23 | --- URLDispatcher.default_handler 24 | --- Variable 25 | --- Bundle ID for default URL handler. (Defaults to `"com.apple.Safari"`) 26 | obj.default_handler = "org.mozilla.firefoxdeveloperedition" 27 | 28 | --- URLDispatcher.decode_slack_redir_urls 29 | --- Variable 30 | --- If true, handle Slack-redir URLs to apply the rule on the destination URL. Defaults to `true` 31 | obj.decode_slack_redir_urls = false 32 | 33 | --- URLDispatcher.url_patterns 34 | --- Variable 35 | --- URL dispatch rules. 36 | --- A table containing a list of dispatch rules. Each rule should be its own 37 | --- table in the format: `{ "url pattern", "application bundle ID", "function" 38 | --- }`, and they are evaluated in the order they are declared. Note that the 39 | --- patterns are [Lua patterns](https://www.lua.org/pil/20.2.html) and not 40 | --- regular expressions. Defaults to an empty table, which has the effect of 41 | --- having all URLs dispatched to the `default_handler`. If "application bundle 42 | --- ID" is specified, that application will be used to open matching URLs. If no 43 | --- "application bundle ID" is specified, but "function" is provided (and is a 44 | --- Lua function) it will be called with the URL. 45 | obj.url_patterns = dofile(spoons.scriptPath() .. "url_patterns.lua") 46 | 47 | --- URLDispatcher.logger 48 | --- Variable 49 | --- Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon. 50 | obj.logger = hs.logger.new('URLDispatcher') 51 | 52 | -- Local functions to decode URLs 53 | function hex_to_char(x) 54 | return string.char(tonumber(x, 16)) 55 | end 56 | 57 | function unescape(url) 58 | return url:gsub("%%(%x%x)", hex_to_char) 59 | end 60 | 61 | --- URLDispatcher:dispatchURL(scheme, host, params, fullUrl) 62 | --- Method 63 | --- Dispatch a URL to an application according to the defined `url_patterns`. 64 | --- 65 | --- Parameters (according to the [httpCallback](http://www.hammerspoon.org/docs/hs.urlevent.html#httpCallback) specification): 66 | --- * scheme - A string containing the URL scheme (i.e. "http") 67 | --- * host - A string containing the host requested (e.g. "www.hammerspoon.org") 68 | --- * params - A table containing the key/value pairs of all the URL parameters 69 | --- * fullURL - A string containing the full, original URL 70 | function obj:dispatchURL(scheme, host, params, fullUrl) 71 | local url = fullUrl 72 | self.logger.df("Dispatching URL '%s'", url) 73 | if self.decode_slack_redir_urls then 74 | local newUrl = string.match(url, 'https://slack.redir.net/.*url=(.*)') 75 | if newUrl then 76 | url = unescape(newUrl) 77 | end 78 | end 79 | for i,pair in ipairs(self.url_patterns) do 80 | local p = pair[1] 81 | local app = pair[2] 82 | local func = pair[3] 83 | if string.match(url, p) then 84 | id = app 85 | if id ~= nil then 86 | self.logger.df("Match found, opening with '%s'", id) 87 | hs.application.launchOrFocusByBundleID(id) 88 | hs.urlevent.openURLWithBundle(url, id) 89 | return 90 | end 91 | if func ~= nil then 92 | self.logger.df("Match found, calling func '%s'", func) 93 | func(url) 94 | return 95 | end 96 | end 97 | end 98 | self.logger.df("No match found, opening with default handler '%s'", self.default_handler) 99 | hs.application.launchOrFocusByBundleID(self.default_handler) 100 | hs.urlevent.openURLWithBundle(url, self.default_handler) 101 | end 102 | 103 | --- URLDispatcher:start() 104 | --- Method 105 | --- Start dispatching URLs according to the rules 106 | function obj:start() 107 | if hs.urlevent.httpCallback then 108 | self.logger.w("An hs.urlevent.httpCallback was already set. I'm overriding it with my own but you should check if this breaks any other functionality") 109 | end 110 | hs.urlevent.httpCallback = function(...) self:dispatchURL(...) end 111 | hs.urlevent.setDefaultHandler('http') 112 | -- hs.urlevent.setRestoreHandler('http', self.default_handler) 113 | return self 114 | end 115 | 116 | return obj 117 | -------------------------------------------------------------------------------- /vim/.vimrc: -------------------------------------------------------------------------------- 1 | set nocompatible 2 | 3 | call plug#begin('~/.vim/plugged') 4 | 5 | " Themes 6 | Plug 'vim-airline/vim-airline-themes' 7 | Plug 'reedes/vim-colors-pencil', { 'on': [] } 8 | 9 | " Navigation 10 | Plug 'bling/vim-airline' 11 | Plug 'mileszs/ack.vim', { 'on': 'Ack' } 12 | Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] } 13 | Plug 'tpope/vim-projectionist' 14 | 15 | " Languages 16 | Plug 'elixir-lang/vim-elixir', { 'for': 'elixir' } 17 | Plug 'othree/html5.vim', { 'for': ['html', 'eruby'] } 18 | Plug 'pangloss/vim-javascript', { 'for': 'javascript' } 19 | Plug 'MaxMEllon/vim-jsx-pretty', { 'for': 'javascript' } 20 | Plug 'plasticboy/vim-markdown', { 'for': 'markdown' } 21 | Plug 'rust-lang/rust.vim', { 'for': 'rust' } 22 | Plug 'tpope/vim-haml', { 'for': ['haml', 'sass', 'scss'] } 23 | Plug 'tpope/vim-rails', { 'for': 'ruby' } 24 | Plug 'vim-ruby/vim-ruby', { 'for': 'ruby' } 25 | Plug 'leafgarland/typescript-vim', { 'for': 'typescript' } 26 | 27 | " Useful tools 28 | Plug 'tpope/vim-fugitive', { 'on': ['Gblame', 'Gbrowse'] } 29 | Plug 'tpope/vim-rhubarb', { 'on': ['Gbrowse'] } 30 | Plug 'tpope/vim-repeat', { 'commit': '7a6675f' } 31 | Plug 'tpope/vim-surround', { 'commit': '2d05440' } 32 | 33 | Plug 'AndrewRadev/splitjoin.vim' 34 | Plug 'AndrewRadev/switch.vim' 35 | Plug 'airblade/vim-gitgutter', { 'commit': 'b27ee4d' } 36 | Plug 'janko-m/vim-test', { 'on': ['TestFile', 'TestNearest', 'TestLast', 'TestSuite'] } 37 | Plug 'jiangmiao/auto-pairs' 38 | Plug 'junegunn/goyo.vim', { 'on': 'Goyo' } 39 | Plug 'junegunn/vim-easy-align', { 'on': '(EasyAlign)' } 40 | Plug 'lifepillar/vim-mucomplete' 41 | Plug 'sirver/ultisnips', { 'commit': '423f264', 'on': [] } 42 | Plug 'tomtom/tcomment_vim', { 'on': 'TComment' } 43 | Plug 'w0rp/ale' 44 | 45 | Plug 'liuchengxu/vista.vim' 46 | Plug 'ludovicchabant/vim-gutentags' 47 | Plug '/opt/homebrew/opt/fzf' ", { 'on': ['Files2', 'Buffers', 'Tags', 'Commands', 'Ag', 'History', 'Marks', 'Snippets'] } 48 | Plug 'junegunn/fzf.vim' ", { 'on': ['Files2', 'Buffers', 'Tags', 'Commands', 'Ag', 'History', 'Marks', 'Snippets'] } 49 | 50 | call plug#end() 51 | 52 | set encoding=utf-8 53 | 54 | set showcmd " Display incomplete commands. 55 | set noshowmode " Display the mode you're in. 56 | 57 | set backspace=indent,eol,start " Intuitive backspacing. 58 | set hidden " Handle multiple buffers better. 59 | 60 | set ignorecase " Case-insensitive searching. 61 | set smartcase " But case-sensitive if expression contains a capital letter. 62 | 63 | set number " Show line numbers. 64 | set ruler " Show cursor position. 65 | set cursorline " Highlight the line of the cursor. 66 | 67 | set incsearch " Highlight matches as you type. 68 | set hlsearch " Highlight matches. 69 | 70 | set spelllang=en,nl 71 | set spellfile=$HOME/.vim/spell/en.utf-8.add,$HOME/.vim/spell/nl.utf-8.add 72 | set complete+=kspell 73 | 74 | set wrap " Turn on line wrapping. 75 | set linebreak " Break lines. 76 | set breakindent " Add indenting after break. 77 | let &showbreak="↳ " " Line break indicator. 78 | set display+=lastline " Show last line contents if it doesn't fit entirely on in buffer 79 | 80 | set scrolloff=5 " Line scroll offset from top and bottom. 81 | 82 | set title " Set the terminal's title 83 | set visualbell " No beeping. 84 | 85 | set noswapfile " Disable .swp file creation. 86 | set nobackup " Don't make a backup before overwriting a file. 87 | set nowritebackup " And again. 88 | 89 | set history=1000 " Remember last 1000 commands. 90 | set undolevels=1000 " Remember last 1000 undos. 91 | 92 | " Configure vim path 93 | " - .: search relative to the directory of the current file 94 | " - **: current directory and all sub directories 95 | set path=.,** 96 | " Ignore paths for `path` config 97 | " The path config sets `**` which searches everything, which can be a 98 | " performance issue. Tell vim which directories to ignore. 99 | set wildignore=*.swp,*.swo,*.bak,*.class,*.lock,.gitkeep,.git/** 100 | set wildignore+=**/vendor/**,**/tmp/**,tmp/**,log/**,coverage/**,doc/** 101 | set wildignore+=*.ico,*.png,*.PNG,*.JPG,*.jpg,*.JPEG,*.jpeg,*.GIF,*.gif 102 | set wildignore+=*/node_modules,node_modules,*.min.js,public/packs/**,**/public/packs-test/** 103 | 104 | set tabstop=2 " Global tab width. 105 | set shiftwidth=2 " And again, related. 106 | set shiftround 107 | set expandtab " Use spaces instead of tabs. 108 | au FocusGained,BufEnter * checktime 109 | 110 | set clipboard=unnamed " Enable OS clipboard to properly paste in to VIM buffer. 111 | set pastetoggle= 112 | 113 | if (has("termguicolors")) 114 | set termguicolors 115 | endif 116 | let &colorcolumn="80,100" " Highlight column 80 and 100 117 | let c_space_errors=1 " Highlight trailing spaces 118 | set splitbelow " Open vsplits to below 119 | set splitright " Open hsplits to the right 120 | 121 | " Configure syntax highlighting 122 | " Reduce syntax highlighting so it doesn't hang while trying to 123 | " highlight everything. 124 | syntax sync minlines=2000 125 | syntax sync maxlines=5000 126 | set synmaxcol=400 127 | set redrawtime=4000 128 | set lazyredraw 129 | 130 | let mapleader="," 131 | let g:font_normal="Meslo\ LG\ M\ Regular\ for\ Powerline:h16" 132 | let g:font_focus="Meslo\ LG\ M\ Regular\ for\ Powerline:h20" 133 | 134 | runtime! config/**/*.vim 135 | 136 | set shell=$SHELL " Fix Ruby + chruby loading (https://github.com/postmodern/chruby/wiki/Vim) 137 | set shortmess+=IF 138 | set shortmess-=S " Show search matches count on search 139 | call Load_default_theme() 140 | 141 | abbr changset changeset 142 | abbr changsets changesets 143 | -------------------------------------------------------------------------------- /iterm2/colors.itermcolors: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ansi 0 Color 6 | 7 | Blue Component 8 | 0.0 9 | Green Component 10 | 0.0 11 | Red Component 12 | 0.0 13 | 14 | Ansi 1 Color 15 | 16 | Blue Component 17 | 0.0 18 | Green Component 19 | 0.0 20 | Red Component 21 | 0.80000001192092896 22 | 23 | Ansi 10 Color 24 | 25 | Blue Component 26 | 0.2039216011762619 27 | Green Component 28 | 0.88627451658248901 29 | Red Component 30 | 0.54117649793624878 31 | 32 | Ansi 11 Color 33 | 34 | Blue Component 35 | 0.30980390310287476 36 | Green Component 37 | 0.91372549533843994 38 | Red Component 39 | 0.98823529481887817 40 | 41 | Ansi 12 Color 42 | 43 | Blue Component 44 | 0.82745099067687988 45 | Green Component 46 | 0.52549022436141968 47 | Red Component 48 | 0.0 49 | 50 | Ansi 13 Color 51 | 52 | Blue Component 53 | 0.65882349014282227 54 | Green Component 55 | 0.49803918600082397 56 | Red Component 57 | 0.67843139171600342 58 | 59 | Ansi 14 Color 60 | 61 | Blue Component 62 | 0.88627451658248901 63 | Green Component 64 | 0.88627451658248901 65 | Red Component 66 | 0.2039216011762619 67 | 68 | Ansi 15 Color 69 | 70 | Blue Component 71 | 0.92549020051956177 72 | Green Component 73 | 0.93333327770233154 74 | Red Component 75 | 0.93333327770233154 76 | 77 | Ansi 2 Color 78 | 79 | Blue Component 80 | 0.023529410362243652 81 | Green Component 82 | 0.66788321733474731 83 | Red Component 84 | 0.30588239431381226 85 | 86 | Ansi 3 Color 87 | 88 | Blue Component 89 | 0.0 90 | Green Component 91 | 0.62745100259780884 92 | Red Component 93 | 0.76862752437591553 94 | 95 | Ansi 4 Color 96 | 97 | Blue Component 98 | 0.64313727617263794 99 | Green Component 100 | 0.39607840776443481 101 | Red Component 102 | 0.2039216011762619 103 | 104 | Ansi 5 Color 105 | 106 | Blue Component 107 | 0.48235291242599487 108 | Green Component 109 | 0.31372550129890442 110 | Red Component 111 | 0.45882350206375122 112 | 113 | Ansi 6 Color 114 | 115 | Blue Component 116 | 0.60392159223556519 117 | Green Component 118 | 0.59607851505279541 119 | Red Component 120 | 0.023529410362243652 121 | 122 | Ansi 7 Color 123 | 124 | Blue Component 125 | 0.81176471710205078 126 | Green Component 127 | 0.84313732385635376 128 | Red Component 129 | 0.82745099067687988 130 | 131 | Ansi 8 Color 132 | 133 | Blue Component 134 | 0.32549020648002625 135 | Green Component 136 | 0.34117650985717773 137 | Red Component 138 | 0.33333331346511841 139 | 140 | Ansi 9 Color 141 | 142 | Blue Component 143 | 0.16078430414199829 144 | Green Component 145 | 0.16078430414199829 146 | Red Component 147 | 0.93725490570068359 148 | 149 | Background Color 150 | 151 | Blue Component 152 | 0.0 153 | Green Component 154 | 0.0 155 | Red Component 156 | 0.0 157 | 158 | Bold Color 159 | 160 | Blue Component 161 | 1 162 | Green Component 163 | 1 164 | Red Component 165 | 1 166 | 167 | Cursor Color 168 | 169 | Blue Component 170 | 1 171 | Green Component 172 | 1 173 | Red Component 174 | 1 175 | 176 | Cursor Text Color 177 | 178 | Blue Component 179 | 0.0 180 | Green Component 181 | 0.0 182 | Red Component 183 | 0.0 184 | 185 | Foreground Color 186 | 187 | Blue Component 188 | 1 189 | Green Component 190 | 1 191 | Red Component 192 | 1 193 | 194 | Selected Text Color 195 | 196 | Blue Component 197 | 0.0 198 | Green Component 199 | 0.0 200 | Red Component 201 | 0.0 202 | 203 | Selection Color 204 | 205 | Blue Component 206 | 1 207 | Green Component 208 | 0.8353000283241272 209 | Red Component 210 | 0.70980000495910645 211 | 212 | 213 | 214 | -------------------------------------------------------------------------------- /vim/.vim/UltiSnips/ruby.snippets: -------------------------------------------------------------------------------- 1 | # Ruby snippets 2 | # Modified version from honza/vim-snippets 3 | # Original source: https://github.com/honza/vim-snippets/blob/b988fb9576db2990eb96db14eee2e0f5ec4841e4/UltiSnips/ruby.snippets 4 | 5 | priority -50 6 | 7 | snippet "^#!" "#!/usr/bin/env ruby" r 8 | #!/usr/bin/env ruby 9 | $0 10 | endsnippet 11 | 12 | snippet gem "gem" 13 | gem "${1:name}" 14 | endsnippet 15 | 16 | snippet # "Wrap in #{code}" i 17 | #{${0:${VISUAL:code}}} 18 | endsnippet 19 | 20 | snippet if "if-statement" 21 | if ${1:condition} 22 | ${0:${VISUAL:code}} 23 | end 24 | endsnippet 25 | 26 | snippet else "else-statement" 27 | else 28 | ${0:${VISUAL:code}} 29 | endsnippet 30 | 31 | snippet elsif "elsif-statement" 32 | elsif ${1:condition} 33 | ${0:${VISUAL:code}} 34 | endsnippet 35 | 36 | snippet unless "unless-statement" 37 | unless ${1:condition} 38 | ${0:${VISUAL:code}} 39 | end 40 | endsnippet 41 | 42 | snippet deb "debugger" 43 | require "debug"; debugger # rubocop:disable Style/Semicolon 44 | endsnippet 45 | 46 | snippet pry "binding.pry" 47 | require "pry"; binding.pry 48 | endsnippet 49 | 50 | snippet "pu(ts)?" "puts = * 80" r 51 | puts "${0:=}" * 80 52 | endsnippet 53 | 54 | # attribute helpers 55 | snippet "\b(r|attr)" "attr_reader :" r 56 | attr_reader :${0:attr_names} 57 | endsnippet 58 | 59 | snippet "\b(w|attr)" "attr_writer :" r 60 | attr_writer :${0:attr_names} 61 | endsnippet 62 | 63 | snippet "\b(rw|attr)" "attr_accessor :" r 64 | attr_accessor :${0:attr_names} 65 | endsnippet 66 | 67 | # Methods 68 | snippet def "def ..." 69 | def ${1:method_name}${3:(${2:args})} 70 | ${0:${VISUAL:object}} 71 | end 72 | endsnippet 73 | 74 | snippet defi "def initialize..." 75 | def initialize${2:(${1:args})} 76 | ${0:${VISUAL:object}} 77 | end 78 | endsnippet 79 | 80 | snippet alias "alias : :" 81 | alias :${1:new_name} :${2:old_name} 82 | endsnippet 83 | 84 | # Mapping 85 | snippet "(\S+)\.mapp" ".map { || }" r 86 | `!p snip.rv=match.group(1)`.map { |${1:`!p 87 | element_name = match.group(1).lstrip('$@') 88 | ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name) 89 | try: 90 | wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1)) 91 | snip.rv = wmatch.group(1).lower() 92 | except: 93 | snip.rv = 'element' 94 | `}| $0 } 95 | endsnippet 96 | 97 | snippet "(\S+)\.map" ".map do || end" r 98 | `!p snip.rv=match.group(1)`.map do |${1:`!p 99 | element_name = match.group(1).lstrip('$@') 100 | ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name) 101 | try: 102 | wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1)) 103 | snip.rv = wmatch.group(1).lower() 104 | except: 105 | snip.rv = 'element' 106 | `}| 107 | $0 108 | end 109 | endsnippet 110 | 111 | # Looping 112 | snippet "(\S+)\.each" ".each do || end" r 113 | `!p snip.rv=match.group(1)`.each do |${1:`!p 114 | element_name = match.group(1).lstrip('$@') 115 | ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name) 116 | try: 117 | wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1)) 118 | snip.rv = wmatch.group(1).lower() 119 | except: 120 | snip.rv = 'element' 121 | `}| 122 | $0 123 | end 124 | endsnippet 125 | 126 | # Blocks 127 | snippet do "do || ... end" i 128 | do |${1:args}| 129 | ${0:${VISUAL:object}} 130 | end 131 | endsnippet 132 | 133 | snippet doo "do ... end" i 134 | do 135 | ${0:${VISUAL:object}} 136 | end 137 | endsnippet 138 | 139 | snippet begin "begin ... rescue ... end" 140 | begin 141 | $1 142 | rescue 143 | $0 144 | end 145 | endsnippet 146 | 147 | snippet rescue 148 | rescue ${1:Exception }=> e 149 | puts e.message 150 | puts e.backtrace.inspect 151 | ${0:# Rescue} 152 | endsnippet 153 | 154 | snippet "\b(case|sw(itch)?)" "case when ... end" r 155 | case ${1:variable} 156 | when ${2:expression} 157 | $0 158 | end 159 | endsnippet 160 | 161 | # Classes 162 | snippet class "class def initialize ... end end" 163 | class ${1:ClassName} 164 | def initialize(${2:*args}) 165 | $0 166 | end 167 | end 168 | endsnippet 169 | 170 | # Modules 171 | snippet "mod(ule)?" "module" r 172 | module ${1:ModuleName} 173 | ${0:${VISUAL:# code}} 174 | end 175 | endsnippet 176 | 177 | # RSpec 178 | snippet "(setup|rspec)" "RSpec setup (setup)" r 179 | require "spec_helper" 180 | 181 | describe ${1:Model} do 182 | ${0:${VISUAL:# code}} 183 | end 184 | endsnippet 185 | 186 | snippet "des(cribe)?" "RSpec describe block (des)" r 187 | describe "${1:.method_name}" do 188 | ${0:${VISUAL:# assertions}} 189 | end 190 | endsnippet 191 | 192 | snippet "feat(ure)?" "RSpec feature block (feature)" r 193 | feature "${1:scenario}" do 194 | ${0:${VISUAL:# assertions}} 195 | end 196 | endsnippet 197 | 198 | snippet "con(text)?" "RSpec context block (con)" r 199 | context "${1:when in context}" do 200 | ${0:${VISUAL:# assertions}} 201 | end 202 | endsnippet 203 | 204 | snippet before "RSpec before block (before)" 205 | before do 206 | ${0:${VISUAL:# before spec}} 207 | end 208 | endsnippet 209 | 210 | snippet after "RSpec after block (after)" 211 | after do 212 | ${0:${VISUAL:# after spec}} 213 | end 214 | endsnippet 215 | 216 | snippet around "RSpec around block (around)" 217 | around do |example| 218 | $0 219 | example.run 220 | end 221 | endsnippet 222 | 223 | snippet "back(ground)?" "RSpec background block (background)" r 224 | background do 225 | ${0:${VISUAL:# before feature spec}} 226 | end 227 | endsnippet 228 | 229 | snippet let "RSpec let block (let)" 230 | let(:${1:name}) { ${0:${VISUAL:object}} } 231 | endsnippet 232 | 233 | snippet let! "RSpec let! block (let!)" 234 | let!(:${1:name}) { ${0:${VISUAL:object}} } 235 | endsnippet 236 | 237 | snippet "sub(ject)?" "RSpec subject block (subject)" r 238 | subject { ${0:${VISUAL:object}} } 239 | endsnippet 240 | 241 | snippet it "RSpec it block (it)" 242 | it "${1:does something}" do 243 | ${0:${VISUAL:object}} 244 | end 245 | endsnippet 246 | 247 | snippet "sc(enario)?" "RSpec scenario block (scenario)" r 248 | scenario "${1:does something}" do 249 | ${0:${VISUAL:object}} 250 | end 251 | endsnippet 252 | 253 | snippet "ex(pect)?" "RSpec expect block (expect)" r 254 | expect(${1:subject}).to ${0:${VISUAL:assertion}} 255 | endsnippet 256 | 257 | snippet within "Capybara within block (within)" 258 | within "${1:selector}" do 259 | ${0:${VISUAL:object}} 260 | end 261 | endsnippet 262 | 263 | snippet saop "save_and_open_page" 264 | save_and_open_page 265 | endsnippet 266 | 267 | # vim: set ts=2 sw=2 expandtab: 268 | -------------------------------------------------------------------------------- /iterm2/base16-suzume.dark.itermcolors: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ansi 0 Color 6 | 7 | Alpha Component 8 | 1 9 | Blue Component 10 | 0.0 11 | Color Space 12 | sRGB 13 | Green Component 14 | 0.0 15 | Red Component 16 | 0.0 17 | 18 | Ansi 1 Color 19 | 20 | Alpha Component 21 | 1 22 | Blue Component 23 | 0.1398729681968689 24 | Color Space 25 | sRGB 26 | Green Component 27 | 0.19611293077468872 28 | Red Component 29 | 0.9217606782913208 30 | 31 | Ansi 10 Color 32 | 33 | Alpha Component 34 | 1 35 | Blue Component 36 | 0.16799864172935486 37 | Color Space 38 | sRGB 39 | Green Component 40 | 0.6702880859375 41 | Red Component 42 | 0.075562871992588043 43 | 44 | Ansi 11 Color 45 | 46 | Alpha Component 47 | 1 48 | Blue Component 49 | 1 50 | Color Space 51 | sRGB 52 | Green Component 53 | 0.86967986822128296 54 | Red Component 55 | 0.75814181566238403 56 | 57 | Ansi 12 Color 58 | 59 | Alpha Component 60 | 1 61 | Blue Component 62 | 0.6571815013885498 63 | Color Space 64 | sRGB 65 | Green Component 66 | 0.65367108583450317 67 | Red Component 68 | 0.64999270439147949 69 | 70 | Ansi 13 Color 71 | 72 | Alpha Component 73 | 1 74 | Blue Component 75 | 0.88943415880203247 76 | Color Space 77 | sRGB 78 | Green Component 79 | 0.88623952865600586 80 | Red Component 81 | 0.88289433717727661 82 | 83 | Ansi 14 Color 84 | 85 | Alpha Component 86 | 1 87 | Blue Component 88 | 0.86083775758743286 89 | Color Space 90 | sRGB 91 | Green Component 92 | 0.74846744537353516 93 | Red Component 94 | 0.56910878419876099 95 | 96 | Ansi 15 Color 97 | 98 | Alpha Component 99 | 1 100 | Blue Component 101 | 0.99999994039535522 102 | Color Space 103 | sRGB 104 | Green Component 105 | 0.99999994039535522 106 | Red Component 107 | 1 108 | 109 | Ansi 2 Color 110 | 111 | Alpha Component 112 | 1 113 | Blue Component 114 | 0.0074280789121985435 115 | Color Space 116 | sRGB 117 | Green Component 118 | 0.70786935091018677 119 | Red Component 120 | 0.36360976099967957 121 | 122 | Ansi 3 Color 123 | 124 | Alpha Component 125 | 1 126 | Blue Component 127 | 0.45030468702316284 128 | Color Space 129 | sRGB 130 | Green Component 131 | 0.68734639883041382 132 | Red Component 133 | 0.89356523752212524 134 | 135 | Ansi 4 Color 136 | 137 | Alpha Component 138 | 1 139 | Blue Component 140 | 0.8579171895980835 141 | Color Space 142 | sRGB 143 | Green Component 144 | 0.63667339086532593 145 | Red Component 146 | 0.25295686721801758 147 | 148 | Ansi 5 Color 149 | 150 | Alpha Component 151 | 1 152 | Blue Component 153 | 0.74787729978561401 154 | Color Space 155 | sRGB 156 | Green Component 157 | 0.50664401054382324 158 | Red Component 159 | 0.53446602821350098 160 | 161 | Ansi 6 Color 162 | 163 | Alpha Component 164 | 1 165 | Blue Component 166 | 0.86083775758743286 167 | Color Space 168 | sRGB 169 | Green Component 170 | 0.74846744537353516 171 | Red Component 172 | 0.56910878419876099 173 | 174 | Ansi 7 Color 175 | 176 | Alpha Component 177 | 1 178 | Blue Component 179 | 0.99999994039535522 180 | Color Space 181 | sRGB 182 | Green Component 183 | 0.99999994039535522 184 | Red Component 185 | 1 186 | 187 | Ansi 8 Color 188 | 189 | Alpha Component 190 | 1 191 | Blue Component 192 | 0.53316670656204224 193 | Color Space 194 | sRGB 195 | Green Component 196 | 0.52942442893981934 197 | Red Component 198 | 0.52550071477890015 199 | 200 | Ansi 9 Color 201 | 202 | Alpha Component 203 | 1 204 | Blue Component 205 | 0.0 206 | Color Space 207 | sRGB 208 | Green Component 209 | 0.59190851449966431 210 | Red Component 211 | 1 212 | 213 | Background Color 214 | 215 | Alpha Component 216 | 1 217 | Blue Component 218 | 0.0 219 | Color Space 220 | sRGB 221 | Green Component 222 | 0.0 223 | Red Component 224 | 0.0 225 | 226 | Badge Color 227 | 228 | Alpha Component 229 | 0.5 230 | Blue Component 231 | 0.0 232 | Color Space 233 | sRGB 234 | Green Component 235 | 0.14910027384757996 236 | Red Component 237 | 1 238 | 239 | Bold Color 240 | 241 | Alpha Component 242 | 1 243 | Blue Component 244 | 0.99999994039535522 245 | Color Space 246 | sRGB 247 | Green Component 248 | 0.99999994039535522 249 | Red Component 250 | 1 251 | 252 | Cursor Color 253 | 254 | Alpha Component 255 | 1 256 | Blue Component 257 | 0.99999994039535522 258 | Color Space 259 | sRGB 260 | Green Component 261 | 0.99999994039535522 262 | Red Component 263 | 1 264 | 265 | Cursor Guide Color 266 | 267 | Alpha Component 268 | 0.25 269 | Blue Component 270 | 1 271 | Color Space 272 | sRGB 273 | Green Component 274 | 0.92681378126144409 275 | Red Component 276 | 0.70214027166366577 277 | 278 | Cursor Text Color 279 | 280 | Alpha Component 281 | 1 282 | Blue Component 283 | 0.0 284 | Color Space 285 | sRGB 286 | Green Component 287 | 0.0 288 | Red Component 289 | 0.0 290 | 291 | Foreground Color 292 | 293 | Alpha Component 294 | 1 295 | Blue Component 296 | 0.99999994039535522 297 | Color Space 298 | sRGB 299 | Green Component 300 | 0.99999994039535522 301 | Red Component 302 | 1 303 | 304 | Link Color 305 | 306 | Alpha Component 307 | 1 308 | Blue Component 309 | 0.73422712087631226 310 | Color Space 311 | sRGB 312 | Green Component 313 | 0.35915297269821167 314 | Red Component 315 | 0.0 316 | 317 | Selected Text Color 318 | 319 | Alpha Component 320 | 1 321 | Blue Component 322 | 0.0 323 | Color Space 324 | sRGB 325 | Green Component 326 | 0.0 327 | Red Component 328 | 0.0 329 | 330 | Selection Color 331 | 332 | Alpha Component 333 | 1 334 | Blue Component 335 | 1 336 | Color Space 337 | sRGB 338 | Green Component 339 | 0.86967986822128296 340 | Red Component 341 | 0.75814181566238403 342 | 343 | 344 | 345 | -------------------------------------------------------------------------------- /hammerspoon/Spoons/URLDispatcher.spoon/docs.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Command": [], 4 | "Constant": [], 5 | "Constructor": [], 6 | "Deprecated": [], 7 | "Field": [], 8 | "Function": [], 9 | "Method": [ 10 | { 11 | "def": "URLDispatcher:dispatchURL(scheme, host, params, fullUrl)", 12 | "desc": "Dispatch a URL to an application according to the defined `url_patterns`.", 13 | "doc": "Dispatch a URL to an application according to the defined `url_patterns`.\n\nParameters (according to the [httpCallback](http://www.hammerspoon.org/docs/hs.urlevent.html#httpCallback) specification):\n * scheme - A string containing the URL scheme (i.e. \"http\")\n * host - A string containing the host requested (e.g. \"www.hammerspoon.org\")\n * params - A table containing the key/value pairs of all the URL parameters\n * fullURL - A string containing the full, original URL", 14 | "name": "dispatchURL", 15 | "signature": "URLDispatcher:dispatchURL(scheme, host, params, fullUrl)", 16 | "stripped_doc": "Parameters (according to the [httpCallback](http://www.hammerspoon.org/docs/hs.urlevent.html#httpCallback) specification):\n * scheme - A string containing the URL scheme (i.e. \"http\")\n * host - A string containing the host requested (e.g. \"www.hammerspoon.org\")\n * params - A table containing the key/value pairs of all the URL parameters\n * fullURL - A string containing the full, original URL", 17 | "type": "Method" 18 | }, 19 | { 20 | "def": "URLDispatcher:start()", 21 | "desc": "Start dispatching URLs according to the rules", 22 | "doc": "Start dispatching URLs according to the rules", 23 | "name": "start", 24 | "signature": "URLDispatcher:start()", 25 | "stripped_doc": "", 26 | "type": "Method" 27 | } 28 | ], 29 | "Variable": [ 30 | { 31 | "def": "URLDispatcher.decode_slack_redir_urls", 32 | "desc": "If true, handle Slack-redir URLs to apply the rule on the destination URL. Defaults to `true`", 33 | "doc": "If true, handle Slack-redir URLs to apply the rule on the destination URL. Defaults to `true`", 34 | "name": "decode_slack_redir_urls", 35 | "signature": "URLDispatcher.decode_slack_redir_urls", 36 | "stripped_doc": "", 37 | "type": "Variable" 38 | }, 39 | { 40 | "def": "URLDispatcher.default_handler", 41 | "desc": "Bundle ID for default URL handler. (Defaults to `\"com.apple.Safari\"`)", 42 | "doc": "Bundle ID for default URL handler. (Defaults to `\"com.apple.Safari\"`)", 43 | "name": "default_handler", 44 | "signature": "URLDispatcher.default_handler", 45 | "stripped_doc": "", 46 | "type": "Variable" 47 | }, 48 | { 49 | "def": "URLDispatcher.logger", 50 | "desc": "Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon.", 51 | "doc": "Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon.", 52 | "name": "logger", 53 | "signature": "URLDispatcher.logger", 54 | "stripped_doc": "", 55 | "type": "Variable" 56 | }, 57 | { 58 | "def": "URLDispatcher.url_patterns", 59 | "desc": "URL dispatch rules.", 60 | "doc": "URL dispatch rules.\nA table containing a list of dispatch rules. Each rule should be its own table in the format: `{ \"url pattern\", \"application bundle ID\", \"function\" }`, and they are evaluated in the order they are declared. Note that the patterns are [Lua patterns](https://www.lua.org/pil/20.2.html) and not regular expressions. Defaults to an empty table, which has the effect of having all URLs dispatched to the `default_handler`. If \"application bundle ID\" is specified, that application will be used to open matching URLs. If no \"application bundle ID\" is specified, but \"function\" is provided (and is a Lua function) it will be called with the URL.", 61 | "name": "url_patterns", 62 | "signature": "URLDispatcher.url_patterns", 63 | "stripped_doc": "A table containing a list of dispatch rules. Each rule should be its own table in the format: `{ \"url pattern\", \"application bundle ID\", \"function\" }`, and they are evaluated in the order they are declared. Note that the patterns are [Lua patterns](https://www.lua.org/pil/20.2.html) and not regular expressions. Defaults to an empty table, which has the effect of having all URLs dispatched to the `default_handler`. If \"application bundle ID\" is specified, that application will be used to open matching URLs. If no \"application bundle ID\" is specified, but \"function\" is provided (and is a Lua function) it will be called with the URL.", 64 | "type": "Variable" 65 | } 66 | ], 67 | "desc": "Route URLs to different applications with pattern matching", 68 | "doc": "Route URLs to different applications with pattern matching\n\nDownload: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/URLDispatcher.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/URLDispatcher.spoon.zip)\n\nSets Hammerspoon as the default browser for HTTP/HTTPS links, and\ndispatches them to different apps according to the patterns defined\nin the config. If no pattern matches, `default_handler` is used.", 69 | "items": [ 70 | { 71 | "def": "URLDispatcher.decode_slack_redir_urls", 72 | "desc": "If true, handle Slack-redir URLs to apply the rule on the destination URL. Defaults to `true`", 73 | "doc": "If true, handle Slack-redir URLs to apply the rule on the destination URL. Defaults to `true`", 74 | "name": "decode_slack_redir_urls", 75 | "signature": "URLDispatcher.decode_slack_redir_urls", 76 | "stripped_doc": "", 77 | "type": "Variable" 78 | }, 79 | { 80 | "def": "URLDispatcher.default_handler", 81 | "desc": "Bundle ID for default URL handler. (Defaults to `\"com.apple.Safari\"`)", 82 | "doc": "Bundle ID for default URL handler. (Defaults to `\"com.apple.Safari\"`)", 83 | "name": "default_handler", 84 | "signature": "URLDispatcher.default_handler", 85 | "stripped_doc": "", 86 | "type": "Variable" 87 | }, 88 | { 89 | "def": "URLDispatcher:dispatchURL(scheme, host, params, fullUrl)", 90 | "desc": "Dispatch a URL to an application according to the defined `url_patterns`.", 91 | "doc": "Dispatch a URL to an application according to the defined `url_patterns`.\n\nParameters (according to the [httpCallback](http://www.hammerspoon.org/docs/hs.urlevent.html#httpCallback) specification):\n * scheme - A string containing the URL scheme (i.e. \"http\")\n * host - A string containing the host requested (e.g. \"www.hammerspoon.org\")\n * params - A table containing the key/value pairs of all the URL parameters\n * fullURL - A string containing the full, original URL", 92 | "name": "dispatchURL", 93 | "signature": "URLDispatcher:dispatchURL(scheme, host, params, fullUrl)", 94 | "stripped_doc": "Parameters (according to the [httpCallback](http://www.hammerspoon.org/docs/hs.urlevent.html#httpCallback) specification):\n * scheme - A string containing the URL scheme (i.e. \"http\")\n * host - A string containing the host requested (e.g. \"www.hammerspoon.org\")\n * params - A table containing the key/value pairs of all the URL parameters\n * fullURL - A string containing the full, original URL", 95 | "type": "Method" 96 | }, 97 | { 98 | "def": "URLDispatcher.logger", 99 | "desc": "Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon.", 100 | "doc": "Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon.", 101 | "name": "logger", 102 | "signature": "URLDispatcher.logger", 103 | "stripped_doc": "", 104 | "type": "Variable" 105 | }, 106 | { 107 | "def": "URLDispatcher:start()", 108 | "desc": "Start dispatching URLs according to the rules", 109 | "doc": "Start dispatching URLs according to the rules", 110 | "name": "start", 111 | "signature": "URLDispatcher:start()", 112 | "stripped_doc": "", 113 | "type": "Method" 114 | }, 115 | { 116 | "def": "URLDispatcher.url_patterns", 117 | "desc": "URL dispatch rules.", 118 | "doc": "URL dispatch rules.\nA table containing a list of dispatch rules. Each rule should be its own table in the format: `{ \"url pattern\", \"application bundle ID\", \"function\" }`, and they are evaluated in the order they are declared. Note that the patterns are [Lua patterns](https://www.lua.org/pil/20.2.html) and not regular expressions. Defaults to an empty table, which has the effect of having all URLs dispatched to the `default_handler`. If \"application bundle ID\" is specified, that application will be used to open matching URLs. If no \"application bundle ID\" is specified, but \"function\" is provided (and is a Lua function) it will be called with the URL.", 119 | "name": "url_patterns", 120 | "signature": "URLDispatcher.url_patterns", 121 | "stripped_doc": "A table containing a list of dispatch rules. Each rule should be its own table in the format: `{ \"url pattern\", \"application bundle ID\", \"function\" }`, and they are evaluated in the order they are declared. Note that the patterns are [Lua patterns](https://www.lua.org/pil/20.2.html) and not regular expressions. Defaults to an empty table, which has the effect of having all URLs dispatched to the `default_handler`. If \"application bundle ID\" is specified, that application will be used to open matching URLs. If no \"application bundle ID\" is specified, but \"function\" is provided (and is a Lua function) it will be called with the URL.", 122 | "type": "Variable" 123 | } 124 | ], 125 | "name": "URLDispatcher", 126 | "stripped_doc": "\nDownload: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/URLDispatcher.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/URLDispatcher.spoon.zip)\n\nSets Hammerspoon as the default browser for HTTP/HTTPS links, and\ndispatches them to different apps according to the patterns defined\nin the config. If no pattern matches, `default_handler` is used.", 127 | "submodules": [], 128 | "type": "Module" 129 | } 130 | ] -------------------------------------------------------------------------------- /.macos: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Comprehensive list here: 4 | # https://github.com/mathiasbynens/dotfiles/blob/main/.macos 5 | 6 | # How-to detect (non-hidden) settings: 7 | # see: http://superuser.com/questions/455755/how-to-explore-more-defaults-write-tweaks-on-os-x 8 | 9 | # Ask for the administrator password upfront 10 | sudo -v 11 | 12 | # Keep-alive: update existing `sudo` time stamp until `.osx` has finished 13 | while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & 14 | 15 | ################################################################################ 16 | # General settings 17 | 18 | # Disable the sound effects on boot 19 | sudo nvram SystemAudioVolume=" " 20 | 21 | # Customize sign in screen 22 | defaults write com.apple.loginwindow LoginwindowText "email me at: tom@tomdebruijn.com" 23 | 24 | # Menu bar 25 | # Set sidebar icon size to medium 26 | defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2 27 | 28 | # Always show scrollbars 29 | defaults write NSGlobalDomain AppleShowScrollBars -string "Always" 30 | 31 | # Expand save panel by default 32 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true 33 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true 34 | 35 | # Expand print panel by default 36 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true 37 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true 38 | 39 | # Save to disk (not to iCloud) by default 40 | defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false 41 | 42 | # Disable Resume system-wide 43 | defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false 44 | 45 | # Disable automatic termination of inactive apps 46 | defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true 47 | 48 | # Disable automatic capitalization as it’s annoying when typing code 49 | defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false 50 | 51 | # Disable smart dashes as they’re annoying when typing code 52 | defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false 53 | 54 | # Disable automatic period substitution as it’s annoying when typing code 55 | defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false 56 | 57 | # Disable smart quotes as they’re annoying when typing code 58 | defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false 59 | 60 | # Disable auto-correct 61 | defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false 62 | 63 | ################################################################################ 64 | # Trackpad 65 | 66 | # Trackpad: enable tap to click for this user and for the login screen 67 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true 68 | defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 69 | defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 70 | 71 | # Trackpad: map bottom right corner to right-click 72 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 73 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true 74 | defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 75 | defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true 76 | 77 | # Enable full keyboard access for all controls 78 | # (e.g. enable Tab in modal dialogs) 79 | defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 80 | 81 | # Disable press-and-hold for keys in favor of key repeat 82 | defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false 83 | 84 | # Increase key repeat speed 85 | defaults write NSGlobalDomain KeyRepeat -int 1 86 | defaults write NSGlobalDomain InitialKeyRepeat -int 10 87 | 88 | # Set language and text formats 89 | defaults write NSGlobalDomain AppleLanguages -array "en" "nl" 90 | defaults write NSGlobalDomain AppleLocale -string "en_NL@currency=EUR" 91 | defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" 92 | defaults write NSGlobalDomain AppleMetricUnits -bool true 93 | 94 | ################################################################################ 95 | # Screen 96 | 97 | # Require password immediately after sleep or screen saver begins 98 | defaults write com.apple.screensaver askForPassword -int 1 99 | defaults write com.apple.screensaver askForPasswordDelay -int 0 100 | 101 | # Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) 102 | defaults write com.apple.screencapture type -string "png" 103 | 104 | # Disable shadow in screenshots 105 | defaults write com.apple.screencapture disable-shadow -bool true 106 | 107 | ################################################################################ 108 | # Finder 109 | 110 | # Set Downloads as the default location for new Finder windows 111 | defaults write com.apple.finder NewWindowTarget -string "PfLo" 112 | defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Downloads/" 113 | 114 | # Don't show icons for hard drives, servers, and removable media on the desktop 115 | defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool false 116 | defaults write com.apple.finder ShowHardDrivesOnDesktop -bool false 117 | defaults write com.apple.finder ShowMountedServersOnDesktop -bool false 118 | defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool false 119 | 120 | # Show all filename extensions 121 | defaults write NSGlobalDomain AppleShowAllExtensions -bool true 122 | 123 | # Show status bar 124 | defaults write com.apple.finder ShowStatusBar -bool true 125 | 126 | # Show path bar 127 | defaults write com.apple.finder ShowPathbar -bool true 128 | 129 | # Allow text selection in Quick Look 130 | defaults write com.apple.finder QLEnableTextSelection -bool true 131 | 132 | # When performing a search, search the current folder by default 133 | defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" 134 | 135 | # Disable the warning when changing a file extension 136 | defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false 137 | 138 | # Enable spring loading for directories 139 | defaults write NSGlobalDomain com.apple.springing.enabled -bool true 140 | 141 | # Remove the spring loading delay for directories 142 | defaults write NSGlobalDomain com.apple.springing.delay -float 0 143 | 144 | # Avoid creating .DS_Store files on network volumes 145 | defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true 146 | 147 | # Use list view in all Finder windows by default 148 | # Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv` 149 | defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" 150 | 151 | # Enable AirDrop over Ethernet and on unsupported Macs running Lion 152 | defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true 153 | 154 | # Show the ~/Library folder 155 | chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library 156 | 157 | # Show the /Volumes folder 158 | sudo chflags nohidden /Volumes 159 | 160 | # Expand the following File Info panes: 161 | # “General”, “Open with”, and “Sharing & Permissions” 162 | defaults write com.apple.finder FXInfoPanesExpanded -dict \ 163 | General -bool true \ 164 | OpenWith -bool true \ 165 | Privileges -bool true 166 | 167 | ################################################################################ 168 | # Dock 169 | 170 | # Set the icon size of Dock items 171 | defaults write com.apple.dock tilesize -int 60 172 | 173 | # Automatically hide and show the Dock 174 | defaults write com.apple.dock autohide -bool true 175 | 176 | # Don’t show Dashboard as a Space 177 | defaults write com.apple.dock dashboard-in-overlay -bool true 178 | 179 | # Don't automatically rearrange Spaces based on most recent use 180 | defaults write com.apple.dock mru-spaces -bool false 181 | 182 | # Add iOS Simulator to Launchpad 183 | sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app" "/Applications/Simulator.app" 184 | 185 | ################################################################################ 186 | # Safari 187 | 188 | # Privacy: don’t send search queries to Apple 189 | defaults write com.apple.Safari UniversalSearchEnabled -bool false 190 | defaults write com.apple.Safari SuppressSearchSuggestions -bool true 191 | 192 | # Show the full URL in the address bar (note: this still hides the scheme) 193 | defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true 194 | 195 | # Prevent Safari from opening ‘safe’ files automatically after downloading 196 | defaults write com.apple.Safari AutoOpenSafeDownloads -bool false 197 | 198 | # Allow hitting the Backspace key to go to the previous page in history 199 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true 200 | 201 | # Enable Safari’s debug menu 202 | defaults write com.apple.Safari IncludeInternalDebugMenu -bool true 203 | 204 | # Make Safari’s search banners default to Contains instead of Starts With 205 | defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false 206 | 207 | # Enable the Develop menu and the Web Inspector in Safari 208 | defaults write com.apple.Safari IncludeDevelopMenu -bool true 209 | defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true 210 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true 211 | 212 | # Add a context menu item for showing the Web Inspector in web views 213 | defaults write NSGlobalDomain WebKitDeveloperExtras -bool true 214 | 215 | ############################################################################### 216 | # Activity Monitor 217 | 218 | # Show the main window when launching Activity Monitor 219 | defaults write com.apple.ActivityMonitor OpenMainWindow -bool true 220 | 221 | # Show all processes in Activity Monitor 222 | defaults write com.apple.ActivityMonitor ShowCategory -int 0 223 | 224 | # Sort Activity Monitor results by CPU usage 225 | defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage" 226 | defaults write com.apple.ActivityMonitor SortDirection -int 0 227 | 228 | ################################################################################ 229 | # TextEdit 230 | 231 | # Use plain text mode for new TextEdit documents 232 | defaults write com.apple.TextEdit RichText -int 0 233 | 234 | # Open and save files as UTF-8 in TextEdit 235 | defaults write com.apple.TextEdit PlainTextEncoding -int 4 236 | defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 237 | 238 | ################################################################################ 239 | # Chrome 240 | 241 | # Expand the print dialog by default 242 | defaults write com.google.Chrome PMPrintingExpandedStateForPrint2 -bool true 243 | defaults write com.google.Chrome.canary PMPrintingExpandedStateForPrint2 -bool true 244 | 245 | ############################################################################### 246 | # Kill affected applications 247 | 248 | for app in "Activity Monitor" "Spotlight" "Dashboard" "Dock" "Finder" \ 249 | "Google Chrome" "Messages" "Safari" "SystemUIServer"; do 250 | killall "${app}" > /dev/null 2>&1 251 | done 252 | 253 | echo "Done. A restart maybe required for some settings." 254 | -------------------------------------------------------------------------------- /vim/.vim/colors/twilight.vim: -------------------------------------------------------------------------------- 1 | " Vim color file 2 | " Converted from Textmate theme Twilight using Coloration v0.3.2 (http://github.com/sickill/coloration) 3 | " Source: https://github.com/jaywilliams/vim-vwilight/blob/a96c183664d79c68888b4f86370dacbf049ef7d7/colors/vwilight.vim 4 | 5 | set background=dark 6 | highlight clear 7 | 8 | if exists("syntax_on") 9 | syntax reset 10 | endif 11 | 12 | let g:colors_name = "twilight" 13 | 14 | hi Cursor ctermfg=NONE ctermbg=248 cterm=NONE guifg=NONE guibg=#a7a7a7 gui=NONE 15 | hi Visual ctermfg=NONE ctermbg=59 cterm=NONE guifg=NONE guibg=#3c4043 gui=NONE 16 | hi CursorLine ctermfg=NONE ctermbg=235 cterm=NONE guifg=NONE guibg=#2b2b2b gui=NONE 17 | hi CursorColumn ctermfg=NONE ctermbg=235 cterm=NONE guifg=NONE guibg=#2b2b2b gui=NONE 18 | hi ColorColumn ctermfg=NONE ctermbg=235 cterm=NONE guifg=NONE guibg=#2b2b2b gui=NONE 19 | hi LineNr ctermfg=245 ctermbg=235 cterm=NONE guifg=#868686 guibg=#2b2b2b gui=NONE 20 | hi SignColumn ctermfg=245 ctermbg=235 cterm=NONE guifg=#868686 guibg=#2b2b2b gui=NONE 21 | hi VertSplit ctermfg=240 ctermbg=240 cterm=NONE guifg=#565656 guibg=#565656 gui=NONE 22 | hi MatchParen ctermfg=179 ctermbg=NONE cterm=NONE guifg=#cda869 guibg=NONE gui=NONE 23 | hi StatusLine ctermfg=231 ctermbg=240 cterm=bold guifg=#f8f8f8 guibg=#565656 gui=bold 24 | hi StatusLineNC ctermfg=231 ctermbg=240 cterm=NONE guifg=#f8f8f8 guibg=#565656 gui=NONE 25 | hi Pmenu ctermfg=95 ctermbg=NONE cterm=NONE guifg=#9b703f guibg=NONE gui=NONE 26 | hi PmenuSel ctermfg=NONE ctermbg=59 cterm=NONE guifg=NONE guibg=#3c4043 gui=NONE 27 | hi IncSearch ctermfg=NONE ctermbg=59 cterm=NONE guifg=#ffffff guibg=#ba0000 gui=NONE 28 | hi Search ctermfg=NONE ctermbg=59 cterm=NONE guifg=#ffffff guibg=#ba0000 gui=NONE 29 | hi Directory ctermfg=6 ctermbg=NONE cterm=NONE guifg=#cf6a4c guibg=NONE gui=NONE 30 | hi Folded ctermfg=59 ctermbg=233 cterm=NONE guifg=#5f5a60 guibg=#141414 gui=NONE 31 | 32 | hi Normal ctermfg=231 ctermbg=0 cterm=NONE guifg=#f8f8f8 guibg=#141414 gui=NONE 33 | hi Boolean ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cf6a4c guibg=NONE gui=NONE 34 | hi Character ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cf6a4c guibg=NONE gui=NONE 35 | hi Comment ctermfg=59 ctermbg=NONE cterm=NONE guifg=#5f5a60 guibg=NONE gui=NONE 36 | hi Conditional ctermfg=179 ctermbg=NONE cterm=NONE guifg=#cda869 guibg=NONE gui=NONE 37 | hi Constant ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cf6a4c guibg=NONE gui=NONE 38 | hi Define ctermfg=179 ctermbg=NONE cterm=NONE guifg=#cda869 guibg=NONE gui=NONE 39 | hi ErrorMsg ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE 40 | hi WarningMsg ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE 41 | hi Float ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cf6a4c guibg=NONE gui=NONE 42 | hi Function ctermfg=95 ctermbg=NONE cterm=NONE guifg=#9b703f guibg=NONE gui=NONE 43 | hi Identifier ctermfg=228 ctermbg=NONE cterm=NONE guifg=#f9ee98 guibg=NONE gui=NONE 44 | hi Keyword ctermfg=179 ctermbg=NONE cterm=NONE guifg=#cda869 guibg=NONE gui=NONE 45 | hi Label ctermfg=107 ctermbg=NONE cterm=NONE guifg=#8f9d6a guibg=NONE gui=NONE 46 | hi NonText ctermfg=239 ctermbg=0 cterm=NONE guifg=#4f4f4f guibg=NONE gui=NONE 47 | hi Number ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cf6a4c guibg=NONE gui=NONE 48 | hi Operator ctermfg=179 ctermbg=NONE cterm=NONE guifg=#cda869 guibg=NONE gui=NONE 49 | hi PreProc ctermfg=179 ctermbg=NONE cterm=NONE guifg=#cda869 guibg=NONE gui=NONE 50 | hi Special ctermfg=231 ctermbg=NONE cterm=NONE guifg=#f8f8f8 guibg=NONE gui=NONE 51 | hi SpecialKey ctermfg=239 ctermbg=235 cterm=NONE guifg=#4f4f4f guibg=NONE gui=NONE 52 | hi Statement ctermfg=3 ctermbg=NONE cterm=NONE guifg=#cda869 guibg=NONE gui=NONE 53 | hi StorageClass ctermfg=228 ctermbg=NONE cterm=NONE guifg=#f9ee98 guibg=NONE gui=NONE 54 | hi String ctermfg=107 ctermbg=NONE cterm=NONE guifg=#8f9d6a guibg=NONE gui=NONE 55 | hi Tag ctermfg=95 ctermbg=NONE cterm=NONE guifg=#9b703f guibg=NONE gui=NONE 56 | hi Title ctermfg=231 ctermbg=NONE cterm=bold guifg=#f8f8f8 guibg=NONE gui=bold 57 | hi Todo ctermfg=59 ctermbg=NONE cterm=inverse,bold guifg=#5f5a60 guibg=NONE gui=inverse,bold,italic 58 | hi Type ctermfg=94 ctermbg=NONE cterm=NONE guifg=#9b703f guibg=NONE gui=NONE 59 | hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline guifg=NONE guibg=NONE gui=underline 60 | 61 | hi rubyClass ctermfg=179 ctermbg=NONE cterm=NONE guifg=#cda869 guibg=NONE gui=NONE 62 | hi rubyFunction ctermfg=95 ctermbg=NONE cterm=NONE guifg=#9b703f guibg=NONE gui=NONE 63 | hi rubyInterpolationDelimiter ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE 64 | hi rubySymbol ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cf6a4c guibg=NONE gui=NONE 65 | hi rubyConstant ctermfg=103 ctermbg=NONE cterm=NONE guifg=#9b859d guibg=NONE gui=NONE 66 | hi rubyStringDelimiter ctermfg=107 ctermbg=NONE cterm=NONE guifg=#8f9d6a guibg=NONE gui=NONE 67 | hi rubyBlockParameter ctermfg=103 ctermbg=NONE cterm=NONE guifg=#7587a6 guibg=NONE gui=NONE 68 | hi rubyInstanceVariable ctermfg=103 ctermbg=NONE cterm=NONE guifg=#7587a6 guibg=NONE gui=NONE 69 | hi rubyInclude ctermfg=179 ctermbg=NONE cterm=NONE guifg=#cda869 guibg=NONE gui=NONE 70 | hi rubyGlobalVariable ctermfg=103 ctermbg=NONE cterm=NONE guifg=#7587a6 guibg=NONE gui=NONE 71 | hi rubyRegexp ctermfg=179 ctermbg=NONE cterm=NONE guifg=#e9c062 guibg=NONE gui=NONE 72 | hi rubyRegexpDelimiter ctermfg=179 ctermbg=NONE cterm=NONE guifg=#e9c062 guibg=NONE gui=NONE 73 | hi rubyEscape ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cf6a4c guibg=NONE gui=NONE 74 | hi rubyControl ctermfg=179 ctermbg=NONE cterm=NONE guifg=#cda869 guibg=NONE gui=NONE 75 | hi rubyClassVariable ctermfg=103 ctermbg=NONE cterm=NONE guifg=#7587a6 guibg=NONE gui=NONE 76 | hi rubyOperator ctermfg=179 ctermbg=NONE cterm=NONE guifg=#cda869 guibg=NONE gui=NONE 77 | hi rubyException ctermfg=179 ctermbg=NONE cterm=NONE guifg=#cda869 guibg=NONE gui=NONE 78 | hi rubyPseudoVariable ctermfg=103 ctermbg=NONE cterm=NONE guifg=#7587a6 guibg=NONE gui=NONE 79 | hi rubyRailsUserClass ctermfg=103 ctermbg=NONE cterm=NONE guifg=#9b859d guibg=NONE gui=NONE 80 | hi rubyRailsARAssociationMethod ctermfg=186 ctermbg=NONE cterm=NONE guifg=#dad085 guibg=NONE gui=NONE 81 | hi rubyRailsARMethod ctermfg=186 ctermbg=NONE cterm=NONE guifg=#dad085 guibg=NONE gui=NONE 82 | hi rubyRailsRenderMethod ctermfg=186 ctermbg=NONE cterm=NONE guifg=#dad085 guibg=NONE gui=NONE 83 | hi rubyRailsMethod ctermfg=186 ctermbg=NONE cterm=NONE guifg=#dad085 guibg=NONE gui=NONE 84 | 85 | hi erubyDelimiter ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE 86 | hi erubyComment ctermfg=59 ctermbg=NONE cterm=NONE guifg=#5f5a60 guibg=NONE gui=italic 87 | hi erubyRailsMethod ctermfg=186 ctermbg=NONE cterm=NONE guifg=#dad085 guibg=NONE gui=NONE 88 | 89 | hi htmlTag ctermfg=137 ctermbg=NONE cterm=NONE guifg=#ac885b guibg=NONE gui=NONE 90 | hi htmlEndTag ctermfg=137 ctermbg=NONE cterm=NONE guifg=#ac885b guibg=NONE gui=NONE 91 | hi htmlTagName ctermfg=137 ctermbg=NONE cterm=NONE guifg=#ac885b guibg=NONE gui=NONE 92 | hi htmlArg ctermfg=137 ctermbg=NONE cterm=NONE guifg=#ac885b guibg=NONE gui=NONE 93 | hi htmlSpecialChar ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cf6a4c guibg=NONE gui=NONE 94 | 95 | hi javaScriptFunction ctermfg=228 ctermbg=NONE cterm=NONE guifg=#f9ee98 guibg=NONE gui=NONE 96 | hi javaScriptRailsFunction ctermfg=186 ctermbg=NONE cterm=NONE guifg=#dad085 guibg=NONE gui=NONE 97 | hi javaScriptBraces ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE 98 | 99 | hi yamlKey ctermfg=95 ctermbg=NONE cterm=NONE guifg=#9b703f guibg=NONE gui=NONE 100 | hi yamlAnchor ctermfg=103 ctermbg=NONE cterm=NONE guifg=#7587a6 guibg=NONE gui=NONE 101 | hi yamlAlias ctermfg=103 ctermbg=NONE cterm=NONE guifg=#7587a6 guibg=NONE gui=NONE 102 | hi yamlDocumentHeader ctermfg=107 ctermbg=NONE cterm=NONE guifg=#8f9d6a guibg=NONE gui=NONE 103 | 104 | hi cssURL ctermfg=103 ctermbg=NONE cterm=NONE guifg=#7587a6 guibg=NONE gui=NONE 105 | hi cssFunctionName ctermfg=186 ctermbg=NONE cterm=NONE guifg=#dad085 guibg=NONE gui=NONE 106 | hi cssColor ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cf6a4c guibg=NONE gui=NONE 107 | hi cssPseudoClassId ctermfg=95 ctermbg=NONE cterm=NONE guifg=#9b703f guibg=NONE gui=NONE 108 | hi cssClassName ctermfg=95 ctermbg=NONE cterm=NONE guifg=#9b703f guibg=NONE gui=NONE 109 | hi cssValueLength ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cf6a4c guibg=NONE gui=NONE 110 | hi cssCommonAttr ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cf6a4c guibg=NONE gui=NONE 111 | hi cssBraces ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE 112 | 113 | " diff files 114 | hi diffAdded ctermfg=107 ctermbg=NONE cterm=NONE guifg=#8f9d6a guibg=NONE gui=NONE 115 | hi diffRemoved ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cf6a4c guibg=NONE gui=NONE 116 | 117 | " vimdiff 118 | hi diffAdd ctermfg=231 ctermbg=107 cterm=NONE guifg=#f8f8f8 guibg=#8f9d6a gui=NONE 119 | hi diffDelete ctermfg=231 ctermbg=167 cterm=NONE guifg=#f8f8f8 guibg=#cf6a4c gui=NONE 120 | hi diffChange ctermfg=231 ctermbg=103 cterm=NONE guifg=#f8f8f8 guibg=#7587a6 gui=NONE 121 | hi diffText ctermfg=231 ctermbg=139 cterm=NONE guifg=#f8f8f8 guibg=#af87af gui=NONE 122 | 123 | hi gitCommitUntrackedFile ctermfg=103 ctermbg=NONE cterm=NONE guifg=#7587a6 guibg=NONE gui=NONE 124 | hi gitCommitDiscardedFile ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cf6a4c guibg=NONE gui=NONE 125 | hi gitCommitDiscardedArrow ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cf6a4c guibg=NONE gui=NONE 126 | hi gitCommitDiscardedType ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cf6a4c guibg=NONE gui=NONE 127 | hi gitCommitUnmergedFile ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cf6a4c guibg=NONE gui=NONE 128 | hi gitCommitUnmergedArrow ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cf6a4c guibg=NONE gui=NONE 129 | hi gitCommitUnmergedType ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cf6a4c guibg=NONE gui=NONE 130 | hi gitCommitSelectedFile ctermfg=107 ctermbg=NONE cterm=NONE guifg=#8f9d6a guibg=NONE gui=NONE 131 | hi gitCommitSelectedArrow ctermfg=107 ctermbg=NONE cterm=NONE guifg=#8f9d6a guibg=NONE gui=NONE 132 | hi gitCommitSelectedType ctermfg=107 ctermbg=NONE cterm=NONE guifg=#8f9d6a guibg=NONE gui=NONE 133 | hi link GitGutterAdd GitGutterAddDefault 134 | hi link GitGutterChange GitGutterChangeDefault 135 | hi link GitGutterDelete GitGutterDeleteDefault 136 | hi link GitGutterChangeDelete GitGutterChangeDeleteDefault 137 | 138 | if ! has('gui_running') 139 | hi String ctermfg=2 140 | hi rubyGlobalVariable ctermfg=4 141 | hi Identifier ctermfg=3 142 | hi Constant ctermfg=1 143 | hi Number ctermfg=1 144 | hi Boolean ctermfg=1 145 | hi SpecialComment ctermfg=237 146 | hi link sqlKeyword sqlOperator 147 | 148 | hi doxygenOther ctermfg=3 149 | hi doxygenSpecial ctermfg=3 150 | hi doxygenParam ctermfg=3 151 | hi doxygenParamName ctermfg=6 cterm=NONE 152 | hi doxygenBOther ctermfg=3 153 | hi Type ctermfg=13 154 | hi Tag ctermfg=5 155 | hi Operator ctermfg=3 156 | hi Function ctermfg=7 157 | hi Identifier ctermfg=4 158 | 159 | hi clear htmlSpecialChar 160 | hi link htmlSpecialChar Constant 161 | 162 | hi vimHiTerm ctermfg=7 163 | hi PreProc ctermfg=1 164 | endif 165 | 166 | " Color Spelling Errors a little better 167 | hi clear SpellBad 168 | hi SpellBad cterm=underline ctermbg=NONE ctermfg=124 guifg=#ba0000 guibg=NONE gui=underline 169 | hi SpellCap ctermbg=235 ctermfg=NONE 170 | hi SpellRare ctermbg=235 ctermfg=NONE 171 | 172 | " NERDTree theme 173 | hi NERDTreeDir ctermfg=6 guifg=#91bfdc 174 | hi link NERDTreeDirSlash NERDTreeDir 175 | hi link NERDTreeClosable Normal 176 | hi link NERDTreeOpenable Normal 177 | "" Files 178 | hi NERDTreeExecFile ctermfg=2 guifg=#5FB41C 179 | "" Symlinks 180 | hi NERDTreeLinkDir ctermfg=5 guifg=#8881BD 181 | hi link NERDTreeLinkFile NERDTreeLinkDir 182 | hi NERDTreeLinkTarget ctermfg=8 guifg=#aaaaaa 183 | 184 | " Hide ~ symbol in gutter at end of buffer 185 | hi! link EndOfBuffer Ignore 186 | --------------------------------------------------------------------------------