Sublime Forum

How to define self define keybinds with some no predefine command?

#1

I want to define a keybinding to
Open in containing folder
Browse Package
and so on so forth.
but do not know how to add it in keybind file.
Is there someone how to define?Thanks!
here is an example define word_wrap to F4.

  { 
        "keys": ["f4"],
        "command": "toggle_setting",
        "args":
        {
                "setting": "word_wrap"
        }
    },

OK,I define a new command and bind it to a hotkey solve it.

import sublime
import sublime_plugin
import os
class opencontainCommand(sublime_plugin.TextCommand):
	def run(self,edit):
		# window = self.window
		file_name=self.view.file_name()
		dir_path = os.path.dirname(file_name)
        # sublime.set_clipboard(dir_path)
		os.startfile(dir_path)

{"caption":"START_CURRETN_FOLDER","command":"opencontain"},

{ "keys": ["shift+alt+f12"], "command": "opencontain"},

0 Likes