Skip to content

Commit

Permalink
Feat!: New create command
Browse files Browse the repository at this point in the history
Breaking changes:
- Bump minimum Yazi version to v0.4.2.
- The create command makes use of the fs.create and the fs.cwd
  functions, which are only implemented in Yazi v0.4.2.
- Completely removed support for Yazi versions below Yazi v0.4.0, as you
  can technically still use the plugin with Yazi v0.4.0 and Yazi v0.4.1
  without any issues as long as you don't use the create command,
  but Yazi v0.3.x and below are now no longer supported.
- For the last version of the plugin that works with versions of Yazi
  below v0.4.0, see the v0.4.1-and-lower tag.
- No configuration change is required, unless of course you want to make
  use of the new create command.

Changes:
- Added a new create command.
- Added 3 new configuration options for the create command.
- Added documentation for the create command.
- Added a new --smart flag to both the open and enter commands.
- Removed the --confirm flag from the examples for the shell command, as
  that flag has been removed from Yazi in Yazi v0.4.0.
- Fixed the types for the Url class.
- Removed unnecessary functions.
  • Loading branch information
hankertrix committed Dec 22, 2024
1 parent d2b49af commit 5be9562
Show file tree
Hide file tree
Showing 2 changed files with 369 additions and 126 deletions.
Loading

4 comments on commit 5be9562

@xfzv
Copy link

@xfzv xfzv commented on 5be9562 Dec 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I've adopted the new create command over yazi default one.

Thanks for adding it.

@hankertrix
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! I was annoyed at always creating a file instead of a directory or a directory instead of a file with the default create command, so I made this new create command to fit what I normally do.

You're welcome!

@xfzv
Copy link

@xfzv xfzv commented on 5be9562 Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used to use

[manager]

keymap = [
  { on = "a", run = "create", desc = "Create a file (ends with / for directories)" },
  { on = "A", run = "create --dir ", desc = "Create a directory" },
]

but in the end it was pretty much as error prone as forgetting the trailing /. I was pressing a instead of A to create a directory quite often.

Your approach is much better, I would never create a file without any extension and now I can use a only.

@hankertrix
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, I had the same issue. I had the same configuration, just that the key binds were different, and I always mixed them up anyway.

It was what prompted me to request for the fs.create API, as I wanted to make a version of the command that just fit what I would normally do without any external dependencies on shell commands.

Glad to know that you found it helpful too!

Please sign in to comment.