<?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>Victor Farazdagi &#187; Vim</title>
	<atom:link href="http://www.phpmag.ru/category/programming/vim/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpmag.ru</link>
	<description>Phrozn, Phing &#38; Zend Framework Musings</description>
	<lastBuildDate>Fri, 19 Aug 2011 08:47:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Copy/Paste Issues in CLI Vim</title>
		<link>http://www.phpmag.ru/2011/02/22/copypaste-issues-in-cli-vim/</link>
		<comments>http://www.phpmag.ru/2011/02/22/copypaste-issues-in-cli-vim/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 10:41:13 +0000</pubDate>
		<dc:creator>Victor Farazdagi</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[cli]]></category>

		<guid isPermaLink="false">http://www.phpmag.ru/?p=1239</guid>
		<description><![CDATA[I use Vim whole day, every day. Combined with GNU Screen I have a really powerful development platform. Unfortunately, I had a consistency problem with copy/paste text between different Vim instances (running in different iTerm2 tabs, or in separate GNU Screen windows). When running CLI locally it is not a big deal as Vim has [...]]]></description>
			<content:encoded><![CDATA[<p>I use <a href="http://www.vim.org/">Vim</a> whole day, every day. </p>
<p>Combined with <a href="http://www.gnu.org/software/screen/">GNU Screen</a> I have a really powerful development platform. </p>
<p>Unfortunately, I had a consistency problem with copy/paste text between different Vim instances (running in different iTerm2 tabs, or in separate GNU Screen windows). </p>
<p>When running CLI locally it is not a big deal as Vim has support for yank/paste to/from system clipboard (via * and + registers). It is not an issue if you work with MacVim either, as it has full integration with system clipboard.</p>
<p>My problem is that most of the time, when developing, I am connecting to different machines via ssh. There are number of solutions: for eg X11 Forwarding, using xclips. </p>
<p>But I wanted a more simple approach that </p>
<ul>
<li>will require zero configuration on my part</li>
<li>will work 100% of time, disregarding from which machine I am connecting, whether I connect as ssh -x host etc</li>
</ul>
<p>Most obvious solution is to use temp file, where selection is going to be yanked into, and (presumably from another vim instance running on the very same host) is going to be pasted from.</p>
<p>This trick, as many others, has been already discussed on <a href="http://vim.wikia.com/wiki/Copy_and_paste_between_sessions_using_a_temporary_file">Vim.Wikia</a>.<br />
All I needed to add to my <a href="https://github.com/farazdagi/vim-ide">Vim Bundle</a>&#8216;s .vimrc:</p>
<pre name="code" class="bash">
"copy the current visual selection to ~/.vbuf
vmap <Leader>y :w! ~/.vbuf<CR>
"copy the current line to the buffer file if no visual selection
nmap <Leader>y :.w! ~/.vbuf<CR>
"paste the contents of the buffer file
nmap <Leader>p :r ~/.vbuf<CR>
</pre>
<p>Now, when working in different windows of GNU Screen (I have at least two instances of Vim &#8211; one with current code, and another with Unit Test suite), to move text between those intances, I just need to </p>
<ol>
<li>visually select code </li>
<li>type ,y </li>
<li>switch to another GNU Screen window</li>
<li>type ,p</li>
</ol>
<p>This four steps take less than a couple of seconds, mind you <img src='http://www.phpmag.ru/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpmag.ru/2011/02/22/copypaste-issues-in-cli-vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vim 7.3 is out!!</title>
		<link>http://www.phpmag.ru/2010/08/17/vim-7-3-is-out/</link>
		<comments>http://www.phpmag.ru/2010/08/17/vim-7-3-is-out/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 13:07:07 +0000</pubDate>
		<dc:creator>Victor Farazdagi</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[cli]]></category>

		<guid isPermaLink="false">http://www.phpmag.ru/?p=1085</guid>
		<description><![CDATA[Couple of days ago, Vim team released new version of their great text editor. Once I had a little time, that&#8217;s today, I upgraded all my boxes. There couple of new features that are particularly interesting: a) Persistent undo Small but nevertheless very useful addition. Basically, your undo lists are dumped into undo files allowing [...]]]></description>
			<content:encoded><![CDATA[<p>Couple of days ago, Vim team <a href="https://groups.google.com/group/vim_announce/browse_thread/thread/66c02efd1523554b">released</a> new version of their great text editor. Once I had a little time, that&#8217;s today, I upgraded all my boxes. There couple of new features that are particularly interesting:<br />
<span id="more-1085"></span></p>
<h3>a) Persistent undo</h3>
<p>Small but nevertheless very useful addition. Basically, your undo lists are dumped into undo files allowing you to undo/redo even if buffer is unloaded (or even if editor closed). Plus now you are able to undo even after buffer reload (this is separate feature actually).</p>
<p>To enable, add to your .vimrc:</p>
<pre name="code" class="bash">
set undofile
set undodir=/tmp
</pre>
<p>That will enable dumping undo lists into undofile, which will be located in /tmp folder.</p>
<h3>b) Arbitrary columns</h3>
<p>Main use for me is to highlight maximum line length. You could have similar functionality before, but now it is supported out of box:</p>
<pre name="code" class="bash">
" make sure that max lines are displayed
" (80 and 120 are from ZF Coding standards)
set colorcolumn=80,120
</pre>
<p>To update the color of the ruler use hl-ColorColumn. In our custom theme (based on <a href="http://dengmao.wordpress.com/2007/01/22/vim-color-scheme-wombat/">wombat</a>), I set color as:</p>
<pre name="code" class="bash">
hi ColorColumn guibg=#2d2d2d
</pre>
<h3>c) Relative line numbers</h3>
<p>Well, at first I though this kind of controversial feature, but once I tried to navigate inside document using it &#8211; I suppose I like this feature. In any case, not added to my .vimrc by default. I turn it manually:</p>
<pre name="code" class="bash">
:set rnu
</pre>
<p>and to get back to original line numbers:</p>
<pre name="code" class="bash">
:set nu
</pre>
<h3>d) Conceal text</h3>
<p>Well, this feature is mainly for syntax file writers, as it <em>might</em> make markup text more readable. I, honestly, haven&#8217;t enough incentive to dig into it any deeper, as I don&#8217;t really see how can I use it in my immediate work (I actually like to see all the markup).</p>
<h3>Conclusion</h3>
<p>Although 7.3 is a minor release, it is still the result of two-years of work, with a lot of issues fixed and several very cool additions.</p>
<h3>Couple of notes on installation</h3>
<p>On our <a href="http://4cinc.com/">4C&#8217;s development server</a> (running CentOS), I was able to compile 7.3 without any issues whatsoever. </p>
<p>While recently switching to Mac, I still program on my old Ubuntu box and updating the Vim installation didn&#8217;t work the first time I tried. I noticed that my Ubuntu installation needed <strong>xorg-dev</strong> and <strong>libgtk2.0-dev</strong> packages, once installed I was able to compile an complete the Vim&#8217;s installation.</p>
<p>Here is little script I use to compile and install Vim on CentOS (used it on Ubuntu as well):</p>
<pre name="code" class="php">
#!/bin/bash
export CONF_OPT_GUI='--enable-gui=gtk2'
export CONF_OPT_PYTHON='--enable-pythoninterp'
export CONF_OPT_MULTIBYTE='--enable-multibyte'
export CONF_OPT_FEAT='--with-features=huge'
export CONF_OPT_COMPBY='--with-compiledby="yourname@here.com'

make distclean
./configure $CONF_OPT_FEAT $CONF_OPT_MULTIBYTE $CONF_OPT_PYTHON $CONF_OPT_COMPBY $CONF_OPT_GUI
make
make install
</pre>
<p>Save it into extracted <strong>vim73</strong> directory (I prefer to use name &#8220;configure-my&#8221;), then simply source:</p>
<pre name="code" class="shell">
source configure-my
</pre>
<p>Hope that saves you some time and happy Viming!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpmag.ru/2010/08/17/vim-7-3-is-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DOS end of lines in Vim</title>
		<link>http://www.phpmag.ru/2010/03/28/dos-end-of-lines-in-vim/</link>
		<comments>http://www.phpmag.ru/2010/03/28/dos-end-of-lines-in-vim/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 04:42:50 +0000</pubDate>
		<dc:creator>Victor Farazdagi</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tricks & Tips]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://www.phpmag.ru/?p=983</guid>
		<description><![CDATA[Sometimes I get annoying ^M chars when opening files using Vim &#8211; obviously it&#8217;s a DOS EOL which mixes the picture. The good place to seek for fixes and workarounds is Vim Wikia, which not only shows you what to do, but also gives you a brief background on what is going on (if you [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes I get annoying ^M chars when opening files using Vim &#8211; obviously it&#8217;s a DOS EOL which mixes the picture.</p>
<p>The good place to seek for fixes and workarounds is <a href="http://vim.wikia.com/wiki/Change_end-of-line_format_for_dos-mac-unix">Vim Wikia</a>, which not only shows you what to do, but also gives you a brief background on what is going on (if you are unaware).</p>
<p>I am generally happy with dos2unix utility to convert files, but sometimes it seems to be unable to fix the issue. In such situations I do a simple search/replace, right inside of Vim (in ex mode):<br />
<span id="more-983"></span></p>
<pre name="code" class="bash">
:%s/\r/\r/g
</pre>
<p>In my opinion it is real magic &#8211; it replaces carriage returns (CR) with line-feeds (LF), but the actual command reads: do a replacement of \r with \r, right?<br />
Well, Vim is clever enough to look into file-type, and if it&#8217;s unix &#8211; it presumes that first \r can be either CR or LF, while second (replacement) is always LF <img src='http://www.phpmag.ru/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>If it doesn&#8217;t work for you check your buffer&#8217;s file type:</p>
<pre name="code" class="bash">
:set ff?
</pre>
<p>I only recently moved to Vim, but start loving it for such small but extremely useful gems.</p>
<p>Should you have any questions/suggestions &#8211; hit me back on <a href="http://twitter.com/farazdagi">my tweeter</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpmag.ru/2010/03/28/dos-end-of-lines-in-vim/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

