Eric Leenman wrote:
Hi,

I'm used to cut, copy and paste the windows-way.
Meaning, selecting text and then press CTRL-X, CTRL-C or CTRL-V.

In VIM (and correct me if I'm wrong) you
yank (y) for copy
put (p) for paste
..... for cut

With this in mind, how to cut, copy and paste the VIM-way?
Because when I select text and see select-mode in the lowest line
and then press y, I see a letter y in my text and the selected text is gone.
How come?

Rgds,
Eric

The Vim names for cut, copy and paste are delete, yank and put, respectively. By default, they use the "unnamed register", which is good enough when the cut/copy and the paste happen within a single instance of Vim. To use the clipboard, specify register + by using either a "+ prefix to the Normal-mode commands y d p P or by postfixing a + argument to the :y[ank] :d[elete] and :pu[t] Ex-commands (which accept a range).

The difference between Select mode and Visual mode is that in Select mode, any printable-character key hit causes the character in question to replace the selection. All the Normal-mode commands and Ex-commands mentioned above are for Normal or Visual modes, not for Select or Insert/Replace.

To create a Visual (not Select) -mode selection, hit v at one end of the selection, then move the cursor to the other end.

See
        :help y
        :help d
        :help p
        :help P
        :help {motion}
        :help motion.txt
        :help registers
        :help :yank
        :help :delete
        :help :put
        :help :range

Examples:

        :%y +
                copy the whole file to the clipboard

        dd
                delete the current line into the default register

        "+5yy
                yank 5 lines (starting at current line) into the clipboard

        p
                put the default register after the cursor

        "+P
                put the clipboard before the cursor

        y$
                yank from the cursor to the end of the line

        :$put +
                add the clipboard after the last line of the file

etc.


Best regards,
Tony.
--
When one woman was asked how long she had been going to symphony
concerts, she paused to calculate and replied, "Forty-seven years --
and I find I mind it less and less."
                -- Louise Andrews Kent

Reply via email to