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!

댓글

이 블로그의 인기 게시물

Creating an synchronous HTTP request using Spring RestTemplate

how to delete all issues on project in sentry, 센트리 이슈 삭제하기

동남아 국가들이 사용하는 언어

형태소 분석 태그

MySQL GRANT

max_active_runs of Airflow

Read a file in Java, 자바 파일 읽기

dagrun_timeout of Airflow

ssh-copy-id in ansible

Create fixed rounded button by Tailwind