Hello everyone,
In this quick tutorial i will show you how to be able to call from Mac terminal some useful tools like : VScode , Sublime Text and Sublime Merge.
VScode is quite straight forward, hold 'cmd + shit + P' then look for Shell command: install 'code' command in PATH.
Once you click on it will be configured.
For Sublime Text and Sublime merge, once they are downloaded and installed in Application folder (https://www.sublimemerge.com/ , https://www.sublimetext.com/)
Create links of their binaries into a path mentioned in your PATH variable (ex: /usr/local/bin/)
>. ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/stxt
>. ln -s "/Applications/Sublime Merge.app/Contents/SharedSupport/bin/smerge" /usr/local/bin/smerge
Once set, you can call them from your terminal.
% code --help
Visual Studio Code 1.91.0
Usage: code [options][paths...]
To read from stdin, append '-' (e.g. 'ps aux | grep code | code -')
Options
-d --diff <file> <file> Compare two files with each other.
-m --merge <path1> <path2> <base> <result> Perform a three-way merge by providing paths for two modified versions of a file, the common origin of both modified
versions and the output file to save merge results.
-a --add <folder> Add folder(s) to the last active window.
-g --goto <file:line[:character]> Open a file at the path on the specified line and character position.
-n --new-window Force to open a new window.
-r --reuse-window Force to open a file or folder in an already opened window.
-w --wait Wait for the files to be closed before returning.
--locale <locale> The locale to use (e.g. en-US or zh-TW).
--user-data-dir <dir> Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code.
--profile <profileName> Opens the provided folder or workspace with the given profile and associates the profile with the workspace. If the
profile does not exist, a new empty one is created.
-h --help Print usage.
% smerge --help
Sublime Merge build 2096
Usage: smerge path Open the given repository
or: smerge search query Search for commits in the current repository
or: smerge blame file [line] Blame the given file in the current repository
or: smerge log file Show the file history in the current repository
or: smerge mergetool Opens the merge tool for the given files
[--no-wait] [base] left right [-o merged]
-n or --new-window: Open a new window
--launch-or-new-window: Only open a new window if the application is running
-b or --background: Don't activate the application
--safe-mode: Launch using a sandboxed (clean) environment
-h or --help: Show help (this message) and exit
-v or --version: Show version and exit
% stxt --help
Sublime Text build 4169
Usage: stxt [arguments] [files] Edit the given files
or: stxt [arguments] [directories] Open the given directories
or: stxt [arguments] -- [files] Edit files that may start with '-'
or: stxt [arguments] - Edit stdin
or: stxt [arguments] - >out Edit stdin and write the edit to stdout
Arguments:
--project <project>: Load the given project
--command <command>: Run the given command
-n or --new-window: Open a new window
--launch-or-new-window: Only open a new window if the application is open
-a or --add: Add folders to the current window
-w or --wait: Wait for the files to be closed before returning
-b or --background: Don't activate the application
-s or --stay: Keep the application activated after closing the file
--safe-mode: Launch using a sandboxed (clean) environment
-h or --help: Show help (this message) and exit
-v or --version: Show version and exit
--wait is implied if reading from stdin. Use --stay to not switch back
to the terminal when a file is closed (only relevant if waiting for a file).
Filenames may be given a :line or :line:column suffix to open at a specific
location.
enjoy ;).