Skip to content

Instantly share code, notes, and snippets.

@adrianorsouza
Last active September 26, 2023 16:26
Show Gist options
  • Save adrianorsouza/df4759b0583dcd112da4 to your computer and use it in GitHub Desktop.
Save adrianorsouza/df4759b0583dcd112da4 to your computer and use it in GitHub Desktop.

Revisions

  1. adrianorsouza revised this gist Mar 10, 2016. 1 changed file with 22 additions and 3 deletions.
    25 changes: 22 additions & 3 deletions sublime-command-line.md
    Original file line number Diff line number Diff line change
    @@ -24,15 +24,34 @@ In order to launch sublime from command line you only need to create a symlink `

    ### Test it out

    type in command line
    open a new file from the command line:

    subl test.rb

    it should open new file `test.rb` sublime text
    *it should open new file `test.rb` in Sublime Text*

    open a project folder

    subl dir/project

    to launch Sublime app

    subl

    for more detailed options use the help:

    subl -h

    ### Config git to use Sublime Text as its editor globally
    run the command as follows:

    git config --global core.editor "subl -w"

    to config git to use Sublime Text as editor only for a particular repository/project run the same command above without `--global` option.

    ----

    NOTE: To accomplish this you must:
    ### NOTE: In order to execute Sublime from the Command Line you must:

    have created a directory where you actually place binaries `/usr/local/bin` if not make it before creating a `symlink`:

  2. adrianorsouza revised this gist Aug 13, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion sublime-command-line.md
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ Requirements

    Setup
    ---
    In order to launch sublime from command you only need to create a symlink `/usr/local/bin/subl` point to sublime app, to do so run the following in the command line.
    In order to launch sublime from command line you only need to create a symlink `/usr/local/bin/subl` point to sublime app, to do so run the following in the command line.

    ### Sublime Text 2

  3. adrianorsouza revised this gist Aug 13, 2014. 1 changed file with 12 additions and 9 deletions.
    21 changes: 12 additions & 9 deletions sublime-command-line.md
    Original file line number Diff line number Diff line change
    @@ -1,27 +1,29 @@
    Launch Sublime Text from the command line on OSX
    ---

    Sublime Text includes a command line tool, `subl`, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITOR for unix tools, such as git and subversion.

    ### Requirements

    Requirements
    ---
    - Sublime text 2 or 3 installed in your system within `Applications` folder


    Setup
    ---
    In order to launch sublime from command you only need to create a symlink `/usr/local/bin/subl` point to sublime app, to do so run the following in the command line.

    Sublime Text 2
    ----
    ### Sublime Text 2


    ln -sv "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl

    Sublime Text 3
    ----
    ### Sublime Text 3


    ln -sv "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl


    Test it out
    ----
    ### Test it out

    type in command line

    subl test.rb
    @@ -47,3 +49,4 @@ then reload the shell:

    test again.

    Further info read from [sublime docs](https://www.sublimetext.com/docs/2/osx_command_line.html)
  4. adrianorsouza renamed this gist Aug 13, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. adrianorsouza created this gist Aug 13, 2014.
    49 changes: 49 additions & 0 deletions sublime-command-line
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    Launch Sublime Text from the command line on OSX
    ---


    ### Requirements

    - Sublime text 2 or 3 installed in your system within `Applications` folder


    In order to launch sublime from command you only need to create a symlink `/usr/local/bin/subl` point to sublime app, to do so run the following in the command line.

    Sublime Text 2
    ----

    ln -sv "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl

    Sublime Text 3
    ----

    ln -sv "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl


    Test it out
    ----
    type in command line

    subl test.rb

    it should open new file `test.rb` sublime text

    ----

    NOTE: To accomplish this you must:

    have created a directory where you actually place binaries `/usr/local/bin` if not make it before creating a `symlink`:


    mkdir -p /usr/local/bin

    have `/usr/local/bin` in your PATH environment variable, if not add by running the following command:

    echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bash_profile

    then reload the shell:

    source ~/.bash_profile

    test again.