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

Migrating to Yazi v0.2.0 #461

Closed
sxyazi opened this issue Dec 28, 2023 · 3 comments
Closed

Migrating to Yazi v0.2.0 #461

sxyazi opened this issue Dec 28, 2023 · 3 comments

Comments

@sxyazi
Copy link
Owner

sxyazi commented Dec 28, 2023

If you encounter any issues during the migrating, please create a discussion!

Renamed layout to ratio

The term ratio better conveys the meaning of the value than layout. Change it in your yazi.toml if any:

[manager]
- layout = [ 1, 4, 3 ]
+ ratio = [ 1, 4, 3 ]

Renamed peek command to seek

I noticed that peek confuses users, as it doesn't quite convey the behavior of continuous scrolling to "seeking for" content. Change it in your keymap.toml if any:

[manager]
keymap = [
-    { on = [ "<A-k>" ], exec = "peek -5" },
+    { on = [ "<A-k>" ], exec = "seek -5" },

Renamed --dir_first to --dir-first for sort command

In Lua plugins, people prefer to write emit("sort", { dir_first = true }) rather than emit("sort", { ["dir-first"] = true }). emit will replace _ with - behind the scenes automatically.

dir_first is the only option containing _, which makes it unrepresentable. So let's change it in your keymap.toml if any:

[manager]
keymap = [
-    { on = [ ",", "m" ], exec = "sort modified --dir_first" },
+    { on = [ ",", "m" ], exec = "sort modified --dir-first" },

Remove [plugins.preload] and use init.lua instead

This mainly affects users who use the code from tips. Please move your UI plugin code to ~/.config/yazi/init.lua. The new tips page is now available for Yazi v0.2.0.

If you are using the "full border" tip, copy the following latest code into your ~/.config/yazi/init.lua:

function Manager:render(area)
	self.area = area

	local chunks = ui.Layout()
		:direction(ui.Layout.HORIZONTAL)
		:constraints({
			ui.Constraint.Ratio(MANAGER.ratio.parent, MANAGER.ratio.all),
			ui.Constraint.Ratio(MANAGER.ratio.current, MANAGER.ratio.all),
			ui.Constraint.Ratio(MANAGER.ratio.preview, MANAGER.ratio.all),
		})
		:split(area)

	local bar = function(c, x, y)
		return ui.Bar(
			ui.Rect { x = math.max(0, x), y = math.max(0, y), w = math.min(1, area.w), h = math.min(1, area.h) },
			ui.Bar.TOP
		):symbol(c)
	end

	return ya.flat {
		-- Borders
		ui.Border(area, ui.Border.ALL):type(ui.Border.ROUNDED),
		ui.Bar(chunks[1], ui.Bar.RIGHT),
		ui.Bar(chunks[3], ui.Bar.LEFT),

		bar("", chunks[1].right - 1, chunks[1].y),
		bar("", chunks[1].right - 1, chunks[1].bottom - 1),
		bar("", chunks[2].right, chunks[2].y),
		bar("", chunks[2].right, chunks[1].bottom - 1),

		-- Parent
		Parent:render(chunks[1]:padding(ui.Padding.xy(1))),
		-- Current
		Current:render(chunks[2]:padding(ui.Padding.y(1))),
		-- Preview
		Preview:render(chunks[3]:padding(ui.Padding.xy(1))),
	}
end
@sxyazi sxyazi added feature New feature request and removed feature New feature request labels Dec 28, 2023
@sxyazi sxyazi changed the title [WIP] Migrating to Yazi v0.2.0 Migrating to Yazi v0.2.0 Jan 15, 2024
@sxyazi sxyazi pinned this issue Jan 15, 2024
@obedm503
Copy link

crates.io does not show v0.2 yet. Is releasing to creates.io not part of the automated release process?

@sxyazi sxyazi changed the title Migrating to Yazi v0.2.0 Migrating to Yazi v0.2.1 Jan 16, 2024
@sxyazi
Copy link
Owner Author

sxyazi commented Jan 16, 2024

crates.io does not show v0.2 yet. Is releasing to creates.io not part of the automated release process?

Done! 🚀

@sxyazi sxyazi changed the title Migrating to Yazi v0.2.1 Migrating to Yazi v0.2.0 Jan 16, 2024
@sxyazi sxyazi closed this as completed Jan 18, 2024
@sxyazi sxyazi unpinned this issue Feb 1, 2024
Copy link

I'm going to lock this issue because it has been closed for 30 days. ⏳ This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants