0

I use the Dvorak layout and am trying to start using Neovim. By default, the arrow buttons were scattered all across the keyboard, so I created this script to remap them:

local function noremap(shortcut, command)
  -- vim.api.nvim_set_keymap("", shortcut, command, { noremap = true, silent = true })
  vim.keymap.set("", shortcut, command, { silent = true, noremap = true })
end

-- h is already in the right place
noremap("c", "k")
noremap("t", "j")
noremap("n", "l")

-- the keys I remapped to might be used for other commands, so I basically swap them
noremap("k", "c")
noremap("j", "t")
noremap("l", "n")

-- same for uppercase
noremap("K", "C")
noremap("J", "T")
noremap("L", "N")

Note that I'm using i, not h, for up. This is because I have set set up a layer on my keyboard with IJKL as arrows a long time ago and am already used to this, plus this makes more sense.

In raw Neovim, this worked fine, but then I installed LazyVim. I managed to get the remaps working by moving the code to lua/config/keymaps.lua, but there's a problem: when I press C (aka I on qwerty) for UP, there's a 0.5 second delay before the cursor moves up. RIGHT, LEFT and DOWN work fine.

I experimented with remapping UP to other buttons and the lag persisted. It disappears only if I don't remap it at all.

How could I fix this?

2 Answers 2

1

In standard Neovim the c key command is the command for change c. It wait for a move (or a text objet) to determine what to change, switching to operation pending mode.

LazyVim comes with which-key.nvim that provides hints when in operation pending mode (e.g.: c or d) to complete the operation.

To solve the problem you probably have to either:

  • Disable which-key.nvim
  • Restrict it to not make suggestions for operation pending mode (I'm not sure it is possible)

One way to disable which-key.nvim in LazyVim is to add a ~/.config/nvim/lua/plugins/disabled.lua file with the following content:

return {
    { "folke/which-key.nvim", enabled = false },
}
1

There is Dvorak support in an optional plugin distributed with Vim (:edit $VIMRUNTIME/macros/README.txt):

The following have been moved to an optional package.  Add the command to your
vimrc file to use the package:

packadd! dvorak     " Dvorak keyboard support; adds mappings

In particular, $VIMRUNTIME/pack/dist/opt/dvorak/dvorak/enable.vim might interest you.

Also see :help mbyte-keymap for another way to approach this; Vim comes with $VIMRUNTIME/keymap/dvorak.vim, too, so :set keymap=dvorak ought to work.

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.