Skip to content
This repository has been archived by the owner on Apr 6, 2018. It is now read-only.
This repository has been archived by the owner on Apr 6, 2018. It is now read-only.

hotkey to enable/disable package #966

Closed
morenoh149 opened this issue Feb 12, 2016 · 6 comments
Closed

hotkey to enable/disable package #966

morenoh149 opened this issue Feb 12, 2016 · 6 comments
Labels

Comments

@morenoh149
Copy link
Contributor

I work with colleagues that do not always know vim. There should be a hotkey to turn this mode on and off.

@maxbrunsfeld
Copy link
Contributor

This is something you can add yourself:

init.coffee

atom.commands.add 'atom-workspace', 'vim-mode:toggle-enabled', ->
  disabledPackages = atom.config.get('core.disabledPackages')
  disabledPackageIndex = disabledPackages.indexOf('vim-mode')
  if disabledPackageIndex is -1
    disabledPackages.push('vim-mode')
  else
    disabledPackages.splice(disabledPackageIndex, 1)
  atom.config.set('core.disabledPackages', disabledPackages)

@morenoh149
Copy link
Contributor Author

morenoh149 commented Feb 12, 2016

https://atom.io/docs/v1.5.2/hacking-atom-the-init-file

/*
~/.atom/keymap.cson
*/
'atom-workspace':
  'ctrl-alt-v': 'vim-mode:toggle-enabled'

@elrob
Copy link

elrob commented Aug 12, 2016

Hi @morenoh149 and @maxbrunsfeld, I added those two snippets to the respective files and restarted atom but it doesn't seem to work. 'ctrl-alt-v' does nothing. I also tried a different key combination 'ctrl-shift-F12' and that didn't work either. I'm new to atom, any ideas what I'm missing or how to debug it?
Thanks

@morenoh149
Copy link
Contributor Author

no clue. I tried to be as clear as possible.

@elrob
Copy link

elrob commented Aug 15, 2016

No worries, I got the following to work fine.
credit goes to chibicode

# init.coffee

atom.commands.add 'atom-text-editor',
  'user:toggle-vim-mode': (event) ->
    if atom.packages.isPackageDisabled("vim-mode")
      atom.packages.enablePackage("vim-mode")
    else
      atom.packages.disablePackage("vim-mode")


# keymap.cson

'atom-workspace':
  'ctrl-shift-f12': 'user:toggle-vim-mode'

@nolanholden
Copy link

nolanholden commented Jan 4, 2018

for those who wind up here and now use vim-mode-plus, use the following (credit to elrob, chibicode):

# init.coffee

atom.commands.add 'atom-text-editor',
  'user:toggle-vim-mode-plus': (event) ->
    if atom.packages.isPackageDisabled("vim-mode-plus")
      atom.packages.enablePackage("vim-mode-plus")
    else
      atom.packages.disablePackage("vim-mode-plus")


# keymap.cson

'atom-workspace':
  'ctrl-shift-f12': 'user:toggle-vim-mode-plus'

(hint: init.coffee exists in your ~/.atom/)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants