From 7689c031764829946a7ea5a61bed07c77d926793 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 10 Sep 2012 10:51:15 -0400 Subject: [PATCH] change how editor is launched for how i do my vimmmmmmmmm --- lib/qwandry/launcher.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/qwandry/launcher.rb b/lib/qwandry/launcher.rb index 743e940..4327d7f 100644 --- a/lib/qwandry/launcher.rb +++ b/lib/qwandry/launcher.rb @@ -35,9 +35,14 @@ module Qwandry paths = package.is_a?(String) ? [package] : package.paths # Editors may have options, 'mate -w' for instance editor_and_options = editor.strip.split(/\s+/) - + # Launch the editor with its options and any paths that we have been passed - system(*(editor_and_options + paths)) + + if File.directory?(paths.first) + Dir.chdir(paths.first) { system(*(editor_and_options)) } + else + system(*(editor_and_options + paths)) + end end private