You can use Sublime Text from the command line by utilizing the subl command

You can use Sublime Text from the command line by utilizing the subl command. Here’s how you can set it up and use it:

1. Install Sublime Text

If you haven't already installed Sublime Text, download and install it from the Sublime Text website.

2. Add subl Command to Path (if not already done)

On macOS:

The subl command is typically added automatically, but if it isn't, follow these steps:

  • Open Sublime Text.
  • Press Cmd + Shift + P to open the command palette.
  • Type Install 'subl' command in PATH and select the option to install it.

If you prefer to do it manually, you can create a symbolic link:

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl

On Linux:

If the subl command isn't available, you can create a symbolic link to it:

sudo ln -s /opt/sublime_text/sublime_text /usr/local/bin/subl

On Windows:

You can add Sublime Text to the system PATH manually by:

  1. Right-clicking on This PC and selecting Properties.
  2. Click on Advanced system settings.
  3. Click Environment Variables.
  4. Under System variables, find the Path variable, then click Edit.
  5. Add the path to your subl.exe (typically C:\Program Files\Sublime Text 3\subl.exe).

3. Using Sublime Text from Command Line

Once the subl command is available, you can use it as follows:

Open a file:

subl filename.txt

Open a directory:

subl /path/to/directory

Open multiple files:

subl file1.txt file2.txt file3.txt

Open Sublime Text without opening a file:

subl

Open in the background (without blocking the terminal):

subl -b

Open a file or folder in a new window:

subl -n filename.txt

Open file and jump to a specific line:

subl filename.txt:20

This will open filename.txt and move the cursor to line 20.

Open with specific syntax highlighting:

subl --syntax Python filename.py

Let me know if you need more details on using Sublime Text from the command line!

댓글

이 블로그의 인기 게시물

Spring Boot with Kafka Streams

Install and run an FTP server using Docker

kubeadm init

Random numbers ranged 1 to 10 in Python

Options for auto.offset.reset in Kafka

경량 리눅스 배포판

Scan an HBase table with a prefix filter

MAX_POLL_RECORDS_CONFIG in Kafka