Skip to content
Merged
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
7 changes: 7 additions & 0 deletions doc/rake.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ COMMANDS *rake-commands*
Set g:rake_legacy to 1 to enable the old, legacy R command variants. This
option will eventually be removed.

*rake-ruby-c-extensions*
This plugin supports Ruby C extension files usually located under ext/.
For those C files 'path' is enhanced with correct Ruby include directory.
With this you can use |i_CTRL-X_CTRL-I| completion and |[i|, |[d| families of
mappings and commands on all the macros and functions provided by ruby.h
header file.

ABOUT *rake-about*

Grab the latest version or report a bug on GitHub:
Expand Down
20 changes: 19 additions & 1 deletion plugin/rake.vim
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,21 @@ function! s:project_path(...) dict abort
return join([self._root]+a:000,'/')
endfunction

call s:add_methods('project',['path'])
function! s:project_ruby_include_path() dict abort
if !has_key(self, '_ruby_include_path')
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd'
let cwd = getcwd()
try
execute cd fnameescape(self.path())
let self._ruby_include_path = system('ruby -rrbconfig -e "print RbConfig::CONFIG[\"rubyhdrdir\"] || RbConfig::CONFIG[\"topdir\"]"')
finally
execute cd fnameescape(cwd)
endtry
endif
return self._ruby_include_path
endfunction

call s:add_methods('project',['path','ruby_include_path'])

" }}}1
" Rake {{{1
Expand Down Expand Up @@ -323,6 +337,10 @@ augroup rake_path
\ let &l:path = escape(s:project().path('lib'),', ')
\ . ',' . escape(s:project().path('ext'),', ') . ',' . &path |
\ endif
autocmd User Rake
\ if &filetype ==# 'c' || &filetype ==# 'cpp' |
\ let &l:path = escape(s:project().ruby_include_path(),', ') . ',' . &path |
\ endif
augroup END

" }}}1
Expand Down