Add Yazi
This commit is contained in:
parent
e01d953656
commit
52f41ba6e7
6 changed files with 748 additions and 0 deletions
66
.config/yazi/init.lua
Normal file
66
.config/yazi/init.lua
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
---@diagnostic disable: undefined-global
|
||||
|
||||
-- Draw a full bar around window
|
||||
function Manager:render(area)
|
||||
self.area = area
|
||||
|
||||
local chunks = ui.Layout()
|
||||
:direction(ui.Layout.HORIZONTAL)
|
||||
:constraints({
|
||||
ui.Constraint.Ratio(MANAGER.ratio.parent, MANAGER.ratio.all),
|
||||
ui.Constraint.Ratio(MANAGER.ratio.current, MANAGER.ratio.all),
|
||||
ui.Constraint.Ratio(MANAGER.ratio.preview, MANAGER.ratio.all),
|
||||
})
|
||||
:split(area)
|
||||
|
||||
local bar = function(c, x, y)
|
||||
x, y = math.max(0, x), math.max(0, y)
|
||||
return ui.Bar(ui.Rect { x = x, y = y, w = ya.clamp(0, area.w - x, 1), h = math.min(1, area.h) }, ui.Bar.TOP)
|
||||
:symbol(c)
|
||||
end
|
||||
|
||||
return ya.flat {
|
||||
-- Borders
|
||||
ui.Border(area, ui.Border.ALL):type(ui.Border.ROUNDED),
|
||||
ui.Bar(chunks[1], ui.Bar.RIGHT),
|
||||
ui.Bar(chunks[3], ui.Bar.LEFT),
|
||||
|
||||
bar("┬", chunks[1].right - 1, chunks[1].y),
|
||||
bar("┴", chunks[1].right - 1, chunks[1].bottom - 1),
|
||||
bar("┬", chunks[2].right, chunks[2].y),
|
||||
bar("┴", chunks[2].right, chunks[1].bottom - 1),
|
||||
|
||||
-- Parent
|
||||
Parent:render(chunks[1]:padding(ui.Padding.xy(1))),
|
||||
-- Current
|
||||
Current:render(chunks[2]:padding(ui.Padding.y(1))),
|
||||
-- Preview
|
||||
Preview:render(chunks[3]:padding(ui.Padding.xy(1))),
|
||||
}
|
||||
end
|
||||
|
||||
-- Show user and hostname in top bar
|
||||
-- function Header:host()
|
||||
-- return ui.Span(ya.user_name() .. "@" .. ya.host_name() .. ":"):fg("blue")
|
||||
-- end
|
||||
--
|
||||
-- function Header:layout(area)
|
||||
-- self.area = area
|
||||
--
|
||||
-- return ui.Layout()
|
||||
-- :direction(ui.Layout.HORIZONTAL)
|
||||
-- :constraints({ ui.Constraint.Percentage(50), ui.Constraint.Percentage(50) })
|
||||
-- :split(area)
|
||||
-- end
|
||||
--
|
||||
-- function Header:render(area)
|
||||
-- local chunks = self:layout(area)
|
||||
--
|
||||
-- local left = ui.Line { self:host(), self:cwd() }
|
||||
-- local right = ui.Line { self:tabs() }
|
||||
-- return {
|
||||
-- ui.Paragraph(chunks[1], { left }),
|
||||
-- ui.Paragraph(chunks[2], { right }):align(ui.Paragraph.RIGHT),
|
||||
-- }
|
||||
-- end
|
||||
--
|
||||
15
.config/yazi/keymap.toml
Normal file
15
.config/yazi/keymap.toml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# 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]
|
||||
|
||||
prepend_keymap = [
|
||||
{ on = [ "l" ], exec = [ "plugin smart-enter --sync", "escape --visual --select" ], desc = "Enter the child directory, or open file." },
|
||||
{ on = [ "L" ], exec = "plugin smart-enter --sync --args='detatch'", desc = "Open in new window." },
|
||||
{ on = [ "n" ], exec = "create", desc = "Create a file or directory (ends with / for directories)" },
|
||||
{ on = [ "=" ], exec = """
|
||||
shell 'printf "Mode Bits: "; read ans; chmod $ans "$@"' --block --confirm
|
||||
""", desc = "chmod" },
|
||||
]
|
||||
|
||||
19
.config/yazi/plugins/smart-enter.yazi/init.lua
Normal file
19
.config/yazi/plugins/smart-enter.yazi/init.lua
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
---@diagnostic disable: undefined-global
|
||||
|
||||
return {
|
||||
entry = function(self, args)
|
||||
local h = cx.active.current.hovered
|
||||
if h and h.cha.is_dir then
|
||||
ya.manager_emit("enter", {})
|
||||
return
|
||||
end
|
||||
|
||||
if #args > 0 and args[1] == "detatch" then
|
||||
os.execute(string.format("opener detatch \"%s\"", h.url))
|
||||
else
|
||||
ya.manager_emit("open", {})
|
||||
-- os.execute(string.format("opener \"%s\"", h.url))
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
397
.config/yazi/theme.toml
Normal file
397
.config/yazi/theme.toml
Normal file
|
|
@ -0,0 +1,397 @@
|
|||
# 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/theme.json"
|
||||
|
||||
# vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
# : Manager {{{
|
||||
|
||||
[manager]
|
||||
cwd = { fg = "white", bold = true }
|
||||
|
||||
# Hovered
|
||||
hovered = { fg = "black", bg = "lightblue" }
|
||||
preview_hovered = { underline = true }
|
||||
|
||||
# Find
|
||||
find_keyword = { fg = "yellow", italic = true }
|
||||
find_position = { fg = "magenta", bg = "reset", italic = true }
|
||||
|
||||
# Marker
|
||||
marker_selected = { fg = "lightgreen", bg = "lightgreen" }
|
||||
marker_copied = { fg = "lightyellow", bg = "lightyellow" }
|
||||
marker_cut = { fg = "lightred", bg = "lightred" }
|
||||
|
||||
# Tab
|
||||
tab_active = { fg = "black", bg = "lightblue" }
|
||||
tab_inactive = { fg = "white", bg = "darkgray" }
|
||||
tab_width = 1
|
||||
|
||||
# Border
|
||||
border_symbol = "│"
|
||||
border_style = { fg = "gray" }
|
||||
|
||||
# Highlighting
|
||||
syntect_theme = ""
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Status {{{
|
||||
|
||||
[status]
|
||||
separator_open = ""
|
||||
separator_close = ""
|
||||
separator_style = { fg = "darkgray", bg = "darkgray" }
|
||||
|
||||
# Mode
|
||||
mode_normal = { fg = "black", bg = "lightblue", bold = true }
|
||||
mode_select = { fg = "black", bg = "lightgreen", bold = true }
|
||||
mode_unset = { fg = "black", bg = "lightmagenta", bold = true }
|
||||
|
||||
# Progress
|
||||
progress_label = { bold = true }
|
||||
progress_normal = { fg = "blue", bg = "black" }
|
||||
progress_error = { fg = "red", bg = "black" }
|
||||
|
||||
# Permissions
|
||||
permissions_t = { fg = "lightgreen" }
|
||||
permissions_r = { fg = "lightyellow" }
|
||||
permissions_w = { fg = "lightred" }
|
||||
permissions_x = { fg = "lightcyan" }
|
||||
permissions_s = { fg = "darkgray" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Select {{{
|
||||
|
||||
[select]
|
||||
border = { fg = "blue" }
|
||||
active = { fg = "magenta" }
|
||||
inactive = {}
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Input {{{
|
||||
|
||||
[input]
|
||||
border = { fg = "blue" }
|
||||
title = {}
|
||||
value = {}
|
||||
selected = { reversed = true }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Completion {{{
|
||||
|
||||
[completion]
|
||||
border = { fg = "blue" }
|
||||
active = { bg = "darkgray" }
|
||||
inactive = {}
|
||||
|
||||
# Icons
|
||||
icon_file = ""
|
||||
icon_folder = ""
|
||||
icon_command = ""
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Tasks {{{
|
||||
|
||||
[tasks]
|
||||
border = { fg = "blue" }
|
||||
title = {}
|
||||
hovered = { underline = true }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Which {{{
|
||||
|
||||
[which]
|
||||
cols = 3
|
||||
mask = { bg = "black" }
|
||||
cand = { fg = "lightcyan" }
|
||||
rest = { fg = "darkgray" }
|
||||
desc = { fg = "magenta" }
|
||||
separator = " "
|
||||
separator_style = { fg = "darkgray" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Help {{{
|
||||
|
||||
[help]
|
||||
on = { fg = "magenta" }
|
||||
exec = { fg = "cyan" }
|
||||
desc = { fg = "gray" }
|
||||
hovered = { bg = "darkgray", bold = true }
|
||||
footer = { fg = "black", bg = "white" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : File-specific styles {{{
|
||||
|
||||
[filetype]
|
||||
|
||||
rules = [
|
||||
# Images
|
||||
{ mime = "image/*", fg = "magenta" },
|
||||
|
||||
# Videos
|
||||
{ mime = "video/*", fg = "green" },
|
||||
{ mime = "audio/*", fg = "green" },
|
||||
|
||||
# Archives
|
||||
{ mime = "application/zip", fg = "red" },
|
||||
{ mime = "application/gzip", fg = "red" },
|
||||
{ mime = "application/x-tar", fg = "red" },
|
||||
{ mime = "application/x-bzip", fg = "red" },
|
||||
{ mime = "application/x-bzip2", fg = "red" },
|
||||
{ mime = "application/x-7z-compressed", fg = "red" },
|
||||
{ mime = "application/x-rar", fg = "red" },
|
||||
{ mime = "application/xz", fg = "red" },
|
||||
|
||||
# Documents
|
||||
# { mime = "application/doc", fg = "green" },
|
||||
{ mime = "application/pdf", fg = "magenta" },
|
||||
# { mime = "application/rtf", fg = "green" },
|
||||
# { mime = "application/vnd.*", fg = "green" },
|
||||
|
||||
# Fallback
|
||||
# { name = "*", fg = "white" },
|
||||
{ name = "*", fg = "yellow", bold = true, is = "exec" },
|
||||
{ name = "*/", fg = "blue", bold = true }
|
||||
]
|
||||
|
||||
[icon]
|
||||
|
||||
rules = [
|
||||
# Programming
|
||||
{ name = "*.cpp" , text = "", fg = "#519aba" },
|
||||
{ name = "*.css" , text = "", fg = "#42a5f5" },
|
||||
{ name = "*.c" , text = "", fg = "#599eff" },
|
||||
{ name = "*.fish" , text = "" },
|
||||
{ name = "*.go" , text = "", fg = "#519aba" },
|
||||
{ name = "*.hpp" , text = "", fg = "#a074c4" },
|
||||
{ name = "*.h" , text = "", fg = "#a074c4" },
|
||||
{ name = "*.htm" , text = "", fg = "#e44d26" },
|
||||
{ name = "*.html" , text = "", fg = "#e44d26" },
|
||||
{ name = "*.java" , text = "", fg = "#cc3e44" },
|
||||
{ name = "*.js" , text = "", fg = "#F1F134" },
|
||||
{ name = "*.jsx" , text = "", fg = "#20c2e3" },
|
||||
{ name = "*.lua" , text = "", fg = "#51a0cf" },
|
||||
{ name = "*.nix" , text = "", fg = "#7ab1db" },
|
||||
{ name = "*.php" , text = "" },
|
||||
{ name = "*.rb" , text = "" },
|
||||
{ name = "*.rs" , text = "", fg = "#dea584" },
|
||||
{ name = "*.scss" , text = "" },
|
||||
{ name = "*.sh" , text = "", fg = "#4d5a5e" },
|
||||
{ name = "*.swift", text = "" },
|
||||
{ name = "*.ts" , text = "", fg = "#519aba" },
|
||||
{ name = "*.tsx" , text = "" },
|
||||
{ name = "*.vim" , text = "" },
|
||||
{ name = "*.vue" , text = "" },
|
||||
{ name = "*.py" , text = "", fg = "#ffbc03" },
|
||||
{ name = "*.pyc" , text = "", fg = "#ffe291" },
|
||||
|
||||
# Text
|
||||
{ name = "*.txt" , text = "", fg = "#bbbbbb" },
|
||||
{ name = "*.csv" , text = "", fg = "#89e051" },
|
||||
{ name = "*.json" , text = "", fg = "#cbcb41" },
|
||||
{ name = "*.conf" , text = "", fg = "#6d8086" }, # Configuration
|
||||
{ name = "*.ini" , text = "", fg = "#6d8086" },
|
||||
{ name = "*.yaml" , text = "", fg = "#6d8086" },
|
||||
{ name = "*.yml" , text = "", fg = "#6d8086" },
|
||||
{ name = "*.toml" , text = "", fg = "#6d8086" },
|
||||
{ name = "*.org" , text = "", fg = "#77aa99" },
|
||||
{ name = "*.tex" , text = "", fg = "#3d6117" }, # Plaintext typesetting
|
||||
{ name = "*.typ" , text = "", fg = "#0e606a" },
|
||||
{ name = "*.markdown", text = "", fg = "#519aba" }, # Markdown
|
||||
{ name = "*.md" , text = "", fg = "#519aba" },
|
||||
{ name = "*.mdx" , text = "", fg = "#519aba" },
|
||||
{ name = "*.rmd" , text = "", fg = "#519aba" },
|
||||
|
||||
# Archives
|
||||
{ name = "*.7z" , text = "" },
|
||||
{ name = "*.ace" , text = "" },
|
||||
{ name = "*.alz" , text = "" },
|
||||
{ name = "*.arc" , text = "" },
|
||||
{ name = "*.arj" , text = "" },
|
||||
{ name = "*.bz2" , text = "" },
|
||||
{ name = "*.bz" , text = "" },
|
||||
{ name = "*.cab" , text = "" },
|
||||
{ name = "*.cpio", text = "" },
|
||||
{ name = "*.deb" , text = "" },
|
||||
{ name = "*.dwm" , text = "" },
|
||||
{ name = "*.dz" , text = "" },
|
||||
{ name = "*.ear" , text = "" },
|
||||
{ name = "*.esd" , text = "" },
|
||||
{ name = "*.gz" , text = "" },
|
||||
{ name = "*.jar" , text = "" },
|
||||
{ name = "*.lha" , text = "" },
|
||||
{ name = "*.lrz" , text = "" },
|
||||
{ name = "*.lz4" , text = "" },
|
||||
{ name = "*.lzh" , text = "" },
|
||||
{ name = "*.lzma", text = "" },
|
||||
{ name = "*.lzo" , text = "" },
|
||||
{ name = "*.lz" , text = "" },
|
||||
{ name = "*.rar" , text = "" },
|
||||
{ name = "*.rpm" , text = "" },
|
||||
{ name = "*.rz" , text = "" },
|
||||
{ name = "*.sar" , text = "" },
|
||||
{ name = "*.swm" , text = "" },
|
||||
{ name = "*.t7z" , text = "" },
|
||||
{ name = "*.tar" , text = "" },
|
||||
{ name = "*.taz" , text = "" },
|
||||
{ name = "*.tbz2", text = "" },
|
||||
{ name = "*.tbz" , text = "" },
|
||||
{ name = "*.tgz" , text = "" },
|
||||
{ name = "*.tlz" , text = "" },
|
||||
{ name = "*.txz" , text = "" },
|
||||
{ name = "*.tzo" , text = "" },
|
||||
{ name = "*.tzst", text = "" },
|
||||
{ name = "*.tz" , text = "" },
|
||||
{ name = "*.war" , text = "" },
|
||||
{ name = "*.wim" , text = "" },
|
||||
{ name = "*.xz" , text = "" },
|
||||
{ name = "*.zip" , text = "" },
|
||||
{ name = "*.zoo" , text = "" },
|
||||
{ name = "*.zst" , text = "" },
|
||||
{ name = "*.z" , text = "" },
|
||||
|
||||
# Images
|
||||
{ name = "*.bmp" , text = "" }, # Lossless
|
||||
{ name = "*.gif" , text = "" },
|
||||
{ name = "*.png" , text = "" },
|
||||
{ name = "*.tiff" , text = "" },
|
||||
{ name = "*.webp" , text = "" },
|
||||
{ name = "*.jpeg" , text = "" }, # Lossy
|
||||
{ name = "*.jpg" , text = "" },
|
||||
{ name = "*.mjpeg", text = "" },
|
||||
{ name = "*.mjpg" , text = "" },
|
||||
{ name = "*.mng" , text = "" },
|
||||
{ name = "*.pbm" , text = "" },
|
||||
{ name = "*.pcx" , text = "" },
|
||||
{ name = "*.pgm" , text = "" },
|
||||
{ name = "*.ppm" , text = "" },
|
||||
{ name = "*.svg" , text = "" },
|
||||
{ name = "*.svgz" , text = "" },
|
||||
{ name = "*.tga" , text = "" },
|
||||
{ name = "*.tif" , text = "" },
|
||||
{ name = "*.xbm" , text = "" },
|
||||
{ name = "*.xpm" , text = "" },
|
||||
|
||||
# Movies
|
||||
{ name = "*.asf" , text = "" },
|
||||
{ name = "*.avi" , text = "" },
|
||||
{ name = "*.cgm" , text = "" },
|
||||
{ name = "*.dl" , text = "" },
|
||||
{ name = "*.emf" , text = "" },
|
||||
{ name = "*.flc" , text = "" },
|
||||
{ name = "*.fli" , text = "" },
|
||||
{ name = "*.flv" , text = "" },
|
||||
{ name = "*.gl" , text = "" },
|
||||
{ name = "*.m2v" , text = "" },
|
||||
{ name = "*.m4v" , text = "" },
|
||||
{ name = "*.mkv" , text = "" },
|
||||
{ name = "*.mov" , text = "" },
|
||||
{ name = "*.mp4" , text = "" },
|
||||
{ name = "*.mp4v", text = "" },
|
||||
{ name = "*.mpeg", text = "" },
|
||||
{ name = "*.mpg" , text = "" },
|
||||
{ name = "*.nuv" , text = "" },
|
||||
{ name = "*.ogm" , text = "" },
|
||||
{ name = "*.ogv" , text = "" },
|
||||
{ name = "*.ogx" , text = "" },
|
||||
{ name = "*.qt" , text = "" },
|
||||
{ name = "*.rm" , text = "" },
|
||||
{ name = "*.rmvb", text = "" },
|
||||
{ name = "*.vob" , text = "" },
|
||||
{ name = "*.webm", text = "" },
|
||||
{ name = "*.wmv" , text = "" },
|
||||
{ name = "*.xcf" , text = "" },
|
||||
{ name = "*.xwd" , text = "" },
|
||||
{ name = "*.yuv" , text = "" },
|
||||
|
||||
# Audio
|
||||
{ name = "*.aac" , text = "" },
|
||||
{ name = "*.au" , text = "" },
|
||||
{ name = "*.flac", text = "" },
|
||||
{ name = "*.m4a" , text = "" },
|
||||
{ name = "*.mid" , text = "" },
|
||||
{ name = "*.midi", text = "" },
|
||||
{ name = "*.mka" , text = "" },
|
||||
{ name = "*.mp3" , text = "" },
|
||||
{ name = "*.mpc" , text = "" },
|
||||
{ name = "*.oga" , text = "" },
|
||||
{ name = "*.ogg" , text = "" },
|
||||
{ name = "*.opus", text = "" },
|
||||
{ name = "*.ra" , text = "" },
|
||||
{ name = "*.spx" , text = "" },
|
||||
{ name = "*.wav" , text = "" },
|
||||
{ name = "*.xspf", text = "" },
|
||||
|
||||
# Documents
|
||||
{ name = "*.pdf" , text = "", fg = "#b30b00" }, # Printable
|
||||
{ name = "*.doc" , text = "", fg = "#185abd" }, # Non plaintext docs
|
||||
{ name = "*.doct", text = "", fg = "#185abd" },
|
||||
{ name = "*.docx", text = "", fg = "#185abd" },
|
||||
{ name = "*.dot" , text = "", fg = "#185abd" },
|
||||
{ name = "*.pom" , text = "", fg = "#cb4a32" }, # Presentations
|
||||
{ name = "*.pot" , text = "", fg = "#cb4a32" },
|
||||
{ name = "*.potx", text = "", fg = "#cb4a32" },
|
||||
{ name = "*.ppm" , text = "", fg = "#cb4a32" },
|
||||
{ name = "*.ppmx", text = "", fg = "#cb4a32" },
|
||||
{ name = "*.pps" , text = "", fg = "#cb4a32" },
|
||||
{ name = "*.ppsx", text = "", fg = "#cb4a32" },
|
||||
{ name = "*.ppt" , text = "", fg = "#cb4a32" },
|
||||
{ name = "*.pptx", text = "", fg = "#cb4a32" },
|
||||
{ name = "*.xlc" , text = "" },
|
||||
{ name = "*.xlm" , text = "" },
|
||||
{ name = "*.xls" , text = "" },
|
||||
{ name = "*.xlsm", text = "" },
|
||||
{ name = "*.xlsx", text = "" },
|
||||
{ name = "*.xlt" , text = "" },
|
||||
{ name = "*.ods" , text = "" },
|
||||
{ name = "*.ots" , text = "" },
|
||||
{ name = "*.odg" , text = "" },
|
||||
|
||||
# Lockfiles
|
||||
{ name = "*.lock", text = "", fg = "#bbbbbb" },
|
||||
|
||||
# Misc
|
||||
{ name = "*.bin", text = "" },
|
||||
{ name = "*.exe", text = "" },
|
||||
{ name = "*.pkg", text = "" },
|
||||
|
||||
# Dotfiles
|
||||
{ name = ".DS_Store" , text = "" },
|
||||
{ name = ".bashprofile" , text = "" },
|
||||
{ name = ".bashrc" , text = "" },
|
||||
{ name = ".gitattributes", text = "" },
|
||||
{ name = ".gitignore" , text = "" },
|
||||
{ name = ".gitmodules" , text = "" },
|
||||
{ name = ".vimrc" , text = "" },
|
||||
{ name = ".zprofile" , text = "" },
|
||||
{ name = ".zshenv" , text = "" },
|
||||
{ name = ".zshrc" , text = "" },
|
||||
|
||||
# Named files
|
||||
{ name = "COPYING" , text = "" },
|
||||
{ name = "Containerfile", text = "", fg = "#458ee6" },
|
||||
{ name = "Dockerfile" , text = "", fg = "#458ee6" },
|
||||
{ name = "LICENSE" , text = "", fg = "#d0bf41" },
|
||||
|
||||
# Default
|
||||
{ name = "*" , text = "" },
|
||||
{ name = "*/", text = "", fg = "yellow" },
|
||||
]
|
||||
|
||||
# : }}}
|
||||
149
.config/yazi/yazi.toml
Normal file
149
.config/yazi/yazi.toml
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
# 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/yazi.json"
|
||||
|
||||
[manager]
|
||||
ratio = [ 1, 2, 3 ]
|
||||
sort_by = "natural"
|
||||
sort_sensitive = false
|
||||
sort_reverse = false
|
||||
sort_dir_first = true
|
||||
linemode = "size"
|
||||
show_hidden = false
|
||||
show_symlink = true
|
||||
|
||||
[preview]
|
||||
tab_size = 2
|
||||
max_width = 1000
|
||||
max_height = 1500
|
||||
cache_dir = ""
|
||||
image_filter = "triangle"
|
||||
image_quality = 75
|
||||
sixel_fraction = 15
|
||||
ueberzug_scale = 1
|
||||
ueberzug_offset = [ 0, 0, 0, 0 ]
|
||||
|
||||
[opener]
|
||||
open = [
|
||||
{ exec = 'opener "$@"', block = true, desc = "Open" },
|
||||
]
|
||||
|
||||
[open]
|
||||
rules = [
|
||||
{ name = "*/", use = [ "edit", "open", "reveal" ] },
|
||||
|
||||
{ mime = "*", use = [ "open" ] },
|
||||
]
|
||||
|
||||
[tasks]
|
||||
micro_workers = 10
|
||||
macro_workers = 25
|
||||
bizarre_retry = 5
|
||||
image_alloc = 536870912 # 512MB
|
||||
image_bound = [ 0, 0 ]
|
||||
suppress_preload = false
|
||||
|
||||
[plugin]
|
||||
|
||||
preloaders = [
|
||||
{ name = "*", cond = "!mime", exec = "mime", multi = true, prio = "high" },
|
||||
# Image
|
||||
{ mime = "image/vnd.djvu", exec = "noop" },
|
||||
{ mime = "image/*", exec = "image" },
|
||||
# Video
|
||||
{ mime = "video/*", exec = "video" },
|
||||
# PDF
|
||||
{ mime = "application/pdf", exec = "pdf" },
|
||||
]
|
||||
previewers = [
|
||||
{ name = "*/", exec = "folder", sync = true },
|
||||
# Code
|
||||
{ mime = "text/*", exec = "code" },
|
||||
{ mime = "*/xml", exec = "code" },
|
||||
{ mime = "*/javascript", exec = "code" },
|
||||
{ mime = "*/x-wine-extension-ini", exec = "code" },
|
||||
# JSON
|
||||
{ mime = "application/json", exec = "json" },
|
||||
# Image
|
||||
{ mime = "image/vnd.djvu", exec = "noop" },
|
||||
{ mime = "image/*", exec = "image" },
|
||||
# Video
|
||||
{ mime = "video/*", exec = "video" },
|
||||
# PDF
|
||||
{ mime = "application/pdf", exec = "pdf" },
|
||||
# Archive
|
||||
{ mime = "application/zip", exec = "archive" },
|
||||
{ mime = "application/gzip", exec = "archive" },
|
||||
{ mime = "application/x-tar", exec = "archive" },
|
||||
{ mime = "application/x-bzip", exec = "archive" },
|
||||
{ mime = "application/x-bzip2", exec = "archive" },
|
||||
{ mime = "application/x-7z-compressed", exec = "archive" },
|
||||
{ mime = "application/x-rar", exec = "archive" },
|
||||
{ mime = "application/xz", exec = "archive" },
|
||||
# Fallback
|
||||
{ name = "*", exec = "file" },
|
||||
]
|
||||
|
||||
[input]
|
||||
# cd
|
||||
cd_title = "Change directory:"
|
||||
cd_origin = "top-center"
|
||||
cd_offset = [ 0, 2, 50, 3 ]
|
||||
|
||||
# create
|
||||
create_title = "Create:"
|
||||
create_origin = "top-center"
|
||||
create_offset = [ 0, 2, 50, 3 ]
|
||||
|
||||
# rename
|
||||
rename_title = "Rename:"
|
||||
rename_origin = "hovered"
|
||||
rename_offset = [ 0, 1, 50, 3 ]
|
||||
|
||||
# trash
|
||||
trash_title = "Move {n} selected file{s} to trash? (y/N)"
|
||||
trash_origin = "top-center"
|
||||
trash_offset = [ 0, 2, 50, 3 ]
|
||||
|
||||
# delete
|
||||
delete_title = "Delete {n} selected file{s} permanently? (y/N)"
|
||||
delete_origin = "top-center"
|
||||
delete_offset = [ 0, 2, 50, 3 ]
|
||||
|
||||
# filter
|
||||
filter_title = "Filter:"
|
||||
filter_origin = "top-center"
|
||||
filter_offset = [ 0, 2, 50, 3 ]
|
||||
|
||||
# find
|
||||
find_title = [ "Find next:", "Find previous:" ]
|
||||
find_origin = "top-center"
|
||||
find_offset = [ 0, 2, 50, 3 ]
|
||||
|
||||
# search
|
||||
search_title = "Search via {n}:"
|
||||
search_origin = "top-center"
|
||||
search_offset = [ 0, 2, 50, 3 ]
|
||||
|
||||
# shell
|
||||
shell_title = [ "Shell:", "Shell (block):" ]
|
||||
shell_origin = "top-center"
|
||||
shell_offset = [ 0, 2, 50, 3 ]
|
||||
|
||||
# overwrite
|
||||
overwrite_title = "Overwrite an existing file? (y/N)"
|
||||
overwrite_origin = "top-center"
|
||||
overwrite_offset = [ 0, 2, 50, 3 ]
|
||||
|
||||
# quit
|
||||
quit_title = "{n} task{s} running, sure to quit? (y/N)"
|
||||
quit_origin = "top-center"
|
||||
quit_offset = [ 0, 2, 50, 3 ]
|
||||
|
||||
[select]
|
||||
open_title = "Open with:"
|
||||
open_origin = "hovered"
|
||||
open_offset = [ 0, 1, 50, 7 ]
|
||||
|
||||
[log]
|
||||
enabled = false
|
||||
102
.local/bin/opener
Executable file
102
.local/bin/opener
Executable file
|
|
@ -0,0 +1,102 @@
|
|||
#!/usr/bin/env sh
|
||||
# Script for opening a file, intended for use by a terminal file manager.
|
||||
|
||||
# Whether to open in a new window
|
||||
detatch=0
|
||||
[ "$1" = "detatch" ] && detatch=1 && shift 1
|
||||
|
||||
# First arg must be a file
|
||||
[ ! -f "$1" ] && echo "Not a file: '$1'" && exit 1
|
||||
|
||||
function launch_gui() {
|
||||
if [ "$detatch" -eq 0 ]; then
|
||||
[ -n "$WAYLAND_DISPLAY" ] \
|
||||
&& precmd="swallow" `# For Hyprland` \
|
||||
|| precmd="devour" # For X
|
||||
else
|
||||
precmd="setsid -f"
|
||||
fi
|
||||
|
||||
$precmd "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
function launch_term() {
|
||||
if [ "$detatch" -eq 1 ]; then
|
||||
# This is a bit of a hack. Shell only expects a single argument into
|
||||
# the -c flag, so it needs to be wrapped in quotes. However, if "$@"
|
||||
# wher passed in with `mpv "my file.mp3"`, it would not preserve the
|
||||
# $2 having a space and would instead split it up into 3 arguments
|
||||
# into the new shell. Wrapping everything argument in quotes is the
|
||||
# only general solution I could come up with.
|
||||
command_string=""
|
||||
while [ $# -gt 0 ]; do
|
||||
command_string="$command_string \"$1\""
|
||||
shift
|
||||
done
|
||||
setsid -f $TERMINAL -e $SHELL -c "$command_string; exec $SHELL" >/dev/null 2>&1
|
||||
else
|
||||
clear
|
||||
"$@"
|
||||
fi
|
||||
}
|
||||
|
||||
case $(file --mime-type "$1" -b) in
|
||||
application/javascript|\
|
||||
application/json|\
|
||||
application/pgp-encrypted|\
|
||||
application/x-subrip|\
|
||||
inode/x-empty|\
|
||||
text/*)
|
||||
case "${1##*.}" in
|
||||
org|typ)
|
||||
# Any "document" like file ought to be in emacs
|
||||
launch_gui emacsclient -c "$1"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
|
||||
launch_term nvim "$1"
|
||||
;;
|
||||
image/*)
|
||||
launch_gui nsxiv "$1"
|
||||
;;
|
||||
video/*)
|
||||
launch_gui mpv -quiet "$1"
|
||||
;;
|
||||
application/epub*|\
|
||||
application/octet-stream|\
|
||||
application/pdf|\
|
||||
application/postscript|\
|
||||
application/vnd.djvu|\
|
||||
image/vnd.djvu)
|
||||
launch_gui zathura "$1"
|
||||
;;
|
||||
audio/*|\
|
||||
video/x-ms-asf)
|
||||
[ -z "$(mediainfo "$1" | grep "Cover\s*: Yes")" ] \
|
||||
&& (launch_term mpv --audio-display=no "$1") \
|
||||
|| (launch_gui mpv "$1")
|
||||
;;
|
||||
application/msword|\
|
||||
application/octet-stream|\
|
||||
application/vnd.ms-powerpoint|\
|
||||
application/vnd.oasis.opendocument.database|\
|
||||
application/vnd.oasis.opendocument.formula|\
|
||||
application/vnd.oasis.opendocument.graphics|\
|
||||
application/vnd.oasis.opendocument.graphics-template|\
|
||||
application/vnd.oasis.opendocument.presentation|\
|
||||
application/vnd.oasis.opendocument.presentation-template|\
|
||||
application/vnd.oasis.opendocument.spreadsheet|\
|
||||
application/vnd.oasis.opendocument.spreadsheet-template|\
|
||||
application/vnd.oasis.opendocument.text|\
|
||||
application/vnd.openxmlformats-officedocument.presentationml.presentation|\
|
||||
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|\
|
||||
application/vnd.openxmlformats-officedocument.wordprocessingml.document)
|
||||
launch_gui libreoffice "$1"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue