Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom key mapping not working properly in neovim #69

Open
SDA-31 opened this issue May 15, 2022 · 9 comments
Open

Custom key mapping not working properly in neovim #69

SDA-31 opened this issue May 15, 2022 · 9 comments

Comments

@SDA-31
Copy link

SDA-31 commented May 15, 2022

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 })
@matze
Copy link
Owner

matze commented May 16, 2022

But it does work with regular vim keymaps in neovim?

@zeitchef
Copy link

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']]

@matze
Copy link
Owner

matze commented Jun 27, 2022

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

@zeitchef
Copy link

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

@huyz
Copy link

huyz commented Jul 29, 2022

For a Mac and and the latest vim-move a4bbedd, 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
Copy link

huyz commented Aug 13, 2022

I had to revisit as not everything was working, in particular inside the terminal. Here's my solution: #73

@hui00
Copy link

hui00 commented May 12, 2023

kitty.conf -> macos_option_as_alt yes

@felipeospina21
Copy link

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

@AgustinOrdonez
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants