What I want to do is:
(1) Copy a piece of code and paste into a buffer in Vim;
(2) Copy another piece of code and paste into another buffer in Vim;
(3) Compare these two buffers directly without saving them into files.
I know this can be done easily with Notepad++. I need to do this quite often, and I want to know if Vim can do this. Thanks!
You can do :diffthis on each window you want to compare.
See :help diff.
Related
What i am looking to achieve is simple, but i am a noob in this and i have tried to get that done.
I am used to copy in excel but in Emeditor i feel there is a better way of doing that, afterall it opens more file.
I do not want to be copying-down specific line range like i do in excel.
For instance, if i have a file that is 20million lines, and i need to copy only specific range, maybe between 1-2M or from 2M to 5M, without having to highlight and copydown, how do i go about it?
I will appreciate your responses.
Press F8 (or Ctrl+F8 to select whole lines) to mark the
beginning point of a selection.
Press Ctrl+G and specify the destination line number/column to jump to the ending point.
Press Ctrl+C to copy the selection.
I have an excel File filled with data which often doesn't fit in one line. Obviously these lines are getting split into two. Working as intended so far. But sometimes Excel decides there is a need for a line break even tough the text does fit on one line.
My guess would be that Excel sets a margin for its cells, but how can I modify it to prevent this from happening?
WordWrap a.k.a. Wrap Text is your friend:
Here you can see more.
If you are copy pasting.
Paste the desired object within the box with the blinking cursor (Easy).
This will paste the contents only within a block.
if the documents from which you are copying the content consists of line breaks for new paragraphs then excel takes those line breaks as new rows/columns.
for your problems if your document has made split cells for the content, Try
Selecting the columns you wish to combine together.
then use the formula.
=CONCAT(CELL A,CELL B)
Hope this helps you.
I am copying large amounts of text from PDF documents into vim, but when you do a copy-paste from PDFs as opposed to say web browsers, everytime the PDF line breaks within a paragraph the copied text includes a newline. So when I paste into vim using 'p', I then have to press 'J' many times to collapse the newlines.
I'd much rather have a command that I can map to another letter on the keyboard that takes the contents of the copied text and pastes it removing the newlines. Any idea how I can do this?
This should do it:
map <leader>xx :let #* = substitute(#*, "\n", "", "g")<CR>"*p
Change the <leader>xx with the mapping of your choice.
What this command does, it substitues the end of line charater (\n) with nothing (""), inside the clipboard register (which is the star register). Then it pastes the text from the * register.
You can use my UnconditionalPaste plugin for that. It provides gcp / gcP mappings that force the paste to be characterwise, i.e. all newlines and indent are flattened to spaces. It also has other, similar mappings to force linewise mode, or paste with a custom separator, etc.
Is there a way I can select a portion of multiple lines in vim and then paste them at the end of another block of lines. For instance if I want everything after the equal sign from:
qw=12345
er=23435
and pasted into:
ty=
ui=
What would I have to do?
This seems real simple, but for some reason, I am completely stuck.
You are looking for block selection mode.
Please note the different keybinding for Windows platforms.
I want to replace a selection of text with is present in the default paste buffer. Say, I yanked a word with yaw and now I want to replace a word with that, how do I do it?
I saw similar questions answered with suggestions to use a named register and delete the text-to-be-replaced into the black hole etc, but I am looking for a cleaner solution.
Visually select the range, then type p.