Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion autoload/rubycomplete.vim
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ class VimRubyCompletion
$LOAD_PATH.concat(custom_paths).uniq!
end

VIM::evaluate("get(g:, 'rubycomplete_auto_require', [])").each do |f|
require File.expand_path(f)
end

buf = VIM::Buffer.current
enum = buf.line_number
nums = Range.new( 1, enum )
Expand Down Expand Up @@ -386,7 +390,7 @@ class VimRubyCompletion
next if x == 0
ln = buf[x]
is_const = false
if /^\s*(module|class|def|include)\s+/.match(ln) || is_const = /^\s*?[A-Z]([A-z]|[1-9])*\s*?[|]{0,2}=\s*?.+\s*?/.match(ln)
if /^\s*(module|class|def|include)\s+/.match(ln) || is_const = /^\s*?[A-Z]([A-z]|[1-9])*\s*?[|]{0,2}=\s*?.+\s*?/.match(ln) || /attr_(accessor|reader|writer)/.match(ln)
clscnt += 1 if /class|module/.match($1)
# We must make sure to load each constant only once to avoid errors
if is_const
Expand Down
5 changes: 3 additions & 2 deletions doc/ft-ruby-omni.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Notes:
< To use custom paths that should be added to $LOAD_PATH to correctly
resolve requires, set: >
let g:rubycomplete_load_paths = ["/path/to/code", "./lib/example"]


< For automatically loading files (for example if a project has a bootstrap
file with a bunch of require statements) set: >
let g:rubycomplete_auto_require = ["/path/to/file.rb", "./lib/hello.rb"]
vim:tw=78:sw=4:ts=8:ft=help:norl: