Here is the one I use more than any other: open a vi session in a new xterm. At any one time I usually have between 20 and 200 of such sessions open.

Usage:

vix [ -i ] [ -r ] [ -s ] [ filenames ... ] -i: create minimised (useful when opening many in one go) -r: readonly edit session -s: open all files in a single vi session

The code:

#!/usr/bin/perl -w my $xterm = '/usr/X11R6/bin/xterm'; my $vi = '/bin/vi'; my $single = 0; my @xopts = qw/ -cm +cn -dc -j -s +sb -sl 0 -wf -fg white -bg black /; my @vopts = (); while (@ARGV && $ARGV[0] =~ /^-/) { my $arg = shift; last if $arg eq '--'; push(@xopts, '-iconic'), next if $arg eq '-i'; push(@vopts, '-R'), next if $arg eq '-r'; $single = 1, next if $arg eq '-s'; die "unknown option '$arg'\n"; } @ARGV = '' unless @ARGV; for ($single ? \@ARGV : @ARGV) { my $pid = fork; die "fork: $!\n" unless defined $pid; next if $pid; my $name = $single ? "vix session" : $_; $name =~ s/lock\z/lock /; # avoid fwvm trickery exec $xterm, @xopts, -name => $name, -title => $name, -e => $vi, @vopts, $single ? @$_ : $_; }

Update 2006/04/06: added hack to dodge 'lock' trickery.

Hugo


In reply to Re: Private Utilities by hv
in thread Private Utilities by Ovid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.