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
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |