Re: [code] Key Chains

From: Robert <rob.g.att.web.de>
Date: Thu, 31 Jan 2013 08:20:29 +0100

Hi Michael,

On Thu, Jan 31, 2013 at 6:49 AM, Michael Richter <ttmrichter.att.gmail.com> wrote:
> Well, I guess the first problem I'm having is that I can't see anything in
> the lua/init.lua at or near line 153 that does anything with any keys. This
> is what I'm seeing (149-159):
>
> ---
> -- Container for Lua-specific key bindings.
> -- @class table
> -- @name _G.keys.lua
> keys.lua = {
> [keys.LANGUAGE_MODULE_PREFIX] = {
> m = {io.open_file,
> (_HOME..'/modules/lua/init.lua'):iconv('UTF-8', _CHARSET)},
> },
> ['s\n'] = M.try_to_autocomplete_end,
> }
>
> Where is anything being bound to anything? And when I try Ctrl+L,M ...
> nothing happens. I think I'm just not understanding the whole premise here.
>

if you're on a Mac this should be Command-L, M.
The first key is set in `keys.LANGUAGE_MODULE_PREFIX`.

An (hopefully) simpler example below:
In your init.lua:

keys['c1'] = {
  ['2'] = function() gui.statusbar_text = '2' end,
  ['3'] = function() gui.statusbar_text = '3' end
}

Key chains are set in nested tables, here the first level is Ctrl-1,
at the second level you
have 2 or 3 and a simple function to put something in the status bar.
(This is my favorite way of debugging or trying to figure out where
something went wrong.)

A more emacsy example, with more nesting and modifiers at the second
level as well:
keys['c1'] = {
  ['c2'] = {
    ['3'] = function() gui.statusbar_text = '1, 2, 3' end
  },
}

Ctrl-1 Ctrl-2 3
should display 1,2,3 in your status bar.

I hope this helps a bit.
Robert

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Thu 31 Jan 2013 - 02:20:29 EST

This archive was generated by hypermail 2.2.0 : Thu 31 Jan 2013 - 06:37:26 EST