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:
- Right-clicking on This PC and selecting Properties.
- Click on Advanced system settings.
- Click Environment Variables.
- Under System variables, find the Path variable, then click Edit.
- Add the path to your
subl.exe
(typicallyC:\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!
댓글
댓글 쓰기