Skip to content

Commit

Permalink
Merge pull request #16 from New-Bamboo/2.0
Browse files Browse the repository at this point in the history
2.0 upgrade
  • Loading branch information
Claudio Ortolina committed Dec 7, 2013
2 parents 3ae851e + 2bdc0fc commit b923b06
Show file tree
Hide file tree
Showing 50 changed files with 237 additions and 310 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
*.log
*.gz
hermes/vim/bundle
hermes/vim/spell/*.add
hermes/vim/spell/*.add.spl
hermes/bashrc.d/hermes-install-path.bash
87 changes: 0 additions & 87 deletions .gitmodules

This file was deleted.

17 changes: 17 additions & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
update
install ack
install autojump
install bash
install bash-completion
install ctags
install direnv
install git
install grc
install rbenv
install reattach-to-user-namespace
install ruby-build
install the_silver_searcher
install tmux
install tree
install vim
install wget
50 changes: 23 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,43 +269,39 @@ recalculation. This means that a manual installation may be spread
across multiple directories, resulting in a structure that is
difficult to maintain and update.

Enter [Pathogen](https://github.com/tpope/vim-pathogen), a package
Enter [Vundle](https://github.com/gmarik/vundle), a package
manager that makes this process painless and that inverts the
usual installation pattern, as it lets you organize plugins based
on their name. With Pathogen, you can simply clone a repository into
your `~/.vim` folder and you're done. This is the first stepping
stone to efficient dotfile management through a git repository
where you can add all your plugins as git submodules and update
all of them with a single command.
on their name.

Hermes uses git submodules extensively: since Pathogen allows
us to keep each plugin in a separate folder, we can include all of
our plugins as submodules in the `hermes/vim/bundle` folder. This
makes it dead easy to add other plugins and keep them up-to-date:
Vundle has been inspired by [Bundler](http://gembundler.com), the package
manager for Ruby and it uses a similar approach. Let's say that we want to add
the NerdTree plugin to our configuration, available at
<http://github.com/scrooloose/nerdtree>.

cd ~/.hermes
git submodule add <github-url> hermes/vim/bundle/<plugin-name>
We can just open `~/.vimrc`, add a single line:

And you're done! Updating plugins is similarly straightforward:
Bundle 'scrooloose/nerdtree'

cd ~/.hermes
git submodule foreach git pull origin master
And then run `:BundleInstall` as a normal mode command. Done!

Under the hood, Vundle will download the plugin, store it into `vim/bundle` and
load it into the runtime.

As in every other Github-based project, it's advisable
to fork a plugin if you need to make changes that go
beyond simple configuration (which we usually add to
`~/.hermes/vim/plugins.vim`). In that case, you would need to
remove the original submodule completely and add it back again
using your fork as the source.
Using Vundle requires just a preliminary installation (included in the Hermes
installation script) and a few lines at the top of our `~/.vimrc`:

Pathogen loads the contents of `~/.vim/bundle` by default.
including itself. This is controlled by the first two lines in the
`~/.vimrc` file:
" Options required by Vundle
set nocompatible
filetype off

" loading pathogen at runtime as it's bundled
runtime bundle/vim-pathogen/autoload/pathogen.vim
call pathogen#infect()
" Setup Vundle
set rtp+=bundle/vundle/
call vundle#rc()

Vundle is capable of searching, updating and installing other plugins and
features an interactive mode. Be sure to run `:help vundle` to learn all of
these tricks.

### Managing configuration

Expand Down
9 changes: 4 additions & 5 deletions hermes/bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ function source_modules {
unset f
}

function configure_rvm {
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
export PATH=$PATH:$HOME/.rvm/bin
function configure_rbenv {
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
}

function tmuxify_command_prompt {
Expand All @@ -40,8 +39,8 @@ export PATH=/usr/local/bin:/usr/local/sbin:$PATH

load_homebrew_command_completions
source_modules
configure_rvm
configure_rbenv
configure_editor
tmuxify_command_prompt

eval `direnv hook $0`
eval "$(direnv hook $0)"
2 changes: 1 addition & 1 deletion hermes/bashrc.d/hermes.bash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export PATH=$HOME/.hermes/bin:$PATH
export PATH=$HERMES_PATH/hermes/bin:$PATH
32 changes: 16 additions & 16 deletions hermes/bashrc.d/git-rvm.bash → hermes/bashrc.d/prompt.bash
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

function __git_dirty {
git diff --quiet HEAD &>/dev/null
[ $? == 1 ] && echo "!"
}

function __git_branch {
__git_ps1 " %s"
}

function __my_rvm_ruby_version {
local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}')
[ "$gemset" != "" ] && gemset="@$gemset"
local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}')
[ "$version" == "1.8.7" ] && version=""
local full="$version$gemset"
[ "$full" != "" ] && echo "$full "
_pwd ()
{
local PRE= NAME="$PWD" LENGTH="$1";
[[ "$NAME" != "${NAME#$HOME/}" || -z "${NAME#$HOME}" ]] &&
PRE+='~' NAME="${NAME#$HOME}" LENGTH=$[LENGTH-1];
((${#NAME}>$LENGTH)) && NAME="/...${NAME:$[${#NAME}-LENGTH+4]}";
echo "$PRE$NAME"
}

__rbenv_ps1 ()
{
rbenv_ruby_version=`rbenv version | sed -e 's/ .*//'`
printf $rbenv_ruby_version
}

bash_prompt() {
Expand Down Expand Up @@ -54,8 +53,9 @@ bash_prompt() {
local UC=$W # user's color
[ $UID -eq "0" ] && UC=$R # root's color

PS1="$C\$(__my_rvm_ruby_version)$Y\h$W:$EMY\w$EMW\$(__git_branch)$EMY\$(__git_dirty)${NONE}
$ "
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
PS1="$C\$(__rbenv_ps1) $EMY\$(_pwd 20)$EMW\$(__git_branch)${NONE} 🚀 "
}

bash_prompt
Expand Down
1 change: 0 additions & 1 deletion hermes/bashrc.d/tmux.bash

This file was deleted.

2 changes: 1 addition & 1 deletion hermes/powconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export POW_TIMEOUT=1800
export POW_WORKERS=1
export PATH=/usr/local/bin:$HOME/.rvm/bin:$PATH
export PATH=/usr/local/bin:$PATH
14 changes: 11 additions & 3 deletions hermes/tmux.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
set-option -g default-command "reattach-to-user-namespace -l $SHELL; cd ."
set -g default-terminal "screen-256color"
set -g history-limit 20000
set -g set-titles on
set -g set-titles-string "#W"

# use VI
set-window-option -g mode-keys vi

Expand Down Expand Up @@ -43,7 +46,7 @@ bind _ split-window

# Zoom
unbind z
bind z run ". ~/.hermes/hermes/tmux/zoom"
bind z resize-pane -Z

# tile all windows
unbind =
Expand Down Expand Up @@ -78,7 +81,11 @@ unbind p
bind p paste-buffer

bind -t vi-copy 'v' begin-selection
bind -t vi-copy 'y' copy-selection
bind -t vi-copy 'V' rectangle-toggle
bind -t vi-copy 'y' copy-pipe "reattach-to-user-namespace pbcopy"

unbind -t vi-copy Enter
bind -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"

set-option -g status on
set-option -g status-interval 1
Expand All @@ -92,7 +99,8 @@ set -g mouse-resize-pane on
set -g mouse-select-pane on
set-window-option -g mode-mouse on
set -g base-index 1
set -g renumber-windows on
set -s escape-time 0

# Source the hermes tmux theme
source ~/.hermes/hermes/tmux/hermes.tmux
source $HERMES_PATH/hermes/tmux/hermes.tmux
21 changes: 0 additions & 21 deletions hermes/tmux/zoom

This file was deleted.

10 changes: 8 additions & 2 deletions hermes/vim/autocommands.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@ augroup vimrcEx
au!

" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
au FileType text setlocal textwidth=78

" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
au BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
" Instead of reverting the cursor to the last position in the buffer, we
" set it to the first line when editing a git commit message
" Thanks: https://github.com/spf13/spf13-vim/blob/3.0/.vimrc#L92-L94
au FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0])
" Remove trailing whitespace before saving a file
au FileType ruby,javascript,css,scss,sass,html autocmd BufWritePre <buffer> :%s/\s\+$//e
augroup END

" Save when losing focus
Expand Down
1 change: 0 additions & 1 deletion hermes/vim/bundle/ack.vim
Submodule ack.vim deleted from 34d0b2
1 change: 0 additions & 1 deletion hermes/vim/bundle/ctrlp.vim
Submodule ctrlp.vim deleted from c1646e
1 change: 0 additions & 1 deletion hermes/vim/bundle/matchit
Submodule matchit deleted from 060d9d
1 change: 0 additions & 1 deletion hermes/vim/bundle/nerdtree
Submodule nerdtree deleted from 40d05a
1 change: 0 additions & 1 deletion hermes/vim/bundle/snipmate.vim
Submodule snipmate.vim deleted from f5a75d
1 change: 0 additions & 1 deletion hermes/vim/bundle/supertab
Submodule supertab deleted from cb8a29
1 change: 0 additions & 1 deletion hermes/vim/bundle/tComment
Submodule tComment deleted from 84af41
1 change: 0 additions & 1 deletion hermes/vim/bundle/tabular
Submodule tabular deleted from 0c856b
1 change: 0 additions & 1 deletion hermes/vim/bundle/tagbar
Submodule tagbar deleted from 852c6d
1 change: 0 additions & 1 deletion hermes/vim/bundle/vim-buffergator
Submodule vim-buffergator deleted from e3d24d
1 change: 0 additions & 1 deletion hermes/vim/bundle/vim-bundler
Submodule vim-bundler deleted from 42979d
1 change: 0 additions & 1 deletion hermes/vim/bundle/vim-coffee-script
Submodule vim-coffee-script deleted from 089506
1 change: 0 additions & 1 deletion hermes/vim/bundle/vim-cucumber
Submodule vim-cucumber deleted from 811271
1 change: 0 additions & 1 deletion hermes/vim/bundle/vim-endwise
Submodule vim-endwise deleted from fd869a
1 change: 0 additions & 1 deletion hermes/vim/bundle/vim-fugitive
Submodule vim-fugitive deleted from 6462bd
1 change: 0 additions & 1 deletion hermes/vim/bundle/vim-javascript
Submodule vim-javascript deleted from 395f89
1 change: 0 additions & 1 deletion hermes/vim/bundle/vim-markdown
Submodule vim-markdown deleted from 5ed43c
1 change: 0 additions & 1 deletion hermes/vim/bundle/vim-pathogen
Submodule vim-pathogen deleted from 12c348
1 change: 0 additions & 1 deletion hermes/vim/bundle/vim-powerline
Submodule vim-powerline deleted from 20ab08
1 change: 0 additions & 1 deletion hermes/vim/bundle/vim-rails
Submodule vim-rails deleted from 871513
1 change: 0 additions & 1 deletion hermes/vim/bundle/vim-surround
Submodule vim-surround deleted from 02199e
1 change: 0 additions & 1 deletion hermes/vim/bundle/vim-textobj-rubyblock
Submodule vim-textobj-rubyblock deleted from 97e410
1 change: 0 additions & 1 deletion hermes/vim/bundle/vim-textobj-user
Submodule vim-textobj-user deleted from 03afa6
1 change: 0 additions & 1 deletion hermes/vim/bundle/vim-turbux
Submodule vim-turbux deleted from 1903e5
1 change: 0 additions & 1 deletion hermes/vim/bundle/vim-unimpaired
Submodule vim-unimpaired deleted from 728535
1 change: 0 additions & 1 deletion hermes/vim/bundle/vimux
Submodule vimux deleted from eab15d
Loading

0 comments on commit b923b06

Please sign in to comment.