oil.nvim
oil.nvim copied to clipboard
Question: How to remap the `j` and `k` keys in floating window
Is it possible to remap the j and k keys in the floating window? In telescope, I currently use Ctrl+j to move down and Ctrl+k to move up and would like to keep it consistent, unless this causes issues with oil.nvim. Thoughts?
IMO it's consistent vim-wise. In telescope you could also have j and k working when entering normal mode(Esc). In oil you are in the normal mode by default, so you have the j and k by default.
If you really want to be fully consistent, then you can map the keys when you open an oil buffer:
vim.api.nvim_create_autocmd("FileType", {
pattern = "oil",
callback = function(event)
vim.keymap.set("n", "<C-j>", "<cmd>normal! j<cr>", { buffer = event.buf })
vim.keymap.set("n", "<C-k>", "<cmd>normal! k<cr>", { buffer = event.buf })
end,
})
Other than that, I just use normal j/k.