Vim Macro: cleaning up line endings
Tuesday, July 1. 2008
When development teams have people working on a variety of platforms, its pretty common to end up with wrong line endings. In vim these will look like ^M at the end of each line. To get rid of these line endings you can use the following command (in command mode)
:% s/^M$//
To type the correct ^M character, you'll need to press Ctrl + V followed by Ctrl + M (the first combination means "take the next combination literally).
To turn this into a macro you should do the following. In command mode, pressq, followed by any letter. This will be the shortcut to access the macro. Then type the command as above. Finally, press q again to stop recording and its done. You can use your macro by pressing @ and then the letter you chose.
:% s/^M$//
To type the correct ^M character, you'll need to press Ctrl + V followed by Ctrl + M (the first combination means "take the next combination literally).
To turn this into a macro you should do the following. In command mode, pressq, followed by any letter. This will be the shortcut to access the macro. Then type the command as above. Finally, press q again to stop recording and its done. You can use your macro by pressing @ and then the letter you chose.
(Page 1 of 1, totaling 1 entries)

Comments
Wed, 27.08.2008 10:19
If it’s anything like the Asus that I have, then it should b e relatively easy to put Ubuntu on it, like I’ve done with m ine. Put installer on to a bootable USB stick…
Wed, 27.08.2008 08:50
It should be possible to automatically close down the wifi c onnection and unload the kernel module on hibernate. Look a t the scripts in /etc/apm/suspend.d for example. /etc/de fault/acpi-support might also have some options to get you s omewhere. I put my normal ethernet driver module (e100 [...]
Tue, 26.08.2008 14:56
Vid: Thanks for dropping by, I’m very pleased to hear you fo und this useful.
Tue, 26.08.2008 14:54
dotjay: Shared offices are OK, but I do like the peace and quiet of not sharing I must say. I get a bit loopy though i f I stay home for too long! The offline time trick is a goo d one – I like to at least turn off the monitor and use a pe n sometimes.
Mon, 25.08.2008 20:00
I’m so glad that you settled into telecommuting so well. As you know, I’ve been working for myself and/or telecommuting for the last five years. I’ve never really had the experienc e of a shared office, but I do use Skype a lot, sometimes ta lking with work mates for hours at a time. The trick i [...]
Sun, 24.08.2008 23:25
Lorna, Great post, found this via Chris’s blog, more tool s in my toolset now :). Thanks
Sat, 23.08.2008 20:46
shaun: I didn’t anticipate problems, I just didn’t think it worked in that way – but I’m completely happy to be told oth erwise :) Don’t be surprised that curl lets you do weird an d wonderful things, lots of tools are like that and it allow s you to use them in ways that the original author had [...]
Sat, 23.08.2008 10:21
ok, I’ve been experimenting with this, ‘switch’ing on the RE QUEST_METHOD to implement post, get, put, delete for a db r esource; so far I’ve not had problems using $SERVER[‘QUERY STRING’] and parse_str()... what problems do you anticipate? (I’m not sending files, everything fits in the string [...]
Fri, 22.08.2008 09:20
The main conference site is now live, and the call for paper s is open – see http://conference.phpnw.org.uk/phpnw08/