Vico home blog download feedback

Automatically hard-wrap text

There's a question if Vico can automatically hard-wrap text at a certain column. Vim can do this when the textwidth setting is non-zero.

This setting is not natively supported by Vico, so the natural follow up question was: "But can I script it?".

Read more…

4 comments

Scripting Vico

Vico is scriptable in the Nu language. The Nu webpage describes it as:

Nu is an interpreted object-oriented language. Its syntax comes from Lisp, but Nu is semantically closer to Ruby than Lisp. Nu is implemented in Objective-C and is designed to take full advantange of the Objective-C runtime and the many mature class libraries written in Objective-C. Nu code can fully interoperate with code written in Objective-C; messages can be sent to and from objects with no concern for whether those messages are implemented in Objective-C or Nu.

Since Vico is written almost exclusively in Objective-C, Nu can take advantage of the native classes that make up Vico. The available classes and methods you can call are being documented here. This allows creating rich plugins that integrate seamlessly with Vico and the rest of Mac OS X.

As an example, here's a "Hello World" example using Cocoa:

(let (alert (NSAlert new))
  (alert setMessageText:"Hello, World!")
  (alert beginSheetModalForWindow:((current-window) window)
                    modalDelegate:nil
                   didEndSelector:nil
                      contextInfo:nil))

Paste this into Vico, select it, and issue the :eval command, and you'll get the familiar greeting as a nice Cocoa sheet. If you want to play with this example, check out Apples documentation for NSAlert.

Read more…

3 comments