<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>Homepage of Michael Goerz - vim</title>
 <link href="http://users.physik.fu-berlin.de/~mgoerz/feeds/tags/vim" rel="self"/>
 <link href="http://users.physik.fu-berlin.de/~mgoerz/"/>
 <updated>2013-03-14T16:35:44+01:00</updated>
 <author>
   <name>Michael Goerz</name>
   <email>goerz@physik.fu-berlin.de</email>
 </author>

 
 <entry>
   <title>Integrating VIM with IPython II</title>
   <link href="blog/2009/04/integrating-vim-with-ipython-ii/"/>
   <updated>2009-04-15T00:00:00+02:00</updated>
   <id>blog/2009/04/integrating-vim-with-ipython-ii</id>
   <content type="html">&lt;p&gt;After some suggestions by Peter Battaglia, I rewrote the send.vim script to work better for its original purpose: sending text from vim to ipython. See the &lt;a href=&#39;http://michaelgoerz.net/blog/2008/09/integrating-vim-with-ipython/&#39;&gt;original post&lt;/a&gt; for the idea.&lt;/p&gt;

&lt;p&gt;The send.vim script is now in the vim script repository:&lt;/p&gt;

&lt;p&gt;&lt;a href=&#39;http://www.vim.org/scripts/script.php?script_id=2608&#39;&gt;http://www.vim.org/scripts/script.php?script_id=2608&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The problem was that it&amp;#8217;s not enough to send the text as-is. The ipython shell needs additional newlines to tell it when a code block ends at indentation level zero. Another problem are blank lines: a blank line in your source code might unintentionally end a code block when you send it to ipython. Hence, it&amp;#8217;s best not to send empty lines at all.&lt;/p&gt;

&lt;p&gt;The special behavior required for ipython meant that I had to extend the functionality of the script somewhat. I still want the plugin to be of general purpose, with all the ipython-specific behavior being optional. So, in addition to setting the &lt;code&gt;g:sendToProgramName&lt;/code&gt; variable, you also have to set the &lt;code&gt;g:sendToProgramMode&lt;/code&gt; to &amp;#8216;ipython&amp;#8217; now in order to enable it.&lt;/p&gt;

&lt;p&gt;It seems very feasible to add modes like this for other situations in the future.&lt;/p&gt;

&lt;p&gt;In the reimplementation of the plugin, I also made it more robust to work per-buffer. In addition to the global settings (&lt;code&gt;g:sendToProgramName&lt;/code&gt; etc.), you can also give settings local to the buffer by setting (for example) the &lt;code&gt;b:sendToProgramName&lt;/code&gt; variable. Local settings, if present, override global settings. The plugin also keeps its internal state per buffer.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Vim Plugin for Completion of Fortran Structures</title>
   <link href="blog/2008/12/vim-plugin-for-completion-of-fortran-structures/"/>
   <updated>2008-12-18T00:00:00+01:00</updated>
   <id>blog/2008/12/vim-plugin-for-completion-of-fortran-structures</id>
   <content type="html">&lt;p&gt;I wrote a little plugin for vim that allows you to complete Fortran 90 structures by pressing F7.&lt;/p&gt;

&lt;p&gt;&lt;a href=&#39;http://www.vim.org/scripts/script.php?script_id=2487&#39;&gt;http://www.vim.org/scripts/script.php?script_id=2487&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The plugin in written in python, so you need to have your vim compiled with python support in order to use it.&lt;/p&gt;

&lt;p&gt;The intention is to complete &amp;#8220;program&amp;#8221;, &amp;#8220;type&amp;#8221;, &amp;#8220;interface&amp;#8221;, &amp;#8220;module&amp;#8221;, &amp;#8220;subroutine&amp;#8221;, &amp;#8220;function&amp;#8221;, &amp;#8220;do&amp;#8221;, and &amp;#8220;select&amp;#8221; constructs. You write the first line of such a construct (e.g. &amp;#8220;subroutine foo(a, b)&amp;#8221;, then press F7, and the script will add the closing line &amp;#8220;end subroutine foo&amp;#8221; and put the cursor between the two lines, indented by one level.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Vim Reference Card</title>
   <link href="blog/2008/09/vim-reference-card/"/>
   <updated>2008-09-29T00:00:00+02:00</updated>
   <id>blog/2008/09/vim-reference-card</id>
   <content type="html">&lt;p&gt;This is my reference card for the vim editor:&lt;/p&gt;

&lt;p&gt;&lt;a href=&#39;http://michaelgoerz.net/refcards/index.html#vim&#39;&gt;Vim Reference Card&lt;/a&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Integrating VIM with IPython</title>
   <link href="blog/2008/09/integrating-vim-with-ipython/"/>
   <updated>2008-09-20T00:00:00+02:00</updated>
   <id>blog/2008/09/integrating-vim-with-ipython</id>
   <content type="html">&lt;p&gt;When writing python scripts, I often want to run some code snippets in &lt;a href=&#39;http://ipython.scipy.org/&#39;&gt;ipython&lt;/a&gt; for testing/debugging purposes. Until now, the only way to do this was to copy and paste the code snippets from &lt;a href=&#39;http://www.vim.org/&#39;&gt;vim&lt;/a&gt; to ipython. I wanted to have a way to send lines of text from vim to ipython directly.&lt;/p&gt;

&lt;p&gt;More generally, I wanted to send text from vim to any (text-based) application at all. Instead of ipython, this might be a &lt;a href=&#39;http://www.gnuplot.info/&#39;&gt;gnuplot&lt;/a&gt; session, or a &lt;a href=&#39;http://www.wolfram.com/products/mathematica/index.html&#39;&gt;Mathematica&lt;/a&gt; kernel.&lt;/p&gt;

&lt;p&gt;To do this sort of thing, I used a feature of &lt;a href=&#39;http://www.gnu.org/software/screen/&#39;&gt;screen&lt;/a&gt;. If you have a program running inside a screen session, you can &lt;a href=&#39;http://aperiodic.net/screen/faq#how_to_send_a_command_to_a_window_in_a_running_screen_session_from_the_commandline&#39;&gt;send arbitrary commands&lt;/a&gt; to it by executing something like &lt;code&gt;screen -S sessionname -p 0 -X stuff &amp;#39;command
to execute^M&amp;#39;&lt;/code&gt; So, all I had to do was to generate a call like that from vim.&lt;/p&gt;

&lt;p&gt;I split the job in two parts. First, there is a script that reads from stdin and sends every line it receives to a screen session. The script takes the -S and -p parameters with the same meaning as screen itself.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;m calling it &lt;a href=&#39;send2screen.py&#39;&gt;send2screen.py&lt;/a&gt;. (Update: April 15, 2009)&lt;/p&gt;

&lt;p&gt;Second, there is the vim plugin, which just takes a range and sends all the lines in the range to the stdin of an arbitrary program (for our purpose, that arbitrary program will be send2screen.py, of course)&lt;/p&gt;

&lt;p&gt;&lt;a href=&#39;http://www.vim.org/scripts/script.php?script_id=2608&#39;&gt;http://www.vim.org/scripts/script.php?script_id=2608&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The plugin goes into &lt;a href=&#39;send.vim&#39;&gt;~/.vim/plugins/send.vim&lt;/a&gt; (&lt;a href=&#39;http://michaelgoerz.net/blog/2009/04/integrating-vim-with-ipython-ii/&#39;&gt;Update: April 15, 2009&lt;/a&gt; )&lt;/p&gt;

&lt;p&gt;To use it, I set the sendToProgramName variable in vim to point to send2screen.py appropriately (update: you also need to set the sendToProgramMode to &amp;#8216;ipython&amp;#8217;), select some text in visual mode, and do: : &amp;#8217;&amp;#60;,&amp;#8217;&amp;#62; python send() Or, to send the current line: : . python send() Of course, you could also map shortcuts to execute these commands.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>ifort compiler definition for vim</title>
   <link href="blog/2008/07/ifort-compiler-definition-for-vim/"/>
   <updated>2008-07-14T00:00:00+02:00</updated>
   <id>blog/2008/07/ifort-compiler-definition-for-vim</id>
   <content type="html">&lt;p&gt;I put together a very quick compiler script for using ifort in vim, from an error format pattern I found here: &lt;a href=&#39;http://vim.wikia.com/wiki/Errorformat_for_Intel_ifort&#39;&gt;http://vim.wikia.com/wiki/Errorformat_for_Intel_ifort&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the script: &lt;a href=&#39;ifort.vim&#39;&gt;ifort.vim&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Put it in &lt;code&gt;~/.vim/compiler&lt;/code&gt; and add the line &lt;code&gt;autocmd FileType fortran compiler
ifort&lt;/code&gt; to your .vimrc.&lt;/p&gt;

&lt;p&gt;The effect of this is that when you type &lt;code&gt;:make&lt;/code&gt; in vim, it will parse any error messages that &amp;#8216;make&amp;#8217; throws up and allow you to navigate between error lines (use &lt;code&gt;:copen&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;This isn&amp;#8217;t tested very thoroughly, but it seems to work.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Vim Color Profile</title>
   <link href="blog/2008/05/vim-color-profile/"/>
   <updated>2008-05-25T00:00:00+02:00</updated>
   <id>blog/2008/05/vim-color-profile</id>
   <content type="html">&lt;p&gt;Since I didn&amp;#8217;t like any of the existing color profiles for vim (what&amp;#8217;d you expect), I wrote my own:&lt;/p&gt;

&lt;p&gt;&lt;a href=&#39;goerz.vim&#39;&gt;goerz.vim&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s intended to be used mainly in a 256 color terminal (xterm with 256color support, which is my preferred way to run vim). It also works with gvim, and under 88 color terminals (not as perfect). You can see how it looks on this screenshot, which is vim running inside yakuake (which supports 256 colors):&lt;/p&gt;
&lt;a href=&#39;vimbig.png&#39;&gt;&lt;img alt=&#39;Vim Screenshot&#39; height=&#39;234&#39; src=&#39;vimbig-300x234.png&#39; title=&#39;vimbig&#39; width=&#39;300&#39; /&gt;&lt;/a&gt;</content>
 </entry>
 
 <entry>
   <title>xml_taginsert Vim Plugin</title>
   <link href="blog/2008/05/xml_taginsert-vim-plugin/"/>
   <updated>2008-05-23T00:00:00+02:00</updated>
   <id>blog/2008/05/xml_taginsert-vim-plugin</id>
   <content type="html">&lt;p&gt;I&amp;#8217;ve written a vim plugin that allows to easier editing of html/xml files. If you load the plugin, you can use &lt;code&gt;F7&lt;/code&gt; to insert tags.&lt;/p&gt;

&lt;p&gt;&lt;a href=&#39;http://www.vim.org/scripts/script.php?script_id=2248&#39;&gt;http://www.vim.org/scripts/script.php?script_id=2248&lt;/a&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Vim LatexSuite Refcard</title>
   <link href="blog/2008/05/vim-latexsuite-refcard/"/>
   <updated>2008-05-11T00:00:00+02:00</updated>
   <id>blog/2008/05/vim-latexsuite-refcard</id>
   <content type="html">&lt;p&gt;This is my (unfinished) quick reference card for the &lt;a href=&#39;http://vim-latex.sourceforge.net/&#39;&gt;LatexSuite&lt;/a&gt; plugin package for vim.&lt;/p&gt;

&lt;p&gt;&lt;a href=&#39;http://michaelgoerz.net/refcards/#latexsuite&#39;&gt;Vim LatexSuite Refcard&lt;/a&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>VIM Syntax File for TeX</title>
   <link href="blog/2008/03/vim-syntax-file-for-tex/"/>
   <updated>2008-03-30T00:00:00+01:00</updated>
   <id>blog/2008/03/vim-syntax-file-for-tex</id>
   <content type="html">&lt;p&gt;I wasn&amp;#8217;t quite happy with how the TeX syntax file looks that comes with VIM, so I modified it. I wanted section (subsection, etc.) titles to be emphasized so that I can see them easily while scrolling through the file.&lt;/p&gt;

&lt;p&gt;I also wanted spell check to be switched off for comments. Comments in TeX are usually disabled parts of text, with latex commands which will show up as spelling mistakes.&lt;/p&gt;

&lt;p&gt;&lt;a href=&#39;tex.vim&#39;&gt;tex.vim&lt;/a&gt;&lt;/p&gt;</content>
 </entry>
 
 
</feed>