lib/robot-vim/runner.rb in robot-vim-0.10.0 vs lib/robot-vim/runner.rb in robot-vim-1.0.0
- old
+ new
@@ -1,17 +1,23 @@
module RobotVim
class Runner
DEFAULT_VIM_BINARY = "vim"
+ DEFAULT_VIMRC = File.join(File.expand_path("~"), ".vimrc")
def initialize(args={})
@vim_binary = args[:vim]
+ @vimrc = args[:vimrc]
end
def vim_binary
@vim_binary || DEFAULT_VIM_BINARY
end
+ def vimrc
+ @vimrc || DEFAULT_VIMRC
+ end
+
def run(args={})
output_file_name = RobotVim::FileNameGenerator.generate
commands = args[:commands] + output_write_command(output_file_name) + vim_close_commands
InputFile.path_for(args[:input_file]) do |input_file_path|
@@ -26,10 +32,10 @@
end
private
def invoke_vim(script_file_path, input_file)
- Kernel.send(:`, "#{self.vim_binary} -n -s #{script_file_path} #{input_file}")
+ Kernel.send(:`, "#{self.vim_binary} -N -n -u #{self.vimrc} -s #{script_file_path} #{input_file}")
end
def output_write_command(output_file_name)
":w #{output_file_name}"
end