summary refs log tree commit diff stats
path: root/ranger
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 /ranger
parentf16b6b2bf31c2be04af7c7c95f27b2b6c1a3fd03 (diff)
downloadranger-540d503322c5b26910760014e29897dc3549c0f0.tar.gz
[vim integration] When INVIM env var is set, write filename to tempfile and exit
Diffstat (limited to 'ranger')
-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')