NicolaiSoeborg/filemanager-plugin

Open a filemanager by at start

horpto opened this issue ยท 4 comments

It would be nice if filemanager will be opened at start of micro. Or if filemanager has an option for that.

sum01 commented

You can achieve this by creating an init.lua in Micro's config folder and adding the call to filemanager's toggle_tree function.

So on Linux echo "filemanager.toggle_tree()" >> ~/.config/micro/init.lua is all you need to do.


I'm not really sure if such a one-liner is necessary to put in the plugin, or if most people would want it anyways. I'll leave this open for opinions on that.

Ok, thanks for your reply.

if such a one-liner is necessary to put in the plugin,

I think it should be optional, but is enabled by default.

"filemanager.toggle_tree()" > ~/.config/micro/init.lua

"filemanager.toggle_tree()" >> ~/.config/micro/init.lua would be nicier as init.lua can have other lines.

adding filemanager.toggle_tree() to init.lua does the trick.

however, the active pane (buffer) is now the filemanager, i wish the cursor be in the file i'm editing instead of filemanager pane.

I found a work-around but it is not ideal:

--this is init.lua--
filemanager.toggle_tree()

function onViewOpen(view)
  tabs[curTab+1].CurView = 1
end
sum01 commented

I have implemented a modified version of your recommendations, I just need to get around to pushing the changes.