voyeg3r

editclipboard

Sep 27th, 2022
1,344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.77 KB | None | 0 0
  1. # add a command line to the shells history without executing it
  2. commit-to-history() {
  3.     print -s ${(z)BUFFER}
  4.     zle send-break
  5. }
  6. zle -N commit-to-history
  7. bindkey "^x^h" commit-to-history
  8.  
  9. # Edit content of clipboard on vim (scratch buffer)
  10. function _edit_clipboard(){
  11.     # pbpaste | vim -c 'setlocal bt=nofile bh=wipe nobl noswapfile nu'
  12.     export LC_ALL=en_US.UTF-8
  13.     /bin/xclip -i -selection clipboard -o | /usr/bin/nvim
  14. }
  15. zle -N edit-clipboard _edit_clipboard
  16. bindkey '^x^v' edit-clipboard
  17.  
  18. # Edit content of primary selection (ZQ discard)
  19. function _edit_primary_selection(){
  20.     export LC_ALL=en_US.UTF-8
  21.     /bin/xclip -i -selection primary -o | /usr/bin/nvim
  22. }
  23. zle -N edit-primary_slection _edit_primary_selection
  24. bindkey '^x^p' edit-primary_slection
  25.  
  26.  
Advertisement
Add Comment
Please, Sign In to add comment