I have Ctrl-h mapped to move to the pane left of current in Normal Mode. If I forget that I’m in insert mode and do this, it just locked up Neovim and starts consuming processor until I force quit. I can’t find what this mapping is trying to do and how to undo it. It occasionally causes me to lose work. Please help. :-)

EDIT: I just looked in my config to try to just add this binding to do the same thing in Insert Mode and discovered that that’s what it’s already supposed to do. I have CTRL-H mapped to , but all it does is lockup Neovim.

  • Cipherd@lemmy.ml
    link
    fedilink
    arrow-up
    3
    ·
    7 months ago
    :help i_CTRL-H
    
     or CTRL-H  Delete the character before the cursor (see i_backspacing                                                       about joining lines).
    
  • philwills@programming.dev
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    7 months ago

    You probably already thought of this, but just in case, are you switching to normal before calling the command switch panes?

    inoremap <silent> <c-h> <esc>:silent call TmuxMove('h')<cr>
    

    Edit: if this doesn’t work I give up…

    • rustbuckett@programming.devOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      7 months ago

      That’s the thing. I forget to switch to normal mode, it just locks up. The default behavior is the backspace in insert mode, but that’s not what it’s doing. I’ll try to remember to post my mappings.

  • rustbuckett@programming.devOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    7 months ago

    I think I’m on the trail. According to this post on Reddit, some terminal emulators have trouble passing the correct codes to terminal apps like Neovim. I did manage to break C-H completely, but that’s not really helpful. By adding the following keybinds to alacritty.yml, I’m getting Neovim to behave differently, but not as expected.

    key_bindings:
      - { key: F6,    mods: Shift,        chars: "\x1b[17~;1u"   }
      - { key: H,     mods: Control,               chars: "\x1b[72;4u"}
    

    The first one for S-F6, gets Neovim to recognize the ‘F6’ part, but does not behave any differently than if I just pressed ‘F6’ without the modifier. But, without this key binding in alacritty.yml, Neovim doesn’t react to Shift+F6 at all.

    The second entry, if I’m in Insert Mode in Neovim, causes Neovim to switch to Normal Mode and go to the top of the buffer. In normal mode, it just goes to the top of the buffer instead of the defined behavior of moving to the pane to the left of the current pane.

    So, I’ve basically managed to get a “different error”, but not solve the problem. Any ideas?

  • rustbuckett@programming.devOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    7 months ago

    This isn’t exactly a fix, but it keeps me from accidentally locking up my terminal and potentially losing work

    map('i', '', 'gj', {})
    map('i', '', 'gk', {})
    map('i', '', '', {})
    map('i', '', '', {})
    map('n', '', 'j', {})
    map('n', '', 'k', {})
    map('n', '', 'l', {})
    map('n', '', 'h', {})
    

    Now if I forget to leave Insert Mode, the cursor just moves to the left, and C-H in Normal Mode still works as expected.

    p.s. I commented the key_bindings in alacritty.yml