Pasting is now much easier
Often, when I'm using the text editor Vim, I paste some text into the file I am editing and immediately want to change the indentation or re-wrap it. (This is usually when I am pasting from a website into an email, or when I am moving blocks of code around my program.) My old way of doing this was to hit V (visual line mode), select the text I just pasted, and then use = (automatically indent) or gq (reformat) as appropriate.
I knew the [ and ] marks existed, but they just weren't in my repertoire. They are placed on the first and last character (respectively) of the most recently changed or yanked text. But something, I know not what, has brought them to my awareness, so I have started using them in such situations. Usually, a linewise paste leaves the cursor on the first line of the pasted text, so ='] in that situation adjusts the indent for the whole block.
Incidentally, the text editor in MS Visual Studio annoys me, amongst other ways, by automatically adjusting the indent on all pasted text except the first line, which always ends up with its original indent plus the existing indent on that line, i.e. half-way across the screen.
It's so hard to see the Sun with the truth in your eyes.
Comments on Pasting is now much easier | no comments | Post a comment