diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-09-13 18:18:26 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-09-13 18:18:26 +0900 |
| commit | 95528f5119f0e973bb0ffb41ed4e17564b39676e (patch) | |
| tree | 2aab63e1793e15adc8f986789318dfece947383f | |
| parent | fa7b259c8011f410632dae255c04015fb5c5a0fa (diff) | |
updates
| -rw-r--r-- | mac/.config/aerospace/aerospace.toml | 2 | ||||
| -rw-r--r-- | mac/.config/shell/bm-files | 3 | ||||
| -rw-r--r-- | mac/.config/yazi/init.lua | 41 | ||||
| -rw-r--r-- | mac/.config/yazi/keymap-default.toml | 20 | ||||
| -rw-r--r-- | mac/.config/yazi/plugins/confirm-quit.yazi/main.lua | 20 | ||||
| -rw-r--r-- | mac/.config/yazi/plugins/folder-rules.yazi/main.lua | 12 | ||||
| -rw-r--r-- | mac/.config/yazi/plugins/parent-arrow.yazi/main.lua | 24 | ||||
| -rw-r--r-- | mac/.config/yazi/yazi.toml | 11 | ||||
| -rw-r--r-- | mac/.config/zsh/keymaps.zsh | 4 | ||||
| -rw-r--r-- | mac/.config/zsh/scripts.zsh | 16 |
10 files changed, 150 insertions, 3 deletions
diff --git a/mac/.config/aerospace/aerospace.toml b/mac/.config/aerospace/aerospace.toml index 5412537..9443612 100644 --- a/mac/.config/aerospace/aerospace.toml +++ b/mac/.config/aerospace/aerospace.toml @@ -101,7 +101,7 @@ on-focus-changed = ['move-mouse window-lazy-center'] # See: https://nikitabobko.github.io/AeroSpace/guide#binding-modes # 'main' binding mode must be always presented [mode.main.binding] - # All possible keys: + # All possible keys # - Letters. a, b, c, ..., z # - Numbers. 0, 1, 2, ..., 9 # - Keypad numbers. keypad0, keypad1, keypad2, ..., keypad9 diff --git a/mac/.config/shell/bm-files b/mac/.config/shell/bm-files index 2c79c8f..3d0646a 100644 --- a/mac/.config/shell/bm-files +++ b/mac/.config/shell/bm-files @@ -50,6 +50,9 @@ vvw ${XDG_DATA_HOME:-${HOME}/.local/share}/vimwiki/index.md vxc ${XDG_CONFIG_HOME:-${HOME}/.config}/x11/xinitrc # X11 config vxp ${XDG_CONFIG_HOME:-${HOME}/.config}/x11/xprofile # Start up - X11 profile vxr ${XDG_CONFIG_HOME:-${HOME}/.config}/x11/xresources # Colors, themes and variables for X11 +vyc ${XDG_CONFIG_HOME:-${HOME}/.config}/yazi/yazi.toml # Yazi config +vyi ${XDG_CONFIG_HOME:-${HOME}/.config}/yazi/init.lua # Yazi init for plugins +vyk ${XDG_CONFIG_HOME:-${HOME}/.config}/yazi/keymap-default.toml # Yazi key config vza ${XDG_CONFIG_HOME:-${HOME}/.config}/shell/aliasrc # Aliases used by zsh (and potentially other shells) vzc ${ZDOTDIR:-${XDG_CONFIG_HOME:-${HOME}/.config}/zsh}/.zshrc # Zsh config vzk ${ZDOTDIR:-${XDG_CONFIG_HOME:-${HOME}/.config}/zsh}/keymaps.zsh # Zsh keymaps diff --git a/mac/.config/yazi/init.lua b/mac/.config/yazi/init.lua index 9d6b9ed..13d69a6 100644 --- a/mac/.config/yazi/init.lua +++ b/mac/.config/yazi/init.lua @@ -1,3 +1,33 @@ +Status:children_add(function(self) + local h = self._current.hovered + if h and h.link_to then + return " -> " .. tostring(h.link_to) + else + return "" + end +end, 3300, Status.LEFT) + +Status:children_add(function() + local h = cx.active.current.hovered + if not h or ya.target_family() ~= "unix" then + return "" + end + + return ui.Line({ + ui.Span(ya.user_name(h.cha.uid) or tostring(h.cha.uid)):fg("magenta"), + ":", + ui.Span(ya.group_name(h.cha.gid) or tostring(h.cha.gid)):fg("magenta"), + " ", + }) +end, 500, Status.RIGHT) + +Header:children_add(function() + if ya.target_family() ~= "unix" then + return "" + end + return ui.Span(ya.user_name() .. "@" .. ya.host_name() .. ":"):fg("blue") +end, 500, Header.LEFT) + if os.getenv("NVIM") then require("toggle-pane"):entry("min-preview") end @@ -13,6 +43,15 @@ require("full-border"):setup({ th.git = th.git or {} th.git.modified_sign = "M" th.git.deleted_sign = "D" +th.git.added_sign = "A" +th.git.renamed_sign = "R" +th.git.copied_sign = "C" +th.git.untracked_sign = "?" +th.git.ignored_sign = "!" +th.git.conflicted_sign = "U" +th.git.typechange_sign = "T" +th.git.staged_sign = "+" + require("git"):setup() require("mactag"):setup({ @@ -33,3 +72,5 @@ require("mactag"):setup({ Purple = "#cb88f8", }, }) + +require("folder-rules"):setup() diff --git a/mac/.config/yazi/keymap-default.toml b/mac/.config/yazi/keymap-default.toml index b0ecb37..d0ca6f2 100644 --- a/mac/.config/yazi/keymap-default.toml +++ b/mac/.config/yazi/keymap-default.toml @@ -226,6 +226,26 @@ on = "-" run = "plugin zoom -1" desc = "Zoom out hovered file" +[[mgr.prepend_keymap]] +on = "K" +run = "plugin parent-arrow -1" + +[[mgr.prepend_keymap]] +on = "J" +run = "plugin parent-arrow 1" + +[[mgr.prepend_keymap]] +on = "q" +run = "plugin confirm-quit" + +[[mgr.prepend_keymap]] +on = "<C-p>" +run = 'shell -- qlmanage -p "$@"' + +[[mgr.prepend_keymap]] +on = "<C-m>" +run = 'shell --block -- neomutt -a "$@"' + [tasks] keymap = [ diff --git a/mac/.config/yazi/plugins/confirm-quit.yazi/main.lua b/mac/.config/yazi/plugins/confirm-quit.yazi/main.lua new file mode 100644 index 0000000..f171bc0 --- /dev/null +++ b/mac/.config/yazi/plugins/confirm-quit.yazi/main.lua @@ -0,0 +1,20 @@ +local count = ya.sync(function() + return #cx.tabs +end) + +local function entry() + if count() < 2 then + return ya.emit("quit", {}) + end + + local yes = ya.confirm({ + pos = { "center", w = 60, h = 10 }, + title = "Quit?", + content = ui.Text("There are multiple tabs open. Are you sure you want to quit?"):wrap(ui.Wrap.YES), + }) + if yes then + ya.emit("quit", {}) + end +end + +return { entry = entry } diff --git a/mac/.config/yazi/plugins/folder-rules.yazi/main.lua b/mac/.config/yazi/plugins/folder-rules.yazi/main.lua new file mode 100644 index 0000000..556f610 --- /dev/null +++ b/mac/.config/yazi/plugins/folder-rules.yazi/main.lua @@ -0,0 +1,12 @@ +local function setup() + ps.sub("cd", function() + local cwd = cx.active.current.cwd + if cwd:ends_with("Downloads") then + ya.emit("sort", { "mtime", reverse = true, dir_first = false }) + else + ya.emit("sort", { "alphabetical", reverse = false, dir_first = true }) + end + end) +end + +return { setup = setup } diff --git a/mac/.config/yazi/plugins/parent-arrow.yazi/main.lua b/mac/.config/yazi/plugins/parent-arrow.yazi/main.lua new file mode 100644 index 0000000..a4fd880 --- /dev/null +++ b/mac/.config/yazi/plugins/parent-arrow.yazi/main.lua @@ -0,0 +1,24 @@ +--- @sync entry +local function entry(_, job) + local parent = cx.active.parent + if not parent then + return + end + + local offset = tonumber(job.args[1]) + if not offset then + return ya.err(job.args[1], "is not a number") + end + + local start = parent.cursor + 1 + offset + local end_ = offset < 0 and 1 or #parent.files + local step = offset < 0 and -1 or 1 + for i = start, end_, step do + local target = parent.files[i] + if target and target.cha.is_dir then + return ya.emit("cd", { target.url }) + end + end +end + +return { entry = entry } diff --git a/mac/.config/yazi/yazi.toml b/mac/.config/yazi/yazi.toml index 5cb5fc9..d1067fd 100644 --- a/mac/.config/yazi/yazi.toml +++ b/mac/.config/yazi/yazi.toml @@ -57,6 +57,13 @@ play = [ { run = '''mediainfo "$1"; echo "Press enter to exit"; read _''', block = true, desc = "Show media info", for = "unix" }, ] +[[opener.set-wallpaper]] +run = ''' + osascript -e 'on run {img}' -e 'tell application "System Events" to set picture of every desktop to img' -e 'end run' "$0" +''' +for = "macos" +desc = "Set as wallpaper" + [open] rules = [ # Folder @@ -78,6 +85,10 @@ rules = [ { name = "*", use = [ "open", "reveal" ] }, ] +[[open.prepend_rules]] +mime = "image/*" +use = [ "set-wallpaper", "open" ] + [tasks] micro_workers = 10 macro_workers = 10 diff --git a/mac/.config/zsh/keymaps.zsh b/mac/.config/zsh/keymaps.zsh index b911502..698104e 100644 --- a/mac/.config/zsh/keymaps.zsh +++ b/mac/.config/zsh/keymaps.zsh @@ -163,13 +163,13 @@ if [[ -f "${ZPLUGINDIR:-${HOME}/.local/bin/zsh}/zsh-vi-mode/zsh-vi-mode.plugin.z bindkey -s '^B' '^ubc -lq\n' bindkey -s '^D' '^ucdi\n' bindkey -s '^F' '^ufzffiles\n' - bindkey -s '^G' '^ulf\n' + bindkey -s '^G' '^uyazi\n' bindkey -s '^N' '^ulastnvim\n' bindkey -s '^O' '^utmo\n' bindkey -s '^P' '^ufzfpass\n' bindkey -s '^Q' '^uhtop\n' bindkey -s '^T' '^usessionizer\n' - bindkey -s '^Y' '^ulfcd\n' + bindkey -s '^Y' '^uyazicd\n' bindkey -s '^Z' '^upd\n' # bindkey -s '^_' '^u\n' diff --git a/mac/.config/zsh/scripts.zsh b/mac/.config/zsh/scripts.zsh index 7ebe2ed..a90bca5 100644 --- a/mac/.config/zsh/scripts.zsh +++ b/mac/.config/zsh/scripts.zsh @@ -474,6 +474,7 @@ function lfcd () { fi } + ########################################################################################### ########################################################################################### ### --- MAN --- ### @@ -863,3 +864,18 @@ function delete_venv() { echo "$venv deleted" fi } + + +########################################################################################### +########################################################################################### +### --- YAZI --- ### +# open yazi and cd to the file path +function yazicd () { + tmp="$(mktemp -uq)" + trap 'rm -f $tmp >/dev/null 2>&1 && trap - HUP INT QUIT TERM EXIT' HUP INT QUIT TERM EXIT + yazi --cwd-file="$tmp" "$@" + if [ -f "$tmp" ]; then + dir="$(cat "$tmp")" + [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" + fi +} |
