vim-move
vim-move copied to clipboard
Custom key mapping not working properly in neovim
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 })
But it does work with regular vim keymaps in neovim?
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']]
Are you on Mac? Then #71 could be related.
@matze I am indeed, though using Kitty not iTerm.
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 toEsc+
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
kitty.conf -> macos_option_as_alt yes
for me using command + opt makes the keybindings work. Im using wezterm by the way.
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