Sha256: b2d63c1fa82eb84d4d69d554e1bee19b5ec2e2f4ece2253b54fa8830ef2e063d

Contents?: true

Size: 657 Bytes

Versions: 1

Compression:

Stored size: 657 Bytes

Contents

module RobotVim
  class CommandGenerator
    def self.generate(user_commands, output_file)
      user_commands + 
        record_location_command + 
        write_output_file_command(output_file) +
        vim_close_commands
    end

    def self.write_output_file_command(output_file)
      ":w #{output_file}\n"
    end

    def self.record_location_command
      ":let current_line = line(\".\")\n" +
      ":let current_column = col(\".\")\n" +
      ":normal! G\n" + 
      ":execute \"normal! o\" . current_line\n" +
      ":execute \"normal! o\" . current_column\n"  
    end

    def self.vim_close_commands
      "\n:%bd!\n:q!\n"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
robot-vim-2.0.0 lib/robot-vim/command_generator.rb