buffer navigation with oil

This commit is contained in:
2026-06-25 14:56:01 +02:00
parent 87a8648b07
commit 7c9890b281
3 changed files with 23 additions and 0 deletions

View File

@@ -38,6 +38,13 @@ Browse files with:
<leader>dl
```
Oil usage:
- `<leader>dl` opens the parent directory of the current file
- `<CR>` opens a file or enters a directory
- `-` goes to the parent directory
- edit the Oil buffer, then `:w` to apply file operations
Open `netrw` explicitly with:
```vim

View File

@@ -6,6 +6,12 @@ vim.pack.add({
})
require("oil").setup({
keymaps = {
["<C-h>"] = false,
["<C-j>"] = false,
["<C-k>"] = false,
["<C-l>"] = false,
},
view_options = {
show_hidden = true,
is_hidden_file = function(name, _)

View File

@@ -24,6 +24,16 @@ vim.api.nvim_create_autocmd("FileType", {
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "oil",
callback = function(ev)
vim.keymap.set("n", "<C-h>", "<C-w>h", { buffer = ev.buf })
vim.keymap.set("n", "<C-j>", "<C-w>j", { buffer = ev.buf })
vim.keymap.set("n", "<C-k>", "<C-w>k", { buffer = ev.buf })
vim.keymap.set("n", "<C-l>", "<C-w>l", { buffer = ev.buf })
end,
})
-- disable normie mouse stuff
for _, key in ipairs({ "<Up>", "<Down>", "<Left>", "<Right>" }) do
vim.keymap.set({ "n", "i", "v", "x", "s", "o", "c" }, key, "<Nop>")