From 4527ad8208b46b18024ef7de59b94203e6441a78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Krej=C4=8D=C3=AD?= Date: Wed, 11 Feb 2015 22:40:21 +0100 Subject: [PATCH] Update 11/2/15 --- .aliases => .aliases.zsh | 4 + .colors.zsh | 8 + .completion.zsh | 64 +++ .custom => .custom.zsh | 4 +- .path => .exports.zsh | 8 + .functions | 38 -- .functions.zsh | 55 +++ .gitconfig | 5 +- .oh-my-zsh => .oh-my-zsh.zsh | 37 +- .setopt.zsh | 43 ++ .vimrc | 931 ++++++++++++++++++----------------- .zshrc | 14 +- mikekreeki.zsh-theme | 7 + 13 files changed, 721 insertions(+), 497 deletions(-) rename .aliases => .aliases.zsh (90%) create mode 100644 .colors.zsh create mode 100644 .completion.zsh rename .custom => .custom.zsh (69%) rename .path => .exports.zsh (69%) delete mode 100644 .functions create mode 100644 .functions.zsh rename .oh-my-zsh => .oh-my-zsh.zsh (54%) create mode 100644 .setopt.zsh create mode 100644 mikekreeki.zsh-theme diff --git a/.aliases b/.aliases.zsh similarity index 90% rename from .aliases rename to .aliases.zsh index 872d504..4770a2e 100644 --- a/.aliases +++ b/.aliases.zsh @@ -1,11 +1,15 @@ # SHELL alias pwdc='pwd | pbcopy' +alias ll='ls -GFhl' +# alias ls='ls -GFhl' + # BUNDLER alias bi='bundle install' # RAILS alias restart='mkdir -p tmp && touch tmp/restart.txt' +alias stop='spring stop' # GIT alias gs='git status -s' diff --git a/.colors.zsh b/.colors.zsh new file mode 100644 index 0000000..2976d4b --- /dev/null +++ b/.colors.zsh @@ -0,0 +1,8 @@ +# Setup terminal, and turn on colors +export TERM=xterm-256color +export CLICOLOR=1 +export LSCOLORS=Gxfxcxdxbxegedabagacad + +# Enable color in grep +export GREP_OPTIONS='--color=auto' +export GREP_COLOR='3;33' diff --git a/.completion.zsh b/.completion.zsh new file mode 100644 index 0000000..3fbfed3 --- /dev/null +++ b/.completion.zsh @@ -0,0 +1,64 @@ +# add in zsh-completions +fpath=(/usr/local/share/zsh-completions $fpath) + +autoload -U compinit && compinit +zmodload -i zsh/complist + +# man zshcontrib +zstyle ':vcs_info:*' actionformats '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' +zstyle ':vcs_info:*' formats '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f ' +zstyle ':vcs_info:*' enable git #svn cvs + +# Enable completion caching, use rehash to clear +zstyle ':completion::complete:*' use-cache on +zstyle ':completion::complete:*' cache-path ~/.zsh/cache/$HOST + +# Fallback to built in ls colors +zstyle ':completion:*' list-colors '' + +# Make the list prompt friendly +zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s' + +# Make the selection prompt friendly when there are a lot of choices +zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s' + +# Add simple colors to kill +zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' + +# list of completers to use +zstyle ':completion:*::::' completer _expand _complete _ignored _approximate + +zstyle ':completion:*' menu select=1 _complete _ignored _approximate + +# insert all expansions for expand completer +# zstyle ':completion:*:expand:*' tag-order all-expansions + +# match uppercase from lowercase +zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' + +# offer indexes before parameters in subscripts +zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters + +# formatting and messages +zstyle ':completion:*' verbose yes +zstyle ':completion:*:descriptions' format '%B%d%b' +zstyle ':completion:*:messages' format '%d' +zstyle ':completion:*:warnings' format 'No matches for: %d' +zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b' +zstyle ':completion:*' group-name '' + +# ignore completion functions (until the _ignored completer) +zstyle ':completion:*:functions' ignored-patterns '_*' +zstyle ':completion:*:scp:*' tag-order files users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *' +zstyle ':completion:*:scp:*' group-order files all-files users hosts-domain hosts-host hosts-ipaddr +zstyle ':completion:*:ssh:*' tag-order users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *' +zstyle ':completion:*:ssh:*' group-order hosts-domain hosts-host users hosts-ipaddr +zstyle '*' single-ignored show + +# ZAW styles +zstyle ':filter-select:highlight' matched fg=yellow,standout +zstyle ':filter-select' max-lines 10 # use 10 lines for filter-select +zstyle ':filter-select' max-lines -10 # use $LINES - 10 for filter-select +zstyle ':filter-select' rotate-list yes # enable rotation for filter-select +zstyle ':filter-select' case-insensitive yes # enable case-insensitive search +zstyle ':filter-select' extended-search no # see below diff --git a/.custom b/.custom.zsh similarity index 69% rename from .custom rename to .custom.zsh index 2a399f5..546dbbc 100644 --- a/.custom +++ b/.custom.zsh @@ -1,5 +1,5 @@ # Load RVM into a shell session *as a function* [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" -# EDITOR -export EDITOR=mvim +# Setup fzf +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh diff --git a/.path b/.exports.zsh similarity index 69% rename from .path rename to .exports.zsh index 5ac34bb..6c84753 100644 --- a/.path +++ b/.exports.zsh @@ -1,4 +1,5 @@ # GENERAL +export PATH="/Users/mikekreeki/.dotfiles/bin:$PATH" # HOMEBREW export PATH="/usr/local/bin:$PATH" @@ -18,3 +19,10 @@ PATH=".git/safe/../../bin:$PATH" # Android SDK export PATH="/Users/Kreeki/Development/adt-bundle/sdk/platform-tools:$PATH" export PATH="/Users/Kreeki/Development/adt-bundle/sdk/tools:$PATH" + +# Preferred editor for local and remote sessions +if [[ -n $SSH_CONNECTION ]]; then + export EDITOR='vim' +else + export EDITOR='mvim' +fi diff --git a/.functions b/.functions deleted file mode 100644 index 62ea4a0..0000000 --- a/.functions +++ /dev/null @@ -1,38 +0,0 @@ -function e() { - if [ "$1" = "" ] - then - exec $EDITOR . - else - exec $EDITOR "$1" - fi -} - -function log(){ - tail -f -n 100 log/development.log -} - -function running(){ - ps ax | grep $1 -} - -pman() { - man -t "${1}" | open -f -a /Appllication/Preview.app/ -} - -function gpr() { - git push && hub pull-request -b blueberryapps:$1 -h blueberryapps:$(git symbolic-ref --short HEAD) -} - -function deploy() { - git push - if [[ "$1" == "" ]] - then - print 'Deploying staging...' - cap -s branch=$(git symbolic-ref --short HEAD) staging deploy - cap -s branch=$(git symbolic-ref --short HEAD) staging deploy:migrate - else - print "Deploying $1..." - cap -s branch=$(git symbolic-ref --short HEAD) $1 deploy - cap -s branch=$(git symbolic-ref --short HEAD) $1 deploy:migrate - fi -} diff --git a/.functions.zsh b/.functions.zsh new file mode 100644 index 0000000..62b4f8f --- /dev/null +++ b/.functions.zsh @@ -0,0 +1,55 @@ +# Open file in EDITOR +function e() { + if [ "$1" = "" ] + then + exec $EDITOR . + else + exec $EDITOR "$1" + fi +} + +# Switch to subdirectory +function c() { + dir=$(ls | fzf --query="$1") + if [[ -n "$dir" ]]; then + cd $dir + fi +} + +# Switch projects +function p() { + proj=$(ls ~/Projects | fzf --query="$1") + if [[ -n "$proj" ]]; then + cd ~/Projects/$proj + fi +} + +# Tail development log +function log(){ + tail -f -n 100 log/development.log +} + +# Detect empty enter, execute git status if in git dir +magic-enter () { + if [[ -z $BUFFER ]]; then + if git rev-parse --is-inside-work-tree > /dev/null 2>&1; then + echo -ne '\n' + git status + fi + zle accept-line + else + zle accept-line + fi +} +zle -N magic-enter +bindkey "^M" magic-enter + +f() { + eval $(([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s | sed 's/ *[0-9]* *//') +} + +fe() { + local file + file=$(fzf --query="$1" --select-1 --exit-0) + [ -n "$file" ] && ${EDITOR:-vim} "$file" +} diff --git a/.gitconfig b/.gitconfig index 64dfe38..abb1fc3 100644 --- a/.gitconfig +++ b/.gitconfig @@ -71,7 +71,7 @@ autocorrect = 1 [credential] - helper = osxkeychain + helper = osxkeychain [filter "media"] clean = git-media-clean %f @@ -86,5 +86,6 @@ [merge] stat = true + [git-up "bundler"] - autoinstall = true + autoinstall = true diff --git a/.oh-my-zsh b/.oh-my-zsh.zsh similarity index 54% rename from .oh-my-zsh rename to .oh-my-zsh.zsh index 451e47d..3a77636 100644 --- a/.oh-my-zsh +++ b/.oh-my-zsh.zsh @@ -1,3 +1,4 @@ +# Path to your oh-my-zsh installation. ZSH=$HOME/.oh-my-zsh # Path to your oh-my-zsh configuration. @@ -5,7 +6,7 @@ ZSH=$HOME/.oh-my-zsh # Look in ~/.oh-my-zsh/themes/ # Optionally, if you set this to "random", it'll load a random theme each # time that oh-my-zsh is loaded. -ZSH_THEME="robbyrussell" +# ZSH_THEME="mikekreeki" # Set to this to use case-sensitive completion # CASE_SENSITIVE="true" @@ -22,8 +23,8 @@ ZSH_THEME="robbyrussell" # Uncomment following line if you want to disable autosetting terminal title. # DISABLE_AUTO_TITLE="true" -# Uncomment following line if you want to disable command autocorrection -# DISABLE_CORRECTION="true" +# Uncomment the following line to enable command auto-correction. +ENABLE_CORRECTION="true" # Uncomment following line if you want red dots to be displayed while waiting for completion # COMPLETION_WAITING_DOTS="true" @@ -33,9 +34,37 @@ ZSH_THEME="robbyrussell" # much faster. # DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +HIST_STAMPS="mm/dd/yyyy" + # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) -plugins=(git zsh-syntax-highlighting) +# Add wisely, as too many plugins slow down shell startup. +plugins=(git bundler zsh-syntax-highlighting) + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# ssh +# export SSH_KEY_PATH="~/.ssh/dsa_id" + +# Set personal aliases, overriding those provided by oh-my-zsh libs, +# plugins, and themes. Aliases can be placed here, though oh-my-zsh +# users are encouraged to define aliases within the ZSH_CUSTOM folder. +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" + +# You may need to manually set your language environment +# export LANG=en_US.UTF-8 source $ZSH/oh-my-zsh.sh + +export LC_ALL=en_US.UTF-8 +export LANG=en_US.UTF-8 diff --git a/.setopt.zsh b/.setopt.zsh new file mode 100644 index 0000000..858e691 --- /dev/null +++ b/.setopt.zsh @@ -0,0 +1,43 @@ +unsetopt MENU_COMPLETE +setopt AUTO_MENU + +# 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 + +# Allow multiple terminal sessions to all append to one zsh command history +setopt APPEND_HISTORY + +# Add commands 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 + +# ===== 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 diff --git a/.vimrc b/.vimrc index 792a763..a2423fa 100644 --- a/.vimrc +++ b/.vimrc @@ -1,627 +1,666 @@ " GENERAL -set nocompatible -filetype off - -set rtp+=~/.vim/bundle/Vundle.vim -call vundle#begin() - -Plugin 'gmarik/Vundle.vim' - -Plugin 'corntrace/bufexplorer' -Plugin 'kien/ctrlp.vim' -Plugin 'scrooloose/nerdtree' -Plugin 'scrooloose/syntastic' -Plugin 'Shougo/neocomplete.vim' -Plugin 'Shougo/neosnippet.vim' -Plugin 'Yggdroot/indentLine' -Plugin 'kien/rainbow_parentheses.vim' -Plugin 'Lokaltog/vim-powerline' -Plugin 'tpope/vim-commentary' -Plugin 'junegunn/vim-easy-align' -Plugin 'Lokaltog/vim-easymotion' -Plugin 'tpope/vim-endwise' -Plugin 'edsono/vim-matchit' -Plugin 'tpope/vim-repeat' -Plugin 'duff/vim-scratch' -Plugin 'tpope/vim-surround' -Plugin 'majutsushi/tagbar' -Plugin 'milkypostman/vim-togglelist' -Plugin 'tpope/vim-unimpaired' -Plugin 'michaeljsmith/vim-indent-object' -Plugin 'darvelo/vim-autoclose' -Plugin 'AndrewRadev/splitjoin.vim' -Plugin 'airblade/vim-rooter' -Plugin 'ntpeters/vim-better-whitespace' -Plugin 'AndrewRadev/multichange.vim' -Plugin 'rhysd/conflict-marker.vim' -" Plugin 'rhysd/clever-f.vim' -Plugin 'idanarye/vim-merginal' - -Plugin 'rking/ag.vim' -Plugin 'tpope/vim-fugitive' -Plugin 'int3/vim-extradite' -Plugin 'tpope/vim-rvm' -" Plugin 'tpope/vim-bundler' - -Plugin 'tpope/vim-rails' -Plugin 'vim-ruby/vim-ruby' -Plugin 'rking/vim-ruby-refactoring' -Plugin 'slim-template/vim-slim' -Plugin 'othree/html5.vim' -Plugin 'pangloss/vim-javascript' -Plugin 'kchmck/vim-coffee-script' -Plugin 'othree/javascript-libraries-syntax.vim' -" Plugin 'vim-scripts/FormatComment.vim' -Plugin 'inkarkat/argtextobj.vim' -Plugin 'rhysd/committia.vim' - -Plugin 'airblade/vim-gitgutter' -Plugin 'janko-m/vim-test' -Plugin 'gorkunov/smartpairs.vim' -Plugin 'Wolfy87/vim-enmasse' -Plugin 'gorkunov/smartgf.vim' -Plugin 'gregsexton/gitv' -Plugin 'mattdbridges/bufkill.vim' -Plugin 'derekwyatt/vim-scala' -Plugin 'ktvoelker/sbt-vim' -Plugin 'mhinz/vim-startify' -Plugin 'mattn/gist-vim' -Plugin 'mattn/webapi-vim' -Plugin 'junegunn/vim-github-dashboard' -Plugin 'mxw/vim-jsx' -Plugin 'EinfachToll/DidYouMean' - -call vundle#end() - -filetype plugin indent on -syntax on - -set shell=/bin/sh - -if v:version >= 704 " Vim 7.4 and up - " Revert to the old regex engine, which is faster for Ruby syntax highlighting - set re=1 -endif - -set encoding=utf-8 -set fileencoding=utf-8 - -let mapleader = "," - -set hidden -set number -set nowrap -set showbreak=+++ -set showmatch -set errorbells -set visualbell - -set notildeop -set modelines=0 - -set mouse= - -set nobackup -set noswapfile - -set ttyfast -set lazyredraw - -set scrolloff=1 - -if $TERM == "xterm-256color" || $TERM == "screen-256color" || $COLORTERM == "gnome-terminal" - set t_Co=256 -endif + set nocompatible + filetype off +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" PLUGINS -" INDENTATION + set rtp+=~/.vim/bundle/Vundle.vim + call vundle#begin() + + Plugin 'gmarik/Vundle.vim' + + Plugin 'corntrace/bufexplorer' + Plugin 'kien/ctrlp.vim' + Plugin 'scrooloose/nerdtree' + Plugin 'scrooloose/syntastic' + Plugin 'Shougo/neocomplete.vim' + Plugin 'Shougo/neosnippet.vim' + Plugin 'Yggdroot/indentLine' + Plugin 'kien/rainbow_parentheses.vim' + Plugin 'Lokaltog/vim-powerline' + Plugin 'tpope/vim-commentary' + Plugin 'junegunn/vim-easy-align' + Plugin 'Lokaltog/vim-easymotion' + Plugin 'tpope/vim-endwise' + Plugin 'edsono/vim-matchit' + Plugin 'tpope/vim-repeat' + Plugin 'duff/vim-scratch' + Plugin 'tpope/vim-surround' + Plugin 'majutsushi/tagbar' + Plugin 'milkypostman/vim-togglelist' + Plugin 'tpope/vim-unimpaired' + Plugin 'michaeljsmith/vim-indent-object' + Plugin 'darvelo/vim-autoclose' + Plugin 'AndrewRadev/splitjoin.vim' + Plugin 'airblade/vim-rooter' + Plugin 'ntpeters/vim-better-whitespace' + Plugin 'AndrewRadev/multichange.vim' + Plugin 'rhysd/conflict-marker.vim' + " Plugin 'rhysd/clever-f.vim' + Plugin 'idanarye/vim-merginal' + + Plugin 'rking/ag.vim' + Plugin 'tpope/vim-fugitive' + Plugin 'int3/vim-extradite' + Plugin 'tpope/vim-rvm' + " Plugin 'tpope/vim-bundler' + + Plugin 'tpope/vim-rails' + Plugin 'vim-ruby/vim-ruby' + Plugin 'rking/vim-ruby-refactoring' + Plugin 'slim-template/vim-slim' + Plugin 'othree/html5.vim' + Plugin 'pangloss/vim-javascript' + Plugin 'kchmck/vim-coffee-script' + Plugin 'othree/javascript-libraries-syntax.vim' + " Plugin 'vim-scripts/FormatComment.vim' + Plugin 'inkarkat/argtextobj.vim' + Plugin 'rhysd/committia.vim' + + Plugin 'airblade/vim-gitgutter' + Plugin 'janko-m/vim-test' + Plugin 'gorkunov/smartpairs.vim' + Plugin 'Wolfy87/vim-enmasse' + Plugin 'gorkunov/smartgf.vim' + Plugin 'gregsexton/gitv' + Plugin 'mattdbridges/bufkill.vim' + Plugin 'derekwyatt/vim-scala' + Plugin 'ktvoelker/sbt-vim' + " Plugin 'mhinz/vim-startify' + Plugin 'mattn/gist-vim' + Plugin 'mattn/webapi-vim' + Plugin 'junegunn/vim-github-dashboard' + Plugin 'mxw/vim-jsx' + Plugin 'EinfachToll/DidYouMean' + Plugin 'Shougo/vimproc' + Plugin 'Shougo/vimshell.vim' + Plugin 'kana/vim-textobj-user' + Plugin 'nelstrom/vim-textobj-rubyblock' + Plugin 'ngmy/vim-rubocop' + + call vundle#end() + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" GENERAL -set autoindent -set expandtab -set shiftwidth=2 -set smartindent -set smarttab -set softtabstop=2 + filetype plugin indent on + syntax on -" break properly, don't split words -set linebreak + set shell=/bin/sh + if v:version >= 704 " Vim 7.4 and up + " Revert to the old regex engine, which is faster for Ruby syntax highlighting + set re=1 + endif -" SEARCH + set encoding=utf-8 + set fileencoding=utf-8 -set ignorecase -set smartcase -set gdefault -set incsearch -set showmatch -set hlsearch -set scs + let mapleader = "," -nnoremap / /\v -vnoremap / /\v + set hidden + set number + set nowrap + set showbreak=+++ + set showmatch + set errorbells + set visualbell -" Press Space to turn off highlighting and clear any message already displayed. -nnoremap :nohlsearch:echo + set notildeop + set modelines=0 -" Project search using Ag -nnoremap f :Ag! + set mouse= + set nobackup + set noswapfile -" MOVEMENT + set ttyfast + set lazyredraw -nnoremap -nnoremap -nnoremap -nnoremap -inoremap -inoremap -inoremap -inoremap + set scrolloff=1 -nnoremap j gj -nnoremap k gk + if $TERM == "xterm-256color" || $TERM == "screen-256color" || $COLORTERM == "gnome-terminal" + set t_Co=256 + endif -nnoremap J 10j -nnoremap K 10k +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" INDENTATION -nnoremap -nnoremap -vnoremap -vnoremap + set autoindent + set expandtab + set shiftwidth=2 + set smartindent + set smarttab + set softtabstop=2 -" move to beginning/end of line -noremap H ^ -noremap L $ + " break properly, don't split words + set linebreak -" $/^ doesn't do anything -noremap $ -noremap ^ -noremap $ -noremap ^ +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" SEARCH -" nnoremap g; -nnoremap ů g; + set ignorecase + set smartcase + set gdefault + set incsearch + set showmatch + set hlsearch + set scs -" Cursorline in active window only -" augroup CursorLine -" au! -" au VimEnter,WinEnter,BufWinEnter * setlocal cursorline -" au WinLeave * setlocal nocursorline -" augroup END + nnoremap / /\v + vnoremap / /\v + " Press Space to turn off highlighting and clear any message already displayed. + nnoremap :nohlsearch:echo -" EDITING + " Project search using Ag + nnoremap f :Ag! -" Backspace over everything -set backspace=indent,eol,start +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" MOVEMENT -" Bubble single lines -nmap [e -nmap ]e + nnoremap + nnoremap + nnoremap + nnoremap + inoremap + inoremap + inoremap + inoremap + + nnoremap j gj + nnoremap k gk + + nnoremap J 10j + nnoremap K 10k + + nnoremap + nnoremap + vnoremap + vnoremap + + " move to beginning/end of line + noremap H ^ + noremap L $ + + " $/^ doesn't do anything + noremap $ + noremap ^ + noremap $ + noremap ^ + + " nnoremap g; + nnoremap ů g; + + " Cursorline in active window only + " augroup CursorLine + " au! + " au VimEnter,WinEnter,BufWinEnter * setlocal cursorline + " au WinLeave * setlocal nocursorline + " augroup END + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" EDITING -" Bubble multiple lines -vmap [egv -vmap ]egv + " Backspace over everything + set backspace=indent,eol,start + " Bubble single lines + nmap [e + nmap ]e -" COPY/PASTE + " Bubble multiple lines + vmap [egv + vmap ]egv -set clipboard=unnamed,unnamedplus +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" COPY/PASTE -" Toggle paste mode -set pastetoggle= + set clipboard=unnamed,unnamedplus -" reselect the text that was just pasted -nnoremap v V`] + " Toggle paste mode + set pastetoggle= -" Duplicate selection in visual mode -vmap D y'>p + " reselect the text that was just pasted + nnoremap v V`] -" assume the /g flag on :s substitutions to replace all matches in a line -set gdefault + " Duplicate selection in visual mode + vmap D y'>p -" R replaces cursor to end of line with what's copied -nnoremap R v$hp + " assume the /g flag on :s substitutions to replace all matches in a line + set gdefault + " R replaces cursor to end of line with what's copied + nnoremap R v$hp +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " SELECTION -" Visually select the text that was last edited/pasted -nmap gV `[v`] - -" reselect visual block after indent/outdent -vnoremap < >gv + " Visually select the text that was last edited/pasted + nmap gV `[v`] + " reselect visual block after indent/outdent + vnoremap < >gv +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " AUTOCOMPLETION -set wildmenu -set wildmode=longest:full,full - -set completefunc=syntaxcomplete#Complete + set wildmenu + set wildmode=longest:full,full + set completefunc=syntaxcomplete#Complete +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " ABBREVIATIONS -" Yes, I know :) -iabbrev anno ###########################################################k - -iabbrev edn end -iabbrev GCI CGI + " Yep, I know :) + iabbrev anno ###########################################################k + iabbrev edn end + iabbrev GCI CGI +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " FORMATTING -" set colorcolumn=80 -execute "set colorcolumn=" . join(range(81,335), ',') - -" When at 3 spaces and I hit >>, go to 4, not 5. -set shiftround + " set colorcolumn=80 + execute "set colorcolumn=" . join(range(81,335), ',') + " When at 3 spaces and I hit >>, go to 4, not 5. + set shiftround +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " HISTORY -set undolevels=1000 -set nobackup -set nowritebackup - -set history=250 + set undolevels=1000 + set nobackup + set nowritebackup -set updatetime=750 + set history=250 + set updatetime=750 +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " MOVING BETWEEN FILES -" Switch between the last two files -nnoremap + " Switch between the last two files + nnoremap -" auto load files if vim detects they have been changed outside of Vim -set autoread + " auto load files if vim detects they have been changed outside of Vim + set autoread -nmap s :only:AV + nmap s :only:AV +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " MODES -imap jj -imap ii - + imap jj + imap ii +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " BUFFERS -map :bn -map :bp - -nmap d :BD -" nmap D :only -nmap D :close + map :bn + map :bp -nnoremap + nmap d :BD + " nmap D :only + nmap D :close + nnoremap +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " SPLITS -set winwidth=80 + set winwidth=80 -" Open vertical split on right -set splitright + " Open vertical split on right + set splitright -" Open a new vertical split and switch over to it -nnoremap w v -nnoremap e :vnew -nmap w + " Open a new vertical split and switch over to it + nnoremap w v + nnoremap e :vnew + nmap w -" Resize splits when the window is resized -au VimResized * exe "normal! \=" + " Resize splits when the window is resized + au VimResized * exe "normal! \=" -map h -map j -map k -map l + map h + map j + map k + map l +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " DIFF -" Simple way to turn off Gdiff splitscreen -" works only when diff buffer is focused -if !exists(":Gdiffoff") - command Gdiffoff diffoff | q | Gedit -endif - + " Simple way to turn off Gdiff splitscreen + " works only when diff buffer is focused + if !exists(":Gdiffoff") + command Gdiffoff diffoff | q | Gedit + endif +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " UTILITIES -function! Preserve(command) - " Preparation: save last search, and cursor position. - let _s=@/ - let l = line(".") - let c = col(".") - " Do the business: - execute a:command - " Clean up: restore previous search history, and cursor position - let @/=_s - call cursor(l, c) - endfunction - nmap _$ :call Preserve("%s/\\s\\+$//e") - nmap _= :call Preserve("normal gg=G") - -" Remove trailing whitespace before save -autocmd BufWritePre *.rb,*.js,*.coffee,*.css,*.sass,*.scss,*.slim :call Preserve("%s/\\s\\+$//e") - - -command! Path :call EchoPath() - function! EchoPath() - echo join(split(&path, ","), "\n") - endfunction - - + function! Preserve(command) + " Preparation: save last search, and cursor position. + let _s=@/ + let l = line(".") + let c = col(".") + " Do the business: + execute a:command + " Clean up: restore previous search history, and cursor position + let @/=_s + call cursor(l, c) + endfunction + nmap _$ :call Preserve("%s/\\s\\+$//e") + nmap _= :call Preserve("normal gg=G") + + " Remove trailing whitespace before save + autocmd BufWritePre * :call Preserve("%s/\\s\\+$//e") + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " MAPPINGS -" Don't wait so long for the next keypress (particularly in ambigious Leader -" situations. (via @r00k dotfiles) -set timeoutlen=500 - + " Don't wait so long for the next keypress (particularly in ambigious Leader + " situations. (via @r00k dotfiles) + set timeoutlen=500 +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " ALIASES -:command! W w -:command! Q q - -:command! Stop !spring stop + :command! W w + :command! Q q + :command! Stop !spring stop +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " GUI -" Set the vertical split character to a space -set fillchars+=vert:\ " there is a single space after '\ ' - -" Status and command line -set showcmd + " Set the vertical split character to a space + set fillchars+=vert:\ " there is a single space after '\ ' -set laststatus=2 -set statusline=[%02n]\ %f\ %(\[%M%R%H]%)%=\ %4l,%02c%2V\ %P%* + " Status and command line + set showcmd -" Hide tollbars, scrollbars and other bars -set shortmess+=I + set laststatus=2 + set statusline=[%02n]\ %f\ %(\[%M%R%H]%)%=\ %4l,%02c%2V\ %P%* -set guioptions-=r -set guioptions-=L + " Hide tollbars, scrollbars and other bars + set shortmess+=I -" Use console dialogs -set guioptions+=c + set guioptions-=r + set guioptions-=L -" Start in fullscreen by default -if has("gui_running") - set fu -end + " Use console dialogs + set guioptions+=c -" set number -" set relativenumber -" function! NumberToggle() -" if(&relativenumber == 1) -" set norelativenumber -" set number -" else -" set number -" set relativenumber -" endif -" endfunc -" nnoremap :call NumberToggle() + " Start in fullscreen by default + if has("gui_running") + set fu + end -autocmd WinEnter,FocusGained * :setlocal number relativenumber -autocmd WinLeave,FocusLost * :setlocal number norelativenumber + " set number + " set relativenumber + " function! NumberToggle() + " if(&relativenumber == 1) + " set norelativenumber + " set number + " else + " set number + " set relativenumber + " endif + " endfunc + " nnoremap :call NumberToggle() + " autocmd WinEnter,FocusGained * :setlocal number relativenumber + " autocmd WinLeave,FocusLost * :setlocal number norelativenumber +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " THEME AND COLORS -" Theme -colorscheme railscasts + " Theme + colorscheme railscasts -" Font -set guifont=Monaco:h12 + " Font + set guifont=Monaco:h12 -" Status line + " Status line -" Search hightlighting -hi Search guibg=#585858 guifg=NONE + " Search hightlighting + hi Search guibg=#585858 guifg=NONE -" Cursors -highlight Cursor guifg=white guibg=steelblue + " Cursors + highlight Cursor guifg=white guibg=steelblue -set guicursor+=a:blinkon0 -set guicursor+=i:ver10 + set guicursor+=a:blinkon0 + set guicursor+=i:ver10 -au InsertLeave * hi Cursor guifg=white guibg=steelblue -au InsertEnter * hi Cursor guibg=grey + au InsertLeave * hi Cursor guifg=white guibg=steelblue + au InsertEnter * hi Cursor guibg=grey -" highlight CursorLine guibg=#1C1C1C -highlight CursorLineNr guibg=NONE guifg=#444444 -highlight ColorColumn ctermbg=233 guibg=#1C1C1C -highlight VertSplit guifg=#585858 -highlight SignColumn guibg=black + " highlight CursorLine guibg=#1C1C1C + highlight CursorLineNr guibg=NONE guifg=#444444 + highlight ColorColumn ctermbg=233 guibg=#1C1C1C + highlight VertSplit guifg=#585858 + highlight SignColumn guibg=black -hi MatchParen guibg=NONE guifg=green gui=bold + hi MatchParen guibg=NONE guifg=green gui=bold -highlight DiffText cterm=bold ctermfg=10 ctermbg=88 gui=none guifg=Red guibg=NONE + highlight DiffText cterm=bold ctermfg=10 ctermbg=88 gui=none guifg=Red guibg=NONE -" highlight! link DiffText MatchParen - -highlight! link DiffAdd GitGutterAdd -highlight! link DiffDelete GitGutterDelete -highlight! link DiffChange GitGutterChange + " highlight! link DiffText MatchParen + highlight! link DiffAdd GitGutterAdd + highlight! link DiffDelete GitGutterDelete + highlight! link DiffChange GitGutterChange +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " CONCEAL -set conceallevel=2 -set concealcursor=nvi + set conceallevel=2 + set concealcursor=nvi +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " MARKS -nmap ga `a - + nmap ga `a +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " QUICKFIX -nnoremap ) :cnext -nnoremap ú :cprevious - - -" PLUGINS + nnoremap ) :cnext + nnoremap ú :cprevious +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " NERDTree -function! OpenNERDTree() - "" Check if NERDTree is open - if exists("t:NERDTreeBufName") - let s:ntree = bufwinnr(t:NERDTreeBufName) - else - let s:ntree = -1 - endif - if (s:ntree != -1) - "" If NERDTree is open, close it. - :NERDTreeClose - else - :NERDTreeFind - endif -endfunction + function! OpenNERDTree() + "" Check if NERDTree is open + if exists("t:NERDTreeBufName") + let s:ntree = bufwinnr(t:NERDTreeBufName) + else + let s:ntree = -1 + endif + + if (s:ntree != -1) + "" If NERDTree is open, close it. + :NERDTreeClose + else + :NERDTreeFind + endif + endfunction -nnoremap n :call OpenNERDTree() + " Toggle NERDTree + nnoremap q :call OpenNERDTree() -let NERDTreeMinimalUI = 1 -let g:NERDTreeWinSize = 40 -let NERDTreeAutoDeleteBuffer = 1 + " Focus file in current buffer in NERDTree + nnoremap Q :NERDTreeFind -" autocmd BufEnter * if &modifiable | NERDTreeFind | wincmd p | endif + let NERDTreeMinimalUI = 1 + let g:NERDTreeWinSize = 40 + let NERDTreeAutoDeleteBuffer = 1 + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " CtrlP -let g:ctrlp_map = '' -let g:ctrlp_cmd = 'CtrlP' -if executable('ag') - let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' -endif + let g:ctrlp_map = '' + let g:ctrlp_cmd = 'CtrlP' + + if executable('ag') + let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' + endif + + let g:ctrlp_match_window = 'bottom,order:ttb' -let g:ctrlp_match_window = 'bottom,order:ttb' + " CtrlP + NERDTree integration + " When NERDTree CWD changes, CtrlP picks that up. Super cool. + let g:NERDTreeChDirMode = 2 + let g:ctrlp_working_path_mode = 'rw' -" CtrlP + NERDTree integration -" When NERDTree CWD changes, CtrlP picks that up. Super cool. -let g:NERDTreeChDirMode = 2 -let g:ctrlp_working_path_mode = 'rw' + let g:ctrlp_show_hidden = 1 +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Buffer Explorer -let g:bufExplorerShowRelativePath=1 -let g:bufExplorerSplitOutPathName=0 + let g:bufExplorerShowRelativePath=1 + let g:bufExplorerSplitOutPathName=0 + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Scratch + nnoremap :Scratch +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " vim-test -nmap R :TestNearest -nmap r :TestFile -" nmap a :TestSuite -" nmap l :TestLast + nmap R :TestNearest + nmap r :TestFile + " nmap a :TestSuite + " nmap l :TestLast -let g:test#rspec#options = '--no-color' + let g:test#ruby#rspec#options = '--no-color' +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Rainbow Parenstheses -nnoremap p :RainbowParenthesesToggle -" au VimEnter * RainbowParenthesesToggle -au Syntax * RainbowParenthesesLoadRound -au Syntax * RainbowParenthesesLoadSquare -au Syntax * RainbowParenthesesLoadBraces + nnoremap p :RainbowParenthesesToggle + " au VimEnter * RainbowParenthesesToggle + au Syntax * RainbowParenthesesLoadRound + au Syntax * RainbowParenthesesLoadSquare + au Syntax * RainbowParenthesesLoadBraces +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Syntastic -let g:syntastic_enable_signs = 0 -let g:syntastic_auto_loc_list = 1 -" Neocomplete -let g:acp_enableAtStartup = 0 + let g:syntastic_enable_signs = 0 + let g:syntastic_auto_loc_list = 1 + let g:syntastic_ruby_checkers = ['mri'] -let g:neocomplete#enable_at_startup = 1 -let g:neocomplete#force_overwrite_completefunc = 1 -let g:neocomplete#enable_smart_case = 1 +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Neocomplete -let g:neocomplete#sources#tags#cache_limit_size = 5000000 + let g:acp_enableAtStartup = 0 -let g:neosnippet#enable_snipmate_compatibility = 1 -let g:neosnippet#snippets_directory='~/.vim/snippets' + let g:neocomplete#enable_at_startup = 1 + let g:neocomplete#force_overwrite_completefunc = 1 + let g:neocomplete#enable_smart_case = 1 -imap (neosnippet_expand_or_jump) -smap (neosnippet_expand_or_jump) -xmap (neosnippet_expand_target) + let g:neocomplete#sources#tags#cache_limit_size = 5000000 -inoremap =my_cr_function() -function! s:my_cr_function() - return neocomplete#close_popup() . "\" - " For no inserting key. - "return pumvisible() ? neocomplete#close_popup() : "\" -endfunction + let g:neosnippet#enable_snipmate_compatibility = 1 + let g:neosnippet#snippets_directory='~/.vim/snippets' -let g:neocomplete#enable_refresh_always = 1 " Disable if slow -let g:neocomplete#enable_insert_char_pre = 1 + imap (neosnippet_expand_or_jump) + smap (neosnippet_expand_or_jump) + xmap (neosnippet_expand_target) -inoremap pumvisible() ? "\" : "\" + inoremap =my_cr_function() + function! s:my_cr_function() + return neocomplete#close_popup() . "\" + " For no inserting key. + "return pumvisible() ? neocomplete#close_popup() : "\" + endfunction -inoremap neocomplete#smart_close_popup()."\" -inoremap neocomplete#smart_close_popup()."\" -inoremap neocomplete#close_popup() -inoremap neocomplete#cancel_popup() + let g:neocomplete#enable_refresh_always = 1 " Disable if slow + let g:neocomplete#enable_insert_char_pre = 1 -" Neosnippet -imap neosnippet#expandable_or_jumpable() ? - \ "\(neosnippet_expand_or_jump)" - \: pumvisible() ? "\" : "\" - smap neosnippet#expandable_or_jumpable() ? - \ "\(neosnippet_expand_or_jump)" - \: "\" + inoremap pumvisible() ? "\" : "\" -" For snippet_complete marker. -if has('conceal') - set conceallevel=2 concealcursor=i -endif + inoremap neocomplete#smart_close_popup()."\" + inoremap neocomplete#smart_close_popup()."\" + inoremap neocomplete#close_popup() + inoremap neocomplete#cancel_popup() +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " EasyMotion -let g:EasyMotion_smartcase = 1 -let g:EasyMotion_move_highlight = 0 -" let g:EasyMotion_leader_key = 'e' -" map e (easymotion-prefix) + let g:EasyMotion_smartcase = 1 + let g:EasyMotion_move_highlight = 0 + " let g:EasyMotion_leader_key = 'e' + + map y (easymotion-prefix) + + " nmap F (easymotion-s) + + nmap / (easymotion-sn) + omap / (easymotion-tn) + nmap n (easymotion-next) + nmap N (easymotion-prev) -" nmap F (easymotion-s) +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" EasyAlign -nmap / (easymotion-sn) -omap / (easymotion-tn) -nmap n (easymotion-next) -nmap N (easymotion-prev) + vmap (EasyAlign) +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Fugitive.vim -:command! G Gstatus + :command! G Gstatus + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Extradite -let g:extradite_width = 80 + let g:extradite_width = 80 + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " vim-gitgutter -let g:gitgutter_sign_column_always = 1 + let g:gitgutter_sign_column_always = 1 + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Yankstack -" nmap yankstack_substitute_older_paste -" nmap yankstack_substitute_newer_paste + " nmap yankstack_substitute_older_paste + " nmap yankstack_substitute_newer_paste + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " FormatComment.vim -map gqc :call FormatComment() + map gqc :call FormatComment() + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " SplitJoin.vim -nmap S :SplitjoinJoin -nmap s :SplitjoinSplit + nmap S :SplitjoinJoin + nmap s :SplitjoinSplit + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " vim-marginal -nnoremap g :MerginalToggle + + nnoremap g :MerginalToggle + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Smartgf + + let g:smartgf_key = 'z' +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " LANGUAGES " force spell when doing a git commit @@ -641,16 +680,16 @@ autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete " Convert hashes to 1.9 syntax nmap h :%s/:\([^=,'"]*\) =>/\1:/gc -" Smartgf -let g:smartgf_key = 'z' " vim-github-dashboard let g:github_dashboard = { 'username': 'mikekreeki', 'password': $GITHUB_TOKEN } +au BufRead,BufNewFile Rakefile,Capfile,Gemfile set ft=ruby syntax=ruby + "" Rails.vim " displays <% %> correctly -autocmd User Rails let b:surround_{char2nr('-')} = "<% \r %>" +autocmd User Rails let b:surround_{char2nr('-')} = "<% \r %>" let g:rails_projections = { \ "app/serializers/*_serializer.rb": { diff --git a/.zshrc b/.zshrc index d48c4d9..9cad3c0 100644 --- a/.zshrc +++ b/.zshrc @@ -1,5 +1,9 @@ -source ~/.dotfiles/.oh-my-zsh -source ~/.dotfiles/.aliases -source ~/.dotfiles/.functions -source ~/.dotfiles/.path -source ~/.dotfiles/.custom +source ~/.dotfiles/.oh-my-zsh.zsh +source ~/.dotfiles/.aliases.zsh +source ~/.dotfiles/.colors.zsh +source ~/.dotfiles/.completion.zsh +source ~/.dotfiles/.functions.zsh +source ~/.dotfiles/.exports.zsh +source ~/.dotfiles/.setopt.zsh +source ~/.dotfiles/.custom.zsh +source ~/.dotfiles/mikekreeki.zsh-theme diff --git a/mikekreeki.zsh-theme b/mikekreeki.zsh-theme new file mode 100644 index 0000000..c650169 --- /dev/null +++ b/mikekreeki.zsh-theme @@ -0,0 +1,7 @@ +PROMPT='(%{$fg_bold[cyan]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info)) ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg_bold[yellow]%}$(work_in_progress)%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%} ~" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[yellow]%}+" +ZSH_THEME_GIT_PROMPT_CLEAN=""