feat zsh: 搭配shift複製貼上到系統剪貼簿功能
This commit is contained in:
parent
00859dd216
commit
2d3f1770b1
@ -130,18 +130,26 @@ alias free='free -m' # Show sizes in MB
|
|||||||
|
|
||||||
# Zsh Shift Select Mode
|
# Zsh Shift Select Mode
|
||||||
zinit light jirutka/zsh-shift-select
|
zinit light jirutka/zsh-shift-select
|
||||||
# 定義 Ctrl+Y:複製選取的區塊
|
# Ctrl+Y 複製:複製到 zsh 與系統剪貼簿
|
||||||
function my_copy_region() {
|
function my_copy_region() {
|
||||||
zle copy-region-as-kill
|
zle copy-region-as-kill
|
||||||
|
print -rn -- "$CUTBUFFER" | clipcopy
|
||||||
}
|
}
|
||||||
zle -N my_copy_region
|
zle -N my_copy_region
|
||||||
bindkey '^Y' my_copy_region
|
bindkey '^Y' my_copy_region
|
||||||
# 定義 Ctrl+P:貼上(yank)
|
# Ctrl+P 貼上(zsh yank)
|
||||||
function my_paste() {
|
# function my_paste() {
|
||||||
zle yank
|
# zle yank
|
||||||
|
# }
|
||||||
|
# zle -N my_paste
|
||||||
|
# bindkey '^P' my_paste
|
||||||
|
# 貼上(clipboard-paste)
|
||||||
|
function my_paste_from_clipboard() {
|
||||||
|
LBUFFER+=$(clippaste)
|
||||||
}
|
}
|
||||||
zle -N my_paste
|
zle -N my_paste_from_clipboard
|
||||||
bindkey '^P' my_paste
|
# bindkey '^O' my_paste_from_clipboard # 例如 Ctrl+O
|
||||||
|
bindkey '^P' my_paste_from_clipboard # 例如 Ctrl+P
|
||||||
|
|
||||||
# overwrite ls
|
# overwrite ls
|
||||||
if command -v colorls &> /dev/null; then
|
if command -v colorls &> /dev/null; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user