To insert text from a file in the current Vim buffer I use :r filename
to insert the text below the cursor or :0r filename
to insert in the first line.
How do you insert the contents of a file where [Cursor] is located?
Actual line with some coding [Cursor] // TODO for later version Line below actual line ...
Type a (append) to insert text to the right of the cursor. Experiment by moving the cursor anywhere on a line and typing a , followed by the text you want to add. Press Esc when you're finished. Type A to add text to the end of a line.
Insert text to the left of the cursor by typing i from command mode. Type I to insert text at the beginning of a line. The command moves the cursor from any position on that line. Press Esc to return to command mode after you type the desired text.
This inserts the contents of the file whose path is at the cursor position:
:r <cfile>
Insert a line break, read the file, and then take out the line break...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With