Skip to content

Commit

Permalink
- Switched to having these files in ~/.config/ and using symlinks
Browse files Browse the repository at this point in the history
- Added functions
  • Loading branch information
MarcelRobitaille committed May 13, 2016
0 parents commit de45108
Show file tree
Hide file tree
Showing 10 changed files with 239 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
[user]
email = [email protected]
name = Marcel Robitaille
[push]
default = simple
[core]
editor = vim
[alias]

# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit

# View the current working tree status using the short format
s = status -s

# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"

# `git di $number` shows the diff between the state `$number` revisions ago and the current state
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"

# Pull in remote changes for the current repository and all its submodules
p = !"git pull; git submodule foreach git pull origin master"

# Clone a repository including all submodules
c = clone --recursive

# Commit all changes
ca = !git add -A && git commit -av

# Switch to a branch, creating it if necessary
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"

# Show verbose output about tags, branches or remotes
tags = tag -l
branches = branch -a
remotes = remote -v

# Amend the currently staged files to the latest commit
amend = commit --amend --reuse-message=HEAD

# Credit an author on the latest commit
credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f"

# Interactive rebase with the given number of latest commits
reb = "!r() { git rebase -i HEAD~$1; }; r"

# Remove the old tag with this name and tag the latest commit with it.
retag = "!r() { git tag -d $1 && git push origin :refs/tags/$1 && git tag $1; }; r"

# Find branches containing commit
fb = "!f() { git branch -a --contains $1; }; f"

# Find tags containing commit
ft = "!f() { git describe --always --contains $1; }; f"

# Find commits by source code
fc = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f"

# Find commits by commit message
fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f"

# Remove branches that have already been merged with master
# a.k.a. ‘delete merged’
dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"

# List contributors with number of commits
contributors = shortlog --summary --numbered

# Merge GitHub pull request on top of the current branch or,
# if a branch name is specified, on top of the specified branch
mpr = "!f() { \
declare currentBranch=\"$(git symbolic-ref --short HEAD)\"; \
declare branch=\"${2:-$currentBranch}\"; \
if [ $(printf \"%s\" \"$1\" | grep '^[0-9]\\+$' > /dev/null; printf $?) -eq 0 ]; then \
git fetch origin refs/pull/$1/head:pr/$1 && \
git checkout -B $branch && \
git rebase $branch pr/$1 && \
git checkout -B $branch && \
git merge pr/$1 && \
git branch -D pr/$1 && \
git commit --amend -m \"$(git log -1 --pretty=%B)\n\nCloses #$1.\"; \
fi \
}; f"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
6 changes: 6 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
save=true
save-exact=true
init-author-name=Marcel Robitaille
init-author-email=marcelrobitaille11@gmail.com
init-license=MIT
progress=false
48 changes: 48 additions & 0 deletions .vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
" Vim settings
set nocompatible
filetype off


" ================ Vundle ======================

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" Tree view
Plugin 'scrooloose/nerdtree'

" Fuzzy file finder
Plugin 'ctrlpvim/ctrlp.vim'

" All of your Plugins must be added before the following line
call vundle#end()
filetype plugin indent on


" Line numbers
set number

" Syntax highlighting
syntax on

" Start scrolling three lines before the horizontal window border
set scrolloff=3

" This makes vim act like all other editors, buffers can
" exist in the background without being in a window.
" http://items.sjbach.com/319/configuring-vim-right
set hidden


" ================ Indentation ======================

set autoindent
set smartindent
set smarttab
set tabstop=4
set shiftwidth=4
set softtabstop=4
12 changes: 12 additions & 0 deletions .zshrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Path to your oh-my-zsh installation.
export ZSH=/home/marcel/.config/oh-my-zsh

ZSH_THEME="agnoster_custom"

plugins=(git)

for file in $ZSH/{oh-my-zsh,exports,aliases,functions}.sh; do
[ -r "$file" ] && [ -f "$file" ] && source "$file";
done;

DEFAULT_USER="marcel"
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Marcel Robitaille

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# zshdotfiles
My dotfiles for all my computers running zsh
24 changes: 24 additions & 0 deletions oh-my-zsh/aliases.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Basic functions
alias rm="rm -i"

# Places
alias d="cd ~/Desktop"

# Git
alias g="git "
alias s="git status -s"
alias a="git add "
alias aa="git add -A"
# alias ac="git commit -am "
alias c="git commit "
# alias cm="git commit -m "
alias d="git diff "
alias p="git push"
alias pl="git pull"
alias new="clone [email protected]:Marcel-Robitaille/template.git "

# Misc
alias scan="sudo chmod 666 /dev/bus/usb/$(lsusb | grep Brother | sed s/Bus\ // | sed s:\ Device\ :/: | cut -d':' -f 1 ) && xsane"
alias sql="mysql -u lan -p personal --host 192.168.0.120"
alias starwars="telnet towel.blinkenlights.nl"
alias fonts="fc-cache -fv"
8 changes: 8 additions & 0 deletions oh-my-zsh/exports.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$PATH"
export FPATH="/home/marcel/.oh-my-zsh/custom/plugins:$FPATH"

export EDITOR="/usr/bin/atom"
export EDITOR_CLI="/usr/bin/atom"
export CHEATCOLORS=true

export LANG=en_US.UTF-8
33 changes: 33 additions & 0 deletions oh-my-zsh/functions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Prints colours. Nuff said.
colourtest(){
for x in 0 1 4 5 7 8; do for i in `seq 30 37`; do for a in `seq 40 47`; do echo -ne "\e[$x;$i;$a""m\\\e[$x;$i;$a""m\e[0;37;40m "; done; echo; done; done; printf "\e[0m\n";
}

# Clones repo, cds into it, and opens it in your text editor
clone(){
local FOLDER=""
if [ "$#" -gt "1" ]; then
FOLDER=$2
elif; then
FOLDER=$(echo $1 | grep -o "[^\/]*\.git$" | sed s/\.git//)
fi;

git clone $1 $FOLDER
cd $FOLDER
$EDITOR_CLI .
}

# Create a new directory and enter it
function mkd() {
mkdir -p "$@" && cd "$_";
}

# `git commit -m "<message>"` without the need for ""
cm(){
git commit -m "$*"
}

# Same as previous but with -a
cam(){
git commit -am "$*"
}

0 comments on commit de45108

Please sign in to comment.