snippetMagic

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

snippetMagic

Jeff Rose-3
I was just heckling Gavin with questions while trying to work the kinks
out of these snippets, but I should be posting to the list anyway...

First, I'm trying to get the indentation to work correctly.  Is there by
any chance a way to query for where the current line should be indented
to?  The language indenting stuff in vim has to know this, but I'm not
sure how to use it.  I guess I could even just do "==" on each line
before and after writing text, but I'm not sure if that is correct
either.  Any advice you have would be great.

Second, what do you think is the best way for selecting the active
snippet packages?  Currently it just uses the filetype variable, but
there is a package for rails, for example, which that won't work for.
Any pointers on making menus or easy to use picklists or something?
This is the kind of stuff that a good ruby binding for vim would have
included so we can throw together functional plugins without spending
time on boilerplate stuff...(Documentation could probably be automated
too.  Maybe an rdoc to vim documentation generator or something?)  I
tried to ask around about who is working on the binding and no one
responded, including the author.  If we were to work on the binding in
this project do you think they would accept additions and/or changes?

Last, do you have any ideas on a minimally intrusive way to tell the
user that their cursor is currently in place to run a snippet?  In
TextMate a little dot comes up at the bottom, which is nice because it
lets you learn about new snippets as you code.  (So you type
"foo.each[cursor-here]" and a star shows up in the status bar or
something, which tells you that if you hit tab a snippet will be produced.)

I second Thomas's suggestions as well.  Mauricio Fernandez folding and
block conversion scripts are great, and the others look helpful.  It
would be ideal if we could create a list of features, and then inside
vim select a feature from the list, hit enter, and then press the key
combination you want to bind to it.  Basically how it's done in video
games...

-Jeff

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

Re: snippetMagic

Thomas Adam-2
Jeff,

On Wed, Feb 15, 2006 at 01:24:24PM +0100, Jeff Rose wrote:

I have to ask Jeff (whether it's just me being naive I couldn't say) --
but where would I find your snippets implemetation.  What is it, even?
:)

> First, I'm trying to get the indentation to work correctly. Is there
> by any chance a way to query for where the current line should be
> indented to? The language indenting stuff in vim has to know this,
> but I'm not sure how to use it. I guess I could even just do "==" on
> each line before and after writing text, but I'm not sure if that is
> correct either. Any advice you have would be great.

Well, the indenting stuff works by vim evaluating the given syntax
within the specified filetype.  When you say "current line" -- I assume
you mean the line which has the cursor on it?  Paradoxically if that's
the case, the indentation ought to have already taken place.   But
you're right, == is certainly one way of doing it.

> Second, what do you think is the best way for selecting the active
> snippet packages? Currently it just uses the filetype variable, but
> there is a package for rails, for example, which that won't work for.
> Any pointers on making menus or easy to use picklists or something?

Hmm.  Filetypes are all well and good, but there are of course instances
when this not desirable.  I suppose what you could do in that case is
get Vim to read modelines, but the issue here is that Vim might not be
setup to use them, or the entry for the necessary modeline is not
present within the file beforehand.

I had this issue when I was looking at FVWM syntax.  The way I got
around it (essentially distinguishing between version 1 and version 2)
was to set a buffer which then toggled between the two.  Ultimately
overkill, of course.

> This is the kind of stuff that a good ruby binding for vim would have
> included so we can throw together functional plugins without spending
> time on boilerplate stuff...(Documentation could probably be automated
> too. Maybe an rdoc to vim documentation generator or something?) I
> tried to ask around about who is working on the binding and no one
> responded, including the author. If we were to work on the binding in
> this project do you think they would accept additions and/or changes?

I would have thought so, yes.

> Last, do you have any ideas on a minimally intrusive way to tell
> the user that their cursor is currently in place to run a snippet?
> In TextMate a little dot comes up at the bottom, which is nice
> because it lets you learn about new snippets as you code. (So you
> type "foo.each[cursor-here]" and a star shows up in the status bar
> or something, which tells you that if you hit tab a snippet will be
> produced.)

Interesting idea.  I have never used TextMate.  I am not sure how you
would go about doing this in Vim.

> I second Thomas's suggestions as well. Mauricio Fernandez folding and
> block conversion scripts are great, and the others look helpful. It
> would be ideal if we could create a list of features, and then inside
> vim select a feature from the list, hit enter, and then press the key
> combination you want to bind to it. Basically how it's done in video
> games...

Video... what?  :)

/me cuddles moon-buggy

-- Thomas Adam

--  
I've been too honest with myself, I should have lied like everybody else.
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel