Paste in Vim without moving the cursor?

The safest way without destroying a register is to do the following: p` If you want to create a shortcut, just use any of vim's map functions that are suitable for you, eg: noremap p p`.

Maybe some other register that isn't normally used at all - I'm not sure what's available or customary. – aehlke Oct 19 '09 at 6:21 Sorry, what I meant in my comment was, I'd like to save that as a preset command so it's less to type. – aehlke Oct 19 '09 at 6:22 See the revised answer.

– carl Oct 19 '09 at 6:29 Note when you repeat using . The mapping is ignored.Is that a vim bug, or is there a way to honor the mapping? This is especially useful when P rather than p is used, as Shift-P is awkward to repeat – pixelbeat Oct 19 '09 at 22:58 @pixelbeat I think there's a repeat.

Vim which makes . More powerful/intelligent. Might help you.

– aehlke Oct 19 '09 at 1:08.

Whenever I have a sequence of steps to repeat several times I record a macro, which is trivially easy in Vim. The general method is Position the cursor where you want to make the first change. Type qx to start recording keystrokes.

Make the first edit. Move the cursor to the position where the second edit should begin. T q again to quit recording.

Type @x to replay the macro and make the next edit. The @ command takes a count so you can repeat the edit as many times as you want with one command. So in your case, the entire sequence of keystrokes to record the macro might be qxp`jq and 5@x to replay it five times for a total of 6 changes.

Note that the character after the first q is a register to record the macro into and it can be any letter, not just x. Just be careful your macros doesn't yank text into the register presently being recording into, it makes a real mess of things! Macros can be arbitrarily long and complex.

They can contain Ex mode commands and even call other macros.

This is a great explanation, thank you. I'll experiment with this. – aehlke Oct 25 '09 at 1:16.

(as in the up arrow) If you use 'p' to paste text below the current line, the cursor will be on the first line of the pasted content. Typing 'k' in command mode takes you to the line above the start of the pasted content.

Please re-read my question. – aehlke Oct 19 '09 at 6:35 p pastes after cursor. It doesn't have to be in next line.It depends on how you selected block to copy (v vs. shift-v).

-1 – depesz Oct 19 '09 at 8:12.

I have tried things like CTRL-O and variations of ''. None of these seem to work. They go to the beginning of the line, not to the original cursor position.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions