Sublime Forum

An attempt at describing Bracketeer

#1

There were a few quirky pasting and indenting issues that I was getting frustrated with, and I hadn’t really figured out the userecho bug report system (still haven’t — I wish it had “real” bug/issue/feature tracking abilities).

So I wrote bracketeer, and now I continue to like it since, well for one it works, but more because it lets me tweak with bracket-typing behavior. For instance, I can hit ctrl+',ctrl+' to start writing a python doc comment. Or that typing a ’ inside “” does not produce double 's, just a single apostrophe.

I’ve also tried to figure out good indent, unindent behavior when typing {,}. At this point I think Jon has probably done a better job, but I haven’t disabled my plugin to find out, hopefully some discussion here will shine some light on that.

I didn’t just recreate the wheel, I also added a few bracket-manipulation commands. Here is the entire list of commands:

  • bracketeer_indent
    : I have a particular way I like text to be indented, involving not indenting the last line my cursor is on, ignoring the first unless it’s at the first col, not indenting blank lines, and not indenting <?php / ?> tags if they are at the beginning of the line. If you don’t like it, don’t use it :wink:
  • bracketeer_select
    : I think you’ll like this one. Selects inside the current braces, then selects the braces themselves, and so on until the outermost brackets are selected. Useful for grabbing blocks of code in C-style languages, or argument lists in python.
  • bracketeer
    : the namesake command inserts braces or quotes and is configurable to some degree. Again, you might no like it, but if you do like it, you might love it!
  • bracketeer_goto
    : This one is neat, especially when passed {“goto”:“both”}. It will place two cursors: one to the right of the left brace, and one to the right of the right brace. Matches curly braces only. In this way, it is really easy to remove the curly braces around one liners, if you’re cleaning up if…else if…else blocks.

The best source of documentation is my Example.sublime-keymap file.

Did you know, the Example.sublime-keymap file is generated based on my Default (OSX).sublime-keymap file? It’s the same with all my plugins. So anytime I fix something or add something, it gets “documented” in that file! Neat.

0 Likes

#2

Hey, do you have a link to the repo? :smile:

0 Likes

#3

How embarrassing! Of course:

https://github.com/colinta/SublimeBracketeer

And available on Package Control (“Bracketeer”)

0 Likes