Skip to content
Browse files

vundle

  • Loading branch information...
1 parent 7ffd524 commit 70e7cb420d4a38a01ad8445891f4e77836e2c142 Timo Göllner committed Feb 2, 2012
Showing with 181 additions and 8,687 deletions.
  1. +2 −6 .netrwhist
  2. +142 −0 autoload/pathogen.vim
  3. +0 −4,744 autoload/rails.vim
  4. +1 −0 bundle/vim-bundler
  5. +1 −0 bundle/vim-fugitive
  6. +1 −0 bundle/vim-rails
  7. +1 −0 bundle/vim-rake
  8. +1 −0 bundle/vim-ruby-doc
  9. +1 −0 bundle/vim-rvm
  10. +1 −0 bundle/vundle
  11. +0 −226 doc/fugitive.txt
  12. +0 −1,134 doc/rails.txt
  13. +0 −10 macros/rails.vim
  14. +0 −466 plugin/ColorSchemeMenuMaker.vim
  15. +0 −1,761 plugin/fugitive.vim
  16. +0 −340 plugin/rails.vim
  17. +30 −0 vimrc.local
View
8 .netrwhist
@@ -1,7 +1,3 @@
let g:netrw_dirhistmax =10
-let g:netrw_dirhist_cnt =5
-let g:netrw_dirhist_1='/home/timo/.rvm/gems/ree-1.8.7-2010.01@intern/gems/shoulda-2.11.3'
-let g:netrw_dirhist_2='/home/timo/.rvm/gems/ree-1.8.7-2010.01@newsletter/gems/shoulda-2.11.3'
-let g:netrw_dirhist_3='/home/timo/.rvm/gems/ree-1.8.7-2010.01@newsletter/gems/digineo-billing-0.1.9'
-let g:netrw_dirhist_4='/home/timo/.rvm/gems/ruby-1.9.2-p0@ootb/gems/rails-3.0.1'
-let g:netrw_dirhist_5='/home/timo/.rvm/gems/ruby-1.9.2-p0@ootb/gems/actionpack-3.0.1'
+let g:netrw_dirhist_cnt =1
+let g:netrw_dirhist_1='/home/timo/.rvm/gems/ruby-1.9.2-p290@magistrix/gems/actionpack-3.0.11'
View
142 autoload/pathogen.vim
@@ -0,0 +1,142 @@
+" pathogen.vim - path option manipulation
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" Version: 1.3
+
+" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
+"
+" API is documented below.
+
+if exists("g:loaded_pathogen") || &cp
+ finish
+endif
+let g:loaded_pathogen = 1
+
+" Split a path into a list.
+function! pathogen#split(path) abort " {{{1
+ if type(a:path) == type([]) | return a:path | endif
+ let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
+ return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
+endfunction " }}}1
+
+" Convert a list to a path.
+function! pathogen#join(...) abort " {{{1
+ if type(a:1) == type(1) && a:1
+ let i = 1
+ let space = ' '
+ else
+ let i = 0
+ let space = ''
+ endif
+ let path = ""
+ while i < a:0
+ if type(a:000[i]) == type([])
+ let list = a:000[i]
+ let j = 0
+ while j < len(list)
+ let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
+ let path .= ',' . escaped
+ let j += 1
+ endwhile
+ else
+ let path .= "," . a:000[i]
+ endif
+ let i += 1
+ endwhile
+ return substitute(path,'^,','','')
+endfunction " }}}1
+
+" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
+function! pathogen#legacyjoin(...) abort " {{{1
+ return call('pathogen#join',[1] + a:000)
+endfunction " }}}1
+
+" Remove duplicates from a list.
+function! pathogen#uniq(list) abort " {{{1
+ let i = 0
+ let seen = {}
+ while i < len(a:list)
+ if has_key(seen,a:list[i])
+ call remove(a:list,i)
+ else
+ let seen[a:list[i]] = 1
+ let i += 1
+ endif
+ endwhile
+ return a:list
+endfunction " }}}1
+
+" \ on Windows unless shellslash is set, / everywhere else.
+function! pathogen#separator() abort " {{{1
+ return !exists("+shellslash") || &shellslash ? '/' : '\'
+endfunction " }}}1
+
+" Convenience wrapper around glob() which returns a list.
+function! pathogen#glob(pattern) abort " {{{1
+ let files = split(glob(a:pattern),"\n")
+ return map(files,'substitute(v:val,"[".pathogen#separator()."/]$","","")')
+endfunction "}}}1
+
+" Like pathogen#glob(), only limit the results to directories.
+function! pathogen#glob_directories(pattern) abort " {{{1
+ return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
+endfunction "}}}1
+
+" Checks if a bundle is 'disabled'. A bundle is considered 'disabled' if
+" its 'basename()' is included in g:pathogen_disabled[]'.
+function! pathogen#is_disabled(path) " {{{1
+ if !exists("g:pathogen_disabled")
+ return 0
+ endif
+ let sep = pathogen#separator()
+ return index(g:pathogen_disabled, strpart(a:path, strridx(a:path, sep)+1)) != -1
+endfunction "}}}1
+
+" Prepend all subdirectories of path to the rtp, and append all 'after'
+" directories in those subdirectories.
+function! pathogen#runtime_prepend_subdirectories(path) " {{{1
+ let sep = pathogen#separator()
+ let before = filter(pathogen#glob_directories(a:path.sep."*[^~]"), '!pathogen#is_disabled(v:val)')
+ let after = filter(pathogen#glob_directories(a:path.sep."*[^~]".sep."after"), '!pathogen#is_disabled(v:val[0:-7])')
+ let rtp = pathogen#split(&rtp)
+ let path = expand(a:path)
+ call filter(rtp,'v:val[0:strlen(path)-1] !=# path')
+ let &rtp = pathogen#join(pathogen#uniq(before + rtp + after))
+ return &rtp
+endfunction " }}}1
+
+" For each directory in rtp, check for a subdirectory named dir. If it
+" exists, add all subdirectories of that subdirectory to the rtp, immediately
+" after the original directory. If no argument is given, 'bundle' is used.
+" Repeated calls with the same arguments are ignored.
+function! pathogen#runtime_append_all_bundles(...) " {{{1
+ let sep = pathogen#separator()
+ let name = a:0 ? a:1 : 'bundle'
+ if "\n".s:done_bundles =~# "\\M\n".name."\n"
+ return ""
+ endif
+ let s:done_bundles .= name . "\n"
+ let list = []
+ for dir in pathogen#split(&rtp)
+ if dir =~# '\<after$'
+ let list += filter(pathogen#glob_directories(substitute(dir,'after$',name,'').sep.'*[^~]'.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])') + [dir]
+ else
+ let list += [dir] + filter(pathogen#glob_directories(dir.sep.name.sep.'*[^~]'), '!pathogen#is_disabled(v:val)')
+ endif
+ endfor
+ let &rtp = pathogen#join(pathogen#uniq(list))
+ return 1
+endfunction
+
+let s:done_bundles = ''
+" }}}1
+
+" Invoke :helptags on all non-$VIM doc directories in runtimepath.
+function! pathogen#helptags() " {{{1
+ for dir in pathogen#split(&rtp)
+ if dir[0 : strlen($VIM)-1] !=# $VIM && isdirectory(dir.'/doc') && !empty(glob(dir.'/doc/*')) && (!filereadable(dir.'/doc/tags') || filewritable(dir.'/doc/tags'))
+ helptags `=dir.'/doc'`
+ endif
+ endfor
+endfunction " }}}1
+
+" vim:set ft=vim ts=8 sw=2 sts=2:
View
4,744 autoload/rails.vim
0 additions, 4,744 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
1 bundle/vim-bundler
@@ -0,0 +1 @@
+Subproject commit 0faf7670a5412fb5fa9b61e15f48c1276753de29
1 bundle/vim-fugitive
@@ -0,0 +1 @@
+Subproject commit 64716b9622e5c3fae0caec7e9589988a9da146cb
1 bundle/vim-rails
@@ -0,0 +1 @@
+Subproject commit 1599eecc7105971409d041e5acfe0fa85b23a097
1 bundle/vim-rake
@@ -0,0 +1 @@
+Subproject commit 8bccbe434e0c79c09523e5ebd062c64ec06604e4
1 bundle/vim-ruby-doc
@@ -0,0 +1 @@
+Subproject commit a77ff244575631a5ebe1d8bfbb4f96b94d9cac27
1 bundle/vim-rvm
@@ -0,0 +1 @@
+Subproject commit d53dfd8d320e47f628a94359adb6a185deb53356
1 bundle/vundle
@@ -0,0 +1 @@
+Subproject commit c9d81623c33febf0111de9df3d2065c56803a549
View
226 doc/fugitive.txt
@@ -1,226 +0,0 @@
-*fugitive.txt* A Git wrapper so awesome, it should be illegal
-
-Author: Tim Pope <vimNOSPAM@tpope.org> *fugitive-author*
-License: Same terms as Vim itself (see |license|)
-
-This plugin is only available if 'compatible' is not set.
-
-INTRODUCTION *fugitive*
-
-Install in ~/.vim, or in ~\vimfiles if you're on Windows and feeling lucky.
-Vim 7.2 is recommended as it ships with syntax highlighting for many Git file
-types.
-
-If you're in a hurry to get started, here are some things to try:
-
-In any file in your repository, run |:Gedit| HEAD. Press <CR> to jump to the
-current branch. Press <CR> again to jump to the top most commit. Keep using
-<CR> to explore parent commits, trees, and blobs. Use C in a tree or blob to
-get back to the commit.
-
-Edit a file in the work tree and make some changes. Use |:Gdiff| to open up
-the indexed version. Use |do| and |dp| on various hunks to bring the files in
-sync, or use |:Gread| to pull in all changes. Write the indexed version to
-stage the file.
-
-Run |:Gstatus| to check your repository's status. Use "-" to stage and reset
-files and "p" to add/reset --patch them. Invoke |:Gcommit| to commit your
-changes.
-
-Run |:Gblame| in a work tree file to see a blame in a vertical split. Press
-<CR> on any line to reopen and reblame that file as it stood in that commit.
-Press o or O on any line to inspect that commit in a split or a tab.
-
-Run |:Ggrep| to search the work tree or history. Run |:Gmove| to rename a
-file. Run |:Gremove| to delete a file.
-
-COMMANDS *fugitive-commands*
-
-These commands are local to the buffers in which they work (generally, buffers
-that are part of Git repositories).
-
- *fugitive-:Git*
-:Git [args] Run an arbitrary git command. Similar to :!git [args]
- but chdir to the repository tree first.
-
- *fugitive-:Gcd*
-:Gcd [directory] |:cd| relative to the repository.
-
- *fugitive-:Glcd*
-:Glcd [directory] |:lcd| relative to the repository.
-
- *fugitive-:Gstatus*
-:Gstatus Bring up the output of git-status in the preview
- window. In addition to standard motions, you can
- use <C-N> and <C-P> to jump from filename to
- filename. Press D to |:Gdiff| the file on the cursor
- line, or dh to |:Gdiff!|. Press - to stage or unstage
- the file on the cursor line. Press p to do so on a
- per hunk basis (--patch). Press C to invoke
- |:Gcommit|.
-
- *fugitive-:Gcommit*
-:Gcommit [args] A wrapper around git-commit. If there is nothing
- to commit, |:Gstatus| is called instead. Unless the
- arguments given would skip the invocation of an editor
- (e.g., -m), a split window will be used to obtain a
- commit message. Write and close that window (:wq or
- |:Gwrite|) to finish the commit. Unlike when running
- the actual git-commit command, it is possible (but
- unadvisable) to muck with the index with commands like
- git-add and git-reset while a commit message is
- pending.
-
- *fugitive-:Ggrep*
-:Ggrep [args] |:grep| with git-grep as 'grepprg'.
-
- *fugitive-:Glog*
-:Glog [args] Load all previous revisions of the current file into
- the quickfix list. Additional git-log arguments can
- be given (for example, --reverse). If "--" appears as
- an argument, no file specific filtering is done, and
- commits are loaded into the quickfix list.
-
- *fugitive-:Gedit* *fugitive-:Ge*
-:Gedit [revision] |:edit| a |fugitive-revision|.
-
- *fugitive-:Gsplit*
-:Gsplit [revision] |:split| a |fugitive-revision|.
-
- *fugitive-:Gvsplit*
-:Gvsplit [revision] |:vsplit| a |fugitive-revision|.
-
- *fugitive-:Gtabedit*
-:Gtabedit [revision] |:tabedit| a |fugitive-revision|
-
- *fugitive-:Gpedit*
-:Gpedit [revision] |:pedit| a |fugitive-revision|
-
- *fugitive-:Gread*
-:Gread [revision] Empty the buffer and |:read| a |fugitive-revision|.
- When the argument is omitted, this is similar to
- git-checkout on a work tree file or git-add on a stage
- file, but without writing anything to disk.
-
-:{range}Gread [revision]
- |:read| in a |fugitive-revision| after {range}.
-
- *fugitive-:Gread!*
-:Gread! [revision] Deprecated synonym for |:Gread|.
-
- *fugitive-:Gwrite*
-:Gwrite Write to the current file's path and stage the results.
- When run in a work tree file, it is effectively git
- add. Elsewhere, it is effectively git-checkout. A
- great deal of effort is expended to behave sensibly
- when the work tree or index version of the file is
- open in another buffer.
-
-:Gwrite {path} You can give |:Gwrite| an explicit path of where in
- the work tree to write. You can also give a path like
- :0:foo.txt or even :0 to write to just that stage in
- the index.
-
- *fugitive-:Gdiff*
-:Gdiff [revision] Perform a |vimdiff| against the current file in the
- given revision. With no argument, the version in the
- index is used (which means a three-way diff during a
- merge conflict, making it a git-mergetool
- alternative). The newer of the two files is placed
- to the right. Use |do| and |dp| and write to the
- index file to simulate "git add --patch".
-
- *fugitive-:Gdiff!*
-:Gdiff! [revision] Like |:Gdiff|, but split horizontally.
-
- *fugitive-:Gmove*
-:Gmove {destination} Wrapper around git-mv that renames the buffer
- afterward. The destination is relative to the current
- directory except when started with a /, in which case
- it is relative to the work tree. Add a ! to pass -f.
-
- *fugitive-:Gremove*
-:Gremove Wrapper around git-rm that deletes the buffer
- afterward. When invoked in an index file, --cached is
- passed. Add a ! to pass -f and forcefully discard the
- buffer.
-
- *fugitive-:Gblame*
-:Gblame [flags] Run git-blame on the file and open the results in a
- scroll bound vertical split. Press enter on a line to
- reblame the file as it was in that commit. You can
- give any of ltwfsMC as flags and they will be passed
- along to git-blame.
-
-:[range]Gblame [flags] Run git-blame on the given range.
-
-MAPPINGS *fugitive-mappings*
-
-These maps are available in Git objects.
-
- *fugitive-<CR>*
-<CR> Jump to the revision under the cursor.
-
- *fugitive-o*
-o Jump to the revision under the cursor in a new split.
-
- *fugitive-O*
-O Jump to the revision under the cursor in a new tab.
-
- *fugitive-~*
-~ Go to the current file in the [count]th first
- ancestor.
-
- *fugitive-P*
-P Go to the current file in the [count]th parent.
-
- *fugitive-C*
-C Go to the commit containing the current file.
-
- *fugitive-a*
-a Show the current tag, commit, or tree in an alternate
- format.
-
-SPECIFYING REVISIONS *fugitive-revision*
-
-Fugitive revisions are similar to Git revisions as defined in the "SPECIFYING
-REVISIONS" section in the git-rev-parse man page. For commands that accept an
-optional revision, the default is the file in the index for work tree files
-and the work tree file for everything else. Example revisions follow.
-
-Revision Meaning ~
-HEAD .git/HEAD
-master .git/refs/heads/master
-HEAD^{} The commit referenced by HEAD
-HEAD^ The parent of the commit referenced by HEAD
-HEAD: The tree referenced by HEAD
-/HEAD The file named HEAD in the work tree
-Makefile The file named Makefile in the work tree
-HEAD^:Makefile The file named Makefile in the parent of HEAD
-:Makefile The file named Makefile in the index (writable)
-- The current file in HEAD
-^ The current file in the previous commit
-~3 The current file 3 commits ago
-: .git/index (Same as |:Gstatus|)
-:0 The current file in the index
-:1 The current file's common ancestor during a conflict
-:2 The current file in the target branch during a conflict
-:3 The current file in the merged branch during a conflict
-:/foo The most recent commit with "foo" in the message
-
-STATUSLINE *fugitive-statusline*
-
- *fugitive#statusline()*
-Add %{fugitive#statusline()} to your statusline to get an indicator including
-the current branch and the currently edited file's commit. If you don't have
-a statusline, this one matches the default when 'ruler' is set:
->
- set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
-<
-ABOUT *fugitive-about*
-
-Grab the latest version or report a bug on GitHub:
-
-http://github.com/tpope/vim-fugitive
-
- vim:tw=78:et:ft=help:norl:
View
1,134 doc/rails.txt
@@ -1,1134 +0,0 @@
-*rails.txt* Plugin for working with Ruby on Rails applications
-
-Author: Tim Pope <vimNOSPAM@tpope.org> |rails-plugin-author|
-
-|rails-introduction| Introduction and Feature Summary
-|rails-installation| Installation and Usage
-|rails-configure-vim| Configuring Vim
-|rails-install-plugin| Installing and Using the Plugin
-|rails-commands| General Commands
-|rails-navigation| Navigation
-|rails-gf| File Under Cursor - gf
-|rails-alternate-related| Alternate and Related Files
-|rails-type-navigation| File Type Commands
-|rails-custom-navigation| Custom Navigation Commands
-|rails-rake| Rake
-|rails-scripts| Script Wrappers
-|rails-refactoring| Refactoring Helpers
-|rails-partials| Partial Extraction
-|rails-migrations| Migration Inversion
-|rails-integration| Integration
-|rails-vim-integration| Integration with the Vim Universe
-|rails-rails-integration| Integration with the Rails Universe
-|rails-abbreviations| Abbreviations
-|rails-syntax| Syntax Highlighting
-|rails-options| Managed Vim Options
-|rails-configuration| Configuration
-|rails-global-settings| Global Settings
-|rails-about| About rails.vim
-|rails-license| License
-
-This plugin is only available if 'compatible' is not set.
-
-{Vi does not have any of this}
-
-INTRODUCTION *rails-introduction* *rails*
-
-TextMate may be the latest craze for developing Ruby on Rails applications,
-but Vim is forever. This plugin offers the following features for Ruby on
-Rails application development.
-
-1. Automatically detects buffers containing files from Rails applications,
- and applies settings to those buffers (and only those buffers). You can
- use an autocommand to apply your own custom settings as well.
- |rails-configuration|
-
-2. Unintrusive. Only files in a Rails application should be affected; regular
- Ruby scripts are left untouched. Even when enabled, the plugin should keep
- out of your way if you're not using its features. (If you find a situation
- where this is not a case, contact the |rails-plugin-author|.)
-
-3. Easy navigation of the Rails directory structure. |gf| considers context
- and knows about partials, fixtures, and much more. There are two commands,
- :A (alternate) and :R (related) for easy jumping between files, including
- favorites like model to migration, template to helper, and controller to
- functional test. For more advanced usage, :Rmodel, :Rview, :Rcontroller,
- and several other commands are provided. |rails-navigation|
-
-4. Enhanced syntax highlighting. From has_and_belongs_to_many to
- distance_of_time_in_words, it's here. For easy completion of these long
- method names, 'completefunc' is set to enable syntax based completion on
- |i_CTRL-X_CTRL-U|. |rails-syntax|
-
-5. Interface to rake. Use :Rake to run the current test, spec, or feature.
- Use :.Rake to do a focused run of just the method, example, or scenario on
- the current line. :Rake can also run arbitrary migrations, load individual
- fixtures, and more. |rails-rake|
-
-6. Interface to script/*. Generally, use ":Rscript about" to call
- "script/about" or "script/rails about". Most commands have wrappers with
- additional features: ":Rgenerate controller Blog" generates a blog
- controller and edits app/controllers/blog_controller.rb. |rails-scripts|
-
-7. Partial extraction and migration inversion. |:Rextract| {file} replaces
- the desired range (ideally selected in visual line mode) with "render
- :partial => '{file}'", which is automatically created with your content.
- The @{file} instance variable is replaced with the {file} local variable.
- |:Rinvert| takes a self.up migration and writes a self.down.
- |rails-refactoring|
-
-8. Integration with other plugins. |:Rtree| spawns NERDTree.vim or creates a
- new project.vim project. If dbext.vim is installed, it will be
- transparently configured to reflect database.yml. Cream users get some
- additional mappings, and all GUI users get a menu. |rails-integration|
-
-INSTALLATION AND USAGE *rails-installation*
-
-If you are familiar Vim and have the latest version installed, you may skip
-directly to |rails-install-plugin| below.
-
-Configuring Vim ~
- *rails-configure-vim*
-If you are new to Vim, you need to create a vimrc. For Windows, this file
-goes in ~\_vimrc (try :e ~\_vimrc if you don't know where this is). On other
-platforms, use ~/.vimrc. A very minimal example file is shown below.
->
- set nocompatible
- syntax on
- filetype plugin indent on
->
-Installing and Using the Plugin ~
- *rails-install-plugin*
-If you have the zip file, extract it to vimfiles (Windows) or ~/.vim
-(everything else). You should have the following files: >
- autoload/rails.vim
- plugin/rails.vim
- doc/rails.txt
-See |add-local-help| for instructions on enabling the documentation. In a
-nutshell: >
- :helptags ~/.vim/doc
-
-Whenever you edit a file in a Rails application, this plugin will be
-automatically activated. This sets various options and defines a few
-buffer-specific commands.
-
-If you are in a hurry to get started, with a minimal amount of reading, you
-are encouraged to at least skim through the headings and command names in this
-file, to get a better idea of what is offered. If you only read one thing,
-make sure it is the navigation section: |rails-navigation|.
-
-GENERAL COMMANDS *rails-commands*
-
-All commands are buffer local, unless otherwise stated. This means you must
-actually edit a file from a Rails application.
-
- *rails-:Rails*
-:Rails {directory} The only global command. Creates a new Rails
- application in {directory}, and loads the README.
-
-:Rails! Show the version of rails.vim installed. If rails.vim
- is active for the current buffer, also show the type
- of Rails file detected.
-
- *rails-:Rcd*
-:Rcd [{directory}] |:cd| to /path/to/railsapp/{directory}.
-
- *rails-:Rlcd*
-:Rlcd [{directory}] |:lcd| to /path/to/railsapp/{directory}.
-
- *rails-:Rdoc*
-:Rdoc Browse to the Rails API, either in doc/api in the
- current Rails application, gem_server if it is
- running, or http://api.rubyonrails.org/ . Requires
- :OpenURL to be defined (see |rails-:OpenURL|).
-
- *rails-:Rdoc!*
-:Rdoc! Make the appropriate |:helptags| call and invoke
- |:help| rails.
-
- *rails-:Redit*
-:Redit {file} Edit {file}, relative to the application root. Append
- :line or #method to jump within the file, as in
- :Redit app/controllers/users_controller.rb:12 or
- :Redit app/models/user.rb#activate .
-
- *rails-:Rlog*
-:Rlog [{logfile}] Split window and open {logfile} ($RAILS_ENV or
- development by default). The control characters used
- for highlighting are removed. If you have a :Tail
- command (provided by |tailminusf|.vim), that is used;
- otherwise, the file does NOT reload upon change.
- Use |:checktime| to tell Vim to check for changes.
- |G| has been mapped to do just that prior to jumping
- to the end of the file, and q is mapped to close the
- window. If the delay in loading is too long, you
- might like :Rake log:clear.
-
- *rails-:Rpreview*
-:Rpreview [{path}] Creates a URL from http://localhost:3000/ and the
- {path} given. The not too useful default is to then
- edit this URL using Vim itself, allowing |netrw| to
- download it. More useful is to define a :OpenURL
- command, which will be used instead (see
- |rails-:OpenURL|). If {path} is omitted, a sensible
- default is used (considers the current
- controller/template, but does not take routing into
- account). The default is overridden by comments like
- the following that are either before the current
- method call or at the top of the file: >
- # GET /users
- # PUT /users/1
-<
- *rails-:Rpreview!*
-:Rpreview! [{path}] As with :Rpreview, except :OpenURL is never used.
-
- *rails-:Rtags*
-:Rtags Calls ctags -R on the current application root and
- writes the result to tmp/tags. Exuberant ctags must
- be installed. Additional arguments can be passed to
- ctags with |g:rails_ctags_arguments|.
-
- *rails-:Rrefresh*
-:Rrefresh Refreshes certain cached settings. Most noticeably,
- this clears the cached list of classes that are syntax
- highlighted as railsUserClass.
-
- *rails-:Rrefresh!*
-:Rrefresh! As above, and also reloads rails.vim.
-
- *rails-:OpenURL*
-:OpenURL {url} This is not a command provided by the plugin, but
- rather provided by user and utilized by other plugin
- features. This command should be defined to open the
- provided {url} in a web browser. An example command
- on a Mac might be: >
- :command -bar -nargs=1 OpenURL :!open <args>
-< The following appears to work on Windows: >
- :command -bar -nargs=1 OpenURL :!start cmd /cstart /b <args>
-< On Debian compatible distributions, the following is
- the preferred method: >
- :command -bar -nargs=1 OpenURL :!sensible-browser <args>
-< If exists("$SECURITYSESSIONID"), has("gui_win32"), or
- executable("sensible-browser") is true, the
- corresponding command above will be automatically
- defined. Otherwise, you must provide your own (which
- is recommended, regardless).
-
-NAVIGATION *rails-navigation*
-
-Navigation is where the real power of this plugin lies. Efficient use of the
-following features will greatly ease navigating the Rails file structure.
-
-The 'path' has been modified to include all the best places to be.
->
- :find blog_controller
- :find book_test
-<
- *rails-:Rfind*
-:Rfind [{file}] Find {file}. Very similar to :find, but things like
- BlogController are properly handled, and tab complete
- works.
-
-File Under Cursor - gf ~
- *rails-gf*
-The |gf| command, which normally edits the current file under the cursor, has
-been remapped to take context into account. |CTRL-W_f|(open in new window) and
-|CTRL-W_gf| (open in new tab) are also remapped.
-
-Example uses of |gf|, and where they might lead.
-(* indicates cursor position)
->
- Pos*t.first
-< app/models/post.rb ~
->
- has_many :c*omments
-< app/models/comment.rb ~
->
- link_to 'Home', :controller => 'bl*og'
-< app/controllers/blog_controller.rb ~
->
- <%= render 'sh*ared/sidebar' %>
-< app/views/shared/_sidebar.html.erb ~
->
- <%= stylesheet_link_tag 'scaf*fold' %>
-< public/stylesheets/scaffold.css ~
->
- class BlogController < Applica*tionController
-< app/controllers/application_controller.rb ~
->
- class ApplicationController < ActionCont*roller::Base
-< .../action_controller/base.rb ~
->
- fixtures :pos*ts
-< test/fixtures/posts.yml ~
->
- layout :pri*nt
-< app/views/layouts/print.html.erb ~
->
- <%= link_to "New", new_comme*nt_path %>
-< app/controllers/comments_controller.rb (jumps to def new) ~
-
-In the last example, the controller and action for the named route are
-determined by evaluating routes.rb as Ruby and doing some introspection. This
-means code from the application is executed. Keep this in mind when
-navigating unfamiliar applications.
-
-Alternate and Related Files ~
- *rails-alternate-related*
-Two commands, :A and :R, are used quickly jump to an "alternate" and a
-"related" file, defined below.
-
- *rails-:A* *rails-:AE* *rails-:AS* *rails-:AV* *rails-:AT* *rails-:AD*
-:A These commands were picked to mimic Michael Sharpe's
-:AE a.vim. Briefly, they edit the "alternate" file, in
-:AS either the same window (:A and :AE), a new split
-:AV window (:AS), a new vertically split window (:AV), a
-:AT new tab (:AT), or read it into the current buffer
-:AD (:AD). A mapping for :A is [f .
-
- *rails-:R* *rails-:RE* *rails-:RS* *rails-:RV* *rails-:RT* *rails-:RD*
-:R These are similar |rails-:A| and friends above, only
-:RE they jump to the "related" file rather than the
-:RS "alternate." A mapping for :R is ]f .
-:RV
-:RT
-:RD
-
- *rails-alternate* *rails-related*
-The alternate file is most frequently the test file, though there are
-exceptions. The related file varies, and is sometimes dependent on current
-location in the file. For example, when editing a controller, the related
-file is template for the method currently being edited.
-
-The easiest way to learn these commands is to experiment. A few examples of
-alternate and related files for a Test::Unit application follow:
-
-Current file Alternate file Related file ~
-model unit test schema definition
-controller (in method) functional test template (view)
-template (view) functional test controller (jump to method)
-migration previous migration next migration
-config/database.yml config/routes.rb config/environments/*.rb
-
-Suggestions for further contexts to consider for the alternate file, related
-file, and file under the cursor are welcome. They are subtly tweaked from
-release to release.
-
-File Type Navigation Commands ~
- *rails-type-navigation*
-For the less common cases, a more deliberate set of commands are provided.
-Each of the upcoming commands takes an optional argument (with tab completion)
-but defaults to a reasonable guess. Commands that default to the current
-model or controller generally behave like you'd expect in other file types.
-For example, in app/helpers/posts_helper.rb, the current controller is
-"posts", and in test/fixtures/comments.yml, the current model is "comment".
-In model related files, the current controller is the pluralized model name,
-and in controller related files, the current model is the singularized
-controller name.
-
-Each of the following commands has variants for splitting, vertical splitting,
-opening in a new tab, and reading the file into the current buffer. For
-:Rmodel, those variants would be :RSmodel, :RVmodel, :RTmodel, and :RDmodel.
-There is also :REmodel which is a synonym for :Rmodel (future versions might
-allow customization of the behavior of :Rmodel). They also allow for jumping
-to methods or line numbers using the same syntax as |:Redit|, and file
-creation can be forced by adding a ! after the filename (not after the command
-itself!).
-
-:Rcontroller |rails-:Rcontroller|
-:Renvironment |rails-:Renvironment|
-:Rfixtures |rails-:Rfixtures|
-:Rfunctionaltest |rails-:Rfunctionaltest|
-:Rhelper |rails-:Rhelper|
-:Rinitializer |rails-:Rinitializer|
-:Rintegrationtest |rails-:Rintegrationtest|
-:Rjavascript |rails-:Rjavascript|
-:Rlayout |rails-:Rlayout|
-:Rlib |rails-:Rlib|
-:Rlocale |rails-:Rlocale|
-:Rmailer |rails-:Rmailer|
-:Rmetal |rails-:Rmetal|
-:Rmigration |rails-:Rmigration|
-:Rmodel |rails-:Rmodel|
-:Robserver |rails-:Robserver|
-:Rplugin |rails-:Rplugin|
-:Rspec |rails-:Rspec|
-:Rstylesheet |rails-:Rstylesheet|
-:Rtask |rails-:Rtask|
-:Runittest |rails-:Runittest|
-:Rview |rails-:Rview|
-
- *rails-:Rcontroller*
-:Rcontroller [{name}] Edit the specified or current controller.
-
- *rails-:Renvironment*
-:Renvironment [{name}] Edit the config/environments file specified. With no
- argument, defaults to editing config/application.rb
- or config/environment.rb.
-
- *rails-:Rfixtures*
-:Rfixtures [{name}] Edit the fixtures for the given or current model. If
- an argument is given, it must be pluralized, like the
- final filename (this may change in the future). If
- omitted, the current model is pluralized. An optional
- extension can be given, to distinguish between YAML
- and CSV fixtures.
-
- *rails-:Rfunctionaltest*
-:Rfunctionaltest [{name}]
- Edit the functional test or controller spec for the
- specified or current controller.
-
- *rails-:Rhelper*
-:Rhelper [{name}] Edit the helper for the specified name or current
- controller.
-
- *rails-:Rinitializer*
-:Rinitializer [{name}] Edit the config/initializers file specified. With no
- argument, defaults to editing config/routes.rb.
-
- *rails-:Rintegrationtest*
-:Rintegrationtest [{name}]
- Edit the integration test, integration spec, or
- cucumber feature specified. With no argument,
- defaults to editing test/test_helper.rb.
-
- *rails-:Rjavascript*
-:Rjavascript [{name}] Edit the JavaScript for the specified name or current
- controller. Also supports CoffeeScript in
- app/scripts/.
-
- *rails-:Rlayout*
-:Rlayout [{name}] Edit the specified layout. Defaults to the layout for
- the current controller, or the application layout if
- that cannot be found. A new layout will be created if
- an extension is given.
-
- *rails-:Rlib*
-:Rlib [{name}] Edit the library from the lib directory for the
- specified name. If the current file is part of a
- plugin, the libraries from that plugin can be
- specified as well. With no argument, defaults to
- editing db/seeds.rb.
-
- *rails-:Rlocale*
-:Rlocale [{name}] Edit the config/locale file specified, optionally
- adding a yml or rb extension if none is given. With
- no argument, checks config/environment.rb for the
- default locale.
-
- *rails-:Rmailer*
-:Rmailer [{name}] Edit the mailer specified. This looks in both
- app/mailers for Rails 3 and app/models for older
- versions of Rails but only tab completes the former.
-
- *rails-:Rmetal*
-:Rmetal [{name}] Edit the app/metal file specified. With no argument,
- defaults to editing config/boot.rb.
-
- *rails-:Rmigration*
-:Rmigration [{pattern}] If {pattern} is a number, find the migration for that
- particular set of digits, zero-padding if necessary.
- Otherwise, find the newest migration containing the
- given pattern. Omitting the pattern selects the
- latest migration. Give a numeric argument of 0 to edit
- db/schema.rb.
-
- *rails-:Rmodel*
-:Rmodel [{name}] Edit the specified or current model.
-
- *rails-:Robserver*
-:Robserver [{name}] Find the observer with a name like
- {model}_observer.rb. When in an observer, most
- commands (like :Rmodel) will seek based on the
- observed model ({model}) and not the actual observer
- ({model}_observer). However, for the command
- :Runittest, a file of the form
- {model}_observer_test.rb will be found.
-
- *rails-:Rplugin*
-:Rplugin [{plugin}[/{path}]]
- Edits a file within a plugin. If the path to the file
- is omitted, it defaults to init.rb. If no argument is
- given, it defaults to editing the application Gemfile.
-
- *rails-:Rspec*
-:Rspec [{name}] Edit the given spec. With no argument, defaults to
- editing spec/spec_helper.rb (If you want to jump to
- the spec for the given file, use |:A| instead). This
- command is only defined if there is a spec folder in
- the root of the application.
-
- *rails-:Rstylesheet*
-:Rstylesheet [{name}] Edit the stylesheet for the specified name or current
- controller. Also supports Sass and SCSS.
-
- *rails-:Rtask*
-:Rtask [{name}] Edit the .rake file from lib/tasks for the specified
- name. If the current file is part of a plugin, the
- tasks for that plugin can be specified as well. If no
- argument is given, either the current plugin's
- Rakefile or the application Rakefile will be edited.
-
- *rails-:Runittest*
-:Runittest [{name}] Edit the unit test or model spec for the specified
- name or current model.
-
- *rails-:Rview*
-:Rview [[{controller}/]{view}]
- Edit the specified view. The controller will default
- sensibly, and the view name can be omitted when
- editing a method of a controller. If a view name is
- given with an extension, a new file will be created.
- This is a quick way to create a new view.
-
-Custom Navigation Commands ~
- *rails-custom-navigation*
-
-It is also possible to create custom navigation commands. This is best done
-in an initialization routine of some sort (e.g., an autocommand); see
-|rails-configuration| for details.
-
- *rails-:Rnavcommand*
-:Rnavcommand [options] {name} [{path} ...]
- Create a navigation command with the supplied
- name, looking in the supplied paths, using the
- supplied options. The -suffix option specifies what
- suffix to filter on, and strip from the filename, and
- defaults to -suffix=.rb . The -glob option specifies
- a file glob to use to find files, _excluding_ the
- suffix. Useful values include -glob=* and -glob=**/*.
- The -default option specifies a default argument (not
- a full path). If it is specified as -default=model(),
- -default=controller(), or -default=both(), the current
- model, controller, or both (as with :Rintegrationtest)
- is used as a default.
-
- *rails-:Rcommand*
-:Rcommand Obsolete alias for |:Rnavcommand|.
-
-Examples: >
- Rnavcommand api app/apis -glob=**/* -suffix=_api.rb
- Rnavcommand config config -glob=*.* -suffix= -default=routes.rb
- Rnavcommand concern app/concerns -glob=**/*
- Rnavcommand exemplar test/exemplars spec/exemplars -glob=**/*
- \ -default=model() -suffix=_exemplar.rb
-
-Finally, one Vim feature that proves helpful in conjunction with all of the
-above is |CTRL-^|. This keystroke edits the previous file, and is helpful to
-back out of any of the above commands.
-
-RAKE *rails-rake*
-
-Rake integration happens through the :Rake command.
-
- *rails-:Rake*
-:[range]Rake {targets} Calls |:make!| {targets} (with 'makeprg' being rake)
- and opens the quickfix window if there were any
- errors. An argument of "-" reruns the last task. If
- {targets} are omitted, :Rake defaults to something
- sensible as described below. Giving a line number
- argument may affect that default.
-
- *rails-:Rake!*
-:[range]Rake! {targets} Called with a bang, :Rake will forgo opening the
- quickfix window.
-
- *rails-rake-defaults*
-
-Generally, the default task is one that runs the test you'd expect. For
-example, if you're in a view in an RSpec application, the view spec is run,
-but if it's a Test::Unit application, the functional test for the
-corresponding controller is run. The following table lists the most
-interesting mappings:
-
-File Task ~
-unit test test:units TEST=...
-functional test test:functionals TEST=...
-integration test test:integration TEST=...
-spec spec SPEC=...
-feature cucumber FEATURE=...
-model test:units TEST=... spec SPEC=...
-controller test:functionals TEST=... spec SPEC=...
-helper test:functionals TEST=... spec SPEC=...
-view test:functionals TEST=... spec SPEC=...
-fixtures db:fixtures:load FIXTURES=...
-migration db:migrate VERSION=...
-config/routes.rb routes
-db/seeds.rb db:seed
-
-Additionally, when :Rake is given a line number (e.g., :.Rake), the following
-additional tasks can be invoked:
-
-File Task ~
-unit test test:units TEST=... TESTOPTS=-n...
-functional test test:functionals TEST=... TESTOPTS=-n...
-integration test test:integration TEST=... TESTOPTS=-n...
-spec spec SPEC=...:...
-feature cucumber FEATURE=...:...
-controller routes CONTROLLER=...
-fixtures db:fixtures:identify LABEL=...
-migration in self.up db:migrate:up VERSION=...
-migration in self.down db:migrate:down VERSION=...
-migration elsewhere db:migrate:redo VERSION=...
-task ... (try to guess currently edited declaration)
-
-Finally, you can override the default task with a comment like "# rake ..."
-before the method pointed to by [range] or at the top of the file.
-
-SCRIPT WRAPPERS *rails-scripts*
-
-The following commands are wrappers around the scripts in the script directory
-of the Rails application. Most have extra features beyond calling the script.
-A limited amount of completion with <Tab> is supported.
-
- *rails-:Rscript*
-:Rscript {script} {options}
- Call ruby script/{script} {options}. Defaults to
- calling script/console.
-
- *rails-:Rconsole*
-:Rconsole {options} Obsolete. Call |:Rscript| instead.
-
- *rails-:Rrunner*
-:[range]Rrunner {code} Executes {code} with script/runner. Differs from
- :Rscript runner {code} in that the code is passed as
- one argument. Also, |system()| is used instead of
- |:!|. This is to help eliminate annoying "Press
- ENTER" prompts. If a line number is given in the
- range slot, the output is pasted into the buffer after
- that line.
-
- *rails-:Rp*
-:[range]Rp {code} Like :Rrunner, but call the Ruby p method on the
- result. Literally "p begin {code} end".
-
- *rails-:Rpp* *rails-:Ry*
-:[range]Rpp {code} Like :Rp, but with pp (pretty print) or y (YAML
-:[range]Ry {code} output).
-
- *rails-:Rgenerate*
-:Rgenerate {options} Calls script/generate {options}, and then edits the
- first file generated.
-
- *rails-:Rdestroy*
-:Rdestroy {options} Calls script/destroy {options}.
-
- *rails-:Rserver*
-:Rserver {options} Launches script/server {options} in the background.
- On win32, this means |!start|. On other systems, this
- uses the --daemon option.
-
- *rails-:Rserver!*
-:Rserver! {options} Same as |:Rserver|, only first attempts to kill any
- other server using the same port. On non-Windows
- systems, lsof must be installed for this to work.
-
-REFACTORING HELPERS *rails-refactoring*
-
-A few features are dedicated to helping you refactor your code.
-
-Partial Extraction ~
- *rails-partials*
-
-The :Rextract command can be used to extract a partial to a new file.
-
- *rails-:Rextract*
-:[range]Rextract [{controller}/]{name}
- Create a {name} partial from [range] lines (default:
- current line).
-
- *rails-:Rpartial*
-:[range]Rpartial [{controller}/]{name}
- Obsolete alias for :Rextract.
-
-If this is your file, in app/views/blog/show.html.erb: >
-
- 1 <div>
- 2 <h2><%= @post.title %></h2>
- 3 <p><%= @post.body %></p>
- 4 </div>
-
-And you issue this command: >
-
- :2,3Rextract post
-
-Your file will change to this: >
-
- 1 <div>
- 2 <%= render :partial => 'post' %>
- 3 </div>
-
-And app/views/blog/_post.html.erb will now contain: >
-
- 1 <h2><%= post.title %></h2>
- 2 <p><%= post.body %></p>
-
-As a special case, if the file had looked like this: >
-
- 1 <% for object in @posts -%>
- 2 <h2><%= object.title %></h2>
- 3 <p><%= object.body %></p>
- 4 <% end -%>
-<
-The end result would have been this: >
-
- 1 <%= render :partial => 'post', :collection => @posts %>
-<
-The easiest way to choose what to extract is to use |linewise-visual| mode.
-Then, a simple >
- :'<,'>Rextract blog/post
-will suffice. (Note the use of a controller name in this example.)
-
-Migration Inversion ~
- *rails-migrations* *rails-:Rinvert*
-:Rinvert In a migration, rewrite the self.up method into a
- self.down method. If self.up is empty, the process is
- reversed. This chokes on more complicated
- instructions, but works reasonably well for simple
- calls to create_table, add_column, and the like.
-
-INTEGRATION *rails-integration*
-
-Having one foot in Rails and one in Vim, rails.vim has two worlds with which
-to interact.
-
-Integration with the Vim Universe ~
- *rails-vim-integration*
-
-A handful of Vim plugins are enhanced by rails.vim. All plugins mentioned can
-be found at http://www.vim.org/. Cream and GUI menus (for lack of a better
-place) are also covered in this section.
-
- *rails-:Rtree* *rails-:Rproject*
-:Rtree [{arg}] If |NERDTree| is installed, open a tree for the
- application root or the given subdirectory.
- Otherwise, if the |project| plugin is installed,
- invoke :Project (typically without an argument), and
- search for the root of the current Rails application.
- If it is not found, create a new project, with
- appropriate directories (app, etc., but not vendor).
-
- *rails-:Rdbext* *rails-dbext*
-:Rdbext [{environment}] This command is only provided when the |dbext| plugin
- is installed. Loads the {environment} configuration
- (defaults to $RAILS_ENV or development) from
- config/database.yml and uses it to configure dbext.
- The configuration is cached on a per application
- basis. With dbext version 8.00 and newer, this
- command is called automatically when needed. When
- dbext is configured, you can execute SQL directly from
- Vim: >
- :Select * from posts order by id desc
- :Update comments set author_id = 1
-<
- *rails-surround*
-The |surround| plugin available from vim.org enables adding and removing
-"surroundings" like parentheses, quotes, and HTML tags. Even by itself, it is
-quite useful for Rails development, particularly eRuby editing. When coupled
-with this plugin, a few additional replacement surroundings are available in
-eRuby files. See the |surround| documentation for details on how to use them.
-The table below uses ^ to represent the position of the surrounded text.
-
-Key Surrounding ~
-= <%= ^ %>
-- <% ^ -%>
-# <%# ^ %>
-<C-E> <% ^ -%>\n<% end -%>
-
-The last surrounding is particularly useful in insert mode with the following
-map in one's vimrc. Use Alt+o to open a new line below the current one. This
-works nicely even in a terminal (where most alt/meta maps will fail) because
-most terminals send <M-o> as <Esc>o anyways.
->
- imap <M-o> <Esc>o
-<
-One can also use the <C-E> surrounding in a plain Ruby file to append a bare
-"end" on the following line.
-
- *rails-abolish*
-Among the many features of |abolish| on vim.org is the ability to change the
-inflection of the word under the cursor. For example, one can hit crs to
-change from MixedCase to snake_case. This plugin adds two additional
-inflections: crl for alternating between the singular and plural, and crt for
-altering between tableize and classify. The latter is useful in changing
-constructs like BlogPost.all to current_user.blog_posts.all and vice versa.
-
- *rails-cream*
-This plugin provides a few additional key bindings if it is running under
-Cream, the user friendly editor which uses Vim as a back-end. Ctrl+Enter
-finds the file under the cursor (as in |rails-gf|), and Alt+[ and Alt+] find
-the alternate (|rails-alternate|) and related (|rails-related|) files.
-
- *rails-menu*
-If the GUI is running, a menu for several commonly used features is provided.
-Also on this menu is a list of recently accessed projects. This list of
-projects can persist across restarts if a 'viminfo' flag is set to enable
-retaining certain global variables. If this interests you, add something like
-the following to your vimrc: >
- set viminfo^=!
-<
-Integration with the Rails Universe ~
- *rails-rails-integration*
-The general policy of rails.vim is to focus exclusively on the Ruby on Rails
-core. Supporting plugins and other add-ons to Rails has the potential to
-rapidly get out of hand. However, a few pragmatic exceptions have been made.
-
- *rails-template-types*
-Commands like :Rview use a hardwired list of extensions (erb, rjs, etc.)
-when searching for files. In order to facilitate working with non-standard
-template types, several popular extensions are featured in this list,
-including haml, liquid, and mab (markaby). These extensions will disappear
-once a related configuration option is added to rails.vim.
-
- *rails-rspec*
-The presence of a spec directory causes several additional behaviors to
-activate. :A knows about specs and will jump to them (but Test::Unit files
-still get priority). The associated controller or model of a spec is
-detected, so all navigation commands should work as expected inside a spec
-file. :Rake in a spec runs just that spec, and in a model, controller, or
-helper, runs the associated spec.
-
-|:Runittest| and |:Rfunctionaltest| lead double lives, handling model and
-controller specs respectively. For helper and view specs, you can use
-|:Rspec| or define your own navigation commands:
->
- Rnavcommand spechelper spec/helpers -glob=**/*
- \ -suffix=_helper_spec.rb -default=controller()
- Rnavcommand specview spec/views -glob=**/* -suffix=_spec.rb
-<
-ABBREVIATIONS *rails-abbreviations* *rails-snippets*
-
-Abbreviations are "snippets lite". They may later be extracted into a
-separate plugin, or removed entirely.
-
- *rails-:Rabbrev*
-:Rabbrev List all Rails abbreviations.
-
-:Rabbrev {abbr} {expn} [{extra}]
- Define a new Rails abbreviation. {extra} is permitted
- if and only if {expn} ends with "(".
-
- *rails-:Rabbrev!*
-:Rabbrev! {abbr} Remove an abbreviation.
-
-Rails abbreviations differ from regular abbreviations in that they only expand
-after a <C-]> (see |i_CTRL-]|) or a <Tab> (if <Tab> does not work, it is
-likely mapped by another plugin). If the abbreviation ends in certain
-punctuation marks, additional expansions are possible. A few examples will
-hopefully clear this up (all of the following are enabled by default in
-appropriate file types).
-
-Command Sequence typed Resulting text ~
-Rabbrev rp( render :partial\ => rp( render(:partial =>
-Rabbrev rp( render :partial\ => rp<Tab> render :partial =>
-Rabbrev vs( validates_size_of vs( validates_size_of(
-Rabbrev pa[ params pa[:id] params[:id]
-Rabbrev pa[ params pa<C-]> params
-Rabbrev pa[ params pa.inspect params.inspect
-Rabbrev AR:: ActionRecord AR::Base ActiveRecord::Base
-Rabbrev :a :action\ =>\ render :a<Tab> render :action =>
-
-In short, ( expands on (, :: expands on . and :, and [ expands on . and [.
-These trailing punctuation marks are NOT part of the final abbreviation, and
-you cannot have two mappings that differ only by punctuation.
-
-You must escape spaces in your expansion, either as "\ " or as "<Space>". For
-an abbreviation ending with "(", you may define where to insert the
-parenthesis by splitting the expansion into two parts (divided by an unescaped
-space).
-
-Many abbreviations are provided by default: use :Rabbrev to list them. They
-vary depending on the type of file (models have different abbreviations than
-controllers). There is one "smart" abbreviation, :c, which expands to
-":controller => ", ":collection => ", or ":conditions => " depending on
-context.
-
-SYNTAX HIGHLIGHTING *rails-syntax*
-
-Syntax highlighting is by and large a transparent process. For the full
-effect, however, you need a colorscheme which accentuates rails.vim
-extensions. One such colorscheme is vividchalk, available from vim.org.
-
-The following is a summary of the changes made by rails.vim to the standard
-syntax highlighting.
-
- *rails-syntax-keywords*
-Rails specific keywords are highlighted in a filetype specific manner. For
-example, in a model, has_many is highlighted, whereas in a controller,
-before_filter is highlighted. A wide variety of syntax groups are used but
-they all link by default to railsMethod.
-
-If you feel a method has been wrongfully omitted, submit it to the
-|rails-plugin-author|.
-
- *rails-syntax-classes*
-Models, helpers, and controllers are given special highlighting. Depending on
-the version of Vim installed, you may need a rails.vim aware colorscheme in
-order to see this. Said colorscheme needs to provide highlighting for the
-railsUserClass syntax group.
-
-The class names are determined by camelizing filenames from certain
-directories of your application. If app/models/line_item.rb exists, the class
-"LineItem" will be highlighted.
-
-The list of classes is refreshed automatically after certain commands like
-|:Rgenerate|. Use |:Rrefresh| to trigger the process manually.
-
- *rails-syntax-assertions*
-If you define custom assertions in test_helper.rb, these will be highlighted
-in your tests. These are found by scanning test_helper.rb for lines of the
-form " def assert_..." and extracting the method name. The railsUserMethod
-syntax group is used. The list of assertions can be refreshed with
-|:Rrefresh|.
-
- *rails-syntax-strings*
-In the following line of code, the "?" in the conditions clause and the "ASC"
-in the order clause will be highlighted: >
- Post.find(:all, :conditions => ["body like ?","%e%"], :order => "title ASC")
-<
-A string literal using %Q<> or %<> delimiters will have its contents
-highlighted as HTML. This is sometimes useful when writing helpers. >
- link = %<<a href="http://www.vim.org">Vim</a>>
-<
- *rails-syntax-yaml*
-YAML syntax highlighting has been extended to highlight eRuby, which can be
-used in most Rails YAML files (including database.yml and fixtures).
-
-MANAGED VIM OPTIONS *rails-options*
-
-The following options are set local to buffers where the plugin is active.
-
- *rails-'shiftwidth'* *rails-'sw'*
- *rails-'softtabstop'* *rails-'sts'*
- *rails-'expandtab'* *rails-'et'*
-A value of 2 is used for 'shiftwidth' (and 'softtabstop'), and 'expandtab' is
-enabled. This is a strong convention in Rails, so the conventional wisdom
-that this is a user preference has been ignored.
-
- *rails-'path'* *rails-'pa'*
-All the relevant directories from your application are added to your 'path'.
-This makes it easy to access a buried file: >
- :find blog_controller.rb
-<
- *rails-'suffixesadd'* *rails-'sua'*
-This is filetype dependent, but typically includes .rb, .rake, and several
-others. This allows shortening the above example: >
- :find blog_controller
-<
- *rails-'includeexpr'* *rails-'inex'*
-The 'includeexpr' option is set to enable the magic described in |rails-gf|.
-
- *rails-'statusline'* *rails-'stl'*
-Useful information is added to the 'statusline', when |g:rails_statusline| is
-enabled.
-
- *rails-'filetype'* *rails-'ft'*
-The 'filetype' is sometimes adjusted for Rails files. Most notably, *.rxml
-and *.rjs are treated as Ruby files, and files that have been falsely
-identified as Mason sources are changed back to eRuby files (but only when
-they are part of a Rails application).
-
- *rails-'completefunc'* *rails-'cfu'*
-A 'completefunc' is provided (if not already set). It is very simple, as it
-uses syntax highlighting to make its guess. See |i_CTRL-X_CTRL-U|.
-
-CONFIGURATION *rails-configuration*
-
-Very little configuration is actually required; this plugin automatically
-detects your Rails application and adjusts Vim sensibly.
-
- *rails-:autocmd* *rails-autocommands*
-If you would like to set your own custom Vim settings whenever a Rails file is
-loaded, you can use an autocommand like the following in your vimrc: >
- autocmd User Rails silent! Rlcd
- autocmd User Rails map <buffer> <F9> :Rake<CR>
-You can also have autocommands that only apply to certain types of files.
-These are based off the information shown when running the |:Rails!|
-command, with hyphens changed to periods. A few examples: >
- autocmd User Rails.controller* iabbr <buffer> wsn wsdl_service_name
- autocmd User Rails.model.arb* iabbr <buffer> vfo validates_format_of
- autocmd User Rails.view.erb* imap <buffer> <C-Z> <%= %><C-O>3h
-End all such Rails autocommands with asterisks, even if you have an exact
-specification, to allow for more specific subtypes to be added in the future.
-There is also a filename matching syntax: >
- autocmd User Rails/config/environment.rb Rabbrev c config
- autocmd User Rails/**/foo_bar.rb Rabbrev FB:: FooBar
-Use the filetype based syntax whenever possible, reserving the filename based
-syntax for more advanced cases.
-
- *macros/rails.vim*
-If you have several commands to run on initialization for all file types, they
-can be placed in a "macros/rails.vim" file in the 'runtimepath' (for example,
-"~/.vim/macros/rails.vim"). This file is sourced by rails.vim each time a
-Rails file is loaded.
-
- *config/rails.vim*
-If you have settings particular to a specific project, they can be put in a
-config/rails.vim file in the root directory of the application. The file is
-sourced in the |sandbox| for security reasons.
-
- *rails-:Rset*
-:Rset {option}[={value}]
- Query or set a local option. This command may be
- called directly, from an autocommand, or from
- config/rails.vim.
-
-Options may be set in one of four scopes, which may be indicated by an
-optional prefix. These scopes determine how broadly an option will apply.
-Generally, the default scope is sufficient.
-
-Scope Description ~
-a: All files in one Rails application
-b: Buffer (file) specific
-g: Global to all applications
-l: Local to method (same as b: in non-Ruby files)
-
-Options are shown below with their default scope, which should be omitted.
-While you may override the scope with a prefix, this is rarely necessary and
-oftentimes useless. (For example, setting g:task is useless because the
-default rake task will apply before considering this option.)
-
-Option Meaning ~
-b:alternate Custom alternate file for :A, relative to the Rails root
-b:controller Default controller for certain commands (e.g., :Rhelper)
-b:model Default model for certain commands (e.g., :Rfixtures)
-l:related Custom related file for :R, relative to the Rails root
-a:root_url Root URL for commands like :Rpreview
-
-Examples: >
- :Rset root_url=http://localhost:12345
- :Rset related=app/views/blog/edit.html.erb
-<
- *rails-modelines*
-If |g:rails_modelines| is enabled, these options can also be set from
-modelines near the beginning or end of the file. These modelines will always
-set buffer-local options; scope should never be specified. Examples: >
- # Rset task=db:schema:load
- <%# Rset alternate=app/views/layouts/application.html.erb %>
-Modelines can also be local to a method. Example: >
- def test_comment
- # rset alternate=app/models/comment.rb
-These two forms differ only in case.
-
-Modelines are deprecated.
-
-GLOBAL SETTINGS *rails-global-settings*
-
-A few global variables control the behavior of this plugin. In general, they
-can be enabled by setting them to 1 in your vimrc, and disabled by setting
-them to 0. >
- let g:rails_some_option=1
- let g:rails_some_option=0
-Most of these seldom need to be used. So seldom, in fact, that you should
-notify the |rails-plugin-author| if you find any of them useful, as nearly all
-are being considered for removal.
-
- *g:loaded_rails* >
- let g:loaded_rails=1
-Set this include guard to prevent the plugin from being loaded.
-
- *g:rails_abbreviations*
-Enable Rails abbreviations. See |rails-abbreviations|. Enabled by default.
-
- *g:rails_ctags_arguments* >
- let g:rails_ctags_arguments='--languages=-javascript'
-Additional arguments to pass to ctags from |:Rtags|. Defaults to ignoring
-JavaScript files, since ctags has a tendency to choke on those.
-
- *g:rails_default_file* >
- let g:rails_default_file='config/database.yml'
-File to load when a new Rails application is created, or when loading an
-existing project from the menu. Defaults to the README.
-
- *rails-screen* *g:rails_gnu_screen* >
- let g:rails_gnu_screen=1
-Use GNU Screen or Tmux (if it is running) to launch |:Rscript| console and
-|:Rserver| in the background. Enabled by default.
-
- *g:rails_history_size* >
- let g:rails_history_size=5
-Number of projects to remember. Set to 0 to disable. See |rails-menu| for
-information on retaining these projects across a restart.
-
- *g:rails_mappings* >
- let g:rails_mappings=1
-Enables a few mappings (mostly for |rails-navigation|). Enabled by default.
-
- *g:rails_modelines* >
- let g:rails_modelines=1
-Enable modelines like the following: >
- # Rset task=db:schema:load
-Modelines set buffer-local options using the :Rset command.
-Also enables method specific modelines (note the case difference): >
- def show
- # rset preview=blog/show/1
-Modelines are deprecated and disabled by default.
-
- *g:rails_menu* >
- let g:rails_menu=1
-When 2, a Rails menu is created. When 1, this menu is a submenu under the
-Plugin menu. The default is 1 except on MacVim, where reports of weird
-terminal output have led to it being disabled by default.
-
- *g:rails_url* >
- let g:rails_url='http://localhost:3000/'
-Used for the |:Rpreview| command. Default is as shown above. Overridden by
-b:rails_url.
-
- *g:rails_statusline* >
- let g:rails_statusline=1
-Give a clue in the statusline when this plugin is enabled. Enabled by
-default. This used to be a far more verbose indicator which included the
-type of Rails file. If you actually liked this, you can add either
-%{rails#statusline(1)} or %{rails#STATUSLINE(1)} to 'statusline' explicitly
-(and let the author know, because this fallback is likely getting the boot).
-
- *g:rails_syntax* >
- let g:rails_syntax=1
-When enabled, this tweaks the syntax highlighting to be more Rails friendly.
-Enabled by default. See |rails-syntax|.
-
- *rails-tabs* *g:rails_tabstop* >
- let g:rails_tabstop=4
-This option now requires the plugin railstab.vim from vim.org:
- http://www.vim.org/scripts/script.php?script_id=2253
-
-If your goal is simply just override this plugin's settings and use your own
-custom 'shiftwidth', adjust things manually in an autocommand: >
- autocmd User Rails set sw=4 sts=4 noet
-This is highly discouraged: don't fight Rails.
-
-ABOUT *rails-about* *rails-plugin-author*
-
-This plugin was written by Tim Pope. Email him at <vimNOSPAM@tpope.org>. He
-can also be found on Freenode's IRC network, hanging out in #rubyonrails and
-#vim as tpope.
-
-The official homepage is
- http://rails.vim.tpope.net
-The latest stable version can be found at
- http://www.vim.org/scripts/script.php?script_id=1567
-You can keep up to date with |GetLatestVimScripts|.
-
-The very latest development versions can be retrieved from Git:
- http://github.com/tpope/vim-rails
- git clone git://github.com/tpope/vim-rails.git
-
-The Github repository has Pledgie donations enabled. All donations made will
-proxied along to ICCF, which goes to help needy children in |Uganda|.
-Donations will be made in through the plugin author's vim.org account through
-http://www.vim.org/sponsor/ . The voting privileges associated with the
-donation will be used to vote for features that will enable better plugins in
-the future. If you would rather keep those voting privileges for yourself, or
-you want your donation to be tax deductible, donate directly through vim.org
-instead. Donations have historically been matched.
-
-Feedback is highly desired on this plugin. Please send all comments,
-complaints, and compliments to the author. No bug is too small to report.
-
- *rails-license*
-This plugin is distributable under the same terms as Vim itself. See
-|license|. No warranties, expressed or implied.
-
- vim:tw=78:ts=8:ft=help:norl:
View
10 macros/rails.vim
@@ -1,10 +0,0 @@
-command! -nargs=0 Rroutes :Rfind routes.rb
-command! -nargs=0 RSroutes :RSfind routes.rb
-
-command! -nargs=0 Rschema :Rfind db/schema.rb
-command! -nargs=0 RSschema :RSfind db/schema.rb
-
-command! -nargs=0 Rconfig :Rfind application.yml
-command! -nargs=0 RSconfig :RSfind application.yml
-
-Rnavcommand sass public/stylesheets/sass -suffix=.sass
View
466 plugin/ColorSchemeMenuMaker.vim
@@ -1,466 +0,0 @@
-" theme.menu.vim: Generates Vim themes menu and organizes themes based
-" upon background colors
-" Maintainer: Erik Falor <rAjsBnFCybe@tzNnvy.Zpbz g?? - NOSPAM>
-" Date: Aug 30, 2007
-" Version: 0.4
-"
-
-" Initialization: {{{
-if exists("g:loaded_theme_menu") || &cp
- finish
-endif
-let g:loaded_theme_menu= "0.4"
-let s:keepcpo = &cpo
-set cpo&vim
-"}}}
-
-" Script Variables: {{{
-let s:menuFile = strpart(&rtp, 0, stridx(&rtp, ',')) . '/plugin/ColorSchemes.vim'
-let s:menuName = '&ColorSchemes'
-let s:xdigit = '[0123456789ABCDEFabcdef]'
-let s:hexvals = { 0:0, 1:1, 2:2, 3:3,
- \4:4, 5:5, 6:6, 7:7,
- \8:8, 9:9, 'a':10, 'b':11,
- \'c':12, 'd':13, 'e':14, 'f':15,
- \'A':10, 'B':11, 'C':12, 'D':13,
- \'E':14, 'F':15 }
-"}}}
-
-" Library Functions {{{
-function! <SID>RGBtoHSV(r, g, b) "{{{
- let h = 0
- let s = 0
- let v = 0
- if (a:b > a:g) && (a:b > a:r)
- let v = a:b
- if v != 0
- let min = 0
- if(a:r > a:g)
- let min = a:g
- else
- let min = a:r
- endif
-
- let delta = v - min
-
- if delta != 0
- let s = (delta * 255) / v
- let h = 240 + (60 * a:r - 60 * a:g) / delta
- else
- let s = 0
- let h = 240 + (60 * a:r - 60 * a:g)
- endif
- if h < 0
- let h = h + 360
- endif
- else
- let s = 0
- let h = 0
- endif
- elseif a:g > a:r
- let v = a:g
- if v != 0
- let min = 0
- if a:r > a:b
- let min = a:b
- else
- let min = a:r
- endif
- let delta = v - min
- if delta != 0
- let s = (delta * 255) / v
- let h = 120 + (60 * a:b - 60 * a:r) / delta
- else
- let s = 0
- let h = 120 + (60 * a:b - 60 * a:r)
- endif
- if h < 0
- let h = h + 360
- endif
- else
- let s = 0
- let h = 0
- endif
- else
- let v = a:r
- if v != 0
- let min = 0
- if a:g > a:b
- let min = a:b
- else
- let min = a:g
- endif
- let delta = v - min
- if delta != 0
- let s = (delta * 255) / v
- let h = (60 * a:g - 60 * a:b) / delta
- else
- let s = 0
- let h = 60 * a:g - 60 * a:b
- endif
- if h < 0
- let h = h + 360
- endif
- else
- let s = 0
- let h = 0
- endif
- endif
- return [h, s, v]
-endfunction "RGBtoHSV()
-"}}}
-
-function! <SID>IsBlack(r, g, b, h, s, v) "{{{
- if a:r == a:g && a:g == a:b && a:b == 0
- return 1
- else
- return 0
- endif
-endfunction "IsBlack()}}}
-
-function! <SID>IsWhite(r, g, b, h, s, v) "{{{
- if a:r == a:g && a:g == a:b && a:b == 255
- return 1
- else
- return 0
- endif
-endfunction "IsWhite()}}}
-
-function! <SID>IsDarkGrey(r, g, b, h, s, v) "{{{
- let diffRGB = max([a:r, a:g, a:b]) - min([a:r, a:g, a:b])
- let darkGreyFuzz = 20
- if diffRGB <= darkGreyFuzz
- return 1
- else
- return 0
- endif
-endfunction "IsDarkGrey()}}}
-
-function! <SID>IsOffWhite(r, g, b, h, s, v) "{{{
- let offWhiteSat = 32
- let offWhiteVal = 255 - 32
- if a:v >= offWhiteVal && a:s <= offWhiteSat
- return 1
- else
- return 0
- endif
-endfunction "}}}
-
-function! <SID>IsGrey(r, g, b, h, s, v) "{{{
- let diffRGB = max([a:r, a:g, a:b]) - min([a:r, a:g, a:b])
- let greyFuzz = 28
- let greyVal = 32
-
- if diffRGB > greyFuzz
- return 0
- elseif (a:s <= greyFuzz )
- \&& (a:v <= 255 - (greyVal * 1))
- \&& (a:v >= 0 + (greyVal * 1))
- return 1
- else
- return 0
- endif
-endfunction "}}}
-
-function! <SID>IsYellow(r, g, b, h, s, v) "{{{
- if a:h > 30 && a:h <= 90
- return 1
- else
- return 0
- endif
-endfunction "}}}
-
-function! <SID>IsGreen(r, g, b, h, s, v) "{{{
- if a:h > 90 && a:h <= 180
- return 1
- else
- return 0
- endif
-endfunction "}}}
-
-function! <SID>IsCyan(r, g, b, h, s, v) "{{{
-" cyan will be 180 deg +/- 10 deg
- let variance = 10
- if a:h > 180 - variance && a:h < 180 + variance
- return 1
- else
- return 0
- endif
-endfunction "}}}
-
-function! <SID>IsBlue(r, g, b, h, s, v) "{{{
- if a:h > 180 && a:h <= 270
- return 1
- else
- return 0
- endif
-endfunction "}}}
-
-function! <SID>IsMagenta(r, g, b, h, s, v) "{{{
- if a:h > 270 && a:h <= 330
- return 1
- else
- return 0
- endif
-endfunction }}}
-
-function! <SID>IsOrange(r, g, b, h, s, v) "{{{
- "a magic number found through trial and error
- let greenFuzz = 172
- if a:r > a:g && a:b == 0 && a:g < greenFuzz && a:g != 0
- return 1
- else
- return 0
- endif
-endfunction "}}}
-
-function! <SID>IsRed(r, g, b, h, s, v) "{{{
- if a:h > 330 || a:h <= 30
- return 1
- else
- return 0
- endif
-endfunction "}}}
-
-function! <SID>RgbTxt2Hexes() "{{{
- "read rgb.txt, return dictionary mapping color names to hex triplet
- if exists("g:rgbtxt") && filereadable(g:rgbtxt)
- let rgbtxt = g:rgbtxt
- else
- if has("win32") || has("win64")
- let rgbtxt = expand("$VIMRUNTIME/rgb.txt")
- elseif filereadable("/usr/X11R6/lib/X11/rgb.txt")
- let rgbtxt = "/usr/X11R6/lib/X11/rgb.txt"
- elseif filereadable("/usr/share/X11/rgb.txt")
- let rgbtxt = "/usr/share/X11/rgb.txt"
- endif
- endif
- let rgbdict = {}
- if filereadable(rgbtxt)
- for line in readfile(rgbtxt)
- if line !~ '^\(!\|#\)'
- let l = matchlist(line, '\s*\(\d\+\)\s*\(\d\+\)\s*\(\d\+\)\s*\(.*\)')
- let rgbdict[tolower(l[4])] = printf('%02X%02X%02X', l[1], l[2], l[3])
- endif
- endfor
- "note: vim treats guibg=NONE as guibg=white
- let rgbdict['none'] = 'FFFFFF'
- else
- echoerr "ColorSchemeMenuMaker.vim could not open rgb.txt file at " . rgbtxt
- endif
- return rgbdict
-endfunction "}}}
-
-function! <SID>RGBHexToHexes(rgb) "{{{
- let xdigits = '\(' . s:xdigit . '\{2\}\)'
- let pat = '\(#\)\?' . xdigits . xdigits . xdigits
- let l = matchlist(a:rgb, pat)
- if len(l) > 0
- return [ l[2], l[3], l[4] ]
- else
- return []
- endif
-endfunction "}}}
-
-function! <SID>RGBHexToInts(rgbList) "{{{
- return map(a:rgbList, '<SID>Hex2Int(v:val)')
-endfunction "}}}
-
-function! <SID>Hex2Int(hex) "{{{
- let xdigits = split(a:hex, '\zs')
- return 16 * s:hexvals[xdigits[0]] + s:hexvals[xdigits[1]]
-endfunction "}}}
-
-function! <SID>RGB2BoyColor(rgb) "{{{
- let rgbL = <SID>RGBHexToInts(<SID>RGBHexToHexes(a:rgb))
- let r = rgbL[0] | let g = rgbL[1] | let b = rgbL[2]
- let hsvL = <SID>RGBtoHSV(r, g, b)
- let h = hsvL[0] | let s = hsvL[1] | let v = hsvL[2]
- if <SID>IsBlack(r, g, b, h, s, v) == 1 | return 'black' | endif
- if <SID>IsWhite(r, g, b, h, s, v) == 1 | return 'white' | endif
- if <SID>IsGrey(r, g, b, h, s, v) == 1 | return 'grey' | endif
- if <SID>IsOffWhite(r, g, b, h, s, v) == 1 | return 'offwhite' | endif
- if <SID>IsDarkGrey(r, g, b, h, s, v) == 1 | return 'darkgrey' | endif
- if <SID>IsOrange(r, g, b, h, s, v) == 1 | return 'orange' | endif
- if <SID>IsYellow(r, g, b, h, s, v) == 1 | return 'yellow' | endif
- if <SID>IsCyan(r, g, b, h, s, v) == 1 | return 'cyan' | endif
- if <SID>IsGreen(r, g, b, h, s, v) == 1 | return 'green' | endif
- if <SID>IsBlue(r, g, b, h, s, v) == 1 | return 'blue' | endif
- if <SID>IsMagenta(r, g, b, h, s, v) == 1 | return 'magenta' | endif
- if <SID>IsRed(r, g, b, h, s, v) == 1 | return 'red' | endif
- return 'unknown'
-endfunction "}}}
-
-function! <SID>GlobThemes() "{{{
- "return list containing paths to all theme files in &runtimepath
- return split(globpath(&rtp, 'colors/*.vim'), '\n')
-endfunction "}}}
-
-function! <SID>ScanThemeBackground() "{{{
- "Read each of the theme files and find out which color
- "each theme 'basically' is. Uses the last 'hi Normal'
- "group found to classify by color. Notes those color
- "files that do have more than one 'hi Normal' command.
- let name2hex = <SID>RgbTxt2Hexes()
- let themeColors = {}
- let themeNames = {}
- let i = 0
- let pat = 'hi.*\s\+Normal\s\+.\{-}guibg=\(#\?\)\(\w\+\)'
- for theme in <SID>GlobThemes()
- if filereadable(theme)
-
- "DEBUG
- "let i = i + 1
- "if i > 10
- "break
- "endif
-
- let higroupfound = 0
- let color = ''
- for line in readfile(theme)
- let bg = matchlist(line, pat)
- if len(bg) > 0
- if bg[1] == '#'
- let color = <SID>RGB2BoyColor(bg[2])
- else
- if has_key(name2hex, tolower(bg[2]))
- let color = <SID>RGB2BoyColor(name2hex[tolower(bg[2])])
- else
- let color = 'unknown'
- endif
- endif
- let higroupfound += 1
- endif
- endfor
- let themename = fnamemodify(theme, ':t:r')
- let letter = toupper(strpart(themename, 0, 1))
- if letter =~ '\d' | let letter = '#' | endif
-
- if len(color) < 1
- let color = 'unknown'
- endif
-
- "allocate sub-dict if needed
- if !has_key(themeColors, color)
- let themeColors[color] = {}
- endif
- "allocate sub-dict if needed
- if !has_key(themeNames, letter)
- let themeNames[letter] = {}
- endif
- if higroupfound > 1
- "mark themes with many 'hi Normal' commands
- if len(color) > 0
- let themeColors[color][themename] = '*' . themename
- endif
- let themeNames[letter][themename] = '*' . themename
- else
- if len(color) > 0
- let themeColors[color][themename] = themename
- endif
- let themeNames[letter][themename] = themename
- endif
- endif
- endfor
- return [themeColors, themeNames]
-endfunction "}}}
-
-function! <SID>BuildMenu(dicts) "{{{
- "puts menu commands into a list
- let menu = []
- call add(menu, '"ColorScheme menu generated ' . strftime("%c", localtime()))
- call add(menu, '')
- call add(menu, '"Themes by color:')
- call add(menu, '')
- "count number of themes categorized by color
- let totThemes = 0
- for i in keys(a:dicts[0])
- let totThemes += len(a:dicts[0][i])
- endfor
- for color in sort(keys(a:dicts[0]))
- let numThemes = len(a:dicts[0][color])
- call add(menu, '')
- call add(menu, '"submenu '. color)
- for theme in sort(keys(a:dicts[0][color]))
- call add(menu, '9000amenu '. s:menuName. '.&Colors\ ('. totThemes . ').'
- \. color . '\ ('. numThemes . ').'
- \. a:dicts[0][color][theme]. ' :colo '. theme . '<CR>')
- endfor
- endfor
- call add(menu, '"Themes by name:')
- call add(menu, '')
- "count number of themes categorized by name
- let totThemes = 0
- for i in keys(a:dicts[1])
- let totThemes += len(a:dicts[1][i])
- endfor
- for letter in sort(keys(a:dicts[1]))
- let numThemes = len(a:dicts[1][letter])
- call add(menu, '')
- call add(menu, '"submenu '. letter)
- for theme in sort(keys(a:dicts[1][letter]))
- call add(menu, 'amenu '. s:menuName. '.&Names\ (' . totThemes . ').'
- \. letter . '\ ('. numThemes .').'
- \. a:dicts[1][letter][theme] . ' :colo '. theme . '<CR>')
- endfor
- endfor
-
- call add(menu, '')
- "add a separator and a command to re-init the menu
- call add(menu, 'amenu ' . s:menuName .'.-Sep- :')
- call add(menu, 'amenu ' . s:menuName .'.Reload\ Menu :ReloadColors<CR>')
- call add(menu, 'amenu ' . s:menuName .'.Refresh\ Menu :RefreshColors<CR>')
- call add(menu, '')
- call add(menu, 'command! -nargs=0 ReloadColors call <SID>ReloadColors()')
- call add(menu, 'command! -nargs=0 RefreshColors call <SID>RefreshColors()')
- call add(menu, '')
- call add(menu, 'if !exists("g:running_ReloadColors")')
- call add(menu, ' function! <SID>ReloadColors()')
- call add(menu, ' let g:running_ReloadColors = 1')
- call add(menu, ' aunmenu ' . s:menuName)
- call add(menu, " execute 'source " . s:menuFile . "'")
- call add(menu, ' unlet g:running_ReloadColors')
- call add(menu, " echomsg 'Done Reloading " . s:menuFile . "'")
- call add(menu, ' endfunction')
- call add(menu, 'endif')
-
- call add(menu, 'if !exists("g:running_RefreshColors")')
- call add(menu, ' function! <SID>RefreshColors()')
- call add(menu, ' let g:running_RefreshColors = 1')
- call add(menu, ' call WriteColorSchemeMenu()')
- call add(menu, ' call <SID>ReloadColors()')
- call add(menu, ' unlet g:running_RefreshColors')
- call add(menu, " echomsg 'Done Refreshing " . s:menuFile . "'")
- call add(menu, ' endfunction')
- call add(menu, 'endif')
-
- return menu
-endfunction "}}}
-
-function! WriteColorSchemeMenu() "{{{
- "Builds the menu from the two dicts returned by ScanThemeBackground()
- "Stores menu in first plugin dir specified by &rtp
- let menu = <SID>BuildMenu(<SID>ScanThemeBackground())
- call writefile(menu, s:menuFile)
-endfunction "}}}
-
-function! <SID>InitMenu() "{{{
- call WriteColorSchemeMenu()
- execute "source " . s:menuFile
-endfunction "}}}
-
-"}}}
-
-" Restore &cpo: {{{1
-let &cpo= s:keepcpo
-unlet s:keepcpo
-"}}}1
-
-"Detect absence of ColorScheme menu, and generate a new one automatically
-if !filereadable(s:menuFile) "{{{
- echomsg "Creating ColorScheme menu - Please Wait..."
- call <SID>InitMenu()
- echomsg "Done!"
-endif "}}}
-
-" vim: tabstop=4 foldmethod=marker
View
1,761 plugin/fugitive.vim
0 additions, 1,761 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
340 plugin/rails.vim
@@ -1,340 +0,0 @@
-" rails.vim - Detect a rails application
-" Author: Tim Pope <vimNOSPAM@tpope.org>
-" GetLatestVimScripts: 1567 1 :AutoInstall: rails.vim
-" URL: http://rails.vim.tpope.net/
-
-" Install this file as plugin/rails.vim. See doc/rails.txt for details. (Grab
-" it from the URL above if you don't have it.) To access it from Vim, see
-" :help add-local-help (hint: :helptags ~/.vim/doc) Afterwards, you should be
-" able to do :help rails
-
-if exists('g:loaded_rails') || &cp || v:version < 700
- finish
-endif
-let g:loaded_rails = 1
-
-" Utility Functions {{{1
-
-function! s:error(str)
- echohl ErrorMsg
- echomsg a:str
- echohl None
- let v:errmsg = a:str
-endfunction
-
-function! s:autoload(...)
- if !exists("g:autoloaded_rails") && v:version >= 700
- runtime! autoload/rails.vim
- endif
- if exists("g:autoloaded_rails")
- if a:0
- exe a:1
- endif
- return 1
- endif
- if !exists("g:rails_no_autoload_warning")
- let g:rails_no_autoload_warning = 1
- if v:version >= 700
- call s:error("Disabling rails.vim: autoload/rails.vim is missing")
- else
- call s:error("Disabling rails.vim: Vim version 7 or higher required")
- endif
- endif
- return ""
-endfunction
-
-" }}}1
-" Configuration {{{
-
-function! s:SetOptDefault(opt,val)
- if !exists("g:".a:opt)
- let g:{a:opt} = a:val
- endif
-endfunction
-
-call s:SetOptDefault("rails_statusline",1)
-call s:SetOptDefault("rails_syntax",1)
-call s:SetOptDefault("rails_mappings",1)
-call s:SetOptDefault("rails_abbreviations",1)
-call s:SetOptDefault("rails_ctags_arguments","--languages=-javascript")
-call s:SetOptDefault("rails_default_file","README")
-call s:SetOptDefault("rails_root_url",'http://localhost:3000/')
-call s:SetOptDefault("rails_modelines",0)
-call s:SetOptDefault("rails_menu",!has('mac'))
-call s:SetOptDefault("rails_gnu_screen",1)
-call s:SetOptDefault("rails_history_size",5)
-call s:SetOptDefault("rails_generators","controller\ngenerator\nhelper\nintegration_test\nmailer\nmetal\nmigration\nmodel\nobserver\nperformance_test\nplugin\nresource\nscaffold\nscaffold_controller\nsession_migration\nstylesheets")
-if exists("g:loaded_dbext") && executable("sqlite3") && ! executable("sqlite")
- " Since dbext can't find it by itself
- call s:SetOptDefault("dbext_default_SQLITE_bin","sqlite3")
-endif
-
-" }}}1
-" Detection {{{1
-
-function! s:escvar(r)
- let r = fnamemodify(a:r,':~')
- let r = substitute(r,'\W','\="_".char2nr(submatch(0))."_"','g')
- let r = substitute(r,'^\d','_&','')
- return r
-endfunction
-
-function! s:Detect(filename)
- let fn = substitute(fnamemodify(a:filename,":p"),'\c^file://','','')
- let sep = matchstr(fn,'^[^\\/]\{3,\}\zs[\\/]')
- if sep != ""
- let fn = getcwd().sep.fn
- endif
- if fn =~ '[\/]config[\/]environment\.rb$'
- return s:BufInit(strpart(fn,0,strlen(fn)-22))
- endif
- if isdirectory(fn)
- let fn = fnamemodify(fn,':s?[\/]$??')
- else
- let fn = fnamemodify(fn,':s?\(.*\)[\/][^\/]*$?\1?')
- endif
- let ofn = ""
- let nfn = fn
- while nfn != ofn && nfn != ""
- if exists("s:_".s:escvar(nfn))
- return s:BufInit(nfn)
- endif
- let ofn = nfn
- let nfn = fnamemodify(nfn,':h')
- endwhile
- let ofn = ""
- while fn != ofn
- if filereadable(fn . "/config/environment.rb")
- return s:BufInit(fn)
- endif
- let ofn = fn
- let fn = fnamemodify(ofn,':s?\(.*\)[\/]\(app\|config\|db\|doc\|features\|lib\|log\|public\|script\|spec\|stories\|test\|tmp\|vendor\)\($\|[\/].*$\)?\1?')
- endwhile
- return 0
-endfunction
-
-function! s:BufInit(path)
- let s:_{s:escvar(a:path)} = 1
- if s:autoload()
- return RailsBufInit(a:path)
- endif
-endfunction
-
-" }}}1
-" Initialization {{{1
-
-augroup railsPluginDetect
- autocmd!
- autocmd BufNewFile,BufRead * call s:Detect(expand("<afile>:p"))
- autocmd VimEnter * if expand("<amatch>") == "" && !exists("b:rails_root") | call s:Detect(getcwd()) | endif | if exists("b:rails_root") | silent doau User BufEnterRails | endif
- autocmd FileType netrw if !exists("b:rails_root") | call s:Detect(expand("<afile>:p")) | endif | if exists("b:rails_root") | silent doau User BufEnterRails | endif
- autocmd BufEnter * if exists("b:rails_root")|silent doau User BufEnterRails|endif
- autocmd BufLeave * if exists("b:rails_root")|silent doau User BufLeaveRails|endif
- autocmd Syntax railslog if s:autoload()|call rails#log_syntax()|endif
-augroup END
-
-command! -bar -bang -nargs=* -complete=dir Rails :if s:autoload()|call rails#new_app_command(<bang>0,<f-args>)|endif
-
-" }}}1
-" abolish.vim support {{{1
-
-function! s:function(name)
- return function(substitute(a:name,'^s:',matchstr(expand('<sfile>'), '<SNR>\d\+_'),''))
-endfunction
-
-augroup railsPluginAbolish
- autocmd!
- autocmd VimEnter * call s:abolish_setup()
-augroup END
-
-function! s:abolish_setup()
- if exists('g:Abolish') && has_key(g:Abolish,'Coercions')
- if !has_key(g:Abolish.Coercions,'l')
- let g:Abolish.Coercions.l = s:function('s:abolish_l')
- endif
- if !has_key(g:Abolish.Coercions,'t')
- let g:Abolish.Coercions.t = s:function('s:abolish_t')
- endif
- endif
-endfunction
-
-function! s:abolish_l(word)
- let singular = rails#singularize(a:word)
- return a:word ==? singular ? rails#pluralize(a:word) : singular
-endfunction
-
-function! s:abolish_t(word)
- if a:word =~# '\u'
- return rails#pluralize(rails#underscore(a:word))
- else
- return rails#singularize(rails#camelize(a:word))
- endif
-endfunction
-
-" }}}1
-" Menus {{{1
-
-if !(g:rails_menu && has("menu"))
- finish
-endif
-
-function! s:sub(str,pat,rep)
- return substitute(a:str,'\v\C'.a:pat,a:rep,'')
-endfunction
-
-function! s:gsub(str,pat,rep)
- return substitute(a:str,'\v\C'.a:pat,a:rep,'g')
-endfunction
-
-function! s:menucmd(priority)
- return 'anoremenu <script> '.(exists("$CREAM") ? 87 : '').s:gsub(g:rails_installed_menu,'[^.]','').'.'.a:priority.' '
-endfunction
-
-function! s:CreateMenus() abort
- if exists("g:rails_installed_menu") && g:rails_installed_menu != ""
- exe "aunmenu ".s:gsub(g:rails_installed_menu,'\&','')
- unlet g:rails_installed_menu
- endif
- if has("menu") && (exists("g:did_install_default_menus") || exists("$CREAM")) && g:rails_menu
- if g:rails_menu > 1
- let g:rails_installed_menu = '&Rails'
- else
- let g:rails_installed_menu = '&Plugin.&Rails'
- endif
- let dots = s:gsub(g:rails_installed_menu,'[^.]','')
- let menucmd = s:menucmd(200)
- if exists("$CREAM")
- exe menucmd.g:rails_installed_menu.'.-PSep- :'
- exe menucmd.g:rails_installed_menu.'.&Related\ file\ :R\ /\ Alt+] :R<CR>'
- exe menucmd.g:rails_installed_menu.'.&Alternate\ file\ :A\ /\ Alt+[ :A<CR>'
- exe menucmd.g:rails_installed_menu.'.&File\ under\ cursor\ Ctrl+Enter :Rfind<CR>'
- else
- exe menucmd.g:rails_installed_menu.'.-PSep- :'
- exe menucmd.g:rails_installed_menu.'.&Related\ file\ :R\ /\ ]f :R<CR>'
- exe menucmd.g:rails_installed_menu.'.&Alternate\ file\ :A\ /\ [f :A<CR>'
- exe menucmd.g:rails_installed_menu.'.&File\ under\ cursor\ gf :Rfind<CR>'
- endif
- exe menucmd.g:rails_installed_menu.'.&Other\ files.Application\ &Controller :Rcontroller application<CR>'
- exe menucmd.g:rails_installed_menu.'.&Other\ files.Application\ &Helper :Rhelper application<CR>'
- exe menucmd.g:rails_installed_menu.'.&Other\ files.Application\ &Javascript :Rjavascript application<CR>'
- exe menucmd.g:rails_installed_menu.'.&Other\ files.Application\ &Layout :Rlayout application<CR>'
- exe menucmd.g:rails_installed_menu.'.&Other\ files.Application\ &README :R doc/README_FOR_APP<CR>'
- exe menucmd.g:rails_installed_menu.'.&Other\ files.&Environment :Renvironment<CR>'
- exe menucmd.g:rails_installed_menu.'.&Other\ files.&Database\ Configuration :R config/database.yml<CR>'
- exe menucmd.g:rails_installed_menu.'.&Other\ files.Database\ &Schema :Rmigration 0<CR>'
- exe menucmd.g:rails_installed_menu.'.&Other\ files.R&outes :Rinitializer<CR>'
- exe menucmd.g:rails_installed_menu.'.&Other\ files.&Test\ Helper :Rintegrationtest<CR>'
- exe menucmd.g:rails_installed_menu.'.-FSep- :'
- exe menucmd.g:rails_installed_menu.'.Ra&ke\ :Rake :Rake<CR>'
- let menucmd = substitute(menucmd,'200 $','500 ','')
- exe menucmd.g:rails_installed_menu.'.&Server\ :Rserver.&Start\ :Rserver :Rserver<CR>'
- exe menucmd.g:rails_installed_menu.'.&Server\ :Rserver.&Force\ start\ :Rserver! :Rserver!<CR>'
- exe menucmd.g:rails_installed_menu.'.&Server\ :Rserver.&Kill\ :Rserver!\ - :Rserver! -<CR>'
- exe substitute(menucmd,'<script>','<script> <silent>','').g:rails_installed_menu.'.&Evaluate\ Ruby\.\.\.\ :Rp :call <SID>menuprompt("Rp","Code to execute and output: ")<CR>'
- exe menucmd.g:rails_installed_menu.'.&Console\ :Rscript :Rscript console<CR>'
- exe menucmd.g:rails_installed_menu.'.&Preview\ :Rpreview :Rpreview<CR>'
- exe menucmd.g:rails_installed_menu.'.&Log\ file\ :Rlog :Rlog<CR>'
- exe substitute(s:sub(menucmd,'anoremenu','vnoremenu'),'<script>','<script> <silent>','').g:rails_installed_menu.'.E&xtract\ as\ partial\ :Rextract :call <SID>menuprompt("'."'".'<,'."'".'>Rextract","Partial name (e.g., template or /controller/template): ")<CR>'
- exe menucmd.g:rails_installed_menu.'.&Migration\ writer\ :Rinvert :Rinvert<CR>'
- exe menucmd.' '.g:rails_installed_menu.'.-HSep- :'
- exe substitute(menucmd,'<script>','<script> <silent>','').g:rails_installed_menu.'.&Help\ :help\ rails :if <SID>autoload()<Bar>exe RailsHelpCommand("")<Bar>endif<CR>'
- exe substitute(menucmd,'<script>','<script> <silent>','').g:rails_installed_menu.'.Abo&ut\ :if <SID>autoload()<Bar>exe RailsHelpCommand("about")<Bar>endif<CR>'
- let g:rails_did_menus = 1
- call s:ProjectMenu()
- call s:menuBufLeave()
- if exists("b:rails_root")
- call s:menuBufEnter()
- endif
- endif
-endfunction
-
-function! s:ProjectMenu()
- if exists("g:rails_did_menus") && g:rails_history_size > 0
- if !exists("g:RAILS_HISTORY")
- let g:RAILS_HISTORY = ""
- endif
- let history = g:RAILS_HISTORY
- let menu = s:gsub(g:rails_installed_menu,'\&','')
- silent! exe "aunmenu <script> ".menu.".Projects"
- let dots = s:gsub(menu,'[^.]','')
- exe 'anoremenu <script> <silent> '.(exists("$CREAM") ? '87' : '').dots.'.100 '.menu.'.Pro&jects.&New\.\.\.\ :Rails :call <SID>menuprompt("Rails","New application path and additional arguments: ")<CR>'
- exe 'anoremenu <script> '.menu.'.Pro&jects.-FSep- :'
- while history =~ '\n'
- let proj = matchstr(history,'^.\{-\}\ze\n')
- let history = s:sub(history,'^.{-}\n','')
- exe 'anoremenu <script> '.menu.'.Pro&jects.'.s:gsub(proj,'[.\\ ]','\\&').' :e '.s:gsub(proj."/".g:rails_default_file,'[ !%#]','\\&')."<CR>"
- endwhile
- endif
-endfunction
-
-function! s:menuBufEnter()
- if exists("g:rails_installed_menu") && g:rails_installed_menu != ""
- let menu = s:gsub(g:rails_installed_menu,'\&','')
- exe 'amenu enable '.menu.'.*'
- if RailsFileType() !~ '^view\>'
- exe 'vmenu disable '.menu.'.Extract\ as\ partial'
- endif
- if RailsFileType() !~ '^\%(db-\)\=migration$' || RailsFilePath() =~ '\<db/schema\.rb$'
- exe 'amenu disable '.menu.'.Migration\ writer'
- endif
- call s:ProjectMenu()
- silent! exe 'aunmenu '.menu.'.Rake\ tasks'
- silent! exe 'aunmenu '.menu.'.Generate'
- silent! exe 'aunmenu '.menu.'.Destroy'
- if rails#app().cache.needs('rake_tasks') || empty(rails#app().rake_tasks())
- exe substitute(s:menucmd(300),'<script>','<script> <silent>','').g:rails_installed_menu.'.Rake\ &tasks\ :Rake.Fill\ this\ menu :call rails#app().rake_tasks()<Bar>call <SID>menuBufLeave()<Bar>call <SID>menuBufEnter()<CR>'
- else
- let i = 0
- while i < len(rails#app().rake_tasks())
- let task = rails#app().rake_tasks()[i]
- exe s:menucmd(300).g:rails_installed_menu.'.Rake\ &tasks\ :Rake.'.s:sub(task,':',':.').' :Rake '.task.'<CR>'
- let i += 1
- endwhile
- endif
- let i = 0
- let menucmd = substitute(s:menucmd(400),'<script>','<script> <silent>','').g:rails_installed_menu
- while i < len(rails#app().generators())
- let generator = rails#app().generators()[i]
- exe menucmd.'.&Generate\ :Rgen.'.s:gsub(generator,'_','\\ ').' :call <SID>menuprompt("Rgenerate '.generator.'","Arguments for script/generate '.generator.': ")<CR>'
- exe menucmd.'.&Destroy\ :Rdestroy.'.s:gsub(generator,'_','\\ ').' :call <SID>menuprompt("Rdestroy '.generator.'","Arguments for script/destroy '.generator.': ")<CR>'
- let i += 1
- endwhile
- endif
-endfunction
-
-function! s:menuBufLeave()
- if exists("g:rails_installed_menu") && g:rails_installed_menu != ""
- let menu = s:gsub(g:rails_installed_menu,'\&','')
- exe 'amenu disable '.menu.'.*'
- exe 'amenu enable '.menu.'.Help\ '
- exe 'amenu enable '.menu.'.About\ '
- exe 'amenu enable '.menu.'.Projects'
- silent! exe 'aunmenu '.menu.'.Rake\ tasks'
- silent! exe 'aunmenu '.menu.'.Generate'
- silent! exe 'aunmenu '.menu.'.Destroy'
- exe s:menucmd(300).g:rails_installed_menu.'.Rake\ tasks\ :Rake.-TSep- :'
- exe s:menucmd(400).g:rails_installed_menu.'.&Generate\ :Rgen.-GSep- :'
- exe s:menucmd(400).g:rails_installed_menu.'.&Destroy\ :Rdestroy.-DSep- :'
- endif
-endfunction
-
-function! s:menuprompt(vimcmd,prompt)
- let res = inputdialog(a:prompt,'','!!!')
- if res == '!!!'
- return ""
- endif
- exe a:vimcmd." ".res
-endfunction
-
-call s:CreateMenus()
-
-augroup railsPluginMenu
- autocmd!
- autocmd User BufEnterRails call s:menuBufEnter()
- autocmd User BufLeaveRails call s:menuBufLeave()
- " g:RAILS_HISTORY hasn't been set when s:InitPlugin() is called.
- autocmd VimEnter * call s:ProjectMenu()
-augroup END
-
-" }}}1
-" vim:set sw=2 sts=2:
View
30 vimrc.local
@@ -1,3 +1,33 @@
+" load pathogen "
+filetype off
+ set rtp+=~/.vim/bundle/vundle/
+ call vundle#rc()
+
+ " let Vundle manage Vundle
+ " required!
+ Bundle 'gmarik/vundle'
+
+ " My Bundles here:
+ "
+ " original repos on github
+"" Bundle 'Lokaltog/vim-easymotion'
+"" Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
+ Bundle 'tpope/vim-fugitive'
+ Bundle 'tpope/vim-rails.git'
+ Bundle 'tpope/vim-rvm.git'
+ Bundle 'tpope/vim-bundler.git'
+ Bundle 'tpope/vim-rake.git'
+ Bundle 'lucapette/vim-ruby-doc.git'
+"" " vim-scripts repos
+"" Bundle 'L9'
+"" Bundle 'FuzzyFinder'
+"" " non github repos
+"" Bundle 'git://git.wincent.com/command-t.git'
+"" " ...
+filetype plugin indent on
+
+set statusline+=%{exists('g:loaded_rvm')?rvm#statusline():''}
+
" Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>

0 comments on commit 70e7cb4

Please sign in to comment.
Something went wrong with that request. Please try again.