From 8e4dd5ca6a9bd436cdfd83a2773fe0efd244a773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Borgesen?= Date: Mon, 10 Sep 2012 11:11:17 +0200 Subject: [PATCH] Initial commit --- .gitconfig | 32 ++++++ .tmux.conf | 58 +++++++++++ .vimrc | 276 +++++++++++++++++++++++++++++++++++++++++++++++++++ .zshrc | 165 ++++++++++++++++++++++++++++++ bootstrap.sh | 17 ++++ 5 files changed, 548 insertions(+) create mode 100644 .gitconfig create mode 100644 .tmux.conf create mode 100644 .vimrc create mode 100644 .zshrc create mode 100644 bootstrap.sh diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000..5498aa3 --- /dev/null +++ b/.gitconfig @@ -0,0 +1,32 @@ +[alias] + co = checkout + ci = commit + st = status + br = branch + hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short + type = cat-file -t + dump = cat-file -p +[color] + ui = always +[apply] + whitespace = fix +[core] + excludesfile = ~/.gitignore + attributesfile = ~/.gitattributes + whitespace = fix,space-before-tab,tab-in-indent,trailing-space +[color "branch"] + current = yellow reverse + local = yellow + remote = green +[color "diff"] + meta = yellow bold + frag = magenta bold + old = red bold + new = green bold +[color "status"] + added = yellow + changed = green + untracked = cyan +[merge] + log = true + diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..9f89d64 --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,58 @@ +# Rebind action key +set-option -g prefix C-a + +# Double control-a to switch between current and last window. +bind-key C-a last-window + +# Rebind close window +bind q confirm kill-window + +# Control-s to switch between current and last pane. +bind-key C-s last-pane + +# Rebind pane splitting +unbind % +bind | split-window -h +bind - split-window -v + +# Configure terminal to use 256 colors +set -g default-terminal "screen-256color" + +# Vim-style pane navigation +bind h select-pane -L # Select the pane to the left +bind j select-pane -D # Select the pane below +bind k select-pane -U # Select the pane above +bind l select-pane -R # Select the pane to the right + +bind C-h resize-pane -L +bind C-j resize-pane -D +bind C-k resize-pane -U +bind C-l resize-pane -R + +# Left status bar +set -g status-left-bg default +set -g status-left-fg colour235 +set -g status-left '#S' + +# Window status bars +set -g window-status-current-format '#[fg=colour150,noreverse,bold] #I : #W ' +set -g window-status-format '#[fg=colour235] #I : #W ' + +# Right status bar +set -g status-right '#[fg=black]%Y-%m-%d #[fg=white]%I:%M' + +# Message +set -g message-bg colour235 +set -g message-fg white + +# Panes +set -g pane-active-border-fg colour150 + +# Don't automatically rename windows +set -g automatic-rename off + +# Start numbering windows from 1 +set -g base-index 1 + +# Use zsh +set-option -g default-shell /bin/zsh diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..292bf67 --- /dev/null +++ b/.vimrc @@ -0,0 +1,276 @@ +" I use a back background in my editors +set background=dark + +filetype plugin on + + +" Save jumps and marks by default +set viminfo='100,f1 + +" I like highlighted search results +set hlsearch +" Use incremental searching +set incsearch + +" Set standard setting for PEAR coding standards +set tabstop=4 +set shiftwidth=4 + +" Auto expand tabs to spaces +" set expandtab + +" Dont implement VI's bugs +set nocompatible + +" No gvim toolbar +set guioptions-=T + + +set autochdir + + +" Auto indent after a { +set autoindent +set smartindent + +" Linewidth to endless +set textwidth=0 + +" Do not wrap lines automatically +set nowrap + +set showcmd + +set laststatus=2 + +" Show line numbers by default +set number + +" Jump 5 lines when running out of the screen +set scrolljump=5 + +" Indicate jump out of the screen when 3 lines before end of the screen +set scrolloff=3 + +" Repair wired terminal/vim settings +set backspace=start,eol + +"set makeprg=jsl\ -nologo\ -nofilelisting\ -nosummary\ -nocontext\ -conf\ '/etc/jsl.conf'\ -process\ % +"set errorformat=%f(%l):\ %m +"make F10 call make for linting etc. +"inoremap :make +"map :make + +" Map -B to run PHP parser check +" noremap :!php -l % +" noremap :e # + +:map :tag +" :map :set tags=tags +" :map :! "find lib/*.php js/*.js css/*.css -maxdepth 1 -type f | grep -v js_c | grep -v css_c | xargs ctags" + + +" Location list navigation +noremap :lnext +noremap :lprevious + +" Map zz to space, center around cursor +nmap zz + +" :map :buffers + +noremap zz +noremap zz + +set showtabline=2 " File tabs allways visible +:nmap :tabprevious +:nmap :tabnext +:nmap :tabnew +:map :tabnew +:map :tabprevious +:map :tabnext +:map :tabclose +" :map :tabclose +:imap :tabpreviousi +:imap :tabnexti +:imap :tabnew + +:imap +" Trying to unlearn this.. +" :map :tabnext +" :map :tabprevious +" :imap :tabpreviousi +" :imap :tabnexti + +" “”“”“”“”“”“”“”“”“”“”“”“”“”“”" +" Eclim Settings +" “”“”“”“”“”“”“”“”“”“”“”“”“”“”" +" "use default Taglist instead of Eclim, avoid problem +let g:EclimTaglistEnabled=0 +" “let g:taglisttoo_disabled = 1 ”maybe of the same use of the above command +" "if the current file is in a Eclipse project, open project tree +" automatically +let g:EclimProjectTreeAutoOpen=1 +let g:EclimProjectTreeExpandPathOnOpen=1 +let g:EclimProjectTreeSharedInstance=1 "share tree instance through all +" tabs +" " use tabnew instead of split for new action +let g:EclimProjectTreeActions = [{'pattern': '.*', 'name': 'Tab', 'action': 'tabnew'}] + + +" set winaltkeys=no + +":map :tabprevious +":map :tabnext +":imap :tabpreviousi +":imap :tabnexti +:map :tabprevious +:map :tabnext +:imap :tabpreviousi +:imap :tabnexti + +" Tab Control (others) +":map 1gt +":map 2gt +":map 3gt +":map 4gt +":map 5gt +":map 6gt +":map 7gt +":map 8gt +":map 9gt + + +set encoding=utf-8 + +set tags=tags + +" jump to start of line +nmap = ^ + +" The completion dictionary is provided by Rasmus: +" http://lerdorf.com/funclist.txt +set dictionary-=/home/pookey/funclist.txt dictionary+=/home/pookey/funclist.txt +" Use the dictionary completion +set complete-=k complete+=k + +" This function determines, wether we are on the start of the line text (then tab indents) or +" if we want to try autocompletion +function InsertTabWrapper() + let col = col('.') - 1 + if !col || getline('.')[col - 1] !~ '\k' + return "\" + else + return "\" + endif +endfunction + +" Delete stuff into black hole register +noremap D "_d + +" Block comment + +" au FileType haskell,vhdl,ada let b:comment_leader = '-- ' +" au FileType vim let b:comment_leader = '" ' +" au FileType js,c,cpp,java let b:comment_leader = '// ' +" au FileType sh,make let b:comment_leader = '# ' +" au FileType tex let b:comment_leader = '% ' +" let b:comment_leader = '// ' +" noremap ,c :sil s/^/=escape(b:comment_leader,'\/')/:noh +" noremap ,u :sil s/^\V=escape(b:comment_leader,'\/')//e:noh +noremap ,c :sil s/^/=escape('// ','\/')/:noh +noremap ,u :sil s/^\V=escape('// ','\/')//e:noh + +" paste from system buffer +" nmap "+p +" map "+y +nnoremap :set invpaste paste? +set pastetoggle= +set showmode + + +" Remap the tab key to select action with InsertTabWrapper +inoremap =InsertTabWrapper() + +" set list +" set listchars=tab:>-,trail:- +" set listchars=tab:>-,trail:-,eol:$ +set ignorecase " caseinsensitive searches +set showmode " always show command or insert mode +set ruler " show line and column information +set showmatch " show matching brackets +set formatoptions=tcqor +set whichwrap=b,s,<,>,[,] +syntax on + +" CTRL-C = SVN Commit +" map :w:!svn commit + +" What is leader? +map e :Explore +map s :Sexplore + + +" pressing < or > will let you indent/unident selected lines +" +vnoremap < >gv + +" Map to write current buffer. + +map :w +imap +imap + +" I haven't found how to hide this function (yet) +function! RestoreRegister() + let @" = s:restore_reg + return '' +endfunction + +function! s:Repl() + let s:restore_reg = @" + return "p@=RestoreRegister()\" +endfunction + +" NB: this supports "rp that replaces the selection by the contents of @r +" vnoremap p Repl() + +let s:putSwap = 1 +function TogglePutSwap() + if s:putSwap + vnoremap p Repl() + let s:putSwap = 0 + echo 'noreplace put' + else + vnoremap p p + let s:putSwap = 1 + echo 'replace put' + endif + return +endfunction +noremap ,p :call TogglePutSwap() + + +function SurroudIf(fl, ll) + echo 'Iffing' + let intro = 'if(){\n' + let outro = '}' + echo ll + + return +endfunction + +vmap ,i :call SurroudIf() + + +" Eclim code validation +noremap ,s :EclimValidate + + +" Automatically open nerdtree +" autocmd vimenter * NERDTree +autocmd vimenter * if !argc() | NERDTree | endif + +" Automatically close vim if nerdtree is the only buffer left +autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..6be5c9f --- /dev/null +++ b/.zshrc @@ -0,0 +1,165 @@ +HISTSIZE=5000 +HISTFILESIZE=5000 + + +############ GIT CONFIG + +typeset -ga preexec_functions +typeset -ga precmd_functions +typeset -ga chpwd_functions + +setopt prompt_subst + +export __CURRENT_GIT_BRANCH= + + parse_git_branch() { + git branch --no-color 2> /dev/null \ + | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1 /' + } + + preexec_functions+='zsh_preexec_update_git_vars' + zsh_preexec_update_git_vars() { + case "$(history $HISTCMD)" in + *git*) + export __CURRENT_GIT_BRANCH="$(parse_git_branch)" + ;; + esac + } + + chpwd_functions+='zsh_chpwd_update_git_vars' + zsh_chpwd_update_git_vars() { + export __CURRENT_GIT_BRANCH="$(parse_git_branch)" + } + + get_git_prompt_info() { + if [[ "$__CURRENT_GIT_BRANCH" == " " ]]; then + echo "" + else + echo $__CURRENT_GIT_BRANCH + fi + } +################## + +#### PARSE JOBS in background, return "n " where n is the number of jobs in background, if there is no jobs in background this will return "". +parse_jobs(){ + jobs -l | wc -l | sed -e 's/ //g' | sed -e 's/$/ /g' | sed -e 's/^0 $//g' +} + +alias restartCoreAudio="sudo kill -9 `ps ax|grep 'coreaudio[a-z]' |awk '{print $1}'`" +alias logcat='adb logcat | coloredlogcat.py' +alias mv='nocorrect mv -i' # no spelling correction on mv +alias cp='nocorrect cp -i' # no spelling correction on cp +alias mkdir='nocorrect mkdir' # no spelling correction on mkdir +alias tml="tmux list-sessions" +alias tmn="tmux new-session -s" +alias tma="tmux attach-session -t" + +alias e="subl -n ." + +alias dh='df -h' +alias c='cd ~; clear' + +alias -g L='|less' +alias -g X='|xargs' +alias -g G='|grep' +alias -g Gi='|grep -i' +alias -g H='|head' +alias -g T='|tail' +alias -g N=' 2>/dev/null &' + +alias agi='sudo aptitude install' +alias ags='sudo aptitude search' +alias agh='sudo aptitude show' +alias agu='sudo aptitude update' +alias agg='sudo apt-get upgrade' +alias agr='sudo aptitude remove' +alias agp='sudo aptitude purge' +alias agl='dpkg -l | grep' +alias dki='sudo dpkg -i' +alias agL='dpkg -L' +alias agS='dpkg -S' +alias sscp='rsync -av --partial --progress --inplace' +alias svim='sudo vim' +alias rarx='nice -n 19 rar x' + +alias ssource="source ~/.zshrc" + +#bindkey -v # Vi-style keys +bindkey -e # Emacs-style commandline editing + +alias ls='ls -G' +alias la='ls -la' +alias ll='ls -l' +alias latr='ls -latr' + +# Nice prompt +if [ $(hostname) = "xps" ] ; then + PROMPT=$'%j '$'%{\e[1;31m%}''$(get_git_prompt_info)'$'%{\e[m%}'$'%{\e[1;33m%}%n%{\e[0;37m%}@%{\e[1;34m%}%m%{\e[m%}:%{\e[0;33m%}%30<..<%~%{\e[m%}%(!.#.>) ' +else + PROMPT=$'%{\e[1;31m%}''$(get_git_prompt_info)'$'%{\e[m%}'$'$(parse_jobs)%{\e[1;34m%}%n%{\e[0;37m%}@%{\e[1;34m%}%m%{\e[m%}:%{\e[0;33m%}%30<..<%~%{\e[m%}%(!.#.>) ' +fi +#PROMPT=$'%j %{\e[1;30m%}%n%{\e[0;37m%}@%{\e[1;34m%}%m%{\e[m%}:%{\e[0;33m%}%30<..<%~%{\e[m%}%(!.#.>) ' +#PROMPT=$'%j %{\e[1;33m%}%n%{\e[0;37m%}@%{\e[1;34m%}%m%{\e[m%}:%{\e[0;33m%}%30<..<%~%{\e[m%}%(!.#.>) ' +#PROMPT=$'%j %{\e[1;35m%}%n%{\e[0;30m%}@%{\e[1;34m%}%m%{\e[m%}:%{\e[0;33m%}%30<..<%~%{\e[m%}%(!.#.>) ' + +# Git right promtp +#RPROMPT=$'%{\e[1;31m%}''$(get_git_prompt_info)'$'%{\e[m%}' +RPROMPT= + +zstyle ':completion:*' completer _list _expand _complete _ignored _match _prefix +zstyle ':completion:*' condition 'NUMERIC != 1' +zstyle ':completion:*' matcher-list '' 'r:|[._-]=* r:|=*' 'm:{a-z}={A-Z} l:|=* r:|=*' +zstyle ':completion:*' match-original both +zstyle ':completion:*' max-errors 1 +zstyle :compinstall filename '/root/.zshrc' + +if [ -f ~/.ssh/known_hosts ]; then + hosts=(`awk -F "[, ]" '{print $1}' ~/.ssh/known_hosts`) +fi +if [ -f ~/.ssh/known_hosts2 ]; then + hosts=($hosts `awk -F "[, ]" '{print $1}' ~/.ssh/known_hosts2`) +fi +if [ -f ~/.ssh/config ]; then + hosts=($hosts `grep ^Host ~/.ssh/config | sed s/Host\ // | egrep -v '^\*$'`) +fi +zstyle ':completion:*' special-dirs true + + +autoload -Uz compinit +compinit +# End of lines added by compinstall + +#export LC_CTYPE="no_NO.ISO8859-1" +#export __GL_SYNC_TO_VBLANK=1 +export LESS=-MM +export TZ='Europe/Oslo' +export CVS_RSH='ssh' +export RSYNC_RSH='ssh' +#export NNTPSERVER='news.scene.org' +export EDITOR=vim + +export HISTSIZE=1000000000 +export HISTFILE=~/.zsh_history +export SAVEHIST=300000000 + +reboo() { +bash -c 'read -p "really reboot? (y/n)?" +if [ $REPLY != "y" ]; then + echo "thougt so..." + exit 1 +fi +ifconfig +'; +} + +agB () { + dpkg -L $@ | grep bin +} + +PATH=$PATH:/Applications/android-sdk-mac_86/tools +PATH=$PATH:/Applications/android-sdk-mac_86/platform-tools +PATH=$PATH:~/bin +PATH=$PATH:/opt/local/bin +PATH=$PATH:/usr/local/mysql/bin/ + +compdef -d git diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100644 index 0000000..2170ab9 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,17 @@ +#!/bin/bash +cd "$(dirname "$0")" +git pull +function doIt() { + rsync --exclude ".git/" --exclude ".DS_Store" --exclude "bootstrap.sh" --exclude "README.md" -av . ~ +} +if [ "$1" == "--force" -o "$1" == "-f" ]; then + doIt +else + read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1 + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + doIt + fi +fi +unset doIt +source ~/.bash_profile \ No newline at end of file