vim-move icon indicating copy to clipboard operation
vim-move copied to clipboard

Custom key mapping not working properly in neovim

Open SDA-31 opened this issue 3 years ago • 9 comments

I have several .lua files in the config directory. I remap keyboard shortcuts with let g:move_map_keys = 1 on

local keymap = vim.api.nvim_set_keymap
kemayp("", "C-h", "<Plug>MoveCharLeft", { noremap = true, silent = true })
keymap("", "C-l", "<Plug>MoveCharRight", { noremap = true, silent = true })

and it works only after entering the command :so %.

Also there are my keyboard shortcuts:

keymap("n", "<A-l>", ">>", { noremap = true, silent = true })
keymap("v", "<A-l>", ">gv", { noremap = true, silent = true })
keymap("n", "<A-h>", "<<", { noremap = true, silent = true })
keymap("v", "<A-h>", "<gv", { noremap = true, silent = true })

SDA-31 avatar May 15 '22 08:05 SDA-31

But it does work with regular vim keymaps in neovim?

matze avatar May 16 '22 07:05 matze

Not sure if this is related, but vim-move doesn't create any mappings for me at all in Neovim 0.8.0. None of these have any effect:

vim.g.move_key_modifier = 'C'
vim.cmd[[let g:move_key_modifier = 'C']]

zeitchef avatar Jun 27 '22 16:06 zeitchef

Are you on Mac? Then #71 could be related.

matze avatar Jun 27 '22 19:06 matze

@matze I am indeed, though using Kitty not iTerm.

zeitchef avatar Jun 27 '22 19:06 zeitchef

For a Mac and and the latest vim-move https://github.com/matze/vim-move/commit/a4bbedda7ef516b4a1b74d145cd642297e82e800, this is what works for me in 4 scenarios: vim/neovim in iTerm and MacVim/VimR:

if has("mac") && has("gui_running")
  let g:move_normal_option = 1
endif

assuming:

  • the other vim-move defaults have not been changed
  • iTerm profile has Left Option key: set to Esc+

huyz avatar Jul 29 '22 19:07 huyz

I had to revisit as not everything was working, in particular inside the terminal. Here's my solution: https://github.com/matze/vim-move/issues/73

huyz avatar Aug 13 '22 18:08 huyz

kitty.conf -> macos_option_as_alt yes

hui00 avatar May 12 '23 22:05 hui00

for me using command + opt makes the keybindings work. Im using wezterm by the way.

felipeospina21 avatar Sep 12 '23 20:09 felipeospina21

I am using neovim v0.9.2 and neither of this work

vim.g.move_key_modifier = 'C'
vim.cmd[[let g:move_key_modifier = 'C']]

Unlike zeitchef I am running linux

AgustinOrdonez avatar Sep 22 '23 03:09 AgustinOrdonez