installing vim-ruby

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

installing vim-ruby

Mark Volkmann-2
Here's what I did to install vim-ruby.

gem install vim-ruby
ruby vim-ruby-install.rb (from my RUBY_HOME/bin directory)

I don't get errors from either of these.

I have the following in my .vimrc file (_vimrc under Windows).

      set nocompatible      " We're running Vim, not Vi!
      syntax on             " Enable syntax highlighting
      filetype on           " Enable filetype detection
      filetype indent on    " Enable filetype-specific indenting
      filetype plugin on    " Enable filetype-specific plugins

When I start a new vim session and edit a .rb file, it doesn't appear
to have vim-ruby features enabled. For example, when I enter "if name
== "John" and press shift-Enter, it moves to the next line and indents
two spaces, but it does not add "end" to the subsequent line.

I've tried this under both Windows and Fedora Core 4 Linux and get the
same result.

Under Linux in my ~/.vim directory I have
  compiler
    eruby.vim
    rubyunit.vim
    ruby.vim
  ftdetect
    ruby.vim
  ftplugin
    eruby.vim
    ruby.vim
  indent
    eruby.vim
    ruby.vim
  syntax
    eruby.vim
    ruby.vim

Am I missing a step to get vim-ruby installed correctly?

--
R. Mark Volkmann
Partner, Object Computing, Inc.

_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: installing vim-ruby

Nikolai Weibull-5
Mark Volkmann wrote:

> Here's what I did to install vim-ruby.
>
> gem install vim-ruby
> ruby vim-ruby-install.rb (from my RUBY_HOME/bin directory)
>
> I don't get errors from either of these.

Hooray.

> I have the following in my .vimrc file (_vimrc under Windows).
>
>       set nocompatible      " We're running Vim, not Vi!

'compatible' is unset by default if you run vim or gvim (i.e., when
sourcing .vimrc or .gvimrc - or _vimrc, :h 'compatible' for more
information).  

>       syntax on             " Enable syntax highlighting
>       filetype on           " Enable filetype detection
>       filetype indent on    " Enable filetype-specific indenting
>       filetype plugin on    " Enable filetype-specific plugins

The last three can be written as

filetype plugin indent on

> When I start a new vim session and edit a .rb file, it doesn't appear
> to have vim-ruby features enabled. For example, when I enter "if name
> == "John" and press shift-Enter, it moves to the next line and indents
> two spaces, but it does not add "end" to the subsequent line.

How is that an example of what vim-ruby should do?  The Shift-Enter
auto-completion code isn’t in vim-ruby.  That’s something Pit Captain
has added to the rubygarden wiki so that you can added to your own
~/.vim/(after/)?ftplugin/ruby.vim if you want to.

Here’s an even sweeter binding that I use in my
~/.vim/after/ftplugin/ruby.vim:

inoremap <buffer> <CR> <C-O>:call <SID>CompleteStatement()<CR><CR>

function! s:CompleteStatement()
  " TODO: we can check contents of ". register to make sure that they were
  " inserted while typing here...
  if getline('.') =~ '^\s*\%(begin\|case\|class\|def\|for\|if\|module\|unless\|until\|while\)\>\|do\%(\s*|[^|]*|\s*\)\=$'
    let n = indent('.')
    let ind = ''
    let i = 0
    while i < n
      let ind .= ' '
      let i += 1
    endwhile
    call append(line('.'), ind . 'end')
  endif
endfunction

> Am I missing a step to get vim-ruby installed correctly?

No, but you can’t expect it to do stuff not advertised,
        nikolai

--
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: installing vim-ruby

Doug Kearns
In reply to this post by Mark Volkmann-2
G'day Mark,

On Tue, Oct 11, 2005 at 02:41:11PM -0500, Mark Volkmann wrote:

<snip>
 
> When I start a new vim session and edit a .rb file, it doesn't appear
> to have vim-ruby features enabled. For example, when I enter "if name
> == "John" and press shift-Enter, it moves to the next line and indents
> two spaces, but it does not add "end" to the subsequent line.

As Nikolai has pointed out this is not yet included with the distributed
files. Are you particularly interested in this sort of functionality
being included or were you just testing the installation?

I ask because I'd be happy to add these sorts of helper functions but as
I don't use them myself I'd probably need a nudge. ;-)

<snip>

Regards,
Doug
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: installing vim-ruby

Nikolai Weibull-5
Doug Kearns wrote:

> I ask because I'd be happy to add these sorts of helper functions but as
> I don't use them myself I'd probably need a nudge. ;-)

I think that we should ask Bram about this.  There should be some
standard way of disabling/enabling this on a global scale and on a
filetype scale, i.e., behind some if exists("...") test or some such,
perhaps

if exists("g:electric_keys") or exists("g:ruby_electric_keys")
  ...
endif

Something along those lines,
        nikolai

--
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: installing vim-ruby

Mark Volkmann-2
In reply to this post by Doug Kearns
On 10/12/05, Doug Kearns <[hidden email]> wrote:

> G'day Mark,
>
> On Tue, Oct 11, 2005 at 02:41:11PM -0500, Mark Volkmann wrote:
>
> <snip>
>
> > When I start a new vim session and edit a .rb file, it doesn't appear
> > to have vim-ruby features enabled. For example, when I enter "if name
> > == "John" and press shift-Enter, it moves to the next line and indents
> > two spaces, but it does not add "end" to the subsequent line.
>
> As Nikolai has pointed out this is not yet included with the distributed
> files. Are you particularly interested in this sort of functionality
> being included or were you just testing the installation?

Both. I was reading quickly when I saw that functionality described at
http://rubygarden.com/ruby?VimRubySupport. I incorrectly assumed that
it was describing customizations to vim provided by vim-ruby. I
understand now that it was describing customizations beyond what
vim-ruby provides.

I think it would be nice if each release of vim-ruby had a version
number associated with it and there was a vim command you could run to
find out what version you have ... like running "ruby -v" to find out
what version of Ruby is installed. Maybe there's already a way to do
that and I just haven't stumbled across it.

Is there a web page that provides a complete list of the features that
vim-ruby provides?

--
R. Mark Volkmann
Partner, Object Computing, Inc.

_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: installing vim-ruby

Gavin Sinclair
On 10/13/05, Mark Volkmann <[hidden email]> wrote:
> I think it would be nice if each release of vim-ruby had a version
> number associated with it and there was a vim command you could run to
> find out what version you have ... like running "ruby -v" to find out
> what version of Ruby is installed. Maybe there's already a way to do
> that and I just haven't stumbled across it.

There's probably no way at present.  Something to consider.

> Is there a web page that provides a complete list of the features that
> vim-ruby provides?

I hope to provide that at http://vim-ruby-rubyforge.org after a
documentation overhaul.

Gavin

_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel