Skip to content

Instantly share code, notes, and snippets.

@aapis
Last active August 29, 2015 14:22
Show Gist options
  • Select an option

  • Save aapis/f7d3abc742adaf592cfd to your computer and use it in GitHub Desktop.

Select an option

Save aapis/f7d3abc742adaf592cfd to your computer and use it in GitHub Desktop.
Open a bunch of files in a new Sublime Text window
open_files(){/path/to/sublime_open_files_in_new_window.rb ${@}}
# Usage
open_files test.rb main.c load.php
#! /usr/bin/ruby
project_home = '/path/to/a/dir'
log_file = 'some/log/file.log'
if ARGV.size == 0
# pull file list from a log file
files = IO.readlines(log_file)
files.each do |l|
l.gsub!(/\r\n?/, "")
l.prepend(project_home)
end
else
# pull file list from CLI args
files = ARGV
end
`subl -n #{files.join(' ')}`
puts "Opened #{files.size} files in sublime text"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment