local function rekey(t, key, command)
  vim.api.nvim_set_keymap(t, key, command, { noremap = true })
end

local function remap(t, key, command)
  vim.api.nvim_set_keymap(t, key, command, { noremap = false })
end

function rekey_normal(key, command)
  rekey('n', key, command)
end

function rekey_input(key, command)
  rekey('i', key, command)
end

function rekey_visual(key, command)
  rekey('v', key, command)
end

function rekey_terminal(key, command)
  rekey('t', key, command)
end

function remap_normal(key, command)
  remap('n', key, command)
end

function remap_input(key, command)
  remap('i', key, command)
end

function remap_visual(key, command)
  remap('v', key, command)
end

function remap_terminal(key, command)
  remap('t', key, command)
end