Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I open Sublime Text 2 files from the command line in linux to a tab, not a new window

I have ST2 setup so that I can do 'sublime file.txt' and it will open in a ST2 window. But how can I make it open in a new tab in the currently open window?

like image 242
phirschybar Avatar asked Sep 01 '12 04:09

phirschybar


People also ask

How do you open a file with sublime from terminal Linux?

Usage: subl [arguments] [files] edit the given files or: subl [arguments] [directories] open the given directories or: subl [arguments] - edit stdin Arguments: --project <project>: Load the given project --command <command>: Run the given command -n or --new-window: Open a new window -a or --add: Add folders to the ...

How do I open two files in Sublime Text?

To do so, you need to press Ctrl+K, then Ctrl+Shift+Up. You can repeat as many times as you like. Press Ctrl+K, then Ctrl+Shift+Up to open a new sub-window.


2 Answers

Try Sublime command line help

subl --help Sublime Text 2 Build 2217

Usage: subl [arguments] [files]         edit the given files
   or: subl [arguments] [directories]   open the given directories
   or: subl [arguments] -               edit stdin

Arguments:
  --project <project>: Load the given project
  --command <command>: Run the given command
  -n or --new-window:  Open a new window
  -a or --add:         Add folders to the current window
  -w or --wait:        Wait for the files to be closed before returning
  -b or --background:  Don't activate the application
  -s or --stay:        Keep the application activated after closing the file
  -h or --help:        Show help (this message) and exit
  -v or --version:     Show version and exit

--wait is implied if reading from stdin. Use --stay to not switch back
to the terminal when a file is closed (only relevant if waiting for a file).

Filenames may be given a :line or :line:column suffix to open at a specific
location.

After you have opened a new window the subsequent files should be added there as per the default behavior.

like image 119
Mikko Ohtamaa Avatar answered Oct 10 '22 06:10

Mikko Ohtamaa


This works on Ubuntu 12.04:

subl filename

or

subl -n filename (if you want it to open in a seperate window)

like image 30
Francois Avatar answered Oct 10 '22 05:10

Francois