summary refs log tree commit diff stats
path: root/ranger/core/actions.py
diff options
context:
space:
mode:
Diffstat (limited to 'ranger/core/actions.py')
-rw-r--r--ranger/core/actions.py37
1 files changed, 36 insertions, 1 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 79292a06..935534ce 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -17,6 +17,7 @@ import codecs
 import os
 import re
 import shutil
+import subprocess
 import string
 from os.path import join, isdir, realpath
 from os import link, symlink, getcwd
@@ -25,7 +26,7 @@ from inspect import cleandoc
 import ranger
 from ranger.ext.direction import Direction
 from ranger.ext.relative_symlink import relative_symlink
-from ranger.ext.keybinding_parser import key_to_string
+from ranger.ext.keybinding_parser import key_to_string, construct_keybinding
 from ranger.ext.shell_escape import shell_quote
 from ranger import fsobject
 from ranger.core.shared import FileManagerAware, EnvironmentAware, \
@@ -766,6 +767,40 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 		self.tabs[self.current_tab] = self.env.cwd.path
 
 	# --------------------------
+	# -- Overview of internals
+	# --------------------------
+
+	def dump_keybindings(self, *contexts):
+		self.ui.suspend()
+		p = subprocess.Popen(['less'], stdin=subprocess.PIPE)
+		def write(string):
+			p.stdin.write(string.encode('utf-8'))
+
+		def recurse(before, pointer):
+			for key, value in pointer.items():
+				keys = before + [key]
+				if isinstance(value, dict):
+					recurse(keys, value)
+				else:
+					write("%12s %s\n" % (construct_keybinding(keys), value))
+		if not contexts:
+			contexts = 'browser', 'console', 'pager', 'taskview'
+
+		try:
+			for context in contexts:
+				write("Keybindings in `%s'\n" % context)
+				if context in self.env.keymaps:
+					recurse([], self.env.keymaps[context])
+				else:
+					write("  None\n")
+				write("\n")
+			p.stdin.close()
+		except IOError:
+			pass
+		p.wait()
+		self.ui.initialize()
+
+	# --------------------------
 	# -- File System Operations
 	# --------------------------
 
10 23:37:15 +0100 committer hut <hut@lepus.uberspace.de> 2014-12-10 23:37:50 +0100 use markdown in HACKING.md, update it, fix typos' href='/akspecs/ranger/commit/HACKING.md?h=v1.9.2&id=6deb64e69643612022e11772573cac23aabb4983'>6deb64e6 ^
f8f6f7f9 ^

1881922f ^



8ab348a8 ^


1881922f ^

8ab348a8 ^



1881922f ^

f8f6f7f9 ^
6deb64e6 ^


f8f6f7f9 ^

6deb64e6 ^








f8f6f7f9 ^
f8f6f7f9 ^
6deb64e6 ^

f8f6f7f9 ^
6deb64e6 ^





f61fbfae ^

f8f6f7f9 ^
6deb64e6 ^
b071cb85 ^

6deb64e6 ^
f61fbfae ^

f8f6f7f9 ^
f8f6f7f9 ^
b071cb85 ^

f8f6f7f9 ^
6deb64e6 ^




f8f6f7f9 ^
6deb64e6 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94