Last active
September 25, 2015 12:07
-
-
Save smpb/919294 to your computer and use it in GitHub Desktop.
my configuration files. for easy reference and replication.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = Sérgio Bernardino | |
email = code@sergiobernardino.net | |
[color] | |
branch = auto | |
diff = auto | |
grep = auto | |
status = auto | |
log = auto | |
[color "status"] | |
added = green | |
untracked = yellow | |
[alias] | |
# [aa = add all] Adds all files | |
aa = add . | |
# [co = checkout] | |
co = checkout | |
# [ci = commit] | |
ci = commit | |
# [st = status] short status | |
st = status -s | |
# [df = diff] | |
df = diff | |
# [who = shortlog] who committed and how much | |
who = shortlog -nes | |
# [l = log] short one line logs with ref-names | |
l = log --oneline --name-status --decorate=short | |
# [l = log] short one line logs with ref-names, date and author - nice colored | |
ll = log --graph --pretty=format:'%C(yellow)%h%Creset -%C(red)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --date=relative | |
# fix commits that have typos on the message and/or missing files | |
# missing files need to be added before invoking 'fix' | |
fix = commit --amend | |
# show a ranked count of git verbs | |
verbs = !git log --pretty=format:'%s' | cut -d ' ' -f 1 | sort | uniq -c | sort -n | |
# the "Ramalho Syndrome" | |
poop = stash pop | |
# list all the created aliases | |
alias = !git config --get-regexp alias | awk -F'.' '{ print $2 }' | |
# assume a file is never changed | |
assume = update-index --assume-unchanged | |
# list file that are assumed to never be changed | |
assumed = "!git ls-files -v | grep ^h | cut -c 3-" | |
# stop assuming a file is never changed | |
unassume = update-index --no-assume-unchanged | |
# take a snapshot of your current working tree without removing the changes from your tree | |
snapshot = !git stash save "snapshot: $(date)" && git stash apply "stash@{0}" | |
[core] | |
excludesfile = ~/.gitignore | |
[push] | |
default = upstream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# generic options | |
shell zsh # default shell | |
term xterm-256color # set $TERM type | |
startup_message off # don't display the copyright page | |
defscrollback 10000 # change scrollback to 10000 lines | |
termcapinfo xterm ti@:te@ # fix scrollback in PuTTY | |
vbell_msg "beep!" # visible bell | |
# add colors | |
attrcolor b ".I" | |
termcapinfo xterm-256color 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' | |
defbce "on" | |
# visual options | |
hardstatus alwayslastline "%{= kw}%?%{-b kK} %-W%?%{+b kW} %n %t%?%{-b kK}%+W%?%=%{-b kg}%l% @ %H%{-b kK} | %{-b kM}%D %d/%m/%Y %c " | |
# bound keys | |
bindkey -k k1 prev | |
bindkey -k k2 next | |
bindkey -k k3 screen | |
bindkey -k k4 kill | |
bindkey -k k5 detach | |
escape ^ka | |
# default screens | |
screen -t top 0 top | |
screen -t zsh 1 zsh | |
# utf8 | |
setenv LC_CTYPE en_US.UTF-8 | |
defutf8 on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# tmux config file | |
# | |
# by Sérgio Bernardino | |
# | |
# reload tmux.conf with prefix-r | |
bind r source-file ~/.tmux.conf \; display 'Reloaded config file' | |
set -g default-terminal 'screen-256color' | |
# Status bar settings | |
# Variable Description | |
# -------- ----------- | |
# #H Hostname of local host | |
# #h Hostname of local host without the domain name | |
# #F Current window flag | |
# #I Current window index | |
# #P Current pane index | |
# #S Current session name | |
# #T Current window title | |
# #W Current window name | |
# ## A literal # | |
set -g status-utf8 on | |
set -g status-left '#[default]' | |
set -g status-right-length 55 | |
set -g status-right '#[fg=green]#(cut -d " " -f 1-3 /proc/loadavg) @ #H#[default] | #[fg=magenta]%a %d/%m/%Y %H:%M #[default]' | |
set -g window-status-format ' #I #W' | |
set -g window-status-current-format ' #I #W' | |
# colors | |
setw -g window-status-current-fg white | |
setw -g window-status-current-attr bright | |
set -g status-bg black | |
set -g status-fg white | |
set -g status-attr dim | |
set -g message-fg white | |
set -g message-bg black | |
set -g message-attr bright | |
# bind | and - to horizontal and vertical split respectively | |
bind | split-window -h | |
bind - split-window -v | |
# provide visual notification in status bar when a window's content changes | |
setw -g monitor-activity on | |
set -g visual-activity on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" set Pathogen to load all scripts on ~/vim/bundle/ | |
" http://www.vim.org/scripts/script.php?script_id=2332 | |
" call pathogen#runtime_append_all_bundles() | |
"========[ VIM SETTINGS ]======== | |
set nocompatible | |
set ttyfast | |
set encoding=utf-8 | |
set fileformats=unix,mac,dos " handle Mac and DOS line-endings | |
" but prefer Unix endings | |
" show visual bell instead of beeping | |
" don't beep on error | |
set visualbell | |
set noerrorbells | |
" look of the windows | |
set showmode | |
set showcmd | |
set nonumber | |
set ruler | |
set scrolloff=3 " number of screen lines to keep above and below the cursor | |
set laststatus=2 " the last window always has a status bar | |
" deal with tabs and indentation | |
set shiftwidth=2 | |
set tabstop=2 | |
set expandtab | |
set smarttab | |
set autoindent | |
set smartindent | |
" deal with long lines | |
set formatoptions-=cro " do ':help fo-table' for details | |
set textwidth=120 | |
set wrap | |
" Make naughty characters visible... | |
" (uBB is right double angle, uB7 is middle dot) | |
exec "set lcs=tab:\uBB\uBB,trail:\uB7,nbsp:~" | |
augroup VisibleNaughtiness | |
" Remove ALL autocommands for the current group, | |
" to ensure that Vim includes the autocommands only once | |
autocmd! | |
autocmd BufEnter * set list | |
autocmd BufEnter * if !&modifiable | |
autocmd BufEnter * set nolist | |
autocmd BufEnter * endif | |
augroup END | |
" backspace allowed over autoindent, | |
" over EOL - joining lines, over the start of insert | |
set backspace=indent,eol,start | |
" autocomplete commands with <Tab> | |
" present more than one match in a list, complete with longest match | |
set wildmenu | |
set wildmode=list:longest,full " show list of completions: | |
" and complete as much as possible, | |
" then iterate full completions | |
"========[ SEARCH OPTIONS ]======== | |
set ignorecase " ignore case in all searches... | |
set smartcase " ...unless uppercase letters used | |
set incsearch " lookahead as search pattern is specified | |
set hlsearch " highlight all matches | |
" delete in normal mode to switch off highlighting till next search | |
nmap <silent> <BS> :nohlsearch<CR> | |
"========[ PATHS SETUP ]======== | |
" extra forward slash to specify that VIM should add the full path to the filename | |
set backup | |
set backupdir=$HOME/.vim/backups/ | |
set directory=$HOME/.vim/swaps/ | |
set viewdir=$HOME/.vim/views/ | |
" activate 'semi-infinite' undo, if available | |
if has('persistent_undo') | |
set undodir=$HOME/.vim/undodir/ | |
set undolevels=5000 | |
set undofile | |
endif | |
"========[ GENERIC KEY MAPPINGS ]======== | |
" remap leader key - user commands | |
" Example, >:map <Leader>A oanother line<Esc> | |
" works like, >:map ;A oanother line<Esc> | |
let mapleader=";" | |
" remap bracket matching to the Tab key | |
nnoremap <TAB> % | |
vnoremap <TAB> % | |
" enable tab-browsing | |
nmap <C-TAB> :tabnext<CR> | |
nmap <C-S-TAB> :tabprevious<CR> | |
" 'very magic' mode for regular expression patterns | |
" ie, regex work almost exactly like in Perl | |
nnoremap / /\v | |
vnoremap / /\v | |
" Make backspace work as expected in visual modes, | |
" i.e. delete the selected text | |
vmap <BS> x | |
" Use (shift+)space to jump through the page (like browsers do) | |
nnoremap <Space> <PageDown> | |
nnoremap <S-Space> <PageUp> | |
"========[ GUI OPTIONS ]======== | |
if &t_Co >= 256 || has("gui_running") | |
set guioptions-=T "remove toolbar | |
"set guioptions-=m "remove all scroll bars | |
"set guioptions-=l "remove all scroll bars | |
"set guioptions-=r "remove all scroll bars | |
"set guioptions-=b "remove all scroll bars | |
set guifont=Menlo:h13 | |
set background=dark | |
colorscheme solarized | |
endif | |
"========[ FILE SETTINGS ]======== | |
" autosave and autoload file views (to maintain folds) | |
" autocmd BufWinLeave ?* mkview | |
" autocmd BufWinEnter ?* silent loadview | |
filetype on " try to detect the file type when opened, | |
filetype plugin on " enable loading the plugin files, | |
filetype indent on " and ident rules for specific file types | |
syntax enable " switch syntax highlighting on | |
" folding | |
set foldcolumn=1 | |
set foldmethod=syntax | |
" open all folds by default | |
autocmd BufWinEnter * normal zR | |
"========[ OBJC FILES SETTINGS ]======== | |
" my *.m files are, by default, Objective-C files | |
autocmd BufRead,BufNewFile *.m setfiletype objc | |
"========[ PERL FILES SETTINGS ]======== | |
let perl_fold = 1 " syntax folding for Perl files | |
let perl_nofold_packages = 1 " don't fold packages | |
" my *.t files are, by default, Perl files | |
autocmd BufNewFile,BufRead *.t setfiletype perl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# init | |
local ZSH_HOME=~/.zsh | |
export LC_ALL=en_US.UTF-8 | |
export LANG=en_US.UTF-8 | |
# | |
setopt promptsubst | |
setopt nomatch | |
setopt notify | |
unsetopt beep | |
autoload colors; colors; | |
export CLICOLOR=1 | |
export LSCOLORS="Gxfxcxdxbxegedabagacad" | |
# history | |
local HISTFILE=$ZSH_HOME/zsh_history | |
local HISTSIZE=100000 | |
local SAVEHIST=100000 | |
setopt hist_ignore_dups | |
setopt share_history | |
setopt hist_verify | |
setopt extended_history | |
setopt hist_expire_dups_first | |
setopt hist_ignore_space | |
# completion | |
autoload -U compinit # initialization | |
compinit -d $ZSH_HOME/zcompdump | |
# display colors in selection menus | |
zmodload -i zsh/complist | |
zstyle ':completion:*' list-colors $LSCOLORS | |
# use cache for quicker initialization | |
zstyle ':completion:*' use-cache on | |
zstyle ':completion:*' cache-path $ZSH_HOME/cache | |
# display selection menu if there are more than two matches | |
zstyle ':completion:*' menu yes=2 select | |
unsetopt menu_complete | |
# attempt to complete, correct typos up to two mistakes | |
zstyle ':completion:*' completer _complete _approximate | |
zstyle ':completion:*:approximate:*' max-errors 2 numeric | |
zstyle ':completion:*:approximate:*' max-errors 2 not-numeric | |
# correction | |
setopt correct_all | |
# make search up and down work, | |
# so partially type and hit up/down to find relevant stuff | |
bindkey '^[[A' up-line-or-search | |
bindkey '^[[B' down-line-or-search | |
# aliases | |
alias mv='nocorrect mv -v' | |
alias cp='nocorrect cp -v' | |
alias rm='rm -v' | |
alias ls='ls -Flh' | |
alias vi='vim' | |
alias ..='cd ..' | |
alias ...='cd ../..' | |
# only for graphical mode | |
if [[ $TERM == "xterm" || $TERM == "xterm-color" || $TERM == "rxvt" ]]; then | |
#alias gvim='mvim' | |
alias vim='gvim' | |
fi | |
# git | |
local GIT_PROMPT_PREFIX="%{$fg[red]%} [" | |
local GIT_PROMPT_SUFFIX="]%{$reset_color%}" | |
local GIT_DIRTY_STATUS="*" | |
# get branch name, if it exists | |
function git_prompt_info() | |
{ | |
#local REF=$(git name-rev HEAD 2>/dev/null | awk '{ print $2 }') | |
local REF=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') | |
if [[ -n $REF ]]; then | |
echo "$GIT_PROMPT_PREFIX$REF$(parse_git_dirty)$GIT_PROMPT_SUFFIX" | |
fi | |
} | |
# should we show notification of changes to commit? | |
parse_git_dirty () { | |
if [[ -n $(git status -s 2> /dev/null) ]]; then | |
echo " $GIT_DIRTY_STATUS" | |
fi | |
} | |
# prompt | |
local RETURN_CODE="%(?..%{$fg[red]%}%? %{$reset_color%})" | |
export PS1='%{$fg[green]%}%n@%m%{$fg[blue]%} %B%3~%b$(git_prompt_info)%{$reset_color%} %B>%b ' | |
export RPS1=$RETURN_CODE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment