summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorornicar <thibault.duplessis@gmail.com>2011-02-12 20:37:08 -0800
committerornicar <thibault.duplessis@gmail.com>2011-02-13 00:04:12 -0800
commit540d503322c5b26910760014e29897dc3549c0f0 (patch)
tree9750cb6efe1f2a8a3f1db621226b292a1070de5f
parentf16b6b2bf31c2be04af7c7c95f27b2b6c1a3fd03 (diff)
downloadranger-540d503322c5b26910760014e29897dc3549c0f0.tar.gz
[vim integration] When INVIM env var is set, write filename to tempfile and exit
-rw-r--r--ranger/defaults/apps.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/ranger/defaults/apps.py b/ranger/defaults/apps.py
index e93ca1b2..1585012b 100644
--- a/ranger/defaults/apps.py
+++ b/ranger/defaults/apps.py
@@ -46,6 +46,7 @@ This example modifies the behaviour of "feh" and adds a custom media player:
 #### end of the example
 """
 
+from tempfile import gettempdir
 from ranger.api.apps import *
 from ranger.ext.get_executables import get_executables
 
@@ -54,6 +55,12 @@ class CustomApplications(Applications):
 		"""How to determine the default application?"""
 		f = c.file
 
+		if 'INVIM' in os.environ:
+			tmp_file = gettempdir() + "/ranger-selected-file"
+			with open(tmp_file, 'w') as tmp:
+				tmp.write(f.path)
+			raise SystemExit()
+
 		if f.basename.lower() == 'makefile':
 			return self.either(c, 'make')
 
1-17 16:12:29 +0000 committer Stevan Andjelkovic <stevan@student.chalmers.se> 2011-01-17 16:12:29 +0000 Further FreeBSD attempts. ok marco@' href='/novaburst/xombrero/commit/freebsd/Makefile?id=1bbe7631c3b8603141c3dd5917a8cd3516610caf'>1bbe763 ^
66c3a4f ^
1bbe763 ^
66c3a4f ^
f4171a4 ^

1bbe763 ^
66c3a4f ^
1bbe763 ^
b323713 ^

42bac51 ^



e1becca ^

6033b7c ^

bf5d2f9 ^

66c3a4f ^

bf5d2f9 ^
66c3a4f ^
1bbe763 ^












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