Skip to content

Instantly share code, notes, and snippets.

@oodenough
oodenough / copyfile.zsh
Created September 9, 2025 05:39
ohmyzsh copyfile
# copyfile 函数
# Copies the contents of a given file to the system or X Windows clipboard
# Usage: copyfile <file>
function copyfile {
emulate -L zsh
if [[ -z "$1" ]]; then
echo "Usage: copyfile <file>"
return 1
fi
@oodenough
oodenough / copypath.zsh
Created September 9, 2025 05:38
ohmyzsh copypath
# copypath 函数
# Copies the path of given directory or file to the system or X Windows clipboard.
# Copy current directory if no parameter.
function copypath {
# If no argument passed, use current directory
local file="${1:-.}"
# If argument is not an absolute path, prepend $PWD
[[ $file = /* ]] || file="$PWD/$file"
@oodenough
oodenough / vi-mode.zsh
Created September 7, 2025 09:35
ohmyzsh vi-mode 插件
# Vi-mode 配置 - 精简版
# https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/vi-mode/vi-mode.plugin.zsh
# 在没有 oh-my-zsh 的情况下提供 vi 模式支持
# 是否在模式切换时强制重绘提示符
# 设置为 "true" 强制重绘(可能导致延迟),默认为自动检测
typeset -g VI_MODE_RESET_PROMPT_ON_MODE_CHANGE
# 是否在模式切换时改变光标样式
# 设置为 "true" 启用光标形状变化,可以直观显示当前模式
@oodenough
oodenough / Apple_Maps.sgmodule
Last active July 3, 2025 02:17 — forked from mritd/Apple_Maps.sgmodule
Surge Modules
#!name= Redirect Apple Maps to 🇺🇸US
#!desc=只作用于Apple Maps,不修改定位服务和地区检测,可以通过搭配使用其他模块达成混合效果。
[URL Rewrite]
# Redirect Apple Maps to US
(^https?:\/\/gspe\d*-ssl\.ls\.apple\.)(com|cn)(\/.*)(country_code=[A-Z]{2})(.*) $1$2$3country_code=US$5 header
(^https?:\/\/gspe\d*-ssl\.ls\.apple\.)(com|cn)(\/.*)(environment=[a-z/-]{4,})(.*) $1$2$3environment=prod$5 header
[MITM]
hostname = %APPEND% gspe35-ssl.ls.apple.com