Changeset 373

Show
Ignore:
Timestamp:
06/01/08 23:30:31 (3 months ago)
Author:
ingy
Message:
v0.13
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/ingy/Vroom/Changes

    r367 r373  
     1--- 
     2version: 0.13 
     3date:    Sun Jun  1 23:27:02 PDT 2008 
     4changes: 
     5- Support a .vroom/vimrc 
     6- Don't overwrite a .vimrc not created by vroom 
     7- Updated the docs 
    18--- 
    29version: 0.12 
  • trunk/src/ingy/Vroom/Makefile.PL

    r367 r373  
    77requires 'YAML::XS'; 
    88requires 'Class::Field'; 
     9requires 'File::HomeDir'; 
    910 
    1011install_script 'vroom'; 
  • trunk/src/ingy/Vroom/README

    r367 r373  
    33 
    44SYNOPSIS 
     5        > mkdir MySlides    # Make a Directory for Your Slides 
     6        > cd MySlides       # Go In There 
    57        > vim slides.vroom  # Write Some Slides 
    68        > vroom --vroom     # Show Your Slides 
     
    2022    exactly that. 
    2123 
    22     Vroom creates a file called "./.vimrc" with many helpful key mappings 
    23     for navigating a slideshow. See "KEY MAPPINGS" below. Please note that 
    24     you will need the following line in your "$HOME/.vimrc" file in order to 
    25     pickup the local ".vimrc" file. 
     24    Vroom creates a file called "./.vimrc" with helpful key mappings for 
     25    navigating a slideshow. See "KEY MAPPINGS" below. 
     26 
     27    Please note that you will need the following line in your "$HOME/.vimrc" 
     28    file in order to pick up the local ".vimrc" file. 
     29 
     30        set exrc 
    2631 
    2732    Vroom takes advantage of Vim's syntax highlighting. It also lets you run 
     
    6974        THE END 
    7075 
     76    A line that starts with '==' is a header line. It will be centered. 
     77 
     78    Lines that begin with a '+' cause vroom to split the slide there, 
     79    causing an animation effect. 
     80 
     81CONFIGURATION OPTIONS 
     82    Each slide can have one or more configuration options. Options are a 
     83    comma separated list that follow the '----' header for a slide. Like 
     84    this: 
     85 
     86        ---- center 
     87        ---- html 
     88        ---- perl,i20 
     89        ---- config 
     90        ---- skip 
     91 
     92    skip 
     93        Ignore the following slide completely. 
     94 
     95    center 
     96        Center the contents of the slide. 
     97 
     98    i## 'i' followed by a number means to indent the contents by the number 
     99        of characters. 
     100 
     101    perl,ruby,python,js,yaml,make,html 
     102        Specifies that the slide is one of those syntaxen, and that the 
     103        appropriate file extension will be used, thus causing vim to syntax 
     104        highlight the slide. 
     105 
     106    config 
     107        The slide is really a yaml configuration. It will not be displayed 
     108        in the presentation, but will tell vroom what to do from that point 
     109        forward. You can use more than one config slide in your 
     110        "slides.vroom" file. 
     111 
     112    You can specify the following confguration options in a config slide: 
     113 
     114    title <text> 
     115        The title of your presentation. 
     116 
     117    height <number> 
     118        The number of lines in the terminal you plan to use when presenting 
     119        the show. Used for centering the content. 
     120 
     121    width <number> 
     122        The number of columns in the terminal you plan to use when 
     123        presenting the show. Used for centering the content. 
     124 
     125    list_indent <number> 
     126        Auto detect slides that have lists in them, and indent them by the 
     127        specified number of columns. 
     128 
    71129KEY MAPPINGS 
     130    These are the standard key mappings specified in the local ".vimrc". 
     131 
    72132    <SPACE> 
    73133        Advance one slide. 
     
    79139 
    80140    <Q> Quit Vroom. 
     141 
     142CUSTOM CONFIGURATION 
     143    You can create a file called ".vroom/vimrc" in your home directory. If 
     144    vroom sees this file, it will append it onto every local ".vimrc" file 
     145    it creates. 
     146 
     147    Use this file to specify your own custom vim settings for all your vroom 
     148    presentations. 
    81149 
    82150NOTE 
     
    90158 
    91159AUTHOR 
    92     Ingy döt Net <ingy@cpan.org> 
     160    Ingy döt Net <ingy@cpan.org> 
    93161 
    94162COPYRIGHT 
    95     Copyright (c) 2008. Ingy döt Net. 
     163    Copyright (c) 2008. Ingy döt Net. 
    96164 
    97165    This program is free software; you can redistribute it and/or modify it 
  • trunk/src/ingy/Vroom/lib/Vroom/Vroom.pm

    r368 r373  
    77# use diagnostics; 
    88 
    9 our $VERSION = '0.12'; 
     9our $VERSION = '0.13'; 
    1010 
    1111use IO::All; 
     
    1313use Class::Field 'field', 'const'; 
    1414use Getopt::Long; 
     15use File::HomeDir; 
     16use Cwd; 
    1517use Carp; 
    1618 
     
    2527    height => 24, 
    2628    width => 80, 
    27     list_indent => 10, 
    28     skip => 0, 
    29 }; 
     29    list_indent => 10, skip => 0, }; 
    3030 
    3131sub new { 
     
    3838    $self->getOptions; 
    3939 
    40     $self->cleanUp
     40    unlink(glob "0*")
    4141    return if $self->clean; 
    4242 
     
    4848sub getOptions { 
    4949    my $self = shift; 
     50 
     51    die <<'...' if cwd eq File::HomeDir->my_home; 
     52 
     53Don't run vroom in your home directory. 
     54 
     55Create a new directory for your slides and run vroom from there. 
     56... 
     57 
    5058    GetOptions( 
    5159        "clean" => \$self->{clean}, 
     
    5664    do { delete $self->{$_} unless defined $self->{$_} } 
    5765        for qw(clean input vroom); 
    58 } 
    59  
    60 sub cleanUp { 
    61     unlink(glob "0*"); 
    62     unlink(".vimrc"); 
    6366} 
    6467 
     
    147150    for my $option (split /\s*,\s*/, $string) { 
    148151        $config->{$1} = 1 
    149             if $option =~ /^(config|skip|center|perl|yaml|make)$/; 
     152            if $option =~ /^( 
     153                config|skip|center| 
     154                perl|ruby|python|js| 
     155                yaml|make|html 
     156            )$/x; 
    150157        $config->{indent} = $1 
    151158            if $option =~ /i(\d+)/; 
     
    189196    my $ext =  
    190197        $config->{perl} ? ".pl" : 
     198        $config->{js} ? ".js" : 
    191199        $config->{python} ? ".py" : 
    192200        $config->{ruby} ? ".rb" : 
     201        $config->{html} ? ".html" : 
    193202        $config->{shell} ? ".sh" : 
    194203        $config->{yaml} ? ".yaml" : 
     
    223232sub writeVimrc { 
    224233    my $self = shift; 
     234 
     235    my $home_vroom = File::HomeDir->my_home . "/.vroom/vimrc"; 
     236    my $home_vimrc = -e $home_vroom ? io($home_vroom)->all : '';  
     237 
     238    die <<'...' 
     239The .vimrc in your current directory does not look like vroom created it. 
     240 
     241If you are sure it can be overwritten, please delete it yourself this one 
     242time, and rerun vroom. You should not get this message again. 
     243 
     244... 
     245    if -e '.vimrc' and io('.vimrc')->getline !~ /Vroom-\d\.\d\d/; 
     246 
    225247    my $title = "%f         " . $self->config->{title}; 
    226248    $title =~ s/\s/_/g; 
    227249    io(".vimrc")->print(<<"..."); 
     250" This .vimrc file was created by Vroom-$VERSION 
    228251map <SPACE> :n<CR>:<CR>gg 
    229252map <BACKSPACE> :N<CR>:<CR>gg 
     
    234257set laststatus=2 
    235258set statusline=$title 
     259 
     260" Overrides from $home_vroom 
     261$home_vimrc 
    236262... 
    237263} 
     
    241267} 
    242268 
     269=encoding utf8 
     270 
    243271=head1 NAME 
    244272 
     
    247275=head1 SYNOPSIS 
    248276 
     277    > mkdir MySlides    # Make a Directory for Your Slides 
     278    > cd MySlides       # Go In There 
    249279    > vim slides.vroom  # Write Some Slides 
    250280    > vroom --vroom     # Show Your Slides 
     
    326356    THE END 
    327357 
     358A line that starts with '==' is a header line. It will be centered. 
     359 
     360Lines that begin with a '+' cause vroom to split the slide there, 
     361causing an animation effect. 
     362 
     363=head1 CONFIGURATION OPTIONS 
     364 
     365Each slide can have one or more configuration options. Options are 
     366a comma separated list that follow the '----' header for a slide. 
     367Like this: 
     368 
     369    ---- center 
     370    ---- html 
     371    ---- perl,i20 
     372    ---- config 
     373    ---- skip 
     374 
     375=over 
     376 
     377=item skip 
     378 
     379Ignore the following slide completely. 
     380 
     381=item center 
     382 
     383Center the contents of the slide. 
     384 
     385=item i## 
     386 
     387'i' followed by a number means to indent the contents by the number of 
     388characters. 
     389 
     390=item perl,ruby,python,js,yaml,make,html 
     391 
     392Specifies that the slide is one of those syntaxen, and that the 
     393appropriate file extension will be used, thus causing vim to syntax 
     394highlight the slide. 
     395 
     396=item config 
     397 
     398The slide is really a yaml configuration. It will not be displayed 
     399in the presentation, but will tell vroom what to do from that point 
     400forward. You can use more than one config slide in your 
     401C<slides.vroom> file. 
     402 
     403=back 
     404 
     405You can specify the following confguration options in a config slide: 
     406 
     407=over 
     408 
     409=item title <text> 
     410 
     411The title of your presentation. 
     412 
     413=item height <number> 
     414 
     415The number of lines in the terminal you plan to use when presenting the 
     416show. Used for centering the content. 
     417 
     418=item width <number> 
     419 
     420The number of columns in the terminal you plan to use when presenting 
     421the show. Used for centering the content. 
     422 
     423=item list_indent <number> 
     424 
     425Auto detect slides that have lists in them, and indent them by the 
     426specified number of columns. 
     427 
     428=back 
     429 
    328430=head1 KEY MAPPINGS 
    329431 
     432These are the standard key mappings specified in the local C<.vimrc>. 
     433 
    330434=over 
    331435 
     
    347451 
    348452=back 
     453 
     454=head1 CUSTOM CONFIGURATION 
     455 
     456You can create a file called C<.vroom/vimrc> in your home directory. If 
     457vroom sees this file, it will append it onto every local C<.vimrc> file 
     458it creates. 
     459 
     460Use this file to specify your own custom vim settings for all your vroom 
     461presentations. 
    349462 
    350463=head1 NOTE