[ACCEPTED]-How to copy yanked text to VI command prompt-vim
try to use
where " stands for default register.
<C-R>" Will paste default buffer. Alternately, you 2 can use
q: to open a buffer for the next command. try 1
- ensure first you are in normal mode by pressing
- once in normal mode, press
- then use the keyboard combination
ctrl-r, and then type
Note: if you are yanking a full line containing 4 relative file path, the line feed will by 3 pasted as well ... i.e.
:! touch src/bash/script.sh^M
WILL create a "funny 2 file path" containing the "\r" if you do 1 not remove the last
To save you a step of yanking, if your cursor 4 is on the word you want to use in Ex, use:
This 3 eschews yanking to paste into the command 2 line; instead, one pastes the word under 1 one's cursor directly onto the command line. E.g.:
If it is just a word that you want to copy, you 1 can use
- Put your cursor over the word
- Then you can type something like
:vim <C-r><C-w> *
You can yank to the clipboard using the 5
* named buffer. For instance, this will 4 copy the current line to the clipboard:
So 3 you can copy a line using this, and then 2 paste it with shift-insert in the commandline.
Similarly, you 1 can paste from the clipboard like this:
+, on Mac at least. So you'd 3 write
"+yy to yank a line to the clipboard, and 2
"+p to paste. Though you could always use Command-C 1 and Command-V.
More Related questions