From cacb564101d0311a5de0f0a61b9d5ec509765897 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Wed, 3 Jul 2024 12:37:53 +0200 Subject: [PATCH] oil.nvim relative path fix on open file --- lua/custom/plugins/oil.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua index 8708b4f..ed6ae3a 100644 --- a/lua/custom/plugins/oil.lua +++ b/lua/custom/plugins/oil.lua @@ -1,3 +1,13 @@ +-- Fix oil absolute path to relative path conversion +vim.api.nvim_create_augroup('OilRelPathFix', {}) +vim.api.nvim_create_autocmd('BufLeave', { + group = 'OilRelPathFix', + pattern = 'oil:///*', + callback = function() + vim.cmd 'cd .' + end, +}) + return { 'stevearc/oil.nvim', opts = {},