I have this keyboard command:
{"keys":["alt+v"], "command":"toggle_setting", "args":{"setting":"preview_on_click"}},
But when I press alt+v
nothing is happening, setting stays the same.
I have this keyboard command:
{"keys":["alt+v"], "command":"toggle_setting", "args":{"setting":"preview_on_click"}},
But when I press alt+v
nothing is happening, setting stays the same.
toggle_setting
toggles a setting for the currently focused file, it doesn’t work for application settings. I don’t think there’s a built-in command that does what you want, you’d need a plugin to do this.
I guess I will have to learn to to write plugins then. Because there are some things that I need, but can’t find them in packages.
@IGRACH
I am not sure to do things in an optimal way, but I have a command for this.
I have the following in my Packages/User/my_commands.py
file:
import sublime
import sublime_plugin
class TogglePreviewOnClick(sublime_plugin.ApplicationCommand):
def run(self):
prefs = sublime.load_settings("Preferences.sublime-settings")
prefs.set("preview_on_click", not prefs.get("preview_on_click"))
sublime.save_settings("Preferences.sublime-settings")
With that you can set in your sublime-keymap
file:
{"keys":["alt+v"], "command":"toggle_preview_on_click"},