From 2d3f1770b182d4c26c4bda9e4babdb6103372315 Mon Sep 17 00:00:00 2001 From: Yuan Chiu Date: Mon, 5 May 2025 12:54:34 +0800 Subject: [PATCH] =?UTF-8?q?feat=20zsh:=20=E6=90=AD=E9=85=8Dshift=E8=A4=87?= =?UTF-8?q?=E8=A3=BD=E8=B2=BC=E4=B8=8A=E5=88=B0=E7=B3=BB=E7=B5=B1=E5=89=AA?= =?UTF-8?q?=E8=B2=BC=E7=B0=BF=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dot_zshrc.tmpl | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/dot_zshrc.tmpl b/dot_zshrc.tmpl index 283de50..d03ee08 100644 --- a/dot_zshrc.tmpl +++ b/dot_zshrc.tmpl @@ -130,18 +130,26 @@ alias free='free -m' # Show sizes in MB # Zsh Shift Select Mode zinit light jirutka/zsh-shift-select -# 定義 Ctrl+Y:複製選取的區塊 +# Ctrl+Y 複製:複製到 zsh 與系統剪貼簿 function my_copy_region() { zle copy-region-as-kill + print -rn -- "$CUTBUFFER" | clipcopy } zle -N my_copy_region bindkey '^Y' my_copy_region -# 定義 Ctrl+P:貼上(yank) -function my_paste() { - zle yank +# Ctrl+P 貼上(zsh yank) +# function my_paste() { +# zle yank +# } +# zle -N my_paste +# bindkey '^P' my_paste +# 貼上(clipboard-paste) +function my_paste_from_clipboard() { + LBUFFER+=$(clippaste) } -zle -N my_paste -bindkey '^P' my_paste +zle -N my_paste_from_clipboard +# bindkey '^O' my_paste_from_clipboard # 例如 Ctrl+O +bindkey '^P' my_paste_from_clipboard # 例如 Ctrl+P # overwrite ls if command -v colorls &> /dev/null; then