From 80f1083683f4e45a4a3c60400f9185ff0b800c4b Mon Sep 17 00:00:00 2001 From: Aleksander Cynarski Date: Sun, 13 Apr 2025 12:25:36 +0200 Subject: [PATCH] feat: yazi plugins [glow, projects, custom_scripts-set_wallpaper] --- .config/custom_scripts/osx/set_wallpaper.sh | 5 ++ .config/wezterm/modules/hyperlinks.lua | 41 +++++++++++++++ .config/wezterm/modules/mappings.lua | 2 +- .config/wezterm/wezterm.lua | 3 +- .config/yazi/init.lua | 23 ++++++++ .config/yazi/keymap.toml | 40 ++++++++++++++ .config/yazi/package.toml | 10 ++++ .config/yazi/yazi.toml | 7 ++- .gitconfig | 4 ++ .zshrc | 58 +++++++++++++-------- README.md | 5 +- 11 files changed, 172 insertions(+), 26 deletions(-) create mode 100755 .config/custom_scripts/osx/set_wallpaper.sh create mode 100644 .config/wezterm/modules/hyperlinks.lua diff --git a/.config/custom_scripts/osx/set_wallpaper.sh b/.config/custom_scripts/osx/set_wallpaper.sh new file mode 100755 index 0000000..fdc2c82 --- /dev/null +++ b/.config/custom_scripts/osx/set_wallpaper.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -eaou pipefail + +osascript -e 'tell application "System Events" to set picture of every desktop to "'"$1"'"' diff --git a/.config/wezterm/modules/hyperlinks.lua b/.config/wezterm/modules/hyperlinks.lua new file mode 100644 index 0000000..4c425fd --- /dev/null +++ b/.config/wezterm/modules/hyperlinks.lua @@ -0,0 +1,41 @@ +return { + -- Matches: a URL in parens: (URL) + { + regex = "\\((\\w+://\\S+)\\)", + format = "$1", + highlight = 1, + }, + -- Matches: a URL in brackets: [URL] + { + regex = "\\[(\\w+://\\S+)\\]", + format = "$1", + highlight = 1, + }, + -- Matches: a URL in curly braces: {URL} + { + regex = "\\{(\\w+://\\S+)\\}", + format = "$1", + highlight = 1, + }, + -- Matches: a URL in angle brackets: + { + regex = "<(\\w+://\\S+)>", + format = "$1", + highlight = 1, + }, + -- Then handle URLs not wrapped in brackets + { + -- Before + --regex = '\\b\\w+://\\S+[)/a-zA-Z0-9-]+', + --format = '$0', + -- After + regex = "[^(]\\b(\\w+://\\S+[)/a-zA-Z0-9-]+)", + format = "$1", + highlight = 1, + }, + -- implicit mailto link + { + regex = "\\b\\w+@[\\w-]+(\\.[\\w-]+)+\\b", + format = "mailto:$0", + }, +} diff --git a/.config/wezterm/modules/mappings.lua b/.config/wezterm/modules/mappings.lua index 28c9864..ea8dbd0 100644 --- a/.config/wezterm/modules/mappings.lua +++ b/.config/wezterm/modules/mappings.lua @@ -2,7 +2,7 @@ local wezterm = require("wezterm") local act = wezterm.action return { - leader = { key = "a", mods = "CTRL", timeout_milliseconds = 1002 }, + leader = { key = "z", mods = "CTRL", timeout_milliseconds = 1002 }, keys = { { diff --git a/.config/wezterm/wezterm.lua b/.config/wezterm/wezterm.lua index b73e7a5..76e9aa1 100644 --- a/.config/wezterm/wezterm.lua +++ b/.config/wezterm/wezterm.lua @@ -14,7 +14,7 @@ local config = { font = wezterm.font("JetBrains Mono", { weight = "Medium" }), font_size = 12, line_height = 1.0, - window_background_opacity = 0.8, + window_background_opacity = 0.97, -- tab bar use_fancy_tab_bar = true, tab_bar_at_bottom = false, @@ -38,6 +38,7 @@ local config = { keys = mappings.keys, key_tables = mappings.key_tables, hyperlink_rules = hyperlinks, + audible_bell = "Disabled", } -- sessions.apply_to_config(config) -- optional, this adds default keybindings diff --git a/.config/yazi/init.lua b/.config/yazi/init.lua index 4965767..ef1af55 100644 --- a/.config/yazi/init.lua +++ b/.config/yazi/init.lua @@ -15,3 +15,26 @@ require("bookmarks"):setup({ }, }, }) + +require("projects"):setup({ + save = { + method = "yazi", -- yazi | lua + lua_save_path = "", -- comment out to get the default value + -- windows: "%APPDATA%/yazi/state/projects.json" + -- unix: "~/.local/state/yazi/projects.json" + }, + last = { + update_after_save = true, + update_after_load = true, + load_after_start = false, + }, + merge = { + quit_after_merge = false, + }, + notify = { + enable = true, + title = "Projects", + timeout = 3, + level = "info", + }, +}) diff --git a/.config/yazi/keymap.toml b/.config/yazi/keymap.toml index f3fdfba..9338634 100644 --- a/.config/yazi/keymap.toml +++ b/.config/yazi/keymap.toml @@ -17,3 +17,43 @@ desc = "Delete a bookmark" on = [ "b", "D" ] run = "plugin bookmarks delete_all" desc = "Delete all bookmarks" + +[[manager.prepend_keymap]] +on = [ "P", "s" ] +run = "plugin projects save" +desc = "Save current project" + +[[manager.prepend_keymap]] +on = [ "P", "l" ] +run = "plugin projects load" +desc = "Load project" + +[[manager.prepend_keymap]] +on = [ "P", "P" ] +run = "plugin projects load_last" +desc = "Load last project" + +[[manager.prepend_keymap]] +on = [ "P", "d" ] +run = "plugin projects delete" +desc = "Delete project" + +[[manager.prepend_keymap]] +on = [ "P", "D" ] +run = "plugin projects delete_all" +desc = "Delete all projects" + +[[manager.prepend_keymap]] +on = [ "P", "m" ] +run = "plugin projects 'merge current'" +desc = "Merge current tab to other projects" + +[[manager.prepend_keymap]] +on = [ "P", "M" ] +run = "plugin projects 'merge all'" +desc = "Merge current project to other projects" + +[[manager.prepend_keymap]] +on = ["C", "w"] +run = 'shell -- ${HOME}/.config/custom_scripts/osx/set_wallpaper.sh "$1"' +desc = "Set wallpaper" diff --git a/.config/yazi/package.toml b/.config/yazi/package.toml index 39902f7..4f6117a 100644 --- a/.config/yazi/package.toml +++ b/.config/yazi/package.toml @@ -3,6 +3,16 @@ use = "dedukun/bookmarks" rev = "95b2c58" hash = "17a094653b7d0db4ac68ed531d2e1412" +[[plugin.deps]] +use = "Reledia/glow" +rev = "c76bf4f" +hash = "a6b78bf9af5390e3a85a6951fbb7b93" + +[[plugin.deps]] +use = "MasouShizuka/projects" +rev = "4f11ecc" +hash = "17fa17295d27864f62875f06a77f72e7" + [[flavor.deps]] use = "BennyOe/tokyo-night" rev = "695dac6" diff --git a/.config/yazi/yazi.toml b/.config/yazi/yazi.toml index 8400bce..841ab00 100644 --- a/.config/yazi/yazi.toml +++ b/.config/yazi/yazi.toml @@ -10,5 +10,10 @@ show_hidden = true show_symlink = true scrolloff = 5 mouse_events = ["click", "scroll"] -# title_format = "Yazi: {cwd}" +#title_format = "Yazi: {cwd}" + +[plugin] +prepend_previewers = [ + { name = "*.md", run = "glow" }, +] diff --git a/.gitconfig b/.gitconfig index 5eaccdb..734e32e 100644 --- a/.gitconfig +++ b/.gitconfig @@ -35,3 +35,7 @@ lgdu = !git lgd $( git rev-parse --symbolic @{u} ) HEAD ; lg me: my commits from all branches, by date lgme = !git lgd --author=\"$( git config --get user.name )\" --all + ; git log time tracking + ltime = !git --no-pager log --date=iso --since='6 months' --date-order --full-history --all --pretty=tformat:'%C(cyan)%ad%x08%x08%x08%x08%x08%x08%x08%x08%x08 %C(bold red)%h %C(bold blue)%<(22)%ae %C(reset)%s' +[core] + excludesfile = /Users/paramah/.gitignore diff --git a/.zshrc b/.zshrc index 9ac4d80..a191af8 100644 --- a/.zshrc +++ b/.zshrc @@ -1,9 +1,3 @@ -if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then - source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" -fi - - -source $(brew --prefix)/share/powerlevel10k/powerlevel10k.zsh-theme source ~/.zprofile autoload -Uz compinit compinit @@ -13,7 +7,6 @@ compinit # Path to your Oh My Zsh installation. export ZSH="$HOME/.oh-my-zsh" -ZSH_THEME="robbyrussell" plugins=( git @@ -50,7 +43,9 @@ source $HOME/.oh-my-zsh/custom/plugins/fzf-tab-completion/zsh/fzf-zsh-completion zstyle ':completion:*' fzf-search-display true zstyle ':completion::*:cd::*' fzf-cd-widget zstyle ':completion::*:ls::*' fzf-completion-opts --preview='eval head {1}' +zstyle ':completion::*:lsd::*' fzf-completion-opts --preview='eval head -n30 {1}' zstyle ':completion::*:cat::*' fzf-completion-opts --preview='eval head {1}' +zstyle ':completion::*:nvim::*' fzf-completion-opts --preview='eval head {1}' # Map widgets to key @@ -69,21 +64,10 @@ bindkey '^xn' fzf-insert-named-directory ## Git bindkey '^@g' fzf-select-git-widget -bindkey '^@ga' fzf-git-add-files +bindkey '^@a' fzf-git-add-files bindkey '^@gc' fzf-git-change-repository -# GitHub -bindkey '^@h' fzf-select-github-widget -bindkey '^@hs' fzf-github-show-issue -bindkey '^@hc' fzf-github-close-issue - -## Docker -bindkey '^@d' fzf-select-docker-widget -bindkey '^@dc' fzf-docker-remove-containers -bindkey '^@di' fzf-docker-remove-images -bindkey '^@dv' fzf-docker-remove-volumes - -zplug load +# zplug load # ___ _ __ ___ ____ # / _ \| '_ ` _ \|_ / @@ -94,23 +78,53 @@ source $ZSH/oh-my-zsh.sh [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh +# My secrets and configs +[[ ! -f ~/.exports ]] || source ~/.exports + + autoload bashcompinit bashcompinit +# yazi cwd wrapper +function y() { + local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd + yazi "$@" --cwd-file="$tmp" + if cwd="$(command cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then + builtin cd -- "$cwd" + fi + rm -f -- "$tmp" +} + # Default aliases alias vim="nvim" alias j="jump" alias b="bookmark" -alias ls="lsd" -alias y="yazi" +alias ls="eza --git-repos --git" +alias tailscale="/Applications/Tailscale.app/Contents/MacOS/Tailscale" eval "$(/opt/homebrew/bin/brew shellenv)" +eval "$(gopass completion zsh)" # Add Visual Studio Code (code) export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin" export PATH="$PATH:$HOME/tools/git-scripts" +export PATH="$PATH:/usr/local/share/dotnet" export EDITOR=nvim # Added by LM Studio CLI (lms) export PATH="$PATH:/Users/paramah/.lmstudio/bin" + +# bun completions +[ -s "/Users/paramah/.bun/_bun" ] && source "/Users/paramah/.bun/_bun" + +# bun +export BUN_INSTALL="$HOME/.bun" +export PATH="$BUN_INSTALL/bin:$PATH" + +source $HOME/.atuin/bin/env +eval "$(oh-my-posh init zsh)" + +. "$HOME/.atuin/bin/env" + +eval "$(atuin init zsh)" diff --git a/README.md b/README.md index 8669bb3..ecb3a32 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # [![dotfiles](https://skillicons.dev/icons?i=apple,arch,plan9)](https://skillicons.dev) dotfiles -Do zarządzania konfiguracją używany jest [yadm]() +Do zarządzania konfiguracją używany jest [yadm](https://yadm.io/) +Moje leciwe, acz nie najstarsze: [dotfiles](https://git.cynarski.pl/myEnv/dotfiles) + +![catppuccin](https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/footers/gray0_ctp_on_line.svg)