Movatterモバイル変換


[0]ホーム

URL:


Sublime Text

Command Line Interface
Version:

Sublime Text includes a command line tool,subl, to work with files on thecommand line. This can be used to open files and projects in Sublime Text, aswell working as anEDITOR for unix tools, such as git and subversion.

Setup🔗

Some operating systems and installation methods will require a configurationchange to makesubl available on thePATH.

Windows🔗

On Windows, the command line helper issubl.exe. To use this fromtheCommand Prompt orPowershell, the Sublime Text installation folderneeds to be added to thePath environment variable:

Windows 10🔗

  • Open theStart Menu and typeenviron

  • Select the itemEdit the system environment variables

  • Click the buttonEnvironment Variables at the bottom of theSystem Properties dialog

  • Select, or create, thePath environment variable in the appropriate section:
    • For the current user, selectPath in theUser variables for {username} section

    • For all users, selectPath in theSystem variables section

  • Click theNew button and add an entry with the Sublime Text installation directory
    • 64bit installs are typically inC:\Program Files\Sublime Text\

    • 32bit installs on a 64bit version of Windows will be inC:\Program Files (x86)\Sublime Text\

    • 32bit installs on a 32bit version of Windows will be inC:\Program Files\Sublime Text\

Windows 8🔗

  • Press theWindows Key and typeenviron

  • Select the itemEdit the system environment variables

  • Click the buttonEnvironment Variables at the bottom of theSystem Properties dialog

  • Select, or create, thePath environment variable in the appropriate section:
    • For the current user, selectPath in theUser variables for {username} section

    • For all users, selectPath in theSystem variables section

  • In theVariable value input, add an entry with the Sublime Text installationdirectory. If there is an existing value, add a; before the Sublime Textdirectory.

    • 64bit installs are typically inC:\Program Files\Sublime Text\

    • 32bit installs on a 64bit version of Windows will be inC:\Program Files (x86)\Sublime Text\

    • 32bit installs on a 32bit version of Windows will be inC:\Program Files\Sublime Text\

Windows 7🔗

  • Open theStart Menu

  • Right-click onComputer and selectProperties

  • Click onAdvanced System Settings in the left-hand sidebar

  • Click the buttonEnvironment Variables at the bottom of theSystem Properties dialog

  • Select, or create, thePath environment variable in the appropriate section:
    • For the current user, selectPath in theUser variables for {username} section

    • For all users, selectPath in theSystem variables section

  • In theVariable value input, add an entry with the Sublime Text installationdirectory.If there is an existing value, add a; before the Sublime Text directory.

    • 64bit installs are typically inC:\Program Files\Sublime Text\

    • 32bit installs on a 64bit version of Windows will be inC:\Program Files (x86)\Sublime Text\

    • 32bit installs on a 32bit version of Windows will be inC:\Program Files\Sublime Text\

Mac🔗

To usesubl, the Sublime Textbin folder needs to be added tothe path. For a typical installation of Sublime Text, this will be locatedat/Applications/Sublime Text.app/Contents/SharedSupport/bin.

Bash🔗

If using Bash, the default before macOS 10.15, the following command will addthebin folder to thePATH environment variable:

echo'export PATH="/Applications/Sublime Text.app/Contents/SharedSupport/bin:$PATH"'>>~/.bash_profile

Zsh🔗

If using Zsh, the default starting with macOS 10.15, the following command willadd thebin folder to thePATH environment variable:

echo'export PATH="/Applications/Sublime Text.app/Contents/SharedSupport/bin:$PATH"'>>~/.zprofile

Linux🔗

If Sublime Text is installed via one of theLinux Package Manager Repositories or a package,asubl symlink will automatically be installed intothe/usr/bin/ directory.

If installing from a tarball, thesublime_text executable should besymlinked tosubl, with a command such as:

sudoln-s/opt/sublime_text/sublime_text/usr/local/bin/subl

The exact details of the symlink command will depend on the installationlocation. Most defaultPATH environment variable values shouldcontain/usr/local/bin, so no further commands should be necessary.

Usage🔗

To see the available flags, runsubl--help.The available flags will varyper operating system – the following example is from Linux:

Sublime Text build 4131Usage: subl [arguments] [files]         Edit the given files   or: subl [arguments] [directories]   Open the given directories   or: subl [arguments] -- [files]      Edit files that may start with '-'   or: subl [arguments] -               Edit stdin   or: subl [arguments] - >out          Edit stdin and write the edit to stdoutArguments:  --project <project>:    Load the given project  --command <command>:    Run the given command  -n or --new-window:     Open a new window  --launch-or-new-window: Only open a new window if the application is open  -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  --safe-mode:            Launch using a sandboxed (clean) environment  -h or --help:           Show help (this message) and exit  -v or --version:        Show version and exitFilenames may be given a :line or :line:column suffix to open at a specificlocation.

Configuring as EDITOR🔗

To use Sublime Text as the editor for many commands that prompt for input, setyourEDITOR environment variable:

exportEDITOR='subl -w'

Specifying-w will cause thesubl command to not exit until the file isclosed.

Introducing our Git client
Sublime Merge

[8]ページ先頭

©2009-2026 Movatter.jp