Commands

posted by Martin Cohen in Features  | June 30th, 2006  |

Commands in Intype are the most different from TextMate. The reason is once again: LUA. In actual implementation they do not use special UI fields (see Shell Commands in TextMate) for setting save options, input / output options. Everything is done in command itself. LUA engine has full access to Intype API. You can control everything directly and in real time. Let’s have a look at this simple command which inserts a snippet into a new document:

local snippet = '<img src="${1:Input.selection()}" />'

Editor.newDocument(”HTML”)
Editor.insertSnippet(snippet)
Editor.saveDocumentAs(”my_document.html”)
Editor.closeDocument()

LUA has also access to a parser in Intype. So you don’t have to write your own parser for language-sensitive commands (such as Reformat text, Lowercase/Uppercase tags, Conversion or transformation to other language (HTML to Textile) and so. You also can use parser access to fire an auto-completition popup with explicit lexemes. So for example if you want to fire a list of variables, you just ask parser for it:

local list = Parser.getListByScope ("variable", 0, Editor.caretPosition());
Editor.popup(list);

Shell code, external scripts or executables are also available. LUA can execute them by OS.exec(command, params) function and capture output in a string which you can transform to a snippet (using regular expressions) and insert to a document, or just do whatever you need.

Comments are locked

We are sorry, but comments for this post are locked. This post is outdated.

Original post can be found at intype development blog.


 

Categories

What is Intype?

Intype is a powerful and intuitive code editor for Windows with lightning fast response.

It is easily extensible and customizable, thanks in part to its support for scripting and native plug-ins. It makes development in any programming or scripting language quick and easy.

Where can I get it?

Intype is still in development, but the current alpha release is available for download here.

Code stats

This table shows how many lines, files and size actually Intype has in its development branch:

49,200lines
278 files
1,396kilobytes

Status from July 10, 2007

© 2006 Intype Team