In Vim, is there a way to paste text in the search line?

You can insert the contents of a numbered or named register by typing CTRL-R {0-9a-z"%#:-=. }. By typing CTRL-R CTRL-W you can paste the current word under the cursor.

See.

Up vote 31 down vote favorite 9 share g+ share fb share tw.

Say in vim I want to search for $maximumTotalAllowedAfterFinish and replace it with $minimumTotalAllowedAfterFinish. Instead of typing the long text text: :%s/$maximumTotalAllowedAfterFinish/$minimumTotalAllowedAfterFinish/g Is there a way to COPY these long variable names down into the search line, since, on the command line I can't type "p" to paste. Vim link|improve this question asked Sep 19 '08 at 11:47Edward Tanguay22k42228509 80% accept rate.

I guess that tou also need to escape the first $ because this caracter means the end of line. – Luc M Sep 19 '11 at 20:28.

You can insert the contents of a numbered or named register by typing CTRL-R {0-9a-z"%#:-=. }. By typing CTRL-R CTRL-W you can paste the current word under the cursor.

See :he cmdline-editing for more information.

Copy it as normal, then do control-r " to paste. There are lots of other control-r shortcuts (Eg, a calculator, current filename, clipboard contents). Type :help c_ to see the full list.

Type q: to get into history editing mode in a new buffer. Then edit the last line of the buffer and press enter to execute it.

Yes, thanks. So difficult starting a command with something other than ":"! – Johannes Hoff Sep 19 '08 at 12:02.

Or create the command in a vim buffer , e.g. Type it in the buffer: s/foo/bar/gci And copy it to a named register, with "ayy (if the cursor is on that line! ). Now you can execute the contents of the "a" register from Vim's Ex command line with: :OPTIONAL_RANGE@a I use it all the time.

Your "ayy" either is quoted (and therefore incorrect) or it's not (and therefore there's an erroneous " at the end) – tzot Sep 25 '08 at 8:32 Thanks for the correction. – Zsolt Botykai Oct 19 '08 at 20:06.

Typically, you would do that with mouse selecting (perhaps Ctrl+Ins or Ctrl+C after selecting) and then, when in the command/search line, middle-clicking (or Shift+Ins or Ctrl+V). Another way, is to write your command/search line in the text buffer with all the editing available in text buffers, starting with : and all, then, on the line, do: "add@a which will store the whole command line in buffer a, and then execute it. It won't be stored in the command history, though.

Try creating the following line in the text buffer as an example for the keypresses above: :%s/$maximumTotalAllowedAfterFinish/$minimumTotalAllowedAfterFinish/g Finally, you can enter q: to enter history editing in a text buffer.

1 for mentioning the mouse – Cristian Ciupitu Nov 10 '08 at 12:48.

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