Sha256: fc5faf3a6f1cd530573138eba2361209f0c59ff597c8aa17ecdbff224f3f9b44

Contents?: true

Size: 650 Bytes

Versions: 1

Compression:

Stored size: 650 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
      ":%bd!\n:q!\n"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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