Skip to content

Commit

Permalink
feat(oil-nvim): configure winbar to show directory
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Jan 19, 2024
1 parent cc7893f commit afdb28a
Showing 1 changed file with 37 additions and 10 deletions.
47 changes: 37 additions & 10 deletions lua/astrocommunity/file-explorer/oil-nvim/init.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,44 @@
return {
"stevearc/oil.nvim",
cmd = "Oil",
dependencies = {
{
"AstroNvim/astrocore",
opts = {
mappings = {
n = {
["<Leader>O"] = { function() require("oil").open() end, desc = "Open folder in Oil" },
{
"stevearc/oil.nvim",
cmd = "Oil",
dependencies = {
{
"AstroNvim/astrocore",
opts = {
mappings = {
n = {
["<Leader>O"] = { function() require("oil").open() end, desc = "Open folder in Oil" },
},
},
},
},
},
opts = {},
},
{
"rebelot/heirline.nvim",
optional = true,
opts = function(_, opts)
local status = require "astroui.status"
local is_oil = function(bufnr) return status.condition.buffer_matches({ filetype = "^oil$" }, bufnr) end
local disable_winbar_cb = opts.opts.disable_winbar_cb
opts.opts.disable_winbar_cb = function(args)
if is_oil(args.buf) then return false end
return disable_winbar_cb(args)
end

if opts.winbar then
table.insert(opts.winbar, 1, {
condition = function(self) return is_oil(self.bufnr) end,
status.component.separated_path {
padding = { left = 2 },
max_depth = false,
suffix = false,
path_func = function() return require("oil").get_current_dir() end,
},
})
end
end,
},
opts = {},
}

0 comments on commit afdb28a

Please sign in to comment.