in reply to Private Utilities

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

Replies are listed 'Best First'.
Re^2: Private Utilities
by gaal (Parson) on Dec 01, 2005 at 19:58 UTC
    200

    Goodness! If your vi is actually vim, you might consider using minibufexpl.vim.

      You can also use the new "tab pages" implemented in vim 7 (still beta) :)

      Hi, I'm a .signature virus! Copy me to your .signature file and help me propagate, thanks!