Giter VIP home page Giter VIP logo

projects.yazi's Introduction

projects.yazi

A Yazi plugin that adds the functionality to save, load and merge projects. A project means all tabs and their status, including cwd and so on.

Note

The latest main branch of Yazi is required at the moment.

2024-04-30.18-44-42.mp4

Features

  • Save/load projects
  • Load last project
  • Projects persistence
  • Merge a project or its current tab to other projects

Installation

ya pack -a MasouShizuka/projects.yazi

or

# Windows
git clone https://github.com/MasouShizuka/projects.yazi.git %AppData%\yazi\config\plugins\projects.yazi

# Linux/macOS
git clone https://github.com/MasouShizuka/projects.yazi.git ~/.config/yazi/plugins/projects.yazi

Configuration

Add this to your keymap.toml:

[[manager.prepend_keymap]]
on = [ "P", "s" ]
run = "plugin projects --args=save"
desc = "Save current project"

[[manager.prepend_keymap]]
on = [ "P", "l" ]
run = "plugin projects --args=load"
desc = "Load project"

[[manager.prepend_keymap]]
on = [ "P", "P" ]
run = "plugin projects --args=load_last"
desc = "Load last project"

[[manager.prepend_keymap]]
on = [ "P", "d" ]
run = "plugin projects --args=delete"
desc = "Delete project"

[[manager.prepend_keymap]]
on = [ "P", "D" ]
run = "plugin projects --args=delete_all"
desc = "Delete all projects"

[[manager.prepend_keymap]]
on = [ "P", "m" ]
run = "plugin projects --args='merge current'"
desc = "Merge current tab to other projects"

[[manager.prepend_keymap]]
on = [ "P", "M" ]
run = "plugin projects --args='merge all'"
desc = "Merge current project to other projects"

If you want to save the last project when exiting, map the default quit key to:

[[manager.prepend_keymap]]
on = [ "q" ]
run = "plugin projects --args=quit"
desc = "Save last project and exit the process"

Additionally there are configurations that can be done using the plugin's setup function in Yazi's init.lua, i.e. ~/.config/yazi/init.lua. The following are the default configurations:

require("projects"):setup({
    save = {
        method = "yazi", -- yazi | lua
        lua_save_path = "", -- windows: "%APPDATA%/yazi/state/projects.json", unix: "~/.config/yazi/state/projects.json"
    },
    last = {
        update_after_save = true,
        update_after_load = true,
    },
    merge = {
        quit_after_merge = false,
    },
    notify = {
        enable = true,
        title = "Projects",
        timeout = 3,
        level = "info",
    },
})

save

Note

Yazi's api sometimes doesn't work on Windows, which is why the lua method is proposed

method means the method of saving projects:

  • yazi: using yazi api to save to .dds file
  • lua: using Lua to save

lua_save_path means the path of saved file with lua api, the defalut is

  • Windows: %APPDATA%/yazi/state/projects.json
  • Unix: ~/.config/yazi/state/projects.json

last

The last project is loaded by load_last command.

When update_after_save enabled, the saved project will be saved to last project. When update_after_load enabled, the loaded project will be saved to last project.

merge

When quit_after_merge enabled, the merged project will be exited after merging.

notify

When enabled, notifications will be shown when the user saves/loads/deletes/merges a project and deletes all projects.

title, timeout, level are the same as ya.notify.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.