# Bro script spacing

**URL:** <https://community.zeek.org/t/bro-script-spacing/2786>\
**Category:** Zeek\
**Created:** [August 22, 2013, 7:06pm UTC](https://community.zeek.org/t/bro-script-spacing/2786 "2013-08-22T19:06:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![JP\_Bourget](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@JP\_Bourget](https://community.zeek.org/u/JP_Bourget)\
**Post date:** [August 22, 2013, 7:06pm UTC](https://community.zeek.org/t/bro-script-spacing/2786/1 "2013-08-22T19:06:20Z")

</div>

Hello,

I hear there is a "style/format" for spacing syntax in bro scripts. Where can I become familiar with this?

JP

---

<div class="post-metadata">

**Author:** ![Matthias\_Vallentin1](https://yyz1.discourse-cdn.com/flex011/user_avatar/community.zeek.org/matthias_vallentin1/32/596_2.png) [@Matthias\_Vallentin1](https://community.zeek.org/u/Matthias_Vallentin1)\
**Post date:** [August 22, 2013, 7:24pm UTC](https://community.zeek.org/t/bro-script-spacing/2786/2 "2013-08-22T19:24:24Z")

</div>

> I hear there is a "style/format" for spacing syntax in bro scripts. Where can I become familiar with this?

The indentation is called Whitesmiths style [1]. We currently don't  
have an exact guideline, for example like Google's style guide [2].  
Maybe some editors have the ability to explicitly set a style. At  
least in Vim, you can use this:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;autocmd FileType bro set noexpandtab cino='\>1s,f1s,{1s'

This gives you reasonably close support for brace placement. (It also  
assumes you have a Bro syntax plugin.)

I'm curious how others have tweaked their editors, not for syntax  
highlighting, but to get an efficient and style-compatible working  
environment.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Matthias

[1] [Indentation style - Wikipedia](http://en.wikipedia.org/wiki/Indent_style#Whitesmiths_style)  
[2] [GitHub - google/styleguide: Style guides for Google-originated open-source projects](https://code.google.com/p/google-styleguide/)

---

<div class="post-metadata">

**Author:** ![robin](https://yyz1.discourse-cdn.com/flex011/user_avatar/community.zeek.org/robin/32/599_2.png) [@robin](https://community.zeek.org/u/robin)\
**Post date:** [August 22, 2013, 8:39pm UTC](https://community.zeek.org/t/bro-script-spacing/2786/3 "2013-08-22T20:39:54Z")

</div>

Btw, I'd very much like to have a "formatting mode" in Bro that  
reformats a given script into a standard style. We could then run that  
consistently over all the standard scripts, and users could use it  
adapt their own ones accordingly. Should actually not be too hard to  
implement for somebody who's a bit familiar with C++.

Robin

---

<div class="post-metadata">

**Author:** ![Slagell\_Adam\_J](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@Slagell\_Adam\_J](https://community.zeek.org/u/Slagell_Adam_J)\
**Post date:** [August 22, 2013, 8:45pm UTC](https://community.zeek.org/t/bro-script-spacing/2786/4 "2013-08-22T20:45:12Z")

</div>

I could have sworn someone has made an emacs mode for Bro scripts and posted that to the list once.

---

<div class="post-metadata">

**Author:** ![Slagell\_Adam\_J](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@Slagell\_Adam\_J](https://community.zeek.org/u/Slagell_Adam_J)\
**Post date:** [August 22, 2013, 8:52pm UTC](https://community.zeek.org/t/bro-script-spacing/2786/5 "2013-08-22T20:52:24Z")

</div>

Yes, Scott did it.

[https://github.com/srunnels/bro-mode](https://github.com/srunnels/bro-mode)

---

<div class="post-metadata">

**Author:** ![Scott\_Runnels](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@Scott\_Runnels](https://community.zeek.org/u/Scott_Runnels)\
**Post date:** [August 22, 2013, 8:59pm UTC](https://community.zeek.org/t/bro-script-spacing/2786/6 "2013-08-22T20:59:41Z")

</div>

That was me. [http://github.com/srunnels/bro-mode](http://github.com/srunnels/bro-mode)

It needs some work to catch up to some of the new changes though.

If Bro wants to make it’s official stance “just use emacs”, hey I’m totally in! 🙂

---

<div class="post-metadata">

**Author:** ![JP\_Bourget](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@JP\_Bourget](https://community.zeek.org/u/JP_Bourget)\
**Post date:** [August 22, 2013, 9:18pm UTC](https://community.zeek.org/t/bro-script-spacing/2786/7 "2013-08-22T21:18:39Z")

</div>

Mathias,

Thanks man! This makes sense - I wonder is Seth or someone has a trick to get this work in Sublime Text - I’ll try and find one myself and post it if I can.

JP

---

<div class="post-metadata">

**Author:** ![Charles\_A\_Fair](https://avatars.discourse-cdn.com/v4/letter/c/cdc98d/32.png) [@Charles\_A\_Fair](https://community.zeek.org/u/Charles_A_Fair)\
**Post date:** [August 22, 2013, 10:55pm UTC](https://community.zeek.org/t/bro-script-spacing/2786/8 "2013-08-22T22:55:08Z")

</div>

Courtesy of being pointed out by Chris Crawford:

[http://liamrandall.com/syntax-highlighting-for-bro-network-programming-language/](http://liamrandall.com/syntax-highlighting-for-bro-network-programming-language/)  
[http://www.appliednsm.com/syntax-highlighting-for-bro-for-nano/](http://www.appliednsm.com/syntax-highlighting-for-bro-for-nano/)

Also:  
[https://dl.dropboxusercontent.com/u/4303535/Screencasts/bro-mode.mpg](https://dl.dropboxusercontent.com/u/4303535/Screencasts/bro-mode.mpg)

Charles “Chuck” A. Fair  
[charles.fair@mac.com](mailto:charles.fair@mac.com)

---

<div class="post-metadata">

**Author:** ![Seth\_Hall3](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@Seth\_Hall3](https://community.zeek.org/u/Seth_Hall3)\
**Post date:** [August 22, 2013, 11:14pm UTC](https://community.zeek.org/t/bro-script-spacing/2786/9 "2013-08-22T23:14:35Z")

</div>

I just deal with it manually in sublime text. I've been meaning to fix my Bro support for textmate and sublimetext \*forever\* to make it work correctly.

&nbsp;&nbsp;.Seth

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/zeek/original/1X/f09d732bc2cc7c7cc7e35db67cf4e1d5233ce7a7.png) [@system](https://community.zeek.org/u/system)\
**Post date:** [May 6, 2022, 3:41pm UTC](https://community.zeek.org/t/bro-script-spacing/2786/10 "2022-05-06T15:41:10Z")

</div>


