<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">
<channel>
    <title>freebsd.munk.me.uk - Vim</title>
    <link>http://freebsd.munk.me.uk/</link>
    <description>FreeBSD System Administration</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.5.2 - http://www.s9y.org/</generator>
    
    <image>
        <url>http://freebsd.munk.me.uk/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: freebsd.munk.me.uk - Vim - FreeBSD System Administration</title>
        <link>http://freebsd.munk.me.uk/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Move Quicker In Vim!</title>
    <link>http://freebsd.munk.me.uk/archives/186-Move-Quicker-In-Vim!.html</link>
            <category>Vim</category>
    
    <comments>http://freebsd.munk.me.uk/archives/186-Move-Quicker-In-Vim!.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=186</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=186</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    Here&#039;s a list of my fav keyboard shortcuts for moving around Vim rapidly.  There are an infinite number of other great keyboard shortcuts in Vim, these are just the ones I use most and that come to mind right now for zipping around quickly.  As you read this, fire up Vim and try them out :)&lt;br /&gt;
&lt;br /&gt;
Feel free to point out any that I&#039;ve missed out in the comments!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
gg - goto the first line of the current document.&lt;br /&gt;
&lt;br /&gt;
G - goto the last line of the current document&lt;br /&gt;
&lt;br /&gt;
* - * is a great shortcut, it finds the next occurence of the word your cursor is currently on. The &#039;#&#039; key does the same but backwards through the current document, though I have # mapped to auto comment blocks of code/script.&lt;br /&gt;
&lt;br /&gt;
&#039;a and ma - using the keystroke &#039;a will set a &#039;mark&#039; named &#039;a&#039; in the document at the current line you&#039;re at.  Hitting the ma keystroke will take you back to the mark / line named &#039;a&#039;.  You can do the same with any letters in the range [a-zA-Z], just substituate a for the letter you want (mb mc md, &#039;b &#039;c &#039;d to mark/goto marks b, c or d).&lt;br /&gt;
&lt;br /&gt;
% - whilst on a bracket/brace, goto the matching bracket/brace - useful if you&#039;re coding/scripting and you want to check if your brackets are closed properly. 
    </content:encoded>

    <pubDate>Tue, 26 Sep 2006 16:11:00 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/186-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Vim 7 New Features</title>
    <link>http://freebsd.munk.me.uk/archives/189-Vim-7-New-Features.html</link>
            <category>Vim</category>
    
    <comments>http://freebsd.munk.me.uk/archives/189-Vim-7-New-Features.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=189</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=189</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    Vim 7 has been out for a while now and I&#039;ve not commented on it as yet.  There&#039;s &lt;a href=&quot;http://linuxhelp.blogspot.com/2006/09/visual-walk-through-of-couple-of-new.html&quot;  title=&quot;http://linuxhelp.blogspot.com/2006/09/visual-walk-through-of-couple-of-new.html&quot;&gt;an article about the new changes in Vim 7&lt;/a&gt; I was reading and thought I&#039;d make some comments on the features I like/dislike about Vim7.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Highlighting Matching Parentheses&lt;/strong&gt;&lt;br /&gt;
Bracket Highlighting is a useful feature for programmers - when your cursor is over a bracket, the corresponding bracket is auto highlighted for you so you can easily check a brace is closed properly.  &lt;br /&gt;
&lt;br /&gt;
However, personally I find it slows down Vim way too much if you&#039;re editing code that has many nested brackets in - Vim takes a long time to move from one line to the next when you&#039;re hitting &#039;j&#039; or &#039;k&#039; to move down/up through lines.  Ok it&#039;s only a split second difference, but you do get that kind of juddery movement (imagine editing in vim over a 56k modem line whilst downloading something else!).  Not for me thanks - I resorted to turning the feature off.  &lt;br /&gt;
&lt;br /&gt;
For anyone who wants to turn parenthesis automatching off in Vim 7 without having to trawl through the manual, add this to ~/.vimrc:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;&amp;#58;let&amp;#160;loaded_matchparen&amp;#160;=&amp;#160;1&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
It&#039;s in the online help pages for &#039;:help matchparen&#039; if you want to read up on it.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Undo Branches&lt;/strong&gt;&lt;br /&gt;
Vim 7&#039;s undo branches feature lets you revert your changes to a time in the past when everything was good and dandy.  Not only that but it can deal with undo branches - when you make a change, undo it, then make another change... vim now allows you to go back to the first change you made (if I understand it correctly).  &lt;br /&gt;
&lt;br /&gt;
Now to be honest this sounded like a really good feature to me, but so far I&#039;ve not screwed up enough to have to work out how to browse through the different undo branches.  I can imagine if I spent an hour working on a document only to realize I needed something I&#039;d changed half an hour ago, and that change wasn&#039;t in the direct history I could go back to using &#039;u&#039; for undo... then ok maybe I&#039;d take the time to read the docs about how to find the right undo branch to restore the text I was missing.  But that&#039;s not come up yet. :o  Sounds good though.&lt;br /&gt;
&lt;br /&gt;
There are some other features I&#039;ve not tested out as yet - omni completion sounds useful, like syntax autocompletion by the sounds of it.  Start typing in a function name in php or a tag in html, hit &#039;ctrl-x ctrl-o&#039; in command mode and you get up a list of possible completions for the text you&#039;ve started entering.  I might give this a go next time I use it, will have to see. 
    </content:encoded>

    <pubDate>Wed, 20 Sep 2006 21:21:00 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/189-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Vim Tips: Open Files Quicker In Vim</title>
    <link>http://freebsd.munk.me.uk/archives/182-Vim-Tips-Open-Files-Quicker-In-Vim.html</link>
            <category>Vim</category>
    
    <comments>http://freebsd.munk.me.uk/archives/182-Vim-Tips-Open-Files-Quicker-In-Vim.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=182</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=182</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    This tip allows you to open files easily / quickly in the same directory as the file you&#039;re currently working on in Vim.  By default, Vim opens files from the current working directory when you hit &#039;:e&#039; which is annoying if you want to quickly open a file in the same directory as the file you&#039;re working on without having to drill down through lots of subdirectories.  Using this key mapping tip though you can open files from the working directory of the file you&#039;re currently working on by hitting &#039;,e&#039;.  &lt;br /&gt;
&lt;br /&gt;
The tip includes an example, it&#039;s really worth trying if you use Vim as your main editor - personally I&#039;d find it hard working without it in Vim now.&lt;br /&gt;
&lt;br /&gt;
First of all it&#039;s worth noting that there is a Vim setting that allows you to have the working directory follow the file you&#039;re currently working on:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;#&amp;#160;Add&amp;#160;this&amp;#160;to&amp;#160;~/.vimrc&amp;#160;to&amp;#160;make&amp;#160;it&amp;#160;permanent&amp;#58;&lt;br /&gt;
&amp;#58;set&amp;#160;autochdir&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
However the following is still relevant because it&#039;s not always the case you want this behaviour and the keystroke &#039;,e&#039; is as quick as &#039;:e&#039; to type anyway to get this equivalent functionality to work.&lt;br /&gt;
&lt;br /&gt;
Here goes with the &#039;,e&#039; mapping:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li/&gt;Add the following key mapping to ~/.vimrc:&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;map&amp;#160;,e&amp;#160;&amp;#58;e&amp;#160;&amp;#60;C-R&amp;#62;=expand&amp;#40;&quot;%&amp;#58;p&amp;#58;h&quot;&amp;#41;&amp;#160;.&amp;#160;&quot;/&quot;&amp;#160;&amp;#60;CR&amp;#62;&lt;/div&gt;&lt;br /&gt;
Save the ~/.vimrc file.&lt;br /&gt;
&lt;li/&gt;Read in the new mapping by sourcing the ~/.vimrc:&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;&amp;#58;source&amp;#160;~/.vimrc&lt;/div&gt;&lt;br /&gt;
or just exit and restart vim.&lt;/ol&gt;&lt;br /&gt;
&lt;br /&gt;
Now the &#039;,e&#039; mapping should work.  To test it:&lt;br /&gt;
&lt;br /&gt;
Open a file NOT in the current working directory:&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;#&amp;#160;&amp;#40;this&amp;#160;is&amp;#160;in&amp;#160;Vim&amp;#41;&amp;#58;&lt;br /&gt;
#&amp;#160;/root&amp;#160;is&amp;#160;my&amp;#160;current&amp;#160;working&amp;#160;directory&lt;br /&gt;
&amp;#58;!echo&amp;#160;$PWD&lt;br /&gt;
/root&lt;br /&gt;
#&amp;#160;open&amp;#160;up&amp;#160;a&amp;#160;file&amp;#160;in&amp;#160;another&amp;#160;directory&amp;#58;&lt;br /&gt;
&amp;#58;e&amp;#160;/var/log/messages&lt;br /&gt;
#&amp;#160;now&amp;#160;try&amp;#160;the&amp;#160;new&amp;#160;key&amp;#160;mapping&amp;#160;-&amp;#160;when&amp;#160;you&amp;#160;hit&amp;#160;the&amp;#160;key&amp;#160;stroke&amp;#160;&#039;,e&#039;&amp;#160;you&amp;#160;get&amp;#58;&lt;br /&gt;
&amp;#58;e&amp;#160;/var/log/&lt;br /&gt;
#&amp;#160;hitting&amp;#160;&amp;#60;TAB&amp;#62;&amp;#160;allows&amp;#160;autocompletion&amp;#160;on&amp;#160;all&amp;#160;files&amp;#160;in&amp;#160;/var/log&amp;#160;as&amp;#160;well&amp;#160;&amp;#58;&amp;#41;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
I should give credit where it&#039;s due though, I found this tip on the &lt;a href=&quot;http://www.vim.org/tips/index.php&quot;  title=&quot;Vim Tips Website&quot;&gt;Vim Tips site&lt;/a&gt; - always worth searching through if you ever need to get something done in Vim.  Easier still, &lt;a href=&quot;http://www.vim.org/tips/tip_download.php&quot;  title=&quot;Vim Tips Download&quot;&gt;download all of the Vim Tips submitted on the site&lt;/a&gt;, then just search for the keywords that you&#039;re looking for a tip on (searching in it for &#039;,e&#039; I just found out the tip above was &lt;a href=&quot;http://www.vim.org/tips/tip.php?tip_id=2&quot; &gt;tip #2&lt;/a&gt; (of 1327!!!)).  Credit goes to those guys in tip #2 for the above. :)&lt;br /&gt;
&lt;br /&gt;
Mmm... just reading through those comments I&#039;m not sure if I&#039;ll bother posting this article, seems there&#039;s an even easier way to have the working dir follow the current file using &#039;:set autochdir&#039;... ack and I&#039;m so used to using ,e now... then again though there are some times when you don&#039;t always want that autochangedir functionality.  Ho hum I&#039;ll stick with &#039;,e&#039; I think. 
    </content:encoded>

    <pubDate>Mon, 11 Sep 2006 23:34:17 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/182-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Vim Tips: Comment Out Code With One Keystroke</title>
    <link>http://freebsd.munk.me.uk/archives/180-Vim-Tips-Comment-Out-Code-With-One-Keystroke.html</link>
            <category>Vim</category>
    
    <comments>http://freebsd.munk.me.uk/archives/180-Vim-Tips-Comment-Out-Code-With-One-Keystroke.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=180</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=180</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    When coding/scripting in Vim it&#039;s useful to be able to comment out one or more lines quickly and easily.  The following code snippet allows you to comment out either the current line (in command mode) or all the highlighted lines (in visual mode) using the &#039;#&#039; key - add it to your ~/.vimrc file to have it load when vim starts:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;&quot;&amp;#160;comments&amp;#160;mapping&lt;br /&gt;
map&amp;#160;#&amp;#160;&amp;#58;s/^/#&amp;#160;/&amp;#60;cr&amp;#62;j&lt;br /&gt;
vmap&amp;#160;#&amp;#160;&amp;#58;s/^/#&amp;#160;/&amp;#60;cr&amp;#62;gv&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Of course this knocks out the default functionality of the # key - search for word nearest cursor backwards (you can get similar functionality by hitting *, then &#039;N&#039;). 
    </content:encoded>

    <pubDate>Fri, 08 Sep 2006 16:10:58 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/180-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Vim Shell - is there any reason to use a full login shell again?</title>
    <link>http://freebsd.munk.me.uk/archives/125-Vim-Shell-is-there-any-reason-to-use-a-full-login-shell-again.html</link>
            <category>Vim</category>
    
    <comments>http://freebsd.munk.me.uk/archives/125-Vim-Shell-is-there-any-reason-to-use-a-full-login-shell-again.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=125</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=125</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    Ok perhaps it&#039;s wishful thinking that I&#039;d never need to switch endlessly back and forth between a login shell and &lt;a href=&quot;http://www.vim.org/&quot;&gt;vim&lt;/a&gt; again, but after finding the promising &lt;a href=&quot;http://www.vim.org/scripts/script.php?script_id=165&quot;&gt;vimsh vim script&lt;/a&gt; I did think I could be on the way to living my server admin life completely in vim.&lt;br /&gt;
&lt;br /&gt;
The script is very interesting - after sourcing the script from within vim you essentially get a login shell within a new vim buffer.  Unlike a regular login shell though, with vimsh you get the added bonus that you can move around the shell buffer as you would in a regular vim buffer and yank/paste lines as you want.  This could be very useful for writing up articles that include a lot of shell snippets - this site has it&#039;s fair share of those :P&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.vim.org/scripts/script.php?script_id=165&quot;&gt;vimsh&lt;/a&gt; is written by &lt;a href=&quot;http://www.vim.org/account/profile.php?user_id=88&quot;&gt;Brian Sturk&lt;/a&gt; - he has a page detailing his contributions to vim &lt;a href=&quot;http://users.adelphia.net/~bsturk/vim.html&quot;&gt;here&lt;/a&gt; 
    </content:encoded>

    <pubDate>Sun, 21 Mar 2004 13:05:08 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/125-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>

</channel>
</rss>