<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://mirmodynamics.com/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title>Mirmo Dynamics - Tag - script</title>
  <link>http://mirmodynamics.com/</link>
  <atom:link href="http://mirmodynamics.com/feed/tag/script/rss2" rel="self" type="application/rss+xml"/>
  <description>Si tu kiffes pas reunoi, t'écoutes pas et puis c'est tout.</description>
  <language>en</language>
  <pubDate>Sun, 14 Mar 2010 19:59:01 +0100</pubDate>
  <copyright>2003-2009 &amp;copy; Geoffrey Bachelet</copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>Automatically cd to a symfony project's root in vim</title>
    <link>http://mirmodynamics.com/post/2009/03/18/Automatically-cd-to-a-symfony-project-s-root-in-vim</link>
    <guid isPermaLink="false">urn:md5:61347ede04eb1bebad2f907168976ff4</guid>
    <pubDate>Wed, 18 Mar 2009 14:10:00 +0100</pubDate>
    <dc:creator>Geoffrey</dc:creator>
        <category>Symfony</category>
        <category>ctags</category><category>gist</category><category>root</category><category>script</category><category>symfony</category><category>vim</category>    
    <description>    &lt;p&gt;I made a little vimscript to automatically cd to the project root of a symfony project. It makes it easier for me to use the ctags :-)&lt;/p&gt;

&lt;pre&gt;
&amp;quot;-------------------------------------------------------------------------------
&amp;quot;  Description: Finds and cd to the symfony root of the project
&amp;quot;    Copyright: Copyright (C) 2009 Geoffrey Bachelet
&amp;quot;   Maintainer: Geoffrey Bachelet
&amp;quot;      Version: 1.0
&amp;quot;-------------------------------------------------------------------------------

if exists('find_symfony_root_loaded')
  finish
endif

let find_symfony_root_loaded = 1

if ! exists('find_symfony_root_symfony_executable')
  let find_symfony_root_symfony_executable = 'symfony'
endif

&amp;quot; root detection when opening a new vim seems to work
&amp;quot; only if these two events are bound. not sure why.
autocmd BufWinEnter,BufRead * call FindSymfonyRoot()

function FindSymfonyRoot()
  let l:cwd = GetAbsoluteDirname(@%)
  let l:symfony_root = findfile(g:find_symfony_root_symfony_executable, l:cwd.';')
  let l:symfony_root = GetAbsoluteDirname(l:symfony_root)
  if strlen(l:symfony_root) != 0
    execute 'cd '.l:symfony_root
  endif
endfunction

function GetAbsoluteDirname(path)
  let l:path = a:path
  &amp;quot; gets the dirname
  if !isdirectory(l:path)
    let l:path = strpart(l:path, 0, strridx(l:path, '/'))
  endif

  &amp;quot; makes it absolute
  if match(l:path, '/') != 0
    let l:path = getcwd().'/'.l:path
  endif

  return l:path
endfunction
&lt;/pre&gt;


&lt;p&gt;note for later: add vimscript support to geshi&lt;/p&gt;


&lt;p&gt;Or see &lt;a href=&quot;http://gist.github.com/81105&quot;&gt;the highlighted version on gist&lt;/a&gt;.&lt;/p&gt;</description>
    
    
    
          <comments>http://mirmodynamics.com/post/2009/03/18/Automatically-cd-to-a-symfony-project-s-root-in-vim#comment-form</comments>
      <wfw:comment>http://mirmodynamics.com/post/2009/03/18/Automatically-cd-to-a-symfony-project-s-root-in-vim#comment-form</wfw:comment>
      <wfw:commentRss>http://mirmodynamics.com/feed/atom/comments/1184</wfw:commentRss>
      </item>
    
  <item>
    <title>Mass vim file opening reloaded</title>
    <link>http://mirmodynamics.com/post/2008/10/16/Mass-vim-file-opening-reloaded</link>
    <guid isPermaLink="false">urn:md5:043b3c3596084fc127d581eb3ee0bb15</guid>
    <pubDate>Thu, 16 Oct 2008 21:20:00 +0200</pubDate>
    <dc:creator>Geoffrey</dc:creator>
        <category>Geekeries</category>
        <category>bash</category><category>grep</category><category>handy</category><category>script</category><category>tips</category><category>vim</category>    
    <description>    &lt;p&gt;Thinking about it, &lt;a href=&quot;http://mirmodynamics.com/post/2008/10/14/Mass-vim-file-opening&quot;&gt;the snippet I posted earlier&lt;/a&gt; was a bit silly as vim can open by itself multiple files way more efficiently. The only benefit from my script is that I don't have to type the &lt;code&gt;--servername&lt;/code&gt; and &lt;code&gt;--remote-silent-tab&lt;/code&gt;.&lt;/p&gt;


&lt;p&gt;So let's add some usefulness ! First, when I need this script, it's often that I first grepped the files, and then decide that I want to edit them all. From this point of view, having to pass them as &lt;em&gt;arguments&lt;/em&gt; is not that handy, so we'll add a way to pass them via &lt;code&gt;STDIN&lt;/code&gt;.&lt;/p&gt;


&lt;p&gt;Also, what if I want to send them to another vim server ? We'll add this ability too.&lt;/p&gt;


&lt;p&gt;Here is the resulting script:&lt;/p&gt;

&lt;pre&gt;
#!/usr/bin/env bash

# set a default SERVERNAME
SERVERNAME=&amp;quot;ash0&amp;quot;

# look for files on stdin
if ! [ -t 0 ]; then
  FILES=`cat /dev/stdin`
else
  exit;
fi;

# now let's check if we want a specific vim server
if ! [ -z $1 ]; then
  SERVERNAME=$1
fi;

# we can now open the files
/usr/bin/gvim --servername $SERVERNAME --remote-silent-tab $FILES
&lt;/pre&gt;


&lt;p&gt;Tada !&lt;/p&gt;


&lt;p&gt;You can now do the followings:&lt;/p&gt;

&lt;pre&gt;
grep foo | sendtovim
grep foo | sendtovim grep0
&lt;/pre&gt;</description>
    
    
    
          <comments>http://mirmodynamics.com/post/2008/10/16/Mass-vim-file-opening-reloaded#comment-form</comments>
      <wfw:comment>http://mirmodynamics.com/post/2008/10/16/Mass-vim-file-opening-reloaded#comment-form</wfw:comment>
      <wfw:commentRss>http://mirmodynamics.com/feed/atom/comments/1144</wfw:commentRss>
      </item>
    
  <item>
    <title>Mass vim file opening</title>
    <link>http://mirmodynamics.com/post/2008/10/14/Mass-vim-file-opening</link>
    <guid isPermaLink="false">urn:md5:d2b7afaa2aaf18ada08b02c96c5185fc</guid>
    <pubDate>Tue, 14 Oct 2008 19:40:00 +0200</pubDate>
    <dc:creator>Geoffrey</dc:creator>
        <category>Geekeries</category>
        <category>grep</category><category>handy</category><category>script</category><category>tips</category><category>vim</category>    
    <description>    &lt;p&gt;Remember &lt;a href=&quot;http://mirmodynamics.com/post/2006/11/28/Linux-gVim-Rox-filer-Mon-IDE&quot;&gt;my old post about vim and rox-filer&lt;/a&gt; ? Well I've got one tiny and silly addition to it now, I can mass open files from any shell command line, with this little script placed in my &lt;code&gt;~/bin/&lt;/code&gt; (don't forget to &lt;code&gt;chmod +x&lt;/code&gt;):&lt;/p&gt;

&lt;pre&gt;
for i in $*; do
  /usr/bin/gvim --servername ash0 --remote-silent-tab $i
  sleep 1
done;
&lt;/pre&gt;


&lt;p&gt;The &lt;code&gt;sleep 1&lt;/code&gt; is necessary as vim does not seem to like being flooded with files.&lt;/p&gt;


&lt;p&gt;Example usage:&lt;/p&gt;

&lt;pre&gt;
sendtovim `grep foo *`
&lt;/pre&gt;


&lt;p&gt;Opens in vim all files containing &amp;quot;foo&amp;quot; in the current directory. Who said handy ?&lt;/p&gt;


&lt;p&gt;Note: I know have an &lt;a href=&quot;http://mirmodynamics.com/post/2008/10/16/Mass-vim-file-opening-reloaded&quot;&gt;updated and useful version of this script&lt;/a&gt;&lt;/p&gt;</description>
    
    
    
          <comments>http://mirmodynamics.com/post/2008/10/14/Mass-vim-file-opening#comment-form</comments>
      <wfw:comment>http://mirmodynamics.com/post/2008/10/14/Mass-vim-file-opening#comment-form</wfw:comment>
      <wfw:commentRss>http://mirmodynamics.com/feed/atom/comments/1141</wfw:commentRss>
      </item>
    
</channel>
</rss>