Sublime text: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
(Created page with "[https://www.sublimetext.com/ Sublime Text - Text Editing, Done Right] == How do I open a Sublime Text file in terminal == * Open the terminal * Key in {{kbd | key=<nowiki>s...")
 
No edit summary
Line 5: Line 5:
* Open the terminal
* Open the terminal
* Key in {{kbd | key=<nowiki>subl path/to/file.txt</nowiki>}}
* Key in {{kbd | key=<nowiki>subl path/to/file.txt</nowiki>}}
=== Explanation ===
1. Determine which shell you're using by running this in Terminal:
<pre>
echo $SHELL
</pre>
2. Edit the appropriate configuration file:
My result on {{Mac}} is
<pre>
/bin/zsh
</pre>
Choose appropriate configuration file
<pre>
For Bash: ~/.bash_profile or ~/.bashrc
For Zsh (default on newer macOS): ~/.zshrc
</pre>
3. Open the file with a text editor:
<pre>
vi ~/.zshrc
</pre>
4. Existing alias in the file:
<pre>
alias subl='open -a "Sublime Text"'
</pre>


== References ==
== References ==
* [https://www.folkstalk.com/tech/open-file-in-sublime-from-terminal-with-code-examples/ Open File In Sublime From Terminal With Code Examples]
* [https://www.folkstalk.com/tech/open-file-in-sublime-from-terminal-with-code-examples/ Open File In Sublime From Terminal With Code Examples]
* [https://www.sublimetext.com/docs/command_line.html Command Line Interface]


[[Category:Software]]
[[Category: Software]] [[Category: Revised with LLMs]]

Revision as of 18:25, 6 March 2025

Sublime Text - Text Editing, Done Right

How do I open a Sublime Text file in terminal

  • Open the terminal
  • Key in subl path/to/file.txt

Explanation

1. Determine which shell you're using by running this in Terminal:

echo $SHELL

2. Edit the appropriate configuration file:

My result on macOS icon_os_mac.png is

/bin/zsh

Choose appropriate configuration file

For Bash: ~/.bash_profile or ~/.bashrc
For Zsh (default on newer macOS): ~/.zshrc

3. Open the file with a text editor:

vi ~/.zshrc

4. Existing alias in the file:

alias subl='open -a "Sublime Text"'

References