Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added gitignore gitconfig bashrc bashprofile and a new updated vimrc.

  • Loading branch information...
commit 002eeea49a46fce2dc90757067df5e3678706078 1 parent 28a0b6f
@marano authored
View
5 bash_profile
@@ -0,0 +1,5 @@
+
+[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
+
+[[ -r ~/.bashrc ]] && . ~/.bashrc
+
View
25 bashrc
@@ -0,0 +1,25 @@
+
+PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
+
+alias ctags="`brew --prefix`/bin/ctags"
+alias sg="shotgun -p 3000"
+
+export PATH=$PATH:~/heroku-client/bin
+
+# Awesome terminal happy face
+export PS1='$( [[ ${?#0} = "" ]] && echo ":) " || echo ":( " )'
+
+# Unbreak broken, non-colored terminal
+export TERM='xterm-color'
+alias ls='ls -G'
+alias ll='ls -lG'
+export LSCOLORS="ExGxBxDxCxEgEdxbxgxcxd"
+export GREP_OPTIONS="--color"
+
+# Erase duplicates in history
+export HISTCONTROL=erasedups
+# Store 10k history entries
+export HISTSIZE=10000
+# Append to the history file when exiting instead of overwriting it
+shopt -s histappend
+
View
20 gitconfig
@@ -0,0 +1,20 @@
+[user]
+ name = marano
+ email = thiagomarano@gmail.com
+[core]
+ editor = /usr/bin/vim
+ excludesfile = ~/.gitignore
+[color]
+ ui = auto
+[github]
+ user = marano
+[merge]
+ tool = vimdiff
+[alias]
+ st = status
+ ci = commit
+ co = checkout
+ di = diff
+ dc = diff --cached
+ amend = commit --amend
+ aa = add --all
View
3  gitignore
@@ -0,0 +1,3 @@
+*.swp
+*.DS_Store
+*~
View
8 make_links.sh
@@ -1,4 +1,8 @@
#!/bin/sh
-ln -Fs vimrc ~/.vimrc
-ln -Fs tmux.conf ~/.tmux.conf
+ln -Ff vimrc ~/.vimrc
+ln -Ff tmux.conf ~/.tmux.conf
+ln -Ff gitconfig ~/.gitconfig
+ln -Ff gitignore ~/.gitignore
+ln -Ff bash_profile ~/.bash_profile
+ln -Ff bashrc ~/.bashrc
View
275 vimrc
@@ -13,13 +13,23 @@ Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-repeat'
Bundle 'git://git.wincent.com/command-t.git'
Bundle 'digitaltoad/vim-jade'
+Bundle 'slim-template/vim-slim'
+Bundle 'groenewege/vim-less'
-set hlsearch
set hidden
+set expandtab
set tabstop=2
set shiftwidth=2
-set expandtab
+set softtabstop=2
+set autoindent
+set laststatus=2
+set showmatch
+set incsearch
+set hlsearch
+set cursorline
+set number
+set textwidth=79
filetype plugin indent on " required for Vundle
@@ -29,3 +39,264 @@ set background=dark
colorscheme solarized
au BufRead,BufNewFile *.md set filetype=markdown
+
+" Copied from https://github.com/garybernhardt/dotfiles/blob/master/.vimrc
+
+let mapleader=","
+
+" Fix slow O inserts
+:set timeout timeoutlen=1000 ttimeoutlen=100
+
+" Prevent Vim from clobbering the scrollback buffer. See
+" http://www.shallowsky.com/linux/noaltscreen.html
+set t_ti= t_te=
+
+" make searches case-sensitive only if they contain upper-case characters
+set ignorecase smartcase
+
+set history=10000
+
+" Store temporary files in a central spot
+set backup
+set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
+set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
+
+" allow backspacing over everything in insert mode
+set backspace=indent,eol,start
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" OPEN FILES IN DIRECTORY OF CURRENT FILE
+" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+cnoremap %% <C-R>=expand('%:h').'/'<cr>
+map <leader>e :edit %%
+map <leader>v :view %%
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" MISC KEY MAPS
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+" Clear the search buffer when hitting return
+function! MapCR()
+ nnoremap <cr> :nohlsearch<cr>
+endfunction
+call MapCR()
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" MULTIPURPOSE TAB KEY
+" Indent if we're at the beginning of a line. Else, do completion.
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+function! InsertTabWrapper()
+ let col = col('.') - 1
+ if !col || getline('.')[col - 1] !~ '\k'
+ return "\<tab>"
+ else
+ return "\<c-p>"
+ endif
+endfunction
+inoremap <tab> <c-r>=InsertTabWrapper()<cr>
+inoremap <s-tab> <c-n>
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" RENAME CURRENT FILE
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+function! RenameFile()
+ let old_name = expand('%')
+ let new_name = input('New file name: ', expand('%'), 'file')
+ if new_name != '' && new_name != old_name
+ exec ':saveas ' . new_name
+ exec ':silent !rm ' . old_name
+ redraw!
+ endif
+endfunction
+map <leader>n :call RenameFile()<cr>
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" EXTRACT VARIABLE (SKETCHY)
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+function! ExtractVariable()
+ let name = input("Variable name: ")
+ if name == ''
+ return
+ endif
+ " Enter visual mode (not sure why this is needed since we're already in
+ " visual mode anyway)
+ normal! gv
+
+ " Replace selected text with the variable name
+ exec "normal c" . name
+ " Define the variable on the line above
+ exec "normal! O" . name . " = "
+ " Paste the original selected text to be the variable value
+ normal! $p
+endfunction
+vnoremap <leader>rv :call ExtractVariable()<cr>
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" INLINE VARIABLE (SKETCHY)
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+function! InlineVariable()
+ " Copy the variable under the cursor into the 'a' register
+ :let l:tmp_a = @a
+ :normal "ayiw
+ " Delete variable and equals sign
+ :normal 2daW
+ " Delete the expression into the 'b' register
+ :let l:tmp_b = @b
+ :normal "bd$
+ " Delete the remnants of the line
+ :normal dd
+ " Go to the end of the previous line so we can start our search for the
+ " usage of the variable to replace. Doing '0' instead of 'k$' doesn't
+ " work; I'm not sure why.
+ normal k$
+ " Find the next occurence of the variable
+ exec '/\<' . @a . '\>'
+ " Replace that occurence with the text we yanked
+ exec ':.s/\<' . @a . '\>/' . @b
+ :let @a = l:tmp_a
+ :let @b = l:tmp_b
+endfunction
+nnoremap <leader>ri :call InlineVariable()<cr>
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" MAPS TO JUMP TO SPECIFIC COMMAND-T TARGETS AND FILES
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+map <leader>gr :topleft :split config/routes.rb<cr>
+function! ShowRoutes()
+ " Requires 'scratch' plugin
+ :topleft 100 :split __Routes__
+ " Make sure Vim doesn't write __Routes__ as a file
+ :set buftype=nofile
+ " Delete everything
+ :normal 1GdG
+ " Put routes output in buffer
+ :0r! bundle exec rake -s routes
+ " Size window to number of lines (1 plus rake output length)
+ :exec ":normal " . line("$") . _ "
+ " Move cursor to bottom
+ :normal 1GG
+ " Delete empty trailing line
+ :normal dd
+endfunction
+map <leader>gR :call ShowRoutes()<cr>
+map <leader>gv :CommandTFlush<cr>\|:CommandT app/views<cr>
+map <leader>gc :CommandTFlush<cr>\|:CommandT app/controllers<cr>
+map <leader>gm :CommandTFlush<cr>\|:CommandT app/models<cr>
+map <leader>gh :CommandTFlush<cr>\|:CommandT app/helpers<cr>
+map <leader>gl :CommandTFlush<cr>\|:CommandT lib<cr>
+map <leader>gp :CommandTFlush<cr>\|:CommandT public<cr>
+map <leader>gs :CommandTFlush<cr>\|:CommandT public/stylesheets<cr>
+map <leader>gf :CommandTFlush<cr>\|:CommandT features<cr>
+map <leader>gg :topleft 100 :split Gemfile<cr>
+map <leader>gt :CommandTFlush<cr>\|:CommandTTag<cr>
+map <leader>f :CommandTFlush<cr>\|:CommandT<cr>
+map <leader>F :CommandTFlush<cr>\|:CommandT %%<cr>
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" SWITCH BETWEEN TEST AND PRODUCTION CODE
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+function! OpenTestAlternate()
+ let new_file = AlternateForCurrentFile()
+ exec ':e ' . new_file
+endfunction
+function! AlternateForCurrentFile()
+ let current_file = expand("%")
+ let new_file = current_file
+ let in_spec = match(current_file, '^spec/') != -1
+ let going_to_spec = !in_spec
+ let in_app = match(current_file, '\<controllers\>') != -1 || match(current_file, '\<models\>') != -1 || match(current_file, '\<views\>') != -1 || match(current_file, '\<helpers\>') != -1
+ if going_to_spec
+ if in_app
+ let new_file = substitute(new_file, '^app/', '', '')
+ end
+ let new_file = substitute(new_file, '\.rb$', '_spec.rb', '')
+ let new_file = 'spec/' . new_file
+ else
+ let new_file = substitute(new_file, '_spec\.rb$', '.rb', '')
+ let new_file = substitute(new_file, '^spec/', '', '')
+ if in_app
+ let new_file = 'app/' . new_file
+ end
+ endif
+ return new_file
+endfunction
+nnoremap <leader>. :call OpenTestAlternate()<cr>
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" RUNNING TESTS
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+map <leader>t :call RunTestFile()<cr>
+map <leader>T :call RunNearestTest()<cr>
+map <leader>a :call RunTests('')<cr>
+map <leader>c :w\|:!script/features<cr>
+map <leader>w :w\|:!script/features --profile wip<cr>
+
+function! RunTestFile(...)
+ if a:0
+ let command_suffix = a:1
+ else
+ let command_suffix = ""
+ endif
+
+ " Run the tests for the previously-marked file.
+ let in_test_file = match(expand("%"), '\(.feature\|_spec.rb\)$') != -1
+ if in_test_file
+ call SetTestFile()
+ elseif !exists("t:grb_test_file")
+ return
+ end
+ call RunTests(t:grb_test_file . command_suffix)
+endfunction
+
+function! RunNearestTest()
+ let spec_line_number = line('.')
+ call RunTestFile(":" . spec_line_number . " -b")
+endfunction
+
+function! SetTestFile()
+ " Set the spec file that tests will be run for.
+ let t:grb_test_file=@%
+endfunction
+
+function! RunTests(filename)
+ " Write the file and run tests for the given filename
+ :w
+ :silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo
+ :silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo
+ :silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo
+ :silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo
+ :silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo
+ :silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo
+ if match(a:filename, '\.feature$') != -1
+ exec ":!script/features " . a:filename
+ else
+ if filereadable("script/test")
+ exec ":!script/test " . a:filename
+ elseif filereadable("Gemfile")
+ exec ":!bundle exec rspec --color " . a:filename
+ else
+ exec ":!rspec --color " . a:filename
+ end
+ end
+endfunction
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" OpenChangedFiles COMMAND
+" Open a split for each dirty file in git
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+function! OpenChangedFiles()
+ only " Close all windows, unless they're modified
+ let status = system('git status -s | grep "^ \?\(M\|A\|UU\)" | sed "s/^.\{3\}//"')
+ let filenames = split(status, "\n")
+ exec "edit " . filenames[0]
+ for filename in filenames[1:]
+ exec "sp " . filename
+ endfor
+endfunction
+command! OpenChangedFiles :call OpenChangedFiles()
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" InsertTime COMMAND
+" Insert the current time
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+command! InsertTime :normal a<c-r>=strftime('%F %H:%M:%S.0 %z')<cr>
Please sign in to comment.
Something went wrong with that request. Please try again.