Blind Not Dumb (Posts about vim)https://www.feoh.org/categories/vim.atom2024-01-21T01:02:41ZChris PattiNikolaVim Versus Emacs - Minus the Religionhttps://www.feoh.org/posts/vim-versus-emacs-minus-the-religion.html2015-07-15T00:00:00-04:002015-07-15T00:00:00-04:00cpatti<section id="vim-versus-emacs-minus-the-religion-1">
<h2>Vim Versus Emacs - Minus the Religion</h2>
<p><strong>[Note: I originally wrote this for</strong><a class="reference external" href="https://www.quora.com/Text-Editors/Which-is-better-Vim-or-Emacs-Why/answer/Christopher-Patti">Quora</a><strong>but am reposting it here with slight embelishment.</strong></p>
<section id="introduction">
<h3>Introduction</h3>
<div class="line-block">
<div class="line">In hard core technical circles, discussing the relative merits of</div>
<div class="line">these two editors is pretty much verboten. In the past, debates around</div>
<div class="line">this issue have actually become vicious (which is ludicrous when you</div>
<div class="line">think about it) and raged on for literally years. Devotees on either</div>
<div class="line">side would rarely listen to reason, and mostly everyone seemed to</div>
<div class="line">think it was an either/or situation. To be honest, I think that stance</div>
<div class="line">is utter rubbish.</div>
</div>
<div class="line-block">
<div class="line">I feel as if I'm uniquely placed to answer this one because I've been</div>
<div class="line">using both for about 25 years now. (15 with almost full time Vim and</div>
<div class="line">10 emacs).</div>
</div>
<div class="line-block">
<div class="line">First off, I want to slightly challenge your question. It's too</div>
<div class="line">simplistic and there can be no answer to it the way you asked it.</div>
<div class="line">Emacs and vi are both superlative editors for certain types of</div>
<div class="line">things - their strengths give them super powers in very different ways</div>
<div class="line">that lend them to solving some problems more easily than others.</div>
</div>
<section id="vi-vim">
<h4>Vi/Vim</h4>
<div class="line-block">
<div class="line">To my mind, if your goal is simply to edit text, Vim might be better</div>
<div class="line">suited to the task. Its modal editing lends itself to lightning fast</div>
<div class="line">text entry, and there is a nearly infinite potential growth curve for</div>
<div class="line">how its various commands and shortcuts can be efficiently brought to</div>
<div class="line">bear in navigating and moving text around.</div>
</div>
<div class="line-block">
<div class="line">Through the years, various extension technologies have been added to</div>
<div class="line">Vi (a-la Vim) that enable it to be extended in various ways, but in my</div>
<div class="line">personal hard wrought experience, there are limits as to how far you</div>
<div class="line">can push that extension before the both the editing paradigm and the</div>
<div class="line">mechanics begin to creak and groan under the weight of what you're</div>
<div class="line">trying to accomplish.</div>
</div>
<div class="line-block">
<div class="line">For instance, the straw that broke the camel's back for me was trying</div>
<div class="line">to get IDE like method and member auto-completion and refactoring into</div>
<div class="line">the editor. There are various solutions for this in Vim, but they</div>
<div class="line">either just plain didn't work, or if they did de-stabilized my Vim</div>
<div class="line">installation because they required the installation of C shared</div>
<div class="line">libraries that were a pain to build and install. There's nothing quite</div>
<div class="line">like having your editor dump core in the middle of a critical editing</div>
<div class="line">session to make you reconsider your choice of tools.</div>
</div>
<div class="line-block">
<div class="line">Note that the above scenario has virtually nothing to do, strictly</div>
<div class="line">speaking, with editing text. It's the result of trying to make Vim</div>
<div class="line">into an IDE, which it isn't.</div>
</div>
<div class="line-block">
<div class="line">As others have mentioned Vi/Vim also has the advantage of ubiquity.</div>
<div class="line">It's bundled by default on just about every UNIX system on the planet,</div>
<div class="line">and that's definitely worth noting.</div>
</div>
<div class="line-block">
<div class="line">A great resource for Vim users is <a class="reference external" href="https://www.vimcasts.com">Vimcasts</a></div>
<div class="line">and Drew Neil's excellent book <a class="reference external" href="https://pragprog.com/book/dnvim/practical-vim">Practical Vim</a>.</div>
</div>
</section>
<section id="emacs">
<h4>Emacs</h4>
<div class="line-block">
<div class="line">I personally think of emacs less as a text editor and more as an</div>
<div class="line">incredibly powerful programming environment hyper optimized for</div>
<div class="line">working with text - the upshot being that it also has very capable</div>
<div class="line">text editing features.</div>
</div>
<div class="line-block">
<div class="line">I know that sounds like I'm just playing with words but trust me I'm</div>
<div class="line">not. If you want to create the most incredibly powerful programming</div>
<div class="line">environment utterly customized to your every need, then Emacs is</div>
<div class="line">undoubtedly for you.</div>
</div>
<div class="line-block">
<div class="line">It excels at subprocess control, so for instance if you're programming</div>
<div class="line">in Python, emacs will run a Python interpreter for you inside the</div>
<div class="line">editor. Why would you want this you might ask? Because then you can,</div>
<div class="line">while you're coding, try bits and bobs of code out and actually run it</div>
<div class="line">and see how it works. Emacs can even run the Python interpreter on a</div>
<div class="line">remote machine and hook it into your editing session.</div>
</div>
<div class="line-block">
<div class="line">At the core of emacs is emacs lisp - elisp is at the heart of emacs's</div>
<div class="line">superpowers. It is the ONLY extension language available in emacs,</div>
<div class="line">but it can do just about anything. You can avoid learning elisp and</div>
<div class="line">still be very productive using emacs, but chances are if you're like</div>
<div class="line">most people you will get sucked in eventually as the lure of sanding</div>
<div class="line">the rough edges off of some mode or other becomes too great :)</div>
</div>
<div class="line-block">
<div class="line">You can, if you so choose, use emacs as your entire working</div>
<div class="line">environment - edit, code, chat, manipulate source control (like Git) -</div>
<div class="line">pretty much anything.</div>
</div>
<div class="line-block">
<div class="line">This is a common attack non emacs users make "It's not an editor. It's</div>
<div class="line">an operating system!" and I say they're right, but they're also</div>
<div class="line">missing the point :)</div>
</div>
<div class="line-block">
<div class="line">Excellent starter resources for Emacs users are - <a class="reference external" href="https://pragmaticemacs.com/">Pragmatic Emacs</a> and</div>
<div class="line">the book / website (both stellar) <a class="reference external" href="https://www.masteringemacs.org/">Mastering Emacs</a>.</div>
</div>
</section>
</section>
<section id="summary">
<h3>Summary</h3>
<div class="line-block">
<div class="line">I realize this is a long answer, but the question is nuanced and</div>
<div class="line">complex so hopefully the length is merited.</div>
</div>
<div class="line-block">
<div class="line">If you are mostly editing plain old text, or doing very light coding</div>
<div class="line">or maybe editing static configurations, or if you need your editor</div>
<div class="line">to be there by default everywhere you go in UNIX-land, then Vim is</div>
<div class="line">almost undoubtedly your best bet.</div>
</div>
<div class="line-block">
<div class="line">If your needs are more complex, and you find yourself pushing the</div>
<div class="line">envelope, asking IDE like things of your editor, or if you know off</div>
<div class="line">the bat that you're a hard core developer who dreams in code and</div>
<div class="line">demands the utmost in customization capabilities from your</div>
<div class="line">environment, then skip right to emacs.</div>
</div>
<div class="line-block">
<div class="line">Ultimately, ignore all the rhetoric and religion and figure out which</div>
<div class="line">will make you more productive - or do what I do and use them both! I</div>
<div class="line">use vi for super quick edits on servers and emacs for heavier editing</div>
<div class="line">or when I'm editing on my desktop / laptop.</div>
</div>
<p>Tools are just tools, use what makes sense.</p>
<p>[ <strong>Update 07/16/2015: My astute readers reminded me of</strong><a class="reference external" href="https://www.emacswiki.org/emacs/Evil">evil-mode</a>**
which can be seen as letting you have your cake and eat it too :) It provides startlingly complete vim compatibility inside emacs. It works great, I used it initially when I was making the transition from vi to emacs and can recommend it heartily.** ]</p>
</section>
</section>Trying out VimRepresshttps://www.feoh.org/posts/trying-out-vimrepress.html2012-02-09T16:48:00-05:002012-02-09T16:48:00-05:00cpatti<section id="vimrepress">
<h2>VimRePress</h2>
<div class="line-block">
<div class="line">In an ongoing effort to immerse myself in Vim as much as possible, I'm trying out a plugin called <a class="reference external" href="https://github.com/vim-scripts/VimRepress">VimRepress</a> - a fork of the popular Vimpress plugin.</div>
<div class="line"><br></div>
</div>
<section id="installing">
<h3>Installing</h3>
<p>Unfortunately, getting it running with MacVim on MacOS X Lion is a bit of a bear, but thankfully Paulo Poiati wrote an excellent <a class="reference external" href="https://blog.paulopoiati.com/2012/02/07/installing-vimrepress-in-macvim-osx-lion/">article</a> on getting the job done.</p>
<p>Basically, if you're using Homebrew, you have to rebuild your MacVim to use the i386 architecture, otherwise you wind up with a Python interpreter that doesn't match the bitness of your editor, and when MacVim goes to invoke Python to run the blogging bits in the plugin, MacVim explodes.</p>
<p>Also unfortunately, you can't use the Homebrew built Python or Ruby interpreters when building MacVim either, and have to instead use the bundled ones from MacOS (both sorely out of date. Who uses Ruby 1.8 anymore? :).</p>
<p>So I had to uninstall my Homebrew based Python and Ruby, install python-markdown2 into the OSX default Python instance, and now everything seems to be working just fine.</p>
</section>
</section>
<section id="living-the-vim-life">
<h2>Living the Vim Life</h2>
<section id="vimrepress-and-blogging">
<h3>VimRepress and Blogging</h3>
<p>That said, there are still some creature comforts that I miss from the awesome Blogging bundle in TextMate - silly things like giving me a drop down list with the possible Categories for my post and the like. Hopefully over time we can get those implemented in Vim land :)</p>
<p>On the upside, and this counts for a lot, is that I can now write in <a class="reference external" href="https://daringfireball.net/projects/markdown/">Markdown</a> again <<em>contented sigh</em>> I've missed Markdown terribly ever since I transitioned the blog from Typo to Wordpress many moons ago. It's a joy to write in, and really lets me think about the writing, not about a properly formed HTML element, which is priceless.</p>
</section>
<section id="vim-and-me-in-the-large">
<h3>Vim and Me In the Large</h3>
<p>For what it's worth, thus far the minor pain of transitioning to Vim has been entirely worth it, I've definitely seen a noticeable productivity boost, and for work-a-day code and configuration editing, I'm actually finding Vim to be vastly more powerful than TextMate simply because my environment is everywhere I want to be rather than being chained to using my Mac desktop for editing and resorting to chicanery like remote mounted filesystems via sshfs.</p>
<p>For years I'd read <a class="reference external" href="https://pragprog.com/the-pragmatic-programmer">The Pragmatic Programmer</a> with its mantra of "Learn <strong>one</strong> editor, and learn it *<em>well</em>" (paraphrase).</p>
<p>I always had mixed feelings about that. I'd taken pride through most of my career in being able to learn a multitude of different tools and adapt to whatever worked best in the local environment. That is in fact a really great skill to have, but there is definitely wisdom where editors are concerned to pick one and <em>live</em> in it 24/7.</p>
<p><a class="reference external" href="https://code.google.com/p/macvim/">MacVim</a> has helped tremendously with that. With it you can have your cake and eat it to. You can use the very same config files and plugins you use on your UNIX servers on your desktop, only wrapped in a superbly crafted Aqua GUI.</p>
<p>It's a continuing process, but thus far the work I've put in has been totally worth it. I would encourage anyone who's on the fence to give it a try and be strict with yourself about it. Pick a time when you can afford to take the hit and spend the time to get facile enough that you won't miss your old environment. You won't regret it.</p>
</section>
</section>Move over TextMate. MacVim is the new kid in town!https://www.feoh.org/posts/move-over-textmate-macvim-is-the-new-kid-in-town.html2011-09-09T17:41:00-04:002011-09-09T17:41:00-04:00cpatti<div class="line-block">
<div class="line">For years I've been rather proud of the fact that I'm a total polyglot when it</div>
<div class="line">comes to editors. I'm comfortable on both sides of the fence, using Emacs, Vi,</div>
<div class="line">TextMate, EditPlus, or even the venerable /bin/ed whenever that makes sense.</div>
<div class="line"><br></div>
<div class="line">But for the first time in a long time, my current (awesome! :)) job at <a class="reference external" href="https://www.bluestatedigital.com">Blue
State Digital</a> has given me the opportunity to</div>
<div class="line">branch out and do quite a bit of real software development.</div>
</div>
<div class="line-block">
<div class="line">I first encountered TextMate shortly after I came to OSX. It's a great editor,</div>
<div class="line">and I have a tremendous amount of respect for Alan Odegard of <a class="reference external" href="https://www.macromates.com">Macromates</a></div>
<div class="line">software. He has just about single handedly created not only an amazing</div>
<div class="line">editor, but a vibrant and loyal community around his program, and he's to be</div>
<div class="line">commended for that.</div>
</div>
<div class="line-block">
<div class="line">I would have remained happy in TextMate land, but for the fact that my most</div>
<div class="line">recent job has me going back to where it all started for me - server side UNIX,</div>
<div class="line">Linux to be exact.</div>
</div>
<div class="line-block">
<div class="line">So, I editing files on my Mac using Expandrive to remotely mount them, but</div>
<div class="line">quite frankly that's a pain in the neck I just don't need to deal with.</div>
</div>
<div class="line-block">
<div class="line">With Vim, I can memorize one set of keystrokes for everywhere I might need to</div>
<div class="line">be.</div>
</div>
<div class="line-block">
<div class="line">And with MacVim, I get a nicely streamlined, beautifully Aqua-fied interface,</div>
<div class="line">with all the creature comforts TextMate provides and more.</div>
</div>
<div class="line-block">
<div class="line">What's more, there are a number of folks making the same transition, so there</div>
<div class="line">are some excellent articles and websites out there to ease the transition like</div>
<div class="line"><a class="reference external" href="https://www.jackkinsella.ie/2011/09/05/textmate-to-vim.html#masthead">this guide on making the
switch</a> or</div>
<div class="line">the excellent <a class="reference external" href="https://vimcasts.org">VimCasts</a> series of Vim tutorial screen</div>
<div class="line">casts. They cover everything from the basics to some fairly advanced tips and</div>
<div class="line">tricks on more complex Vim modes and integrations, and is written by a TextMate</div>
<div class="line">to Vim switcher.</div>
</div>
<div class="line-block">
<div class="line">Right now I'm writing this post on the excellent</div>
<div class="line"><a class="reference external" href="https://www.vim.org/scripts/script.php?script_id=3510">VimRePress</a> plugin for</div>
<div class="line">Vim that allows you to author and manage your Wordpress blog right from within</div>
<div class="line">the editor! Very sweet :)</div>
</div>
<div class="line-block">
<div class="line">So, it's a brave new world, and I'm excited by the opportunity to get</div>
<div class="line"><strong>really</strong> good at Vim so I can push my editing productivity through the roof</div>
<div class="line">:)</div>
</div>