submode

activate granular scope for keymap by trigger command

t9md

46

3

0.1.1

MIT

GitHub

atom-submode

activate granular CSS scope for keymap by trigger command

Development status

alpha

What's this?

How to use

1. Set configuration in your config.cson

  submode:
    submode:
      "after-save": # submode name
        target: "atom-workspace", # Must be one of ["atom-workspace", "atom-text-editor", "atom-pane"]
        commands: [
          "core:save" # List of commands which trigger this submode
        ],
      "after.move":
        target: "atom-text-editor",
        commands: [
          "core:move-up"
          "core:move-down"
          "core:move-right"
          "core:move-left"
        ]

2. Define keymap to use defined submode in your keymap.cson

# after you invoke `core:save`, you can invoke `some:command` by keystroke `a`
'atom-workspace.after-save':
  "a": "some:command"

# after you invoke `core:move-up/down/right/left`, you can invoke `some:command` by keystroke `a`
'atom-text-editor.after.move':
  "a": "some:command"

Practical example

config.cson

  submode:
    submode:
      "gt-mode":
        target: "atom-pane"
        commands: [
          "vim-mode-plus:next-tab" # `g t`
          "vim-mode-plus:previous-tab" # `g T`
        ]

keymap.cson

'atom-pane.gt-mode':
  't': 'vim-mode-plus:next-tab'
  'T': 'vim-mode-plus:previous-tab'

# To win over default `t`(vim-mode-plus:till) in text-editor scope.
'atom-pane.gt-mode atom-text-editor.vim-mode-plus':
  't': 'vim-mode-plus:next-tab'
  'T': 'vim-mode-plus:previous-tab'