Content tagged with "vim"

Vim and ^M Dos characters > Post > Dec 04, 2009 01 p.m.

I've been working on a Flex project recently, one that I used to compile in Windows, but have since moved over to Linux with the Flex SDK. One of the problems I run into is that Dos appears to leave these characters in my files at the end of each line

// a comment in my flex file^M

The solution

It's painful to have to delete them all manually, so a simple command in vim will do it:

:1,$ s/^M//

To get the ^M you can hit 'Ctrl+v' and then 'Enter'

Aaron

'Find in files' in vim > Post > Jun 14, 2009 03 p.m.

I have been enjoying vim quite a bit recently, it is really starting to speed up my workflow. The learning curve is constant, however. The latest thing I have needed to know (and use quite a bit) is a 'find in files' feature. Vim has this built in with a plugin called 'vimgrep'. The documentation was pretty straight forward (:h vimgrep) but it wasn't immediately obvious how to do recursive searching. The solution was what vim calls 'starstar-wildcard' (essentially **)

This simple example produces a recursive search:

:vimgrep /myPattern/ **

The above example will search through everything though, including binary files (like pngs and such), so a little more instruction is needed.

:vimgrep /myPattern/ **/*.html

# this is also equivalent
:vim /myPattern/ **/*.html

Vim then gives you the first of the matches, you can cycle between them with :cnext/:cn and :cp/:cprevious.

If you have a lot of files to search through, :grep is faster.

:grep -Ir /myPattern/ *
The flags -Ir tell it 'not case sensitive, and recursive...please :)'

Not so hard after all, af

Categories

Tag Cloud

'dark 'why 50mm actionscript adbusters amf aquaplex band blaire bowen brian burntstick butterfly cache calaway calaway park calgary caroline cat causeway chrome clearwater comments dan design django dos double time dreamhost drivers easy_install emacs email extra facebook family reunion favorite fcgi film firefox firewire flash flex flood fluxbox fossils funny gedit george green google grep hack hardy heron hdr init james join keys laserjet 1600 lightroom linux marye memory moderation mount mxml nelson noah olympus outlook park pil pillar pool potty pygments python raven recommend sata select send_mail server shortcut signals signs skye skype smtp soup spirit staged right sucks sucks' sundre sunset svn trac ubuntu vafcs vim virtualbox virus vista vnc water webcam webfaction white balance wide angle wireless work xl2 xmbc xmlrpc xp xp'

Random Images

banjo Ink Future Politician cat jeep bug Bunchy kanes cake nelson-stairs Skye Little mushroom

About this blog

This blog is built on an experimental engine conceived by Aaron Fay. The system used to power this site is running on the awesome Django framework. As the site becomes more complete, and the functionality becomes streamlined, I will reveal more about the inner workings and may also release it open source one day. The most prominent feature at this point is all the different content types use the same model :)

My Comments Elsewhere

Darren's Developer Diary: Controlling file associations in Gnome Installing and configuring lighttpd webserver - HOWTO Import RSS feeds into Facebook without relinquishing content control | bylr.net Grogler » Blog Archive » After Effects Keyboard Shortcuts - Next Frame / Previous Frame Django snippets: Template Query Debug Django snippets: EditInline for GenericForiegnKey II I quit; goodbye cruel facebook « don’t mind me, just talking to myself