Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | $ ! |
| 2 | $ !===================================================================== |
| 3 | $ ! |
| 4 | $ ! VimTutor.com version 29-Aug-2002 |
| 5 | $ ! |
| 6 | $ ! Author: Tom Wyant <Thomas.R.Wyant-III@usa.dupont.com> |
| 7 | $ ! |
| 8 | $ ! This DCL command procedure executes the vimtutor command |
| 9 | $ ! (suprise, suprise!) which gives you a brief tutorial on the VIM |
| 10 | $ ! editor. Languages other than the default are supported in the |
| 11 | $ ! usual way, as are at least some of the command qualifiers, |
| 12 | $ ! though you'll need to play some fairly serious games with DCL |
| 13 | $ ! to specify ones that need quoting. |
| 14 | $ ! |
| 15 | $ ! Copyright (c) 2002 E. I. DuPont de Nemours and Company, Inc |
| 16 | $ ! |
| 17 | $ ! This program is free software; you can redistribute it and/or |
| 18 | $ ! modify it under the terms of the VIM license as available from |
| 19 | $ ! the vim 6.1 ":help license" command or (at your option) the |
| 20 | $ ! license from any later version of vim. |
| 21 | $ ! |
| 22 | $ ! This program is distributed in the hope that it will be useful, |
| 23 | $ ! but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 24 | $ ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 25 | $ ! |
| 26 | $ !===================================================================== |
| 27 | $ ! |
| 28 | $ ! |
| 29 | $ ! Check for the existence of VIM, and die if it isn't there. |
| 30 | $ ! |
| 31 | $ if f$search ("vim:vim.exe") .eqs. "" |
| 32 | $ then |
Bram Moolenaar | 84a05ac | 2013-05-06 04:24:17 +0200 | [diff] [blame] | 33 | $ write sys$error "Error - Can't run tutorial. VIM not found." |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 34 | $ exit |
| 35 | $ endif |
| 36 | $ ! |
| 37 | $ ! |
| 38 | $ ! Pick up the argument, if any. |
| 39 | $ ! |
| 40 | $ inx = 0 |
| 41 | $ arg_loop: |
| 42 | $ inx = inx + 1 |
| 43 | $ if f$type (p'inx') .nes. "" |
| 44 | $ then |
| 45 | $ if p'inx' .nes. "" .and. f$locate ("-", p'inx') .ne. 0 |
| 46 | $ then |
| 47 | $ xx = p'inx' |
| 48 | $ assign/nolog "''xx'" xx |
| 49 | $ p'inx' = "" |
| 50 | $ endif |
| 51 | $ goto arg_loop |
| 52 | $ endif |
| 53 | $ ! |
| 54 | $ ! |
| 55 | $ ! Make sure we clean up our toys when we're through playing. |
| 56 | $ ! |
| 57 | $ on error then goto exit |
| 58 | $ ! |
| 59 | $ ! |
| 60 | $ ! Create the VIM foreign command if needed |
| 61 | $ ! |
| 62 | $ if f$type (vim) .eqs. "" then vim := $vim:vim |
| 63 | $ ! |
| 64 | $ ! |
| 65 | $ ! Build the name for our temp file. |
| 66 | $ ! |
| 67 | $ tutfil = "sys$login:vimtutor_" + - |
| 68 | f$edit (f$getjpi (0, "pid"), "trim") + "." |
| 69 | $ assign/nolog 'tutfil' TUTORCOPY |
| 70 | $ ! |
| 71 | $ ! |
| 72 | $ ! Copy the selected file to the temp file |
| 73 | $ ! |
| 74 | $ assign/nolog/user nla0: sys$error |
| 75 | $ assign/nolog/user nla0: sys$output |
| 76 | $ vim -u "NONE" -c "so $VIMRUNTIME/tutor/tutor.vim" |
| 77 | $ ! |
| 78 | $ ! |
| 79 | $ ! Run the tutorial |
| 80 | $ ! |
| 81 | $ assign/nolog/user sys$command sys$input |
| 82 | $ vim -u "NONE" -c "set nocp" 'p1' 'p2' 'p3' 'p4' 'p5' 'p6' 'p7' 'p8' 'tutfil' |
| 83 | $ ! |
| 84 | $ ! |
| 85 | $ ! Ditch the copy. |
| 86 | $ ! |
| 87 | $ exit: |
| 88 | $ if f$type (tutfil) .nes. "" .and. f$search (tutfil) .nes. "" then - |
| 89 | $ delete 'tutfil';* |
| 90 | $ if f$type (xx) .nes. "" then deassign xx |
| 91 | $ deassign TUTORCOPY |
| 92 | $ exit |
| 93 | $ ! |
| 94 | $ !===================================================================== |
| 95 | $ ! |
| 96 | $ ! Modification history |
| 97 | $ ! |
| 98 | $ ! 29-Aug-2002 T. R. Wyant |
| 99 | $ ! Changed license to vim. |
| 100 | $ ! Fix error "input is not from a terminal" |
| 101 | $ ! Juggle documentation (copyright and contact to front, |
| 102 | $ ! modification history to end). |
| 103 | $ ! 25-Jul-2002 T. R. Wyant |
| 104 | $ ! Initial version |