Showing posts with label paste. Show all posts
Showing posts with label paste. Show all posts

Sunday, 30 July 2017

copy paste in ubuntu unix linux using key board shortcuts commands

copy paste in ubuntu unix linux using key board shortcuts commands





First to copy, select the text that you want to copy using mouse and then press ctrl + shift + c ( This make the text to copy to clip board)

Then simply to paste this content into a file press  ctrl + shift + v
{ Read More }


Wednesday, 19 July 2017

Copy and paste from the system clipboard with vim

Copy and paste from the system clipboard with vim


Often, when using vim, highlighting text in the terminal to copy-and-paste it around is plausible.  This is definitely true when on a true terminal.  I use the rnu option so that I have relative line numbers on each line.  So copying multiple lines with the mouse grabs the line number with unwanted indentation.  When I need to move code around it is annoying to have to manually remove the numbers.

To understand how to get vims clipboard to match your systems you need to understand vim registers.  On a computer we usually only get one clipboard.  Every time we ctrl-c, the contents of the clipboard are discarded and replaced with whatever is highlighted.  We dont have any option to copy multiple objects and then paste them around.  However vim has multiple "registers" where text can be copied and pasted from.  To see the registers type :reg in command mode.

The register that we are interested in is register +.  To test it out, copy some text from another application then run :reg and see the contents displayed in register +.

So now we just need to know how to access the contents of register +.  Register access is done with ".  To paste from they keyboard we type "+p  To copy, for example an entire line, into the system clipboard we type "+yy  To delete the current line and store it in the system clipboard we type "+dd

We can also use registers with visual mode.  If we wanted to copy the line underneath the cursor we would type V"+y  We could copy the next three lines into the system clipboard by typing Vjj"+y

To sum it up, to use the system clipboard to copy and paste in vim simply do what you would usually do in vim, then prepend "+ to your y (yank) or p (paste) command.

Update:
Depending on the version of vim you are using, the register for the clipboard may work differently. In some cases the * and + registers are the same register. If you want to find out which register is for your system clipboard, simply copy some text from anywhere into your clipboard, then run :reg. Whichever register has the text you copied is the register that holds the contents of your clipboard.
{ Read More }


Friday, 16 June 2017

Copy Paste Text but Strip the Formatting and HTML Tags

Copy Paste Text but Strip the Formatting and HTML Tags


Its a common problem. What you get from the clipboard is not what you want.

When you copy some text from a web page or a Word document to the clipboard and then paste that text inside an email message or another rich text editor, the formatting (font sizes, colors, images) stays intact.

For Microsoft Word and other Office programs, you can use the "Paste Special" command that will auto-convert the pasted content from rich text as plain text format.

See: Copy Command Line Output to Clipboard

Alternatively, you can copy the text to the clipboard and paste everything into Notepad. Select the content in Notepad and copy to clipboard again. In this process, all the document formatting and HTML tags will be remove the clipboard content will be in plain text.

You can also (optionally) remove all HTML tags from the clipboard text, which is excellent for copying and pasting things from the web, without getting all the extra markup.

Then theres Clipboard Fusion which automatically strips the text of all formatting as soon as you copy it to the clipboard. Everything that gets to clipboard after you hit Ctrl+C is converted to plain text.
{ Read More }