jeffreytse / zsh-vi-mode

💻 A better and friendly vi(vim) mode plugin for ZSH.
MIT License
2.93k stars 102 forks source link

feat: implement getter and setter for CUTBUFFER (For example, interaction with the system clipboard) #241

Open MuXiu1997 opened 10 months ago

MuXiu1997 commented 10 months ago

I'm considering wrapping the CUTBUFFER into getter and setter functions. This approach might minimize the extent of changes required in the existing code while also allowing other users to override these two functions to fulfill their own needs, such as interacting with the system clipboard.

For example:

# CUTBUFFER getter
function zvm_get_cutbuffer() {
  pbpaste
}

# CUTBUFFER setter
function zvm_set_cutbuffer() {
  echo -n $1 | pbcopy
}

MuXiu1997 commented 10 months ago

@jeffreytse I hope to receive your advice and response.