Browse Source

initial commit

remotes/remote_mirror_0048a893dc9c9faa373a1b34fba08204/master
Andrew Zah 1 year ago
commit
0dee046f1b
Signed by: Andrew Zah <zah@andrewzah.com> GPG Key ID: 0AE942445EB70FAA
14 changed files with 474 additions and 0 deletions
  1. 8
    0
      .curlrc
  2. 1
    0
      .gemrc
  3. 98
    0
      .gitconfig
  4. 1
    0
      .gitignore
  5. 127
    0
      .nvimrc
  6. 23
    0
      .wgetrc
  7. 17
    0
      .zshrc
  8. 6
    0
      zsh/aliases.zsh
  9. 11
    0
      zsh/colors.zsh
  10. 33
    0
      zsh/exports.zsh
  11. 81
    0
      zsh/functions.zsh
  12. 4
    0
      zsh/history.zsh
  13. 50
    0
      zsh/setopt.zsh
  14. 14
    0
      zsh/zsh-path.zsh

+ 8
- 0
.curlrc View File

@@ -0,0 +1,8 @@
# Disguise as IE 9 on Windows 7.
user-agent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"

# When following a redirect, automatically set the previous URL as referer.
referer = ";auto"

# Wait 60 seconds before timing out.
connect-timeout = 60

+ 1
- 0
.gemrc View File

@@ -0,0 +1 @@
gem: --no-rdoc --no-ri

+ 98
- 0
.gitconfig View File

@@ -0,0 +1,98 @@
[user]
email = zah@andrewzah.com
name = Andrew Zah
signingkey = 5EB70FAA
[core]
editor = nvim
excludesfile = ~/.global_gitignore
[alias]
aliases = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\ \t => \\2/' | sort

# pretty log
lg = log --color --graph --pretty=format:'%Cred%h%Creset %C(yellow) %G? %Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
# delete branch
brdel = branch -D
# most modified files
churn = !git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort | awk 'BEGIN {print "count,file"} {print $1 "," $2}'
# save repo as tarball
export = archive -o latest.tar.gz -9 --prefix=latest/
# list of commit sha-1s
l = "!f() { git log $* | grep '^commit ' | cut -f 2 -d ' '; }; f"
# list all tags
tags = tag -l
# checks that local refs are up to date before overwriting
please = push --force-with-lease

# see recent branches worked on
recent = for-each-ref --count=10 --sort=-committerdate refs/heads/ --format="%(refname:short)"

# see overview of commits
overview = log --all --oneline --no-merges

# recap your own commits on a project
recap = log --all --pretty=format:'%h %ad %s' --no-merges --author=<zah@andrewzah.com> --date=short
# amend commit
commend = commit --amend --no-edit
# merge no fast forward
merc = merge --no-ff
# brief status
st = status --short --branch
# stash only unstaged changes to tracked files
stsh = stash --keep-index
# stash any changes to tracked files
staash = stash --include-untracked
# stash ignored, untracked, and tracked files
staaash = stash --all
# initialize empty repo and commit
it = !git init && git commit -m \"root\" --allow-empty }
[diff]
indentHeuristic = on
[log]
date = relative
[color]
ui = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow
frag = magenta
old = red
new = green
[color "status"]
added = yellow
changed = green
untracked = red
[commit]
gpgsign = true

# shorthand URLs
[url "https://github.com/"]
insteadOf = gh:
[url "git@github.com:"]
insteadOf = ghs:
[url "https://gist.github.com/"]
insteadOf = gist:
[url "https://gitlab.com/"]
insteadOf = gl:
[url "git@gitlab.com:"]
insteadOf = gls:
[url "git@github.com:"]
insteadOf = https://github.com/

[init]
templatedir = ~/.config/git/templates/init

+ 1
- 0
.gitignore View File

@@ -0,0 +1 @@
.DS_Store

+ 127
- 0
.nvimrc View File

@@ -0,0 +1,127 @@
" Leader key
let mapleader = ","

" Load plugins
execute pathogen#infect()
" Gruvbo
set background=dark
" let g:gruvbox_italic = 1
colorscheme gruvbox

filetype plugin indent on
runtime macros/matchit.vim

inoremap jj <Esc>

syntax enable
syntax on
" set t_co=256
set termguicolors

" Fast Saving
nmap <leader>w :w!<cr>

" Fast Save+Quit
nmap <leader>x :wq<cr>

set scrolloff=3

" Ctrl-P
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'

" oo/OO insert newline without entering INSERT
" nmap oo o<Esc>k
" nmap OO O<Esc>j

" Line Numbers
set number

" Rainbow brackets/parens
let g:rainbow_active = 1

" 7 lines to the cursor when moving vertically using j/k
" set so=7

set backspace=eol,start,indent
set whichwrap+=<,>,h,l

set magic

set showmatch
set mat=2

vmap <Tab> >gv
vmap <S-Tab> <gv

set tabstop=2
set softtabstop=0
set expandtab
set shiftwidth=2
set smarttab
" set cursorline
set hls is

" clear search highlight
" nnoremap <silent> <C-l><C-l> :nohl<CR><C-l>
nnoremap <silent> <Leader>l :nohl<CR>

" NerdTree
map <F2> :NERDTreeToggle<CR>

" Tabularize
nmap <Leader>a= :Tabularize /=<CR>
vmap <Leader>a= :Tabularize /=<CR>
nmap <Leader>a: :Tabularize /:\zs<CR>
vmap <Leader>a: :Tabularize /:\zs<CR>

" Save 1 keystroke on vim splits
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>

" Allow mac copy/paste
vmap <C-x> :!pbcopy<CR>
vmap <C-c> :w !pbcopy<CR><CR>

" Autoset slang -> slim syntax highlighting
au BufRead,BufNewFile *.slang set filetype=slim

" Autoset ecr -> erb syntax highlighting
au BufRead,BufNewFile *.ecr set filetype=erb

" Session stuff
nnoremap <leader>ss :call MakeSession()<cr>
nnoremap <leader>sl :call LoadSession()<cr>

set ssop-=options " do not store options (vimrc) in a session
"" Make and load method to save session per dir
function! MakeSession()
let b:sessiondir = $HOME . "/.vim/sessions" . getcwd()
if (filewritable(b:sessiondir) != 2)
exe 'silent !mkdir -p ' b:sessiondir
redraw!
endif
let b:filename = b:sessiondir . '/session.vim'
exe "mksession! " . b:filename
endfunction
function! LoadSession()
let b:sessiondir = $HOME . "/.vim/sessions" . getcwd()
let b:sessionfile = b:sessiondir . "/session.vim"
if (filereadable(b:sessionfile))
exe 'source ' b:sessionfile
else
echo "No session loaded."
endif

endfunction

" Auto-commands
augroup autosourcing
if(argc() == 0)
"au VimEnter * nested :call LoadSession() " Uncomment to automatically load session
au VimLeave * :call MakeSession()
endif
augroup END

+ 23
- 0
.wgetrc View File

@@ -0,0 +1,23 @@
# Follow FTP links from HTML documents by default
follow_ftp = on

# Do not go up in the directory structure when downloading recursively
no_parent = on

# Wait 60 seconds before timing out. This applies to all timeouts: DNS, connect and read. (The default read timeout is 15 minutes!)
timeout = 60

# Retry a few times when a download fails, but don’t overdo it. (The default is 20!)
tries = 3

# Use the server-provided last modification date, if available
timestamping = on

# Add a `.html` extension to `text/html` or `application/xhtml+xml` files that lack one, or a `.css` extension to `text/css` files that lack one
adjust_extension = on

# Ignore `robots.txt` and `<meta name=robots content=nofollow>`
robots = off

# Disguise as IE 9 on Windows 7
user_agent = Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)

+ 17
- 0
.zshrc View File

@@ -0,0 +1,17 @@
source ~/.zsh/zsh-path.zsh
source ~/.zsh/colors.zsh
source ~/.zsh/setopt.zsh
source ~/.zsh/exports.zsh
source ~/.zsh/aliases.zsh
source ~/.zsh/functions.zsh
source ~/.zsh/history.zsh
source ~/.zsh/secret-exports.zsh

ZSH_THEME="theunraveler"

plugins=(git lein brew ruby wd)

source $ZSH/oh-my-zsh.sh
source $ZSH/plugins/zsh-up/up.plugin.zsh
source $ZSH/plugins/zsh-colored-man-pages/colored-man-pages_mod.plugin.zsh
source $ZSH/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh

+ 6
- 0
zsh/aliases.zsh View File

@@ -0,0 +1,6 @@
alias ls='ls -GFhl'
alias ll='ls -GFH'

alias pubkey="more ~/.ssh/id_rsa.pub | pbcopy | echo '=> Public key copied to pasteboard.'"

alias git=hub

+ 11
- 0
zsh/colors.zsh View File

@@ -0,0 +1,11 @@
# The variables are wrapped in \%\{\%\}. This should be the case for every
# variable that does not contain space.
for COLOR in RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE; do
eval PR_$COLOR='%{$fg_no_bold[${(L)COLOR}]%}'
eval PR_BOLD_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
done

eval RESET='$reset_color'
export PR_RED PR_GREEN PR_YELLOW PR_BLUE PR_WHITE PR_BLACK PR_MAGENTA
export PR_BOLD_RED PR_BOLD_GREEN PR_BOLD_YELLOW PR_BOLD_BLUE PR_BOLD_MAGENTA
export PR_BOLD_WHITE PR_BOLD_BLACK

+ 33
- 0
zsh/exports.zsh View File

@@ -0,0 +1,33 @@
# PATH
export PATH=/usr/local/bin:$PATH~/bin:/usr/local/sbin:~/bin

# ZSH
export ZSH=/Users/andrew/.oh-my-zsh
export UPDATE_ZSH_DAYS=1

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Custom
########

export TERM=xterm-256color

export GREP_OPTIONS='--color=auto'
export GREP_COLOR='3;33'

# This resolves issues install the mysql, postgres, and other gems with native non universal binary extensions
export ARCHFLAGS='-arch x86_64'

# export MANPATH="/usr/local/man:$MANPATH"
export GPG_TTY=$(tty)

# You may need to manually set your language environment
export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='nvim'
else
export EDITOR='nvim'
fi

+ 81
- 0
zsh/functions.zsh View File

@@ -0,0 +1,81 @@
function extract {
echo Extracting $1 ...
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}

function trash () {
local path
for path in "$@"; do
# ignore any arguments
if [[ "$path" = -* ]]; then :
else
local dst=${path##*/}
# append the time if necessary
while [ -e ~/.Trash/"$dst" ]; do
dst="$dst "$(date +%H-%M-%S)
done
/bin/mv "$path" ~/.Trash/"$dst"
fi
done
}

function mkd() {
mkdir -p "$@";
}

# mkdir -p && cd shorthand
function mkdc() {
mkdir -p "$@" && cd "$_";
}
# `o` with no arguments opens the current directory, otherwise opens the given
# location
function o() {
if [ $# -eq 0 ]; then
open .;
else
open "$@";
fi;
}

# `v` with no arguments opens the current directory in Vim, otherwise opens the
# given location
function v() {
if [ $# -eq 0 ]; then
nvim .;
else
nvim "$@";
fi;
}


# transfer.sh alias
transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi
tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; cat $tmpfile | pbcopy; rm -f $tmpfile; }

# `tre` is a shorthand for `tree` with hidden files and color enabled, ignoring
# the `.git` directory, listing directories first. The output gets piped into
# `less` with options to preserve color and line numbers, unless the output is
# small enough for one screen.
function tre() {
tree -aC -I '.git|node_modules|bower_components' --dirsfirst "$@"
}

# SOURCES
# https://github.com/mathiasbynens/dotfiles/blob/master/.functions

+ 4
- 0
zsh/history.zsh View File

@@ -0,0 +1,4 @@
# HISTORY
HISTSIZE=20000
SAVEHIST=20000
HISTFILE=~/.zsh/zsh_history

+ 50
- 0
zsh/setopt.zsh View File

@@ -0,0 +1,50 @@
# ===== Basics

# If you type foo, and it isn't a command, and it is a directory in your cdpath, go there
setopt AUTO_CD

# Allow comments even in interactive shells (especially for Muness)
# setopt INTERACTIVE_COMMENTS

# ===== History

HISTFILE=~/.zsh_history
HISTSIZE=20000
SAVEHIST=20000

# Allow multiple terminal sessions to all append to one zsh command history
setopt APPEND_HISTORY

# Add comamnds as they are typed, don't wait until shell exit
setopt INC_APPEND_HISTORY

# Do not write events to history that are duplicates of previous events
# setopt HIST_IGNORE_DUPS

# When searching history don't display results already cycled through twice
setopt HIST_FIND_NO_DUPS

# Remove extra blanks from each command line being added to history
setopt HIST_REDUCE_BLANKS

# Include more information about when the command was executed, etc
setopt EXTENDED_HISTORY

# remove command line from history list when first character on the line is a space
setopt hist_ignore_space

# ===== Completion

# Allow completion from within a word/phrase
setopt COMPLETE_IN_WORD

# When completing from the middle of a word, move the cursor to the end of the word
setopt ALWAYS_TO_END

# ===== Prompt

# Enable parameter expansion, command substitution, and arithmetic expansion in the prompt
setopt PROMPT_SUBST

unsetopt MENU_COMPLETE
setopt AUTO_MENU

+ 14
- 0
zsh/zsh-path.zsh View File

@@ -0,0 +1,14 @@
# Mac OS X uses path_helper and /etc/paths.d to preload PATH, clear it out first
if [ -x /usr/libexec/path_helper ]; then
PATH=''
eval `/usr/libexec/path_helper -s`
fi

# if rbenv is present, configure it for use
if which rbenv &> /dev/null; then
# Put the rbenv entry at the front of the line
export PATH="$HOME/.rbenv/bin:$PATH"

# enable shims and auto-completion
eval "$(rbenv init -)"
fi

Loading…
Cancel
Save