stevearc / dressing.nvim

Neovim plugin to improve the default vim.ui interfaces
MIT License
1.73k stars 32 forks source link

Allow settings mappings for `vim.ui.input` #16

Closed mawkler closed 2 years ago

mawkler commented 2 years ago

I there any way to configure key mappings for vim.ui.input? I would like to be able to use <C-k>/<C-j> to move up/down in history by mapping them to <Up>/<Down>.

I tried using an autocmd FileType DressingInput to set the mappings buffer-locally but for some reason it didn't work for me. The autocommand gets triggered but the mappings don't appear.

stevearc commented 2 years ago

What is the exact autocmd that you're using? It works fine for me with

autocmd FileType DressingInput imap <buffer> <C-j> <Down>
autocmd FileType DressingInput imap <buffer> <C-k> <Up>
mawkler commented 2 years ago

You're right. The mistake I made was basically to use inoremap instead of imap. I have just switched from using vim.api.nvim_buf_set_keymap to vim.keymap.set and the latter sets the the opts argument to { remap = false } by default.