summary refs log tree commit diff stats
diff options
context:
space:
mode:
authornfnty <git@nfnty.se>2017-02-09 00:15:26 +0100
committernfnty <git@nfnty.se>2017-02-09 00:16:53 +0100
commita3ccb616e6fc8c88cf7ffcd079dab76655bcc002 (patch)
treebe96caa70553f6137bb3831a6105cfa6d93dd49c
parentc377b4814a5560a6fc34c5e5a5df2fe39d289cad (diff)
downloadranger-a3ccb616e6fc8c88cf7ffcd079dab76655bcc002.tar.gz
commands: Add `quitall!`, Change behavior of `quit!`
Fixes #802
-rw-r--r--doc/ranger.116
-rw-r--r--doc/ranger.pod15
-rw-r--r--doc/rifle.12
-rwxr-xr-xranger/config/commands.py37
-rw-r--r--ranger/config/rc.conf14
5 files changed, 56 insertions, 28 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1
index 1cb2d8ed..1d709719 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -129,7 +129,7 @@
 .\" ========================================================================
 .\"
 .IX Title "RANGER 1"
-.TH RANGER 1 "ranger-1.8.1" "2017-02-08" "ranger manual"
+.TH RANGER 1 "ranger-1.8.1" "2017-02-09" "ranger manual"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -938,6 +938,7 @@ ranger.  For your convenience, this is a list of the \*(L"public\*(R" commands i
 \& quit
 \& quit!
 \& quitall
+\& quitall!
 \& relink newpath
 \& rename_append [\-FLAGS...]
 \& rename newname
@@ -1171,17 +1172,18 @@ a row.
 Removes key mappings of the pager. Works like the \f(CW\*(C`unmap\*(C'\fR command.
 .IP "quit" 2
 .IX Item "quit"
-If only one tab is currently open and no tasks are running, quit ranger. If
-multiple tabs are open, only close this tab. The current directory will be
-bookmarked as ' so you can re-enter it by typing `` or '' the next time you
+Closes the current tab, if there's only one tab. Otherwise quits if there are no tasks in progress.
+The current directory will be bookmarked as ' so you can re-enter it by typing `` or '' the next time you
 start ranger.
 .IP "quit!" 2
 .IX Item "quit!"
-Force quit ranger, even if tasks are running. The current directory will still
-be bookmarked similarly to \f(CW\*(C`quit\*(C'\fR.
+Like \f(CW\*(C`quit\*(C'\fR, except will force quit even if tasks are in progress.
 .IP "quitall" 2
 .IX Item "quitall"
-Like \f(CW\*(C`quit\*(C'\fR, will close ranger even if multiple tabs are open.
+Like \f(CW\*(C`quit\*(C'\fR, except will quit even if multiple tabs are open.
+.IP "quitall!" 2
+.IX Item "quitall!"
+Like \f(CW\*(C`quitall\*(C'\fR, except will force quit even if tasks are in progress.
 .IP "relink \fInewpath\fR" 2
 .IX Item "relink newpath"
 Change the link destination of the current symlink file to <newpath>. First
diff --git a/doc/ranger.pod b/doc/ranger.pod
index 8a783094..8b02ee63 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -959,6 +959,7 @@ ranger.  For your convenience, this is a list of the "public" commands including
  quit
  quit!
  quitall
+ quitall!
  relink newpath
  rename_append [-FLAGS...]
  rename newname
@@ -1225,19 +1226,21 @@ Removes key mappings of the pager. Works like the C<unmap> command.
 
 =item quit
 
-If only one tab is currently open and no tasks are running, quit ranger. If
-multiple tabs are open, only close this tab. The current directory will be
-bookmarked as ' so you can re-enter it by typing `` or '' the next time you
+Closes the current tab, if there's only one tab. Otherwise quits if there are no tasks in progress.
+The current directory will be bookmarked as ' so you can re-enter it by typing `` or '' the next time you
 start ranger.
 
 =item quit!
 
-Force quit ranger, even if tasks are running. The current directory will still
-be bookmarked similarly to C<quit>.
+Like C<quit>, except will force quit even if tasks are in progress.
 
 =item quitall
 
-Like C<quit>, will close ranger even if multiple tabs are open.
+Like C<quit>, except will quit even if multiple tabs are open.
+
+=item quitall!
+
+Like C<quitall>, except will force quit even if tasks are in progress.
 
 =item relink I<newpath>
 
diff --git a/doc/rifle.1 b/doc/rifle.1
index b61423e7..3c97c771 100644
--- a/doc/rifle.1
+++ b/doc/rifle.1
@@ -129,7 +129,7 @@
 .\" ========================================================================
 .\"
 .IX Title "RIFLE 1"
-.TH RIFLE 1 "rifle-1.8.1" "2017-02-08" "rifle manual"
+.TH RIFLE 1 "rifle-1.8.1" "2017-02-09" "rifle manual"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 012cbbde..8f71b241 100755
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -477,9 +477,9 @@ class default_linemode(Command):
 class quit(Command):  # pylint: disable=redefined-builtin
     """:quit
 
-    Closes the current tab. If there is only one tab, quit the program.
+    Closes the current tab, if there's only one tab.
+    Otherwise quits if there are no tasks in progress.
     """
-
     def _exit_no_work(self):
         if self.fm.loader.has_work():
             self.fm.notify('Not quitting: Tasks in progress: Use `quit!` to force quit')
@@ -493,22 +493,43 @@ class quit(Command):  # pylint: disable=redefined-builtin
             self._exit_no_work()
 
 
-class quitall(quit):
+class quit_bang(Command):
+    """:quit!
+
+    Closes the current tab, if there's only one tab.
+    Otherwise force quits immediately.
+    """
+    name = 'quit!'
+    allow_abbrev = False
+
+    def execute(self):
+        if len(self.fm.tabs) >= 2:
+            self.fm.tab_close()
+        else:
+            self.fm.exit()
+
+
+class quitall(Command):
     """:quitall
 
-    Quits the program immediately.
+    Quits if there are no tasks in progress.
     """
+    def _exit_no_work(self):
+        if self.fm.loader.has_work():
+            self.fm.notify('Not quitting: Tasks in progress: Use `quitall!` to force quit')
+        else:
+            self.fm.exit()
 
     def execute(self):
         self._exit_no_work()
 
 
-class quit_bang(Command):
-    """:quit!
+class quitall_bang(Command):
+    """:quitall!
 
-    Quits the program immediately.
+    Force quits immediately.
     """
-    name = 'quit!'
+    name = 'quitall!'
     allow_abbrev = False
 
     def execute(self):
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index 0f60c195..5b301b3c 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -231,12 +231,14 @@ set wrap_scroll false
 # == Command Aliases in the Console
 # ===================================================================
 
-alias e    edit
-alias q    quit
-alias q!   quit!
-alias qa   quitall
-alias qall quitall
-alias setl setlocal
+alias e     edit
+alias q     quit
+alias q!    quit!
+alias qa    quitall
+alias qa!   quitall!
+alias qall  quitall
+alias qall! quitall!
+alias setl  setlocal
 
 alias filter     scout -prt
 alias find       scout -aeit
177a6b67210ee06fd380814be51754'>2c3dda21 ^
71eb22a5 ^
2c3dda21 ^

6070c23e ^
2c3dda21 ^
71eb22a5 ^
2c3dda21 ^


1fafe7af ^


7a583220 ^
1fafe7af ^



27decf77 ^




fd2b373a ^
71eb22a5 ^
7a583220 ^
1fafe7af ^


fd2b373a ^
71eb22a5 ^
d7dc6cf1 ^




2c3dda21 ^






6070c23e ^
2c3dda21 ^



31bbb6ac ^
2c3dda21 ^
1fafe7af ^


d7dc6cf1 ^


fd2b373a ^
7a583220 ^
fd2b373a ^



71eb22a5 ^
2c3dda21 ^
fd2b373a ^




71eb22a5 ^
fd2b373a ^































7a583220 ^
fd2b373a ^


2c3dda21 ^
fd2b373a ^

7a583220 ^
d7dc6cf1 ^


1fafe7af ^
71eb22a5 ^
fd2b373a ^
71eb22a5 ^
fd2b373a ^
71eb22a5 ^
7a583220 ^
1fafe7af ^





7a583220 ^
1fafe7af ^



71eb22a5 ^
7a583220 ^
1fafe7af ^








7a583220 ^
1fafe7af ^








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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234