Sublime Text open open relative to project directoy

Scorb

I have a command mapped to ahotkey in sublime to open the user directory...

{ "keys": ["ctrl+alt+u"], "command": "open_dir", "args": {"dir": "$packages/User/"} },

How can I have a similar command that opens a directory two levels up from the project directory?

OdatNurd

The path variable $project_path expands out to the location of the current sublime-project file (which is specific to the current window) in the same way that $packages expands to the location of the Packages folder.

So, the following will open the directory two levels above the location of the current sublime-project file:

{
    "keys": ["ctrl+alt+u"],
    "command": "open_dir",
    "args": {"dir": "$project_path/../../"}
},

Sometimes people store their sublime-project files in locations other than the locations where their project files are actually stored (e.g. to centralize them all in one location or to remove clutter).

In that case, if you want the binding to open two levels above where the contents of the project are, you can use the $folder variable, which expands out to the location of the first folder that's open in the project (or window).

{
    "keys": ["ctrl+alt+u"],
    "command": "open_dir",
    "args": {"dir": "$folder/../../"}
},

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to open default project in Sublime Text when starting app (mac)

From Dev

sublime text 3 on mac os not keeping project open

From Dev

sublime text 3 on mac os not keeping project open

From Dev

Sublime Text 3 - Open CMD prompt at current or project directory (Windows)

From Dev

Open current directory as project in sublime?

From Dev

Open current directory as project in sublime?

From Dev

Sublime Text 2 - Open folders

From Dev

sublime text : open containing folder

From Dev

Shortcut/"Open with" Sublime Text, in a new Sublime window

From Dev

Sublime Text: text list of open files

From Dev

Sublime Text 3 fails to open SumatraPDF

From Java

How to open remote files in sublime text 3

From Dev

Sublime Text remember open files and folders

From Dev

Sublime Text, open files depending on the git branch

From Dev

sublime text 3 - console - how to open a file

From Dev

Open multiple projects in Sublime Text 3 editor

From Dev

How to open sublime text from terminal in windows?

From Dev

Renaming open files in sublime text 2

From Dev

"unable to open" a sublime text macro file

From Dev

How to tell sublime text not to open two windows

From Dev

Open files in existing window in Sublime Text

From Dev

Sublime Text not showing in Nautilus "open with" menu

From Dev

Mac: Edit in Filezilla with Sublime text always open a new Sublime window

From Dev

Sublime Text through command line: Don't open more than 1 window/instance, add to working project instead

From Dev

'fopen' in C can't open existing file in current directoy on Unix

From Dev

Sublime Text open a specific file with the command palette or key binding

From Dev

Sublime Text Plugin Dev - Open a file, Focus folder in sidbar

From Java

Sublime Text 2 and 3: open the same file multiple times

From Dev

How can I open the current file in a new pane in sublime text?

Related Related

  1. 1

    How to open default project in Sublime Text when starting app (mac)

  2. 2

    sublime text 3 on mac os not keeping project open

  3. 3

    sublime text 3 on mac os not keeping project open

  4. 4

    Sublime Text 3 - Open CMD prompt at current or project directory (Windows)

  5. 5

    Open current directory as project in sublime?

  6. 6

    Open current directory as project in sublime?

  7. 7

    Sublime Text 2 - Open folders

  8. 8

    sublime text : open containing folder

  9. 9

    Shortcut/"Open with" Sublime Text, in a new Sublime window

  10. 10

    Sublime Text: text list of open files

  11. 11

    Sublime Text 3 fails to open SumatraPDF

  12. 12

    How to open remote files in sublime text 3

  13. 13

    Sublime Text remember open files and folders

  14. 14

    Sublime Text, open files depending on the git branch

  15. 15

    sublime text 3 - console - how to open a file

  16. 16

    Open multiple projects in Sublime Text 3 editor

  17. 17

    How to open sublime text from terminal in windows?

  18. 18

    Renaming open files in sublime text 2

  19. 19

    "unable to open" a sublime text macro file

  20. 20

    How to tell sublime text not to open two windows

  21. 21

    Open files in existing window in Sublime Text

  22. 22

    Sublime Text not showing in Nautilus "open with" menu

  23. 23

    Mac: Edit in Filezilla with Sublime text always open a new Sublime window

  24. 24

    Sublime Text through command line: Don't open more than 1 window/instance, add to working project instead

  25. 25

    'fopen' in C can't open existing file in current directoy on Unix

  26. 26

    Sublime Text open a specific file with the command palette or key binding

  27. 27

    Sublime Text Plugin Dev - Open a file, Focus folder in sidbar

  28. 28

    Sublime Text 2 and 3: open the same file multiple times

  29. 29

    How can I open the current file in a new pane in sublime text?

HotTag

Archive