Sublime Text from Command Line

前端 未结 27 1930
时光说笑
时光说笑 2020-11-27 08:37

I installed Sublime Text and wanted to know how to open rb files in it from the terminal. I saw What is the command to make Sublime Text my core editor? and I s

相关标签:
27条回答
  • 2020-11-27 09:42

    I created a simple batch file (s.bat) in the windows directory to start sublime text

    This is the code I put in the batch file to start Sublime Text 2

    @start "sublime" "%ProgramW6432%\Sublime Text 2\sublime_text.exe" %*
    

    I call sublime by typing

    s
    

    I directly open a file using

    s filename.ext
    
    0 讨论(0)
  • 2020-11-27 09:43

    I wanted to start a new instance of Sublime Text from the command-line.. The following page helped me, even though it only says OSX: http://www.sublimetext.com/docs/3/osx_command_line.html.

    So, I use a batch file in my user path to launch 'sublime'. Here is basically what I use (**the batch file contents):

    @start "sublime" "%~dp0Sublime Text\sublime_text.exe" --new-window %*
    

    (my batch file %~-dp0 is located one folder above the Sublime Text installation path.)

    I know this is an old thread, but I thought I'd add what I was looking for (and found). It might help someone else!

    0 讨论(0)
  • The accepted answer doesn't seem to work, at least for Sublime Text 3 on Windows 7. Copying the file directly into C:\Windows\System32 allows subl to resolve fine from the shell, but when I run it, nothing happens.

    I've had more success with a hardlink:

    mklink /h c:\windows\system32\subl.exe "c:\Program Files\Sublime Text 3\subl.exe"

    With that, subl <file.txt> and subl <directory> both work fine.

    0 讨论(0)
提交回复
热议问题