summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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')