I have several vim tips in the pipe, so I think I'll start with one. If you're editing commands in the ex-like Command Line Mode of vim (the one that's displayed after you press ":" in Normal Mode), you can use the Ctrl+R family of keybindings to insert registers and other text there. So for example, if you wish to search for a word, you can do yaw in the buffer, and then type :grep -r <CTRL+R>" ..
Since this pattern is so common, the vim developers already thought of it, and you can simply position the cursor on the word and type :grep -r <CTRL+R><CTRL+W> .. Ctrl+R;Ctrl+A searches for WORDS.
Note that Ctrl+R by default executes the pasted expression as a mini vim program. If you want to insert the literal string, use Ctrl+R;Ctrl+R. Better safe than sorry.
- Location:Home
- Mood:
energetic - Music:TPau - China in Your Hand
I apologise for not posting here in a few days, but publicising the Tel Aviv Linux club meetings, and working on this year's Perl Advent Calendar is relatively time-consuming. But now happy that I finished two articles for the calendar, I can blog a little about other stuff, like Vim Tips.
So here are two Vim tips I've found:
- When using the visual mode, one can use the o to move to the other end of the selection and modify it. Read more about it in the link.
- If you are in insert mode and your line is indented (say after pressing o on an indented line) but wish to start writing from the beginning of the line, you can press Ctrl+W to delete the leading whitespace and start typing at the beginning of the line.
That put aside the last Tel Aviv Linux Club meeting was very successful - many people came, Gilad gave a good presentation about Development Tools for Linux, and four of us went to the café afterwards. And here's some publicity for the next presentation in the series. (Ignore the title of the page and message - they're a leftover from the previous announcement).
Have a lot of fun!
- Location:Home
- Mood:accomplished
- Music:The Contours - Do You Love Me (Dirty Dancing Soundtrack)
