Hi there! I have just begun to use neovim with the kickstart.nvim setup. I also use a custom keyboard with the colemak layout, where I have remapped 'hjkl' with 'neio'. I have a problem with netrw that the new keys 'neio' does not work when navigating the file explorer. How can I make them work with netrw?
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
To enable your Colemak neio keybindings in Netrw, you'll need to create buffer-local mappings specifically for Netrw buffers. This is because Netrw sets its own key mappings that override your global customizations. Here's how to fix it:
✅ Solution: Map neio to hjkl in Netrw Buffers
Add the following to your Neovim configuration (e.g., init.lua or lua/custom/init.lua if you're using kickstart.nvim):
<cmd>normal! ...<cr>: Simulates native hjkl keypresses in Netrw, bypassing your global keymaps.
buffer = true: Ensures the mappings only apply to Netrw buffers.
silent = true: Prevents Neovim from showing the command in the status line.
This maps:
n → h (navigate left/up a directory)
e → j (move down in the file list)
i → k (move up in the file list)
o → l (open a file or directory)
🛠️ Optional: Test the Fix
Open a Netrw buffer:
vim
:Explore
Use n, e, i, and o to navigate and open files.
📌 Notes
If you use a modern file explorer like nvim-tree or oil.nvim, consider switching for better Colemak support and UX.
This fix only affects Netrw's normal mode. Visual or insert mode mappings aren't typically needed for file navigation.
With this setup, your Colemak layout will work seamlessly in Netrw. Let me know if you'd like to adjust other keybindings or migrate to a more modern file explorer!