<?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>Updates: rarely to never &#187; Text manipulation</title>
	<atom:link href="http://grimboy.co.uk/blawg/category/text-manipulation/feed/" rel="self" type="application/rss+xml" />
	<link>http://grimboy.co.uk/blawg</link>
	<description>Since 2006!</description>
	<lastBuildDate>Sun, 27 Jun 2010 05:50:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Where&#8217;s my vi &lt;textarea&gt;?</title>
		<link>http://grimboy.co.uk/blawg/wheres-my-vi-textarea/</link>
		<comments>http://grimboy.co.uk/blawg/wheres-my-vi-textarea/#comments</comments>
		<pubDate>Wed, 15 Aug 2007 19:36:10 +0000</pubDate>
		<dc:creator>grimboy</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Stupidity]]></category>
		<category><![CDATA[Text manipulation]]></category>

		<guid isPermaLink="false">http://grimboy.co.uk/blawg/wheres-my-vi/</guid>
		<description><![CDATA[Is it this it? Well, if you think opening another tab in gvim, making me switch back and forth and keeping stuff in sync behind my back counts then well, you have low expectations. How about this? no particular redistribution rights are granted; that means you do not have the right to use this on [...]]]></description>
			<content:encoded><![CDATA[<p>Is it this <a href="https://addons.mozilla.org/en-US/firefox/addon/394">it</a>? Well, if you think opening another tab in gvim, making me switch back and forth and keeping stuff in sync behind my back counts then well, you have low expectations.</p>
<p>How about <a href="http://gpl.internetconnection.net/vi/vi.js">this</a>?</p>
<blockquote><p>no particular redistribution rights are granted;</p>
<p>that means you do not have the right to use this on your own web site.</p>
<p>exceptions: Internet Connection, Inc. customers may use this application on any site they like. They may not grant redistribution or other rights to others. they may do this even if they (sadly) become no longer customers.</p>
<p>other rights may become available in the future.</p>
<p>http://src.internetconnection.net/vi/</p></blockquote>
<p>I can use it if I buy hosting off a provider named &#8220;Internet Connection, Inc&#8221;? Really, other rights in the future? On some code served from the domain gpl.internetconnection.net? Ambassador, you&#8217;re ruining us.</p>
<p>Fine, fine. I&#8217;ll get over it. So, yeah, <a href="http://www.masswerk.at/jsuix/jsuix_support/jsuix_vi.js">this</a>?</p>
<blockquote><p>While JS/UIX is open-source (JS-files and HTML embedding must be) it is not<br />
public domain. All rights reserved (c) mass:werk, N. Landsteiner 2003.<br />
You may download the files for private use, but you must not publish, serve or<br />
provide this system in any form without the positive confirmation of the<br />
author. All changes to the source code must be authorized. No warranty of any<br />
kind is granted.</p>
<p>Disclaimer: JS/UIX is provided free of charge and on an &#8220;as is&#8221; basis, without<br />
warranties of any kind, expressed or implied. Licensors have no liability with<br />
respect to use of the product. The entire risk as to the quality and perfor-<br />
mance of the product is borne by licensee, who assumes the entire cost of any<br />
service and repair. This disclaimer of warranty constitutes an essential part<br />
of this agreement.  No use of the product is authorized hereunder except under<br />
this disclaimer.</p>
<p>JS/UIX is NOT a free software (for reasons see the FAQ). If you are looking for<br />
a powerfull but easy to use terminal interface have a look at<br />
&#8220;mass:werk termlib.js&#8221;</p></blockquote>
<p>Better put than the last one at least. But what&#8217;s the reasoning behind it?</p>
<blockquote><p>The strict licence is mainly due to the very nature of JS/UIX by now:<br />
Since any malformed code could corrupt the whole system, a greater variety of<br />
distributed copies would render it merly impossible to secure any bugfree<br />
version. Plans are for a totally rebuild version with true multitasking and a<br />
secure userland domain. As this new architecture would allow for third party<br />
extensions, this future version of JS/UIX could well be the start of an open<br />
project under a more permissive licence.</p></blockquote>
<p>Oh, I see. If you licensed your &#8220;Operating System&#8221;  openly then there would instantly be chaos. Just about everyone and their dogs would fork it. They&#8217;d all write masses of really buggy code &#8216;corrupting the whole system&#8217;. Every time anyone wanted a toy operating system they&#8217;d always opt for these broken forks rather than the original. Oh, and once again, we can look forward to freedom sometime in the future.</p>
<p>Right, fine.  <a href="http://www.ibr.cs.tu-bs.de/users/gutbrod/viedit/">Aha!</a> This one is even encouraging me to download it. Hey, it has command mode, search and replace.</p>
<p>h, j, k, l, h, j, k, l &#8212; &#8220;Key not supported&#8221;! But you have vi *in* your name, handface.gif.</p>
<p>Onwards. <a href="http://nigel.mcnie.name/gnawt/">Hmm?</a> Wait, even &#8216;o&#8217; doesn&#8217;t work.</p>
<p>Never mind. <a href="http://www.migniot.com/matrix/projects/jsvim/vim.js">Ho hum</a>. No commands, no search, the cursor sometimes looks like it&#8217;s places where it isn&#8217;t, there&#8217;s nothing telling you what mode you&#8217;re in, no numbers preceding keys. Apart from that pretty good. The best of the freely licensed ones in my opinion.</p>
<p>None of the freely licensed ones are quite good enough for everyday use. That said, I&#8217;m amazed nobody&#8217;s packaged one them up as a greasemonkey script or the like.</p>
<p>Any I&#8217;ve missed?</p>
<p>(Oh, and from a non-textarea point of view <a href="http://vimperator.mozdev.net/">vimperator</a> is pretty good.)</p>
]]></content:encoded>
			<wfw:commentRss>http://grimboy.co.uk/blawg/wheres-my-vi-textarea/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Vim is teh awesombe!</title>
		<link>http://grimboy.co.uk/blawg/vim-is-teh-awesombe/</link>
		<comments>http://grimboy.co.uk/blawg/vim-is-teh-awesombe/#comments</comments>
		<pubDate>Fri, 01 Dec 2006 00:34:21 +0000</pubDate>
		<dc:creator>grimboy</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Religion]]></category>
		<category><![CDATA[Text manipulation]]></category>

		<guid isPermaLink="false">http://grimboy.co.uk/blawg/vim-is-teh-awesombe/</guid>
		<description><![CDATA[photo by lilit I recently started using vim as my primary text editor. I&#8217;m no expert with it (yet) I&#8217;m just posting with some advice to other people who also want to do the same. But first, I&#8217;m going to tell you why vim is good. Fast in terms of loading Fast in terms of [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://static.flickr.com/13/14530246_21061b69c6.jpg" alt="Vim" /><br />
<cite>photo by <a href="http://www.flickr.com/photos/lilit/14530246/">lilit</a></cite></p>
<p>I recently started using vim as my primary text editor. I&#8217;m no expert with it (yet) I&#8217;m just posting with some advice to other people who also want to do the same. But first, I&#8217;m going to tell you why vim is good.</p>
<ul>
<li>Fast in terms of loading</li>
<li>Fast in terms of usage</li>
<li>Customisability</li>
<li>Expandability</li>
<li>Portability</li>
<li>Makes you feel all tingly when you do something in just a few keystrokes</li>
</ul>
<p>Lots of people reject the idea of heavily keyboard and (human) memory reliant editors such as Emacs or vim because they have a steep learning curve. However, I&#8217;ve found vim&#8217;s learning curve to be pretty reasonable, and if you code professionally or even as a regular hobby then it&#8217;s worth taking the time to learn an editor that will speed you up.</p>
<p><img src="http://static.flickr.com/16/20308963_0a89eb264e_o.jpg" alt="Coffee &#038; Cream" /><br />
<cite>photo by <a href="http://www.flickr.com/photos/geeksnap/">hulksjedi</a></cite></p>
<p>There&#8217;s a nice little vim configuration thing called <a href="http://cream.sourceforge.net/">Cream</a>. From what I understand this comes in two components:</p>
<ol>
<li>A number of configurations and macros for normal vim</li>
<li>Cream itself (still vim underneath, but even milder, vim on tranquillisers)</li>
</ol>
<p>I find this quite useful in that it makes normal vim behave a little bit more with its macros. However, Cream itself is too mild, it&#8217;s like using a normal text editor.</p>
<p>So, in conclusion, Cream is good. Download it and install it, but use vim configured by cream. Don&#8217;t use just cream itself. Well, actually you can &#8211; in fact it&#8217;s a nice gentle introduction to vim. If you just want a <em>normal</em> text editor then I recommend you use cream itself. I used cream itself for a while in &#8220;expert mode&#8221; before trying to customise it and failing. One thing that annoyed me in particular while coding python was that &#8220;expand tabs&#8221; worked for a single document, then claimed it was on but had to be turned off and on before it would start working again. I also wanted to be able to have the exact same configuration <strong>everywhere</strong>. This includes stuff like SSHing into Dreamhost and doing a hot-fix on a website or messing around on my old computer underneath the desk<sup>TM</sup> that does odd jobs like backups, svn, trac and an IRC bot. I had trouble doing configuration for Cream itself and I didn&#8217;t feel in control. So really, Cream configured or not (g)vim itself was the only option for me. </p>
<p><img src="http://static.flickr.com/4/7668881_4ec378cf4f.jpg" alt="School children in Sanorgaon" /><br />
<cite>photo by <a href="http://www.flickr.com/photos/phitar/">phitar</a></cite></p>
<p>Anyway, let&#8217;s rewind a bit. If you want to learn vim use the tutor. Invoke the tutor by opening a terminal or a dos prompt or whatever and entering <code>vimtutor</code> in it (this assumes vim is in your path). Do the entire tutor, then do it again. This is the only way. You probably won&#8217;t find it difficult but you may very well find yourself thinking &#8220;this is pointless, weird and archaic&#8221; every now and then. I know I did. However, your brain <strong>will</strong> know when to use various keystrokes magically<sup>1</sup>. Apart from the tutor I found <a href="http://www.vi-improved.org/tutorial.php">this charming IRC style tutorial</a> quite useful for a bit of light revision later on. On top of that there&#8217;s always <a href="http://www.vim.org/tips/">the official vim tips repository</a> which is useful for specific pieces of insight. <a href="http://www.vim.org/tips/tip.php?tip_id=305">This tip</a> is particularly useful in a general sense as it is a compilation.</p>
<p><img src="http://static.flickr.com/75/221509655_f76e7dbcd2.jpg" alt="A Contraption" /><br />
<cite>photo by <a href="http://www.flickr.com/photos/tojosan/221509655/">tojosan</a></cite></p>
<p>Ok, so now that you know this little editor that is fast in all senses of the word you&#8217;re probably wondering about one of its most loved features, its customisability. Firstly there is the .vimrc (or _vimrc on windows). This is something that I did mostly by example, there are a number of heavily commented .vimrc files out there so it&#8217;s fairly easy to just read through them until an option catches your eye. Here are <a href="http://www.stripey.com/vim/vimrc.html">two</a> of my <a href="http://www.ashberg.de/vim/vimrc.html">favourites</a>. Obviously if you want to customise something in particular then you can search through help or fall back to teh interwabs.</p>
<p>Here&#8217;s mine:<br />
<code>" Kill all the tabs.<br />
set ts=4<br />
set sw=4<br />
set et<br />
set nu<br />
set sr</p>
<p>" use <ctrl>+N/</ctrl><ctrl>+P to cycle through tabs (the gui kind):<br />
nnoremap <c -N> :tabnext<cr><br />
nnoremap <c -P> :tabprev<cr></p>
<p>" autoindenting<br />
set ai<br />
" smartindenting<br />
set si<br />
" a <tab> in an indent insets 'shiftwidth' spaces (not tabstop)<br />
set smarttab<br />
" if non-zero, number of spaces to insert for a </tab><tab><br />
set softtabstop=4<br />
" no real wrap during insert<br />
set tw=0</p>
<p>" have the h and l cursor keys wrap between lines (like <space> and <bkspc> do<br />
" by default), and ~ covert case over line breaks<br />
set whichwrap=h,l,~,[,]</p>
<p>" allow </bkspc><bkspc> to delete line breaks, beyond the start of the current<br />
" insertion, and over indentations:<br />
set backspace=eol,start,indent</p>
<p>" have <tab> (and <shift>+<tab> where it works) change the level of<br />
" indentation:<br />
inoremap </tab><tab> <c -T><br />
inoremap <s -Tab> <c -D><br />
" [<ctrl>+V <tab> still inserts an actual tab character.]</p>
<p>" map 'F12' to change the pwd of vim to the cwd of the current file<br />
noremap <f12> :cd %:p:h<cr></p>
<p>" pyLint the python 'compiler'<br />
autocmd FileType python compiler pylint</p>
<p>" Purdy color scheme<br />
colorscheme inkpot<br />
</cr></f12></tab></ctrl></c></s></c></tab></shift></tab></bkspc></space></tab></cr></c></cr></c></ctrl></code></p>
<p><img src="http://static.flickr.com/49/233979977_1cfea9cfcc.jpg" alt="Disassembled Plug" /><br />
<cite>photo by <a href="http://www.flickr.com/photos/jm3/233979977/">jm3</a></cite></p>
<p>Plugins are the next thing. This is pretty obvious, just get some from <a href="http://www.vim.org/scripts/">the official vim plugin repository</a> and shove them in ~/.vim/plugin/ (or C:\Program Files\Vim\vimfiles\plugin\ on windows) and shove <a href="http://www.vim.org/scripts/script.php?script_id=625">colour schemes</a> in ~/.vim/colors/. My favourite plugins at the moment are (keep in mind that some of these are geared toward python/html stuff):</p>
<ul>
<li><a href="http://www.vim.org/scripts/script.php?script_id=625">Colours Sample Pack</a> &#8211; brings variety to the editing experience. Although I am quite settled on inkpot although matrix is good if someone else is in the room.</li>
<li><a href="http://www.vim.org/scripts/script.php?script_id=1633">Subversion (svn) Integration Plugin, update with stupid star trek name</a> &#8211; Means I don&#8217;t have to switch into a terminal as often. (Well I&#8217;d probably use :!svn &#8230; if I didn&#8217;t use this)</li>
<li><a href="http://www.vim.org/scripts/script.php?script_id=790">python.vim</a> &#8211; Some python related menu commands. You need to shove the following in your ~/.vimrc <code>au FileType python source ~/.vim/plugin/python.vim</code></li>
<li><a href="http://www.vim.org/scripts/script.php?script_id=127">runscript.vim</a> &#8211; Again, saves me doing a terminal or !python moo.py &#8230;</li>
<li><a href="http://vim-taglist.sourceforge.net/">Vim Taglist</a> &#8211; Turns vim into a source code browser. Endlessly useful for large files.</li>
</ul>
<p><img src="http://static.flickr.com/12/182747253_525dc4e693.jpg" alt="The Halls of Stanford" /><br />
<cite>photo by <a href="http://www.flickr.com/photos/akash_k/182747253/">akash_k</a></cite></p>
<p>Finally, I said at the beginning that one of my requirements was to have the same configuration across several machines. What I&#8217;ve done is made a vim repository in svn (I use version control for everything) which I check out on all the machines I want to have configured then <code>svn co</code> and <code>ln -s</code> bits of it it to various directories (on windows I just check out bits of the tree directly). I have the plugin and color directories in the repository. I also have a directory called common. When I said I was showing you my .vimrc I was actually showing a file called /common/vimrc in the vim repository. I then source it from all of my .vimrc files. On Ubuntu on my laptop my .vimrc looks like<sup>2</sup>:</p>
<p><code>source $VIMRUNTIME/vimrc_example.vim<br />
source $VIMRUNTIME/mswin.vim<br />
behave mswin</p>
<p>source $HOME/.vim/common/common.vim<br />
set guifont=ProFontWindows\ 9</code><br />
(Yes, I use windows shortcuts on linux)</p>
<p><img src="http://static.flickr.com/102/298233445_216e295736.jpg" alt="Sunset de la Pollution" /><br />
<cite>photo by <a href="http://www.flickr.com/photos/tengis/">tengis</a></cite></p>
<p>In conclusion, I&#8217;m very happy with vim. It has replace notepad++ on Windows and a different editor every month on Linux. I like controlling everything with the keyboard, a keyboard is ordered. A mouse is chaotic and can easily just wander off into Firefox onto a Wikipedia article about conspiracy theories, or something similarly stupid. Also I&#8217;ve never quite been satisfied with using dialogs to do stuff (e.g. open files, change font), gvim provides this option, but I can just as easily do this by typing if I already know what I want<sup>3</sup>. Also being able to execute terminal/dos commands directly from an editor is unspeakably convenient. If you&#8217;re learning vim and want advice or have a question, or if you are a vimmer already and want to correct me on anything I&#8217;ve said, then scratch the itch and leave a comment.</p>
<ol>
<li>No, seriously.</li>
<li>I&#8217;m not lying this time.</li>
<li>I think using dialogs are like window shopping. Prompts are like entering a number into the computer thing in Argos<sup>4</sup>.</li>
<li>Nation specfic references and corporate endorsement all in one. I must be turning into an evil.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://grimboy.co.uk/blawg/vim-is-teh-awesombe/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>
