Lately I've been running into a strange issue where, upon switching focus in and out of Neovim to other windows, some of my keymaps will not be set properly upon re-focusing and instead use the defaults. This, to my knowledge, is not consistent and I cannot reliably reproduce.

I'm guessing something is setting them back to the defaults, but the second I bring up the command menu (:), my keymaps will be set properly, so I don't quite know how to debug this. I'm hoping there's some sort of keymap history, but I haven't been able to find any mention of this. There's certainly no warning/error messages, just wrong mappings until I hit : (possibly other keys/combinations, but I haven't found anything), then we're all good again.

I am able to (inconsistently) reproduce with this minimal config:

-- init.lua
require "keybinds"
-- /lua/keybinds.lua
local opts = { noremap = true, silent = true }
local keymap = vim.keymap.set

-- Normal --
-- Fix navigation
keymap({'n', 'v', 'x'}, ';', 'l', opts)
keymap({'n', 'v', 'x'}, 'l', 'k', opts)
keymap({'n', 'v', 'x'}, 'k', 'j', opts)
keymap({'n', 'v', 'x'}, 'j', 'h', opts)

I realize many people have strong opinions on this keymap in particular, but I've been using it for many years, am very happy with it, and find kl much more comfortable for up/down movement. I'm not looking to change this beyond fixing any mistakes I've made in setting it, of course.

I'm using i3 as my window manager, and therefore am using $mod+[jkl;] for switching focus, both out & back into nvim. I don't see any conflict there, but thought I'd mention it just in case.

Neovim version info:

$ nvim --version
NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1702233742
  • Welcome to Vim :-) From your question I understand that you are using a form of Unix (probably Linux) and the nvim console version of Neovim. Could you tell us which version of Neovim you are using? Commented Feb 24 at 12:35
  • 1
    Sorry about that! Yes, Linux, but I didn't realize there's multiple variants of Neovim? Seems to be just the one from what I can see. Appended version info to the post. Commented Feb 24 at 12:46
  • Thanks. I'll try to reproduce your problem but at first glance it looks to be either a bug in Neovim or an add interaction with the terminal. Commented Feb 24 at 12:56
  • 1
    Maybe it's some sort of system bug, every now and then I'm seeing "A" in my terminal after pressing the up arrow to go back through my command history. Some key getting stuck as active? Not sure. Frustrating as can be. Commented Mar 1 at 14:22
  • 1
    Update: Ended up reverting everything on my system one-by-one and it seems this is a bug w/ Alacritty, my terminal. Really didn't expect that. Will add as an "answer", though I haven't yet found the specific regression (or opened an informed issue) so the solution isn't great. Commented Mar 3 at 8:29

1 Answer 1


It seems that this specific issue is due to a bug in Alacritty, my terminal of choice. I reverted all packages on my system one-by-one and found that it was the culprit, not (Neo)vim or my config. I'm still not quite sure how it could cause this though.

I was on 0.13.1, the latest at the time of writing, and reverted to 0.13.0.

I unfortunately have not yet found a solution beyond reverting, but will be bisecting the changes and/or opening an issue on Alacritty's tracker as soon as I have the time. Will update here in the off chance it's useful to anyone else.

  • That’s very bizarre—I can’t see what signals Alacritty might possibly send that revert mappings in neovim, unless the latter already had a code path for that (or Alacritty sent a truly odd program).
    – D. Ben Knoble
    Commented Mar 3 at 14:15
  • I would guess it's not reverting anything, but forcing a key combination that brings out the default movement behavior? Not sure what that'd be, however. As mentioned above, I'd occasionally see A in my terminal instead of my history when pressing the up arrow, which can be replicated with Alt+up. Alt wouldn't explain the default movements in (n)vim, but maybe another key could? I did test key input with xev, and never saw any issue in my browser/other windows, so it was isolated to my terminal. Commented Mar 3 at 16:49
  • Arrow keys send roughly Esc [ A (B,C,D), FYI
    – D. Ben Knoble
    Commented Mar 3 at 18:08
  • I'm clearly well aware of that. Commented Mar 4 at 4:32

Your Answer

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

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