Sublime text: Difference between revisions

Jump to navigation Jump to search
 
(2 intermediate revisions by the same user not shown)
Line 45: Line 45:
== How to open files with your favorite editor from the terminal? ==
== How to open files with your favorite editor from the terminal? ==


1. Open your shell config file:
[[Open Files in a GUI Editor from the Terminal]]
<pre>
vi ~/.zshrc    # for zsh
vi ~/.bashrc  # for bash
</pre>
 
2. Add an alias for your editor:
<pre>
# VS Code
alias code="open -a 'Visual Studio Code'"
<pre>
 
Tip: Not sure of the exact app name? Run this to find it:
<pre>
ls /Applications/ | grep -i "visual\|cursor\|zed\|sublime"
</pre>
 
The name must exactly match the `.app` filename in `/Applications/` (without the `.app` extension).
 
3. Reload your config:
<pre>
source ~/.zshrc    # for zsh
source ~/.bashrc  # for bash
</pre>
 
 
One-liner shortcut:
<pre>
RC_FILE="$HOME/.$(basename $SHELL)rc"
echo 'alias code="open -a Visual\ Studio\ Code"' >> "$RC_FILE"
source "$RC_FILE"
</pre>


== How to open and create non-existent files with Sublime Text from terminal? ==
== How to open and create non-existent files with Sublime Text from terminal? ==
Line 132: Line 101:
[[Category: Text editor]]
[[Category: Text editor]]
[[Category: Revised with LLMs]]
[[Category: Revised with LLMs]]
[[Category: Developer environment]]

Navigation menu