atom-haskell-archive / haskell-ghc-mod

haskell-ghc-mod atom package
https://atom.io/packages/haskell-ghc-mod
MIT License
69 stars 20 forks source link

How to add key mapping of type insert? #183

Closed ZhiruiLi closed 7 years ago

ZhiruiLi commented 7 years ago

I want to map ctrl-p and ctrl-n for up and down thought the list only when the content list of insert-type and go-to-declaration shows. Is there any way I can do that?

I can't add it as a global key mapping, because I map ctrl-p as the toggle key of fuzzy finder. That means I want to map the key as:

'.platform-win32 atom-text-editor.autocomplete-active':
  'ctrl-p': 'autocomplete-plus:move-up'
  'ctrl-n': 'autocomplete-plus:move-down'

'.platform-win32 atom-text-editor.<??? something like "haskell-ghc-mod.insert-type">':
  'ctrl-p': 'core:move-up'   <---- or something like 'haskell-ghc-mod:move-up'
  'ctrl-n': 'core:move-down'

'atom-text-editor':
  'ctrl-p': 'fuzzy-finder:toggle-file-finder'

Thanks!

lierdakil commented 7 years ago

Something like this should do the trick:

"atom-workspace .select-list.ide-haskell":
  "ctrl-p": "core:move-up"

More specific targeting isn't possible at the moment, though, i.e. all ide-haskell-related select lists will have those bindings. I don't really think it's a problem, but you're free to try to convince me otherwise.

ZhiruiLi commented 7 years ago

That works fine! Thanks very much @lierdakil : )