Sublime Forum

Toggle the "show_full_path" setting?

#1

I would like to make a keybinding to toggle the “show_full_path” setting.

I have put

“keys”: [“super+alt+0”],
“command”: “toggle_setting”,
“args”:
{
“setting”: “show_full_path”
}
},

in my sublime-keymap, and checked with view.settings().get(‘show_full_path’) in the console that it indeed changes the value of the corresponding variable. However, I don’t see any change in the title bar, while the change is immediate when I modify the User/Preferences.sublime-settings file. This behaviour is independent of the value of “show_full_path” (true/false/nothing) in my Preferences.sublime-settings file.

Any clue? I’m on macOS Sonoma 14.2.1/ST 4169.

0 Likes

#2

toggle_setting deals with view-level settings, which "show_full_path" isn’t (despite the fact it’s returned in a cascading manner from what you ran in the console).

I guess you would have to use the Python API, e.g.

prefs = sublime.load_settings("Preferences.sublime-settings")
prefs.set("show_full_path", not prefs.get("show_full_path"))
1 Like

#3

It works like a charm! Many thanks.

1 Like