feat: open oil.nvim instead of netrw when starting nvim from a directory
All checks were successful
Luacheck / luacheck (push) Successful in 10s
StyLua / stylua (push) Successful in 2s

This commit is contained in:
Jeremie Fraeys 2026-02-08 15:50:24 -05:00
parent 214cf0ebdc
commit 30587406dd
No known key found for this signature in database
2 changed files with 12 additions and 4 deletions

View file

@ -91,12 +91,12 @@ local disabled_built_ins = {
'gzip', 'gzip',
'logipat', 'logipat',
'matchit', 'matchit',
-- "netrw", 'netrw',
'netrwFileHandlers', 'netrwFileHandlers',
'loaded_remote_plugins', 'loaded_remote_plugins',
'loaded_tutor_mode_plugin', 'loaded_tutor_mode_plugin',
-- "netrwPlugin", 'netrwPlugin',
-- "netrwSettings", 'netrwSettings',
'rrhelper', 'rrhelper',
'spellfile_plugin', 'spellfile_plugin',
'tar', 'tar',
@ -139,3 +139,12 @@ opt.formatoptions = opt.formatoptions
+ 'j' -- Auto-remove comments if possible. + 'j' -- Auto-remove comments if possible.
- '2' -- I'm not in gradeschool anymore - '2' -- I'm not in gradeschool anymore
opt.iskeyword:append('_') opt.iskeyword:append('_')
-- Open oil.nvim when opening a directory
vim.api.nvim_create_autocmd('VimEnter', {
callback = function()
if vim.fn.isdirectory(vim.fn.expand('%:p')) == 1 then
require('oil').open(vim.fn.expand('%:p'))
end
end,
})

View file

@ -1,6 +1,5 @@
return { return {
'stevearc/oil.nvim', 'stevearc/oil.nvim',
lazy = true,
keys = { keys = {
{ '<leader>e', '<CMD>Oil<CR>', desc = 'Open parent directory' }, { '<leader>e', '<CMD>Oil<CR>', desc = 'Open parent directory' },
{ {