From 6723ec056282f4d2d66d214c921111f57fa48035 Mon Sep 17 00:00:00 2001 From: CassioMarques Date: Sat, 10 Jan 2009 11:47:31 -0200 Subject: [PATCH] Added some snippets for Factory-Girl, browse Rails docs from ApiDock, small changes to .vimrc --- after/plugin/snippets.vim | 2 ++ snippets/ruby-factorygirl/facd.snippet | 4 ++++ snippets/ruby-factorygirl/facn.snippet | 1 + snippets/ruby-factorygirl/facs.snippet | 4 ++++ vimrc | 21 ++++++++++++--------- 5 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 snippets/ruby-factorygirl/facd.snippet create mode 100644 snippets/ruby-factorygirl/facn.snippet create mode 100644 snippets/ruby-factorygirl/facs.snippet diff --git a/after/plugin/snippets.vim b/after/plugin/snippets.vim index d501e7be6..e2b8f326a 100644 --- a/after/plugin/snippets.vim +++ b/after/plugin/snippets.vim @@ -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 diff --git a/snippets/ruby-factorygirl/facd.snippet b/snippets/ruby-factorygirl/facd.snippet new file mode 100644 index 000000000..43c3fe4c9 --- /dev/null +++ b/snippets/ruby-factorygirl/facd.snippet @@ -0,0 +1,4 @@ +Factory.define(:<+model+>) do |<+m+>| + <++> +end +<++> diff --git a/snippets/ruby-factorygirl/facn.snippet b/snippets/ruby-factorygirl/facn.snippet new file mode 100644 index 000000000..df8d62cce --- /dev/null +++ b/snippets/ruby-factorygirl/facn.snippet @@ -0,0 +1 @@ +Factory.next(:<+sequence-name+>)<++> diff --git a/snippets/ruby-factorygirl/facs.snippet b/snippets/ruby-factorygirl/facs.snippet new file mode 100644 index 000000000..a8499d8b3 --- /dev/null +++ b/snippets/ruby-factorygirl/facs.snippet @@ -0,0 +1,4 @@ +Factory.sequence :<+sequence-name+> do |<+m+>| + <++> +end +<++> diff --git a/vimrc b/vimrc index 04aa17c33..ad4994375 100644 --- a/vimrc +++ b/vimrc @@ -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 @@ -101,7 +101,6 @@ inoremap :nohls nnoremap :BufExplorer "map to fuzzy finder text mate stylez -"nnoremap :FuzzyFinderMruFile nnoremap :FuzzyFinderTextMate "map Q to something useful @@ -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() @@ -261,9 +260,6 @@ vnoremap " CTRL-Z undoes even in visual/selection mode vnoremap -" Copy selected lines to the system clipboard -vmap y: call system("xclip -i -selection clipboard", getreg("\"")) - " Run Rspec for the current spec file function! RunRspec() ruby << EOF @@ -276,10 +272,17 @@ EOF endfunction map :call RunRspec() -" 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('')) + +" 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(''))