Giter Site home page Giter Site logo

go-tmbundle's Introduction

(a TextMate language bundle) Version 1.3

Installation

Ensure you’ve got a recent copy of git installed, then copy this line to your Terminal application and run it:

> curl -L https://github.com/downloads/AlanQuatermain/go-tmbundle/install-go-tmbundle.sh | sh

This project has been modified a little since it was first published. The original repository (no longer updated) is available at github.com/AlanQuatermain/old-go-tmbundle

Features

The bundle here implements a language syntax, some snippets, and some compile/format/documentation commands for the Go language (golang.org/). Much of the current infrastructure was created by Martin Kühl (github.com/mkhl), who is a significantly more seasoned TextMate bundle developer than I, and to whom I am eternally grateful.

Snippets

pkg

A package declaration including an optional comment block for packages other than ‘main’.

imp

An import statement with optional alternative name.

imps

A multiple-import statement.

type

A type declaration, with name and variable type as tab-stops.

types

A block with multiple type declarations.

con

A single constant declaration.

cons

A multiple constant declaration block.

var

Declare a variable with an optional initial value (long form, i.e. ‘var x int = 10’).

vars

A block of long-form variable declarations.

func

A plain (global) function declaration, with tab stops for name, parameters, and a single optional result.

funcv

A plain (global) function declaration, with tab stops for name, parameters, and multiple results.

meth

Declares a function on a particular type, with additional tab stops for receiver name and type and a single optional result.

meth

Declares a function on a particular type, with additional tab stops for receiver name and type and multiple results.

in

An empty interface declaration (i.e. matches anything).

int

An interface definition with a single method.

st

A struct definition with a single member.

[]

A slice variable type; expands to ‘[]type’, so is usable inside other snippets.

map

A map variable type; works similar to the slice type above.

ch

A channel type.

fun

A function type definition statement.

:

A short-form variable initializer (i.e. ‘name := value’).

mk

A make statement (used for creating & initializing channels, maps, etc.).

new

A new statement (used to create & initialize structure types).

Cmd-i

iota

if

An if statement, properly formatted (Go requires the use of {} on ifs, unlike C; this throws me sometimes).

sw

A switch statement with an optional expression.

sel

A select statement, for looping over channel conditions.

case

A case clause, within a switch or select.

def

A default clause within a switch.

for

A for loop.

fori

A for loop with an index (similar to C for loops).

forr

A for loop iterating over a collection’s full range.

go

An immediate goroutine call (defines the function inline).

de

A deferred goroutine call (defines the function inline).

def

A simple deferred function call (by default supplies ‘+defer file.Close()+’).

main

A template for a +main()+ function with a tab stop at its body.

init

A template for a module’s +init()+ function, with a tab stop at its body.

,

A pair (‘first, second’), suitable for declaring result variables from a multi-return-value function or a map range loop.

<

Send/receive through a channel. Provides tab stops for the value and the channel name.

ret

A return statement with optional return value.

Commands

Cmd-R

Compile and run the current file.

Cmd-B

Build the current project using gomake.

Cmd-Opt-B

Build the current project as a package using gomake & gopack.

Cmd-K

Compile the current file.

Ctrl-Shift-H

Reformat the document according to the Go style guidelines using gofmt.

Ctrl-H

Show the Go HTML documentation for the currently-selected symbol.

Thanks

Thanks be to lasersox and Infininight over at the #textmate room on IRC (irc.freenode.net/textmate) for all their help in cleaning up this here bundle, and for helping me to optimize my regex use in the language grammar. Thanks to Martin Kühl for his extensive additions to this project’s snippets and commands.

Contact Information

You can contact me through github, or you can ping me on Twitter as ‘alanQuatermain’.

Happy coding :)

go-tmbundle's People

Contributors

alanquatermain avatar chrisseaton avatar guncha avatar mkhl avatar puchupala avatar rsesek avatar schmurfy avatar sorbits avatar tassolee avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.