about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-07-20 23:10:56 +0200
committerhut <hut@lavabit.com>2009-07-20 23:10:56 +0200
commit1acf2a20139db6dd16b00d3a8ac67e473d0a3713 (patch)
treed1924463713f97733769cdc8d3b9aac0b38a4278
parent9a35b407966ad831e3e53b18bb3a82a5710c7071 (diff)
downloadranger-1acf2a20139db6dd16b00d3a8ac67e473d0a3713.tar.gz
documented @@key_combination
-rw-r--r--code/keys.rb29
1 files changed, 26 insertions, 3 deletions
diff --git a/code/keys.rb b/code/keys.rb
index 22a65527..2ffa9804 100644
--- a/code/keys.rb
+++ b/code/keys.rb
@@ -1,3 +1,12 @@
+# The default hotkeys are adjusted for the QWERTY layout.
+# If you want to change them, please follow these steps:
+#
+#   1. if you map key X to key Y, make sure that key Y is not
+#      mapped twice and remap the old mapping.
+#   2. if you change key combinations, like "dd", please adjust
+#      the key_combinations function. Search for the function
+#      and you'll find detailed instructions.
+
 module Fm
 	def eval_keybuffer
 		case @buffer
@@ -558,11 +567,25 @@ module Fm
 		end
 	end
 
-	# ALL combinations of multiple keys (but without the last letter)
-	# or regexps which match combinations need to be in here!
+	# ALL key combinations have to be registered here, otherwise
+	# they will not be recognized.
 	def key_combinations
 		return @@key_combinations if @@key_combinations
 
+		# If your key combination looks like "cut",
+		# you will have to enter the whole word minus the last letter.
+		# that would be "cu".
+		#
+		# If it's more complicated, you will need to enter a custom regular
+		# expression. Lets use the grep command for example.
+		#
+		# The regular expression would have to match "g", "gr", "gre", "grep"
+		# and anything that starts with "grep", like "grep i want to find this"
+		# This regexp would look like this: /g(r(e(p(.*)?)?)?)?/
+		# 
+		# Fore case insensitivity, please use /(?i:bla)/ rather than /bla/i
+		# and do NOT use spaces or newlines inside a regexp
+
 		@@key_combinations = %w[
 			g y c Z cu
 			ter ta S e
@@ -574,7 +597,7 @@ module Fm
 			/:[^<]*/
 			/[fF/!].*/
 			/r\d*\w*[^r]/
-			/(c[wmo]|cd|mv|gf).*/
+			/(cw|cm|co|cd|mv|gf).*/
 			/b(l(o(c(k(.*)?)?)?)?)?/
 			/g(r(e(p(.*)?)?)?)?/
 			/m(k(d(i(r(.*)?)?)?)?)?/