<?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>Gustavo Dutra &#187; vim</title>
	<atom:link href="http://gustavodutra.com/tag/vim/feed/" rel="self" type="application/rss+xml" />
	<link>http://gustavodutra.com</link>
	<description>Um pouco de tudo, nada de pouco</description>
	<lastBuildDate>Thu, 29 Jul 2010 22:57:57 +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>Como consultar a documentação do PHP direto do Vim</title>
		<link>http://gustavodutra.com/post/365/como-consultar-a-documentacao-do-php-direto-do-vim/</link>
		<comments>http://gustavodutra.com/post/365/como-consultar-a-documentacao-do-php-direto-do-vim/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 20:51:54 +0000</pubDate>
		<dc:creator>Gustavo Dutra</dc:creator>
				<category><![CDATA[Nerd]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[como]]></category>
		<category><![CDATA[exemplo]]></category>
		<category><![CDATA[gvim]]></category>
		<category><![CDATA[man]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[vimrc]]></category>

		<guid isPermaLink="false">http://gustavodutra.com/?p=365</guid>
		<description><![CDATA[Olá! Descobri recentemente que é possível baixar a documentação do PHP no formato do man do UNIX. Isso é muito bom, já que assim, podemos consultar funções com parâmetros, variáveis e exemplos. Melhor, podemos fazer isso direto do Vim.
Eu já tinha lido sobre uma opção do Vim chamada keywordprg, mas nunca havia encontrado uma serventia. [...]]]></description>
			<content:encoded><![CDATA[<p>Olá! Descobri recentemente que é possível baixar a documentação do PHP no formato do man do <strong>UNIX</strong>. Isso é muito bom, já que assim, podemos consultar funções com parâmetros, variáveis e exemplos. Melhor, podemos fazer isso direto do Vim.</p>
<p>Eu já tinha lido sobre uma opção do Vim chamada <a rel="nofollow" href="http://vimdoc.sourceforge.net/htmldoc/options.html#%27keywordprg%27">keywordprg</a>, mas nunca havia encontrado uma serventia. Quando eu li no <a rel="nofollow" href="http://bjori.blogspot.com/2010/01/unix-manual-pages-for-php-functions.html">blog do bjori</a>, realmente me veio à mente como eu poderia utilizá-la.</p>
<p><span id="more-365"></span></p>
<p>Eu instalei a última versão do <strong>pear</strong> aqui, e executei os comandos que ele cita no blog:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pear <span style="color: #c20cb9; font-weight: bold;">install</span> doc.php.net<span style="color: #000000; font-weight: bold;">/</span>pman</pre></div></div>

<p>Eu precisei aumentar a memória do <strong>php.ini</strong> (<em>memory_limit</em>), 32M não foi o suficiente.</p>
<p>O manual será instalado no diretório especificado em &#8220;<em>doc_dir</em>&#8221; da configuração da <strong>pear</strong> e o executável no &#8220;<em>bin_dir</em>&#8220;. Para verificar as configurações atuais:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pear config-show <span style="color: #666666; font-style: italic;"># Mostra todas as configurações atuais</span>
pear config-get bin_dir <span style="color: #666666; font-style: italic;"># Mostra configuração atual da opção bin_dir</span>
pear config-get doc_dir <span style="color: #666666; font-style: italic;"># Mostra configuração atual da opção doc_dir</span>
<span style="color: #666666; font-style: italic;"># Para modificar:</span>
pear config-set bin_dir <span style="color: #000000; font-weight: bold;">/</span>outro<span style="color: #000000; font-weight: bold;">/</span>bin
pear config-set doc_dir <span style="color: #000000; font-weight: bold;">/</span>outro<span style="color: #000000; font-weight: bold;">/</span>docs</pre></div></div>

<p>Depois de instalado, você pode utilizar ele tanto no Vim quanto fora do Vim:</p>

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

<p>Bom, se lembra que eu havia falado sobre o <em>keywordprg</em> ? Assim como o <em>makeprg</em> é o programa executado ao se executa :<em>make</em> no Vim e o <em>grepprg</em> o comando executado ao se executar :<em>[grep|vimgrep]</em>, o <em>keywordprg</em> é executado quando se preciona <strong>K</strong> (k maiúsculo) sobre alguma palavra chave &#8211; que no nosso caso será uma função php.</p>
<p>O artigo citado ali em cima, indica para colocarmos no <strong>.vimrc</strong>, mas eu acho mais interessante por no <strong>.ftplugin/php.vim</strong> (se o arquivo não existir, crie). Assim, só será carregado caso o tipo do arquivo for php, possibilitando utilizar outros programas para outras linguagens</p>

<div class="wp_syntax"><div class="code"><pre class="vimrc" style="font-family:monospace;">&quot; Programa executado quando pressionado K
set keywordprg=pman</pre></div></div>

<p>Agora faça o teste: abra um arquivo php, coloque o cursor sobre alguma função e pressione <em>K</em>. Para fechar o manual aberto, basta precionar <em>q</em>. Pode-se utilizar a busca com <em>/termo</em> e também navegar nos resultados com <em>n/N</em>. <em>j/k/UP/DOWN</em> movem o arquivo para cima e para baixo, normalmente, como se fosse um manpage.</p>
<p>Eai, este post ajudou em algo?</p>
]]></content:encoded>
			<wfw:commentRss>http://gustavodutra.com/post/365/como-consultar-a-documentacao-do-php-direto-do-vim/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Lookahead, Lookbehind e Condicionais em Expressões Regulares</title>
		<link>http://gustavodutra.com/post/348/lookahead-lookbehind-e-condicionais-em-expressoes-regulares/</link>
		<comments>http://gustavodutra.com/post/348/lookahead-lookbehind-e-condicionais-em-expressoes-regulares/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 22:28:29 +0000</pubDate>
		<dc:creator>Gustavo Dutra</dc:creator>
				<category><![CDATA[Nerd]]></category>
		<category><![CDATA[Regex]]></category>
		<category><![CDATA[dicas]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[lookahead]]></category>
		<category><![CDATA[lookbehind]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[re]]></category>
		<category><![CDATA[regular expression]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://gustavodutra.com/?p=348</guid>
		<description><![CDATA[Depois de muito tempo sem postar, me lembrei de algo bem interessante! Vocês podem mandar mensagens na página de contato dando sugestões de temas sobre Vim, Expressões regulares ou outra coisa que vocês gostariam de ver no blog ;p.
Expressões Regulares
Expressão regular é uma ferramenta muito forte para o tratamento de texto. É muito utilizado para [...]]]></description>
			<content:encoded><![CDATA[<p>Depois de muito tempo sem postar, me lembrei de algo bem interessante! Vocês podem mandar mensagens na página de contato dando sugestões de temas sobre <strong>Vim</strong>, <strong>Expressões regulares</strong> ou outra coisa que vocês gostariam de ver no blog ;p.</p>
<h2>Expressões Regulares</h2>
<p><strong>Expressão regular</strong> é uma ferramenta muito forte para o tratamento de texto. É muito utilizado para substituições ou para verificar integridade dos dados, pois, através da <strong>expressão regular</strong>, vulga <strong>regex</strong> ou <strong>re</strong>, pode-se casar padrões de texto. Por exemplo:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/^[a-zA-Z0-9]+$/
Para somente caracteres alfanuméricos.
&nbsp;
/^(\d{3}\.){2}\d{3}-\d{2}$/
Validando formato de CPF.</pre></div></div>

<p>Esse tipo de regex é simples, valida praticamente só os caracteres que compõe uma dada string. Porém, as <em>Perl Compatible Regular Expressions</em> (Expressões Regulares Compatíveis com Perl), também conhecidas como <em>pcre</em>, permitem muito mais, inclusive utilizar condicionados (if&#8217;s), porém isso é para outro post! O que vamos falar agora é de <strong>Lookahead</strong> e <strong>Lookbehind</strong>.</p>
<p><span id="more-348"></span></p>
<h2>Lookahead</h2>
<p><strong>Lookahead</strong> é uma forma de casar strings que tenham ou não um determinado final. É utilizado (?⁼&#8230;) para o positivo, ou seja, que terminem com; e (?!&#8230;) para o negativo, ou seja, que não termina com.</p>
<p>Um exemplo simples, seria a busca, primeiramente, de Gustavo seguido por Dutra. Se existisse Gustavo ou Gustavo Outracoisa, ele não casaria. Ao contrário, o segundo exemplo somente casaria o Gustavo ou o Gustavo Outracoisa, porém não casaria o Gustavo Dutra:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/Gustavo(?= Dutra)/
/Gustavo(?! Dutra)</pre></div></div>

<p>Vamos ver um exemplo mais funcional e complexo em <em>python</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #dc143c;">re</span>.<span style="color: black;">findall</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\s</span>?([^;]+);'</span>, <span style="color: #483d8b;">'Vim Editor; GVim Editor; Firefox Browser; Emacs Editor; Thunderbird Email;'</span><span style="color: black;">&#41;</span>
<span style="color: #808080; font-style: italic;"># output seria:</span>
<span style="color: black;">&#91;</span><span style="color: #483d8b;">'Vim Editor'</span>, <span style="color: #483d8b;">'GVim Editor'</span>, <span style="color: #483d8b;">'Firefox Browser'</span>, <span style="color: #483d8b;">'Emacs Editor'</span>, <span style="color: #483d8b;">'Thunderbird Email'</span><span style="color: black;">&#93;</span></pre></div></div>

<p>Mas e se quisesse somente os editores da lista?</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #dc143c;">re</span>.<span style="color: black;">findall</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\s</span>?([^;]+ Editor);'</span>, <span style="color: #483d8b;">'Vim Editor; GVim Editor; Firefox Browser; Emacs Editor; Thunderbird Email;'</span><span style="color: black;">&#41;</span>
<span style="color: #808080; font-style: italic;"># output seria:</span>
<span style="color: black;">&#91;</span><span style="color: #483d8b;">'Vim Editor'</span>, <span style="color: #483d8b;">'GVim Editor'</span>, <span style="color: #483d8b;">'Emacs Editor'</span><span style="color: black;">&#93;</span></pre></div></div>

<p>Mas e se eu quisesse todos MENOS os editores? É ai que entra o <strong>Lookahead</strong>, vamos pegar todos que não terminam com Editor.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>
<span style="color: #dc143c;">re</span>.<span style="color: black;">findall</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\s</span>?([^;]+ (?!Editor))'</span>, <span style="color: #483d8b;">'Vim Editor; GVim Editor; Firefox Browser; Emacs Editor; Thunderbird Email;'</span><span style="color: black;">&#41;</span>
<span style="color: #808080; font-style: italic;"># output seria:</span>
<span style="color: black;">&#91;</span><span style="color: #483d8b;">'Firefox '</span>, <span style="color: #483d8b;">'Thunderbird '</span><span style="color: black;">&#93;</span></pre></div></div>

<p>Observem que o que casar com (?!Editor) não entra no resultado, para incluí-lo, seria necessário uma expressão regular um pouco mais complexa utilizando condicionais. Veremos isso depois!</p>
<h2>Lookbehind</h2>
<p><strong>Lookbehind</strong> faz o mesmo que o <strong>lookahead</strong>, porém, como o próprio nome diz, não procura depois, mas sim antes, da string dita. (?&lt;=&#8230;) para o positivo e (?&lt;!&#8230;) para o negativo.</p>
<p>Vamos pegar um RT de um tweet do <a rel="nofollow" href="http://twitter.com">twitter.com</a>. Como gosto de ser eclético, vou usar <em>perl</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;RT <span style="color: #000099; font-weight: bold;">\@</span>gustavotkg Testando ERs.&quot;</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">/(?&lt; =@)gustavotkg/</span>
<span style="color: #666666; font-style: italic;"># Output seria:</span>
<span style="color: #cc66cc;">1</span></pre></div></div>

<p>Essa expressão retorna 1 (ou seja, TRUE), caso exista algum gustavotkg precedido por uma @.</p>
<p>OBS: @ são escapadas porque representam variáveis do tipo array em perl.</p>
</pre>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;Este é um RT <span style="color: #000099; font-weight: bold;">\@</span>gustavotkg Testando ERs.&quot;</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">/(?&lt; !RT )\@gustavotkg/</span>
<span style="color: #666666; font-style: italic;"># Output seria, vazio, pois o @gustavotkg é precedido por um RT</span>
&nbsp;
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;RT <span style="color: #000099; font-weight: bold;">\@</span>gustavotkg2 também estou testando ERs.&quot;</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">/(?&lt;!^RT \@gustavotkg\b)(.+)$/</span>
<span style="color: #666666; font-style: italic;"># Output seria:</span>
RT <span style="color: #0000ff;">@gustavotkg2</span> també<span style="color: #000066;">m</span> estou testando ERs<span style="color: #339933;">.</span></pre></div></div>

<p>O <em>\b</em> significa borda de palavra (espaço, ponto final, exclamação, final de linha, etc). Como 2 não é uma borda de palavra, pois a expressão regular diz o seguinte: <em>"Case com tudo que não começar com RT @gustavotkg seguido de uma borda de palavra"</em>.</p>
<h2>Condicionais</h2>
<p>Como se pode notar nos casos acima, os operadores de lookahead e lookbehind não colocam o valor casado junto ao resultado final. Para isso temos que verificar condicionalmente e adicionar manualmente o valor. A sintaxe é esta: <strong>(?(condicao)(caso verdadeiro)|(caso falso)).</strong></p>
<p>Parece complicado, mas é bem simples, vamos começar com algo fácil utilizando php:</p>
</pre>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/(?(?&lt; =@)\w+|\w{2})/&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;@testando&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$r</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$r</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;"># Output seria:
</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span> string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;testando&quot;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/(?(?&lt; =@)\w+|\w{2})/&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;testando&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$r</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$r</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;"># Output seria:
</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span> string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;te&quot;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Notem o condicional: Se começar (<strong>lookbehind</strong>) com @, então quero que case toda a palavra que segue o @, caso contrário, quero apenas os dois primeiros caracteres. Fácil? Vamos complicar!</p>
<p>Lembra do exemplo mais acima do <strong>lookahead</strong>? Vou refrescar a memória:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>
<span style="color: #dc143c;">re</span>.<span style="color: black;">findall</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\s</span>?([^;]+ (?!Editor))'</span>, <span style="color: #483d8b;">'Vim Editor; GVim Editor; Firefox Browser; Emacs Editor; Thunderbird Email;'</span><span style="color: black;">&#41;</span>
<span style="color: #808080; font-style: italic;"># output seria:</span>
<span style="color: black;">&#91;</span><span style="color: #483d8b;">'Firefox '</span>, <span style="color: #483d8b;">'Thunderbird '</span><span style="color: black;">&#93;</span></pre></div></div>

<p>Notem que ela não adicionar a categoria do Firefox nem do Thunderbird, pois o (?!) como supracitado, não é colocado junto no resultado final. Para adicioná-los, podemos usar o condicional.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/(\w+ (?(?!Editor)\w+));/&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;Vim Editor; GVim Editor; Firefox Browser; Emacs Editor; Thunderbird Email;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Output seria:</span>
<span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
    string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;Firefox Browser;&quot;</span>
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
    string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">18</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;Thunderbird Email;&quot;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
    string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">15</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;Firefox Browser&quot;</span>
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
    string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">17</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;Thunderbird Email&quot;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Ou seja, no segundo índice do array, que na verdade é o indice 1, consta o resultado pego. Veja que utilizamos o seguinte método: Se \w+ não for seguido de 'Editor' então pega o \w+, senão ignora pois não é para casar. Assim, se for Editor, ele nunca irá casar.</p>
<p><strong>Dúvidas? Sugestões? Deixe um comentário!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://gustavodutra.com/post/348/lookahead-lookbehind-e-condicionais-em-expressoes-regulares/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>50 Cheat Sheets e Quick Refs para salvar sua pele</title>
		<link>http://gustavodutra.com/post/336/50-cheat-sheets-e-quick-refs-para-salvar-sua-pele/</link>
		<comments>http://gustavodutra.com/post/336/50-cheat-sheets-e-quick-refs-para-salvar-sua-pele/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 17:46:11 +0000</pubDate>
		<dc:creator>Gustavo Dutra</dc:creator>
				<category><![CDATA[Dicas]]></category>
		<category><![CDATA[Nerd]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[bash script]]></category>
		<category><![CDATA[bazaar]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[cheat sheets]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[gvim]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[latex]]></category>
		<category><![CDATA[mercurial]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[regular expression]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://gustavodutra.com/?p=336</guid>
		<description><![CDATA[Estou disponibilizando algumas Cheat Sheets que estavam nos meus favoritos. Sempre são úteis em algum momento!!! Espero que aproveitem pelo menos 1 delas!
Controle de Versão

SVN Cheat Sheet
Git Cheat Sheet
Mercurial Cheat Sheet
Bazaar Cheat Sheet

Frameworks

Prototype Cheat Sheet
MooTools Cheat Sheet
jQuery Cheat Sheet
Ruby On Rails
Django Cheat Sheet
CodeIgniter Cheat Sheet
CakePHP Cheat Sheet
Mais de 12 Symfony Cheat Sheets

Programação

Bash Script Quick Refences
AWK [...]]]></description>
			<content:encoded><![CDATA[<p>Estou disponibilizando algumas Cheat Sheets que estavam nos meus favoritos. Sempre são úteis em algum momento!!! Espero que aproveitem pelo menos 1 delas!</p>
<h2>Controle de Versão</h2>
<ul>
<li><a rel="nofollow" href="http://www.cs.put.poznan.pl/csobaniec/Papers/svn-refcard.pdf">SVN Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://ktown.kde.org/%7Ezrusin/git/git-cheat-sheet-large.png">Git Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://edong.net/2008v1/docs/dongwoo-Hg-PDF.pdf">Mercurial Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://doc.bazaar-vcs.org/latest/en/_static/en/bzr-en-quick-reference.png">Bazaar Cheat Sheet</a></li>
</ul>
<h2>Frameworks</h2>
<ul>
<li><a rel="nofollow" href="http://thinkweb2.com/projects/prototype/downloads/Prototype%20Cheat%20Sheet%201.6.0.2">Prototype Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://mediavrog.net/blog/wp-content/uploads/2008/08/mootools-12-cheat-sheet-pf.pdf">MooTools Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://www.cheat-sheets.org/saved-copy/Jquery-Cheat-Sheet-1.2.pdf">jQuery Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://www.addedbytes.com/cheat-sheets/download/ruby-on-rails-cheat-sheet-v1.pdf">Ruby On Rails</a></li>
<li><a rel="nofollow" href="http://www.mercurytide.co.uk/media/whitepapers/django-cheat-sheet/django10-cheat-sheet.pdf">Django Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://codeigniter-1-7-1-quick-reference-cheatsheet.googlecode.com/files/CodeIgniter_Cheatsheet_DesignFellow_v2.zip">CodeIgniter Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://cakephp.org/files/Resources/CakePHP-1.2-Cheatsheet.pdf">CakePHP Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://trac.symfony-project.org/wiki/CheatSheets">Mais de 12 Symfony Cheat Sheets</a></li>
</ul>
<h2>Programação</h2>
<ul>
<li><a rel="nofollow" href="http://www.cheat-sheets.org/saved-copy/bash_ref.pdf">Bash Script Quick Refences</a></li>
<li><a rel="nofollow" href="http://www.cheat-sheets.org/image/saved.copy.gif">AWK Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://www.cheat-sheets.org/saved-copy/HTML5_Canvas_Cheat_Sheet.png">HTML5 Canvas Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://www.cheat-sheets.org/saved-copy/php_cheat_sheet.png">PHP Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://www.zenspider.com/Languages/Ruby/QuickRef.html">Ruby Quick Refence</a></li>
<li><a rel="nofollow" href="http://www.scottklarr.com/topic/106/perl-cheat-sheets/">9 Perl Cheat Sheets</a></li>
<li><a rel="nofollow" href="http://rgruet.free.fr/PQR24/PQR2.4.html">Python Quick Refence</a></li>
<li><a rel="nofollow" href="http://www.addedbytes.com/cheat-sheets/regular-expressions-cheat-sheet/">Regular Expression Cheat Sheet</a></li>
</ul>
<h2>Web Design</h2>
<ul>
<li><a rel="nofollow" href="http://www.reeddesign.co.uk/test/points-pixels.html">Font Size Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://www.blooberry.com/indexdot/css/propindex/all.htm">Propriedades CSS</a></li>
<li><a rel="nofollow" href="http://www.addedbytes.com/cheat-sheets/html-character-entities-cheat-sheet/">HTML Char Entities Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://www.scottklarr.com/topic/114/designers-color-chart-cheat-sheets/">6 Design Colors Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://www.seomoz.org/user_files/SEO_Web_Developer_Cheat_Sheet.pdf">SEO Web Developer Cheat Sheet</a></li>
</ul>
<h2>Bancos de Dados</h2>
<ul>
<li><a rel="nofollow" href="http://www.xml.dvint.com/docs/SchemaStructuresQR-2.pdf">XML Schema Structure Quick Refence</a></li>
<li><a rel="nofollow" href="http://www.cheat-sheets.org/saved-copy/MySQL_QuickRef.pdf">MySQL Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://www.alberton.info/downloads/postgresql-cheat-sheet.png">PostgreSQL Cheat Sheet</a></li>
</ul>
<h2>Ferramentas</h2>
<ul>
<li><a rel="nofollow" href="http://www.google.com/help/cheatsheet.html">Google Search Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://duvet-dayz.com/firebug-cheatsheet/">Firebug Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://www.cheat-sheets.org/saved-copy/dhffkc6q_97fsjrgmd7.gif">Vimperator Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://www.cheat-sheets.org/saved-copy/latexsheet-0.png">LaTeX Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://www.cheat-sheets.org/saved-copy/vim-cheatsheet.png">Vim Cheat Sheet</a></li>
<li><a rel="nofollow" href="http://www.cheat-sheets.org/saved-copy/vimqrc.html">Vim Quick Refence</a></li>
<li><a rel="nofollow" href="http://www.addedbytes.com/cheat-sheets/mod_rewrite-cheat-sheet/">mod_rewirte Cheat Sheet</a></li>
</ul>
<p>Alguma que eu tenha esquecido? Posta ae nos comentários!</p>
]]></content:encoded>
			<wfw:commentRss>http://gustavodutra.com/post/336/50-cheat-sheets-e-quick-refs-para-salvar-sua-pele/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Tchelinux 2009 &#8211; Porto Alegre</title>
		<link>http://gustavodutra.com/post/309/tchelinux-2009-porto-alegre/</link>
		<comments>http://gustavodutra.com/post/309/tchelinux-2009-porto-alegre/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 15:28:29 +0000</pubDate>
		<dc:creator>Gustavo Dutra</dc:creator>
				<category><![CDATA[Nerd]]></category>
		<category><![CDATA[Software Livre]]></category>
		<category><![CDATA[aumentar produtivade]]></category>
		<category><![CDATA[dicas]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[palestra]]></category>
		<category><![CDATA[porque]]></category>
		<category><![CDATA[produtividade]]></category>
		<category><![CDATA[tchelinux]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://gustavodutra.com/?p=309</guid>
		<description><![CDATA[Para quem é do Sul, estarei em Porto Alegre no dia 14/11/2009 ministrando duas palestras no evento Tchelinux. A programação tem mais de 60 palestras sobre diversos temas e a entrada é apenas 2kg de alimentos não perecíveis. Aqueles que participarem recebem um atestado de 10h para usar como atividade complementar.
Para mais informações http://www.tchelinux.org/2009. As [...]]]></description>
			<content:encoded><![CDATA[<p>Para quem é do Sul, estarei em Porto Alegre no dia 14/11/2009 ministrando duas palestras no evento <a rel="nofollow" href="http://www.tchelinux.org">Tchelinux</a>. A programação tem mais de 60 palestras sobre diversos temas e a entrada é apenas 2kg de alimentos não perecíveis. Aqueles que participarem recebem um atestado de 10h para usar como atividade complementar.</p>
<p>Para mais informações <a rel="nofollow" href="http://www.tchelinux.org/2009">http://www.tchelinux.org/2009</a>. As palestras serão:</p>
<h3>VIM-de a mim, produtividade</h3>
<p>Uma palestra que mostra maneiras para um edição de texto efetiva e rápida usando o vim.</p>
<h3>jQuery &#8211; Introdução</h3>
<p>Apresenta o porquê do jQuery ser um excelente framework para desenvolvimento rápido com javascript.</p>
<p>Se alguém tiver assistido a alguma palestra, favor dar um feedback!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://gustavodutra.com/post/309/tchelinux-2009-porto-alegre/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Buscas eficientes no Vim com vimgrep</title>
		<link>http://gustavodutra.com/post/296/buscas-eficientes-no-vim-com-vimgrep/</link>
		<comments>http://gustavodutra.com/post/296/buscas-eficientes-no-vim-com-vimgrep/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 20:23:37 +0000</pubDate>
		<dc:creator>Gustavo Dutra</dc:creator>
				<category><![CDATA[Dicas]]></category>
		<category><![CDATA[Nerd]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[aumentar produtivade]]></category>
		<category><![CDATA[busca]]></category>
		<category><![CDATA[dicas]]></category>
		<category><![CDATA[exemplo]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[gvim]]></category>
		<category><![CDATA[produtividade]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[vimgrep]]></category>

		<guid isPermaLink="false">http://gustavodutra.com/?p=296</guid>
		<description><![CDATA[A busca efetiva pode ajudar muito, caso bem usada, tanto no ganho de tempo como na efeciência de substituições ou refactories. Seguem alguns outros exemplos de finalidades para a busca utilizando o Vim:

Certeza de encontrar todas as incidências
Ficam visualmente destacadas (com :set hlsearch)
Testar substituições
Verificar a ortografia atrás de erros de digitação
Encontrar variáveis ou funções não [...]]]></description>
			<content:encoded><![CDATA[<p>A busca efetiva pode ajudar muito, caso bem usada, tanto no ganho de tempo como na efeciência de substituições ou refactories. Seguem alguns outros exemplos de finalidades para a busca utilizando o Vim:</p>
<ul>
<li>Certeza de encontrar todas as incidências</li>
<li>Ficam visualmente destacadas (com :set hlsearch)</li>
<li>Testar substituições</li>
<li>Verificar a ortografia atrás de erros de digitação</li>
<li>Encontrar variáveis ou funções não utilizadas, só declaradas</li>
<li>Encontrar rapidamente algum termo</li>
<li>Verificar a existência de algum termo</li>
</ul>
<p>Além da conhecida / (barra) para buscar, existe o :vimgrep. É dele que quero falar.</p>
<p><span id="more-296"></span></p>
<h2>Vimgrep</h2>
<h3>Comando</h3>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #000000;">:</span>vim<span style="color: #000000;">&#91;</span>grep<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">!</span><span style="color: #000000;">&#93;</span> <span style="color: #000000;">/</span><span style="color: #000000;">&#123;</span>pattern<span style="color: #000000;">&#125;</span><span style="color: #000000;">/</span><span style="color: #000000;">&#91;</span>g<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>j<span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#123;</span>files<span style="color: #000000;">&#125;</span></pre></div></div>

<ul>
<li>Busca inscidências de <em>pattern</em> nos <em>files</em> listados.</li>
<li><em>pattern</em> pode ser uma expressão regular ou não</li>
<li>A exclamação (<em>!</em>) ignora as alterações já feita no arquivo atual</li>
<li><em>g</em> procura por todas as inscidências, não só a primeira, em cada arquivo</li>
<li><em>j</em> pula para o primeiro resultado ao executar o comando</li>
<li><em>files</em> podem conter <em>wildcards</em>, como *, ? e **</li>
<li>Os resultados são abertos na <strong>quickfix list</strong></li>
</ul>
<h3>Exemplos</h3>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #000000;">:</span>vimgrep<span style="color: #000000;">!</span> <span style="color: #000000;">/$</span>var<span style="color: #000000;">/</span> arquivo<span style="color: #000000;">.</span>pl</pre></div></div>

<p>Pesquisa pela primeira inscidência de $var no arquivo.pl</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #000000;">:</span>vimgrep <span style="color: #000000;">/</span>texto<span style="color: #000000;">/</span> <span style="color: #000000;">*.</span>rb</pre></div></div>

<p>Busca por <em>texto</em> em todos os arquivos com a extensão .rb do diretório atual (para descobrir qual o diretório atual, use :pwd. Para mudar :cd <em>dir</em>)</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #000000;">:</span>vimgrep <span style="color: #000000;">/</span>TeXtO<span style="color: #000000;">/</span> <span style="color: #000000;">*.</span>py dir<span style="color: #000000;">/*.</span>py</pre></div></div>

<p>Busca com case-sensitive em todos os arquivos .py do diretório atual e dos dentro do diretório dir/.</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #000000;">:</span>vimgrep <span style="color: #000000;">/</span>minhaFuncao<span style="color: #000000;">/</span>g <span style="color: #000000;">**/*.</span>c</pre></div></div>

<p>Busca recursiva dentro da árvore de diretórios do diretório atual cuja extensão seja .c</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #000000;">:</span>vimgrep <span style="color: #000000;">/&lt;</span> \<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">^</span> <span style="color: #000000;">&#93;</span>\<span style="color: #000000;">+</span>\<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">^&gt;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">*&gt;.</span>\<span style="color: #000000;">+&lt;</span> \<span style="color: #000000;">/</span>\<span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&gt;/</span> <span style="color: #25BB4D;">index</span><span style="color: #000000;">.</span>html</pre></div></div>

<p>Busca usando expressões regulares também são permitidas!</p>
<h2>Navegando na QuickFix List</h2>
<ul>
<li>:copen</li>
<li>:cfirst</li>
<li>:cprevious</li>
<li>:cnext</li>
<li>:clast</li>
<li>:cclose</li>
</ul>
<p>Como nosso foco é a eficiência, podemos criar mapeamentos para andar pela quickfix list!</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #25BB4D;">map</span> <span style="color: #000000;">&lt;</span>F9<span style="color: #000000;">&gt;</span> <span style="color: #000000;">:</span>copen<span style="color: #000000;">&lt;</span>CR<span style="color: #000000;">&gt;</span>
<span style="color: #25BB4D;">map</span> <span style="color: #000000;">&lt;</span>F10<span style="color: #000000;">&gt;</span> <span style="color: #000000;">:</span>cclose<span style="color: #000000;">&lt;</span>CR<span style="color: #000000;">&gt;</span>
<span style="color: #25BB4D;">map</span> <span style="color: #000000;">&lt;</span>A<span style="color: #000000;">-</span>j<span style="color: #000000;">&gt;</span> <span style="color: #000000;">:</span>cnext<span style="color: #000000;">&lt;</span>CR<span style="color: #000000;">&gt;</span>
<span style="color: #25BB4D;">map</span> <span style="color: #000000;">&lt;</span>A<span style="color: #000000;">-</span>k<span style="color: #000000;">&gt;</span> <span style="color: #000000;">:</span>cprevious<span style="color: #000000;">&lt;</span>CR<span style="color: #000000;">&gt;</span></pre></div></div>

<div id="attachment_305" class="wp-caption aligncenter" style="width: 546px"><a href="http://gustavodutra.com/wp-content/uploads/2009/11/vimgrep1.jpg"><img src="http://gustavodutra.com/wp-content/uploads/2009/11/vimgrep1.jpg" alt="Exemplo de uso do vimgrep" title="Exemplo de uso do vimgrep" width="536" height="875" class="size-full wp-image-305" /></a><p class="wp-caption-text">Exemplo de uso do vimgrep</p></div>
<h2>Conclusão</h2>
<p>Esse recurso não parece ser muito abordado por ai, mas é extremamente importante. Seja criativo e descubra onde melhor usar o :vimgrep! Tenho certeza de que vai lhe ajudar! E quando encontrar, comente ai!</p>
]]></content:encoded>
			<wfw:commentRss>http://gustavodutra.com/post/296/buscas-eficientes-no-vim-com-vimgrep/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Usando Screen e Vim para Pair Programming remoto</title>
		<link>http://gustavodutra.com/post/276/usando-screen-e-vim-para-pair-programming-remoto/</link>
		<comments>http://gustavodutra.com/post/276/usando-screen-e-vim-para-pair-programming-remoto/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 22:09:59 +0000</pubDate>
		<dc:creator>Gustavo Dutra</dc:creator>
				<category><![CDATA[Dicas]]></category>
		<category><![CDATA[Engenharia de Software]]></category>
		<category><![CDATA[Nerd]]></category>
		<category><![CDATA[Software Livre]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[dicas]]></category>
		<category><![CDATA[engenharia de software]]></category>
		<category><![CDATA[extreme programming]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[open-source]]></category>
		<category><![CDATA[pair programming]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[skype]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[xp]]></category>

		<guid isPermaLink="false">http://gustavodutra.com/?p=276</guid>
		<description><![CDATA[Bem, é notável o crescimento das metodologias ágeis de desenvolvimento de software. Uma das práticas que me agrada muito, é a programação em pares (pair programming). É bem perceptível, a um longo prazo, a diferença que faz essa prática. Navegando pela internet, como um marujo sem rumo, encontrei um post falando sobre Remote Pair Programming. [...]]]></description>
			<content:encoded><![CDATA[<p>Bem, é notável o crescimento das <strong>metodologias ágeis de desenvolvimento de software</strong>. Uma das práticas que me agrada muito, é a programação em pares (<em>pair programming</em>). É bem perceptível, a um longo prazo, a diferença que faz essa prática. Navegando pela internet, como um marujo sem rumo, encontrei um post falando sobre <em>Remote Pair Programming</em>. Parece meio estranho, porque o XP (<a rel="nofollow" href="http://www.extremeprogramming.org/">eXtreme Programming</a>) faz alusão a uma dupla programar em um único computador, com um único teclado e um único mouse.<br />
<span id="more-276"></span><br />
Então, vamos tentar simular este ambiente utilizando 4 ferramentas simples:</p>
<ul>
<li>screen</li>
<li>ssh</li>
<li>vim</li>
<li>skype</li>
</ul>
<p>Destas, só o <em>skype</em> não é <em>open-source</em>. Mas é interessante manter uma conversa verbal, pois conversas escritas podem desviar o foco da programação, que é bem mais rápida e precisa do que a escrita, que pode deixar brechas para má interpretações. A conversa verbal consegue interromper o programador ao mesmo tempo em que escreve, corrigindo-o ou questionando-o.</p>
<p>Conectados no skype, basta decidir em qual máquina será o desenvolvimento. Esta, por sua vez, terá que ter um servidor <strong>ssh</strong>. Ela será o <em>host</em> da programação. Será necessário, também, nesta máquina, ter instalado o <em>screen</em>, que é um programa que possibilita criar &#8217;sessões&#8217; no terminal.</p>
<h2>Host</h2>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">screen</span> <span style="color: #660033;">-S</span> PairProgramming</pre></div></div>

<p>Parece que nada mudou, mas você está numa sessão do <strong>screen</strong> chamada <em>PairProgramming</em>.</p>
<p>Precione CTRL+a e digite:</p>

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

<p>Pressione CTRL+a novamente e digite:</p>

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

<p>Tudo que você ver nesta sessão, será visto pelo outro usuário (<em>usuarioclient</em>) que se conectará nela.</p>
<p>Então, abra o <strong>vim</strong>, pois será necessário um edito de textos de verdade <img src='http://gustavodutra.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> , e se divirta:</p>

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

<h2>Client</h2>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> usuarioclient<span style="color: #000000; font-weight: bold;">@</span>host
<span style="color: #c20cb9; font-weight: bold;">screen</span> <span style="color: #660033;">-x</span> usuariohost<span style="color: #000000; font-weight: bold;">/</span>PairProgramming</pre></div></div>

<p>Pronto! Agora você está acessando a mesma seção! Tudo que o <em>usuáriohost</em> fizer, o <em>usuárioclient</em> enxergará e <strong>vice-versa</strong>.</p>
<p>Agora, basta descutir a tarefa via Skype e programar. As atualizações são em tempo real, ou seja, aparecem ao mesmo tempo que são escritos, digo&#8230; depende da conexão, mas não é um grande problema.</p>
<p>Caso seja necessário que o usuarioclient não possa modificar o código, apenas assitir e dar pitacos, o usuáriohost deve pressionar CTRL+A e digitar:</p>
<pre>:aclchg usuarioclient -w #</pre>
<p>Eu ainda vou programar assim, depois digo a experiência.</p>
<h2>Referências</h2>
<ul>
<li><a rel="nofollow" href="http://www.linux.com/archive/feature/56443">Linux.com</a></li>
<li><a rel="nofollow" href="http://haruska.com/2009/09/29/remote-pair-programming/">Jason Haruska</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://gustavodutra.com/post/276/usando-screen-e-vim-para-pair-programming-remoto/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Vim e suas gerações</title>
		<link>http://gustavodutra.com/post/267/vim-e-suas-geracoes/</link>
		<comments>http://gustavodutra.com/post/267/vim-e-suas-geracoes/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 18:15:23 +0000</pubDate>
		<dc:creator>Gustavo Dutra</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[Nerd]]></category>
		<category><![CDATA[camisas]]></category>
		<category><![CDATA[gvim]]></category>
		<category><![CDATA[t-shirt]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://gustavodutra.com/?p=267</guid>
		<description><![CDATA[Vim, um editor para todos.
]]></description>
			<content:encoded><![CDATA[<p>Vim, um editor para todos.</p>

<a href='http://gustavodutra.com/post/267/vim-e-suas-geracoes/vim_manl/' title='Vim Man'><img width="150" height="150" src="http://gustavodutra.com/wp-content/uploads/2009/10/vim_manl-150x150.jpg" class="attachment-thumbnail" alt="Vim Man" title="Vim Man" /></a>
<a href='http://gustavodutra.com/post/267/vim-e-suas-geracoes/vim_nerd/' title='Vim Nerd'><img width="150" height="150" src="http://gustavodutra.com/wp-content/uploads/2009/10/vim_nerd-150x150.jpg" class="attachment-thumbnail" alt="Vim Nerd" title="Vim Nerd" /></a>
<a href='http://gustavodutra.com/post/267/vim-e-suas-geracoes/vim_boy/' title='Vim Boy'><img width="150" height="150" src="http://gustavodutra.com/wp-content/uploads/2009/10/vim_boy-150x150.jpg" class="attachment-thumbnail" alt="Vim Boy" title="Vim Boy" /></a>
<a href='http://gustavodutra.com/post/267/vim-e-suas-geracoes/vim_woman/' title='Vim Woman'><img width="150" height="150" src="http://gustavodutra.com/wp-content/uploads/2009/10/vim_woman-150x150.jpg" class="attachment-thumbnail" alt="Vim Woman" title="Vim Woman" /></a>
<a href='http://gustavodutra.com/post/267/vim-e-suas-geracoes/vim_kid/' title='Vim Kid'><img width="150" height="150" src="http://gustavodutra.com/wp-content/uploads/2009/10/vim_kid-150x150.jpg" class="attachment-thumbnail" alt="Vim Kid" title="Vim Kid" /></a>

]]></content:encoded>
			<wfw:commentRss>http://gustavodutra.com/post/267/vim-e-suas-geracoes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Usando Vim dentro do Eclipse</title>
		<link>http://gustavodutra.com/post/257/usando-vim-dentro-do-eclipse/</link>
		<comments>http://gustavodutra.com/post/257/usando-vim-dentro-do-eclipse/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 11:43:36 +0000</pubDate>
		<dc:creator>Gustavo Dutra</dc:creator>
				<category><![CDATA[Nerd]]></category>
		<category><![CDATA[Software Livre]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[vimrc]]></category>

		<guid isPermaLink="false">http://gustavodutra.com/?p=257</guid>
		<description><![CDATA[Pois é, quem nunca mexeu com java que atire a primeira pedra. Trabalhar com java fora de um IDE é realmente muito ruim. Mas deveria eu criar uma IDE em modo texto para o Vim ou ver alguma solução para o meu problema no google? 
Eu já sabia da existência, mas nunca tinha visto um [...]]]></description>
			<content:encoded><![CDATA[<p>Pois é, quem nunca mexeu com java que atire a primeira pedra. Trabalhar com java fora de um IDE é realmente muito ruim. Mas deveria eu criar uma IDE em modo texto para o Vim ou ver alguma solução para o meu problema no <a rel="nofollow" href="http://google.com" target="_blank">google</a>? </p>
<p>Eu já sabia da existência, mas nunca tinha visto um motivo para fazê-lo. Trata-se do vim ou gvim dentro do Eclipse. Alguns motivos que me tentaram a usá-lo:</p>
<ul>
<li>Compilar é muito mais simples no eclipse.</li>
<li>Achar arquivos em pacotes é mais fácil com o Project Browser</li>
<li>Pode-se utilizar outros plugins do Eclipse, como o de modelagem pra Swing, AWT, etc</li>
<li>Integração com o SVN</li>
</ul>
<p><span id="more-257"></span></p>
<h2>Instalação</h2>
<p>A instalação está descrita no próprio site do <a rel="nofollow" href="http://vimplugin.org" target="_blank">Vimplugin</a>, e pode ser encontrada em <a rel="nofollow" href="http://vimplugin.org/installation" target="_blank">http://vimplugin.org/installation</a>.</p>
<p>Na configuração, ignore o campo de porta e senha, deixe como está. Apenas passe o caminho para o vim (geralmente <em>/usr/bin/vim</em> ou <em>/usr/bin/gvim</em>) e marque a opção &#8220;Embed vim to eclipse&#8221;. Pois se ela não estiver marcada, o vim é aberto externamente. Com o gvim, ao invés do vim, o eclipse coloca até os menus e toolbars, caso não estejam escondidos com o <strong>guioptions</strong>.</p>
<p>Pelo fato de se poder especificar argumentos opcionais para o vim, é possível fazer um .vimrc específico para utilização com o Eclipse. Muito útil.</p>
<h2>Utilização</h2>
<p>Para abrir um arquivo pelo vim: Botão direito sobre o arquivo > Open with > Vim.</p>
<p>Todas as funcionalidades estão presentes. Só não consegui fazer funcionar o <em>DELETE</em>, tem que ser no <em>backspace</em> ou <em>x</em>. Pode-se abrir vários arquivos em buffers e/ou abas, usar macros e substituições por expressões regulares, igual como quando independente.</p>
<h2>Conclusão</h2>
<p>Ainda prefiro o (g)vim sozinho, é mais leve e prático. Mas convenhamos, para java, talvez essa realmente seja a melhor opção. Alguém tem crítica sobre outros plugins?</p>
]]></content:encoded>
			<wfw:commentRss>http://gustavodutra.com/post/257/usando-vim-dentro-do-eclipse/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Criando apresentações Power Point pelo Vim</title>
		<link>http://gustavodutra.com/post/229/criando-apresentacoes-power-point-pelo-vim/</link>
		<comments>http://gustavodutra.com/post/229/criando-apresentacoes-power-point-pelo-vim/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 21:56:13 +0000</pubDate>
		<dc:creator>Gustavo Dutra</dc:creator>
				<category><![CDATA[Dicas]]></category>
		<category><![CDATA[Nerd]]></category>
		<category><![CDATA[Software Livre]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[aumentar produtivade]]></category>
		<category><![CDATA[como]]></category>
		<category><![CDATA[dicas]]></category>
		<category><![CDATA[gvim]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[openoffice]]></category>
		<category><![CDATA[power point]]></category>
		<category><![CDATA[produtividade]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[vimrc]]></category>

		<guid isPermaLink="false">http://gustavodutra.com/?p=229</guid>
		<description><![CDATA[Essa semana eu precisei de uma apresentação Power Point. Abri o Impress, o editor de apresentações do OpenOffice. Comecei meu raciocínio sobre a apresentação. Quando me dei conta, estava colocando negrito e identando um parágrafo. Ao reler o parágrafo, havia 3 erros de gramática. Foi a gota d&#8217;água: Não consigo criar apresentações, pensei.
Quando eu vou [...]]]></description>
			<content:encoded><![CDATA[<p>Essa semana eu precisei de uma apresentação Power Point. Abri o Impress, o editor de apresentações do OpenOffice. Comecei meu raciocínio sobre a apresentação. Quando me dei conta, estava colocando negrito e identando um parágrafo. Ao reler o parágrafo, havia 3 erros de gramática. Foi a gota d&#8217;água: Não consigo criar apresentações, pensei.</p>
<p>Quando eu vou escrever em algum programa de qualquer suíte de escritório &#8211; openoffice, koffice, etc -, eu geralmente me preocupo mais com o negrito da palavra, com identação do parágrafo do que com o conteúdo em si. Isso é um pecado.</p>
<p>Meu primeiro instinto foi: vou escrever tudo no Vim, depois colo no Impress. Boa! Ok, mas e quanto às páginas?<br />
Vou ter que por página por página? Ainda sim eu teria mais trabalho. Eu teria que refazer as listas para que ficassem com as &#8220;bolinhas&#8221; à esquerda. E teria que modificar todos os títulos para negrito?</p>
<p><span id="more-229"></span></p>
<p>Fui pro google e achei um plugin que já conhecia no resultado: <a rel="nofollow" href="http://www.vimoutliner.org/">VimOutliner</a>. Ele dita uma sintaxe muito intuitiva para hierarquisar (existe esse verbo?) o conteúdo. Algo assim:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Título do documento
&nbsp;
Tópico Nível 1
	Tópico Nível 2
	: Parágrafo com alinhamento justify
	; Parágrafo fica do jeito que foi escrito
	- Item de lista
	+ Item de lista numérica</pre></div></div>

<p>O plugin vem com documentação e um shell script que instala automaticamente o plugin. O site tem toda documentação, é bem simples.</p>
<p>Em <a rel="nofollow" href="http://perens.com/FreeSoftware/Outline/">http://perens.com/FreeSoftware/Outline/</a> é possível encontrar vários scripts que convertem o documento para outros formatos. Um deles é o vo2odp.rb, um script em ruby para converter arquivos para o OpenOffice Presentation.</p>
<p>Pra fazê-lo rodar, eu sofri um pouquinho. Tive que instalar o ruby (obviamente) e o rubygems. Depois de instalado:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ gem install builder
$ gem install rubyzip</pre></div></div>

<p>Também alterei o script, segue o patch das modificações:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">29,30c29,30
&lt; require_gem 'builder'
&lt; require_gem 'rubyzip'
---
&gt; require 'builder'
&gt; require 'zip/zip'</pre></div></div>

<p>Copie o trecho acima em um arquivo, por exemplo: /tmp/patch_vo2odp, depois execute</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ patch /caminho/para/vo2odp.rb &lt; /tmp/patch_vo2odp</pre></div></div>

<p>Pronto, agora só escrever sua apresentação. Lembre-se que o plugin tem uma extenção própria, a .otl. Sempre que um arquivo for aberto com esta extenção, o Vim irá carregar o syntax highlight apropriado e algumas outras opções para melhor escrever sua apresentação.</p>
<p>Concluída a apresentação, você pode usar</p>
</pre>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ ruby /caminho/para/vo2odp.rb apresentacao.otl apresentacao.odp</pre></div></div>

<p>Abra com o OpenOffice e salve como .ppt. Pronto! Você acabou de fazer sua apresentação no PowerPoint pelo Vim.</p>
<h3>Observações importantes</h3>
<ul>
<li>O script não quebra as páginas dos slides automaticamente. É separado por capítulos de nível 1. Então, não escreva coisas muito longas dentro de um nível. Lembre-se que é uma apresentação e não um documento de texto.</li>
<li>Quando aberto no OpenOffice, use o negrito, sublinhado, coloque imagens, etc. Crie seu layout e não pense nisso durante a criação do conteúdo. Escreva antes e formate depois</li>
</ul>
<p>E isso ai! Gostou? Não? Comente! Dê dicas e sugestões!</p>
]]></content:encoded>
			<wfw:commentRss>http://gustavodutra.com/post/229/criando-apresentacoes-power-point-pelo-vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vimperator, comportamento do Vim no Firefox</title>
		<link>http://gustavodutra.com/post/175/vimperator-comportamento-do-vim-no-firefox/</link>
		<comments>http://gustavodutra.com/post/175/vimperator-comportamento-do-vim-no-firefox/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 02:47:37 +0000</pubDate>
		<dc:creator>Gustavo Dutra</dc:creator>
				<category><![CDATA[Vimperator]]></category>
		<category><![CDATA[archlinux]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[produtividade]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://gustavodutra.com/?p=175</guid>
		<description><![CDATA[De um tempo para cá tenho tentando chutar o mouse longe e usar só o teclado, na medida do possível. Culpa do Enygmata, que me mostrou o awesome, um gerenciador de janelas supimpa (que me pareceu 10x melhores que o ion-3), e o vimperator, que adiciona as funcionalidades do Vim no Firefox.O pior é que [...]]]></description>
			<content:encoded><![CDATA[<p>De um tempo para cá tenho tentando chutar o mouse longe e usar só o teclado, na medida do possível. Culpa do <a rel="nofollow" href="http://enygmata.c2zlabs.com/">Enygmata</a>, que me mostrou o <a rel="nofollow" href="http://awesome.naquadah.org/">awesome</a>, um gerenciador de janelas supimpa (que me pareceu 10x melhores que o ion-3), e o vimperator, que adiciona as funcionalidades do Vim no Firefox.O pior é que estou conseguindo!</p>
<p>Parece radical, mas a produtividade aumenta, de certo modo. Não só na hora de programar e testar, sempre que edito arquivos no Vim, tento não usar o mouse. Claro que sempre vai ter alguma aplica&ccedil;&atilde;o que vai te obrigar a usar o mouse, mas se pudermos evitar, melhor!</p>
<p>Graças ao maldito do Enygmata, agora acham que sou retardado. Que estou surtando, querendo usar Vim para tudo! Que não tenho mais nada pra fazer, fico inventando moda. Mas enfim, prefiro terminar minhas coisas rapidinho e tomar meu café vendo os outros perdendo tempo clicando e passando mais trabalho porque não tem mais de 1 clipboard para copiar e colar códigos&#8230;<br />
<span id="more-175"></span></p>
<h2>Vimperator</h2>
<p>Foi minha primeira contribuição séria para a comunidade do ArchLinux. Está lá no AUR, `yaourt -S vimperator` para instalá-lo. Vou dar uma palhinha do que esse moço faz.</p>
<h3>Comandos</h3>
<p>Comandos úteis para utilizar durante a navegação:</p>
<ul>
<li><strong>:buffers</strong><br />
Lista os buffers da aba</li>
<li><strong>:bwipeout</strong><br />
Remove o buffer atual da lista</li>
<li><strong>:edit url</strong><br />
Abre um novo buffer</li>
<li><strong>: open [google|amazom|wikipedia|...] (termos da busca|url)</strong><br />
Abre na aba e buffer atual uma url ou busca. Caso não seja especificado o primeiro parâmetro, ele usará a opção <em>defsearch</em></li>
<li><strong>:tab [help|prefs|addons|downloads]</strong><br />
Executa o comando(help,prefs,etc) e abre numa nova aba</li>
<li><strong>:tabclose</strong><br />
Fecha a aba atual</li>
<li><strong>:tabopen</strong><br />
Abre a url numa nova aba. (Mesmos argumentos de :<em>open</em>)</li>
</ul>
<p><strong>OBS</strong>: A maioria dos comandos para gerenciamento de Abas e buffers do Vim funcionam no Vimperator também.</p>
<ul>
<li><strong>f</strong><br />
	Coloca 1 número em cada link e input da página. Ao digitar o número, ele simula o clique. Caso o número seja de um input, ele dá foco para ele. <strong>Obs</strong>: também é possível digitar um texto contido no link, pois se o texto tiver incidência em apenas 1 link, o mesmo será usado.</li>
<li><strong>G</strong><br />
	Move para o fim da página</li>
<li><strong>gg</strong><br />
	Move para o topo da página</li>
<li><strong>gt / Ctrl+n / Ctrl+PageUp</strong><br />
	Move para a aba seguinte</li>
<li><strong>gT / Ctrl+p / Ctrl+PageDown</strong><br />
	Move para a aba anterior</li>
<li><strong>gH</strong><br />
	Vai para a página inicial definida</li>
<li><strong>H / Ctrl+o</strong><br />
	Volta uma página no histórico</li>
<li><strong>L / Ctrl+i</strong><br />
	Avança uma página no histórico</li>
<li><strong>r</strong><br />
	Recarrega a página</li>
<li><strong>R</strong><br />
	Recarrega a página limpando o cache</li>
<li><strong>y</strong><br />
	Copia a URL atual</li>
<p>&#8216;</p>
<li><strong>Y</strong><br />
	Copia o texto selecionado</li>
<li><strong>zi</strong><br />
	Aumenta o zoom da página em 25%</li>
<li><strong>zo</strong><br />
	Diminui o zoom da página em 25%</li>
<li><strong>zz</strong><br />
	Usado sozinho reseta o zoom para 100%, caso usado 200zz, muda o zoom para 200%</li>
<li><strong>j,k,h,l</strong><br />
	Movem o cursor para baixo, para cima, para a esquerda e para direita, respectivamente</li>
</ul>
<p>As opções funcionam como as do Vim. :set option=valor</p>
<h3>Opções</h3>
<p>Para modificar alguma opção do vimperator, se faz do mesmo modo com que é feito no Vim:</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #000000;">:</span>set option=value</pre></div></div>

<ul>
<li><strong>complete</strong><br />
	Ao abrir uma URL (com <img src='http://gustavodutra.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> pen), o Vimperator tenta autocompletar. A lista de caracteres que compõe o que será exibido é: s (buscas), f (arquivos locais), b (bookmarks), h (histórico), entre outros.</li>
<li><strong>defsearch</strong><br />
	Especifica a engine de busca, por exemplo: &#8220;:set defsearch=google&#8221;</li>
<li><strong>guioptions</strong><br />
	Opções da gui: m (menubar), T (toolbar), B (bookmark bar), etc. Para mostrar os menus, basta usar &#8220;set guioptions+=m&#8221;, -= para esconder.</li>
<li><strong>hlsearch</strong><br />
	Colore a busca (idem Vim)</li>
<li><strong>ignorecase</strong><br />
	Case-insensitive nas buscas do Firefox</li>
<li><strong>incsearch</strong><br />
	Busca incremental (idem Vim)</li>
<li><strong>showtabline</strong><br />
	Mostra (caso 1) ou esconde (caso 0) a barra de abas.</li>
<li><strong>smartcase</strong><br />
	Sobreescreve o parâmetreo de &#8216;ignorecase&#8217; caso tenha caracteres maiúsculos na busca.</li>
<li><strong>wildmode</strong><br />
	Define como a completação da linha de comando vai funcionar (idem Vim)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://gustavodutra.com/post/175/vimperator-comportamento-do-vim-no-firefox/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
