summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/config/rifle.conf3
-rw-r--r--ranger/core/actions.py5
-rwxr-xr-xranger/ext/rifle.py3
3 files changed, 9 insertions, 2 deletions
diff --git a/ranger/config/rifle.conf b/ranger/config/rifle.conf
index ad4ba148..daed8b90 100644
--- a/ranger/config/rifle.conf
+++ b/ranger/config/rifle.conf
@@ -11,6 +11,8 @@
 #   $1-$9 | The n-th selected file
 #   $@    | All selected files
 #
+# If you use the special command "ask", rifle will ask you what program to run.
+#
 # Prefixing a condition with "!" will negate its result.
 # These conditions are currently supported:
 #   match <regexp> | The regexp matches $1
@@ -177,5 +179,6 @@ label wallpaper, number 13, mime ^image, X = feh --bg-center "$1"
 label wallpaper, number 14, mime ^image, X = feh --bg-fill "$1"
 
 # Define the editor for non-text files + pager as last action
+              !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php  = ask
 label editor, !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php  = "$EDITOR" -- "$@"
 label pager,  !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php  = "$PAGER" -- "$@"
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index cab164be..95a536ef 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -17,7 +17,7 @@ from ranger.ext.relative_symlink import relative_symlink
 from ranger.ext.keybinding_parser import key_to_string, construct_keybinding
 from ranger.ext.shell_escape import shell_quote
 from ranger.ext.next_available_filename import next_available_filename
-from ranger.ext.rifle import squash_flags
+from ranger.ext.rifle import squash_flags, ASK_COMMAND
 from ranger.core.shared import FileManagerAware, EnvironmentAware, \
 		SettingsAware
 from ranger.core.tab import Tab
@@ -342,7 +342,8 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 				cf = self.thisfile
 				selection = self.thistab.get_selection()
 				if not self.thistab.enter_dir(cf) and selection:
-					if self.execute_file(selection, mode=mode) is False:
+					result = self.execute_file(selection, mode=mode)
+					if result in (False, ASK_COMMAND):
 						self.open_console('open_with ')
 			elif direction.vertical() and cwd.files:
 				newpos = direction.move(
diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py
index 16de09f3..92fbae11 100755
--- a/ranger/ext/rifle.py
+++ b/ranger/ext/rifle.py
@@ -22,6 +22,7 @@ import sys
 
 DEFAULT_PAGER = 'less'
 DEFAULT_EDITOR = 'nano'
+ASK_COMMAND = 'ask'
 ENCODING = 'utf-8'
 
 try:
@@ -292,6 +293,8 @@ class Rifle(object):
 		for count, cmd, lbl, flgs in self.list_commands(files, mimetype):
 			if label and label == lbl or not label and count == number:
 				cmd = self.hook_command_preprocessing(cmd)
+				if cmd == ASK_COMMAND:
+					return ASK_COMMAND
 				command = self._build_command(files, cmd, flags + flgs)
 				break
 			else:
class='alt'>
2c5ea01d ^
5fca2a0b ^
b0a216f5 ^
2c5ea01d ^
b0a216f5 ^



3a1e1f28 ^
b0a216f5 ^
e7758eba ^
b0a216f5 ^

5fca2a0b ^
b0b3af33 ^


b0a216f5 ^
b0b3af33 ^

2c5ea01d ^
5fca2a0b ^
b0b3af33 ^
2c5ea01d ^
582f3519 ^
b06433bc ^
582f3519 ^

94c5d83e ^
dee6cfa6 ^
e9e4b4ff ^
b0a216f5 ^
76612b05 ^
a082b66a ^
b0a216f5 ^
e9e4b4ff ^





ad75190c ^
e9e4b4ff ^
5fca2a0b ^
f473be92 ^
5fca2a0b ^
9cf43c17 ^
5fca2a0b ^

c7720fff ^


a6836d5d ^

c7720fff ^
8d21b83c ^


e9e4b4ff ^
25a4162d ^
e9e4b4ff ^
0c2c782d ^
636d9393 ^
b0a216f5 ^
c6afc196 ^

c0d63e78 ^


c6afc196 ^
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