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!

댓글

이 블로그의 인기 게시물

PYTHONPATH, Python 모듈 환경설정

git 명령어

[gRPC] server of Java and client of Typescript

[Ubuntu] Apache2.4.x 설치

Create topic on Kafka with partition count, 카프카 토픽 생성하기

리눅스의 부팅과정 (프로세스, 서비스 관리)

Auto-populate a calendar in an MUI (Material-UI) TextField component

The pierce selector in Puppeteer