vicoapp / vico

Mac Programmers Text Editor
http://www.vicoapp.com/
658 stars 89 forks source link

Mapping to expression #28

Closed joefiorini closed 12 years ago

joefiorini commented 12 years ago

I'm trying to port my Vim setup to Vico. I have a couple mappings that determine information about the current file being edited. Therefore, they need to be executed within a block (right?) The best I've figured out to do this is calling the map method with the toExpression parameter like so:

((ViMap normalMap) map:"<c-8>" toExpression: (do () ":e"))

(note this is not my actual mapping, just a simplified form). However, when I type in normal mode it doesn't do anything; it doesn't tell me that it's not mapped, so I assume the mapping is there but the expression is not working. If I run via make run against the latest HEAD I don't see any errors in the output. Any thoughts on this?

Shadowfiend commented 12 years ago

Expression maps don't return Strings, they actually run Nu code to modify the Vico environment. So you'd want something more like:

((current-text) input:(+ ":e " extracted-filename))

For example.

joefiorini commented 12 years ago

That worked wonderfully! Thanks!

Shadowfiend commented 12 years ago

Rockin'! No probs :)