Closed Chaitanyabsprip closed 3 years ago
After creating the ranger buffer, rnvimr will set ft=rnvimr
, I think you can remap key for the escape key for terminal mode.
autocmd Filetype rnvimr inoremap jk <nop>
autocmd Filetype rnvimr inoremap kj <nop>
autocmd Filetype rnvimr tnoremap jk <nop>
autocmd Filetype rnvimr tnoremap kj <nop>
these commands should work but aren't.
autocmd Filetype rnvimr tnoremap <buffer><nowait> j j
autocmd Filetype rnvimr tnoremap <buffer><nowait> k k
@kevinhwang91 I tried the mappings you suggested and those are not working as required. It doesn't seem to be doing anything, I get an error message saying the mapping doesn't exist
What does :tmap
say in rnvimr? Before pressing :tmap
, make sure that you are at normal mode in rnvimr buffer.
t jk * <C-\><C-N>
t kj * <C-\><C-N>
t <M-o> * <C-\><C-N>:RnvimrToggle<CR>
t <M-i> * <C-\><C-N>:RnvimrResize<CR>
t <M-[> * <C-\><C-N>
autocmd Filetype rnvimr tnoremap <buffer><nowait> j j autocmd Filetype rnvimr tnoremap <buffer><nowait> k k
The above snippet work for me, please add it into your init.vim. Or run them before ranger started.
vim.api.nvim_set_keymap('t', 'jk', '<c-\\><c-n>', {noremap=true, silent=true})
vim.api.nvim_set_keymap('t', 'kj', '<c-\\><c-n>', {noremap=true, silent=true})
This is how I've set the keymap
augroup ranger
autocmd! Filetype rnvimr tnoremap <buffer><nowait> j j
autocmd! Filetype rnvimr tnoremap <buffer><nowait> k k
augroup end
and this is how I used your snippet
and it is not working, when I open ranger an error message pops saying Error detected while processing FileType Autocommands for "rnvimr": E31: No such mapping
augroup ranger
au!
autocmd Filetype rnvimr tnoremap <buffer><nowait> j j
autocmd Filetype rnvimr tnoremap <buffer><nowait> k k
augroup end
works now, thank you.
Is your feature request related to a problem? Please describe. I have
jk
andkj
bound to escape into normal mode for terminal mode and insert mode. As Ranger works in terminal mode this adds a delay when I am browsing files.Describe the solution you'd like If the terminal buffer in which ranger is working will have a custom filetype or some indentification it will be easy to make custom and conditional key bindings for ranger in nvim.