[PATCH] Suggestion for updated ftplugin/ruby.vim

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

[PATCH] Suggestion for updated ftplugin/ruby.vim

Nikolai Weibull-5
These are other additions to ftplugin/ruby.vim found in Ned Konz script.
I think that they make sense in almost any setting, so they should go in
the distribution.  Comments before I commit?,
        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: [PATCH] Suggestion for updated ftplugin/ruby.vim

Doug Kearns
On Sun, Aug 28, 2005 at 01:53:52PM +0200, Nikolai Weibull wrote:
> These are other additions to ftplugin/ruby.vim found in Ned Konz script.
> I think that they make sense in almost any setting, so they should go in
> the distribution.  Comments before I commit?,

Because I'm lazy can you point me to Ned's script?

You might want to search the archives since this came up when Gavin was
first organising the project. I don't remember the details but he was
certainly conservative.

That said, given your 100 odd ftplugins you are the master... ;-)

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: [PATCH] Suggestion for updated ftplugin/ruby.vim

Nikolai Weibull-5
Doug Kearns wrote:

> On Sun, Aug 28, 2005 at 01:53:52PM +0200, Nikolai Weibull wrote:

> > These are other additions to ftplugin/ruby.vim found in Ned Konz script.
> > I think that they make sense in almost any setting, so they should go in
> > the distribution.  Comments before I commit?,

> Because I'm lazy can you point me to Ned's script?

http://bike-nomad.com/vim/ruby.vim

I am, however, doubtful about setting iskeyword to include ':'.  The
reason for doing so is that we have stuff like ConstantA::ConstantB kind
of stuff and that we want to be able to treat that as one thing on
occasion.  I think, however, that this causes too many issues with other
stuff to be reasonable.

> You might want to search the archives since this came up when Gavin was
> first organising the project. I don't remember the details but he was
> certainly conservative.

It seems it hasn't changed since
http://rubyforge.org/pipermail/vim-ruby-devel/2003q3/000073.html.

> That said, given your 100 odd ftplugins you are the master... ;-)

I'm taking Vim one step closer to becoming Emacs per file :-D.

Here's another thing I've been playing with, but I have the feeling that
electricity isn't something that most Vim-users appreciate...What do you
think?  (Btw, that regex isn't quite right...I'll have to fix that.)

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

It automatically inserts a matching 'end' when necessary.

Totally off-topic:

By the way, do you know why pasting text selected in conkeror is so
slow?,
        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

ruby.vim (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Suggestion for updated ftplugin/ruby.vim

Doug Kearns
On Sun, Aug 28, 2005 at 06:39:43PM +0200, Nikolai Weibull wrote:
> Doug Kearns wrote:

<snip>
 
> > Because I'm lazy can you point me to Ned's script?
>
> http://bike-nomad.com/vim/ruby.vim

Sorry I didn't notice it was included in the header of our ftplugin -
see laziness above. ;-)
 
> I am, however, doubtful about setting iskeyword to include ':'.  The
> reason for doing so is that we have stuff like ConstantA::ConstantB kind
> of stuff and that we want to be able to treat that as one thing on
> occasion.  I think, however, that this causes too many issues with other
> stuff to be reasonable.

I agree. I don't actually think I'd want to match that rather than the
individual constant names very often. Then you need to ask whether '@',
and '$' etc should be included as well? I'm happy with the default for
now.

We should probably include the browsefilter setting and I'm not sure
that your redefinition of 'define' to search for method definitions
makes sense... That seems like a job for ctags.

Other than that, it looks good to me. Thanks.

<snip>
 

> Here's another thing I've been playing with, but I have the feeling that
> electricity isn't something that most Vim-users appreciate...What do you
> think?  (Btw, that regex isn't quite right...I'll have to fix that.)
>
> 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
>
> It automatically inserts a matching 'end' when necessary.

I like it. Pit Capitain has submitted a similar patch to the tracker and
I've been thinking about a good way to include some of these 'extras'.
Do you have any more?
 
> Totally off-topic:
>
> By the way, do you know why pasting text selected in conkeror is so
> slow?,

No, sorry. I haven't experienced any slowness. How are you selecting it?

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: [PATCH] Suggestion for updated ftplugin/ruby.vim

Nikolai Weibull-5
Doug Kearns wrote:

> > http://bike-nomad.com/vim/ruby.vim
>
> Sorry I didn't notice it was included in the header of our ftplugin -
> see laziness above. ;-)
 
No problem :-).

> > I am, however, doubtful about setting iskeyword to include ':'.  The
> > reason for doing so is that we have stuff like ConstantA::ConstantB
> > kind of stuff and that we want to be able to treat that as one thing
> > on occasion.  I think, however, that this causes too many issues
> > with other stuff to be reasonable.

> I agree. I don't actually think I'd want to match that rather than the
> individual constant names very often. Then you need to ask whether
> '@', and '$' etc should be included as well? I'm happy with the
> default for now.

Mm.

> We should probably include the browsefilter setting and I'm not sure
> that your redefinition of 'define' to search for method definitions
> makes sense... That seems like a job for ctags.
 
Yeah, browsefilter would be nice I suppose.  'define' may not so much.

> > Here's another thing I've been playing with, but I have the feeling
> > that electricity isn't something that most Vim-users
> > appreciate...What do you think?  (Btw, that regex isn't quite
> > right...I'll have to fix that.)

> > 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

> > It automatically inserts a matching 'end' when necessary.

> I like it. Pit Capitain has submitted a similar patch to the tracker and
> I've been thinking about a good way to include some of these 'extras'.
> Do you have any more?

No, that's about it.  His version is in a sense better, as it works fine
while pasting code.  Mine will add extra ends when pasting.  I guess one
could hide it behind some variable, like b:ruby_electric_enter or
something similar.

> > By the way, do you know why pasting text selected in conkeror is so
> > slow?,

> No, sorry. I haven't experienced any slowness. How are you selecting it?

Well, either with the mouse (yuck), or manually with keys (which is
rather difficult).  Then, when I try to paste in Vim, it takes like 3
seconds for Vim to grab the selection and actually insert it.  Very
weird.  No such problem with plain Firefox,
        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: [PATCH] Suggestion for updated ftplugin/ruby.vim

Doug Kearns
On Mon, Aug 29, 2005 at 11:20:25AM +0200, Nikolai Weibull wrote:
> Doug Kearns wrote:

<snip>
 
> > We should probably include the browsefilter setting and I'm not sure
> > that your redefinition of 'define' to search for method definitions
> > makes sense... That seems like a job for ctags.
>  
> Yeah, browsefilter would be nice I suppose.  'define' may not so much.

I've committed this with the 'define' line commented out, for now, and
I've added the browsefilter variable.

<snip>
 
Thanks,
Doug
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel