<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>acloudtree &#187; VIM</title>
	<atom:link href="http://www.acloudtree.com/tag/vim/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.acloudtree.com</link>
	<description>Programming, Computers, Writing, Economics, and Life</description>
	<lastBuildDate>Sat, 10 Jul 2010 02:00:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>(Nerd) ^M Removing control characters using VIM</title>
		<link>http://www.acloudtree.com/nerd-m-removing-control-characters-using-vim/</link>
		<comments>http://www.acloudtree.com/nerd-m-removing-control-characters-using-vim/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 05:31:53 +0000</pubDate>
		<dc:creator>jared.folkins</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[VIM]]></category>
		<category><![CDATA[character]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[M]]></category>
		<category><![CDATA[^]]></category>

		<guid isPermaLink="false">http://www.acloudtree.com/?p=566</guid>
		<description><![CDATA[hat tip Matthew Turland
Have you ever opened up a file using VI and found  the following?

&#60;?php
    echo '&#60;html&#62;'^M
    echo '&#60;head&#62;'^M
    echo '&#60;/head&#62;'^M
    echo '&#60;body&#62;'^M
&#160;
...

That stupid control character from some other horrid text editor is trailing every single line. And you are annoyed [...]]]></description>
			<content:encoded><![CDATA[<p><em>hat tip </em><em><a href="http://matthewturland.com/">Matthew Turland</a></em></p>
<p>Have you ever opened up a file using VI and found  the following?</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;html&gt;'</span>^M
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;head&gt;'</span>^M
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/head&gt;'</span>^M
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;body&gt;'</span>^M
&nbsp;
<span style="color: #339933;">...</span></pre></div></div>

<p>That stupid control character from some other horrid text editor is trailing every single line. And you are annoyed enough to Google for an answer. ^M</p>
<p>Now, hopefully you are aware of the powerful regex tools built right into VI. But in this case, the fix is pretty simple, and we won&#8217;t have to craft any regFu. After you open your file using VI, we will then use the search/replace functionality. And we will eventually end up with a line that looks like this.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">:<span style="color: #000000; font-weight: bold;">%</span>s<span style="color: #000000; font-weight: bold;">/</span>^M<span style="color: #000000; font-weight: bold;">//</span>g</pre></div></div>

<p>But there is a gotcha to this solution, so you may need to read on to find out more. And before proceeding, press esc to make sure you are not in insert mode.</p>
<p>First type the following.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> Shift + :</pre></div></div>

<p>Which should just print the colon at the bottom of your screen.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">:</pre></div></div>

<p>Then type this exactly how it looks.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span>s<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>Now we need to type the control character.  You may be thinking &#8220;Jared, I will just hit shift + 6 and get that character onto my screen in no time.&#8221;. And you are more than welcome to do that, but you would be wrong.</p>
<p>You will need to press the following keys.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Control + V</pre></div></div>

<p>Which will get you this printed out.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">:<span style="color: #000000; font-weight: bold;">%</span>s<span style="color: #000000; font-weight: bold;">/</span>^</pre></div></div>

<p>Then type the following.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Control + M</pre></div></div>

<p>Which should have you ending up with this.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">:<span style="color: #000000; font-weight: bold;">%</span>s<span style="color: #000000; font-weight: bold;">/</span>^M</pre></div></div>

<p>At this point you can type the rest of the characters exactly how they look.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">//</span>g</pre></div></div>

<p>Which leaves you with a finished line that looks like so.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">:<span style="color: #000000; font-weight: bold;">%</span>s<span style="color: #000000; font-weight: bold;">/</span>^M<span style="color: #000000; font-weight: bold;">//</span>g</pre></div></div>

<p>Press enter, and you will now replace the ^M character with nothing.</p>
<p></p>
<p><strong>Part 2(kinda): Small search and replace example.</strong></p>
<p>This would replace Dog with Cat.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">:<span style="color: #000000; font-weight: bold;">%</span>s<span style="color: #000000; font-weight: bold;">/</span>Dog<span style="color: #000000; font-weight: bold;">/</span>Cat<span style="color: #000000; font-weight: bold;">/</span>g</pre></div></div>

<p>Cat with Mouse.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">:<span style="color: #000000; font-weight: bold;">%</span>s<span style="color: #000000; font-weight: bold;">/</span>Cat<span style="color: #000000; font-weight: bold;">/</span>Mouse<span style="color: #000000; font-weight: bold;">/</span>g</pre></div></div>

<p>Mouse with Trap.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">:<span style="color: #000000; font-weight: bold;">%</span>s<span style="color: #000000; font-weight: bold;">/</span>Mouse<span style="color: #000000; font-weight: bold;">/</span>Trap<span style="color: #000000; font-weight: bold;">/</span>g</pre></div></div>

<p>So our line to replace the ^M character is literally saying &#8220;Replace the ^M character with nothing&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.acloudtree.com/nerd-m-removing-control-characters-using-vim/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>(Nerd) Ubuntu + Vim + ZendFramework-1.9.2 + .pthml syntax highlighting</title>
		<link>http://www.acloudtree.com/nerd-ubuntu-vim-zendframework-192-pthml-syntax-highlighting/</link>
		<comments>http://www.acloudtree.com/nerd-ubuntu-vim-zendframework-192-pthml-syntax-highlighting/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 18:51:25 +0000</pubDate>
		<dc:creator>jared.folkins</dc:creator>
				<category><![CDATA[Nerd]]></category>
		<category><![CDATA[OOP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[VIM]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[Highlighting]]></category>
		<category><![CDATA[Syntax]]></category>

		<guid isPermaLink="false">http://www.acloudtree.com/nerd-ubuntu-vim-zendframework-192-pthml-syntax-highlighting/</guid>
		<description><![CDATA[1) From the command line &#8216;cd&#8217; to your &#8216;home&#8217; directory

test-box@jbuntu:~$ cd

2a) Check to see if the .vimrc file exists

test-box@jbuntu:~$ ls .vimrc

If the terminal outputs nothing, then that means the file does not exist.
2b) If you get the following

test-box@jbuntu:~$ ls .vimrc
.vimrc

It means that the file does exist and we just need to edit it.
3) If the [...]]]></description>
			<content:encoded><![CDATA[<p>1) From the command line &#8216;cd&#8217; to your &#8216;home&#8217; directory</p>
<p><code><br />
test-box@jbuntu:~$ cd<br />
</code></p>
<p>2a) Check to see if the .vimrc file exists</p>
<p><code><br />
test-box@jbuntu:~$ ls .vimrc<br />
</code></p>
<p>If the terminal outputs nothing, then that means the file does not exist.</p>
<p>2b) If you get the following</p>
<p><code><br />
test-box@jbuntu:~$ ls .vimrc<br />
.vimrc<br />
</code></p>
<p>It means that the file does exist and we just need to edit it.</p>
<p>3) If the file does not exist just &#8216;touch&#8217; the file. If it DOES exist, just skip this step.</p>
<p><code><br />
test-box@jbuntu:~$ touch .vimrc<br />
</code></p>
<p>4) From this point, &#8216;vi&#8217; the &#8216;.vimrc&#8217; file. You primarily need the following lines and you are more than welcome to copy/paste. Write/Quite when finished.</p>
<p><code><br />
if has("autocmd")<br />
autocmd BufEnter *.phtml set syn=php<br />
endif<br />
syn on</code></p>
<p>Now the next time you open VI it should have the desired highlighting for .phtml files found in the Zend Framework.</p>
<p>Below is my &#8216;.vimrc&#8217; file in it&#8217;s entirety. Just for the record. It also allows for syntax highlighting to occur in CakePHP .ctp files along with some other settings that I prefer.</p>
<p><code><br />
set tabstop=2<br />
set shiftwidth=2<br />
set expandtab<br />
if has("autocmd")<br />
autocmd BufEnter *.ctp set syn=php<br />
autocmd BufEnter *.phtml set syn=php<br />
endif<br />
syn on<br />
set ai</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.acloudtree.com/nerd-ubuntu-vim-zendframework-192-pthml-syntax-highlighting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu + VIM + CakePHP 1.2 + .ctp syntax highlighting</title>
		<link>http://www.acloudtree.com/ubuntu-vim-cakephp-12-ctp-syntax-highlighting/</link>
		<comments>http://www.acloudtree.com/ubuntu-vim-cakephp-12-ctp-syntax-highlighting/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 05:19:11 +0000</pubDate>
		<dc:creator>jared.folkins</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[VIM]]></category>
		<category><![CDATA[cakephp]]></category>
		<category><![CDATA[.vimrc]]></category>
		<category><![CDATA[syntax highlighting]]></category>

		<guid isPermaLink="false">http://www.acloudtree.com/?p=43</guid>
		<description><![CDATA[Found this blog post concerning setting up the Cakephp view extension (.ctp) to use the same highlighting as (.php).
blog
I didn&#8217;t find his solution that helpful, but one of the comments said to add this to my &#8216;.vimrc&#8217; file in my home directory.

if has(”autocmd”)
autocmd BufEnter *.ctp set syn=php
endif

And since we are on the topic here is [...]]]></description>
			<content:encoded><![CDATA[<p>Found this blog post concerning setting up the Cakephp view extension (.ctp) to use the same highlighting as (.php).</p>
<p><a href="http://quakey.wordpress.com/2007/07/11/vim-syntax-highlighting/">blog</a></p>
<p>I didn&#8217;t find his solution that helpful, but one of the comments said to add this to my &#8216;.vimrc&#8217; file in my home directory.</p>
<p><code><br />
if has(”autocmd”)<br />
autocmd BufEnter *.ctp set syn=php<br />
endif<br />
</code></p>
<p>And since we are on the topic here is how my .vimrc is setup</p>
<p><code></p>
<pre>
set tabstop=2
set shiftwidth=2
set expandtab

if has("autocmd")
autocmd BufEnter *.ctp set syn=php
endif

syn on</pre>
<p></code></p>
<p>-later</p>
]]></content:encoded>
			<wfw:commentRss>http://www.acloudtree.com/ubuntu-vim-cakephp-12-ctp-syntax-highlighting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
