Skip to content

Instantly share code, notes, and snippets.

@snipem
Created October 31, 2016 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snipem/64d02992adb39c5cb009695a8678ac15 to your computer and use it in GitHub Desktop.
Save snipem/64d02992adb39c5cb009695a8678ac15 to your computer and use it in GitHub Desktop.
VIM navigation key bindings for Civilization 5
From 36e239f83d6858f9f0c13c89fa83d8b2de2d9756 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matthias=20Ku=CC=88ch?= <halde@matthias-kuech.de>
Date: Mon, 31 Oct 2016 18:46:26 +0100
Subject: [PATCH] Added VIM keybindings to Civilization 5
---
UI/InGame/WorldView/WorldView.lua | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/UI/InGame/WorldView/WorldView.lua b/UI/InGame/WorldView/WorldView.lua
index a958521..ffdcc20 100755
--- a/UI/InGame/WorldView/WorldView.lua
+++ b/UI/InGame/WorldView/WorldView.lua
@@ -87,19 +87,19 @@ local DefaultMessageHandler = {};
DefaultMessageHandler[KeyEvents.KeyDown] =
function( wParam, lParam )
- if ( wParam == Keys.VK_LEFT ) then
+ if ( wParam == Keys.VK_LEFT or wParam == Keys.H) then
Events.SerialEventCameraStopMovingRight();
Events.SerialEventCameraStartMovingLeft();
return true;
- elseif ( wParam == Keys.VK_RIGHT ) then
+ elseif ( wParam == Keys.VK_RIGHT or wParam == Keys.L) then
Events.SerialEventCameraStopMovingLeft();
Events.SerialEventCameraStartMovingRight();
return true;
- elseif ( wParam == Keys.VK_UP ) then
+ elseif ( wParam == Keys.VK_UP or wParam == Keys.K) then
Events.SerialEventCameraStopMovingBack();
Events.SerialEventCameraStartMovingForward();
return true;
- elseif ( wParam == Keys.VK_DOWN ) then
+ elseif ( wParam == Keys.VK_DOWN or wParam == Keys.J) then
Events.SerialEventCameraStopMovingForward();
Events.SerialEventCameraStartMovingBack();
return true;
@@ -118,16 +118,16 @@ end
DefaultMessageHandler[KeyEvents.KeyUp] =
function( wParam, lParam )
- if ( wParam == Keys.VK_LEFT ) then
+ if ( wParam == Keys.VK_LEFT or wParam == Keys.H) then
Events.SerialEventCameraStopMovingLeft();
return true;
- elseif ( wParam == Keys.VK_RIGHT ) then
+ elseif ( wParam == Keys.VK_RIGHT or wParam == Keys.L) then
Events.SerialEventCameraStopMovingRight();
return true;
- elseif ( wParam == Keys.VK_UP ) then
+ elseif ( wParam == Keys.VK_UP or wParam == Keys.K) then
Events.SerialEventCameraStopMovingForward();
return true;
- elseif ( wParam == Keys.VK_DOWN ) then
+ elseif ( wParam == Keys.VK_DOWN or wParam == Keys.J) then
Events.SerialEventCameraStopMovingBack();
return true;
end
@@ -137,13 +137,13 @@ end
-- Emergency key up handler
function KeyUpHandler( wParam )
- if ( wParam == Keys.VK_LEFT ) then
+ if ( wParam == Keys.VK_LEFT or wParam == Keys.H) then
Events.SerialEventCameraStopMovingLeft();
- elseif ( wParam == Keys.VK_RIGHT ) then
+ elseif ( wParam == Keys.VK_RIGHT or wParam == Keys.L) then
Events.SerialEventCameraStopMovingRight();
- elseif ( wParam == Keys.VK_UP ) then
+ elseif ( wParam == Keys.VK_UP or wParam == Keys.K) then
Events.SerialEventCameraStopMovingForward();
- elseif ( wParam == Keys.VK_DOWN ) then
+ elseif ( wParam == Keys.VK_DOWN or wParam == Keys.J) then
Events.SerialEventCameraStopMovingBack();
end
end
--
2.8.4 (Apple Git-73)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment