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')
 
href='#n106'>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