Skip to content

Instantly share code, notes, and snippets.

@ntrepid8
Created January 10, 2018 16:57
Show Gist options
  • Save ntrepid8/e62759b6fde57bc4de1efb373669948c to your computer and use it in GitHub Desktop.
Save ntrepid8/e62759b6fde57bc4de1efb373669948c to your computer and use it in GitHub Desktop.

Revisions

  1. ntrepid8 created this gist Jan 10, 2018.
    15 changes: 15 additions & 0 deletions sublp.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #!/usr/bin/env python3
    import os
    import subprocess

    cwd = os.getcwd()
    file_list = [f for f in os.listdir(cwd) if f.endswith('.sublime-project')]
    fl_len = len(file_list)

    if fl_len == 0:
    print("sublime-project file not found")
    elif fl_len == 1:
    print("opening: {}".format(file_list[0]))
    subprocess.run(["/usr/bin/subl", "--project", file_list[0]])
    else:
    print("error: multiple sublime-project files found")