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

后端 未结 7 1649
情话喂你
情话喂你 2020-12-22 16:29

I want to search for $maximumTotalAllowedAfterFinish and replace it with $minimumTotalAllowedAfterFinish. Instead of typing the long text:

相关标签:
7条回答
  • 2020-12-22 17:24

    Typically, you would do that with mouse selecting (perhaps CtrlIns or CtrlC after selecting) and then, when in the command/search line, middle-clicking (or ShiftIns or CtrlV).

    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 key presses above:

    :%s/$maximumTotalAllowedAfterFinish/$minimumTotalAllowedAfterFinish/g
    

    Finally, you can enter q: to enter history editing in a text buffer.

    0 讨论(0)
提交回复
热议问题