filemanager-plugin
filemanager-plugin copied to clipboard
Feature request: Option for fixed width of the tree pane
Navigating thru' the tree is easy enough, pressing Tab to open file is also convenient.
However, when a file is open the pane split seems being divided equally which forces user to use mouse to drag the between-pane vertical border line to enlarge the editing pane. After switching to another file, the panes are divided again. Sometimes, it requires switching between a quite number of files, and drag to resize the edit panes is real tiring.
Possible to add feature that specifies fixed width for tree view pane?
I know people don't like +1 here. But I need to say it. This would be such a major improvement. Please do consider it.
A naive yet straightforward solution
I barely know anything about lua, but I got a simple solution for your problem. (On version 3.5.1)
Open ~/.config/micro/plug/filemanager/filemanager.lua
in your text editor, go to line 1137 (or where the function preIndentSelection
is defined ) and add the following lines inside the code:
-- Tab
function preIndentSelection(view)
if view == tree_view then
tab_pressed = true
-- Open the file
-- Using tab instead of enter, since enter won't work with Readonly
try_open_at_y(tree_view.Cursor.Loc.Y)
toggle_tree() <------------------------------------------- add this line
toggle_tree() <------------------------------------------- add this line
-- Don't actually insert a tab
return false
end
end
Insert the line toggle_tree()
twice after try_open_at_y(tree_view.Cursor.Loc.Y)
. This will reopen the tree whenever you open a new split, reset the width of the tree_view to 30%, and then lock it.
I believe there's a much more straightforward way to fix the width of the tree_view, but as I said, I have very limited knowledge about Lua, so feel free to fix my code if you have a better solution.
Hope this helps!