Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Option for fixed width of the tree pane #64

Open
danqdinh opened this issue Feb 28, 2023 · 2 comments
Open

Feature request: Option for fixed width of the tree pane #64

danqdinh opened this issue Feb 28, 2023 · 2 comments

Comments

@danqdinh
Copy link

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?

@adrian-moisa
Copy link

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.

@Eric-Tu32
Copy link

Eric-Tu32 commented May 19, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants