Giter Club home page Giter Club logo

bookmarks.yazi's Introduction

bookmarks.yazi

A Yazi plugin that adds the basic functionality of vi-like marks.

Note

Version 0.2.5+ or the latest main branch of Yazi is required.

YaziBookmarks.mp4

Features

  • Create/delete bookmarks
  • Custom Notifications
  • '' to go back to the previous folder
  • Bookmarks persistence

Installation

# Linux/macOS
git clone https://github.com/dedukun/bookmarks.yazi.git ~/.config/yazi/plugins/bookmarks.yazi

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

Configuration

Add this to your keymap.toml:

[[manager.prepend_keymap]]
on = [ "m" ]
run = "plugin bookmarks --args=save"
desc = "Save current position as a bookmark"

[[manager.prepend_keymap]]
on = [ "'" ]
run = "plugin bookmarks --args=jump"
desc = "Jump to a bookmark"

[[manager.prepend_keymap]]
on = [ "b", "d" ]
run = "plugin bookmarks --args=delete"
desc = "Delete a bookmark"

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

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:

-- ~/.config/yazi/init.lua
require("bookmarks"):setup({
	save_last_directory = false,
	persist = "none",
	notify = {
		enable = false,
		timeout = 1,
		message = {
			new = "New bookmark '<key>' -> '<folder>'",
			delete = "Deleted bookmark in '<key>'",
			delete_all = "Deleted all bookmarks",
		},
	},
})

save_last_directory

When enabled, a new bookmark is automatically created in ' which allows the user to jump back to the last directory.

persist

When enabled the bookmarks will persist, i.e. if you close and reopen Yazi they will still be present.

There are three possible values for this option:

Value Description
none The default value, i.e., no persistance
all All the bookmarks are saved in persistent memory
vim This mode emulates the vim global marks, i.e., only the bookmarks in upper case (A-Z) are saved to persistent memory

notify

When enabled, notifications will be shown when the user creates a new bookmark and deletes one or all saved bookmarks.

By default the notification has a 1 second timeout that can be changed with notify.timeout.

Furthermore, you can customize the notification messages with notify.message. For the new and delete messages, the <key> and <folder> keywords can be used, which will be replaced by the respective new/deleted bookmark's associated key and folder.

bookmarks.yazi's People

Contributors

dedukun avatar sxyazi avatar

Stargazers

Behnam Moh avatar XYenon avatar Raffaele Mancuso avatar Frestein avatar Raphael Ribeiro avatar Rafael Bodill avatar 阿吉 avatar  avatar  avatar Mika Vilpas avatar  avatar Vera Rei avatar  avatar Chengxie Wu avatar Roman Skorobagatko avatar Rammah Alensari avatar Rolv Apneseth avatar  avatar Nguyễn Đức Toàn avatar TornaxO7 avatar Daniel Santa Cruz avatar  avatar Mark Zaytsev avatar Rusty avatar Stefano Marton avatar  avatar Filipe Paniguel avatar DreamMaoMao avatar winnie avatar Vitaly Yerofeyevsky avatar  avatar  avatar

Watchers

 avatar

bookmarks.yazi's Issues

Micro plugin failed

I followed the readme instructions and I prepended the key to save a bookmark. However, when I press it, the task never completes and gives me this error message:

Micro plugin failed:
runtime error: [string "/home/eugenio/.cargo/registry/src/index.crate..."]:17: attempt to call a nil value (field 'sync')
stack traceback:
        [C]: in field 'sync'
        [string "/home/eugenio/.cargo/registry/src/index.crate..."]:17: in main chunk

Am I doing something wrong or is there a bug? I cannot easily debug this message given my null knowledge of rust.

Thank you for the potentially very useful plugin! I really like the idea of not having to use tabs at all.

99%, 1 left | bookmarks won't save

image

I can assign bookmarks and use them with m and ' respectively but does not persist when i close and reopen yazi. Whenever i press "m" it just says 99%, 1 left.

Any ideas?

Error in background task

I tried the plugin, the functionalities work fine. But every time I add new bookmark with m <some char>. There's a task fail in the background with these message:

Micro plugin failed:
Failed to execute sync block-1 in `bookmarks` plugin
stack traceback:
        [C]: in local 'poll'
        [string "?"]:4: in main chunk
        (...tail calls...)
        [string "C:\Users\ASUS\.cargo\git\checkouts\yazi-d41f8..."]:78: in function <[string "C:\Users\ASUS\.cargo\git\checkouts\yazi-d41f8..."]:69>

I'm on Windows 11. Any idea about this?

Get error when add keymap to toml file


╰─❯yazi
thread 'main' panicked at yazi-config/src/keymap/keymap.rs:85:59:
called `Result::unwrap()` on an `Err` value: Error { inner: Error { inner: TomlError { message: "he start of the current word\"\n\n[[input.keymap]]\non = [\"<A-d>\"]\nexec = \"kill forward\"\ndesc = \"Kill forwards to the end of the current word\"\n\n[[input.keymap]]\non = [\"d\"]\nexec = \"delete --cut\"\ndesc = \"Cut the selected characters\"\n\n[[input.keymap]]\non = [\"D\"]\nexec = [\"delete --cut\", \"move 999\"]\ndesc = \"Cut until the EOL\"\n\n[[input.keymap]]\non = [\"c\"]\nexec = \"delete --cut --insert\"\ndesc = \"Cut the selected characters, and enter insert mode\"\n\n[[input.keymap]]\non = [\"C\"]\nexec = [\"delete --cut --insert\", \"move 999\"]\ndesc = \"Cut until the EOL, and enter insert mode\"\n\n[[input.keymap]]\non = [\"x\"]\nexec = [\"delete --cut\", \"move 1 --in-operating\"]\ndesc = \"Cut the current character\"\n\n[[input.keymap]]\non = [\"y\"]\nexec = \"yank\"\ndesc = \"Copy the selected characters\"\n\n[[input.keymap]]\non = [\"p\"]\nexec = \"paste\"\ndesc = \"Paste the copied characters after the cursor\"\n\n[[input.keymap]]\non = [\"P\"]\nexec = \"paste --before\"\ndesc = \"Paste the copied characters before the cursor\"\n\n[[input.keymap]]\non = [\"u\"]\nexec = \"undo\"\ndesc = \"Undo the last operation\"\n\n[[input.keymap]]\non = [\"<C-r>\"]\nexec = \"redo\"\ndesc = \"Redo the last operation\"\n\n[[input.keymap]]\non = [\"~\"]\nexec = \"help\"\ndesc = \"Open help\"\n\n[[completion.keymap]]\non = [\"<C-q>\"]\nexec = \"close\"\ndesc = \"Cancel completion\"\n\n[[completion.keymap]]\non = [\"<Tab>\"]\nexec = \"close --submit\"\ndesc = \"Submit the completion\"\n\n[[completion.keymap]]\non = [\"<Enter>\"]\nexec = [\"close --submit\", \"close_input --submit\"]\ndesc = \"Submit the completion and input\"\n\n[[completion.keymap]]\non = [\"<A-k>\"]\nexec = \"arrow -1\"\ndesc = \"Move cursor up\"\n\n[[completion.keymap]]\non = [\"<A-j>\"]\nexec = \"arrow 1\"\ndesc = \"Move cursor down\"\n\n[[completion.keymap]]\non = [\"<Up>\"]\nexec = \"arrow -1\"\ndesc = \"Move cursor up\"\n\n[[completion.keymap]]\non = [\"<Down>\"]\nexec = \"arrow 1\"\ndesc = \"Move cursor down\"\n\n[[completion.keymap]]\non = [\"~\"]\nexec = \"help\"\ndesc = \"Open help\"\n\n[[help.keymap]]\non = [\"<Esc>\"]\nexec = \"escape\"\ndesc = \"Clear the filter, or hide the help\"\n\n[[help.keymap]]\non = [\"q\"]\nexec = \"close\"\ndesc = \"Exit the process\"\n\n[[help.keymap]]\non = [\"<C-q>\"]\nexec = \"close\"\ndesc = \"Hide the help\"\n\n[[help.keymap]]\non = [\"k\"]\nexec = \"arrow -1\"\ndesc = \"Move cursor up\"\n\n[[help.keymap]]\non = [\"j\"]\nexec = \"arrow 1\"\ndesc = \"Move cursor down\"\n\n[[help.keymap]]\non = [\"K\"]\nexec = \"arrow -5\"\ndesc = \"Move cursor up 5 lines\"\n\n[[help.keymap]]\non = [\"J\"]\nexec = \"arrow 5\"\ndesc = \"Move cursor down 5 lines\"\n\n[[help.keymap]]\non = [\"<Up>\"]\nexec = \"arrow -1\"\ndesc = \"Move cursor up\"\n\n[[help.keymap]]\non = [\"<Down>\"]\nexec = \"arrow 1\"\ndesc = \"Move cursor down\"\n\n[[help.keymap]]\non = [\"<S-Up>\"]\nexec = \"arrow -5\"\ndesc = \"Move cursor up 5 lines\"\n\n[[help.keymap]]\non = [\"<S-Down>\"]\nexec = \"arrow 5\"\ndesc = \"Move cursor down 5 lines\"\n\n[[help.keymap]]\non = [\"/\"]\nexec = \"filter\"\ndesc = \"Apply a filter for the help items\"\n"), keys: ["manager", "prepend_keymap"], span: Some(10383..10502) } } }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fish: Job 1, 'yazi $argv --cwd-file="$tmp"' terminated by signal SIGABRT (Abort)

Toml file

# A TOML linter such as https://taplo.tamasfe.dev/ can use this schema to validate your config.
# If you encounter any issues, please make an issue at https://github.com/yazi-rs/schemas.
"$schema" = "https://yazi-rs.github.io/schemas/keymap.json"

[manager]

keymap = [
	{ on = [ "<Esc>" ], exec = "escape",             desc = "Exit visual mode, clear selected, or cancel search" },
	{ on = [ "q" ],     exec = "quit",               desc = "Exit the process" },
	{ on = [ "Q" ],     exec = "quit --no-cwd-file", desc = "Exit the process without writing cwd-file" },
	{ on = [ "<C-q>" ], exec = "close",              desc = "Close the current tab, or quit if it is last tab" },
	{ on = [ "<C-z>" ], exec = "suspend",            desc = "Suspend the process" },

	# Navigation
	{ on = [ "k" ], exec = "arrow -1", desc = "Move cursor up" },
	{ on = [ "j" ], exec = "arrow 1",  desc = "Move cursor down" },

	{ on = [ "K" ], exec = "arrow -5", desc = "Move cursor up 5 lines" },
	{ on = [ "J" ], exec = "arrow 5",  desc = "Move cursor down 5 lines" },

	{ on = [ "<S-Up>" ],   exec = "arrow -5", desc = "Move cursor up 5 lines" },
	{ on = [ "<S-Down>" ], exec = "arrow 5",  desc = "Move cursor down 5 lines" },

	{ on = [ "<C-u>" ], exec = "arrow -50%",  desc = "Move cursor up half page" },
	{ on = [ "<C-d>" ], exec = "arrow 50%",   desc = "Move cursor down half page" },
	{ on = [ "<C-b>" ], exec = "arrow -100%", desc = "Move cursor up one page" },
	{ on = [ "<C-f>" ], exec = "arrow 100%",  desc = "Move cursor down one page" },

	{ on = [ "<C-PageUp>" ],   exec = "arrow -50%",  desc = "Move cursor up half page" },
	{ on = [ "<C-PageDown>" ], exec = "arrow 50%",   desc = "Move cursor down half page" },
	{ on = [ "<PageUp>" ],     exec = "arrow -100%", desc = "Move cursor up one page" },
	{ on = [ "<PageDown>" ],   exec = "arrow 100%",  desc = "Move cursor down one page" },

	{ on = [ "h" ], exec = [ "leave", "escape --visual --select" ], desc = "Go back to the parent directory" },
	{ on = [ "l" ], exec = [ "enter", "escape --visual --select" ], desc = "Enter the child directory" },

	{ on = [ "H" ], exec = "back",    desc = "Go back to the previous directory" },
	{ on = [ "L" ], exec = "forward", desc = "Go forward to the next directory" },

	{ on = [ "<A-k>" ], exec = "seek -5", desc = "Seek up 5 units in the preview" },
	{ on = [ "<A-j>" ], exec = "seek 5",  desc = "Seek down 5 units in the preview" },
	{ on = [ "<A-PageUp>" ],   exec = "seek -5", desc = "Seek up 5 units in the preview" },
	{ on = [ "<A-PageDown>" ], exec = "seek 5",  desc = "Seek down 5 units in the preview" },

	{ on = [ "<Up>" ],    exec = "arrow -1", desc = "Move cursor up" },
	{ on = [ "<Down>" ],  exec = "arrow 1",  desc = "Move cursor down" },
	{ on = [ "<Left>" ],  exec = "leave",    desc = "Go back to the parent directory" },
	{ on = [ "<Right>" ], exec = "enter",    desc = "Enter the child directory" },

	{ on = [ "g", "g" ], exec = "arrow -99999999", desc = "Move cursor to the top" },
	{ on = [ "G" ],      exec = "arrow 99999999",  desc = "Move cursor to the bottom" },

	# Selection
	{ on = [ "<Space>" ], exec = [ "select --state=none", "arrow 1" ], desc = "Toggle the current selection state" },
	{ on = [ "v" ],       exec = "visual_mode",                        desc = "Enter visual mode (selection mode)" },
	{ on = [ "V" ],       exec = "visual_mode --unset",                desc = "Enter visual mode (unset mode)" },
	{ on = [ "<C-a>" ],   exec = "select_all --state=true",            desc = "Select all files" },
	{ on = [ "<C-r>" ],   exec = "select_all --state=none",            desc = "Inverse selection of all files" },

	# Operation
	{ on = [ "o" ],         exec = "open",                                                 desc = "Open the selected files" },
	{ on = [ "e" ],         exec = "open",                                                 desc = "Open the selected files" },
	{ on = [ "l" ],         exec = "open",                                                 desc = "Open the selected files" },
	{ on = [ "O" ],         exec = "open --interactive",                                   desc = "Open the selected files interactively" },
	{ on = [ "<Enter>" ],   exec = "open",                                                 desc = "Open the selected files" },
	{ on = [ "<C-Enter>" ], exec = "open --interactive",                                   desc = "Open the selected files interactively" },
	{ on = [ "y" ],         exec = [ "yank", "escape --visual --select" ],                 desc = "Copy the selected files" },
	{ on = [ "d" ],         exec = [ "yank --cut", "escape --visual --select" ],           desc = "Cut the selected files" },
	{ on = [ "p" ],         exec = "paste",                                                desc = "Paste the files" },
	{ on = [ "P" ],         exec = "paste --force",                                        desc = "Paste the files (overwrite if the destination exists)" },
	{ on = [ "-" ],         exec = "link",                                                 desc = "Symlink the absolute path of files" },
	{ on = [ "_" ],         exec = "link --relative",                                      desc = "Symlink the relative path of files" },
	{ on = [ "x" ],         exec = [ "remove", "escape --visual --select" ],               desc = "Move the files to the trash" },
	{ on = [ "X" ],         exec = [ "remove --permanently", "escape --visual --select" ], desc = "Permanently delete the files" },
	{ on = [ "a" ],         exec = "create",                                               desc = "Create a file or directory (ends with / for directories)" },
	{ on = [ "r" ],         exec = "rename --cursor=before_ext",                           desc = "Rename a file or directory" },
	{ on = [ ";" ],         exec = "shell",                                                desc = "Run a shell command" },
	{ on = [ ":" ],         exec = "shell --block",                                        desc = "Run a shell command (block the UI until the command finishes)" },
	{ on = [ "." ],         exec = "hidden toggle",                                        desc = "Toggle the visibility of hidden files" },
	{ on = [ "s" ],         exec = "search fd",                                            desc = "Search files by name using fd" },
	{ on = [ "S" ],         exec = "search rg",                                            desc = "Search files by content using ripgrep" },
	{ on = [ "<C-s>" ],     exec = "search none",                                          desc = "Cancel the ongoing search" },
	{ on = [ "z" ],         exec = "jump zoxide",                                          desc = "Jump to a directory using zoxide" },
	{ on = [ "Z" ],         exec = "jump fzf",                                             desc = "Jump to a directory, or reveal a file using fzf" },

	# Linemode
	{ on = [ "m", "s" ], exec = "linemode size",        desc = "Set linemode to size" },
	{ on = [ "m", "p" ], exec = "linemode permissions", desc = "Set linemode to permissions" },
	{ on = [ "m", "m" ], exec = "linemode mtime",       desc = "Set linemode to mtime" },
	{ on = [ "m", "n" ], exec = "linemode none",        desc = "Set linemode to none" },

	# Copy
	{ on = [ "c", "c" ], exec = "copy path",             desc = "Copy the absolute path" },
	{ on = [ "c", "d" ], exec = "copy dirname",          desc = "Copy the path of the parent directory" },
	{ on = [ "c", "f" ], exec = "copy filename",         desc = "Copy the name of the file" },
	{ on = [ "c", "n" ], exec = "copy name_without_ext", desc = "Copy the name of the file without the extension" },

	# Filter
	{ on = [ "f" ], exec = "filter --smart", desc = "Filter the files" },

	# Find
	{ on = [ "/" ], exec = "find --smart",            desc = "Find next file" },
	{ on = [ "?" ], exec = "find --previous --smart", desc = "Find previous file" },
	{ on = [ "n" ], exec = "find_arrow",              desc = "Go to next found file" },
	{ on = [ "N" ], exec = "find_arrow --previous",   desc = "Go to previous found file" },

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

	# Tabs
	{ on = [ "t" ], exec = "tab_create --current", desc = "Create a new tab using the current path" },

	{ on = [ "1" ], exec = "tab_switch 0", desc = "Switch to the first tab" },
	{ on = [ "2" ], exec = "tab_switch 1", desc = "Switch to the second tab" },
	{ on = [ "3" ], exec = "tab_switch 2", desc = "Switch to the third tab" },
	{ on = [ "4" ], exec = "tab_switch 3", desc = "Switch to the fourth tab" },
	{ on = [ "5" ], exec = "tab_switch 4", desc = "Switch to the fifth tab" },
	{ on = [ "6" ], exec = "tab_switch 5", desc = "Switch to the sixth tab" },
	{ on = [ "7" ], exec = "tab_switch 6", desc = "Switch to the seventh tab" },
	{ on = [ "8" ], exec = "tab_switch 7", desc = "Switch to the eighth tab" },
	{ on = [ "9" ], exec = "tab_switch 8", desc = "Switch to the ninth tab" },

	{ on = [ "[" ], exec = "tab_switch -1 --relative", desc = "Switch to the previous tab" },
	{ on = [ "]" ], exec = "tab_switch 1 --relative",  desc = "Switch to the next tab" },

	{ on = [ "{" ], exec = "tab_swap -1", desc = "Swap the current tab with the previous tab" },
	{ on = [ "}" ], exec = "tab_swap 1",  desc = "Swap the current tab with the next tab" },

	# Tasks
	{ on = [ "w" ], exec = "tasks_show", desc = "Show the tasks manager" },

	# Goto
	{ on = [ "g", "h" ],       exec = "cd ~",             desc = "Go to the home directory" },
	{ on = [ "g", "c" ],       exec = "cd ~/.config",     desc = "Go to the config directory" },
	{ on = [ "g", "d" ],       exec = "cd ~/Downloads",   desc = "Go to the downloads directory" },
	{ on = [ "g", "t" ],       exec = "cd /tmp",          desc = "Go to the temporary directory" },
	{ on = [ "g", "<Space>" ], exec = "cd --interactive", desc = "Go to a directory interactively" },

	# Help
	{ on = [ "~" ], exec = "help", desc = "Open help" },
]

[tasks]

keymap = [
	{ on = [ "<Esc>" ], exec = "close", desc = "Hide the task manager" },
	{ on = [ "<C-q>" ], exec = "close", desc = "Hide the task manager" },
	{ on = [ "w" ],     exec = "close", desc = "Hide the task manager" },

	{ on = [ "k" ], exec = "arrow -1", desc = "Move cursor up" },
	{ on = [ "j" ], exec = "arrow 1",  desc = "Move cursor down" },

	{ on = [ "<Up>" ],   exec = "arrow -1", desc = "Move cursor up" },
	{ on = [ "<Down>" ], exec = "arrow 1",  desc = "Move cursor down" },

	{ on = [ "<Enter>" ], exec = "inspect", desc = "Inspect the task" },
	{ on = [ "x" ],       exec = "cancel",  desc = "Cancel the task" },

	{ on = [ "~" ], exec = "help", desc = "Open help" }
]

[select]

keymap = [
	{ on = [ "<C-q>" ],   exec = "close",          desc = "Cancel selection" },
	{ on = [ "<Esc>" ],   exec = "close",          desc = "Cancel selection" },
	{ on = [ "<Enter>" ], exec = "close --submit", desc = "Submit the selection" },

	{ on = [ "k" ], exec = "arrow -1", desc = "Move cursor up" },
	{ on = [ "j" ], exec = "arrow 1",  desc = "Move cursor down" },

	{ on = [ "K" ], exec = "arrow -5", desc = "Move cursor up 5 lines" },
	{ on = [ "J" ], exec = "arrow 5",  desc = "Move cursor down 5 lines" },

	{ on = [ "<Up>" ],   exec = "arrow -1", desc = "Move cursor up" },
	{ on = [ "<Down>" ], exec = "arrow 1",  desc = "Move cursor down" },

	{ on = [ "<S-Up>" ],   exec = "arrow -5", desc = "Move cursor up 5 lines" },
	{ on = [ "<S-Down>" ], exec = "arrow 5",  desc = "Move cursor down 5 lines" },

	{ on = [ "~" ], exec = "help", desc = "Open help" }
]

[input]

keymap = [
	{ on = [ "<C-q>" ],   exec = "close",          desc = "Cancel input" },
	{ on = [ "<Enter>" ], exec = "close --submit", desc = "Submit the input" },
	{ on = [ "<Esc>" ],   exec = "escape",         desc = "Go back the normal mode, or cancel input" },

	# Mode
	{ on = [ "i" ], exec = "insert",                              desc = "Enter insert mode" },
	{ on = [ "a" ], exec = "insert --append",                     desc = "Enter append mode" },
	{ on = [ "I" ], exec = [ "move -999", "insert" ],             desc = "Move to the BOL, and enter insert mode" },
	{ on = [ "A" ], exec = [ "move 999", "insert --append" ],     desc = "Move to the EOL, and enter append mode" },
	{ on = [ "v" ], exec = "visual",                              desc = "Enter visual mode" },
	{ on = [ "V" ], exec = [ "move -999", "visual", "move 999" ], desc = "Enter visual mode and select all" },

	# Character-wise movement
	{ on = [ "h" ],       exec = "move -1", desc = "Move back a character" },
	{ on = [ "l" ],       exec = "move 1",  desc = "Move forward a character" },
	{ on = [ "<Left>" ],  exec = "move -1", desc = "Move back a character" },
	{ on = [ "<Right>" ], exec = "move 1",  desc = "Move forward a character" },
	{ on = [ "<C-b>" ],   exec = "move -1", desc = "Move back a character" },
	{ on = [ "<C-f>" ],   exec = "move 1",  desc = "Move forward a character" },

	# Word-wise movement
	{ on = [ "b" ],     exec = "backward",              desc = "Move back to the start of the current or previous word" },
	{ on = [ "w" ],     exec = "forward",               desc = "Move forward to the start of the next word" },
	{ on = [ "e" ],     exec = "forward --end-of-word", desc = "Move forward to the end of the current or next word" },
	{ on = [ "<A-b>" ], exec = "backward",              desc = "Move back to the start of the current or previous word" },
	{ on = [ "<A-f>" ], exec = "forward --end-of-word", desc = "Move forward to the end of the current or next word" },

	# Line-wise movement
	{ on = [ "0" ],     exec = "move -999", desc = "Move to the BOL" },
	{ on = [ "$" ],     exec = "move 999",  desc = "Move to the EOL" },
	{ on = [ "<C-a>" ], exec = "move -999", desc = "Move to the BOL" },
	{ on = [ "<C-e>" ], exec = "move 999",  desc = "Move to the EOL" },

	# Delete
	{ on = [ "<Backspace>" ], exec = "backspace",	        desc = "Delete the character before the cursor" },
	{ on = [ "<C-h>" ],       exec = "backspace",         desc = "Delete the character before the cursor" },
	{ on = [ "<C-d>" ],       exec = "backspace --under", desc = "Delete the character under the cursor" },

	# Kill
	{ on = [ "<C-u>" ], exec = "kill bol",      desc = "Kill backwards to the BOL" },
	{ on = [ "<C-k>" ], exec = "kill eol",      desc = "Kill forwards to the EOL" },
	{ on = [ "<C-w>" ], exec = "kill backward", desc = "Kill backwards to the start of the current word" },
	{ on = [ "<A-d>" ], exec = "kill forward",  desc = "Kill forwards to the end of the current word" },

	# Cut/Yank/Paste
	{ on = [ "d" ], exec = "delete --cut",                              desc = "Cut the selected characters" },
	{ on = [ "D" ], exec = [ "delete --cut", "move 999" ],              desc = "Cut until the EOL" },
	{ on = [ "c" ], exec = "delete --cut --insert",                     desc = "Cut the selected characters, and enter insert mode" },
	{ on = [ "C" ], exec = [ "delete --cut --insert", "move 999" ],     desc = "Cut until the EOL, and enter insert mode" },
	{ on = [ "x" ], exec = [ "delete --cut", "move 1 --in-operating" ], desc = "Cut the current character" },
	{ on = [ "y" ], exec = "yank",           desc = "Copy the selected characters" },
	{ on = [ "p" ], exec = "paste",          desc = "Paste the copied characters after the cursor" },
	{ on = [ "P" ], exec = "paste --before", desc = "Paste the copied characters before the cursor" },

	# Undo/Redo
	{ on = [ "u" ],     exec = "undo", desc = "Undo the last operation" },
	{ on = [ "<C-r>" ], exec = "redo", desc = "Redo the last operation" },

	# Help
	{ on = [ "~" ], exec = "help", desc = "Open help" }
]

[completion]

keymap = [
	{ on = [ "<C-q>" ],   exec = "close",                                      desc = "Cancel completion" },
	{ on = [ "<Tab>" ],   exec = "close --submit",                             desc = "Submit the completion" },
	{ on = [ "<Enter>" ], exec = [ "close --submit", "close_input --submit" ], desc = "Submit the completion and input" },

	{ on = [ "<A-k>" ], exec = "arrow -1", desc = "Move cursor up" },
	{ on = [ "<A-j>" ], exec = "arrow 1",  desc = "Move cursor down" },

	{ on = [ "<Up>" ],   exec = "arrow -1", desc = "Move cursor up" },
	{ on = [ "<Down>" ], exec = "arrow 1",  desc = "Move cursor down" },

	{ on = [ "~" ], exec = "help", desc = "Open help" }
]

[help]

keymap = [
	{ on = [ "<Esc>" ], exec = "escape", desc = "Clear the filter, or hide the help" },
	{ on = [ "q" ],     exec = "close",  desc = "Exit the process" },
	{ on = [ "<C-q>" ], exec = "close",  desc = "Hide the help" },

	# Navigation
	{ on = [ "k" ], exec = "arrow -1", desc = "Move cursor up" },
	{ on = [ "j" ], exec = "arrow 1",  desc = "Move cursor down" },

	{ on = [ "K" ], exec = "arrow -5", desc = "Move cursor up 5 lines" },
	{ on = [ "J" ], exec = "arrow 5",  desc = "Move cursor down 5 lines" },

	{ on = [ "<Up>" ],   exec = "arrow -1", desc = "Move cursor up" },
	{ on = [ "<Down>" ], exec = "arrow 1",  desc = "Move cursor down" },

	{ on = [ "<S-Up>" ],   exec = "arrow -5", desc = "Move cursor up 5 lines" },
	{ on = [ "<S-Down>" ], exec = "arrow 5",  desc = "Move cursor down 5 lines" },

	# Filtering
	{ on = [ "/" ], exec = "filter", desc = "Apply a filter for the help items" },
]

[[manager.prepend_keymap]]
on = [ "m" ]
run = "plugin bookmarks --args=save"
desc = "Save current position as a bookmark"

[[manager.prepend_keymap]]
on = [ "'" ]
run = "plugin bookmarks --args=jump"
desc = "Jump to a bookmark"

[[manager.prepend_keymap]]
on = [ "b", "d" ]
run = "plugin bookmarks --args=delete"
desc = "Delete a bookmark"

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

Last visited folder bookmark

Hi there,
I love your plugin, these are a set of features that was really missing in yazi.

I would like to know if there is some easy way to implement the same behaviour in ranger. In ranger there's always available (as in vim) the ' ' bookmark that move you to the last visited folder

image

Do you think is possible to create the same behaviour? If you have any idea I could try to implement it

The name of the persist bookmark

Hi there! Thanks for your time and effort. It's exactly what I want since I've moved from ranger to yazi.
But maybe kinda point that could be improved.
For example the directory structure looks like this:
/aaa/bbb/ccc/ddd.txt
if I cd into the directory "bbb" and save a bookmark there, the popup 'window' (after pressing ') will show the absolute path of the dicrectory all the way to the "ccc". b →/aaa/bbb/ccc/ . Can we just stop at the "bbb" level?

Just a suggestion. Thanks in advance!

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.