Added plugins for Yazi
This commit is contained in:
177
fish/.config/fish/completions/glow.fish
Normal file
177
fish/.config/fish/completions/glow.fish
Normal file
@@ -0,0 +1,177 @@
|
||||
# fish completion for glow -*- shell-script -*-
|
||||
|
||||
function __glow_debug
|
||||
set -l file "$BASH_COMP_DEBUG_FILE"
|
||||
if test -n "$file"
|
||||
echo "$argv" >> $file
|
||||
end
|
||||
end
|
||||
|
||||
function __glow_perform_completion
|
||||
__glow_debug "Starting __glow_perform_completion"
|
||||
|
||||
# Extract all args except the last one
|
||||
set -l args (commandline -opc)
|
||||
# Extract the last arg and escape it in case it is a space
|
||||
set -l lastArg (string escape -- (commandline -ct))
|
||||
|
||||
__glow_debug "args: $args"
|
||||
__glow_debug "last arg: $lastArg"
|
||||
|
||||
# Disable ActiveHelp which is not supported for fish shell
|
||||
set -l requestComp "GLOW_ACTIVE_HELP=0 $args[1] __complete $args[2..-1] $lastArg"
|
||||
|
||||
__glow_debug "Calling $requestComp"
|
||||
set -l results (eval $requestComp 2> /dev/null)
|
||||
|
||||
# Some programs may output extra empty lines after the directive.
|
||||
# Let's ignore them or else it will break completion.
|
||||
# Ref: https://github.com/spf13/cobra/issues/1279
|
||||
for line in $results[-1..1]
|
||||
if test (string trim -- $line) = ""
|
||||
# Found an empty line, remove it
|
||||
set results $results[1..-2]
|
||||
else
|
||||
# Found non-empty line, we have our proper output
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
set -l comps $results[1..-2]
|
||||
set -l directiveLine $results[-1]
|
||||
|
||||
# For Fish, when completing a flag with an = (e.g., <program> -n=<TAB>)
|
||||
# completions must be prefixed with the flag
|
||||
set -l flagPrefix (string match -r -- '-.*=' "$lastArg")
|
||||
|
||||
__glow_debug "Comps: $comps"
|
||||
__glow_debug "DirectiveLine: $directiveLine"
|
||||
__glow_debug "flagPrefix: $flagPrefix"
|
||||
|
||||
for comp in $comps
|
||||
printf "%s%s\n" "$flagPrefix" "$comp"
|
||||
end
|
||||
|
||||
printf "%s\n" "$directiveLine"
|
||||
end
|
||||
|
||||
# This function does two things:
|
||||
# - Obtain the completions and store them in the global __glow_comp_results
|
||||
# - Return false if file completion should be performed
|
||||
function __glow_prepare_completions
|
||||
__glow_debug ""
|
||||
__glow_debug "========= starting completion logic =========="
|
||||
|
||||
# Start fresh
|
||||
set --erase __glow_comp_results
|
||||
|
||||
set -l results (__glow_perform_completion)
|
||||
__glow_debug "Completion results: $results"
|
||||
|
||||
if test -z "$results"
|
||||
__glow_debug "No completion, probably due to a failure"
|
||||
# Might as well do file completion, in case it helps
|
||||
return 1
|
||||
end
|
||||
|
||||
set -l directive (string sub --start 2 $results[-1])
|
||||
set --global __glow_comp_results $results[1..-2]
|
||||
|
||||
__glow_debug "Completions are: $__glow_comp_results"
|
||||
__glow_debug "Directive is: $directive"
|
||||
|
||||
set -l shellCompDirectiveError 1
|
||||
set -l shellCompDirectiveNoSpace 2
|
||||
set -l shellCompDirectiveNoFileComp 4
|
||||
set -l shellCompDirectiveFilterFileExt 8
|
||||
set -l shellCompDirectiveFilterDirs 16
|
||||
|
||||
if test -z "$directive"
|
||||
set directive 0
|
||||
end
|
||||
|
||||
set -l compErr (math (math --scale 0 $directive / $shellCompDirectiveError) % 2)
|
||||
if test $compErr -eq 1
|
||||
__glow_debug "Received error directive: aborting."
|
||||
# Might as well do file completion, in case it helps
|
||||
return 1
|
||||
end
|
||||
|
||||
set -l filefilter (math (math --scale 0 $directive / $shellCompDirectiveFilterFileExt) % 2)
|
||||
set -l dirfilter (math (math --scale 0 $directive / $shellCompDirectiveFilterDirs) % 2)
|
||||
if test $filefilter -eq 1; or test $dirfilter -eq 1
|
||||
__glow_debug "File extension filtering or directory filtering not supported"
|
||||
# Do full file completion instead
|
||||
return 1
|
||||
end
|
||||
|
||||
set -l nospace (math (math --scale 0 $directive / $shellCompDirectiveNoSpace) % 2)
|
||||
set -l nofiles (math (math --scale 0 $directive / $shellCompDirectiveNoFileComp) % 2)
|
||||
|
||||
__glow_debug "nospace: $nospace, nofiles: $nofiles"
|
||||
|
||||
# If we want to prevent a space, or if file completion is NOT disabled,
|
||||
# we need to count the number of valid completions.
|
||||
# To do so, we will filter on prefix as the completions we have received
|
||||
# may not already be filtered so as to allow fish to match on different
|
||||
# criteria than the prefix.
|
||||
if test $nospace -ne 0; or test $nofiles -eq 0
|
||||
set -l prefix (commandline -t | string escape --style=regex)
|
||||
__glow_debug "prefix: $prefix"
|
||||
|
||||
set -l completions (string match -r -- "^$prefix.*" $__glow_comp_results)
|
||||
set --global __glow_comp_results $completions
|
||||
__glow_debug "Filtered completions are: $__glow_comp_results"
|
||||
|
||||
# Important not to quote the variable for count to work
|
||||
set -l numComps (count $__glow_comp_results)
|
||||
__glow_debug "numComps: $numComps"
|
||||
|
||||
if test $numComps -eq 1; and test $nospace -ne 0
|
||||
# We must first split on \t to get rid of the descriptions to be
|
||||
# able to check what the actual completion will be.
|
||||
# We don't need descriptions anyway since there is only a single
|
||||
# real completion which the shell will expand immediately.
|
||||
set -l split (string split --max 1 \t $__glow_comp_results[1])
|
||||
|
||||
# Fish won't add a space if the completion ends with any
|
||||
# of the following characters: @=/:.,
|
||||
set -l lastChar (string sub -s -1 -- $split)
|
||||
if not string match -r -q "[@=/:.,]" -- "$lastChar"
|
||||
# In other cases, to support the "nospace" directive we trick the shell
|
||||
# by outputting an extra, longer completion.
|
||||
__glow_debug "Adding second completion to perform nospace directive"
|
||||
set --global __glow_comp_results $split[1] $split[1].
|
||||
__glow_debug "Completions are now: $__glow_comp_results"
|
||||
end
|
||||
end
|
||||
|
||||
if test $numComps -eq 0; and test $nofiles -eq 0
|
||||
# To be consistent with bash and zsh, we only trigger file
|
||||
# completion when there are no other completions
|
||||
__glow_debug "Requesting file completion"
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
# Since Fish completions are only loaded once the user triggers them, we trigger them ourselves
|
||||
# so we can properly delete any completions provided by another script.
|
||||
# Only do this if the program can be found, or else fish may print some errors; besides,
|
||||
# the existing completions will only be loaded if the program can be found.
|
||||
if type -q "glow"
|
||||
# The space after the program name is essential to trigger completion for the program
|
||||
# and not completion of the program name itself.
|
||||
# Also, we use '> /dev/null 2>&1' since '&>' is not supported in older versions of fish.
|
||||
complete --do-complete "glow " > /dev/null 2>&1
|
||||
end
|
||||
|
||||
# Remove any pre-existing completions for the program since we will be handling all of them.
|
||||
complete -c glow -e
|
||||
|
||||
# The call to __glow_prepare_completions will setup __glow_comp_results
|
||||
# which provides the program's completion choices.
|
||||
complete -c glow -n '__glow_prepare_completions' -f -a '$__glow_comp_results'
|
||||
|
||||
@@ -5,305 +5,762 @@
|
||||
[manager]
|
||||
|
||||
keymap = [
|
||||
{ on = [ "<Esc>" ], run = "escape", desc = "Exit visual mode, clear selected, or cancel search" },
|
||||
{ on = [ "<C-[>" ], run = "escape", desc = "Exit visual mode, clear selected, or cancel search" },
|
||||
{ on = [ "q" ], run = "quit", desc = "Exit the process" },
|
||||
{ on = [ "Q" ], run = "quit --no-cwd-file", desc = "Exit the process without writing cwd-file" },
|
||||
{ on = [ "<C-q>" ], run = "close", desc = "Close the current tab, or quit if it is last tab" },
|
||||
{ on = [ "<C-z>" ], run = "suspend", desc = "Suspend the process" },
|
||||
{ on = [
|
||||
"<Esc>",
|
||||
], run = "escape", desc = "Exit visual mode, clear selected, or cancel search" },
|
||||
{ on = [
|
||||
"<C-[>",
|
||||
], run = "escape", desc = "Exit visual mode, clear selected, or cancel search" },
|
||||
{ on = [
|
||||
"q",
|
||||
], run = "quit", desc = "Exit the process" },
|
||||
{ on = [
|
||||
"Q",
|
||||
], run = "quit --no-cwd-file", desc = "Exit the process without writing cwd-file" },
|
||||
{ on = [
|
||||
"<C-q>",
|
||||
], run = "close", desc = "Close the current tab, or quit if it is last tab" },
|
||||
{ on = [
|
||||
"<C-z>",
|
||||
], run = "suspend", desc = "Suspend the process" },
|
||||
|
||||
# Navigation
|
||||
{ on = [ "k" ], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [ "j" ], run = "arrow 1", desc = "Move cursor down" },
|
||||
{ on = [
|
||||
"k",
|
||||
], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [
|
||||
"j",
|
||||
], run = "arrow 1", desc = "Move cursor down" },
|
||||
|
||||
{ on = [ "K" ], run = "arrow -5", desc = "Move cursor up 5 lines" },
|
||||
{ on = [ "J" ], run = "arrow 5", desc = "Move cursor down 5 lines" },
|
||||
{ on = [
|
||||
"K",
|
||||
], run = "arrow -5", desc = "Move cursor up 5 lines" },
|
||||
{ on = [
|
||||
"J",
|
||||
], run = "arrow 5", desc = "Move cursor down 5 lines" },
|
||||
|
||||
{ on = [ "<S-Up>" ], run = "arrow -5", desc = "Move cursor up 5 lines" },
|
||||
{ on = [ "<S-Down>" ], run = "arrow 5", desc = "Move cursor down 5 lines" },
|
||||
{ on = [
|
||||
"<S-Up>",
|
||||
], run = "arrow -5", desc = "Move cursor up 5 lines" },
|
||||
{ on = [
|
||||
"<S-Down>",
|
||||
], run = "arrow 5", desc = "Move cursor down 5 lines" },
|
||||
|
||||
{ on = [ "<C-u>" ], run = "arrow -50%", desc = "Move cursor up half page" },
|
||||
{ on = [ "<C-d>" ], run = "arrow 50%", desc = "Move cursor down half page" },
|
||||
{ on = [ "<C-b>" ], run = "arrow -100%", desc = "Move cursor up one page" },
|
||||
{ on = [ "<C-f>" ], run = "arrow 100%", desc = "Move cursor down one page" },
|
||||
{ on = [
|
||||
"<C-u>",
|
||||
], run = "arrow -50%", desc = "Move cursor up half page" },
|
||||
{ on = [
|
||||
"<C-d>",
|
||||
], run = "arrow 50%", desc = "Move cursor down half page" },
|
||||
{ on = [
|
||||
"<C-b>",
|
||||
], run = "arrow -100%", desc = "Move cursor up one page" },
|
||||
{ on = [
|
||||
"<C-f>",
|
||||
], run = "arrow 100%", desc = "Move cursor down one page" },
|
||||
|
||||
{ on = [ "<C-PageUp>" ], run = "arrow -50%", desc = "Move cursor up half page" },
|
||||
{ on = [ "<C-PageDown>" ], run = "arrow 50%", desc = "Move cursor down half page" },
|
||||
{ on = [ "<PageUp>" ], run = "arrow -100%", desc = "Move cursor up one page" },
|
||||
{ on = [ "<PageDown>" ], run = "arrow 100%", desc = "Move cursor down one page" },
|
||||
{ on = [
|
||||
"<C-PageUp>",
|
||||
], run = "arrow -50%", desc = "Move cursor up half page" },
|
||||
{ on = [
|
||||
"<C-PageDown>",
|
||||
], run = "arrow 50%", desc = "Move cursor down half page" },
|
||||
{ on = [
|
||||
"<PageUp>",
|
||||
], run = "arrow -100%", desc = "Move cursor up one page" },
|
||||
{ on = [
|
||||
"<PageDown>",
|
||||
], run = "arrow 100%", desc = "Move cursor down one page" },
|
||||
|
||||
{ on = [ "h" ], run = "leave", desc = "Go back to the parent directory" },
|
||||
{ on = [ "l" ], run = "enter", desc = "Enter the child directory" },
|
||||
{ on = [
|
||||
"h",
|
||||
], run = "leave", desc = "Go back to the parent directory" },
|
||||
{ on = [
|
||||
"l",
|
||||
], run = "enter", desc = "Enter the child directory" },
|
||||
|
||||
{ on = [ "H" ], run = "back", desc = "Go back to the previous directory" },
|
||||
{ on = [ "L" ], run = "forward", desc = "Go forward to the next directory" },
|
||||
{ on = [
|
||||
"H",
|
||||
], run = "back", desc = "Go back to the previous directory" },
|
||||
{ on = [
|
||||
"L",
|
||||
], run = "forward", desc = "Go forward to the next directory" },
|
||||
|
||||
{ on = [ "<A-k>" ], run = "seek -5", desc = "Seek up 5 units in the preview" },
|
||||
{ on = [ "<A-j>" ], run = "seek 5", desc = "Seek down 5 units in the preview" },
|
||||
{ on = [ "<A-PageUp>" ], run = "seek -5", desc = "Seek up 5 units in the preview" },
|
||||
{ on = [ "<A-PageDown>" ], run = "seek 5", desc = "Seek down 5 units in the preview" },
|
||||
{ on = [
|
||||
"<A-k>",
|
||||
], run = "seek -5", desc = "Seek up 5 units in the preview" },
|
||||
{ on = [
|
||||
"<A-j>",
|
||||
], run = "seek 5", desc = "Seek down 5 units in the preview" },
|
||||
{ on = [
|
||||
"<A-PageUp>",
|
||||
], run = "seek -5", desc = "Seek up 5 units in the preview" },
|
||||
{ on = [
|
||||
"<A-PageDown>",
|
||||
], run = "seek 5", desc = "Seek down 5 units in the preview" },
|
||||
|
||||
{ on = [ "<Up>" ], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [ "<Down>" ], run = "arrow 1", desc = "Move cursor down" },
|
||||
{ on = [ "<Left>" ], run = "leave", desc = "Go back to the parent directory" },
|
||||
{ on = [ "<Right>" ], run = "enter", desc = "Enter the child directory" },
|
||||
{ on = [
|
||||
"<Up>",
|
||||
], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [
|
||||
"<Down>",
|
||||
], run = "arrow 1", desc = "Move cursor down" },
|
||||
{ on = [
|
||||
"<Left>",
|
||||
], run = "leave", desc = "Go back to the parent directory" },
|
||||
{ on = [
|
||||
"<Right>",
|
||||
], run = "enter", desc = "Enter the child directory" },
|
||||
|
||||
{ on = [ "g", "g" ], run = "arrow -99999999", desc = "Move cursor to the top" },
|
||||
{ on = [ "G" ], run = "arrow 99999999", desc = "Move cursor to the bottom" },
|
||||
{ on = [
|
||||
"g",
|
||||
"g",
|
||||
], run = "arrow -99999999", desc = "Move cursor to the top" },
|
||||
{ on = [
|
||||
"G",
|
||||
], run = "arrow 99999999", desc = "Move cursor to the bottom" },
|
||||
|
||||
# Selection
|
||||
{ on = [ "<Space>" ], run = [ "select --state=none", "arrow 1" ], desc = "Toggle the current selection state" },
|
||||
{ on = [ "v" ], run = "visual_mode", desc = "Enter visual mode (selection mode)" },
|
||||
{ on = [ "V" ], run = "visual_mode --unset", desc = "Enter visual mode (unset mode)" },
|
||||
{ on = [ "<C-a>" ], run = "select_all --state=true", desc = "Select all files" },
|
||||
{ on = [ "<C-r>" ], run = "select_all --state=none", desc = "Inverse selection of all files" },
|
||||
{ on = [
|
||||
"<Space>",
|
||||
], run = [
|
||||
"select --state=none",
|
||||
"arrow 1",
|
||||
], desc = "Toggle the current selection state" },
|
||||
{ on = [
|
||||
"v",
|
||||
], run = "visual_mode", desc = "Enter visual mode (selection mode)" },
|
||||
{ on = [
|
||||
"V",
|
||||
], run = "visual_mode --unset", desc = "Enter visual mode (unset mode)" },
|
||||
{ on = [
|
||||
"<C-a>",
|
||||
], run = "select_all --state=true", desc = "Select all files" },
|
||||
{ on = [
|
||||
"<C-r>",
|
||||
], run = "select_all --state=none", desc = "Inverse selection of all files" },
|
||||
|
||||
# Operation
|
||||
{ on = [ "o" ], run = "open", desc = "Open the selected files" },
|
||||
{ on = [ "O" ], run = "open --interactive", desc = "Open the selected files interactively" },
|
||||
{ on = [ "<Enter>" ], run = "open", desc = "Open the selected files" },
|
||||
{ on = [ "<C-Enter>" ], run = "open --interactive", desc = "Open the selected files interactively" },
|
||||
{ on = [ "y" ], run = "yank", desc = "Copy the selected files" },
|
||||
{ on = [ "Y" ], run = "unyank", desc = "Cancel the yank status of files" },
|
||||
{ on = [ "x" ], run = "yank --cut", desc = "Cut the selected files" },
|
||||
{ on = [ "X" ], run = "unyank", desc = "Cancel the yank status of files" },
|
||||
{ on = [ "p" ], run = "paste", desc = "Paste the files" },
|
||||
{ on = [ "P" ], run = "paste --force", desc = "Paste the files (overwrite if the destination exists)" },
|
||||
{ on = [ "-" ], run = "link", desc = "Symlink the absolute path of files" },
|
||||
{ on = [ "_" ], run = "link --relative", desc = "Symlink the relative path of files" },
|
||||
{ on = [ "d" ], run = "remove", desc = "Move the files to the trash" },
|
||||
{ on = [ "D" ], run = "remove --permanently", desc = "Permanently delete the files" },
|
||||
{ on = [ "a" ], run = "create", desc = "Create a file or directory (ends with / for directories)" },
|
||||
{ on = [ "r" ], run = "rename --cursor=before_ext", desc = "Rename a file or directory" },
|
||||
{ on = [ ";" ], run = "shell", desc = "Run a shell command" },
|
||||
{ on = [ ":" ], run = "shell --block", desc = "Run a shell command (block the UI until the command finishes)" },
|
||||
{ on = [ "." ], run = "hidden toggle", desc = "Toggle the visibility of hidden files" },
|
||||
{ on = [ "s" ], run = "search fd", desc = "Search files by name using fd" },
|
||||
{ on = [ "S" ], run = "search rg", desc = "Search files by content using ripgrep" },
|
||||
{ on = [ "<C-s>" ], run = "search none", desc = "Cancel the ongoing search" },
|
||||
{ on = [ "z" ], run = "plugin zoxide", desc = "Jump to a directory using zoxide" },
|
||||
{ on = [ "Z" ], run = "plugin fzf", desc = "Jump to a directory, or reveal a file using fzf" },
|
||||
{ on = [
|
||||
"o",
|
||||
], run = "open", desc = "Open the selected files" },
|
||||
{ on = [
|
||||
"O",
|
||||
], run = "open --interactive", desc = "Open the selected files interactively" },
|
||||
{ on = [
|
||||
"<Enter>",
|
||||
], run = "open", desc = "Open the selected files" },
|
||||
{ on = [
|
||||
"<C-Enter>",
|
||||
], run = "open --interactive", desc = "Open the selected files interactively" },
|
||||
{ on = [
|
||||
"y",
|
||||
], run = "yank", desc = "Copy the selected files" },
|
||||
{ on = [
|
||||
"Y",
|
||||
], run = "unyank", desc = "Cancel the yank status of files" },
|
||||
{ on = [
|
||||
"x",
|
||||
], run = "yank --cut", desc = "Cut the selected files" },
|
||||
{ on = [
|
||||
"X",
|
||||
], run = "unyank", desc = "Cancel the yank status of files" },
|
||||
{ on = [
|
||||
"p",
|
||||
], run = "paste", desc = "Paste the files" },
|
||||
{ on = [
|
||||
"P",
|
||||
], run = "paste --force", desc = "Paste the files (overwrite if the destination exists)" },
|
||||
{ on = [
|
||||
"-",
|
||||
], run = "link", desc = "Symlink the absolute path of files" },
|
||||
{ on = [
|
||||
"_",
|
||||
], run = "link --relative", desc = "Symlink the relative path of files" },
|
||||
{ on = [
|
||||
"d",
|
||||
], run = "remove", desc = "Move the files to the trash" },
|
||||
{ on = [
|
||||
"D",
|
||||
], run = "remove --permanently", desc = "Permanently delete the files" },
|
||||
{ on = [
|
||||
"a",
|
||||
], run = "create", desc = "Create a file or directory (ends with / for directories)" },
|
||||
{ on = [
|
||||
"r",
|
||||
], run = "rename --cursor=before_ext", desc = "Rename a file or directory" },
|
||||
{ on = [
|
||||
";",
|
||||
], run = "shell", desc = "Run a shell command" },
|
||||
{ on = [
|
||||
":",
|
||||
], run = "shell --block", desc = "Run a shell command (block the UI until the command finishes)" },
|
||||
{ on = [
|
||||
".",
|
||||
], run = "hidden toggle", desc = "Toggle the visibility of hidden files" },
|
||||
{ on = [
|
||||
"s",
|
||||
], run = "search fd", desc = "Search files by name using fd" },
|
||||
{ on = [
|
||||
"S",
|
||||
], run = "search rg", desc = "Search files by content using ripgrep" },
|
||||
{ on = [
|
||||
"<C-s>",
|
||||
], run = "search none", desc = "Cancel the ongoing search" },
|
||||
{ on = [
|
||||
"z",
|
||||
], run = "plugin zoxide", desc = "Jump to a directory using zoxide" },
|
||||
{ on = [
|
||||
"Z",
|
||||
], run = "plugin fzf", desc = "Jump to a directory, or reveal a file using fzf" },
|
||||
|
||||
# Linemode
|
||||
{ on = [ "m", "s" ], run = "linemode size", desc = "Set linemode to size" },
|
||||
{ on = [ "m", "p" ], run = "linemode permissions", desc = "Set linemode to permissions" },
|
||||
{ on = [ "m", "m" ], run = "linemode mtime", desc = "Set linemode to mtime" },
|
||||
{ on = [ "m", "n" ], run = "linemode none", desc = "Set linemode to none" },
|
||||
{ on = [
|
||||
"m",
|
||||
"s",
|
||||
], run = "linemode size", desc = "Set linemode to size" },
|
||||
{ on = [
|
||||
"m",
|
||||
"p",
|
||||
], run = "linemode permissions", desc = "Set linemode to permissions" },
|
||||
{ on = [
|
||||
"m",
|
||||
"m",
|
||||
], run = "linemode mtime", desc = "Set linemode to mtime" },
|
||||
{ on = [
|
||||
"m",
|
||||
"n",
|
||||
], run = "linemode none", desc = "Set linemode to none" },
|
||||
|
||||
# Copy
|
||||
{ on = [ "c", "c" ], run = "copy path", desc = "Copy the absolute path" },
|
||||
{ on = [ "c", "d" ], run = "copy dirname", desc = "Copy the path of the parent directory" },
|
||||
{ on = [ "c", "f" ], run = "copy filename", desc = "Copy the name of the file" },
|
||||
{ on = [ "c", "n" ], run = "copy name_without_ext", desc = "Copy the name of the file without the extension" },
|
||||
{ on = [
|
||||
"c",
|
||||
"c",
|
||||
], run = "copy path", desc = "Copy the absolute path" },
|
||||
{ on = [
|
||||
"c",
|
||||
"d",
|
||||
], run = "copy dirname", desc = "Copy the path of the parent directory" },
|
||||
{ on = [
|
||||
"c",
|
||||
"f",
|
||||
], run = "copy filename", desc = "Copy the name of the file" },
|
||||
{ on = [
|
||||
"c",
|
||||
"n",
|
||||
], run = "copy name_without_ext", desc = "Copy the name of the file without the extension" },
|
||||
|
||||
# Filter
|
||||
{ on = [ "f" ], run = "filter --smart", desc = "Filter the files" },
|
||||
{ on = [
|
||||
"f",
|
||||
], run = "filter --smart", desc = "Filter the files" },
|
||||
|
||||
# Find
|
||||
{ on = [ "/" ], run = "find --smart", desc = "Find next file" },
|
||||
{ on = [ "?" ], run = "find --previous --smart", desc = "Find previous file" },
|
||||
{ on = [ "n" ], run = "find_arrow", desc = "Go to next found file" },
|
||||
{ on = [ "N" ], run = "find_arrow --previous", desc = "Go to previous found file" },
|
||||
{ on = [
|
||||
"/",
|
||||
], run = "find --smart", desc = "Find next file" },
|
||||
{ on = [
|
||||
"?",
|
||||
], run = "find --previous --smart", desc = "Find previous file" },
|
||||
{ on = [
|
||||
"n",
|
||||
], run = "find_arrow", desc = "Go to next found file" },
|
||||
{ on = [
|
||||
"N",
|
||||
], run = "find_arrow --previous", desc = "Go to previous found file" },
|
||||
|
||||
# Sorting
|
||||
{ on = [ ",", "m" ], run = "sort modified --dir-first", desc = "Sort by modified time" },
|
||||
{ on = [ ",", "M" ], run = "sort modified --reverse --dir-first", desc = "Sort by modified time (reverse)" },
|
||||
{ on = [ ",", "c" ], run = "sort created --dir-first", desc = "Sort by created time" },
|
||||
{ on = [ ",", "C" ], run = "sort created --reverse --dir-first", desc = "Sort by created time (reverse)" },
|
||||
{ on = [ ",", "e" ], run = "sort extension --dir-first", desc = "Sort by extension" },
|
||||
{ on = [ ",", "E" ], run = "sort extension --reverse --dir-first", desc = "Sort by extension (reverse)" },
|
||||
{ on = [ ",", "a" ], run = "sort alphabetical --dir-first", desc = "Sort alphabetically" },
|
||||
{ on = [ ",", "A" ], run = "sort alphabetical --reverse --dir-first", desc = "Sort alphabetically (reverse)" },
|
||||
{ on = [ ",", "n" ], run = "sort natural --dir-first", desc = "Sort naturally" },
|
||||
{ on = [ ",", "N" ], run = "sort natural --reverse --dir-first", desc = "Sort naturally (reverse)" },
|
||||
{ on = [ ",", "s" ], run = "sort size --dir-first", desc = "Sort by size" },
|
||||
{ on = [ ",", "S" ], run = "sort size --reverse --dir-first", desc = "Sort by size (reverse)" },
|
||||
{ on = [
|
||||
",",
|
||||
"m",
|
||||
], run = "sort modified --dir-first", desc = "Sort by modified time" },
|
||||
{ on = [
|
||||
",",
|
||||
"M",
|
||||
], run = "sort modified --reverse --dir-first", desc = "Sort by modified time (reverse)" },
|
||||
{ on = [
|
||||
",",
|
||||
"c",
|
||||
], run = "sort created --dir-first", desc = "Sort by created time" },
|
||||
{ on = [
|
||||
",",
|
||||
"C",
|
||||
], run = "sort created --reverse --dir-first", desc = "Sort by created time (reverse)" },
|
||||
{ on = [
|
||||
",",
|
||||
"e",
|
||||
], run = "sort extension --dir-first", desc = "Sort by extension" },
|
||||
{ on = [
|
||||
",",
|
||||
"E",
|
||||
], run = "sort extension --reverse --dir-first", desc = "Sort by extension (reverse)" },
|
||||
{ on = [
|
||||
",",
|
||||
"a",
|
||||
], run = "sort alphabetical --dir-first", desc = "Sort alphabetically" },
|
||||
{ on = [
|
||||
",",
|
||||
"A",
|
||||
], run = "sort alphabetical --reverse --dir-first", desc = "Sort alphabetically (reverse)" },
|
||||
{ on = [
|
||||
",",
|
||||
"n",
|
||||
], run = "sort natural --dir-first", desc = "Sort naturally" },
|
||||
{ on = [
|
||||
",",
|
||||
"N",
|
||||
], run = "sort natural --reverse --dir-first", desc = "Sort naturally (reverse)" },
|
||||
{ on = [
|
||||
",",
|
||||
"s",
|
||||
], run = "sort size --dir-first", desc = "Sort by size" },
|
||||
{ on = [
|
||||
",",
|
||||
"S",
|
||||
], run = "sort size --reverse --dir-first", desc = "Sort by size (reverse)" },
|
||||
|
||||
# Tabs
|
||||
{ on = [ "t" ], run = "tab_create --current", desc = "Create a new tab using the current path" },
|
||||
{ on = [
|
||||
"t",
|
||||
], run = "tab_create --current", desc = "Create a new tab using the current path" },
|
||||
|
||||
{ on = [ "1" ], run = "tab_switch 0", desc = "Switch to the first tab" },
|
||||
{ on = [ "2" ], run = "tab_switch 1", desc = "Switch to the second tab" },
|
||||
{ on = [ "3" ], run = "tab_switch 2", desc = "Switch to the third tab" },
|
||||
{ on = [ "4" ], run = "tab_switch 3", desc = "Switch to the fourth tab" },
|
||||
{ on = [ "5" ], run = "tab_switch 4", desc = "Switch to the fifth tab" },
|
||||
{ on = [ "6" ], run = "tab_switch 5", desc = "Switch to the sixth tab" },
|
||||
{ on = [ "7" ], run = "tab_switch 6", desc = "Switch to the seventh tab" },
|
||||
{ on = [ "8" ], run = "tab_switch 7", desc = "Switch to the eighth tab" },
|
||||
{ on = [ "9" ], run = "tab_switch 8", desc = "Switch to the ninth tab" },
|
||||
{ on = [
|
||||
"1",
|
||||
], run = "tab_switch 0", desc = "Switch to the first tab" },
|
||||
{ on = [
|
||||
"2",
|
||||
], run = "tab_switch 1", desc = "Switch to the second tab" },
|
||||
{ on = [
|
||||
"3",
|
||||
], run = "tab_switch 2", desc = "Switch to the third tab" },
|
||||
{ on = [
|
||||
"4",
|
||||
], run = "tab_switch 3", desc = "Switch to the fourth tab" },
|
||||
{ on = [
|
||||
"5",
|
||||
], run = "tab_switch 4", desc = "Switch to the fifth tab" },
|
||||
{ on = [
|
||||
"6",
|
||||
], run = "tab_switch 5", desc = "Switch to the sixth tab" },
|
||||
{ on = [
|
||||
"7",
|
||||
], run = "tab_switch 6", desc = "Switch to the seventh tab" },
|
||||
{ on = [
|
||||
"8",
|
||||
], run = "tab_switch 7", desc = "Switch to the eighth tab" },
|
||||
{ on = [
|
||||
"9",
|
||||
], run = "tab_switch 8", desc = "Switch to the ninth tab" },
|
||||
|
||||
{ on = [ "[" ], run = "tab_switch -1 --relative", desc = "Switch to the previous tab" },
|
||||
{ on = [ "]" ], run = "tab_switch 1 --relative", desc = "Switch to the next tab" },
|
||||
{ on = [
|
||||
"[",
|
||||
], run = "tab_switch -1 --relative", desc = "Switch to the previous tab" },
|
||||
{ on = [
|
||||
"]",
|
||||
], run = "tab_switch 1 --relative", desc = "Switch to the next tab" },
|
||||
|
||||
{ on = [ "{" ], run = "tab_swap -1", desc = "Swap the current tab with the previous tab" },
|
||||
{ on = [ "}" ], run = "tab_swap 1", desc = "Swap the current tab with the next tab" },
|
||||
{ on = [
|
||||
"{",
|
||||
], run = "tab_swap -1", desc = "Swap the current tab with the previous tab" },
|
||||
{ on = [
|
||||
"}",
|
||||
], run = "tab_swap 1", desc = "Swap the current tab with the next tab" },
|
||||
|
||||
# Tasks
|
||||
{ on = [ "w" ], run = "tasks_show", desc = "Show the tasks manager" },
|
||||
{ on = [
|
||||
"w",
|
||||
], run = "tasks_show", desc = "Show the tasks manager" },
|
||||
|
||||
# Goto
|
||||
{ on = [ "g", "h" ], run = "cd ~", desc = "Go to the home directory" },
|
||||
{ on = [ "g", "c" ], run = "cd ~/.config", desc = "Go to the config directory" },
|
||||
{ on = [ "g", "d" ], run = "cd ~/Downloads", desc = "Go to the downloads directory" },
|
||||
{ on = [ "g", "t" ], run = "cd /tmp", desc = "Go to the temporary directory" },
|
||||
{ on = [ "g", "<Space>" ], run = "cd --interactive", desc = "Go to a directory interactively" },
|
||||
{ on = [
|
||||
"g",
|
||||
"h",
|
||||
], run = "cd ~", desc = "Go to the home directory" },
|
||||
{ on = [
|
||||
"g",
|
||||
"c",
|
||||
], run = "cd ~/.config", desc = "Go to the config directory" },
|
||||
{ on = [
|
||||
"g",
|
||||
"d",
|
||||
], run = "cd ~/Downloads", desc = "Go to the downloads directory" },
|
||||
{ on = [
|
||||
"g",
|
||||
"t",
|
||||
], run = "cd /tmp", desc = "Go to the temporary directory" },
|
||||
{ on = [
|
||||
"g",
|
||||
"<Space>",
|
||||
], run = "cd --interactive", desc = "Go to a directory interactively" },
|
||||
|
||||
# Help
|
||||
{ on = [ "~" ], run = "help", desc = "Open help" },
|
||||
{ on = [
|
||||
"~",
|
||||
], run = "help", desc = "Open help" },
|
||||
]
|
||||
|
||||
prepend_keymap = []
|
||||
|
||||
[tasks]
|
||||
|
||||
keymap = [
|
||||
{ on = [ "<Esc>" ], run = "close", desc = "Hide the task manager" },
|
||||
{ on = [ "<C-[>" ], run = "close", desc = "Hide the task manager" },
|
||||
{ on = [ "<C-q>" ], run = "close", desc = "Hide the task manager" },
|
||||
{ on = [ "w" ], run = "close", desc = "Hide the task manager" },
|
||||
{ on = [
|
||||
"<Esc>",
|
||||
], run = "close", desc = "Hide the task manager" },
|
||||
{ on = [
|
||||
"<C-[>",
|
||||
], run = "close", desc = "Hide the task manager" },
|
||||
{ on = [
|
||||
"<C-q>",
|
||||
], run = "close", desc = "Hide the task manager" },
|
||||
{ on = [
|
||||
"w",
|
||||
], run = "close", desc = "Hide the task manager" },
|
||||
|
||||
{ on = [ "k" ], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [ "j" ], run = "arrow 1", desc = "Move cursor down" },
|
||||
{ on = [
|
||||
"k",
|
||||
], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [
|
||||
"j",
|
||||
], run = "arrow 1", desc = "Move cursor down" },
|
||||
|
||||
{ on = [ "<Up>" ], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [ "<Down>" ], run = "arrow 1", desc = "Move cursor down" },
|
||||
{ on = [
|
||||
"<Up>",
|
||||
], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [
|
||||
"<Down>",
|
||||
], run = "arrow 1", desc = "Move cursor down" },
|
||||
|
||||
{ on = [ "<Enter>" ], run = "inspect", desc = "Inspect the task" },
|
||||
{ on = [ "x" ], run = "cancel", desc = "Cancel the task" },
|
||||
{ on = [
|
||||
"<Enter>",
|
||||
], run = "inspect", desc = "Inspect the task" },
|
||||
{ on = [
|
||||
"x",
|
||||
], run = "cancel", desc = "Cancel the task" },
|
||||
|
||||
{ on = [ "~" ], run = "help", desc = "Open help" }
|
||||
{ on = [
|
||||
"~",
|
||||
], run = "help", desc = "Open help" },
|
||||
]
|
||||
|
||||
[select]
|
||||
|
||||
keymap = [
|
||||
{ on = [ "<Esc>" ], run = "close", desc = "Cancel selection" },
|
||||
{ on = [ "<C-[>" ], run = "close", desc = "Cancel selection" },
|
||||
{ on = [ "<C-q>" ], run = "close", desc = "Cancel selection" },
|
||||
{ on = [ "<Enter>" ], run = "close --submit", desc = "Submit the selection" },
|
||||
{ on = [
|
||||
"<Esc>",
|
||||
], run = "close", desc = "Cancel selection" },
|
||||
{ on = [
|
||||
"<C-[>",
|
||||
], run = "close", desc = "Cancel selection" },
|
||||
{ on = [
|
||||
"<C-q>",
|
||||
], run = "close", desc = "Cancel selection" },
|
||||
{ on = [
|
||||
"<Enter>",
|
||||
], run = "close --submit", desc = "Submit the selection" },
|
||||
|
||||
{ on = [ "k" ], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [ "j" ], run = "arrow 1", desc = "Move cursor down" },
|
||||
{ on = [
|
||||
"k",
|
||||
], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [
|
||||
"j",
|
||||
], run = "arrow 1", desc = "Move cursor down" },
|
||||
|
||||
{ on = [ "K" ], run = "arrow -5", desc = "Move cursor up 5 lines" },
|
||||
{ on = [ "J" ], run = "arrow 5", desc = "Move cursor down 5 lines" },
|
||||
{ on = [
|
||||
"K",
|
||||
], run = "arrow -5", desc = "Move cursor up 5 lines" },
|
||||
{ on = [
|
||||
"J",
|
||||
], run = "arrow 5", desc = "Move cursor down 5 lines" },
|
||||
|
||||
{ on = [ "<Up>" ], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [ "<Down>" ], run = "arrow 1", desc = "Move cursor down" },
|
||||
{ on = [
|
||||
"<Up>",
|
||||
], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [
|
||||
"<Down>",
|
||||
], run = "arrow 1", desc = "Move cursor down" },
|
||||
|
||||
{ on = [ "<S-Up>" ], run = "arrow -5", desc = "Move cursor up 5 lines" },
|
||||
{ on = [ "<S-Down>" ], run = "arrow 5", desc = "Move cursor down 5 lines" },
|
||||
{ on = [
|
||||
"<S-Up>",
|
||||
], run = "arrow -5", desc = "Move cursor up 5 lines" },
|
||||
{ on = [
|
||||
"<S-Down>",
|
||||
], run = "arrow 5", desc = "Move cursor down 5 lines" },
|
||||
|
||||
{ on = [ "~" ], run = "help", desc = "Open help" }
|
||||
{ on = [
|
||||
"~",
|
||||
], run = "help", desc = "Open help" },
|
||||
]
|
||||
|
||||
[input]
|
||||
|
||||
keymap = [
|
||||
{ on = [ "<C-q>" ], run = "close", desc = "Cancel input" },
|
||||
{ on = [ "<Enter>" ], run = "close --submit", desc = "Submit the input" },
|
||||
{ on = [ "<Esc>" ], run = "escape", desc = "Go back the normal mode, or cancel input" },
|
||||
{ on = [ "<C-[>" ], run = "escape", desc = "Go back the normal mode, or cancel input" },
|
||||
{ on = [
|
||||
"<C-q>",
|
||||
], run = "close", desc = "Cancel input" },
|
||||
{ on = [
|
||||
"<Enter>",
|
||||
], run = "close --submit", desc = "Submit the input" },
|
||||
{ on = [
|
||||
"<Esc>",
|
||||
], run = "escape", desc = "Go back the normal mode, or cancel input" },
|
||||
{ on = [
|
||||
"<C-[>",
|
||||
], run = "escape", desc = "Go back the normal mode, or cancel input" },
|
||||
|
||||
# Mode
|
||||
{ on = [ "i" ], run = "insert", desc = "Enter insert mode" },
|
||||
{ on = [ "a" ], run = "insert --append", desc = "Enter append mode" },
|
||||
{ on = [ "I" ], run = [ "move -999", "insert" ], desc = "Move to the BOL, and enter insert mode" },
|
||||
{ on = [ "A" ], run = [ "move 999", "insert --append" ], desc = "Move to the EOL, and enter append mode" },
|
||||
{ on = [ "v" ], run = "visual", desc = "Enter visual mode" },
|
||||
{ on = [ "V" ], run = [ "move -999", "visual", "move 999" ], desc = "Enter visual mode and select all" },
|
||||
{ on = [
|
||||
"i",
|
||||
], run = "insert", desc = "Enter insert mode" },
|
||||
{ on = [
|
||||
"a",
|
||||
], run = "insert --append", desc = "Enter append mode" },
|
||||
{ on = [
|
||||
"I",
|
||||
], run = [
|
||||
"move -999",
|
||||
"insert",
|
||||
], desc = "Move to the BOL, and enter insert mode" },
|
||||
{ on = [
|
||||
"A",
|
||||
], run = [
|
||||
"move 999",
|
||||
"insert --append",
|
||||
], desc = "Move to the EOL, and enter append mode" },
|
||||
{ on = [
|
||||
"v",
|
||||
], run = "visual", desc = "Enter visual mode" },
|
||||
{ on = [
|
||||
"V",
|
||||
], run = [
|
||||
"move -999",
|
||||
"visual",
|
||||
"move 999",
|
||||
], desc = "Enter visual mode and select all" },
|
||||
|
||||
# Character-wise movement
|
||||
{ on = [ "h" ], run = "move -1", desc = "Move back a character" },
|
||||
{ on = [ "l" ], run = "move 1", desc = "Move forward a character" },
|
||||
{ on = [ "<Left>" ], run = "move -1", desc = "Move back a character" },
|
||||
{ on = [ "<Right>" ], run = "move 1", desc = "Move forward a character" },
|
||||
{ on = [ "<C-b>" ], run = "move -1", desc = "Move back a character" },
|
||||
{ on = [ "<C-f>" ], run = "move 1", desc = "Move forward a character" },
|
||||
{ on = [
|
||||
"h",
|
||||
], run = "move -1", desc = "Move back a character" },
|
||||
{ on = [
|
||||
"l",
|
||||
], run = "move 1", desc = "Move forward a character" },
|
||||
{ on = [
|
||||
"<Left>",
|
||||
], run = "move -1", desc = "Move back a character" },
|
||||
{ on = [
|
||||
"<Right>",
|
||||
], run = "move 1", desc = "Move forward a character" },
|
||||
{ on = [
|
||||
"<C-b>",
|
||||
], run = "move -1", desc = "Move back a character" },
|
||||
{ on = [
|
||||
"<C-f>",
|
||||
], run = "move 1", desc = "Move forward a character" },
|
||||
|
||||
# Word-wise movement
|
||||
{ on = [ "b" ], run = "backward", desc = "Move back to the start of the current or previous word" },
|
||||
{ on = [ "w" ], run = "forward", desc = "Move forward to the start of the next word" },
|
||||
{ on = [ "e" ], run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" },
|
||||
{ on = [ "<A-b>" ], run = "backward", desc = "Move back to the start of the current or previous word" },
|
||||
{ on = [ "<A-f>" ], run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" },
|
||||
{ on = [
|
||||
"b",
|
||||
], run = "backward", desc = "Move back to the start of the current or previous word" },
|
||||
{ on = [
|
||||
"w",
|
||||
], run = "forward", desc = "Move forward to the start of the next word" },
|
||||
{ on = [
|
||||
"e",
|
||||
], run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" },
|
||||
{ on = [
|
||||
"<A-b>",
|
||||
], run = "backward", desc = "Move back to the start of the current or previous word" },
|
||||
{ on = [
|
||||
"<A-f>",
|
||||
], run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" },
|
||||
|
||||
# Line-wise movement
|
||||
{ on = [ "0" ], run = "move -999", desc = "Move to the BOL" },
|
||||
{ on = [ "$" ], run = "move 999", desc = "Move to the EOL" },
|
||||
{ on = [ "<C-a>" ], run = "move -999", desc = "Move to the BOL" },
|
||||
{ on = [ "<C-e>" ], run = "move 999", desc = "Move to the EOL" },
|
||||
{ on = [ "<Home>" ], run = "move -999", desc = "Move to the BOL" },
|
||||
{ on = [ "<End>" ], run = "move 999", desc = "Move to the EOL" },
|
||||
{ on = [
|
||||
"0",
|
||||
], run = "move -999", desc = "Move to the BOL" },
|
||||
{ on = [
|
||||
"$",
|
||||
], run = "move 999", desc = "Move to the EOL" },
|
||||
{ on = [
|
||||
"<C-a>",
|
||||
], run = "move -999", desc = "Move to the BOL" },
|
||||
{ on = [
|
||||
"<C-e>",
|
||||
], run = "move 999", desc = "Move to the EOL" },
|
||||
{ on = [
|
||||
"<Home>",
|
||||
], run = "move -999", desc = "Move to the BOL" },
|
||||
{ on = [
|
||||
"<End>",
|
||||
], run = "move 999", desc = "Move to the EOL" },
|
||||
|
||||
# Delete
|
||||
{ on = [ "<Backspace>" ], run = "backspace", desc = "Delete the character before the cursor" },
|
||||
{ on = [ "<Delete>" ], run = "backspace --under", desc = "Delete the character under the cursor" },
|
||||
{ on = [ "<C-h>" ], run = "backspace", desc = "Delete the character before the cursor" },
|
||||
{ on = [ "<C-d>" ], run = "backspace --under", desc = "Delete the character under the cursor" },
|
||||
{ on = [
|
||||
"<Backspace>",
|
||||
], run = "backspace", desc = "Delete the character before the cursor" },
|
||||
{ on = [
|
||||
"<Delete>",
|
||||
], run = "backspace --under", desc = "Delete the character under the cursor" },
|
||||
{ on = [
|
||||
"<C-h>",
|
||||
], run = "backspace", desc = "Delete the character before the cursor" },
|
||||
{ on = [
|
||||
"<C-d>",
|
||||
], run = "backspace --under", desc = "Delete the character under the cursor" },
|
||||
|
||||
# Kill
|
||||
{ on = [ "<C-u>" ], run = "kill bol", desc = "Kill backwards to the BOL" },
|
||||
{ on = [ "<C-k>" ], run = "kill eol", desc = "Kill forwards to the EOL" },
|
||||
{ on = [ "<C-w>" ], run = "kill backward", desc = "Kill backwards to the start of the current word" },
|
||||
{ on = [ "<A-d>" ], run = "kill forward", desc = "Kill forwards to the end of the current word" },
|
||||
{ on = [
|
||||
"<C-u>",
|
||||
], run = "kill bol", desc = "Kill backwards to the BOL" },
|
||||
{ on = [
|
||||
"<C-k>",
|
||||
], run = "kill eol", desc = "Kill forwards to the EOL" },
|
||||
{ on = [
|
||||
"<C-w>",
|
||||
], run = "kill backward", desc = "Kill backwards to the start of the current word" },
|
||||
{ on = [
|
||||
"<A-d>",
|
||||
], run = "kill forward", desc = "Kill forwards to the end of the current word" },
|
||||
|
||||
# Cut/Yank/Paste
|
||||
{ on = [ "d" ], run = "delete --cut", desc = "Cut the selected characters" },
|
||||
{ on = [ "D" ], run = [ "delete --cut", "move 999" ], desc = "Cut until the EOL" },
|
||||
{ on = [ "c" ], run = "delete --cut --insert", desc = "Cut the selected characters, and enter insert mode" },
|
||||
{ on = [ "C" ], run = [ "delete --cut --insert", "move 999" ], desc = "Cut until the EOL, and enter insert mode" },
|
||||
{ on = [ "x" ], run = [ "delete --cut", "move 1 --in-operating" ], desc = "Cut the current character" },
|
||||
{ on = [ "y" ], run = "yank", desc = "Copy the selected characters" },
|
||||
{ on = [ "p" ], run = "paste", desc = "Paste the copied characters after the cursor" },
|
||||
{ on = [ "P" ], run = "paste --before", desc = "Paste the copied characters before the cursor" },
|
||||
{ on = [
|
||||
"d",
|
||||
], run = "delete --cut", desc = "Cut the selected characters" },
|
||||
{ on = [
|
||||
"D",
|
||||
], run = [
|
||||
"delete --cut",
|
||||
"move 999",
|
||||
], desc = "Cut until the EOL" },
|
||||
{ on = [
|
||||
"c",
|
||||
], run = "delete --cut --insert", desc = "Cut the selected characters, and enter insert mode" },
|
||||
{ on = [
|
||||
"C",
|
||||
], run = [
|
||||
"delete --cut --insert",
|
||||
"move 999",
|
||||
], desc = "Cut until the EOL, and enter insert mode" },
|
||||
{ on = [
|
||||
"x",
|
||||
], run = [
|
||||
"delete --cut",
|
||||
"move 1 --in-operating",
|
||||
], desc = "Cut the current character" },
|
||||
{ on = [
|
||||
"y",
|
||||
], run = "yank", desc = "Copy the selected characters" },
|
||||
{ on = [
|
||||
"p",
|
||||
], run = "paste", desc = "Paste the copied characters after the cursor" },
|
||||
{ on = [
|
||||
"P",
|
||||
], run = "paste --before", desc = "Paste the copied characters before the cursor" },
|
||||
|
||||
# Undo/Redo
|
||||
{ on = [ "u" ], run = "undo", desc = "Undo the last operation" },
|
||||
{ on = [ "<C-r>" ], run = "redo", desc = "Redo the last operation" },
|
||||
{ on = [
|
||||
"u",
|
||||
], run = "undo", desc = "Undo the last operation" },
|
||||
{ on = [
|
||||
"<C-r>",
|
||||
], run = "redo", desc = "Redo the last operation" },
|
||||
|
||||
# Help
|
||||
{ on = [ "~" ], run = "help", desc = "Open help" }
|
||||
{ on = [
|
||||
"~",
|
||||
], run = "help", desc = "Open help" },
|
||||
]
|
||||
|
||||
[completion]
|
||||
|
||||
keymap = [
|
||||
{ on = [ "<C-q>" ], run = "close", desc = "Cancel completion" },
|
||||
{ on = [ "<Tab>" ], run = "close --submit", desc = "Submit the completion" },
|
||||
{ on = [ "<Enter>" ], run = [ "close --submit", "close_input --submit" ], desc = "Submit the completion and input" },
|
||||
{ on = [
|
||||
"<C-q>",
|
||||
], run = "close", desc = "Cancel completion" },
|
||||
{ on = [
|
||||
"<Tab>",
|
||||
], run = "close --submit", desc = "Submit the completion" },
|
||||
{ on = [
|
||||
"<Enter>",
|
||||
], run = [
|
||||
"close --submit",
|
||||
"close_input --submit",
|
||||
], desc = "Submit the completion and input" },
|
||||
|
||||
{ on = [ "<A-k>" ], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [ "<A-j>" ], run = "arrow 1", desc = "Move cursor down" },
|
||||
{ on = [
|
||||
"<A-k>",
|
||||
], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [
|
||||
"<A-j>",
|
||||
], run = "arrow 1", desc = "Move cursor down" },
|
||||
|
||||
{ on = [ "<Up>" ], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [ "<Down>" ], run = "arrow 1", desc = "Move cursor down" },
|
||||
{ on = [
|
||||
"<Up>",
|
||||
], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [
|
||||
"<Down>",
|
||||
], run = "arrow 1", desc = "Move cursor down" },
|
||||
|
||||
{ on = [ "<C-p>" ], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [ "<C-n>" ], run = "arrow 1", desc = "Move cursor down" },
|
||||
{ on = [
|
||||
"<C-p>",
|
||||
], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [
|
||||
"<C-n>",
|
||||
], run = "arrow 1", desc = "Move cursor down" },
|
||||
|
||||
{ on = [ "~" ], run = "help", desc = "Open help" }
|
||||
{ on = [
|
||||
"~",
|
||||
], run = "help", desc = "Open help" },
|
||||
]
|
||||
|
||||
[help]
|
||||
|
||||
keymap = [
|
||||
{ on = [ "<Esc>" ], run = "escape", desc = "Clear the filter, or hide the help" },
|
||||
{ on = [ "<C-[>" ], run = "escape", desc = "Clear the filter, or hide the help" },
|
||||
{ on = [ "q" ], run = "close", desc = "Exit the process" },
|
||||
{ on = [ "<C-q>" ], run = "close", desc = "Hide the help" },
|
||||
{ on = [
|
||||
"<Esc>",
|
||||
], run = "escape", desc = "Clear the filter, or hide the help" },
|
||||
{ on = [
|
||||
"<C-[>",
|
||||
], run = "escape", desc = "Clear the filter, or hide the help" },
|
||||
{ on = [
|
||||
"q",
|
||||
], run = "close", desc = "Exit the process" },
|
||||
{ on = [
|
||||
"<C-q>",
|
||||
], run = "close", desc = "Hide the help" },
|
||||
|
||||
# Navigation
|
||||
{ on = [ "k" ], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [ "j" ], run = "arrow 1", desc = "Move cursor down" },
|
||||
{ on = [
|
||||
"k",
|
||||
], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [
|
||||
"j",
|
||||
], run = "arrow 1", desc = "Move cursor down" },
|
||||
|
||||
{ on = [ "K" ], run = "arrow -5", desc = "Move cursor up 5 lines" },
|
||||
{ on = [ "J" ], run = "arrow 5", desc = "Move cursor down 5 lines" },
|
||||
{ on = [
|
||||
"K",
|
||||
], run = "arrow -5", desc = "Move cursor up 5 lines" },
|
||||
{ on = [
|
||||
"J",
|
||||
], run = "arrow 5", desc = "Move cursor down 5 lines" },
|
||||
|
||||
{ on = [ "<Up>" ], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [ "<Down>" ], run = "arrow 1", desc = "Move cursor down" },
|
||||
{ on = [
|
||||
"<Up>",
|
||||
], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [
|
||||
"<Down>",
|
||||
], run = "arrow 1", desc = "Move cursor down" },
|
||||
|
||||
{ on = [ "<S-Up>" ], run = "arrow -5", desc = "Move cursor up 5 lines" },
|
||||
{ on = [ "<S-Down>" ], run = "arrow 5", desc = "Move cursor down 5 lines" },
|
||||
{ on = [
|
||||
"<S-Up>",
|
||||
], run = "arrow -5", desc = "Move cursor up 5 lines" },
|
||||
{ on = [
|
||||
"<S-Down>",
|
||||
], run = "arrow 5", desc = "Move cursor down 5 lines" },
|
||||
|
||||
# Filtering
|
||||
{ on = [ "/" ], run = "filter", desc = "Apply a filter for the help items" },
|
||||
{ on = [
|
||||
"/",
|
||||
], run = "filter", desc = "Apply a filter for the help items" },
|
||||
]
|
||||
|
||||
21
yazi/dot-config/yazi/plugins/exifaudio.yazi/LICENSE
Normal file
21
yazi/dot-config/yazi/plugins/exifaudio.yazi/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Sonico98
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
32
yazi/dot-config/yazi/plugins/exifaudio.yazi/README.md
Normal file
32
yazi/dot-config/yazi/plugins/exifaudio.yazi/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# exifaudio.yazi
|
||||
|
||||
Preview audio metadata and cover on [Yazi](https://github.com/sxyazi/yazi).
|
||||
|
||||

|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
# Linux/macOS
|
||||
git clone https://github.com/Sonico98/exifaudio.yazi.git ~/.config/yazi/plugins/exifaudio.yazi
|
||||
|
||||
# Windows
|
||||
git clone https://github.com/Sonico98/exifaudio.yazi.git %AppData%\yazi\config\plugins\exifaudio.yazi
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Add the following to your `yazi.toml`:
|
||||
|
||||
```toml
|
||||
[plugin]
|
||||
prepend_previewers = [
|
||||
{ mime = "audio/*", run = "exifaudio"}
|
||||
]
|
||||
```
|
||||
|
||||
Make sure you have [exiftool](https://exiftool.org/) installed and in your `PATH`.
|
||||
|
||||
## Thanks
|
||||
|
||||
Thanks to [sxyazi](https://github.com/sxyazi) for the PDF previewer code, on which this previewer is based on.
|
||||
139
yazi/dot-config/yazi/plugins/exifaudio.yazi/init.lua
Normal file
139
yazi/dot-config/yazi/plugins/exifaudio.yazi/init.lua
Normal file
@@ -0,0 +1,139 @@
|
||||
local M = {}
|
||||
|
||||
function M:peek()
|
||||
local cache = ya.file_cache(self)
|
||||
if not cache then
|
||||
return
|
||||
end
|
||||
|
||||
local child = Command("exiftool")
|
||||
:args({
|
||||
"-q", "-q", "-S", "-Title", "-SortName",
|
||||
"-TitleSort", "-TitleSortOrder", "-Artist",
|
||||
"-SortArtist", "-ArtistSort", "-PerformerSortOrder",
|
||||
"-Album", "-SortAlbum", "-AlbumSort", "-AlbumSortOrder",
|
||||
"-AlbumArtist", "-SortAlbumArtist", "-AlbumArtistSort",
|
||||
"-AlbumArtistSortOrder", "-Genre", "-TrackNumber",
|
||||
"-Year", "-Duration", "-SampleRate",
|
||||
"-AudioSampleRate", "-AudioBitrate", "-AvgBitrate",
|
||||
"-Channels", "-AudioChannels", tostring(self.file.url),
|
||||
})
|
||||
:stdout(Command.PIPED)
|
||||
:stderr(Command.NULL)
|
||||
:spawn()
|
||||
|
||||
local limit = self.area.h
|
||||
local i, metadata = 0, {}
|
||||
repeat
|
||||
local next, event = child:read_line()
|
||||
if event == 1 then
|
||||
return self:fallback_to_builtin()
|
||||
elseif event ~= 0 then
|
||||
break
|
||||
end
|
||||
|
||||
i = i + 1
|
||||
if i > self.skip then
|
||||
local m_title, m_tag = prettify(next)
|
||||
local ti = ui.Span(m_title):bold()
|
||||
local ta = ui.Span(m_tag)
|
||||
table.insert(metadata, ui.Line{ti, ta})
|
||||
table.insert(metadata, ui.Line{})
|
||||
end
|
||||
until i >= self.skip + limit
|
||||
|
||||
local p = ui.Paragraph(self.area, metadata):wrap(ui.Paragraph.WRAP)
|
||||
ya.preview_widgets(self, { p })
|
||||
|
||||
local cover_width = self.area.w / 2 - 5
|
||||
local cover_height = (self.area.h / 4) + 3
|
||||
|
||||
local bottom_right = ui.Rect {
|
||||
x = self.area.right - cover_width,
|
||||
y = self.area.bottom - cover_height,
|
||||
w = cover_width,
|
||||
h = cover_height,
|
||||
}
|
||||
|
||||
if self:preload() == 1 then
|
||||
ya.image_show(cache, bottom_right)
|
||||
end
|
||||
end
|
||||
|
||||
function prettify(metadata)
|
||||
local substitutions = {
|
||||
Sortname = "Sort Title:",
|
||||
SortName = "Sort Title:",
|
||||
TitleSort = "Sort Title:",
|
||||
TitleSortOrder = "Sort Title:",
|
||||
ArtistSort = "Sort Artist:",
|
||||
SortArtist = "Sort Artist:",
|
||||
Artist = "Artist:",
|
||||
ARTIST = "Artist:",
|
||||
PerformerSortOrder = "Sort Artist:",
|
||||
SortAlbumArtist = "Sort Album Artist:",
|
||||
AlbumArtistSortOrder = "Sort Album Artist:",
|
||||
AlbumArtistSort = "Sort Album Artist:",
|
||||
AlbumSortOrder = "Sort Album:",
|
||||
AlbumSort = "Sort Album:",
|
||||
SortAlbum = "Sort Album:",
|
||||
Album = "Album:",
|
||||
ALBUM = "Album:",
|
||||
AlbumArtist = "Album Artist:",
|
||||
Genre = "Genre:",
|
||||
GENRE = "Genre:",
|
||||
TrackNumber = "Track Number:",
|
||||
Year = "Year:",
|
||||
Duration = "Duration:",
|
||||
AudioBitrate = "Bitrate:",
|
||||
AvgBitrate = "Average Bitrate:",
|
||||
AudioSampleRate = "Sample Rate:",
|
||||
SampleRate = "Sample Rate:",
|
||||
AudioChannels = "Channels:"
|
||||
}
|
||||
|
||||
for k, v in pairs(substitutions) do
|
||||
metadata = metadata:gsub(tostring(k)..":", v, 1)
|
||||
end
|
||||
|
||||
-- Separate the tag title from the tag data
|
||||
local t={}
|
||||
for str in string.gmatch(metadata , "([^"..":".."]+)") do
|
||||
table.insert(t, str)
|
||||
end
|
||||
|
||||
-- Add back semicolon to title, rejoin tag data if it happened to contain a semicolon
|
||||
return t[1]..":", table.concat(t, ":", 2)
|
||||
|
||||
end
|
||||
|
||||
function M:seek(units)
|
||||
local h = cx.active.current.hovered
|
||||
if h and h.url == self.file.url then
|
||||
ya.manager_emit("peek", {
|
||||
tostring(math.max(0, cx.active.preview.skip + units)),
|
||||
only_if = tostring(self.file.url),
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function M:preload()
|
||||
local cache = ya.file_cache(self)
|
||||
if not cache or fs.cha(cache) then
|
||||
return 1
|
||||
end
|
||||
|
||||
local output = Command("exiftool")
|
||||
:args({ "-b", "-CoverArt", "-Picture", tostring(self.file.url) })
|
||||
:stdout(Command.PIPED)
|
||||
:stderr(Command.PIPED)
|
||||
:output()
|
||||
|
||||
if not output then
|
||||
return 0
|
||||
end
|
||||
|
||||
return fs.write(cache, output.stdout) and 1 or 2
|
||||
end
|
||||
|
||||
return M
|
||||
7
yazi/dot-config/yazi/plugins/hexyl.yazi/LICENSE
Normal file
7
yazi/dot-config/yazi/plugins/hexyl.yazi/LICENSE
Normal file
@@ -0,0 +1,7 @@
|
||||
Copyright © 2024 Reledia <reledia@prontonmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
22
yazi/dot-config/yazi/plugins/hexyl.yazi/README.md
Normal file
22
yazi/dot-config/yazi/plugins/hexyl.yazi/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# hexyl.yazi
|
||||
|
||||
Preview any file on [Yazi](https://github.com/sxyazi/yazi) using [hexyl](https://github.com/sharkdp/hexyl). To install, clone the repo inside your `~/.config/yazi/plugins/`:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Reledia/hexyl.yazi.git
|
||||
```
|
||||
|
||||
then include it in your `yazi.toml` to use:
|
||||
|
||||
```toml
|
||||
[plugin]
|
||||
append_previewers = [
|
||||
{ name = "*", run = "hexyl" },
|
||||
]
|
||||
```
|
||||
|
||||
Make sure you have [hexyl](https://github.com/sharkdp/hexyl) installed, and can be found in `PATH`.
|
||||
|
||||
## Preview
|
||||
|
||||

|
||||
BIN
yazi/dot-config/yazi/plugins/hexyl.yazi/image.png
Normal file
BIN
yazi/dot-config/yazi/plugins/hexyl.yazi/image.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 807 KiB |
67
yazi/dot-config/yazi/plugins/hexyl.yazi/init.lua
Normal file
67
yazi/dot-config/yazi/plugins/hexyl.yazi/init.lua
Normal file
@@ -0,0 +1,67 @@
|
||||
local M = {}
|
||||
|
||||
function M:peek()
|
||||
local child
|
||||
local l = self.file.cha.length
|
||||
if l == 0 then
|
||||
child = Command("hexyl")
|
||||
:args({
|
||||
tostring(self.file.url),
|
||||
})
|
||||
:stdout(Command.PIPED)
|
||||
:stderr(Command.PIPED)
|
||||
:spawn()
|
||||
else
|
||||
child = Command("hexyl")
|
||||
:args({
|
||||
"--border",
|
||||
"none",
|
||||
"--terminal-width",
|
||||
tostring(self.area.w),
|
||||
tostring(self.file.url),
|
||||
})
|
||||
:stdout(Command.PIPED)
|
||||
:stderr(Command.PIPED)
|
||||
:spawn()
|
||||
end
|
||||
|
||||
local limit = self.area.h
|
||||
local i, lines = 0, ""
|
||||
repeat
|
||||
local next, event = child:read_line()
|
||||
if event == 1 then
|
||||
ya.err(tostring(event))
|
||||
elseif event ~= 0 then
|
||||
break
|
||||
end
|
||||
|
||||
i = i + 1
|
||||
if i > self.skip then
|
||||
lines = lines .. next
|
||||
end
|
||||
until i >= self.skip + limit
|
||||
|
||||
child:start_kill()
|
||||
if self.skip > 0 and i < self.skip + limit then
|
||||
ya.manager_emit(
|
||||
"peek",
|
||||
{ tostring(math.max(0, i - limit)), only_if = tostring(self.file.url), upper_bound = "" }
|
||||
)
|
||||
else
|
||||
lines = lines:gsub("\t", string.rep(" ", PREVIEW.tab_size))
|
||||
ya.preview_widgets(self, { ui.Paragraph.parse(self.area, lines) })
|
||||
end
|
||||
end
|
||||
|
||||
function M:seek(units)
|
||||
local h = cx.active.current.hovered
|
||||
if h and h.url == self.file.url then
|
||||
local step = math.floor(units * self.area.h / 10)
|
||||
ya.manager_emit("peek", {
|
||||
tostring(math.max(0, cx.active.preview.skip + step)),
|
||||
only_if = tostring(self.file.url),
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
7
yazi/dot-config/yazi/plugins/miller.yazi/LICENSE
Normal file
7
yazi/dot-config/yazi/plugins/miller.yazi/LICENSE
Normal file
@@ -0,0 +1,7 @@
|
||||
Copyright © 2024 Reledia <reledia@prontonmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
26
yazi/dot-config/yazi/plugins/miller.yazi/README.md
Normal file
26
yazi/dot-config/yazi/plugins/miller.yazi/README.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# miller.yazi
|
||||
|
||||
[Miller](https://github.com/johnkerl/miller) now in [yazi](https://github.com/sxyazi/yazi). To install, clone the repo inside `~/.config/yazi/plugins/`:
|
||||
|
||||
```toml
|
||||
[plugin]
|
||||
prepend_previewers = [
|
||||
{ mime = "text/csv", run = "miller"},
|
||||
]
|
||||
```
|
||||
|
||||
## Preview
|
||||
|
||||

|
||||
|
||||
## Color
|
||||
|
||||
To change colors of keys and values, edit the `init.lua` file after the `--key-color` and `--value-color` flags. To view a list of possible colors, use `mlr --list-color-names`. Make sure to have miller installed and inside your PATH.
|
||||
|
||||
## Other types of file
|
||||
|
||||
To adapt this plugin to the other format supported from miller (like json):
|
||||
- copy the plugin folder
|
||||
- change the name of the copied folder into miller_(fmt)
|
||||
- change the `--icsv` flag inside `init.lua` to `--i(fmt)`
|
||||
- add the correct mime/name rule into `prepend_previewers` and the exec as `miller_(fmt)`
|
||||
59
yazi/dot-config/yazi/plugins/miller.yazi/init.lua
Normal file
59
yazi/dot-config/yazi/plugins/miller.yazi/init.lua
Normal file
@@ -0,0 +1,59 @@
|
||||
local M = {}
|
||||
|
||||
function M:peek()
|
||||
local child = Command("mlr")
|
||||
:args({
|
||||
"--icsv",
|
||||
"--opprint",
|
||||
"-C",
|
||||
"--key-color",
|
||||
"darkcyan",
|
||||
"--value-color",
|
||||
"grey70",
|
||||
"cat",
|
||||
tostring(self.file.url),
|
||||
})
|
||||
:stdout(Command.PIPED)
|
||||
:stderr(Command.PIPED)
|
||||
:spawn()
|
||||
|
||||
local limit = self.area.h
|
||||
local i, lines = 0, ""
|
||||
repeat
|
||||
local next, event = child:read_line()
|
||||
if event == 1 then
|
||||
ya.err(tostring(event))
|
||||
elseif event ~= 0 then
|
||||
break
|
||||
end
|
||||
|
||||
i = i + 1
|
||||
if i > self.skip then
|
||||
lines = lines .. next
|
||||
end
|
||||
until i >= self.skip + limit
|
||||
|
||||
child:start_kill()
|
||||
if self.skip > 0 and i < self.skip + limit then
|
||||
ya.manager_emit(
|
||||
"peek",
|
||||
{ tostring(math.max(0, i - limit)), only_if = tostring(self.file.url), upper_bound = "" }
|
||||
)
|
||||
else
|
||||
lines = lines:gsub("\t", string.rep(" ", PREVIEW.tab_size))
|
||||
ya.preview_widgets(self, { ui.Paragraph.parse(self.area, lines) })
|
||||
end
|
||||
end
|
||||
|
||||
function M:seek(units)
|
||||
local h = cx.active.current.hovered
|
||||
if h and h.url == self.file.url then
|
||||
local step = math.floor(units * self.area.h / 10)
|
||||
ya.manager_emit("peek", {
|
||||
tostring(math.max(0, cx.active.preview.skip + step)),
|
||||
only_if = tostring(self.file.url),
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
BIN
yazi/dot-config/yazi/plugins/miller.yazi/preview.png
Normal file
BIN
yazi/dot-config/yazi/plugins/miller.yazi/preview.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
@@ -133,11 +133,27 @@ previewers = [
|
||||
{ mime = "video/*", run = "video" },
|
||||
# PDF
|
||||
{ mime = "application/pdf", run = "pdf" },
|
||||
# CSV
|
||||
{ mime = "text/csv", run = "miller" },
|
||||
# Archive
|
||||
{ mime = "application/*zip", run = "archive" },
|
||||
{ mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", run = "archive" },
|
||||
# Fallback
|
||||
{ name = "*", run = "file" },
|
||||
{ name = "*", run = "hexyl" },
|
||||
]
|
||||
|
||||
prepend_previewers = [
|
||||
# Exifaudio
|
||||
{ mime = "audio/*", run = "exifaudio" },
|
||||
# Archive previewer
|
||||
{ mime = "application/*zip", run = "ouch" },
|
||||
{ mime = "application/x-tar", run = "ouch" },
|
||||
{ mime = "application/x-bzip2", run = "ouch" },
|
||||
{ mime = "application/x-7z-compressed", run = "ouch" },
|
||||
{ mime = "application/x-rar", run = "ouch" },
|
||||
{ mime = "application/x-xz", run = "ouch" },
|
||||
# Markdown previewer
|
||||
{ name = ".md", run = "glow" },
|
||||
]
|
||||
|
||||
[input]
|
||||
|
||||
Reference in New Issue
Block a user