-
Notifications
You must be signed in to change notification settings - Fork 0
config
this the avaible option on the setup function opts
this field determines how the border style of file explorer is
the border table avaible fields is up, left, main, right
with the value is border style like
nvim_open_win()
border config
default value:
{
main = "double",
left = "rounded",
right = "rounded",
up = { "╭", "─", "╮", ":", "╯", "─", "╰", ":" },
}example:
require("simplyfile").setup {
border = {
up = { "", "", "", "|", "/", "_", "\\", "|" },
main = {
{ "#", "MyMainCorner" },
{ "+", "MyMainBorder" },
},
},
}determine the plugin should use default keymaps or not, see default keymaps, default true.
key maps for the file explorer, this keymaps override default_keymaps
field. default is empty table {},
example keymap: map d to remove file/folder using trash-cli:
require("simplyfile").setup {
keymaps = {
d = function(dir)
os.execute("trash " .. dir.absolute)
end,
}
}open file explorer on enter neovim
preview have this fields
-
show: determine if the file is can show on the preview window(right window) on explorer or not, show must be boolean or function that return boolean and passed one selected dir, default true.Example:
require("simplyfile").setup { preview = { show = function(dir) if dir.is_folder then -- don't show node_mopdules and .git -- folder on preview window if dir.name == "node_modules" then return false elseif dir.name == ".git" then return false else return true end else -- don't preview image on preview window if dir.name:match("%.png$") then return false else return true end end, end }, }
-
max_lines: max lines that can be shown on the preview the value can be a integer or function that not take any argument and return an integer.default:
function() return vim.o.lines end
example:
require("simplyfile").setup { preview = { max_lines = 1, }, }
clipboard option for file explorer the values is a table that have field
-
notify: a boolean value that determine if the simplyfile clipboard must notify or not
example:
require("simplyfile").setup {
clipboard = {
notify = true,
}
}a table that have a field as the
filtername and the value is the function
that receive one SimplyFile.Directory
and return boolean that determine if the
file/directory must be show or not on
file explorer
example:
require("simplyfile").setup {
filters = {
folder = function(dir)
return dir.is_folder
end,
},
}a function that used for default filter on file explorer open
example:
require("simplyfile").setup {
default_filter = function(dir)
return not vim.endswith(dir.name, ".")
end,
}a table that have a field as the
sortname and the value is the function
like second parameter on table.sort()
with two SimplyFile.Directory as the
parameter
example:
require("simplyfile").setup {
sorts = {
name_length = function(a, b)
return #a.name < #b.name
end,
},
}a function that used for default sort on file explorer open
example:
require("simplyfile").setup {
default_sort = function(a, b)
return vim.fn.getfsize(a.name) < vim.fn.getfsize(b.name)
end,
}fields avaible on up_bar:
-
events: events for trigerring callback function the events is table with the key is the neovim events and the value is thenvim_create_augroup()opts -
callback: function that called when the event is trigerred the function first parameter isSimplyFile.ExplStatethe return is two list that contain a{ text, hl }
example:

require("simplyfile").setup {
up_bar = {
events = {
-- user defined event from plugin simplyfile.nvim
User = { pattern = "SimplyFileStateChange" },
},
callback = function(expl)
return {
{ expl.path, "Directory" },
{ " |>", "FloatBorder" },
}, {
{ "<| ", "FloatBorder" },
{ "Search: ", "@field" },
{ expl.search, "CursorLine" },
}
end
},
}the default value:

local comp = require("simplyfile.components")
require("simplyfile").setup {
up_bar = {
events = {
User = {
pattern = "SimplyFileStateChange"
},
DirChanged = {
pattern = "global"
},
},
callback = function(expl)
local left = { { " ", "Normal" } }
local del = { " | ", "FloatBorder" }
local function insert(text, comps)
if not comps then return end
for _, c in ipairs(comps) do
table.insert(text, c)
end
end
local filter = comp.filter(expl)
insert(left, filter)
local sort = comp.sort(expl)
if filter and sort then
insert(left, { del })
end
insert(left, sort)
local search = comp.search(expl)
if (filter and search) or (sort and search) then
insert(left, { del })
end
insert(left, search)
local right = {}
insert(right, comp.cwd())
table.insert(right, { " ", "Normal" })
return left, right
end
},
}
set window option for each window in simplyfile explorer
example:
require("simplyfile").setup {
win_opt = {
up = {
winhighlight = "Normal:MyCustomHl",
-- this is work too
-- winhl = "Normal:MyCustomHl",
},
right = {
wrap = false,
},
main = {
number = true,
relativenumber = true,
},
},
}a table that have h key for horizontal gap
and v key for vertical gap that must be an integer
or a function that return integer
example:
require("simplyfile").setup {
gap = {
h = 4,
v = 1,
},
}a table that determine the margin to up, right, down and left
example:
require("simplyfile").setup {
margin = {
up = 1,
down = 2,
left = 5,
right = 5,
},
}