What's wrong with my ctrl-[hjkl] and ctrl-\ keybindings?


#1

I’m trying to map my focus-pane-<direction> commands, I read a response in another discussion, and have been hacking away at in for a while but am not making any progress. I also checked out the issue #79 and tried the unset! as shown, but even then ctrl-k is still killing chars instead of moving up as expected. I am getting ctrl-h to register as shown, but none of the other commands are even registering. What am I missing here?

I’ve definitely been reloading my windows after all my edits, so I’m pretty sure that isn’t the problem, below is some screenshots and my keymap.cson

Also, I’ve been trying to bind to ctrl-\ but also to no avail, would love some help :smiley:

'atom-text-editor.vim-mode:not(.insert-mode)':
  'ctrl-\\ \\': 'pane:split-down'
'atom-text-editor.vim-mode:not(.insert-mode)':
  'ctrl-\\ |': 'pane:split-right'

'atom-text-editor:not([mini])':
  'alt-shift-S': ''
'.available-snippets atom-text-editor[mini]':
  'alt-shift-S': ''

# 'atom-text-editor.vim-mode:not(.insert-mode),
# .advanced-open-file atom-text-editor':
#   'ctrl-l': 'window:focus-pane-on-right'

'atom-text-editor atom-text-editor.vim-mode:not(.insert-mode)':
  'ctrl-k': 'window:focus-pane-above'

'atom-text-editor.vim-mode:not(.insert-mode)':
  'ctrl-j': 'window:focus-pane-below'
'atom-text-editor.vim-mode:not(.insert-mode)':
  'ctrl-h': 'window:focus-pane-on-left'

'atom-workspace atom-text-editor:not([mini])':
  'ctrl-l': 'window:focus-pane-on-right'
'atom-text-editor':
  'ctrl-l': 'window:focus-pane-on-right'





#2

Ctrl+K is particularly problematic because there are a bunch of compound keybindings assigned to that on Windows and Linux. These are just some of them:

If you want to use Ctrl+K by itself for something else, you need to unset! all of them. (Well, you can use it for something else without unsetting everything, but you have to wait for 500ms after you press it for Atom to know you aren’t activating one of the combination ones.)

The ones with \, you have to use quadruple backslash to make them work, so the first one would be

ctrl-\\\\ \\\\


#3

Thanks for the response lee! Sorry that took so long to get back to you, I don’t think I’m going to need to unset as many ctrl-k s because I’m using a mac so there aren’t as many keys bound to it. However there is a editor:cut-to-end-of-line command bound, and for some it isn’t working when I unset, unless there is something wrong with how I’m using it:

'atom-text-editor':
  'ctrl-k': 'unset!'
'atom-text-editor atom-text-editor.vim-mode:not(.insert-mode)':
  'ctrl-k': 'window:focus-pane-above'

#4

What does the Keybinding Resolver show? Can you attach a screenshot?


#5

It looks like atom is aware of the focus-pane-above command but it is still favoring editor:cut-to-end-of-line, although interestingly that command is not actually being run (as in no text is being deleted). Any idea what is wrong in this case?


#6

Your selector is wrong. window:focus-pane-above has an X next to it because it’s not being matched. You have an extra atom-text-editor in the selector, and text editors generally aren’t nested within one another.


#7

Thanks @DamnedScholar! That worked for moving between panes :thumbsup:

'atom-text-editor':
  'ctrl-k': 'unset!'
  'ctrl-k': 'window:focus-pane-above'
  'ctrl-j': 'window:focus-pane-below'
  'ctrl-h': 'window:focus-pane-on-left'
  'ctrl-l': 'window:focus-pane-on-right'  

Now what about splitting panes with the Ctrl-\ \ and Ctrl-\ | keys?

I’ve tried tacking them onto my atom-text-editor part but currently nothing is even being registered by atom. Attached are two images: first when I press the leading Ctl-\ and then another when I press the following \