Ver código fonte

Add xcxx(), to use command to transform clipboard (xvxx style)

Alois Mahdal 5 anos atrás
pai
commit
6ba46c6d14
1 arquivos alterados com 12 adições e 0 exclusões
  1. 12
    0
      dotfiles/bash/main.bashrc

+ 12
- 0
dotfiles/bash/main.bashrc Ver arquivo

@@ -401,6 +401,18 @@ xvxx() {
401 401
     xop o | vipe | xop ii
402 402
 }
403 403
 
404
+xcxx() {
405
+    #
406
+    # Filter text in primary clipboard using command $@ and save it to C-C clipboard
407
+    #
408
+    # Similar to xvvx() but instead of interactive editing, provided filter
409
+    # command is run.
410
+    #
411
+    local cmd=("$@")
412
+    xop o | "${cmd[@]}" | xop ii
413
+    return "${PIPESTATUS[1]}"
414
+}
415
+
404 416
 vx() {
405 417
     #
406 418
     # Edit stdin and save it to primary clipboard