From 9b1514ed3e61c7cebb2d40a0b2b04246f21df849 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sun, 19 Jul 2020 13:38:44 -0300 Subject: [PATCH] behold the power --- alacritty/alacritty.yml.symlink | 88 +++++++++++++++++++++++++++++++++ bin/atom-package-install | 13 ----- bin/battery-status | 39 --------------- bin/cloudapp | 62 ----------------------- bin/dns-flush | 6 --- bin/dot | 8 +-- bin/gitio | 33 ------------- bin/movieme | 30 ----------- bin/mustacheme | 56 --------------------- bin/res | 60 ---------------------- bin/set-defaults | 5 -- bin/todo | 18 ------- bin/yt | 9 ---- docker/aliases.zsh | 3 +- functions/_boom | 29 ----------- functions/_brew | 79 ----------------------------- functions/_c | 1 - functions/daily | 8 +++ functions/delete-ds | 3 ++ functions/history-top | 4 ++ functions/mcd | 4 ++ functions/ql | 3 ++ functions/today | 8 +++ git/aliases.zsh | 25 +--------- git/gitconfig.symlink | 6 +-- go/path.zsh | 2 - homebrew/install.sh | 2 - macos/install.sh | 3 +- macos/set-defaults.sh | 4 ++ node/install.sh | 9 +++- {yarn => node}/path.zsh | 0 nvim/aliases.zsh | 2 + quicklook/install.sh | 22 +++++++++ react-native/aliases.zsh | 4 ++ ruby/aliases.zsh | 3 -- ruby/completion.zsh | 22 --------- ruby/gemrc.symlink | 6 --- ruby/irbrc.symlink | 48 ------------------ ruby/rbenv.zsh | 5 -- system/_path.zsh | 2 +- system/aliases.zsh | 22 +++++++-- system/env.zsh | 2 +- tmux/tmux.colors.conf.symlink | 23 +++++++++ tmux/tmux.conf.symlink | 51 +++++++++++++++++++ vim/vimrc.symlink | 4 -- xcode/aliases.zsh | 5 ++ yarn/install.sh | 13 +++++ zsh/aliases.zsh | 1 - zsh/config.zsh | 4 +- zsh/fpath.zsh | 2 +- zsh/install.sh | 10 ++++ zsh/oh-my-zsh.zsh | 8 +++ zsh/path.zsh | 0 zsh/prompt.zsh | 77 ----------------------------- zsh/window.zsh | 19 ------- zsh/zshrc.symlink | 22 +++++++-- 56 files changed, 318 insertions(+), 679 deletions(-) create mode 100644 alacritty/alacritty.yml.symlink delete mode 100755 bin/atom-package-install delete mode 100755 bin/battery-status delete mode 100755 bin/cloudapp delete mode 100755 bin/dns-flush delete mode 100755 bin/gitio delete mode 100755 bin/movieme delete mode 100755 bin/mustacheme delete mode 100755 bin/res delete mode 100755 bin/set-defaults delete mode 100755 bin/todo delete mode 100755 bin/yt delete mode 100644 functions/_boom delete mode 100644 functions/_brew create mode 100644 functions/daily create mode 100644 functions/delete-ds create mode 100644 functions/history-top create mode 100644 functions/mcd create mode 100644 functions/ql create mode 100644 functions/today delete mode 100644 go/path.zsh rename {yarn => node}/path.zsh (100%) create mode 100644 nvim/aliases.zsh create mode 100755 quicklook/install.sh create mode 100644 react-native/aliases.zsh delete mode 100644 ruby/aliases.zsh delete mode 100644 ruby/completion.zsh delete mode 100644 ruby/gemrc.symlink delete mode 100644 ruby/irbrc.symlink delete mode 100644 ruby/rbenv.zsh create mode 100644 tmux/tmux.colors.conf.symlink create mode 100644 tmux/tmux.conf.symlink delete mode 100644 vim/vimrc.symlink create mode 100755 yarn/install.sh create mode 100755 zsh/install.sh create mode 100644 zsh/oh-my-zsh.zsh create mode 100644 zsh/path.zsh delete mode 100644 zsh/prompt.zsh delete mode 100644 zsh/window.zsh diff --git a/alacritty/alacritty.yml.symlink b/alacritty/alacritty.yml.symlink new file mode 100644 index 00000000000..8747bfd5c2f --- /dev/null +++ b/alacritty/alacritty.yml.symlink @@ -0,0 +1,88 @@ +font: + size: 14 + use_thin_strokes: false + normal: + family: Ligalex Mono + style: Regular + bold: + family: Ligalex Mono + style: Bold + italic: + family: Ligalex Mono + style: Italic + offset: + x: 0 + y: 20 + glyph_offset: + x: 0 + y: 10 + +window: + padding: + x: 30 + y: 25 + dynamic_padding: true + startup_mode: Maximized + decorations: none + +colors: + primary: + background: '#000000' + foreground: '#FFFFFF' + + dim_foreground: '#9a9a9a' + bright_foreground: '#ffffff' + + cursor: + text: '#000000' + cursor: '#ffffff' + + selection: + text: '#eaeaea' + background: '#404040' + + normal: + black: '#000000' + red: '#FF4143' + green: '#3DE163' + yellow: '#FFCC4B' + blue: '#1094C3' + magenta: '#7F4EFE' + cyan: '#76A9DB' + white: '#FFFFFF' + + bright: + black: '#666666' + red: '#ff3334' + green: '#9ec400' + yellow: '#e7c547' + blue: '#7aa6da' + magenta: '#b77ee0' + cyan: '#54ced6' + white: '#ffffff' + + dim: + black: '#000000' + red: '#8c3336' + green: '#7a8530' + yellow: '#97822e' + blue: '#506d8f' + magenta: '#80638e' + cyan: '#497e7a' + white: '#9a9a9a' + +key_bindings: + - { key: Key0, mods: Command, action: ResetFontSize } + - { key: Equals, mods: Command, action: IncreaseFontSize } + - { key: Add, mods: Command, action: IncreaseFontSize } + - { key: Minus, mods: Command, action: DecreaseFontSize } + - { key: C, mods: Alt, action: Copy } + - { key: V, mods: Alt, action: Paste } + - { key: J, mods: Alt, chars: "\x1bj" } + - { key: K, mods: Alt, chars: "\x1bk" } + - { key: H, mods: Alt, chars: "\x1bh" } + - { key: L, mods: Alt, chars: "\x1bl" } + - { key: K, mods: Command, action: ClearHistory } + - { key: F, mods: Command|Control, action: ToggleFullscreen } + +# vim:ft=yaml diff --git a/bin/atom-package-install b/bin/atom-package-install deleted file mode 100755 index 218bf414ee1..00000000000 --- a/bin/atom-package-install +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# -# Usage: atom-package-install -# -# Installs the atom packages listed in your packages.txt file -# located at ~/.dotfiles/atom.symlink/packages.txt -# -# You can generate a new list based on currently installed -# packages via atom-package-backup - -set -e - -apm install --packages-file ~/.dotfiles/atom.symlink/packages.txt diff --git a/bin/battery-status b/bin/battery-status deleted file mode 100755 index a0f75f0fb94..00000000000 --- a/bin/battery-status +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -# -# battery-status -# -# A quick little indicator for battery status on your Mac laptop, suitable for -# display in your prompt. - -if test ! "$(uname)" = "Darwin" - then - printf "" - exit 0 -fi - -battstat=$(pmset -g batt) -time_left=$(echo $battstat | - tail -1 | - cut -f2 | - awk -F"; " '{print $3}' | - cut -d' ' -f1 -) - -if [[ $(pmset -g ac) == *"No adapter attached."* ]] -then - emoji='🔋' -else - emoji='🔌' -fi - -if [[ $time_left == *"(no"* || $time_left == *"not"* ]] -then - time_left='⌛️ ' -fi - -if [[ $time_left == *"0:00"* ]] -then - time_left='⚡️ ' -fi - -printf "\033[1;92m$emoji $time_left \033[0m" diff --git a/bin/cloudapp b/bin/cloudapp deleted file mode 100755 index 1ec555ab660..00000000000 --- a/bin/cloudapp +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env ruby -# -# cloudapp -# Zach Holman / @holman -# -# Uploads a file from the command line to CloudApp, drops it into your -# clipboard (on a Mac, at least). -# -# Example: -# -# cloudapp drunk-blake.png -# -# This requires Aaron Russell's cloudapp_api gem: -# -# gem install cloudapp_api -# -# Requires you set your CloudApp credentials in ~/.cloudapp as a simple file of: -# -# email -# password - -require 'rubygems' - -['json', 'cloudapp_api'].each do |gem| - begin - require gem - rescue LoadError - puts "You need to install #{gem}: gem install #{gem}" - exit!(1) - end -end - -config_file = "#{ENV['HOME']}/.cloudapp" -unless File.exist?(config_file) - puts "You need to type your email and password (one per line) into "+ - "`~/.cloudapp`" - exit!(1) -end - -email,password = File.read(config_file).split("\n") - -if ARGV[0].nil? - puts "You need to specify a file to upload." - exit!(1) -end - -urls = [] -ARGV.each do |x| - CloudApp.authenticate(email,password) - puts "Attempting to upload #{x}" - url = CloudApp::Item.create(:upload, {:file => x}).url - - # Say it for good measure. - puts "Uploaded #{x} to #{url}" - - # Get the embed link. - url = "#{url}/#{ARGV[0].split('/').last}" - urls << url -end - -# Copy it to your (Mac's) clipboard. -`echo '#{urls.join(',')}' | tr -d "\n" | pbcopy` diff --git a/bin/dns-flush b/bin/dns-flush deleted file mode 100755 index dc3f4c076b7..00000000000 --- a/bin/dns-flush +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# -# I literally always forget how to flush my DNS settings on macOS (in large part -# because it changes every damn update). - -sudo killall -HUP mDNSResponder diff --git a/bin/dot b/bin/dot index 605b0591ec5..1ea79fbc705 100755 --- a/bin/dot +++ b/bin/dot @@ -41,15 +41,15 @@ done export ZSH=$HOME/.dotfiles # Set macOS defaults -$ZSH/macos/set-defaults.sh +$DOTFILES/macos/set-defaults.sh # Install homebrew -$ZSH/homebrew/install.sh 2>&1 +$DOTFILES/homebrew/install.sh 2>&1 # Upgrade homebrew echo "› brew update" brew update # Install software -echo "› $ZSH/script/install" -$ZSH/script/install +echo "› $DOTFILES/script/install" +$DOTFILES/script/install diff --git a/bin/gitio b/bin/gitio deleted file mode 100755 index 2cd36a3e6d6..00000000000 --- a/bin/gitio +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env ruby -# Usage: gitio URL [CODE] -# -# Turns a github.com URL -# into a git.io URL -# -# Created by @defunkt: -# https://gist.github.com/1209316 -# -# Copies the git.io URL to your clipboard. - -url = ARGV[0] -code = ARGV[1] - -if url !~ /^(https?:\/\/)?(gist\.)?github.com/ - abort "* github.com URLs only" -end - -if url !~ /^http/ - url = "https://#{url}" -end - -if code - code = "-F code=#{code}" -end - -output = `curl -i https://git.io -F 'url=#{url}' #{code} 2> /dev/null` -if output =~ /Location: (.+)\n?/ - puts $1 - `echo #$1 | pbcopy` -else - puts output -end diff --git a/bin/movieme b/bin/movieme deleted file mode 100755 index 115a364f0fa..00000000000 --- a/bin/movieme +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# -# MOVIE ME as in: "MOVIE ME AN ANIMATED GIF FROM THIS MOVIE, DAMMIT" -# -# Creates an animated gif from a movie file. Uploads to CloudApp. You must also -# have `gifme` and `cloudapp` in your $PATH. -# -# $1 - the path to the movie we're converting. -# $2 - the start time of the finished product. -# This can be in seconds, or it also accepts the "hh:mm:ss[.xxx]" format. -# $3 - the duration of the video sequence. -# This can be in seconds, or it also accepts the "hh:mm:ss[.xxx]" format. -# -# Examples: -# -# movieme -# ~/Desktop/dr-strangelove.mp4 23:12 3 -# ~/Desktop/holman-backflip-on-fire.mov 3.9 1.75 - -# cleanup -rm -rf /tmp/movieme - -# create tmp dir -mkdir -p /tmp/movieme - -# split the movie into constituent frames -ffmpeg -i "$1" -f image2 -vf "scale=iw*sar:ih" -ss $2 -t $3 -r 7 /tmp/movieme/d-%05d.png - -# ANIMATE -gifme /tmp/movieme/* -d 0 diff --git a/bin/mustacheme b/bin/mustacheme deleted file mode 100755 index ad28a39f6e2..00000000000 --- a/bin/mustacheme +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# -# mustacheme -# expanded from an idea from Rick Olson (@technoweenie) -# -# Takes a .gif, splits it into constituent frames, mustaches each, restitches -# the gif, and uploads to cloudapp. -# -# This leverages the nifty service mustachify.me, which will analyze your photo, -# identify faces, and add a mustache to your image. -# -# If the .gif is a remote file, we'll download it and blow it up locally. -# -# $1 - the path of the gif -# -# Examples: -# -# mustacheme holman-jumping-off-cliff-into-butter.gif -# mustacheme http://github.com/holman/butter/blob/master/holman-butter.gif -# -# Dependencies: -# -# - ImageMagick. If you're on a Mac, run: -# brew install imagemagick -# - wget -# - cloudapp: https://github.com/holman/dotfiles/blob/master/bin/cloudapp -# - gifme: https://github.com/holman/gifme - -set -e - -# Set up mustacheme temporary working directory -output=/tmp/mustacheme -rm -rf $output -mkdir $output - -if [[ $1 == http* ]] -then - wget $1 -O /tmp/mustache-download.gif - file=/tmp/mustache-download.gif -else - file="$1" -fi - -# Blow apart the GIF -convert $1 -coalesce $output/frame_%03d.gif - -# Mustache each frame -for frame in $output/*.gif -do - url=$(cloudapp $frame | grep Uploaded | awk '{print substr($0, index($0, "http://"))}') - url="$url/$(basename $frame)" - wget "http://mustachify.me/?src=$url" -O "$frame-stache" -done - -# Ding! Fries are done. -gifme $output/*-stache -d 0 diff --git a/bin/res b/bin/res deleted file mode 100755 index 40afcfdf55e..00000000000 --- a/bin/res +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/osascript -# -# A small command line script to change screen resolutions on Mountain Lion. -# -# Primarily I switch between two resolutions on my Retina MacBook Pro: Retina, -# and the full resolution setting. This means for particular apps I use, I can -# quickly jump between seeing more pixels and less. -# -# There doesn't appear to be an easy way to do this without just using -# AppleScript to automate clicking buttons, so that's what this does. -# -# Most of this script is adapted from this helpful answer: -# -# http://apple.stackexchange.com/a/91590 -# -# Make sure "Enable access for assistive devices" is checked in the -# Accessibility section of System Properties. - -local index1, index2 - -set index1 to 3 -- 1440 x 900 (Best for Retina) -set index2 to 5 -- 1920 x 1200 (More Space) - -tell application "System Preferences" - reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays" -end tell - -local indexToUse - -tell application "System Events" to tell process "System Preferences" to tell window "Built-in Retina Display" - - click radio button "Display" of tab group 1 - click radio button "Scaled" of radio group 1 of tab group 1 - - -- Click the "Scaled" radio button - click radio button "Scaled" of radio group 1 of tab group 1 - - tell tab group 1 - tell radio group 1 of group 1 - -- Depending on what scale option/index is current selected, set the appropriate new option/index to use - if (value of radio button index1) is true then - set indexToUse to index2 - else if (value of radio button index2) is true then - set indexToUse to index1 - end if - - -- Click the radio button for the new scale option/index - click radio button indexToUse - end tell - end tell - - -- If option/index 1 is selected a warning prompt is displayed, click the OK button to dismiss the prompt - if indexToUse = 1 then - click button "OK" of sheet 1 - end if -end tell - -tell application "System Preferences" - quit -end tell diff --git a/bin/set-defaults b/bin/set-defaults deleted file mode 100755 index 333859619a8..00000000000 --- a/bin/set-defaults +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# -# Sets macOS defaults by running $ZSH/macos/set-defaults.sh. - -exec $ZSH/macos/set-defaults.sh diff --git a/bin/todo b/bin/todo deleted file mode 100755 index 8a62cbde29a..00000000000 --- a/bin/todo +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# -# Creates something for me to do. -# -# I've used literally every todo list, app, program, script, everything. Even -# the ones you are building and haven't released yet. -# -# I've found that they're all nice in their nice ways, but I still don't use -# them, thus defeating the purpose of a todo list. -# -# All `todo` does is put a file on my Desktop with the filename given. That's -# it. I aggressively prune my desktop of old tasks and keep one or two on there -# at a time. Once I've finished a todo, I just delete the file. That's it. -# -# Millions of dollars later and `touch` wins. - -# Run our new web 2.0 todo list application and raise millions of VC dollars. -touch ~/Desktop/"$*" diff --git a/bin/yt b/bin/yt deleted file mode 100755 index ff4b59508d8..00000000000 --- a/bin/yt +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -# -# Downloads the embedded video on any web page straight to the desktop. -# -# youtube-dl, which is awesome: -# https://rg3.github.io/youtube-dl/ -# - -cd ~/Desktop && youtube-dl "$1" diff --git a/docker/aliases.zsh b/docker/aliases.zsh index 17b10f6bc90..be4ea2422bd 100644 --- a/docker/aliases.zsh +++ b/docker/aliases.zsh @@ -1,2 +1,3 @@ alias d='docker $*' -alias d-c='docker-compose $*' +alias dc='docker-compose $*' +alias dcu='docker-compose up $*' diff --git a/functions/_boom b/functions/_boom deleted file mode 100644 index 74e5d4e41ba..00000000000 --- a/functions/_boom +++ /dev/null @@ -1,29 +0,0 @@ -#compdef boom - -local state line cmds ret=1 - -_arguments -C '1: :->cmds' '*: :->args' - -case $state in - cmds) - local -a cmds - cmds=( - 'all:show all items in all lists' - 'edit:edit the boom JSON file in $EDITOR' - 'help:help text' - ) - _describe -t commands 'boom command' cmds && ret=0 - _values 'lists' $(boom | awk '{print $1}') - ;; - args) - case $line[1] in - (boom|all|edit|help) - ;; - *) - _values 'items' `boom $line[1] | awk '{print $1}' | sed -e 's/://'` 2>/dev/null && ret=0 - ;; - esac - ;; -esac - -return ret diff --git a/functions/_brew b/functions/_brew deleted file mode 100644 index d48c97427a1..00000000000 --- a/functions/_brew +++ /dev/null @@ -1,79 +0,0 @@ -#compdef brew - -# Brew ZSH completion function -# Drop this somewhere in your $fpath (like /usr/share/zsh/site-functions) -# and rename it _brew -# -# altered from _fink - -_brew_all_formulae() { - formulae=(`brew search`) -} - -_brew_installed_formulae() { - installed_formulae=(`brew list`) -} - -local -a _1st_arguments -_1st_arguments=( - 'install:install a formula' - 'remove:remove a formula' - 'search:search for a formula (/regex/ or string)' - 'list:list files in a formula or not-installed formulae' - 'link:link a formula' - 'unlink:unlink a formula' - 'home:visit the homepage of a formula or the brew project' - 'info:information about a formula' - 'prune:remove dead links' - 'update:freshen up links' - 'log:git commit log for a formula' - 'create:create a new formula' - 'edit:edit a formula' - 'bundle:install or upgrade all dependencies in a Brewfile' -) - -local -a _bundle_arguments -_bundle_arguments=( - 'dump:write all installed casks/formulae/taps into a Brewfile' - 'cleanup:uninstall all dependencies not listed in a Brewfile' - 'check:check if all dependencies are installed in a Brewfile' -) - -local expl -local -a formula installed_formulae - -_arguments \ - '(-v --verbose)'{-v,--verbose}'[verbose]' \ - '(--version)--version[version information]' \ - '(--prefix)--prefix[where brew lives on this system]' \ - '(--cache)--cache[brew cache]' \ - '*:: :->subcmds' && return 0 - -if (( CURRENT == 1 )); then - _describe -t commands "brew subcommand" _1st_arguments - return -fi - -case "$words[1]" in - list) - _arguments \ - '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ - '1: :->forms' && return 0 - - if [[ "$state" == forms ]]; then - _brew_installed_formulae - _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae - fi - ;; - install|home|log|info) - _brew_all_formulae - _wanted formulae expl 'all formulae' compadd -a formulae - ;; - remove|edit|xo) - _brew_installed_formulae - _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae - ;; - bundle) - _describe 'values' _bundle_arguments - ;; -esac diff --git a/functions/_c b/functions/_c index 39d8cb8f0f1..d77f3146251 100644 --- a/functions/_c +++ b/functions/_c @@ -1,5 +1,4 @@ #compdef c _files -W $PROJECTS -/ -_files -W $GOPATH/src/github.com -/ # See further documentation in `functions/c`. diff --git a/functions/daily b/functions/daily new file mode 100644 index 00000000000..8a9d27b539e --- /dev/null +++ b/functions/daily @@ -0,0 +1,8 @@ +daily () { + if [ -z $1 ]; then + echo "No file name passed!"; + return 1 + fi + + touch $(date "+%Y_%m_%d")_$1.txt; +} diff --git a/functions/delete-ds b/functions/delete-ds new file mode 100644 index 00000000000..a6a92ad43f7 --- /dev/null +++ b/functions/delete-ds @@ -0,0 +1,3 @@ +delete-ds () { + find . -name '.DS_Store' -type f -print -delete; +} diff --git a/functions/history-top b/functions/history-top new file mode 100644 index 00000000000..f92db37e669 --- /dev/null +++ b/functions/history-top @@ -0,0 +1,4 @@ +# history_tops: Show Top 10 used command +history-top() { history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head; } + +# vim:ft=zsh diff --git a/functions/mcd b/functions/mcd new file mode 100644 index 00000000000..b1f640f77da --- /dev/null +++ b/functions/mcd @@ -0,0 +1,4 @@ +# create directory and enter it +mcd() { mkdir -p $1; cd $1; } + +# vim:ft=zsh diff --git a/functions/ql b/functions/ql new file mode 100644 index 00000000000..e5f0aec26e4 --- /dev/null +++ b/functions/ql @@ -0,0 +1,3 @@ +# ql : Show a "Quick Look" view of files +ql () { /usr/bin/qlmanage -p "$@" >& /dev/null & } +# vim:ft=zsh diff --git a/functions/today b/functions/today new file mode 100644 index 00000000000..1b743a3a878 --- /dev/null +++ b/functions/today @@ -0,0 +1,8 @@ +today () { + if [ -z $1 ]; then + echo "No file name passed!"; + return 1 + fi + + e $(date "+%Y_%m_%d")_$1.txt; +} diff --git a/git/aliases.zsh b/git/aliases.zsh index ac8f5a9be9a..7a876ba7303 100644 --- a/git/aliases.zsh +++ b/git/aliases.zsh @@ -1,24 +1 @@ -# Use `hub` as our git wrapper: -# http://defunkt.github.com/hub/ -hub_path=$(which hub) -if (( $+commands[hub] )) -then - alias git=$hub_path -fi - -# The rest of my fun git aliases -alias gl='git pull --prune' -alias glog="git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative" -alias gp='git push origin HEAD' - -# Remove `+` and `-` from start of diff lines; just rely upon color. -alias gd='git diff --color | sed "s/^\([^-+ ]*\)[-+ ]/\\1/" | less -r' - -alias gc='git commit' -alias gca='git commit -a' -alias gco='git checkout' -alias gcb='git copy-branch-name' -alias gb='git branch' -alias gs='git status -sb' # upgrade your git if -sb breaks for you. it's fun. -alias gac='git add -A && git commit -m' -alias ge='git-edit-new' +alias gmf="git merge --no-ff"; diff --git a/git/gitconfig.symlink b/git/gitconfig.symlink index 905ecc220d4..d3bc934beb3 100644 --- a/git/gitconfig.symlink +++ b/git/gitconfig.symlink @@ -5,9 +5,9 @@ protocol = https [alias] co = checkout - promote = !$ZSH/bin/git-promote - wtf = !$ZSH/bin/git-wtf - rank-contributors = !$ZSH/bin/git-rank-contributors + promote = !$DOTFILES/bin/git-promote + wtf = !$DOTFILES/bin/git-wtf + rank-contributors = !$DOTFILES/bin/git-rank-contributors count = !git shortlog -sn [color] diff = auto diff --git a/go/path.zsh b/go/path.zsh deleted file mode 100644 index 71bd1c338a7..00000000000 --- a/go/path.zsh +++ /dev/null @@ -1,2 +0,0 @@ -export GOPATH=$PROJECTS/go -export PATH="$GOPATH/bin:$PATH" diff --git a/homebrew/install.sh b/homebrew/install.sh index f01dbdc7f75..916a263e594 100755 --- a/homebrew/install.sh +++ b/homebrew/install.sh @@ -9,7 +9,6 @@ if test ! $(which brew) then echo " Installing Homebrew for you." - # Install the correct homebrew for each OS type if test "$(uname)" = "Darwin" then @@ -18,7 +17,6 @@ then then ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install)" fi - fi exit 0 diff --git a/macos/install.sh b/macos/install.sh index 312f8eb6ca9..a0ade201a10 100755 --- a/macos/install.sh +++ b/macos/install.sh @@ -8,5 +8,6 @@ fi # command line interface to it that we can use to just install everything, so # yeah, let's do that. -echo "› sudo softwareupdate -i -a" +echo "› sudo softwareupdate -i -a"; sudo softwareupdate -i -a +echo ""; diff --git a/macos/set-defaults.sh b/macos/set-defaults.sh index 03d6f2d9dbe..299b417e3ac 100755 --- a/macos/set-defaults.sh +++ b/macos/set-defaults.sh @@ -1,3 +1,7 @@ +if test ! "$(uname)" = "Darwin" + then + exit 0 +fi # Sets reasonable macOS defaults. # # Or, in other words, set shit how I like in macOS. diff --git a/node/install.sh b/node/install.sh index 03c92217043..6d90468f574 100755 --- a/node/install.sh +++ b/node/install.sh @@ -1,7 +1,12 @@ -if test ! $(which spoof) +if test ! $(which yarn) then if test $(which npm) then - sudo npm install spoof -g + echo "node: installing..."; + npm install yarn -g + echo "node: installed!"; + echo ""; + else + echo "node: already installed, skipping..."; fi fi diff --git a/yarn/path.zsh b/node/path.zsh similarity index 100% rename from yarn/path.zsh rename to node/path.zsh diff --git a/nvim/aliases.zsh b/nvim/aliases.zsh new file mode 100644 index 00000000000..cbbc57e5484 --- /dev/null +++ b/nvim/aliases.zsh @@ -0,0 +1,2 @@ +alias vim="nvim" +alias vi="nvim" diff --git a/quicklook/install.sh b/quicklook/install.sh new file mode 100755 index 00000000000..2b407dba9c8 --- /dev/null +++ b/quicklook/install.sh @@ -0,0 +1,22 @@ +if test ! "$(uname)" = "Darwin" + then + exit 0 +fi + +if test $(which brew) +then + if [[ ! -d $HOME/Library/QuickLook/QLMarkdown.qlgenerator ]] + then + echo ""; + echo "quicklook: installing plugins from sindreshorhus..."; + brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlimagesize suspicious-package quicklookase qlvideo; + echo "quicklook: making it work on Catalanina..."; + xattr -d -r com.apple.quarantine ~/Library/QuickLook; + echo "quicklook: done!"; + echo ""; + else + echo "quicklook: already installed, skipping..."; + echo ""; + fi +fi + diff --git a/react-native/aliases.zsh b/react-native/aliases.zsh new file mode 100644 index 00000000000..7676e0e9eed --- /dev/null +++ b/react-native/aliases.zsh @@ -0,0 +1,4 @@ +alias rn="react-native" +alias rni="react-native run-ios" +alias rna="react-native run-android" +alias rnl="react-native link" diff --git a/ruby/aliases.zsh b/ruby/aliases.zsh deleted file mode 100644 index 607599fcbd2..00000000000 --- a/ruby/aliases.zsh +++ /dev/null @@ -1,3 +0,0 @@ -alias sc='script/console' -alias sg='script/generate' -alias sd='script/destroy' diff --git a/ruby/completion.zsh b/ruby/completion.zsh deleted file mode 100644 index 87bdc54ad78..00000000000 --- a/ruby/completion.zsh +++ /dev/null @@ -1,22 +0,0 @@ -# Stolen from -# https://github.com/sstephenson/rbenv/blob/master/completions/rbenv.zsh - -if [[ ! -o interactive ]]; then - return -fi - -compctl -K _rbenv rbenv - -_rbenv() { - local word words completions - read -cA words - word="${words[2]}" - - if [ "${#words}" -eq 2 ]; then - completions="$(rbenv commands)" - else - completions="$(rbenv completions "${word}")" - fi - - reply=("${(ps:\n:)completions}") -} \ No newline at end of file diff --git a/ruby/gemrc.symlink b/ruby/gemrc.symlink deleted file mode 100644 index 63e8ac20eba..00000000000 --- a/ruby/gemrc.symlink +++ /dev/null @@ -1,6 +0,0 @@ ---- -:update_sources: true -:verbose: true -:backtrace: false -:benchmark: false -gem: --no-document diff --git a/ruby/irbrc.symlink b/ruby/irbrc.symlink deleted file mode 100644 index f25dcbfb023..00000000000 --- a/ruby/irbrc.symlink +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/ruby -require 'irb/completion' -require 'irb/ext/save-history' -require 'rubygems' - -IRB.conf[:SAVE_HISTORY] = 1000 -IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history" - -IRB.conf[:PROMPT_MODE] = :SIMPLE - -IRB.conf[:AUTO_INDENT] = true - -class Object - # list methods which aren't in superclass - def local_methods(obj = self) - (obj.methods - obj.class.superclass.instance_methods).sort - end - - # print documentation - # - # ri 'Array#pop' - # Array.ri - # Array.ri :pop - # arr.ri :pop - def ri(method = nil) - unless method && method =~ /^[A-Z]/ # if class isn't specified - klass = self.kind_of?(Class) ? name : self.class.name - method = [klass, method].compact.join('#') - end - puts `ri '#{method}'` - end -end - -# Copies the result of the last operation you ran in IRB to the system -# clipboard (if you're on macOS). -def cop - last_value = IRB.CurrentContext.last_value - %x[echo '#{last_value}' | pbcopy] - "copied \`#{last_value}' to your clipboard" -end - -def me - User.find_by_login(ENV['USER'].strip) -end - -def r - reload! -end diff --git a/ruby/rbenv.zsh b/ruby/rbenv.zsh deleted file mode 100644 index cb93d589d6a..00000000000 --- a/ruby/rbenv.zsh +++ /dev/null @@ -1,5 +0,0 @@ -# init according to man page -if (( $+commands[rbenv] )) -then - eval "$(rbenv init -)" -fi diff --git a/system/_path.zsh b/system/_path.zsh index 255c2cfca66..ce76bd3d38e 100644 --- a/system/_path.zsh +++ b/system/_path.zsh @@ -1,2 +1,2 @@ -export PATH="./bin:/usr/local/bin:/usr/local/sbin:$ZSH/bin:$PATH" +export PATH="./bin:/usr/local/bin:/usr/local/sbin:$DOTFILES/bin:$PATH" export MANPATH="/usr/local/man:/usr/local/mysql/man:/usr/local/git/man:$MANPATH" diff --git a/system/aliases.zsh b/system/aliases.zsh index d11780cc3b7..c1af580d44c 100644 --- a/system/aliases.zsh +++ b/system/aliases.zsh @@ -3,8 +3,20 @@ # `brew install coreutils` if $(gls &>/dev/null) then - alias ls="gls -F --color" - alias l="gls -lAh --color" - alias ll="gls -l --color" - alias la='gls -A --color' -fi \ No newline at end of file +alias ls="gls -G --group-directories-first --color" +alias l='gls --group-directories-first --color -lah' +alias la='gls --group-directories-first --color -lAh' +alias ll='gls --group-directories-first --color -lh' +alias lsa='gls --group-directories-first --color -lah' +fi + +# add pbcopy/pbpaste on Linux +if test "$(uname)" != "Darwin" +then + alias pbcopy='xclip -selection clipboard' + alias pbpaste='xclip -selection clipboard -o' +fi + +alias sudo="sudo " +alias rm="trash" +alias _rm="/bin/rm" diff --git a/system/env.zsh b/system/env.zsh index b99078ff655..d3fda049518 100644 --- a/system/env.zsh +++ b/system/env.zsh @@ -1 +1 @@ -export EDITOR='code' +export EDITOR='nvim' diff --git a/tmux/tmux.colors.conf.symlink b/tmux/tmux.colors.conf.symlink new file mode 100644 index 00000000000..6d1d6eee44a --- /dev/null +++ b/tmux/tmux.colors.conf.symlink @@ -0,0 +1,23 @@ +# This tmux statusbar config was created by tmuxline.vim +# on Sun, 12 Jul 2020 + +set -g status-justify "left" +set -g status "on" +set -g status-left-style "none" +set -g message-command-style "fg=colour241,bg=colour233" +set -g status-right-style "none" +set -g pane-active-border-style "fg=colour67" +set -g status-style "none,bg=colour0" +set -g message-style "fg=colour241,bg=colour233" +set -g pane-border-style "fg=colour233" +set -g status-right-length "100" +set -g status-left-length "100" +setw -g window-status-activity-style "none" +setw -g window-status-separator "" +setw -g window-status-style "none,fg=colour235,bg=colour0" +set -g status-left "#[fg=colour0,bg=blue] #S #[fg=colour67,bg=colour0,nobold,nounderscore,noitalics]" +set -g status-right "#[fg=colour235,bg=colour0,nobold,nounderscore,noitalics]#[fg=white,bg=red] %Y-%m-%d %H:%M " +setw -g window-status-format "#[fg=colour235,bg=colour0] [#I]#[fg=colour235,bg=colour0]#W " +setw -g window-status-current-format "#[fg=colour0,bg=colour233,nobold,nounderscore,noitalics]#[fg=colour241,bg=colour233] [#I]#[fg=colour241,bg=colour233]#W #[fg=colour233,bg=colour0,nobold,nounderscore,noitalics]" + +# vim:ft=tmux diff --git a/tmux/tmux.conf.symlink b/tmux/tmux.conf.symlink new file mode 100644 index 00000000000..41fdb6fffce --- /dev/null +++ b/tmux/tmux.conf.symlink @@ -0,0 +1,51 @@ +source-file ~/.tmux.colors.conf + +unbind-key C-b +set-option -g prefix C-a +bind C-a send-prefix + +# Remove delay on pressing ESC +set -s escape-time 0 + +# True colors on tmux +set -g default-terminal "xterm-256color" +set -ga terminal-overrides ",xterm-256color:Tc" + +# New window, same folder +bind c new-window -c "#{pane_current_path}" +bind c new-session -c "#{pane_current_path}" + +bind-key Escape copy-mode +bind-key p paste-buffer + +bind-key -T copy-mode-vi Escape send -X cancel +bind-key -T copy-mode-vi 'v' send -X begin-selection +bind-key -T copy-mode-vi 'V' send -X select-line +bind-key -T copy-mode-vi 'r' send -X rectangle-toggle +bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel + +# use s for horizontal split +bind s split-window -v +# use v for vertical split +bind v split-window -h + +# resize panes more easily +bind < resize-pane -L 10 +bind > resize-pane -R 9 +bind - resize-pane -D 10 +bind + resize-pane -U 10 + +set-window-option -g mode-keys vi +set -g base-index 1 +set -g status-keys vi +set -g history-limit 10000 + +set-window-option -g automatic-rename off +set-option -g set-titles off + +bind -n M-l select-pane -L +bind -n M-h select-pane -R +bind -n M-k select-pane -U +bind -n M-j select-pane -D + +# vim:ft=tmux diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink deleted file mode 100644 index 0463e21b902..00000000000 --- a/vim/vimrc.symlink +++ /dev/null @@ -1,4 +0,0 @@ -syntax on - -" Wrap gitcommit file types at the appropriate length -filetype indent plugin on diff --git a/xcode/aliases.zsh b/xcode/aliases.zsh index 53dc5922efe..db803babfbc 100644 --- a/xcode/aliases.zsh +++ b/xcode/aliases.zsh @@ -1,2 +1,7 @@ +if test ! "$(uname)" = "Darwin" + then + exit 0 +fi + alias ios="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app" alias watchos="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator\ \(Watch\).app" diff --git a/yarn/install.sh b/yarn/install.sh new file mode 100755 index 00000000000..5c4145695b3 --- /dev/null +++ b/yarn/install.sh @@ -0,0 +1,13 @@ +if test ! $(which yarn) +then + if test ! $(which trash) + then + echo "yarn: installing trash-cli..."; + yarn global add trash-cli + echo "yarn: installed trash-cli!"; + echo ""; + else + echo "yarn: trash-cli installed, skipping..."; + echo ""; + fi +fi diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index b88e3aa5a1b..21aeb3e5042 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -1,3 +1,2 @@ alias reload!='. ~/.zshrc' - alias cls='clear' # Good 'ol Clear Screen command diff --git a/zsh/config.zsh b/zsh/config.zsh index 8ca7389e218..243cbf065e4 100644 --- a/zsh/config.zsh +++ b/zsh/config.zsh @@ -1,9 +1,9 @@ export LSCOLORS="exfxcxdxbxegedabagacad" export CLICOLOR=true -fpath=($ZSH/functions $fpath) +fpath=($DOTFILES/functions $fpath) -autoload -U $ZSH/functions/*(:t) +autoload -U $DOTFILES/functions/*(:t) HISTFILE=~/.zsh_history HISTSIZE=10000 diff --git a/zsh/fpath.zsh b/zsh/fpath.zsh index eaff4f41b0b..5254cdbdbac 100644 --- a/zsh/fpath.zsh +++ b/zsh/fpath.zsh @@ -1,2 +1,2 @@ #add each topic folder to fpath so that they can add functions and completion scripts -for topic_folder ($ZSH/*) if [ -d $topic_folder ]; then fpath=($topic_folder $fpath); fi; +for topic_folder ($DOTFILES/*) if [ -d $topic_folder ]; then fpath=($topic_folder $fpath); fi; diff --git a/zsh/install.sh b/zsh/install.sh new file mode 100755 index 00000000000..575928e21db --- /dev/null +++ b/zsh/install.sh @@ -0,0 +1,10 @@ +if ! test -d $HOME/.oh-my-zsh +then + echo "oh-my-zsh: installing..."; + sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" + echo "oh-my-zsh: installed with success"; + echo ""; +else + echo "oh-my-zsh: already installed skipping..."; + echo ""; +fi diff --git a/zsh/oh-my-zsh.zsh b/zsh/oh-my-zsh.zsh new file mode 100644 index 00000000000..ec061d7e701 --- /dev/null +++ b/zsh/oh-my-zsh.zsh @@ -0,0 +1,8 @@ +ZSH_THEME="" +ZSH_DISABLE_COMPFIX="true" +ENABLE_CORRECTION="false" +COMPLETION_WAITING_DOTS="true" +HIST_STAMPS="yyyy-mm-dd" +plugins=(git brew sudo npm yarn) + +source $ZSH/oh-my-zsh.sh diff --git a/zsh/path.zsh b/zsh/path.zsh new file mode 100644 index 00000000000..e69de29bb2d diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh deleted file mode 100644 index d35b8c53f5c..00000000000 --- a/zsh/prompt.zsh +++ /dev/null @@ -1,77 +0,0 @@ -autoload colors && colors -# cheers, @ehrenmurdick -# http://github.com/ehrenmurdick/config/blob/master/zsh/prompt.zsh - -if (( $+commands[git] )) -then - git="$commands[git]" -else - git="/usr/bin/git" -fi - -git_branch() { - echo $($git symbolic-ref HEAD 2>/dev/null | awk -F/ {'print $NF'}) -} - -git_dirty() { - if $(! $git status -s &> /dev/null) - then - echo "" - else - if [[ $($git status --porcelain) == "" ]] - then - echo "on %{$fg_bold[green]%}$(git_prompt_info)%{$reset_color%}" - else - echo "on %{$fg_bold[red]%}$(git_prompt_info)%{$reset_color%}" - fi - fi -} - -git_prompt_info () { - ref=$($git symbolic-ref HEAD 2>/dev/null) || return -# echo "(%{\e[0;33m%}${ref#refs/heads/}%{\e[0m%})" - echo "${ref#refs/heads/}" -} - -# This assumes that you always have an origin named `origin`, and that you only -# care about one specific origin. If this is not the case, you might want to use -# `$git cherry -v @{upstream}` instead. -need_push () { - if [ $($git rev-parse --is-inside-work-tree 2>/dev/null) ] - then - number=$($git cherry -v origin/$(git symbolic-ref --short HEAD) 2>/dev/null | wc -l | bc) - - if [[ $number == 0 ]] - then - echo " " - else - echo " with %{$fg_bold[magenta]%}$number unpushed%{$reset_color%}" - fi - fi -} - -directory_name() { - echo "%{$fg_bold[cyan]%}%1/%\/%{$reset_color%}" -} - -battery_status() { - if test ! "$(uname)" = "Darwin" - then - exit 0 - fi - - if [[ $(sysctl -n hw.model) == *"Book"* ]] - then - $ZSH/bin/battery-status - fi -} - -export PROMPT=$'\n$(battery_status)in $(directory_name) $(git_dirty)$(need_push)\n› ' -set_prompt () { - export RPROMPT="%{$fg_bold[cyan]%}%{$reset_color%}" -} - -precmd() { - title "zsh" "%m" "%55<...<%~" - set_prompt -} diff --git a/zsh/window.zsh b/zsh/window.zsh deleted file mode 100644 index 805cb92d6f2..00000000000 --- a/zsh/window.zsh +++ /dev/null @@ -1,19 +0,0 @@ -# From http://dotfiles.org/~_why/.zshrc -# Sets the window title nicely no matter where you are -function title() { - # escape '%' chars in $1, make nonprintables visible - a=${(V)1//\%/\%\%} - - # Truncate command, and join lines. - a=$(print -Pn "%40>...>$a" | tr -d "\n") - - case $TERM in - screen) - print -Pn "\ek$a:$3\e\\" # screen title (in ^A") - ;; - xterm*|rxvt) - print -Pn "\e]2;$2\a" # plain xterm title ($3 for pwd) - ;; - esac -} - diff --git a/zsh/zshrc.symlink b/zsh/zshrc.symlink index 9ce55833097..8c6e15d3a46 100644 --- a/zsh/zshrc.symlink +++ b/zsh/zshrc.symlink @@ -1,8 +1,9 @@ -# shortcut to this dotfiles path is $ZSH -export ZSH=$HOME/.dotfiles +# shortcut to this dotfiles path is $DOTFILES +export DOTFILES=$HOME/.dotfiles +export ZSH=$HOME/.oh-my-zsh # your project folder that we can `c [tab]` to -export PROJECTS=~/Code +export PROJECTS=~/Projects # Stash your environment variables in ~/.localrc. This means they'll stay out # of your main dotfiles repository (which may be public, like this one), but @@ -14,7 +15,7 @@ fi # all of our zsh files typeset -U config_files -config_files=($ZSH/**/*.zsh) +config_files=($DOTFILES/**/*.zsh) # load the path files for file in ${(M)config_files:#*/path.zsh} @@ -47,4 +48,15 @@ autoload -U down-line-or-beginning-search zle -N up-line-or-beginning-search zle -N down-line-or-beginning-search bindkey "^[[A" up-line-or-beginning-search # Up -bindkey "^[[B" down-line-or-beginning-search # Down \ No newline at end of file +bindkey "^[[B" down-line-or-beginning-search # Down + +# Pure theme +autoload -U promptinit; promptinit +zstyle :prompt:pure:git:branch color green +prompt pure + +# Attach to tmux default session +if [ -z "$TMUX" ] +then + tmux attach -t default || tmux new -s default +fi