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

[WIP] Migrating to Yazi v0.3.0 #1046

Open
sxyazi opened this issue May 16, 2024 · 3 comments
Open

[WIP] Migrating to Yazi v0.3.0 #1046

sxyazi opened this issue May 16, 2024 · 3 comments

Comments

@sxyazi
Copy link
Owner

sxyazi commented May 16, 2024

Note that, Yazi v0.3 is still under development. The content of this issue will be updated as development progresses.

Eliminated the exec property

Since Yazi v0.2.4, exec has been deprecated and replaced with a new run property and some compatibility code has been written to ensure users can transition smoothly.

In Yazi v0.3, these compatibility codes will be removed, meaning exec will be completely eliminated.

Please replace all instances of exec = ... with run = ... in your yazi.toml, keymap.toml, and theme.toml files if any, for example:

# keymap.toml
- { on = [ "k" ], exec = "arrow -1", desc = "Move cursor up" }
+ { on = [ "k" ], run = "arrow -1", desc = "Move cursor up" }

Eliminated the jump command

In Yazi v0.2.5, the jump command has been deprecated, and zoxide and fzf have been re-implemented as built-in plugins to enhance their functionality and provide better flexibility (See #865 for details).

In Yazi v0.3, the compatibility code of jump command will be deleted. Please replace them in your keymap.toml if any:

# keymap.toml
- { on = [ "z" ], run = "jump zoxide" },
+ { on = [ "z" ], run = "plugin zoxide" },
# keymap.toml
- { on = [ "Z" ], run = "jump fzf" },
+ { on = [ "Z" ], run = "plugin fzf" },

Removed the mime plugin from preloaders

Yazi v0.3 introduced a fetcher to simplify preloader design, and reclassified the mime plugin as part of the fetcher.

If you copied the entire preloaders before, please remove it from the list:

# yazi.toml
[plugin]
preloaders = [
-  { name = "*", cond = "!mime", run = "mime", prio = "high" }

If you are using a custom mime plugin, such as DreamMaoMao/mime, please update its code to the latest.

Changed the behavior of the sort command's --reverse and --dir-first options

If you use a custom configuration and have overridden the , key series, please update them to the latest (See the sort docs for details):

{ on = [ ",", "m" ], run = "sort modified --reverse=no", desc = "Sort by modified time" },
{ on = [ ",", "M" ], run = "sort modified --reverse", desc = "Sort by modified time (reverse)" },
{ on = [ ",", "c" ], run = "sort created --reverse=no", desc = "Sort by created time" },
{ on = [ ",", "C" ], run = "sort created --reverse", desc = "Sort by created time (reverse)" },
{ on = [ ",", "e" ], run = "sort extension --reverse=no", desc = "Sort by extension" },
{ on = [ ",", "E" ], run = "sort extension --reverse", desc = "Sort by extension (reverse)" },
{ on = [ ",", "a" ], run = "sort alphabetical --reverse=no", desc = "Sort alphabetically" },
{ on = [ ",", "A" ], run = "sort alphabetical --reverse", desc = "Sort alphabetically (reverse)" },
{ on = [ ",", "n" ], run = "sort natural --reverse=no", desc = "Sort naturally" },
{ on = [ ",", "N" ], run = "sort natural --reverse", desc = "Sort naturally (reverse)" },
{ on = [ ",", "s" ], run = "sort size --reverse=no", desc = "Sort by size" },
{ on = [ ",", "S" ], run = "sort size --reverse", desc = "Sort by size (reverse)" },

The reason for this change

Before Yazi v0.3, the sort command was stateless. It didn’t consider the current sorting state of the directory. For example, if the directory was in reverse order, using sort new-ordering would lose that setting, and you’d have to use sort new-ordering --reverse to keep it.

If the directory had both --reverse and --dir-first enabled, you’d have to use sort new-ordering --reverse --dir-first, which was cumbersome. Yazi v0.3 introduced the sort --translit option, exacerbating this issue.

Therefore, in Yazi v0.3, the behavior was changed: the new sort command respects the previous directory sorting state. If --reverse isn’t passed, it won’t change the state, and --reverse/--dir-first now also supports --reverse=no to explicitly cancel it.

Used Ctrl-c instead of Ctrl-q as the universal close key for all components

Ctrl-c is more in line with conventions, and it's closer to Ctrl, which makes it more convenient to press. See #763 (comment) and #779 (comment) for more details.

This is a change in user behavior, so it's listed as a breaking change here. For users who copy the entire keymap.toml configuration file or use a custom key, they will not be affected.

Used <S-Enter> instead of <C-Enter> as the alternative key for interactive open

Previously, <C-Enter> was used as an alternative key for interactive open, in Yazi v0.3, changing it to <S-Enter> aligns with the behavior of o/O - o for direct file opening, O (Shift-o) for interactive file opening.

This change makes the behavior more intuitive and reduces additional cognitive burden. This is a change in user behavior, so it's listed as a breaking change here.

Renamed the shell wrapper to yy, in favor of the new Ya CLI

This is a change in user behavior, so it's listed as a breaking change here. See #914 for details.

For users who do not need the new CLI program, they will not be affected since shell function takes precedence over binary programs.

@sxyazi sxyazi added feature New feature request and removed feature New feature request labels May 16, 2024
@mikavilpas

This comment was marked as off-topic.

mikavilpas added a commit to mikavilpas/dotfiles that referenced this issue May 19, 2024
@sxyazi

This comment was marked as off-topic.

@sxyazi
Copy link
Owner Author

sxyazi commented May 30, 2024

Lua API changes in Yazi v0.3

success and code are now properties instead of methods of Status

local status = Command("ls"):spawn():wait()
- ya.err("success:", status:success(), "code:", status:code())
+ ya.err("success:", status.success, "code:", status.code)

Renamed is_block_device, is_char_device, and is_socket of Cha

  • is_block_device => is_block
  • is_char_device => is_char
  • is_socket => is_sock

mikavilpas added a commit to mikavilpas/dotfiles that referenced this issue Jun 3, 2024
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

2 participants