Atom Editor - Body Keybind for Everything Except V

2019-09-09 21:50发布

问题:

I am an avid Vim user who recently decided to give Atom a try. In vim I map ,bn & ,bp to next buffer and previous buffer, respectively. I am trying to imitate the same behavior in Atom for switching between tabs. In my keymap.cson file I have the following:

'body':
  ', b n': 'pane:show-next-item'
  ', b p': 'pane:show-previous-item'

This will work except if I try to type just the ',' character in Vim mode insert it will not display unless I hit ',' twice.

I thought maybe the following would work, but it had no effect:

'body .vim-mode:not(.insert-mode)':
  ', b n': 'pane:show-next-item'
  ', b p': 'pane:show-previous-item'

Any help is appreciated!

回答1:

Turns out I simply forgot to add the atom-text-editor selector before the .vim-mode:not(.insert-mode) selector. Changed the script to the following and it worked:

'body atom-text-editor.vim-mode:not(.insert-mode)':
  ', b n': 'pane:show-next-item'
  ', b p': 'pane:show-previous-item'