Sublime Forum

Terminus opens to the wrong directory

#1

I would like terminus to open to the directory of the file I am currently working on in Sublime.

I have this in my keybindings:

{ 
    "keys": ["alt+`"], "command": "toggle_terminus_panel"
},    
    { 
    "keys": ["ctrl+alt+t"], "command": "terminus_open", "args": {
        "cwd": "${file_path:${folder}}"
    }
},
{ 
"keys": ["ctrl+w"], "command": "terminus_close", "context": [{ "key": "terminus_view"}]
},

    { 
    "keys": ["ctrl+alt+t"], "command": "terminus_open", "args": {
        "cwd": "${file_path:${folder}}"
    }
}

However, if I open a file in the folder /home/user/blue/element/ Terminus opens to
/home/user/blue

How can I fix this?

0 Likes

#2

I am assuming you are talking about this binding

{ 
    "keys": ["ctrl+alt+t"], "command": "terminus_open", 
    "args": {
        "cwd": "${file_path:${folder}}"
    }
}

Using this binding appears to work for me correctly i.e. opens the folder in the Terminus view containing the currently open file, on Windows 11 using ST Build 4143 (latest stable)

Maybe you could do sublime.log_commands(True) & sublime.log_input(True) and see if they are logging as you expect them. If that’s not the case, perhaps more detail is needed.

0 Likes

#3

I added the code as you gave it and logged as suggested. The results were:

key evt: ctrl+alt+t
command: terminus_open {"cwd": "${file_path:${folder}}"}
command: terminus_activate {"auto_close": true, "cancellable": false, "cmd": ["/bin/bash", "-i", "-l"], "cwd": "/home/red/Documents/mydata", "default_title": "Login Shell", "env": {"LANG": "en_ZA.UTF-8", "TERM": "linux", "TERMINUS_SUBLIME": "1", "TERM_PROGRAM": "Terminus-Sublime"}, "file_regex": null, "line_regex": null, "panel_name": "Terminus 2", "show_in_panel": null, "tag": null, "timeit": false, "title": null}
command: terminus_initialize_view {"auto_close": true, "cancellable": false, "cmd": ["/bin/bash", "-i", "-l"], "cwd": "/home/red/Documents/mydata", "default_title": "Login Shell", "env": {"LANG": "en_ZA.UTF-8", "TERM": "linux", "TERMINUS_SUBLIME": "1", "TERM_PROGRAM": "Terminus-Sublime"}, "file_regex": null, "line_regex": null, "panel_name": "Terminus 2", "show_in_panel": null, "tag": null, "timeit": false, "title": null}
command: terminus_render
command: terminus_show_cursor
command: terminus_render
command: terminus_show_cursor
command: drag_select {"event": {"button": 1, "x": 11.796875, "y": 311.08984375}}
command: drag_select {"event": {"button": 1, "x": 10.84375, "y": 562.796875}}
command: drag_select {"event": {"button": 1, "x": 11.171875, "y": 538.58984375}}
command: drag_select {"event": {"button": 1, "x": 186.015625, "y": 624.24609375}}
command: drag_select {"event": {"button": 1, "x": 143.734375, "y": 918.4140625}}

>>> sublime.log_input(True) 
command: drag_select {"event": {"button": 1, "x": 187.09375, "y": 117.8515625}}
key evt: ctrl+alt+t
command: terminus_open {"cwd": "${file_path:${folder}}"}
command: terminus_activate {"auto_close": true, "cancellable": false, "cmd": ["/bin/bash", "-i", "-l"], "cwd": "/home/red/Documents/mydata", "default_title": "Login Shell", "env": {"LANG": "en_ZA.UTF-8", "TERM": "linux", "TERMINUS_SUBLIME": "1", "TERM_PROGRAM": "Terminus-Sublime"}, "file_regex": null, "line_regex": null, "panel_name": "Terminus 2", "show_in_panel": null, "tag": null, "timeit": false, "title": null}
command: terminus_initialize_view {"auto_close": true, "cancellable": false, "cmd": ["/bin/bash", "-i", "-l"], "cwd": "/home/red/Documents/mydata", "default_title": "Login Shell", "env": {"LANG": "en_ZA.UTF-8", "TERM": "linux", "TERMINUS_SUBLIME": "1", "TERM_PROGRAM": "Terminus-Sublime"}, "file_regex": null, "line_regex": null, "panel_name": "Terminus 2", "show_in_panel": null, "tag": null, "timeit": false, "title": null}
command: terminus_render
command: terminus_show_cursor
command: terminus_render
command: terminus_show_cursor
command: drag_select {"event":

I am still getting the wrong directory. Not sure why.

0 Likes