Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix mvim Focus on exotic Terminal. Closes gh-4

Mvim focus fix is now available for iTerm too
  • Loading branch information...
commit a09af52519db54ddc628de5eddd2ba63da61ba37 1 parent bbc6dea
@nel nel authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/interactive_editor.rb
8 lib/interactive_editor.rb
@@ -25,7 +25,7 @@ def edit(file=nil)
mtime = File.stat(@file.path).mtime
- args = Shellwords.shellwords(@editor) #parse @editor as arguments could be complexe
+ args = Shellwords.shellwords(@editor) #parse @editor as arguments could be complex
args << @file.path
@@ -68,7 +68,11 @@ module Editors
:emacs => nil,
:nano => nil,
:mate => 'mate -w',
- :mvim => 'mvim -g -f -c "au VimLeave * !open -a Terminal"'
+ :mvim => 'mvim -g -f' + case ENV['TERM_PROGRAM']
+ when '' then ' -c "au VimLeave * !open -a iTerm"' #on close refocus on iTerm
+ when 'Apple_Terminal' then ' -c "au VimLeave * !open -a Terminal"' #on close refocus on Terminal
+ else '' #don't do tricky things if we don't know the Term
+ end
}.each do |k,v|
define_method(k) do |*args|
InteractiveEditor.edit(v || k, *args)
Please sign in to comment.
Something went wrong with that request. Please try again.