From 15d4cfcdf7e2b8ececd07bdaffddad30c891ac98 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Thu, 1 Aug 2024 10:58:47 +0200 Subject: [PATCH] toggle oil.nvim fullscreen window --- lua/custom/plugins/oil.lua | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua index 5da3382..4704761 100644 --- a/lua/custom/plugins/oil.lua +++ b/lua/custom/plugins/oil.lua @@ -13,11 +13,19 @@ return { -- Optional dependencies dependencies = { 'nvim-tree/nvim-web-devicons' }, config = function() - require('oil').setup({ + local oil = require 'oil' + oil.setup { view_options = { - show_hidden = true - } - }) - vim.keymap.set('n', 'fe', require('oil').open, { desc = '[F]ile [E]xplorer' }) + show_hidden = true, + }, + } + + vim.keymap.set('n', 'fe', function() + if vim.bo.filetype == 'oil' then + oil.close() + else + oil.open() + end + end, { desc = '[F]ile [E]xplorer' }) end, }