Files
dotfiles/yazi/.config/yazi/init.lua
T

175 lines
5.8 KiB
Lua

--- eza-preview ---
require("eza-preview"):setup({})
--- omp ---
require("omp"):setup({ config = "/home/liph/.config/yazi/omp/omp.toml" })
--- yatlint ---
require("yaziline"):setup({
color = "#98c379",
secondary_color = "#5a6078",
default_files_color = "darkgray", -- color of the file counter when it's inactive
selected_files_color = "white",
yanked_files_color = "green",
cut_files_color = "red",
separator_style = "angly", -- "angly" | "curvy" | "liney" | "empty"
separator_open = "",
separator_close = "",
separator_open_thin = "",
separator_close_thin = "",
separator_head = "",
separator_tail = "",
select_symbol = "",
yank_symbol = "󰆐",
filename_max_length = 24, -- truncate when filename > 24
filename_truncate_length = 6, -- leave 6 chars on both sides
filename_truncate_separator = "...",
})
--- git ---
require("git"):setup({
-- Order of status signs showing in the linemode
order = 1500,
})
--- tab restore ---
require("close-and-restore-tab"):setup()
--- yafg ---
require("yafg"):setup({
toggle_mode_key = "alt-t", -- fzf key to switch ripgrep/fzf mode (default: "ctrl-t")
editor = "nvim", -- Editor command (default: "hx")
args = { "--noplugin" }, -- Additional editor arguments (default: {})
file_arg_format = "+{row} {file}", -- File argument format (default: "{file}:{row}:{col}")
})
--- whoosh ---
--
-- local bookmarks = {
-- { tag = "Desktop", path = "~/Desktop", key = "d" },
-- { tag = "Documents", path = "~/Documents", key = "D" },
-- { tag = "Downloads", path = "~/Downloads", key = "o" },
-- }
-- -- You can also configure bookmarks with key arrays
-- local bookmarks = {
-- { tag = "Desktop", path = "~/Desktop", key = { "d", "D" } },
-- { tag = "Documents", path = "~/Documents", key = { "d", "d" } },
-- { tag = "Downloads", path = "~/Downloads", key = "o" },
-- }
require("whoosh"):setup({
-- Configuration bookmarks (cannot be deleted through plugin)
bookmarks = bookmarks,
-- Notification settings
jump_notify = false,
-- Key generation for auto-assigning bookmark keys
keys = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
-- Configure the built-in menu action hotkeys
-- false - hide menu item
special_keys = {
create_temp = "<Enter>", -- Create a temporary bookmark from the menu
fuzzy_search = "<Space>", -- Launch fuzzy search (fzf)
history = "<Tab>", -- Open directory history
previous_dir = "<Backspace>", -- Jump back to the previous directory
project_root = "-", -- Jump to the current Git repository root
},
-- File path for storing user bookmarks
bookmarks_path = (
ya.target_family() == "windows" and os.getenv("APPDATA") .. "\\yazi\\config\\plugins\\whoosh.yazi\\bookmarks"
) or (os.getenv("HOME") .. "/.config/yazi/plugins/whoosh.yazi/bookmarks"),
-- Replace home directory with "~"
home_alias_enabled = true, -- Toggle home aliasing in displays
-- Path truncation in navigation menu
path_truncate_enabled = false, -- Enable/disable path truncation
path_max_depth = 3, -- Maximum path depth before truncation
-- Path truncation in fuzzy search (fzf)
fzf_path_truncate_enabled = false, -- Enable/disable path truncation in fzf
fzf_path_max_depth = 5, -- Maximum path depth before truncation in fzf
-- Long folder name truncation
path_truncate_long_names_enabled = false, -- Enable in navigation menu
fzf_path_truncate_long_names_enabled = false, -- Enable in fzf
path_max_folder_name_length = 20, -- Max length in navigation menu
fzf_path_max_folder_name_length = 20, -- Max length in fzf
-- History directory settings
history_size = 10, -- Number of directories in history (default 10)
history_fzf_path_truncate_enabled = false, -- Enable/disable path truncation by depth for history
history_fzf_path_max_depth = 5, -- Maximum path depth before truncation for history (default 5)
history_fzf_path_truncate_long_names_enabled = false, -- Enable/disable long folder name truncation for history
history_fzf_path_max_folder_name_length = 30, -- Maximum length for folder names in history (default 30)
})
--- mime-ext ---
require("mime-ext.local"):setup({
-- Expand the default filename database (lowercase), for example:
with_files = {
makefile = "text/makefile",
-- ...
},
-- Expand the default extension database (lowercase), for example:
with_exts = {
mk = "text/makefile",
-- ...
},
-- Empty the default filename and extension databases,
-- use only the custom ones configured with `with_files` and `with_exts`
custom_only = false,
-- If the MIME type is not in both filename and extension databases,
-- then fallback to Yazi's preset `mime.local` plugin, which uses `file(1)`
fallback_file1 = false,
})
-- fchar --
-- default config
require("fchar"):setup({
-- if true: f -> file, File, FILE
insensitive = true,
-- if true: f -> file, .file, @file, #file, ...file
skip_symbols = true,
-- if {"yazi-"}: f -> file, yazi-file
skip_prefix = {},
aliases = {},
keys = {},
})
-- setup keymaps
require("fchar"):setup({
keys = {
start = "f", -- ff -> file
ext = "e", -- ef -> name.fs
word = "F", -- Ff -> file, also-file
all = "<C-f>", -- ^ff -> file, also-file, twofile, elf
},
})
-- aliases for German
require("fchar"):setup({
aliases = {
a = "ä",
o = "ö",
u = "ü",
s = "ß",
},
})
--[[ you may want to turn off the search regex from showing up
in the header by putting this in `~/.config/yazi/init.lua` ]]
function Header:flags()
local cwd = self._current.cwd
local filter = self._current.files.filter
local t = {}
if cwd.spec.is_search then
t[#t + 1] = string.format("search: %s", cwd.domain)
end
if filter then
t[#t + 1] = string.format("filter: %s", filter)
end
return #t == 0 and "" or " (" .. table.concat(t, ", ") .. ")"
end