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:
To get the ^M you can hit 'Ctrl+v' and then 'Enter'
Aaron
Tags dos flex vim |
Comments 0
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:
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.
The flags -Ir tell it 'not case sensitive, and recursive...please :)'
Not so hard after all,
af
Tags grep vim |
Comments 0