From de45108edcd734c25cd60d0d1e153515250ca609 Mon Sep 17 00:00:00 2001 From: Marcel Robitaille Date: Fri, 13 May 2016 19:32:23 -0300 Subject: [PATCH] - Switched to having these files in ~/.config/ and using symlinks - Added functions --- .gitconfig | 84 ++++++++++++++++++++++++++++++++++++++++++ .gitignore | 1 + .npmrc | 6 +++ .vimrc | 48 ++++++++++++++++++++++++ .zshrc | 12 ++++++ LICENSE | 21 +++++++++++ README.md | 2 + oh-my-zsh/aliases.sh | 24 ++++++++++++ oh-my-zsh/exports.sh | 8 ++++ oh-my-zsh/functions.sh | 33 +++++++++++++++++ 10 files changed, 239 insertions(+) create mode 100644 .gitconfig create mode 100644 .gitignore create mode 100644 .npmrc create mode 100644 .vimrc create mode 100644 .zshrc create mode 100644 LICENSE create mode 100644 README.md create mode 100644 oh-my-zsh/aliases.sh create mode 100644 oh-my-zsh/exports.sh create mode 100644 oh-my-zsh/functions.sh diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000..a8f3c53 --- /dev/null +++ b/.gitconfig @@ -0,0 +1,84 @@ +[user] + email = marcelrobitaille11@gmail.com + 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" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +* diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..0433370 --- /dev/null +++ b/.npmrc @@ -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 diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..4317cd0 --- /dev/null +++ b/.vimrc @@ -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 diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..e13f88a --- /dev/null +++ b/.zshrc @@ -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" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2fd345e --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..682b5de --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# zshdotfiles +My dotfiles for all my computers running zsh diff --git a/oh-my-zsh/aliases.sh b/oh-my-zsh/aliases.sh new file mode 100644 index 0000000..b98f53e --- /dev/null +++ b/oh-my-zsh/aliases.sh @@ -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 git@github.com: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" diff --git a/oh-my-zsh/exports.sh b/oh-my-zsh/exports.sh new file mode 100644 index 0000000..c2d3e61 --- /dev/null +++ b/oh-my-zsh/exports.sh @@ -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 diff --git a/oh-my-zsh/functions.sh b/oh-my-zsh/functions.sh new file mode 100644 index 0000000..ec0a04e --- /dev/null +++ b/oh-my-zsh/functions.sh @@ -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 ""` without the need for "" +cm(){ + git commit -m "$*" +} + +# Same as previous but with -a +cam(){ + git commit -am "$*" +}