Vim snippets

26 views
Skip to first unread message

steveno

unread,
May 17, 2012, 3:36:25 PM5/17/12
to falc...@googlegroups.com
This goes out to anyone on the list who's writing falcon using Vim. As some of you may know there is a vim plugin called snippets that allows you to quickly template out new pieces of code and then fill in the variables. Very neat stuff; honestly I never use it.

For those that do, though, a while back I contributed a very basic set of templates for it. The latest versions can be found here and I personally recommend vundle if you're going to start using them.

I'm bringing this up because I'd like to know if anyone has any suggestions for new snippets or suggestions of improvement for current ones? I'm shortly going to add Try..Catch, Switch, and Select statements. Admittedly, when I do code in falcon I use a very small subset of what the language has to offer but I'm more than willing to expand on any of the tools I've contributed to help others take full advantage of the language.

And by the way, for anyone who doesn't know, falcon highlighting and indentation is included upstream with Vim so you get it by default assuming you install a new enough version.



Paul Nema

unread,
May 17, 2012, 5:09:31 PM5/17/12
to falc...@googlegroups.com
Not that familiar with vim snippets so the below may already be
included with your snippets.

Something that would speed up coding and help to reduce errors:

1. The equivalent of parenthesis matching (using the '%' to match
paren's) but with if/end, switch/end, etc

or

2. A different color for each level of indenting for the words if/end.
Either the color of the if/end changes with each level of indent or
all the text between each level of indented if/end changes.

One of the examples from above:

if cond1 (color blue)
if cond2 (color blue-green)
if condA (color green)
end (color green)
end (color blue-green)

if cond3 (color blue-green)
end (color blue-green)
end (color blue)


On 5/17/12, steveno <oliver...@gmail.com> wrote:
> This goes out to anyone on the list who's writing falcon using Vim. As some
> of you may know there is a vim plugin called snippets that allows you to
> quickly template out new pieces of code and then fill in the variables.
> Very neat stuff; honestly I never use it.
>
> For those that do, though, a while back I contributed a very basic set of
> templates for it. The latest versions can be found
> here<https://github.com/honza/snipmate-snippets>and I personally recommend
> vundle <https://github.com/gmarik/vundle> if you're going to start using
> them.
>
> I'm bringing this up because I'd like to know if anyone has any suggestions
> for new snippets or suggestions of improvement for current ones? I'm
> shortly going to add Try..Catch, Switch, and Select statements. Admittedly,
> when I do code in falcon I use a very small subset of what the language has
> to offer but I'm more than willing to expand on any of the tools I've
> contributed to help others take full advantage of the language.
>
> And by the way, for anyone who doesn't know, falcon highlighting and
> indentation is included upstream with Vim so you get it by default assuming
> you install a new enough version.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "FalconPL" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/falconpl/-/X6ZwKhqCGw4J.
> To post to this group, send email to falc...@googlegroups.com.
> To unsubscribe from this group, send email to
> falconpl+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/falconpl?hl=en.
>
>

Steven Oliver

unread,
May 17, 2012, 8:58:46 PM5/17/12
to falc...@googlegroups.com
The first is definitely doable actually. Neither of them would be done through snippets though.

It's been so long since I played with the syntax highlighter code

Steven Oliver

unread,
May 17, 2012, 9:06:09 PM5/17/12
to falc...@googlegroups.com
Sorry, I didn't finish my last email before accidentally hitting the send button.

Anyway, both of those would be accomplished through the syntax code; that is assuming vim can do the second one. I've never seen anything like that. Great idea though!

The snippets would would really help with the first one because it writes out the if statement for you then guides you through filling in the blanks.

Either way I'll see what I can do for you.

steveno

unread,
May 18, 2012, 9:07:02 AM5/18/12
to falc...@googlegroups.com

Paul,
I have attached a screenshot of some syntax highlighting code I borrowed from the Lisp guys. Is that the kind of thing you had in mind? Several other languages have implemented something similar. They all refer to it as the %_rainbow (python_rainbow, lisp_rainbow, etc.).
example.PNG

Paul Nema

unread,
May 18, 2012, 10:28:02 AM5/18/12
to falc...@googlegroups.com
OS

Screen shot looks good. The outlook email pop up threw me off. Was
wondering why it wasn't going away until I realized it was part of the
screen shot...

On the color coding for block level syntax (I.E. color for either
if/end words or text between if/end) I'll start investigating next
week. Let me know if you find out anything with your investigations.
I'll also download your snippets and falcon_rainbow over the weekend
and give them a test ride.

Thanks
> --
> You received this message because you are subscribed to the Google Groups
> "FalconPL" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/falconpl/-/8r02xQwxtRUJ.

Steven Oliver

unread,
May 18, 2012, 1:33:20 PM5/18/12
to falc...@googlegroups.com
The rainbow code is built into the syntax file. I keep a github repository of it and play it with some before I send updates upstream to Bram.

You can get the new syntax file here:
https://github.com/steveno/falconpl-vim/tree/master/syntax

In order to see it in your code, you'll have to add this to your vimrc:
"----------------------------------------------
" Falcon options
"----------------------------------------------

" falcon rainbow highlighting
let g:falcon_rainbow=1

Steven N. Oliver
Reply all
Reply to author
Forward
0 new messages