<?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>My stuff &#187; Vim</title>
	<atom:link href="http://michelhollands.net/blog/index.php/category/vim/feed/" rel="self" type="application/rss+xml" />
	<link>http://michelhollands.net/blog</link>
	<description>Tech and travel tidbits</description>
	<lastBuildDate>Tue, 13 Dec 2011 09:59:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>Highlight the current line in Vim</title>
		<link>http://michelhollands.net/blog/2007/08/15/highlight-the-current-line-in-vim/</link>
		<comments>http://michelhollands.net/blog/2007/08/15/highlight-the-current-line-in-vim/#comments</comments>
		<pubDate>Wed, 15 Aug 2007 14:48:09 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://michelhollands.net/blog/2007/08/15/highlight-the-current-line-in-vim/</guid>
		<description><![CDATA[To highlight the current line in Vim, you have to set the cursorline setting. :set cursorline :set cul These two are the same. This can also be set in your _vimrc file, you don&#8217;t need the colon then. Here&#8217;s an extract from my vimrc file: set nowrap set ic " Ignore case set ai " [...]]]></description>
			<content:encoded><![CDATA[<p>To highlight the current line in Vim, you have to set the cursorline setting.</p>
<pre>
   :set cursorline
   :set cul
</pre>
<p>These two are the same. This can also be set in your _vimrc file, you don&#8217;t need the colon then.</p>
<p>Here&#8217;s an extract from my vimrc file:</p>
<pre>
  set nowrap
  set ic                       " Ignore case
  set ai                       " autoindent
  set tabstop=4
  set shiftwidth=4
  set expandtab
  set cul                      " Cursor highlight

  map <f1> ^hhxxj0
  map <f2> ^i  <esc>j0
</pre>
<p>The last 2 entries add mappings for F1 and F2, to dedent and indent the current line. Map is one of the most useful Vim commands, well worth learning.</p>
]]></content:encoded>
			<wfw:commentRss>http://michelhollands.net/blog/2007/08/15/highlight-the-current-line-in-vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Substituting from this line to the end of the file (in Vim)</title>
		<link>http://michelhollands.net/blog/2007/08/07/substituting-from-this-line-to-the-end-of-the-file-in-vim/</link>
		<comments>http://michelhollands.net/blog/2007/08/07/substituting-from-this-line-to-the-end-of-the-file-in-vim/#comments</comments>
		<pubDate>Tue, 07 Aug 2007 13:50:54 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://michelhollands.net/blog/2007/08/07/substituting-from-this-line-to-the-end-of-the-file-in-vim/</guid>
		<description><![CDATA[In vim, if you want to change something from the current line until the end of the line, you can use .,$ as the range segment of the s command. :.,$s/COMPILE/COMPILE BODY/g Substituting over the full file is done by using the % range, which is a shortcut for 1,$, ie from the first to [...]]]></description>
			<content:encoded><![CDATA[<p>In vim, if you want to change something from the current line until the end of the line, you can use .,$ as the range segment of the s command.</p>
<pre>
   :.,$s/COMPILE/COMPILE BODY/g
</pre>
<p>Substituting over the full file is done by using the % range, which is a shortcut for 1,$, ie from the first to the last line.</p>
<pre>
   :%s/COMPILE/COMPILE BODY/g
</pre>
]]></content:encoded>
			<wfw:commentRss>http://michelhollands.net/blog/2007/08/07/substituting-from-this-line-to-the-end-of-the-file-in-vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inserting the current filename in Vim</title>
		<link>http://michelhollands.net/blog/2006/11/02/inserting-the-current-filename-in-vim/</link>
		<comments>http://michelhollands.net/blog/2006/11/02/inserting-the-current-filename-in-vim/#comments</comments>
		<pubDate>Thu, 02 Nov 2006 10:23:24 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://michelhollands.net/blog/2006/11/02/inserting-the-current-filename-in-vim/</guid>
		<description><![CDATA[To insert the current file name in Vim, go to insert mode. Then type Control-R % . With Control-R you can do more things : Control-R =5*4 This inserts 20 into the current cursor position. Some examples can be found here]]></description>
			<content:encoded><![CDATA[<p>To insert the current file name in Vim, go to insert mode. Then type Control-R % . With Control-R you can do more things :</p>
<pre>   Control-R =5*4</pre>
<p>This inserts 20 into the current cursor position.</p>
<p>Some examples can be found <a href="http://www.gatago.com/comp/editors/21062266.html">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://michelhollands.net/blog/2006/11/02/inserting-the-current-filename-in-vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compiling PL/SQL within Vim</title>
		<link>http://michelhollands.net/blog/2004/08/24/compiling-plsql-within-vim-2/</link>
		<comments>http://michelhollands.net/blog/2004/08/24/compiling-plsql-within-vim-2/#comments</comments>
		<pubDate>Tue, 24 Aug 2004 17:40:22 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://michelhollands.net/blog/2004/08/24/compiling-plsql-within-vim-2/</guid>
		<description><![CDATA[Vim is a great Vi clone, which also works on Windows. It supports using external programs to compile the code you are writing. The following will show how to use this to compile PL/SQL code. Cygwin is also used. The command &#8216;:make&#8217; in Vim will call an external program on your current document. This external [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.vim.org">Vim</a> is a great Vi clone, which also works on Windows. It supports using external programs to compile the code you are writing. The following will show how to use this to compile PL/SQL code. Cygwin is also used.</p>
<p>The command &#8216;:make&#8217; in Vim will call an external program on your current document. This external program is setup using the makeprg variable in Vim. Here we will set this to be a shell script, which will be run using Cygwin&#8217;s bash shell. The following has to be added to your vimrc file.</p>
<pre>
   autocmd BufRead *.sql set makeprg=c:\\cygwin\\bin\\bash\ c:\\apps\\bin\sql_compile.sh\ \"%\"
   autocmd BufRead *.sql set efm=%E%l/%c%m,%C%m,%Z
</pre>
<p>This sets up the make program and the error format for .sql files. Note that space, slash and double quotes are escaped. The second line sets up the error format. This catches the PL/SQL error messages. The Vim help has information regarding this format, type &#8216;:help efm&#8217; to get there. The error format used here is not perfect, the last error will have too much data. But it&#8217;s useful as is.</p>
<p>The script called is as follows :</p>
<pre>
   sqlplus user/password@sid << END
   @$1
   show errors;
   exit
   END
   exit
</pre>
<p>We call Sql/Plus and execute the file given as first parameter to the script by passing the commands for Sql/Plus using a here document. The errors are then shown using the Sql/Plus command 'show errors'. After that, we exit both Sql/Plus and the shell script.</p>
<p>Calling ':make' while editing a .sql file will then execute the file and show the errors. Additionally, the Vim functionality regarding error list (using ':clist') can be used then as well.</p>
<p>UPDATE : after this article was written, I bought a new PC. The network at work doesn't allow me to install Cygwin , the port used by the installation program is blocked. So the compile didn't work anymore. As is happening more and more, Python came to the rescue. The following script does the same as the one shown above :</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">   <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>, <span style="color: #dc143c;">popen2</span>, <span style="color: #dc143c;">sys</span>
&nbsp;
   <span style="color: black;">&#40;</span>to_sqlplus,from_sqlplus<span style="color: black;">&#41;</span> = <span style="color: #dc143c;">os</span>.<span style="color: #dc143c;">popen2</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'SQLPLUS.EXE sysadm/sysadm@tbp2bi01'</span><span style="color: black;">&#41;</span>
   to_sqlplus.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span><span style="color: #483d8b;">'
      @%s
      show errors;
      exit;
   '</span><span style="color: #483d8b;">''</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
   <span style="color: #ff7700;font-weight:bold;">for</span> l <span style="color: #ff7700;font-weight:bold;">in</span> from_sqlplus.<span style="color: black;">readlines</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
      <span style="color: #ff7700;font-weight:bold;">print</span> l,</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://michelhollands.net/blog/2004/08/24/compiling-plsql-within-vim-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.447 seconds -->

