So I spend a lot of time in my text editor. Like a lot of time. I use it for writing, code, notes, or well everything. So that often means that I need to open a file for review, copy something and paste it into a new location.
For most folks this would not be an issue (and to be honest for most of my life it was not an issue for me either). I would just use my mouse, select the text I need/want and a few key strokes later, badabing badaboom.
However as I have begun using a terminal more and more. I have been finding more and more instances, when I have to capture multiple lines from a file (more lines than, my terminal has). For a vim user, where the clipboard is not compiled into binary I uses because I run a distribution of Linux (Fedora) that just so happens to not build vim with clipboard support.
$ --> vim --version | grep -Eo [-+]clipboard
-clipboard
I have an extra challenge for copy, and pasting content from one source to another.
Luckily for me I found a tool (xclip) some time ago, for taking output from commands and allowing me to move it to my clipboard.
Using this tool and keybinding in my .vimrc, I can quickly solve my copy, past woes.
To do this you simply need to add the following keybinding.
vmap y ":w !xclip -sel clipWhat this maps to is:
:'<,'>w !xclip -sel clipWhich if we break this down, states; take the selected area, and write the buffer and send it to the command (xclip, that selects the clipboard as its storage location).
This will allow you to select blocks of text from with in your text editor and move then to your clipboard (using xclip), with having clipboard support built into the editor.
No comments:
Post a Comment