<?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>Lojic Technologies Blog &#187; vim</title>
	<atom:link href="http://lojic.com/blog/tag/vim/feed/" rel="self" type="application/rss+xml" />
	<link>http://lojic.com/blog</link>
	<description></description>
	<lastBuildDate>Fri, 25 Nov 2011 20:12:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Nice Fonts for GNU Emacs on Ubuntu Linux</title>
		<link>http://lojic.com/blog/2008/02/07/nice-fonts-for-gnu-emacs-on-ubuntu-linux/</link>
		<comments>http://lojic.com/blog/2008/02/07/nice-fonts-for-gnu-emacs-on-ubuntu-linux/#comments</comments>
		<pubDate>Thu, 07 Feb 2008 16:13:18 +0000</pubDate>
		<dc:creator>Brian Adkins</dc:creator>
				<category><![CDATA[software]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lisp]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://lojic.com/blog/2008/02/07/nice-fonts-for-gnu-emacs-on-ubuntu-linux/</guid>
		<description><![CDATA[UPDATE 12/24/08: This article is now out of date. I just installed Ubuntu 8.10, and getting Emacs with nice fonts is now much easier:

Install the emacs-snapshot-gtk package
Edit ~/.Xresources to have
Emacs.font: Bitstream Vera Sans Mono-10
xrdb -merge ~/.Xresources


Before discussing how to get nice fonts for emacs, it might be reasonable to ask, &#8220;why emacs?&#8221; I haven&#8217;t fully [...]]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE 12/24/08:</strong> This article is now out of date. I just installed Ubuntu 8.10, and getting Emacs with nice fonts is now much easier:</p>
<ol>
<li>Install the emacs-snapshot-gtk package</li>
<li>Edit ~/.Xresources to have<br />
Emacs.font: Bitstream Vera Sans Mono-10</li>
<li>xrdb -merge ~/.Xresources</li>
</ol>
<hr />
<p>Before discussing how to get nice fonts for emacs, it might be reasonable to ask, &#8220;why emacs?&#8221; I haven&#8217;t fully answered that question myself, but had I not been able to get nice, readable fonts on emacs, I probably wouldn&#8217;t continue researching it. For the info on getting nice fonts to work, scroll down to &#8220;Nice Fonts&#8221; below.</p>
<p>After many years of using large IDEs to develop software, I switched to <a href="http://www.vim.org/">vim</a> about a year and a half ago when I began developing with Ruby on Rails. Although the learning curve for vim was a bit steep, I quickly got to the point of being more productive with vim than I was with my previous IDE, and I&#8217;m continually learning features of vim that save me time and effort.</p>
<p>Ok, if vim is so great, why am I considering emacs? In a word, Lisp. Emacs, has great Lisp support. For the little bit of Lisp dabbling I&#8217;ve been doing, vim has been fine, but from what I&#8217;ve seen demonstrated with emacs and slime, I think it&#8217;s worth researching. Another important factor is that emacs is scripted with elisp, a dialect of Lisp. I&#8217;ve never taken the time to read up on vim scripting, but scripting emacs with elisp seems easy. Type in some elisp code into the scratch buffer, evaluate it, and it&#8217;s integrated immediately into emacs. I haven&#8217;t written any vim scripts in a year and a half, but within a few hours of researching emacs, I had implemented several elisp scripts (from source obtained online).</p>
<p>Here&#8217;s one to simulate the % command in vim which moves the cursor to the matching paren:</p>
<pre>
(defun match-paren (arg)
  "Go to the matching paren if on a paren; otherwise insert %."
  (interactive "p")
  (cond ((looking-at "\s(") (forward-list 1) (backward-char 1))
	((looking-at "\s)") (forward-char 1) (backward-list 1))
        (t (self-insert-command (or arg 1)))))

(global-set-key "%" 'match-paren)
</pre>
<p>Here&#8217;s one to simulate the vim o and O commands which open a new line either below or above the cursor and position the cursor properly indented, so you can start typing immediately. I use this quite often in vim:</p>
<pre>
(defun bja-open-line-below ()
  (interactive)
  (end-of-line)
  (open-line 1)
  (next-line 1)
  (indent-according-to-mode))

(global-set-key [?C-o] 'bja-open-line-below)

(defun bja-open-line-above ()
  (interactive)
  (beginning-of-line)
  (open-line 1)
  (indent-according-to-mode))

(global-set-key [?M-o] 'bja-open-line-above)
</pre>
<p>After my brief exposure to emacs, I think vim is more concise. In other words, it appears that vim can accomplish a given task with fewer keystrokes than emacs. I&#8217;m curious to see how hard it is to extend emacs to have some of the niceties I&#8217;m used to with vim. Maybe I can have the best of both worlds &#8211; the conciseness of vim and the extensibility and Lisp support of emacs. Lennart Borgman passed on a link to <a href="http://www.emacswiki.org/cgi-bin/wiki/vimpulse.el">vimpulse.el</a>, so I&#8217;ll take a look at it soon.</p>
<p>I swapped my caps-lock with my left control key a long time ago, so the emacs chording isn&#8217;t quite as much of a problem, but I still wonder if vim might be easier on the hands/wrists since it requires very little chording.</p>
<p>I know some famous lispers use vi(m) for Lisp development, so I don&#8217;t think emacs is a must-have. Also, if I end up using a commercial Lisp such as Lispworks or Allegro, I may consider returning to an IDE for lisp development. So, at this stage, I&#8217;m still very much a vim user who is researching emacs.</p>
<p><strong>UPDATE:</strong>Well, sometime between the original post and now I became a die-hard GNU Emacs user, so I figured I&#8217;d update the post :)</p>
<p><strong>Nice Fonts</strong></p>
<p>But enough of that, how do you get nice fonts on emacs? I had heard that the new version of emacs (22) provided anti-aliased fonts, but apparently I was mistaken. I spent hours Googling and rebuilding emacs to no avail &#8211; quite a frustrating experience. Then I posted a question on the gnu.emacs.help usenet group and received a helpful reply in a few minutes which did the trick. <a href="http://groups.google.com/group/gnu.emacs.help/browse_frm/thread/56467e1d7e39d279/61f2560701405cc8?hl=en#61f2560701405cc8">Here&#8217;s the thread.</a></p>
<p>Here&#8217;s what I did:</p>
<pre>
cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs co emacs
cd emacs
./configure --enable-font-backend --with-gif=no
make bootstrap
make
sudo make install
</pre>
<p>After that, I was able to use the &#8216;Bitstream Vera Sans Mono-10&#8242; font, and it looks great!</p>
<pre>
emacs -r -fn "Bitstream Vera Sans Mono-10"
</pre>
<p>The -r flag is for reverse video. I much prefer a black background. After making emacs from the cvs sources, it reports its version as 23.0.60.2.</p>
<p>After editing my ~/.Xresources file to have the following line:</p>
<pre>
Emacs.font: Bitstream Vera Sans Mono-10
</pre>
<p>And running the command:</p>
<pre>
xrdb -merge ~/.Xresources
</pre>
<p>Emacs automatically uses that font at startup.</p>
<p>During my hours of Googling, I had seen the page with the correct information <a href="http://www.emacswiki.org/cgi-bin/wiki/XftGnuEmacs">here</a>. But in my haste, I read the statement, &#8220;<em>Note: Since the emacs-unicode-2 branch which had the xft support is merged into trunk, the current page is obsolete.</em>&#8220;, and somehow got the impression that the <strong>entire</strong> page was obsolete, but apparently that is not the case.<strong>*</strong></p>
<p>Fortunately, the helpful folks on gnu.emacs.help set me straight &#8211; thanks guys!</p>
<p><strong>*UPDATE:</strong> I edited the wiki page referenced above, so the &#8220;obsolete&#8221; notice is further down the page.</p>
]]></content:encoded>
			<wfw:commentRss>http://lojic.com/blog/2008/02/07/nice-fonts-for-gnu-emacs-on-ubuntu-linux/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Use vimdiff to display subversion diffs</title>
		<link>http://lojic.com/blog/2007/11/27/use-vimdiff-to-display-subversion-diffs/</link>
		<comments>http://lojic.com/blog/2007/11/27/use-vimdiff-to-display-subversion-diffs/#comments</comments>
		<pubDate>Tue, 27 Nov 2007 15:14:38 +0000</pubDate>
		<dc:creator>Brian Adkins</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[utility]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://lojic.com/blog/2007/11/27/use-vimdiff-to-display-subversion-diffs/</guid>
		<description><![CDATA[I prefer using vimdiff or gvimdiff to view differences between files. When researching ways to allow using vimdiff to view subversion differences, I came across this article.
The bottom line is that subversion passes the two relevant arguments as the 6th and 7th arguments, so the following shell script wrapper does the trick:

#!/bin/sh
/usr/bin/gvimdiff ${6} ${7}

Save the [...]]]></description>
			<content:encoded><![CDATA[<p>I prefer using vimdiff or gvimdiff to view differences between files. When researching ways to allow using vimdiff to view subversion differences, I came across <a href="http://blog.tplus1.com/index.php/2007/08/29/how-to-use-vimdiff-as-the-subversion-diff-tool/">this article</a>.</p>
<p>The bottom line is that subversion passes the two relevant arguments as the 6th and 7th arguments, so the following shell script wrapper does the trick:<br />
<code><br />
#!/bin/sh<br />
/usr/bin/gvimdiff ${6} ${7}<br />
</code></p>
<p>Save the script as gvimdiff_wrapper.sh, make it executable and accessible on your path. Then modify $HOME/.subversion/config to have the following line:<br />
<code><br />
diff-cmd = gvimdiff_wrapper.sh<br />
</code></p>
<p>That will allow you to use gvimdiff to display the diff generated by <code>svn diff my_file.txt</code></p>
]]></content:encoded>
			<wfw:commentRss>http://lojic.com/blog/2007/11/27/use-vimdiff-to-display-subversion-diffs/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

