From 78bcda2db6b0b8669a6fbcf63b1143602f544416 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Fri, 21 Jan 2011 00:41:36 -0500 Subject: Code cleanup. --- core/keys.lua | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'core/keys.lua') diff --git a/core/keys.lua b/core/keys.lua index a5e47662..29a06d6d 100644 --- a/core/keys.lua +++ b/core/keys.lua @@ -134,7 +134,6 @@ local pcall = _G.pcall local next = _G.next local type = _G.type local unpack = _G.unpack -local OSX = _G.OSX --- -- Lookup table for key values higher than 255. @@ -198,12 +197,9 @@ local function run_key_command(lexer, scope) end local f, args = key[1], { unpack(key, 2) } - if type(key[1]) == 'string' then - if key[2] == 'buffer' then - f, args = buffer[f], { buffer, unpack(key, 3) } - elseif key[2] == 'view' then - f, args = view[f], { view, unpack(key, 3) } - end + if type(key[1]) == 'string' and (key[2] == 'buffer' or key[2] == 'view') then + local v = _G[key[2]] + f, args = v[f], { v, unpack(key, 3) } end if type(f) ~= 'function' then error(L('Unknown command:')..tostring(f)) end -- cgit v1.2.3