1

I would like to disable the Alt-h key combination that brings up the horizontal terminal in Neovim.

I see the original mapping in ~/.config/nvim/lua/core/mappings.lua:

    ["<A-h>"] = {                                      
      function()                                       
        require("nvterm.terminal").toggle "horizontal" 
      end,                                             
      "Toggle horizontal term",                        
    },                                                 

This mapping is for normal mode (n).

I'm looking to add an override in .config/nvim/lua/custom/init.lua.

I've tried all sorts of approaches, using unmap, vim.api.nvim_set_keymap, map <Esc-h> <Nop>, and more, but I can't find something that works apart from commenting out the original code, which is not a good solution.

Any pointers appreciated.

Note - I have NVChad installed, if this has any impact.

3
  • 1
    Is it <Esc>-h or <Alt>-h? Nov 8 at 10:24
  • 1
    @VivianDeSmedt depending on the terminal, they might be equivalent.
    – D. Ben Knoble
    Nov 8 at 14:01
  • Is uninstalling nvchad an acceptable solution? I assume that’s where the original code came from?
    – D. Ben Knoble
    Nov 8 at 14:02

1 Answer 1

0

I would suggest you to add the following lines to:

~/.config/nvim/lua/custom/mapping.lua

-- more keybinds!
M.custom = {
  n = {
    ["<A-h>"] = {"<Nop>", ""}
  }
}
2
  • 1
    Perfect! Thanks. It's obvious now, and the best approach as far as I can see, consistent with the way the mapping is done in the first place. Cheers.
    – Alex D.
    Nov 9 at 10:15
  • Thanks for the feedback :-). If the solution fit your need maybe you can accept the answer using the v button next to the arrow voting buttons. It allow the question to rest. Nov 9 at 10:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.