Browse Source

Add xvx() and xvvx() for quick clipboard editing

Alois Mahdal 7 years ago
parent
commit
9ada2fa46f
1 changed files with 21 additions and 0 deletions
  1. 21
    0
      dotfiles/bash/main.bashrc

+ 21
- 0
dotfiles/bash/main.bashrc View File

@@ -271,6 +271,27 @@ xood() {
271 271
     echo "$tmp/$name"
272 272
 }
273 273
 
274
+xvx() {
275
+    #
276
+    # Edit text in primary clipboard and save it to C-C clipboard
277
+    #
278
+    # Ideal for editing snippets in browser-based editors: during editing,
279
+    # select the text, open terminal, call `xvx`, edit the text, move
280
+    # back to the browser and paste it over the old (still selected) text.
281
+    # That's it, no need to make up and save temporary files.
282
+    #
283
+    # If you quickly realize you need to re-edit the text, use xvvx().
284
+    #
285
+    xop o | vipe | xop ii
286
+}
287
+
288
+xvvx() {
289
+    #
290
+    # Edit text in C-C clipboard and save it back
291
+    #
292
+    xop oo | vipe | xop ii
293
+}
294
+
274 295
 yum_hasbin() {
275 296
     #
276 297
     # Ask yum who has bin $1 (and make the output actually readable)