Skip to content

Commit

Permalink
Added some snippets for Factory-Girl, browse Rails docs from ApiDock,…
Browse files Browse the repository at this point in the history
… small changes to .vimrc
  • Loading branch information
cassiomarques committed Jan 10, 2009
1 parent 85a3c87 commit 6723ec0
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
2 changes: 2 additions & 0 deletions after/plugin/snippets.vim
Expand Up @@ -55,6 +55,8 @@ endfunction
if s:inRailsEnv()
call NERDSnippetsFromDirectoryForFiletype('~/.vim/snippets/ruby-rails', 'ruby')
call NERDSnippetsFromDirectoryForFiletype('~/.vim/snippets/ruby-rspec', 'ruby')
" create factory-girl snippets
call NERDSnippetsFromDirectoryForFiletype('~/.vim/snippets/ruby-factorygirl', 'ruby')
else
"create merb snippets
endif
Expand Down
4 changes: 4 additions & 0 deletions snippets/ruby-factorygirl/facd.snippet
@@ -0,0 +1,4 @@
Factory.define(:<+model+>) do |<+m+>|
<++>
end
<++>
1 change: 1 addition & 0 deletions snippets/ruby-factorygirl/facn.snippet
@@ -0,0 +1 @@
Factory.next(:<+sequence-name+>)<++>
4 changes: 4 additions & 0 deletions snippets/ruby-factorygirl/facs.snippet
@@ -0,0 +1,4 @@
Factory.sequence :<+sequence-name+> do |<+m+>|
<++>
end
<++>
21 changes: 12 additions & 9 deletions vimrc
Expand Up @@ -67,15 +67,15 @@ if has("gui_running")
set columns=115
else
let g:CSApprox_loaded = 0
colorscheme desert
endif

colorscheme railscasts

if $COLORTERM == 'gnome-terminal'
set term=gnome-256color
colorscheme railscasts
colorscheme desert
else
colorscheme default
colorscheme desert
endif

syntax on " Enable syntax highlighting
Expand All @@ -101,7 +101,6 @@ inoremap <C-L> <C-O>:nohls<CR>
nnoremap <C-B> :BufExplorer<cr>
"map to fuzzy finder text mate stylez
"nnoremap <c-f> :FuzzyFinderMruFile<CR>
nnoremap <c-f> :FuzzyFinderTextMate<CR>
"map Q to something useful
Expand Down Expand Up @@ -178,7 +177,7 @@ set laststatus=2 " Always show status line.

" gvim specific
set mousehide " Hide mouse after chars typed
set mouse=a " Mouse in all modes
"set mouse=a " Mouse in all modes

"visual search mappings
function! s:VSetSearch()
Expand Down Expand Up @@ -261,9 +260,6 @@ vnoremap <C-D> <LT>
" CTRL-Z undoes even in visual/selection mode
vnoremap <C-Z> <C-C>
" Copy selected lines to the system clipboard
vmap <C-c> y: call system("xclip -i -selection clipboard", getreg("\""))<CR>
" Run Rspec for the current spec file
function! RunRspec()
ruby << EOF
Expand All @@ -276,10 +272,17 @@ EOF
endfunction
map <F7> :call RunRspec()<cr>
" Open the Ruby ApiDock page for the word under cursor, in a new Firefox tab
let g:browser = 'firefox -new-tab '
" Open the Ruby ApiDock page for the word under cursor, in a new Firefox tab
function! OpenRubyDoc(keyword)
let url = 'http://apidock.com/ruby/'.a:keyword
exec '!'.g:browser.' '.url.' &'
endfunction
noremap RB :call OpenRubyDoc(expand('<cword>'))<CR>
" Open the Rails ApiDock page for the word under cursos, in a new Firefox tab
function! OpenRailsDoc(keyword)
let url = 'http://apidock.com/rails/'.a:keyword
exec '!'.g:browser.' '.url.' &'
endfunction
noremap RR :call OpenRailsDoc(expand('<cword>'))<CR>

0 comments on commit 6723ec0

Please sign in to comment.